July 22, 2011, 08:30:49 Last Edit: July 26, 2011, 10:20:03 by rude
Hi.
I'm new to gmb: it's simply fan-ta-stic!!!
I'm testing it before importing all my music (42000 music files) in it.
At now I've imported about 10000, everything is fine, I'm very happy with it, but I realize I need to move music folders from one disk to another.
What's the right way to do it? Mass moving doesn't work for me (covers files...) and I'm afraid to lose all job done up to now...
Pleeze...
THX, byez :)

The best way currently is probably to edit the gmbrc file directly with this command :

perl -pi.premove -e 's#/mnt/OLD_FOLDER/#/home/MYNAME/Music/#g' ~/.config/gmusicbrowser/gmbrc

(a gmbrc.premove backup will be created)
replace the /mnt/OLD_FOLDER/ and /home/MYNAME/Music/ by the correct folders
and replace "gmbrc" by "tags" if you are still using version 1.0.x

An even better way is not having to change the folder at all, by using symbolic links, that way your music can always be in, for example, ~/Music/ no matter in what real folder it is.

#2 July 22, 2011, 17:28:03 Last Edit: July 22, 2011, 17:29:59 by rude
Thank you.
Sorry, it doesn't work on my system...
I need to move/copy all my files cause I need them on an unique HD, and the current one is too much small (250 GB, but I need at least 1 TB).
Here the command I gave:
perl -pi.premove -e 's#/mnt/home/ego/Scrivania/2001 My Music/#/home/ego/Musica/#g' ~/.config/gmusicbrowser/gmbrc

Is that right? Sorry, I'm not practiced with Perl, at all...
After command, no result (no file in /Musica...) Am  I wrong?

The command only update gmusicbrowser's library, it doesn't move any files.
You can move the files as you want, from the command line it would be :
mv "/mnt/home/ego/Scrivania/2001 My Music/" /home/ego/Musica/

No result, sorry.
GMB 1.1.7. I'm using folder >>> 010 Big Dreamers Never Sleep (1987) with 11 files in it (9 >mp3 and 2 >covers)
The folder is in /home/ego/Scrivania so I load it in gmb by scanning /Scrivania. OK. Then I play some music and rate it, seeing covers. OK. In Browser I can see changes. OK.
Then perl -pi.premove -e 's#/home/ego/Scrivania/010 Big Dreamers Never Sleep (1987)/#/home/ego/Musica/#g' ~/.config/gmusicbrowser/gmbrc and mv "/home/ego/Scrivania/010 Big Dreamers Never Sleep (1987)/" /home/ego/Musica/
Back in Settings, I add /home/ego/Musica and scan it.
I have LOST all of my ratings and play counts.... NOK!!! >:(

Sure I'm wronging somewhat... what?
Thanks

#5 July 22, 2011, 18:20:19 Last Edit: July 22, 2011, 18:30:16 by laite
Quote from: rude on July 22, 2011, 18:09:03
I have LOST all of my ratings and play counts.... NOK!!! >:(

I managed to do this manually when changed my music folder, it's not pretty but it worked.

0) close gmb
1) open ~/.config/gmusicbrowser/gmbrc with some editor that is capable of handling large text files (gedit is fine)
2) scroll down until you see different tracks and their filepaths
3) then just find+replace all these from "oldfolder" to "newfolder"
4) start gmb

There is no need to scan anything again in gmb, since filepaths have been changed in gmbrc. But as I said, this worked for me, but it might have some problems which I didn't consider.

edit: I guess that in addition to tracks' paths, you should also change "LibraryPath".

edit2: currently I'm using symlink my music folder to ~/Music/ as Quentin suggested. This allows me to dual-boot and just copy-paste gmbrc from system to another without need to change anything.

