diff --git a/main.py b/main.py index c7f556c..412e346 100644 --- a/main.py +++ b/main.py @@ -287,9 +287,10 @@ class ApplicationWindow(QMainWindow, Ui_MainWindow): self.permanent_status_label.setText(message) def play_audio_file(self) -> None: - """Start playback of tableView.current_song_filepath track & moves playback slider""" + """Start playback of `tableView.current_song_filepath` & moves playback slider""" # get metadata self.current_song_metadata = self.tableView.get_current_song_metadata() + print(f'current_song_metadata: {self.current_song_metadata}') # read the file url = QUrl.fromLocalFile(self.tableView.get_current_song_filepath()) # load the audio content @@ -300,7 +301,7 @@ class ApplicationWindow(QMainWindow, Ui_MainWindow): self.move_slider() # mover # self.player.setPlaybackRate(1.5) - # assign metadata + # assign "now playing" labels & album artwork if self.current_song_metadata is not None: artist = ( self.current_song_metadata["TPE1"][0] @@ -313,7 +314,7 @@ class ApplicationWindow(QMainWindow, Ui_MainWindow): else None ) title = self.current_song_metadata["TIT2"][0] - # edit labels + self.artistLabel.setText(artist) self.albumLabel.setText(album) self.titleLabel.setText(title) diff --git a/utils/id3_timestamp_to_datetime.py b/utils/id3_timestamp_to_datetime.py index 2e61d1d..103d7e0 100644 --- a/utils/id3_timestamp_to_datetime.py +++ b/utils/id3_timestamp_to_datetime.py @@ -7,5 +7,8 @@ def id3_timestamp_to_datetime(timestamp: ID3TimeStamp): if len(timestamp.text) == 4: # If only year is provided datetime_obj = datetime.datetime.strptime(timestamp.text, '%Y') else: - datetime_obj = datetime.datetime.strptime(timestamp.text, '%Y-%m-%d') + try: + datetime_obj = datetime.datetime.strptime(timestamp.text, '%Y-%m-%d') + except ValueError: + datetime_obj = datetime.datetime.strptime(timestamp.text, '%Y%m%d') return datetime_obj.strftime('%Y-%m-%d') diff --git a/utils/set_id3_tag.py b/utils/set_id3_tag.py index 0fe0a8d..bd40fe8 100644 --- a/utils/set_id3_tag.py +++ b/utils/set_id3_tag.py @@ -136,6 +136,6 @@ def set_id3_tag(filepath: str, tag_name: str, value: str): audio_file.save(filepath) return True except Exception as e: - dialog = ErrorDialog(f"An unhandled exception occurred:\n{e}") + dialog = ErrorDialog(f"set_id3_tag.py | An unhandled exception occurred:\n{e}") dialog.exec_() return False