songs aren't stored in album dir, all of them stay in artist dir and an empty album dir is created

Bug #727469 reported by David Gamba
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Rhythmbox Fileorganizer
Fix Released
Medium
lachlan-00

Bug Description

Rhythmbox 0.13.1
When I run the organize selection it will properly rename the file but it won't put the songs inside the album dir, it just creates an empty one and leaves the songs all together in the artist dir.

Revision history for this message
David Gamba (davidgamba) wrote :
Revision history for this message
David Gamba (davidgamba) wrote :

I followed the output of the targetdir variable in fileops.py

 59 targetdir = self.fo.configurator.get_val('folder').get_string()
 60 targetdir = tools.data_filler(self, targetdir)
 61 targetdir = tools.folderize(self.fo.configurator, targetdir)

in line 59 it is: targetdir: $artist/$album
in line 60 it is: targetdir: Natalie Grant/Wow 2006
in line 61 it is: targetdir: /home/gambad/Music/Natalie Grant

As you can see the problem comes after calling: tools.folderize(self.fo.configurator, targetdir)
the return from that is missing the album name

Revision history for this message
lachlan-00 (lachlan-00) wrote :

Wait, it's started doing that to me too!

Somewhere between the 25th of january and yesterday. (the last times i used fileorganizer) it has cut out the second half of the string after the slash '$artist/($year) $album'.

a lot in gnome/python has been changing lately and i've been using experimental packages to get gnome-shell.
There must be something going on here.

Are you using a stable version of gnome and python?

Revision history for this message
lachlan-00 (lachlan-00) wrote :

i changed folderize in tools.py to this and try it out.
it seems that os.path.dirname needs a trailing / when returning a value

Another test would be to add a / to the end of your folder variable in gconf first and test that out before changing anything.

# Create a folder if non-existant, and return it
def folderize(configurator, folder):
    dirname = ((configurator.get_val('library_locations').get_list())[0].get_string() + '/').replace('file:///','/')
    fullpath = (dirname + folder + '/')
    if not os.path.exists(fullpath):
        os.makedirs(fullpath)
    return os.path.dirname(fullpath)

Changed in rb-fileorganizer:
status: New → In Progress
importance: Undecided → Medium
assignee: nobody → derWaarden (lachlan-00)
Revision history for this message
lachlan-00 (lachlan-00) wrote :

Adding / to the end of the folder variable fixed it for me.

Let me know how you go.

Revision history for this message
David Gamba (davidgamba) wrote :

Adding / at the end of the folder variable in gconf fixed for me, though it would be nice to have a backup option (in case one forgets) so I made this patch.

I also changed the default in configurator.py for it con contain a / at the end

PS: My brother tried the patch you made and it didn't work for him so I treated the fullpath as a string instead.
PPS: your plugin rocks, I have been looking for so long for something like this!!! :)

--- tools.py~ 2011-03-01 11:38:39.317607842 -0600
+++ tools.py 2011-03-02 10:33:17.377155000 -0600
@@ -14,9 +14,10 @@
 # Create a folder if non-existant, and return it
 def folderize(configurator, folder):
     dir = ((configurator.get_val('library_locations').get_list())[0].get_string() + '/').replace('file:///','/')
- if not os.path.exists(dir + folder):
- os.makedirs(dir + folder)
- return os.path.dirname(dir + folder)
+ fullpath = str(dir) + folder + '/'
+ if not os.path.exists(fullpath):
+ os.makedirs(fullpath)
+ return os.path.dirname(fullpath)

 # Replace the placeholders with the correct values
 def data_filler(file, string):

Revision history for this message
David Gamba (davidgamba) wrote :

Does the program changes song metadata at all? it is just that before the fix I did some tests and messed up with a directory and now I have:
/home/$user/Music/$artist/$album1/$album2/$album3/$album4/

and a bunch of songs in each album dir.

I have no idea on how to fix it. I deleted rhythmbox database, moved all songs to the $artist dir and ran rhythmbox again and it then organized things and it changed them to that again.

Revision history for this message
lachlan-00 (lachlan-00) wrote :

dir is already a string when you pull it out (the .get_string() part)

library_locations is a list so you can have multiple locations. (Music/sorted, Music/unsorted, Music/new, Music/etc)
The 'dir =' line will get the value, pull the list out and take the first item in the list and make it a string.

I think i'm going to add a function that will check the string is a valid dir string where the first and last character is a /.
that way nobody has to put in a slash if they don't want to and those of us that do it to get past this bug don't have to change back.

Sorry if that didn't work for your brother i just wrote it up at work so i could get my files back to normal. ;)
I'll make a commit soon that will fix all this, should only need to edit tools.py

Glad you like! I searched forever for something like this too. I used to use multiple programs to do things like this and now rhythmbox can do it all without leaving the window.

Revision history for this message
lachlan-00 (lachlan-00) wrote :

Uninstall and reinstall a fresh copy of fileorganizer and try this:

change this line in tools.py

return os.path.dirname(dir + folder)
to
return os.path.normpath(dir + folder)

That worked well for me in testing with or without slashes.

Revision history for this message
lachlan-00 (lachlan-00) wrote :

I had the same problem and it's been working for me so i consider this fixed.

Try the latest commit if you're still having trouble but you should be fine.

Changed in rb-fileorganizer:
status: In Progress → Fix Committed
Revision history for this message
David Gamba (davidgamba) wrote : Re: [Bug 727469] Re: songs aren't stored in album dir, all of them stay in artist dir and an empty album dir is created

Sorry, I have been so busy lately at work that I haven't been able to look at
this anymore.

About your program the bug fix you implemented works perfectly, it is an
awesome pluggin.

Now I just have to figure out why the damaged files I have continue to get
misplaced even with the fix, this is not the case for new songs or current ones
that aren't damaged.

I think that the reason might be with the song metadata, maybe the bug
changed that.
It is so odd. Anyway Thank you so much for it and for the fast follow up!!!

David

On Fri, Mar 11, 2011 at 5:38 PM, derWaarden <email address hidden> wrote:
> I had the same problem and it's been working for me so i consider this
> fixed.
>
> Try the latest commit if you're still having trouble but you should be
> fine.
>
> ** Changed in: rb-fileorganizer
>       Status: In Progress => Fix Committed
>
> --
> You received this bug notification because you are a direct subscriber
> of the bug.
> https://bugs.launchpad.net/bugs/727469
>
> Title:
>  songs aren't stored in album dir, all of them stay in artist dir and
>  an empty album dir is created
>
> Status in Rhythmbox Fileorganizer:
>  Fix Committed
>
> Bug description:
>  Rhythmbox 0.13.1
>  When I run the organize selection it will properly rename the file but it won't put the songs inside the album dir, it just creates an empty one and leaves the songs all together in the artist dir.
>
> To unsubscribe from this bug, go to:
> https://bugs.launchpad.net/rb-fileorganizer/+bug/727469/+subscribe
>

lachlan-00 (lachlan-00)
Changed in rb-fileorganizer:
milestone: none → 1.1.0
lachlan-00 (lachlan-00)
Changed in rb-fileorganizer:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.