Thank laite too  :)
Last rows of my gmbrc are:
Quote[Songs]
added   album   album_artist_raw   artist   bitrate   channel   comment   compilation   disc   file   filetype   genre   grouping   label   lastplay   lastskip   length   missing   modif   path   playcount   rating   replaygain_album_gain   replaygain_album_peak   replaygain_track_gain   replaygain_track_peak   samprate   size   skipcount   title   track   version   year
10   1311356911   Big Dreamers Never Sleep      Gino Vannelli   128   2      0   0   001 Gino Vannelli -1- In the Name of Money.mp3   mp3 l3v1            0   0   235   0   1303765294   /home/ego/Musica/010 Big Dreamers Never Sleep (1987)   0      0   0   0   0   44100   3772325   0   In the Name of Money   1      1987
11   1311356911   Big Dreamers Never Sleep      Gino Vannelli   128   2      0   0   002 Gino Vanelli - 2-Time out.mp3   mp3 l3v1            0   0   279   0   1303765294   /home/ego/Musica/010 Big Dreamers Never Sleep (1987)   0      0   0   0   0   44100   4462960   0   Time out   2      1987
12   1311356911   Big Dreamers Never Sleep      Gino Vannelli   128   2      0   0   004 gino vannelli -4- Young lover.mp3   mp3 l3v1            0   0   203   0   1303765294   /home/ego/Musica/010 Big Dreamers Never Sleep (1987)   0      0   0   0   0   44100   3248789   0   Young Lover   4      1987
13   1311356911   Big Dreamers Never Sleep      Gino Vannelli   160   2      0   0   003 Gino Vanelli -3- Wild Horses.mp3   mp3 l3v1            0   0   280   0   1303765294   /home/ego/Musica/010 Big Dreamers Never Sleep (1987)   0      0   0   0   0   44100   5605452   0   Wild Horses   3      1987
14   1311356911   Big Dreamers Never Sleep      Gino Vannelli   128   2      0   0   007 gino vannelli - 7-something tells me.mp3   mp3 l3v1            0   0   261   0   1303765294   /home/ego/Musica/010 Big Dreamers Never Sleep (1987)   0      0   0   0   0   44100   4176658   0   Something tells me   7      1987
15   1311356911   Big Dreamers Never Sleep      Gino Vannelli   160   2      0   0   009 gino vannelli - 09- King For A Day.mp3   mp3 l3v1            0   0   271   0   1303765294   /home/ego/Musica/010 Big Dreamers Never Sleep (1987)   0      0   0   0   0   44100   5417370   0   King For A Day   9      1987
16   1311356911   Big Dreamers Never Sleep      Gino Vannelli   160   2      0   0   006 Gino Vanelli - 6-Persona Non Grata.mp3   mp3 l3v1            0   0   258   0   1303765300   /home/ego/Musica/010 Big Dreamers Never Sleep (1987)   0      0   0   0   0   44100   5161893   0   Persona non grata   6      1987
17   1311356911   Big Dreamers Never Sleep      Gino Vannelli   128   2      0   0   005 Gino Vanelli - 5-down with love.mp3   mp3 l3v1            0   0   268   0   1303765294   /home/ego/Musica/010 Big Dreamers Never Sleep (1987)   0      0   0   0   0   44100   4281984   0   Down With Love   5      1987
18   1311356911   Big Dreamers Never Sleep      Gino Vannelli   167   2      0   0   008 Gino Vanelli - 8-Shape me like a man.mp3   mp3 l3v1            0   0   292   0   1303765294   /home/ego/Musica/010 Big Dreamers Never Sleep (1987)   0      0   0   0   0   44100   6092017   0   Shape me like a man   8      1987

[album]
album_picture
Big Dreamers Never Sleep\x00   /home/ego/Musica/010 Big Dreamers Never Sleep (1987)/Gino_Vannelli_-_Big_Dreamers_Never_Sleep-front.jpg
I suppose it should be fine... but again i lose ratings, counts, etc...
I'll go symbolic, if nothing else helps....

#7 July 22, 2011, 20:53:22 Last Edit: July 22, 2011, 20:55:12 by Quentin Sculo
2 things
1) gmusicbrowser must NOT be running while you run the perl -pi... command
2) make sure you replace by the exact same folder, if you move everything that was in /A/ into /B/ use :
perl -pi.premove -e 's#/A/#/B/#g' ~/.config/gmusicbrowser/gmbrc

