Browse Source

Fixed file search

itec 4 years ago
parent
commit
9aeb00d3a9
1 changed files with 4 additions and 4 deletions
  1. 4 4
      playlistalo.py

+ 4 - 4
playlistalo.py

@@ -173,11 +173,11 @@ def listplaylist():
             f = open(udir + "/last", "r")
             last = f.readline().rstrip()
         else:
-            last = os.path.basename(sorted(glob(udir + "/*.m4a"))[0]).split("|")[0]
+            last = os.path.basename(sorted(glob(udir + "/*"))[0]).split("|")[0]
         #print ("LAST: " + last)
 
         #leggi i file nella cartella
-        files = sorted(glob(udir + "/*.m4a"))
+        files = [x for x in glob(udir + "/*") if not os.path.basename(x) == "last"]
         seq = 0
         for file in files:
             bn = os.path.splitext(os.path.basename(file))[0]
@@ -204,7 +204,7 @@ def listfallback():
     pl = []
     pl2 = []
     #leggi i file nella cartella
-    files = sorted(glob("fallback/*.m4a"))
+    files = [x for x in glob("fallback/*") if not os.path.basename(x) == "last"]
     seq = 0
     for file in files:
         bn = os.path.splitext(os.path.basename(file))[0]
@@ -246,7 +246,7 @@ def shuffleusers():
 
 def shufflefallback():
     #rinominare con un numero casuale i file in fallback
-    files = sorted(glob("fallback/*.m4a"))
+    files = [x for x in glob("fallback/*") if not os.path.basename(x) == "last"]
     for file in files:
         fname =  str(random.randrange(10**6)).zfill(14) + "|" + "|".join(os.path.basename(file).split("|")[1:])
         fname = os.path.dirname(file) + "/" + fname