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

View File

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