Browse Source

Reduced verbosity + consume fix

itec 4 years ago
parent
commit
e2f5167ee2
4 changed files with 20 additions and 6 deletions
  1. 1 1
      pl_list.py
  2. 10 0
      pl_playloop.py
  3. 7 3
      playlistalo.py
  4. 2 2
      trimaudio.sh

+ 1 - 1
pl_list.py

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

+ 10 - 0
pl_playloop.py

@@ -0,0 +1,10 @@
+#!/usr/bin/env python3
+#Fa partire il loop musicale
+
+import playlistalo
+
+if __name__ == '__main__':
+    #playlistalo.shuffleusers()
+    playlistalo.playloop()
+
+    

+ 7 - 3
playlistalo.py

@@ -188,10 +188,14 @@ def playsingle():
         firstsong = scriptpath + "/" + pl[0][0]
         print (firstsong)
         #qui fa play
-        subprocess.call(["mplayer", firstsong])
+        subprocess.call(["mplayer", "-nolirc", "-msglevel", "all=0:statusline=5", firstsong])
         #alla fine consuma
         os.rename(firstsong, scriptpath + "/archive/" + os.path.basename(firstsong))
-        with open(os.path.dirname(firstsong) + "/last", "w") as f:
+        #se non ci sono + file cancella la cartella
+        if not glob(os.path.dirname(firstsong) + "/*.m4a"):
+            shutil.rmtree(os.path.dirname(firstsong))
+        else:
+            with open(os.path.dirname(firstsong) + "/last", "w") as f:
                 f.write(time.strftime("%Y%m%d%H%M%S"))
     else:
         #usa il fallback
@@ -202,7 +206,7 @@ def playsingle():
             firstsong = plf[0][0]
             print (firstsong)
             #qui fa play
-            subprocess.call(["mplayer", firstsong])
+            subprocess.call(["mplayer", "-nolirc", "-msglevel", "all=0:statusline=5", firstsong])
             #alla fine consuma
             fname =  time.strftime("%Y%m%d%H%M%S") + "|" + "|".join(os.path.basename(firstsong).split("|")[1:])
             fname = os.path.dirname(firstsong) + "/" + fname

+ 2 - 2
trimaudio.sh

@@ -7,7 +7,7 @@ temp1=/tmp/$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1).m4a
 temp2=/tmp/$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1).m4a
 
 #step 1 rimuove il silenzio
-ffmpeg -i "$1" -to $(($secmax + 15))  -af "silenceremove=start_periods=1:start_duration=1:start_threshold=-60dB:detection=peak,aformat=dblp,areverse,silenceremove=start_periods=1:start_duration=1:start_threshold=-60dB:detection=peak,aformat=dblp,areverse" -y $temp1
+ffmpeg -i "$1" -to $(($secmax + 15)) -af "silenceremove=start_periods=1:start_duration=1:start_threshold=-60dB:detection=peak,aformat=dblp,areverse,silenceremove=start_periods=1:start_duration=1:start_threshold=-60dB:detection=peak,aformat=dblp,areverse" -v quiet -y $temp1
 
 
 # step 2 tronca e sfuma
@@ -16,7 +16,7 @@ len=${len%.*}
 
 if [ $len -gt $secmax ];
 then 
-    ffmpeg -i $temp1 -to $secmax -af "afade=t=out:st=$(($secmax - $secfad)):d=$secfad" -y $temp2
+    ffmpeg -i $temp1 -to $secmax -af "afade=t=out:st=$(($secmax - $secfad)):d=$secfad" -v quiet -y $temp2
     mv $temp2 "$2"
     rm $temp1
 else