no reset if playing

This commit is contained in:
itec78 2020-08-18 15:57:26 +02:00
parent 4bde232b46
commit e47d45dbaa

View file

@ -393,7 +393,7 @@ def setlastannounce(announcepos):
def consume(song):
if os.path.exists(song):
print ("consumo la canzone " + song)
print ("Consumo la canzone " + song)
if song.split("/")[0] == "playlist":
os.remove(song)
if not [x for x in glob(os.path.dirname(song) + "/*") if not os.path.basename(x) == "last"]:
@ -442,40 +442,41 @@ def plaympd():
synctime = 5
listlen = 10
if SHUFFLEUSERS:
shuffleusers()
if SHUFFLEFALLBACK:
shufflefallback()
#stoppa e svuota
client.stop()
client.clear()
#cancella la cartella mpd
if os.path.exists("mpd"):
shutil.rmtree("mpd")
os.makedirs("mpd")
client.rescan()
if client.status()['state'] != "play":
if SHUFFLEUSERS:
shuffleusers()
if SHUFFLEFALLBACK:
shufflefallback()
#stoppa e svuota
client.stop()
client.clear()
#cancella la cartella mpd
if os.path.exists("mpd"):
shutil.rmtree("mpd")
os.makedirs("mpd")
client.rescan()
#aggiunge l'annuncio iniziale
addstartannounce()
#resetta il lastannounce
setlastannounce(ANNOUNCEREPEAT)
#aggiunge l'annuncio iniziale
addstartannounce()
#resetta il lastannounce
setlastannounce(ANNOUNCEREPEAT)
#riempe la playlist
plt = listtot(listlen)
for f in plt:
print(f[0])
copyfile(f[0], "mpd/" + f[0])
client.rescan()
time.sleep(0.5)
for f in plt:
client.add(f[0])
#riempe la playlist
plt = listtot(listlen)
for f in plt:
print(f[0])
copyfile(f[0], "mpd/" + f[0])
client.rescan()
time.sleep(0.5)
for f in plt:
client.add(f[0])
#consuma il primo e fa play
consume(plt[0][0])
#consuma il primo e fa play
consume(plt[0][0])
#mpdadd(client, listlen)
client.play(0)
#mpdadd(client, listlen)
client.play(0)
while True:
# print("Current")
@ -560,7 +561,7 @@ def mpdadd(client, listlen):
#print (i)
for x in client.playlistinfo()[i:]:
print("cancello " + x['file'])
print("Cancello " + x['file'])
client.delete(i)
#e rifa la playlist
for f in plt[i-1:]: