mirror of
https://github.com/csd4ni3l/music-player.git
synced 2026-01-01 12:13:42 +01:00
Fix crashing due to Discord RPC error and fix metadata handling crashing if there are no id3 headers
This commit is contained in:
@@ -621,7 +621,7 @@ class Main(arcade.gui.UIView):
|
|||||||
else:
|
else:
|
||||||
state = "Paused"
|
state = "Paused"
|
||||||
else:
|
else:
|
||||||
details = ""
|
details = "No songs playing"
|
||||||
state = "No songs playing"
|
state = "No songs playing"
|
||||||
|
|
||||||
self.pypresence_client.update(state=state, details=details, start=self.pypresence_client.start_time)
|
self.pypresence_client.update(state=state, details=details, start=self.pypresence_client.start_time)
|
||||||
|
|||||||
@@ -55,14 +55,14 @@ def extract_metadata_and_thumbnail(file_path: str, thumb_resolution: tuple):
|
|||||||
last_played = float(frame.text[0])
|
last_played = float(frame.text[0])
|
||||||
elif desc == "play_count":
|
elif desc == "play_count":
|
||||||
play_count = int(frame.text[0])
|
play_count = int(frame.text[0])
|
||||||
|
|
||||||
|
if hasattr(easyid3, "info"):
|
||||||
|
sound_length = round(easyid3.info.length, 2)
|
||||||
|
bitrate = int((easyid3.info.bitrate or 0) / 1000)
|
||||||
|
sample_rate = int(easyid3.info.sample_rate / 1000)
|
||||||
except ID3NoHeaderError:
|
except ID3NoHeaderError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if hasattr(easyid3, "info"):
|
|
||||||
sound_length = round(easyid3.info.length, 2)
|
|
||||||
bitrate = int((easyid3.info.bitrate or 0) / 1000)
|
|
||||||
sample_rate = int(easyid3.info.sample_rate / 1000)
|
|
||||||
|
|
||||||
apic = id3.getall("APIC")
|
apic = id3.getall("APIC")
|
||||||
thumb_image_data = apic[0].data if apic else None
|
thumb_image_data = apic[0].data if apic else None
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user