|excetara2 ||12-02-2010 01:54 AM |
Script to Copy/Sync Playlists and Music to Blackberry
This is a script I wrote to copy my playlists and associated Music from rhythmbox over to a blackberry. All my music is in a Music Folder and I output the playlist files from rhythmbox into the Music folder so it uses relative indexing (rhythmbox will use relative if it can so all music in the playlist is contained in that music folder. If not, it will use absolute paths). Then the same directory structure is set up on the blackberry and music is transferred as well as the same playlists in a format blackberry understands.
I may write a rhythmbox plugin for this if I get time because shouldn't be difficult and would fully automate the process. There may already be an easier way to do this I just didn't find one relatively quickly.
Note: If it uses absolute paths so my setup above isn't followed the script would need to be slightly modified.
- Change dirBlackMusic to the blackberry mount location (should be '/media/???????/BlackBerry/music/' where ?????? is whatever your system decides)
- Change dirCompMusic to your music folder
- Set-up so you input playlist without the .m3u etension (make sure to output playlists from rhythmbox as .m3u) and if you just hit enter and input nothing it runs the playlists set in listPlaylist
- Note: dirPlayNameBlack was for absolute paths on blackberry but currently not using it in the script because using relative on PC and blackberry.
Need to comment the code below but any questions just ask.
d = os.path.dirname(f)
if not os.path.exists(d):
inputPlaylist = raw_input('Enter Name of Playlist:')
inputPlaylist += '.m3u'
if (inputPlaylist == '.m3u'):
listPlaylist = ['Blackberry.m3u','Acoust.m3u','Country.m3u','LiamTomTom.m3u','New Great.m3u','PowerHour.m3u','That Stanky Shit.m3u','Other Stuff.m3u'] #Works on spaces properly but need \' and \"
listPlaylist = inputPlaylist
dirCompMusic = '/mnt/data/Music/'
dirBlackMusic = '/media/424D-549E/BlackBerry/music/'
dirBlackPlaylist = dirBlackMusic
dirPlayNameBlack = 'file:///SDCard/BlackBerry/music'
for namePlaylist in listPlaylist:
readPlay = open(namePlaylist, 'r')
writePlay = open(dirBlackMusic + namePlaylist, 'w')
for line in readPlay:
line = line.strip()
if (line == '#'):
line = line.replace('"','\"')
line = line.replace("'","\'")
dirBlackPath = dirBlackMusic + line
if (not os.path.isfile(dirBlackPath)):
#ospath = line.replace(' ','\\ ')
# os.system("cp %s %s" % (ospath, blackberrypath))
playNameBlack = line.replace(' ','%20')
writePlay.write(playNameBlack + '\n')
print "Please Mount your Blackberry or Change dirBlackMusic to reflect music Folder"
|All times are GMT -5. The time now is 04:31 PM. || |
Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.