mirror of
https://github.com/csd4ni3l/music-player.git
synced 2026-01-01 12:13:42 +01:00
fix exception if there is no id3 metadata
This commit is contained in:
@@ -60,8 +60,6 @@ def extract_metadata_and_thumbnail(file_path: str, thumb_resolution: tuple):
|
|||||||
sound_length = round(easyid3.info.length, 2)
|
sound_length = round(easyid3.info.length, 2)
|
||||||
bitrate = int((easyid3.info.bitrate or 0) / 1000)
|
bitrate = int((easyid3.info.bitrate or 0) / 1000)
|
||||||
sample_rate = int(easyid3.info.sample_rate / 1000)
|
sample_rate = int(easyid3.info.sample_rate / 1000)
|
||||||
except ID3NoHeaderError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
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
|
||||||
@@ -71,6 +69,9 @@ def extract_metadata_and_thumbnail(file_path: str, thumb_resolution: tuple):
|
|||||||
pil_image = pil_image.resize(thumb_resolution)
|
pil_image = pil_image.resize(thumb_resolution)
|
||||||
thumb_texture = arcade.Texture(pil_image)
|
thumb_texture = arcade.Texture(pil_image)
|
||||||
|
|
||||||
|
except ID3NoHeaderError:
|
||||||
|
pass
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.debug(f"[Metadata/Thumbnail Error] {file_path}: {e}")
|
logging.debug(f"[Metadata/Thumbnail Error] {file_path}: {e}")
|
||||||
|
|
||||||
@@ -104,7 +105,6 @@ def extract_metadata_and_thumbnail(file_path: str, thumb_resolution: tuple):
|
|||||||
"thumbnail": thumb_texture,
|
"thumbnail": thumb_texture,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def adjust_volume(input_path, volume):
|
def adjust_volume(input_path, volume):
|
||||||
audio = AudioSegment.from_file(input_path)
|
audio = AudioSegment.from_file(input_path)
|
||||||
change = volume - audio.dBFS
|
change = volume - audio.dBFS
|
||||||
|
|||||||
Reference in New Issue
Block a user