Skip to content

Commit

Permalink
small python cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesmadere committed Feb 4, 2025
1 parent 6da7113 commit 9465276
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions src/soundPlayerManager/audioPlayer/audioPlayerSoundPlayerManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,26 +267,26 @@ async def __progressThroughPlaylist(self, playlist: SoundPlayerPlaylist):
try:
while self.__isLoadingOrPlaying and not playErrorOccurred and (currentPlaylistIndex < len(playlist.playlistFiles) or mediaPlayer.isPlaying):
if mediaPlayer.isPlaying:
pass
continue

if currentPlaylistIndex < 0:
currentPlaylistIndex = 0
else:
if currentPlaylistIndex < 0:
currentPlaylistIndex = 0
else:
currentPlaylistIndex += 1
currentPlaylistIndex += 1

if currentPlaylistIndex < len(playlist.playlistFiles):
currentFile = playlist.playlistFiles[currentPlaylistIndex]
currentVolume = currentFile.volume
if currentPlaylistIndex < len(playlist.playlistFiles):
currentFile = playlist.playlistFiles[currentPlaylistIndex]
currentVolume = currentFile.volume

if not utils.isValidInt(currentVolume):
currentVolume = baseVolume
if not utils.isValidInt(currentVolume):
currentVolume = baseVolume

await mediaPlayer.setMedia(currentFile.filePath)
await mediaPlayer.setVolume(currentVolume)
await mediaPlayer.setMedia(currentFile.filePath)
await mediaPlayer.setVolume(currentVolume)

if not await mediaPlayer.play():
self.__timber.log('AudioPlayerSoundPlayerManager', f'Received bad playback result when attempting to play media element at playlist index ({currentPlaylistIndex=}) ({currentFile=}) ({currentVolume=}) ({playlist=}) ({baseVolume=}) ({mediaPlayer=})')
playErrorOccurred = True
if not await mediaPlayer.play():
self.__timber.log('AudioPlayerSoundPlayerManager', f'Received bad playback result when attempting to play media element at playlist index ({currentPlaylistIndex=}) ({currentFile=}) ({currentVolume=}) ({playlist=}) ({baseVolume=}) ({mediaPlayer=})')
playErrorOccurred = True

await asyncio.sleep(self.__playbackLoopSleepTimeSeconds)
except Exception as e:
Expand Down

0 comments on commit 9465276

Please sign in to comment.