Warn if colon in track path

This commit is contained in:
Keith Edmunds 2022-02-26 09:26:13 +00:00
parent cb50fc253b
commit b283a3db07
2 changed files with 12 additions and 12 deletions

View File

@ -381,11 +381,6 @@ class Window(QMainWindow, Ui_MainWindow):
self.previous_track_position = self.music.fade() self.previous_track_position = self.music.fade()
self.end_of_track_actions() self.end_of_track_actions()
def file_is_readable(self, path):
"Return True if path is readable else False"
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"

View File

@ -609,11 +609,6 @@ class PlaylistTab(QTableWidget):
duration = Tracks.get_duration(session, self._get_row_id(row)) duration = Tracks.get_duration(session, self._get_row_id(row))
return start + timedelta(milliseconds=duration) return start + timedelta(milliseconds=duration)
def _can_read_track(self, track):
"Check track file is readable"
return os.access(track.path, os.R_OK)
def _context_menu(self, pos): def _context_menu(self, pos):
self.menu.exec_(self.mapToGlobal(pos)) self.menu.exec_(self.mapToGlobal(pos))
@ -1289,10 +1284,20 @@ class PlaylistTab(QTableWidget):
self.setItem(row, self.COL_START_TIME, item) self.setItem(row, self.COL_START_TIME, item)
def _track_path_is_readable(self, track_id): def _track_path_is_readable(self, track_id):
"Returns True if track path is readable, else False" """
Returns True if track path is readable, else False
vlc cannot read files with a colon in the path
"""
with Session() as session: with Session() as session:
return os.access(Tracks.get_path(session, track_id), os.R_OK) path = Tracks.get_path(session, track_id)
if os.access(path, os.R_OK):
if ':' not in path:
return True
return False
def _update_row(self, row, track): def _update_row(self, row, track):
""" """