Fblade1987 Posted March 8, 2009 Share Posted March 8, 2009 Hey guys, I recently bought myself a cheap knock-off ipod shuffle, so it for a £2 and couldnt resist :P , however I've noticed it doesnt actually shuffle the songs it just plays albums/folders through and then onto the next. This got me thinking I could simulate a the shuffle experience by somehow randomizing the file names and moving all the files to the root of the mp3 player, but so that i would be able to reconize what songs are what when looking at them on a computer have something that will de-randomize the files back to their orignal state. Is there an script that could do this? or if not can anyone recommend a good language i could use that will work on all OS'S? and also could someone help me knock a quick and dirty one togther? Thanks matt Quote Link to comment Share on other sites More sharing options...
DingleBerries Posted March 8, 2009 Share Posted March 8, 2009 Python, C++, most all languages will do what you want. a = 1 b = 2 So read the name, translate, rename just leave out the characters M, P, 3 If I had time tonight I would... still not because its a bad idea. Quote Link to comment Share on other sites More sharing options...
Fblade1987 Posted March 8, 2009 Author Share Posted March 8, 2009 sorry if this may seem like a really daft question though, but what would i compile it too for it to work on all OS's? Quote Link to comment Share on other sites More sharing options...
xdmag Posted March 8, 2009 Share Posted March 8, 2009 A Python or Perl script would work on any OS, provided that you install the interpreter. Basic C/C++ should compile without change, but of course the binary produced is platform-specific. Compiled Java programs are supposed to work on all platforms. In this case I think a script will be the easiest and fastest to do. I suggest adding a random 4-digit number at the beginning of each filename. Makes it easy to de-randomize. Quote Link to comment Share on other sites More sharing options...
Fblade1987 Posted March 12, 2009 Author Share Posted March 12, 2009 can anyone help me produce one of these my brain is mush alately and just cant figure the logic out Quote Link to comment Share on other sites More sharing options...
soulbleed Posted March 16, 2009 Share Posted March 16, 2009 On Windows, something like this would work: for /f %%i in ('dir /b') do ( rename "%%i" "%random%-%%i" ) Edit: Just tried it, but for some reason %random% doesn't change. Quote Link to comment Share on other sites More sharing options...
ratmandall Posted March 16, 2009 Share Posted March 16, 2009 Well I was extra bored So I made a python script to help you do this, Make sure you run it in the directory with all your songs. You can download python here http://www.python.org/download/releases/2.5.4/ Once it has generated the random names, copy the folder of songs to your Ipod. Then you can hit enter and the script will change the songs back to their original state. [Tested on Ubuntu GNU/Linux, should work with windows tho.] #Run this in the directory with your songs, and DO NOT CLOSE this until you have recovered the names. raw_input("Are you sure you want to continue? Make sure not to exit prematurely.") import os,random chars = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"] old_new = {} for song in os.listdir('.'): if song.endswith((".mp3",".wav",".aac")) == True: new = str(random.randint(0,2000))+random.choice(chars)+song[-4:] old_new[new] = song os.rename(song,new) print "Generated random name" else: print "Unrecognized extension" def recover(): for old_song in os.listdir('.'): try: os.rename(old_song,old_new[old_song]) "Song name recovered...." except KeyError: pass raw_input("\nHave you copied the songs to your Ipod?") raw_input("Hit enter to recover the names") recover() It's a bit overkill :P but I love overkill D: Quote Link to comment Share on other sites More sharing options...
ls Posted March 16, 2009 Share Posted March 16, 2009 Well I was extra bored So I made a python script to help you do this, Make sure you run it in the directory with all your songs. You can download python here http://www.python.org/download/releases/2.5.4/ Once it has generated the random names, copy the folder of songs to your Ipod. Then you can hit enter and the script will change the songs back to their original state. [Tested on Ubuntu GNU/Linux, should work with windows tho.] #Run this in the directory with your songs, and DO NOT CLOSE this until you have recovered the names. raw_input("Are you sure you want to continue? Make sure not to exit prematurely.") import os,random,time chars = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"] .... ..... It's a bit overkill :P but I love overkill D: instead of writing chars = ["a","b",.....] you could say chars = list("abcdefghijklmnopqrstuvwxyz") it may save you some time Quote Link to comment Share on other sites More sharing options...
ratmandall Posted March 16, 2009 Share Posted March 16, 2009 instead of writing chars = ["a","b",.....] you could say chars = list("abcdefghijklmnopqrstuvwxyz") it may save you some time Aww yeah :P Thanks. I already had that list from another script I wrote so it was just copy pasta. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.