Skip to content

Commit

Permalink
fix: cast infinite waiting. disable cast_try_reconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
elibroftw committed Apr 18, 2024
1 parent acc18cb commit c4e497c
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 11 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
Music Caster by Elijah Lopez Changelog

5.18.5
- [Fix] GUI freezing from seeking

5.18.4
- [Fix] Increase wait timeout

Expand Down
8 changes: 4 additions & 4 deletions build_files/mc_version_info.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# For more details about fixed file info 'ffi' see: http://msdn.microsoft.com/en-us/library/ms646997.aspx
VSVersionInfo(
ffi=FixedFileInfo(
prodvers=(5, 18, 4, 0),
filevers=(5, 18, 4, 0),
prodvers=(5, 18, 5, 0),
filevers=(5, 18, 5, 0),
# Contains a bitmask that specifies the valid bits 'flags'r
mask=0x17,
# Contains a bitmask that specifies the Boolean attributes of the file.
Expand All @@ -27,12 +27,12 @@ VSVersionInfo(
'000004b0',
[StringStruct('CompanyName', 'Elijah Lopez'),
StringStruct('FileDescription', 'Music Caster'),
StringStruct('FileVersion', '5.18.4.0'),
StringStruct('FileVersion', '5.18.5.0'),
StringStruct('InternalName', 'Music Caster'),
StringStruct('LegalCopyright', 'Copyright (c) 2019 - 2024, Elijah Lopez'),
StringStruct('OriginalFilename', 'Music Caster.exe'),
StringStruct('ProductName', 'Music Caster'),
StringStruct('ProductVersion', '5.18.4.0')])
StringStruct('ProductVersion', '5.18.5.0')])
]),
VarFileInfo([VarStruct('Translation', [0, 1200])])
]
Expand Down
2 changes: 1 addition & 1 deletion build_files/setup_script.iss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#define MyAppName "Music Caster"
#define MyAppVersion "5.18.4"
#define MyAppVersion "5.18.5"
#define MyAppPublisher "Elijah Lopez"
#define MyAppURL "https://elijahlopez.ca/software#music-caster"
#define MyAppExeName "Music Caster.exe"
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ujson~=5.5
mutagen~=1.45
Pillow~=10.3.0
PyChromecast~=14.0
zeroconf~=0.37
# zeroconf~=0.132
pynput~=1.4.5
pypng~=0.0.20
# pypresence
Expand Down
2 changes: 1 addition & 1 deletion src/meta.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION = latest_version = '5.18.4'
VERSION = latest_version = '5.18.5'
UPDATE_MESSAGE = """
[NEW] Better Error Capturing
[MSG] Language translators wanted
Expand Down
14 changes: 10 additions & 4 deletions src/music_caster.py
Original file line number Diff line number Diff line change
Expand Up @@ -1493,7 +1493,7 @@ def play_system_audio(switching_device=False, show_error=False):
tray_notify(t('ERROR') + f': ' + t('Could not connect to cast device') + ' (psa)')
change_device()
return handle_exception(e)
cast_try_reconnect()
# cast_try_reconnect()
return play_system_audio(switching_device=switching_device, show_error=True)
except Exception as e:
handle_exception(e)
Expand Down Expand Up @@ -1811,7 +1811,7 @@ def play_url(position=0, autoplay=True, switching_device=False, show_error=False
if show_error:
tray_notify(t('ERROR') + ': ' + t('Could not connect to cast device') + ' (play_url)')
return handle_exception(e)
cast_try_reconnect()
# cast_try_reconnect()
return play_url(position, autoplay, switching_device, show_error=True)
track_position = position
track_start = time.monotonic() - track_position
Expand Down Expand Up @@ -1893,7 +1893,7 @@ def play(position=0, autoplay=True, switching_device=False, show_error=False):
tray_notify(t('ERROR') + f': ' + t('Could not connect to cast device') + ' (play)')
change_device()
return handle_exception(e)
cast_try_reconnect()
# cast_try_reconnect()
return play(position=position, autoplay=autoplay, switching_device=switching_device, show_error=True)
track_position = position
track_start = time.monotonic() - track_position
Expand Down Expand Up @@ -2221,14 +2221,18 @@ def stop(stopped_from: str, stop_cast=True):

def set_pos(new_position):
"""
AKA: seeking
sets position of audio player or cast to new_position
"""
global track_position, track_start, track_end
app_log.info('trying to set playback position')
if cast is not None:
try:
cast.media_controller.update_status()
except PyChromecastError:
cast.wait()
app_log.info('set_pos(1) trying to wait on cast')
cast.wait(WAIT_TIMEOUT)
app_log.info('set_pos(1) cast waited')
if cast.media_controller.status.player_is_idle and music_queue:
return play(position=new_position, autoplay=playing_status.playing())
else:
Expand All @@ -2239,7 +2243,9 @@ def set_pos(new_position):
cast.media_controller.pause()
break
except (NotConnected, RequestTimeout, RequestFailed):
app_log.info('set_pos(2) trying to wait on cast')
cast.wait()
app_log.info('set_pos(2) cast waited')
else:
audio_player.set_pos(new_position)
track_position = new_position
Expand Down

0 comments on commit c4e497c

Please sign in to comment.