Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- import random
- mp3_list = []
- def crawleo(spath):
- global mp3_list
- if os.path.exists(spath):
- buf = os.listdir(spath)
- for f in buf:
- if os.path.isfile(spath + "\\" + f):
- mp3_list.append(spath + "\\" + f)
- else:
- #print "------------- ["+f+"] ------------------"
- crawleo(spath + "\\" + f)
- else:
- print "El path: " + spath + " no existe."
- mp3_path = raw_input("Path de MP3: ")
- crawleo(mp3_path)
- mp3_cant = raw_input("Cantidad de Temas (maximo "+str(len(mp3_list))+"): ")
- random.shuffle(mp3_list)
- fo = open("lista.m3u" ,"w")
- for i in range(int(mp3_cant)):
- fo.write(mp3_list[i]+"\n")
- fo.close()
- os.execlp("C:\Archivos de programa\Winamp\winamp.exe","-",
- os.path.join(os.path.abspath(os.path.split(__file__)[0]),"lista.m3u"))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement