
Journal Journal: Edna python script
This is my best working, and most useful application ever!
It's code is in pure python, and it only use's the urllib module
Here is the code:
import os
import urllib
def write():
s=open("test.m3u", "w")
s.write(f.read())
s.close()
def write2():
fil = line.split('/')[-1]
fil = fil[:-1]
fil = fil.replace("%20", " ")
k = urllib.urlopen(line)
s2=open(fil, "w")
print "laster ned " + fil
s2.write(k.read())
s2.close()
n = raw_input("Hva er linken?")
f = urllib.urlopen(n)
n = n.split('/')[-1]
write()
file = open("test.m3u")
while 1:
line = file.readline()
fila = line
if not line:
break
write2()
can't remember why i put import os there in the first place :)
For the code to work properly in windows, you must change the opening mode of the files you want to write the mp3 to, from "w" too "wb".
edit: forgot to say what it does. you give the program a link to a mp3-playlist file, an edna-database for example. And it downloads every file.