|
@@ -101,7 +101,7 @@ def add(url, user = "-unknown-"):
|
|
|
return("Err: file non scaricato")
|
|
|
|
|
|
#se il file esiste gia' in playlist salto (potrebbe esserci, anche rinominato)
|
|
|
- if glob(scriptpath + "/playlist/**/*|" + id + ".*"):
|
|
|
+ if glob("playlist/**/*|" + id + ".*"):
|
|
|
print ('--- File già presente ---')
|
|
|
return ("Err: %s [%s] già presente" %(title, id))
|
|
|
|
|
@@ -144,7 +144,7 @@ def __normalizetext(s):
|
|
|
def listplaylist():
|
|
|
pl = []
|
|
|
pl2 = []
|
|
|
- for udir in sorted(glob(scriptpath + "/playlist/*/")):
|
|
|
+ for udir in sorted(glob("playlist/*/")):
|
|
|
#print (udir)
|
|
|
user = os.path.basename(os.path.dirname(udir))
|
|
|
|
|
@@ -170,7 +170,7 @@ def listplaylist():
|
|
|
key = "-".join([str(seq).zfill(5), last, dat])
|
|
|
#print ("KEY: " + key)
|
|
|
|
|
|
- plsong = [key, file.replace(scriptpath + "/", "") , user, nam, cod] #, file
|
|
|
+ plsong = [key, file, user, nam, cod]
|
|
|
pl.append(plsong)
|
|
|
pl.sort()
|
|
|
#rimuove la prima colonna, che serve solo per l'ordinamento
|
|
@@ -185,7 +185,7 @@ def listfallback():
|
|
|
pl = []
|
|
|
pl2 = []
|
|
|
#leggi i file nella cartella
|
|
|
- files = sorted(glob(scriptpath + "/fallback/*.m4a"))
|
|
|
+ files = sorted(glob("fallback/*.m4a"))
|
|
|
seq = 0
|
|
|
for file in files:
|
|
|
bn = os.path.splitext(os.path.basename(file))[0]
|
|
@@ -195,7 +195,7 @@ def listfallback():
|
|
|
cod = bn.split("|")[2]
|
|
|
key = "-".join([str(seq).zfill(5), dat])
|
|
|
|
|
|
- plsong = [key, file.replace(scriptpath + "/", "") , "fallback", nam, cod] #, file
|
|
|
+ plsong = [key, file, "fallback", nam, cod]
|
|
|
pl.append(plsong)
|
|
|
pl.sort()
|
|
|
#rimuove la prima colonna, che serve solo per l'ordinamento
|
|
@@ -208,12 +208,12 @@ def playsingle():
|
|
|
#print ('\n'.join([x[0] for x in pl]))
|
|
|
|
|
|
if pl:
|
|
|
- firstsong = scriptpath + "/" + pl[0][0]
|
|
|
+ firstsong = pl[0][0]
|
|
|
print (firstsong)
|
|
|
#qui fa play
|
|
|
subprocess.call(["mplayer", "-nolirc", "-msglevel", "all=0:statusline=5", firstsong])
|
|
|
#alla fine consuma
|
|
|
- os.rename(firstsong, scriptpath + "/archive/" + os.path.basename(firstsong))
|
|
|
+ os.rename(firstsong, "archive/" + os.path.basename(firstsong))
|
|
|
#se non ci sono + file cancella la cartella
|
|
|
if not glob(os.path.dirname(firstsong) + "/*.m4a"):
|
|
|
shutil.rmtree(os.path.dirname(firstsong))
|