Compare commits

...

2 Commits

Author SHA1 Message Date
Keith Edmunds
4687ef5288 Fix check of whether track is readable
Fixes #45
Fixes #44
Fixes #42
2021-08-14 08:20:02 +01:00
Keith Edmunds
f0b59b8d23 Improve track info box. Fixes #46 2021-08-14 08:03:03 +01:00
2 changed files with 8 additions and 5 deletions

View File

@ -294,7 +294,7 @@ class Window(QMainWindow, Ui_MainWindow):
def file_is_readable(self, path): def file_is_readable(self, path):
"Return True if path is readable else False" "Return True if path is readable else False"
return os.access(self.next_track.path, os.R_OK) return os.access(path, os.R_OK)
def insert_note(self): def insert_note(self):
"Add non-track row to playlist" "Add non-track row to playlist"
@ -414,13 +414,14 @@ class Window(QMainWindow, Ui_MainWindow):
self.music.play(self.current_track.path) self.music.play(self.current_track.path)
# Update metadata # Update metadata
# TODO is this valid if next track is on different playlist?
next_track_id = self.current_track_playlist_tab.play_started() next_track_id = self.current_track_playlist_tab.play_started()
if next_track_id is not None: if next_track_id is not None:
self.next_track = Tracks.get_track(session, next_track_id) self.next_track = Tracks.get_track(session, next_track_id)
self.next_track_playlist_tab = self.current_track_playlist_tab self.next_track_playlist_tab = self.current_track_playlist_tab
# Check we can read it # Check we can read it
if not self.file_is_readable(self.next_track.path, os.R_OK): if not self.file_is_readable(self.next_track.path):
self.show_warning( self.show_warning(
"Can't read next track", "Can't read next track",
self.next_track.path) self.next_track.path)

View File

@ -622,9 +622,11 @@ class PlaylistTab(QTableWidget):
txt = f"Track not found (track.id={id})" txt = f"Track not found (track.id={id})"
else: else:
txt = f""" txt = f"""
Title: {track.title}\n Title: {track.title}
Artist: {track.artist}\n Artist: {track.artist}
Path: {track.path}""" Path: {track.path}
Track ID: {track.id}
"""
info = QMessageBox(self) info = QMessageBox(self)
info.setIcon(QMessageBox.Information) info.setIcon(QMessageBox.Information)
info.setText(txt) info.setText(txt)