added a setting where you can change if the playback should be looped or not

This commit is contained in:
janis
2022-08-24 11:19:04 +02:00
parent 359562ec0c
commit 974e11636a
2 changed files with 18 additions and 9 deletions

View File

@@ -4,11 +4,15 @@ import copy
import bin.filepathanalysis
import pygame
import bin.info_handler
import configparser
pa = bin.filepathanalysis.PathAnalysis()
cvr = bin.csv_parsers.CsvRead()
cvw = bin.csv_parsers.CsvWrite()
config = configparser.ConfigParser()
config.read('./data/settings.ini')
class Player:
def __init__(self):
@@ -114,16 +118,19 @@ class Player:
# Main event-checking part
if mx.music.get_busy() is False and inst.value == 1 and self.__recent_change == 0:
mx.music.unload()
if len(self.playlist) > 0:
if config["Playback"]["loopPlayback"] == "0":
pass
else:
self.playlist = copy.deepcopy(self.playlist_backup)
self.current_playing_pos = -1
self.current_playing = self.playlist.pop(0)
self.current_playing_pos += 1
mx.music.load(self.current_playing)
mx.music.play()
self.__recent_change = 10000000
self.infoupdater()
if len(self.playlist) > 0:
pass
else:
self.playlist = copy.deepcopy(self.playlist_backup)
self.current_playing_pos = -1
self.current_playing = self.playlist.pop(0)
self.current_playing_pos += 1
mx.music.load(self.current_playing)
mx.music.play()
self.__recent_change = 10000000
self.infoupdater()
else:
pass

View File

@@ -3,6 +3,8 @@
# (lower = more up to date but higher resource usage)
showcaseRefreshRate = 0.5
[Playback]
loopPlayback = 1
[Info]
version = V1.1