you can move the files however you want, use a graphical file browser if you want. If you use the command line, to do this move would be :
mv /A/* /B/
note the "*" : it means all the subfolders from /A/ will be put in /B/, so A/some_file.mp3 will now be /B/some_file.mp3
if you do "mv /A/ /B/" it means A/ and its subfolders will be put in B, so A/some_file.mp3 will now be /B/A/some_file.mp3, in that case you would have to do s#/A/#/B/A/#g in the perl command.

Then you can run gmusicbrowser, if it worked, the files should be where you want them, you should NOT need to re-scan them.
In any case, if you make mistakes, note that you have a few backups of gmbrc (that contains gmusicbrowser's DB) in ~/.config/gmusicbrowser/

#8 July 22, 2011, 23:07:01 Last Edit: July 22, 2011, 23:11:19 by rude
Quote from: Quentin Sculo on July 22, 2011, 20:53:22
2 things
1) gmusicbrowser must NOT be running while you run the perl -pi... command
2) make sure you replace by the exact same folder, if you move everything that was in /A/ into /B/ use :
perl -pi.premove -e 's#/A/#/B/#g' ~/.config/gmusicbrowser/gmbrc

you can move the files however you want, use a graphical file browser if you want.

I'm going crazy...  :o
Target: to move folder "VANNELLI" scanned and tagged in gmb from /home/ego/Scrivania to /home/ego/Musica without losing gmb data and tags

OK, let's start...
1- in gmb I can play files, add rating and follow playcounts...
2- quit gmb
3- gedit ~/.config/gmusicbrowser/gmbrc
Quote[Songs]
added   album   album_artist_raw   artist   bitrate   channel   comment   compilation   disc   file   filetype   genre   grouping   label   lastplay   lastskip   length   missing   modif   path   playcount   rating   replaygain_album_gain   replaygain_album_peak   replaygain_track_gain   replaygain_track_peak   samprate   size   skipcount   title   track   version   year
1   1311374587   Big Dreamers Never Sleep      Gino Vannelli   128   2      0   0   001 Gino Vannelli -1- In the Name of Money.mp3   mp3 l3v1            1311374684   0   235   0   1303765294   /home/ego/Scrivania/VANNELLI   1   60   0   0   0   0   44100   3772325   0   In the Name of Money   1      1987
2   1311374587   Big Dreamers Never Sleep      Gino Vannelli   128   2      0   0   002 Gino Vanelli - 2-Time out.mp3   mp3 l3v1            1311374687   0   279   0   1303765294   /home/ego/Scrivania/VANNELLI   1   60   0   0   0   0   44100   4462960   0   Time out   2      1987
3   1311374587   Big Dreamers Never Sleep      Gino Vannelli   128   2      0   0   004 gino vannelli -4- Young lover.mp3   mp3 l3v1            1311374692   0   203   0   1303765294   /home/ego/Scrivania/VANNELLI   1   100   0   0   0   0   44100   3248789   0   Young Lover   4      1987
4   1311374587   Big Dreamers Never Sleep      Gino Vannelli   160   2      0   0   003 Gino Vanelli -3- Wild Horses.mp3   mp3 l3v1            1311374712   0   280   0   1303765294   /home/ego/Scrivania/VANNELLI   2   20   0   0   0   0   44100   5605452   0   Wild Horses   3      1987
5   1311374587   Big Dreamers Never Sleep      Gino Vannelli   128   2      0   0   007 gino vannelli - 7-something tells me.mp3   mp3 l3v1            1311374700   0   261   0   1303765294   /home/ego/Scrivania/VANNELLI   1   20   0   0   0   0   44100   4176658   0   Something tells me   7      1987
6   1311374587   Big Dreamers Never Sleep      Gino Vannelli   160   2      0   0   009 gino vannelli - 09- King For A Day.mp3   mp3 l3v1            1311374707   0   271   0   1303765294   /home/ego/Scrivania/VANNELLI   1   100   0   0   0   0   44100   5417370   0   King For A Day   9      1987
7   1311374587   Big Dreamers Never Sleep      Gino Vannelli   160   2      0   0   006 Gino Vanelli - 6-Persona Non Grata.mp3   mp3 l3v1            1311374698   0   258   0   1303765300   /home/ego/Scrivania/VANNELLI   1   40   0   0   0   0   44100   5161893   0   Persona non grata   6      1987
8   1311374587   Big Dreamers Never Sleep      Gino Vannelli   128   2      0   0   005 Gino Vanelli - 5-down with love.mp3   mp3 l3v1            1311374695   0   268   0   1303765294   /home/ego/Scrivania/VANNELLI   1   80   0   0   0   0   44100   4281984   0   Down With Love   5      1987
9   1311374587   Big Dreamers Never Sleep      Gino Vannelli   167   2      0   0   008 Gino Vanelli - 8-Shape me like a man.mp3   mp3 l3v1            1311374704   0   292   0   1303765294   /home/ego/Scrivania/VANNELLI   2   20   0   0   0   0   44100   6092017   0   Shape me like a man   8      1987

[album]
album_picture
Big Dreamers Never Sleep\x00   /home/ego/Scrivania/VANNELLI/Gino_Vannelli_-_Big_Dreamers_Never_Sleep-front.jpg
4- from shell: perl -pi.premove -e 's#/home/ego/Scrivania/VANNELLI/#/home/ego/Musica/#g' ~/.config/gmusicbrowser/gmbrc
5- In Nautilus window I can see file gmbrc date/time refreshing to actual, so I'm sure something happened...
6- gedit ~/.config/gmusicbrowser/gmbrc
Quote[Songs]
added   album   album_artist_raw   artist   bitrate   channel   comment   compilation   disc   file   filetype   genre   grouping   label   lastplay   lastskip   length   missing   modif   path   playcount   rating   replaygain_album_gain   replaygain_album_peak   replaygain_track_gain   replaygain_track_peak   samprate   size   skipcount   title   track   version   year
1   1311374587   Big Dreamers Never Sleep      Gino Vannelli   128   2      0   0   001 Gino Vannelli -1- In the Name of Money.mp3   mp3 l3v1            1311374684   0   235   0   1303765294   /home/ego/Scrivania/VANNELLI   1   60   0   0   0   0   44100   3772325   0   In the Name of Money   1      1987
2   1311374587   Big Dreamers Never Sleep      Gino Vannelli   128   2      0   0   002 Gino Vanelli - 2-Time out.mp3   mp3 l3v1            1311374687   0   279   0   1303765294   /home/ego/Scrivania/VANNELLI   1   60   0   0   0   0   44100   4462960   0   Time out   2      1987
3   1311374587   Big Dreamers Never Sleep      Gino Vannelli   128   2      0   0   004 gino vannelli -4- Young lover.mp3   mp3 l3v1            1311374692   0   203   0   1303765294   /home/ego/Scrivania/VANNELLI   1   100   0   0   0   0   44100   3248789   0   Young Lover   4      1987
4   1311374587   Big Dreamers Never Sleep      Gino Vannelli   160   2      0   0   003 Gino Vanelli -3- Wild Horses.mp3   mp3 l3v1            1311374712   0   280   0   1303765294   /home/ego/Scrivania/VANNELLI   2   20   0   0   0   0   44100   5605452   0   Wild Horses   3      1987
5   1311374587   Big Dreamers Never Sleep      Gino Vannelli   128   2      0   0   007 gino vannelli - 7-something tells me.mp3   mp3 l3v1            1311374700   0   261   0   1303765294   /home/ego/Scrivania/VANNELLI   1   20   0   0   0   0   44100   4176658   0   Something tells me   7      1987
6   1311374587   Big Dreamers Never Sleep      Gino Vannelli   160   2      0   0   009 gino vannelli - 09- King For A Day.mp3   mp3 l3v1            1311374707   0   271   0   1303765294   /home/ego/Scrivania/VANNELLI   1   100   0   0   0   0   44100   5417370   0   King For A Day   9      1987
7   1311374587   Big Dreamers Never Sleep      Gino Vannelli   160   2      0   0   006 Gino Vanelli - 6-Persona Non Grata.mp3   mp3 l3v1            1311374698   0   258   0   1303765300   /home/ego/Scrivania/VANNELLI   1   40   0   0   0   0   44100   5161893   0   Persona non grata   6      1987
8   1311374587   Big Dreamers Never Sleep      Gino Vannelli   128   2      0   0   005 Gino Vanelli - 5-down with love.mp3   mp3 l3v1            1311374695   0   268   0   1303765294   /home/ego/Scrivania/VANNELLI   1   80   0   0   0   0   44100   4281984   0   Down With Love   5      1987
9   1311374587   Big Dreamers Never Sleep      Gino Vannelli   167   2      0   0   008 Gino Vanelli - 8-Shape me like a man.mp3   mp3 l3v1            1311374704   0   292   0   1303765294   /home/ego/Scrivania/VANNELLI   2   20   0   0   0   0   44100   6092017   0   Shape me like a man   8      1987

[album]
album_picture
Big Dreamers Never Sleep\x00   /home/ego/Musica/Gino_Vannelli_-_Big_Dreamers_Never_Sleep-front.jpg
SO NOTHING HAPPENED!!!
Let's go on...
7- Graphically I move VANNELLI from .../Scrivania to .../Musica
8- run gmb: <Playlist Empty> ...sigh!
9- gmb Settings/Library: add folder to search for new songs > /home/ego/Musica
10- library gets populated with my songs, but I've lost my work in tags, ratings, counts, etc...
11- quit gmb
12- gedit ~/.config/gmusicbrowser/gmbrc AT LAST:
Quote[Songs]
added   album   album_artist_raw   artist   bitrate   channel   comment   compilation   disc   file   filetype   genre   grouping   label   lastplay   lastskip   length   missing   modif   path   playcount   rating   replaygain_album_gain   replaygain_album_peak   replaygain_track_gain   replaygain_track_peak   samprate   size   skipcount   title   track   version   year
10   1311375808   Big Dreamers Never Sleep      Gino Vannelli   128   2      0   0   001 Gino Vannelli -1- In the Name of Money.mp3   mp3 l3v1            0   0   235   0   1303765294   /home/ego/Musica/VANNELLI   0      0   0   0   0   44100   3772325   0   In the Name of Money   1      1987
11   1311375808   Big Dreamers Never Sleep      Gino Vannelli   128   2      0   0   002 Gino Vanelli - 2-Time out.mp3   mp3 l3v1            0   0   279   0   1303765294   /home/ego/Musica/VANNELLI   0      0   0   0   0   44100   4462960   0   Time out   2      1987
12   1311375808   Big Dreamers Never Sleep      Gino Vannelli   128   2      0   0   004 gino vannelli -4- Young lover.mp3   mp3 l3v1            0   0   203   0   1303765294   /home/ego/Musica/VANNELLI   0      0   0   0   0   44100   3248789   0   Young Lover   4      1987
13   1311375808   Big Dreamers Never Sleep      Gino Vannelli   160   2      0   0   003 Gino Vanelli -3- Wild Horses.mp3   mp3 l3v1            0   0   280   0   1303765294   /home/ego/Musica/VANNELLI   0      0   0   0   0   44100   5605452   0   Wild Horses   3      1987
14   1311375808   Big Dreamers Never Sleep      Gino Vannelli   128   2      0   0   007 gino vannelli - 7-something tells me.mp3   mp3 l3v1            0   0   261   0   1303765294   /home/ego/Musica/VANNELLI   0      0   0   0   0   44100   4176658   0   Something tells me   7      1987
15   1311375808   Big Dreamers Never Sleep      Gino Vannelli   160   2      0   0   009 gino vannelli - 09- King For A Day.mp3   mp3 l3v1            0   0   271   0   1303765294   /home/ego/Musica/VANNELLI   0      0   0   0   0   44100   5417370   0   King For A Day   9      1987
16   1311375808   Big Dreamers Never Sleep      Gino Vannelli   160   2      0   0   006 Gino Vanelli - 6-Persona Non Grata.mp3   mp3 l3v1            0   0   258   0   1303765300   /home/ego/Musica/VANNELLI   0      0   0   0   0   44100   5161893   0   Persona non grata   6      1987
17   1311375808   Big Dreamers Never Sleep      Gino Vannelli   128   2      0   0   005 Gino Vanelli - 5-down with love.mp3   mp3 l3v1            0   0   268   0   1303765294   /home/ego/Musica/VANNELLI   0      0   0   0   0   44100   4281984   0   Down With Love   5      1987
18   1311375808   Big Dreamers Never Sleep      Gino Vannelli   167   2      0   0   008 Gino Vanelli - 8-Shape me like a man.mp3   mp3 l3v1            0   0   292   0   1303765294   /home/ego/Musica/VANNELLI   0      0   0   0   0   44100   6092017   0   Shape me like a man   8      1987

[album]
album_picture
Big Dreamers Never Sleep\x00   /home/ego/Musica/VANNELLI/Gino_Vannelli_-_Big_Dreamers_Never_Sleep-front.jpg

WHY?!?  :'( :'( :'(
[tested on Mint 11 and Debian]

I think the problem is the terminal slash "/", try :
perl -pi.premove -e 's#/home/ego/Scrivania/VANNELLI#/home/ego/Musica#g' ~/.config/gmusicbrowser/gmbrc
instead of :
perl -pi.premove -e 's#/home/ego/Scrivania/VANNELLI/#/home/ego/Musica/#g' ~/.config/gmusicbrowser/gmbrc

make sure that either they both end with a "/" or that none does.
I usually put hte termianl slash in the example I give to avoid the rare problem of replacing /home/ego/Scrivania/VANNELLI_ANOTHER_FOLDER by /home/ego/Musica_ANOTHER_FOLDER
but of course when using a terminal "/" files that are not in subfolders will not be moved as gmbrc doesn't have the terminal "/"
This method is more meant to be used on the root of the library, that usually doesn't contain files itself. Rather than move each folder one at a time.

Quote from: Quentin Sculo on July 22, 2011, 23:23:01
I think the problem is the terminal slash "/", try :
perl -pi.premove -e 's#/home/ego/Scrivania/VANNELLI#/home/ego/Musica#g' ~/.config/gmusicbrowser/gmbrc

OK, that's good... so and so...  ;)
Now the Perl script (without final '/') correctly overwrites gmbrc.
But, relaunching gmb, my settings are always lost: it reads VANNELLI in /home/ego/Musica, but nothing more than that. No counts, ratings...

Goin' to try again...

Question: how has to be set Settings/Library/ FoldersToSearch before and after filemoving?

Thank You  :)

Quote from: rude on July 23, 2011, 07:55:47
Question: how has to be set Settings/Library/ FoldersToSearch before and after filemoving?
Just like the rest "/home/ego/Scrivania/VANNELLI" will be replaced by "/home/ego/Musica"
In case I wasn't clear, that's all this perl command does, it replaces one string by another, so there is no reason for the rating or anything else to have changed.

#12 July 23, 2011, 11:58:50 Last Edit: July 23, 2011, 12:30:35 by rude
OK, that's not the problem.
The real problem is that the perl command tells gmbrc where will be stored FILES I'm going to move, but what really I want to move is a WHOLE HIERARCHICAL SYSTEM of nested FOLDERS and - finally - files.
So , if I move files only, everything is fine (tags etc.), but if I move all folders gmbrc doesnt find the files it is searching, so I need to rescan and newly rescanned files are "new" with-no-tags.
Here is the problem, isn't it?
:)

If you just move the whole hierarchy of folders from one root to another, then using the perl command will work fine.
If you want to completely change the hierarchy of folders, then it will probably not work, unless you update each change with the appropriate perl command.

The other method is currently to move all your files how you want them, remove all the files from the library in gmb (the song data are kept in gmb's DB for a number of sessions), and then rescan, if the files have either the same filename or the same path, and the same title/album/artist/size, they will be recognized, and the playcount/rating/... will be kept.
Sadly, the picture assignations for artists and albums will be lost, in v1.1.7 you can tell gmb to re-select automatically the album's pictures by selecting 2 or more albums and choosing "auto-select pictures" in the context menu, though it might not choose the correct ones.
I know that method is far from perfect, but it's complicated to get things right. I plan to soon remove the requirement of removing the songs first.

Did it. Pheeww...  8) no loss.
Many many thanks!
GMB is big, waiting for 1.2 and more...

Byez