Glen Pitt-Pladdy :: BlogNokia 5800 ExpressMusic M3U Playlists - Unix tricks | |||
Like most people in the world of Unix, I automate anything that I do routinely. One thing is syncing music to my phone, a Nokia 5800 ExpressMusic. Transferring MusicLike many Nokia phones this is great for Unix / Linux people since it can be connected as a standard USB storage device (disk), and to transfer music all you do is drop the files on the phone as you would with any disk. Even better, rsync the files to the phone. The catch is that the SD card has a FAT32 filesystem which has several deficiencies and it doesn't play nice with rsync defaults orientated to a fully featured Unix filesystem. It's a good idea to backup everything before doing stuff like this since if the command it slightly wrong it could delete other data. You may also like to add the --dry-run option to test before running the rsync command for real. The basic command I use in my scripts is:
rsync -rtv --modify-window=1 \ This will sync an entire directory structure, preserving times, but allow one second variance when it compares file times due to the 2 second resolution of FAT filesystems. It also excludes cover.jpg files which may be used by some playback software for cover art, and provides a file to list patterns which you want to exclude. In my case I produce this list from low scoring files from my IMMS database. Directory PlaylistsThe 5800 (and presumably other recent Symbian phones) recognise standard M3U Format playlist files (although their own playlists are in SQLite databases), but use DOS paths (ie. "\" instead of "/" for directory separators). It is relatively easy to script up making a playlist from a directory tree on the phone:
CURRENTDIR=`pwd` This will create a relative path playlist of all files ending .mp3 in the music directory you rsynced to. Note that rsync will nuke this each time so you may want to add this in to the script after each rsync to create a fresh playlist. Translating PlaylistsIf you have an existing M3U playlist and need to strip paths (eg. absolute paths) to transfer it to the phone:
CURRENTDIR=`pwd` This will pull in all the lines in the source playlist ending with .mp3, strip the absolute path pattern you specify, check the file exists under the destination (ie. you didn't exclude it in your rsync) and translate to DOS paths. CSV scores to PlaylistI periodically dump my IMMS database scores to a .csv file (without quotes) in the format: SCORE,/PATH/TO/MP3 This is easy to make into an M3U playlist cherry picking the highest scores:
CURRENTDIR=`pwd` This will grab lines with scores of 90 to 100, removing the score, and then like before, strips the absolute path pattern, checks the file exists, and translates paths. |
|||
Disclaimer: This is a load of random thoughts, ideas and other nonsense and is not intended to be taken seriously. I have no idea what I am doing with most of this so if you are stupid and naive enough to believe any of it, it is your own fault and you can live with the consequences. More importantly this blog may contain substances such as humor which have not yet been approved for human (or machine) consumption and could seriously damage your health if taken seriously. If you still feel the need to litigate (or whatever other legal nonsense people have dreamed up now), then please address all complaints and other stupidity to yourself as you clearly "don't get it".
Copyright Glen Pitt-Pladdy 2008-2023
|
Comments: