rhythmbox picks bad filenames for ipod
Submitted by Allison (desrt)
Link to original bug (#570600)
Description
get_ipod_filename() chooses the name for the file that will go on the ipod in approximately this way:
(0) start with a source filename (1) generate a random number from 0..99. call it 's' (2) stitch the following together: - iPodControl/Music/ - "F%02d" % (s,) - the first 27 characters of the original filename - the extension for the file (after transcoding)
i name my music like this:
artist - album - ## - title.flac
consider the album "one beat" by the artist "sleater-kinney".
sleater-kinney - one beat - 01 - one beat.flac sleater-kinney - one beat - 02 - faraway.flac sleater-kinney - one beat - 03 - oh!.flac sleater-kinney - one beat - 04 - the remainder.flac sleater-kinney - one beat - 05 - light rail coyote.flac sleater-kinney - one beat - 06 - step aside.flac sleater-kinney - one beat - 07 - combat rock.flac sleater-kinney - one beat - 08 - o₂.flac sleater-kinney - one beat - 09 - funeral song.flac sleater-kinney - one beat - 10 - prisstina.flac sleater-kinney - one beat - 11 - hollywood ending.flac sleater-kinney - one beat - 12 - sympathy.flac
these will get copied to the ipod like:
f**/sleater-kinney - one beat -.mp3 f**/sleater-kinney - one beat -.mp3 f**/sleater-kinney - one beat -.mp3 f**/sleater-kinney - one beat -.mp3 f**/sleater-kinney - one beat -.mp3 f**/sleater-kinney - one beat -.mp3 f**/sleater-kinney - one beat -.mp3 f**/sleater-kinney - one beat -.mp3 f**/sleater-kinney - one beat -.mp3 f**/sleater-kinney - one beat -.mp3 f**/sleater-kinney - one beat -.mp3 f**/sleater-kinney - one beat -.mp3
for random ** values between 00 and 99.
of course, due to the birthday paradox, it doesn't take very many tracks on an album before there is a very good chance of a collision occuring (one would expect a 50% chance of collision at ~10 tracks).
there are essentially three possible fixes:
- if we get a collision then try another random number
- use a different method, like the end of the filename instead of the start
- both
#1 has the drawback that if you have a very large number of files that start with the same string then you might easily get rhythmbox stuck in a loop.
#2 has the drawback that maybe the end of the filename isn't unique enough either (although in my case, this is where the titles are so it would be a vast improvement)