Browse Source

Removed scriptpath

itec 4 years ago
parent
commit
2fc7b0901a
2 changed files with 8 additions and 8 deletions
  1. 1 1
      pl_list.py
  2. 7 7
      playlistalo.py

+ 1 - 1
pl_list.py

@@ -5,5 +5,5 @@ import playlistalo
 
 if __name__ == '__main__':
     pl = playlistalo.listplaylist()
-    print ('\n'.join([", ".join(x[1:]) for x in pl]))
+    print ('\n'.join([", ".join(x) for x in pl]))
     

+ 7 - 7
playlistalo.py

@@ -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))