Rename function file_is_readable to file_is_unreadable
This commit is contained in:
parent
d609656ae3
commit
ca86f59736
@ -55,7 +55,7 @@ def fade_point(
|
||||
return int(trim_ms)
|
||||
|
||||
|
||||
def file_is_readable(path: Optional[str]) -> bool:
|
||||
def file_is_unreadable(path: Optional[str]) -> bool:
|
||||
"""
|
||||
Returns True if passed path is readable, else False
|
||||
"""
|
||||
|
||||
@ -4,7 +4,7 @@ import vlc # type: ignore
|
||||
#
|
||||
from config import Config
|
||||
from datetime import datetime
|
||||
from helpers import file_is_readable
|
||||
from helpers import file_is_unreadable
|
||||
from typing import Optional
|
||||
from time import sleep
|
||||
|
||||
@ -101,7 +101,7 @@ class Music:
|
||||
Log and return if path not found.
|
||||
"""
|
||||
|
||||
if not file_is_readable(path):
|
||||
if file_is_unreadable(path):
|
||||
log.error(f"play({path}): path not readable")
|
||||
return None
|
||||
|
||||
|
||||
@ -314,7 +314,7 @@ class Window(QMainWindow, Ui_MainWindow):
|
||||
btn.setEnabled(False)
|
||||
btn.pgb.setVisible(False)
|
||||
if cart.path:
|
||||
if helpers.file_is_readable(cart.path):
|
||||
if not helpers.file_is_unreadable(cart.path):
|
||||
colour = Config.COLOUR_CART_READY
|
||||
btn.path = cart.path
|
||||
btn.player = self.music.VLC.media_player_new(cart.path)
|
||||
@ -339,7 +339,7 @@ class Window(QMainWindow, Ui_MainWindow):
|
||||
if not isinstance(btn, CartButton):
|
||||
return
|
||||
|
||||
if helpers.file_is_readable(btn.path):
|
||||
if not helpers.file_is_unreadable(btn.path):
|
||||
# Don't allow clicks while we're playing
|
||||
btn.setEnabled(False)
|
||||
if not btn.player:
|
||||
@ -377,7 +377,7 @@ class Window(QMainWindow, Ui_MainWindow):
|
||||
if not path:
|
||||
QMessageBox.warning(self, "Error", "Filename required")
|
||||
return
|
||||
if cart.path and helpers.file_is_readable(cart.path):
|
||||
if cart.path and not helpers.file_is_unreadable(cart.path):
|
||||
tags = helpers.get_tags(cart.path)
|
||||
cart.duration = tags['duration']
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@ from config import Config
|
||||
from dbconfig import Session, scoped_session
|
||||
from helpers import (
|
||||
ask_yes_no,
|
||||
file_is_readable,
|
||||
file_is_unreadable,
|
||||
get_relative_date,
|
||||
ms_to_mmss,
|
||||
open_in_audacity,
|
||||
@ -1109,7 +1109,7 @@ class PlaylistTab(QTableWidget):
|
||||
plr = self._get_row_plr(session, row_number)
|
||||
if not plr:
|
||||
continue
|
||||
if not file_is_readable(plr.track.path):
|
||||
if file_is_unreadable(plr.track.path):
|
||||
continue
|
||||
else:
|
||||
return row_number
|
||||
@ -1511,7 +1511,7 @@ class PlaylistTab(QTableWidget):
|
||||
with Session() as session:
|
||||
track = session.get(Tracks, track_id)
|
||||
if track:
|
||||
if not file_is_readable(track.path):
|
||||
if file_is_unreadable(track.path):
|
||||
self._set_row_colour_unreadable(row)
|
||||
else:
|
||||
self._set_row_colour_default(row)
|
||||
@ -1733,7 +1733,7 @@ class PlaylistTab(QTableWidget):
|
||||
return
|
||||
|
||||
# Check track is readable
|
||||
if not file_is_readable(track.path):
|
||||
if file_is_unreadable(track.path):
|
||||
return None
|
||||
|
||||
# Clear any existing next track
|
||||
@ -2105,7 +2105,7 @@ class PlaylistTab(QTableWidget):
|
||||
_ = self._set_row_track_id(row, track.id)
|
||||
_ = self._set_row_track_path(row, track.path)
|
||||
|
||||
if not file_is_readable(track.path):
|
||||
if file_is_unreadable(track.path):
|
||||
self._set_row_colour_unreadable(row)
|
||||
|
||||
def _update_section_headers(self, session: scoped_session) -> None:
|
||||
@ -2191,7 +2191,7 @@ class PlaylistTab(QTableWidget):
|
||||
continue
|
||||
|
||||
# We have a track. Skip if it is unreadable
|
||||
if not file_is_readable(self._get_row_path(row)):
|
||||
if file_is_unreadable(self._get_row_path(row)):
|
||||
continue
|
||||
|
||||
# Set next track start from end of current track
|
||||
|
||||
Loading…
Reference in New Issue
Block a user