Compare commits

...

4 Commits

Author SHA1 Message Date
Keith Edmunds
1825e48e92 Fix unmarking row as played
Fixes #254
2024-07-31 13:04:04 +01:00
Keith Edmunds
2b8a911a78 Unmark row zero when no longer next track
Fixes #253
2024-07-31 12:57:51 +01:00
Keith Edmunds
a95ded1551 More log quietening 2024-07-30 17:13:30 +01:00
Keith Edmunds
0c76227bbc Quieten logging: move many info to debug 2024-07-30 16:51:53 +01:00
5 changed files with 23 additions and 24 deletions

View File

@ -250,7 +250,7 @@ class _Music:
def _set_vlc_log(self):
try:
vlc.libvlc_log_set(self.VLC, self.log_callback, None)
log.info("VLC logging set up successfully")
log.debug("VLC logging set up successfully")
except Exception as e:
log.error(f"Failed to set up VLC logging: {e}")

View File

@ -278,7 +278,7 @@ def normalise_track(path: str) -> None:
# Check type
ftype = os.path.splitext(path)[1][1:]
if ftype not in ["mp3", "flac"]:
log.info(
log.error(
f"helpers.normalise_track({path}): " f"File type {ftype} not implemented"
)

View File

@ -524,7 +524,7 @@ class Window(QMainWindow, Ui_MainWindow):
) -> Optional[Playlists]:
"""Create new playlist"""
log.info(f"create_playlist({playlist_name=}")
log.debug(f"create_playlist({playlist_name=}")
playlist_name = self.solicit_playlist_name(session)
if not playlist_name:
@ -575,7 +575,7 @@ class Window(QMainWindow, Ui_MainWindow):
self.move_source_rows = self.active_tab().get_selected_rows()
self.move_source_model = self.active_proxy_model()
log.info(f"cut_rows(): {self.move_source_rows=} {self.move_source_model=}")
log.debug(f"cut_rows(): {self.move_source_rows=} {self.move_source_model=}")
def debug(self):
"""Invoke debugger"""

View File

@ -154,10 +154,10 @@ class PlaylistModel(QAbstractTableModel):
if file_is_unreadable(rat.path):
return QBrush(QColor(Config.COLOUR_UNREADABLE))
# Current track
if track_sequence.current and track_sequence.current.track_id == rat.track_id:
if track_sequence.current and track_sequence.current.row_number == row:
return QBrush(QColor(Config.COLOUR_CURRENT_PLAYLIST))
# Next track
if track_sequence.next and track_sequence.next.track_id == rat.track_id:
if track_sequence.next and track_sequence.next.row_number == row:
return QBrush(QColor(Config.COLOUR_NEXT_PLAYLIST))
# Individual cell colouring
@ -329,7 +329,7 @@ class PlaylistModel(QAbstractTableModel):
with db.Session() as session:
for row_number in sorted(row_numbers, reverse=True):
log.info(f"{self}: delete_rows(), {row_number=}")
log.debug(f"{self}: delete_rows(), {row_number=}")
super().beginRemoveRows(QModelIndex(), row_number, row_number)
# We need to remove data from the underlying data store,
# which is the database, but we cache in
@ -480,7 +480,7 @@ class PlaylistModel(QAbstractTableModel):
(ie, ignore the first, not-yet-duplicate, track).
"""
log.info(f"{self}: get_duplicate_rows() called")
log.debug(f"{self}: get_duplicate_rows() called")
found = []
result = []
@ -494,7 +494,7 @@ class PlaylistModel(QAbstractTableModel):
else:
found.append(track_id)
log.info(f"{self}: get_duplicate_rows() returned: {result=}")
log.debug(f"{self}: get_duplicate_rows() returned: {result=}")
return result
def _get_new_row_number(self, proposed_row_number: Optional[int]) -> int:
@ -725,7 +725,7 @@ class PlaylistModel(QAbstractTableModel):
with db.Session() as session:
for row_number in row_numbers:
playlist_row = session.get(
PlaylistRows, self.playlist_rows[row_number].row_number
PlaylistRows, self.playlist_rows[row_number].playlistrow_id
)
if not playlist_row:
return
@ -884,7 +884,7 @@ class PlaylistModel(QAbstractTableModel):
Move existing_rat track to new_row_number and append note to any existing note
"""
log.info(f"{self}: move_track_add_note({new_row_number=}, {existing_rat=}, {note=}")
log.debug(f"{self}: move_track_add_note({new_row_number=}, {existing_rat=}, {note=}")
if note:
with db.Session() as session:
@ -911,7 +911,7 @@ class PlaylistModel(QAbstractTableModel):
Add the existing_rat track details to the existing header at header_row_number
"""
log.info(f"{self}: move_track_to_header({header_row_number=}, {existing_rat=}, {note=}")
log.debug(f"{self}: move_track_to_header({header_row_number=}, {existing_rat=}, {note=}")
if existing_rat.track_id:
if note and existing_rat.note:
@ -925,7 +925,7 @@ class PlaylistModel(QAbstractTableModel):
and execute any found
"""
log.info(f"{self}: obs_scene_change({row_number=})")
log.debug(f"{self}: obs_scene_change({row_number=})")
# Check any headers before this row
idx = row_number - 1
@ -949,7 +949,7 @@ class PlaylistModel(QAbstractTableModel):
sceneName=scene_name
)
)
log.info(f"{self}: OBS scene changed to '{scene_name}'")
log.debug(f"{self}: OBS scene changed to '{scene_name}'")
continue
except obswebsocket.exceptions.ConnectionFailure:
log.error(f"{self}: OBS connection refused")
@ -964,7 +964,7 @@ class PlaylistModel(QAbstractTableModel):
- update display
"""
log.info(f"{self}: previous_track_ended()")
log.debug(f"{self}: previous_track_ended()")
# Sanity check
if not track_sequence.previous:
@ -999,7 +999,7 @@ class PlaylistModel(QAbstractTableModel):
Remove track from row, retaining row as a header row
"""
log.info(f"{self}: remove_track({row_number=})")
log.debug(f"{self}: remove_track({row_number=})")
with db.Session() as session:
playlist_row = session.get(
@ -1206,7 +1206,6 @@ class PlaylistModel(QAbstractTableModel):
old_next_row = track_sequence.next.row_number
track_sequence.set_next(rat)
self.invalidate_row(row_number)
if Config.WIKIPEDIA_ON_NEXT:
self.signals.search_wikipedia_signal.emit(
@ -1216,7 +1215,7 @@ class PlaylistModel(QAbstractTableModel):
self.signals.search_songfacts_signal.emit(
self.playlist_rows[row_number].title
)
if old_next_row:
if old_next_row is not None:
self.invalidate_row(old_next_row)
self.invalidate_row(row_number)

View File

@ -344,7 +344,7 @@ class PlaylistTab(QTableView):
else:
self.musicmuster.lblSumPlaytime.setText("")
else:
log.info(
log.debug(
f"playlists.py.selectionChanged: {self.musicmuster.disable_selection_timing=}"
)
@ -397,7 +397,7 @@ class PlaylistTab(QTableView):
else False.
"""
log.info(f"_audacity({cmd=})")
log.debug(f"_audacity({cmd=})")
# Notify user if audacity not running
if "audacity" not in [i.name() for i in psutil.process_iter()]:
@ -433,7 +433,7 @@ class PlaylistTab(QTableView):
log.error(f"_audactity_command {msgs=}")
return False
if timing:
log.info(f"_audactity_command {timing=}")
log.debug(f"_audactity_command {timing=}")
return True
@ -636,7 +636,7 @@ class PlaylistTab(QTableView):
"""
rows_to_delete = self.get_selected_rows()
log.info(f"_delete_rows({rows_to_delete=}")
log.debug(f"_delete_rows({rows_to_delete=}")
row_count = len(rows_to_delete)
if row_count < 1:
return
@ -775,7 +775,7 @@ class PlaylistTab(QTableView):
if status:
self.musicmuster.audacity_file_path = path
log.info(f"_open_in_audacity {path=}, {status=}")
log.debug(f"_open_in_audacity {path=}, {status=}")
def _rescan(self, row_number: int) -> None:
"""Rescan track"""
@ -912,7 +912,7 @@ class PlaylistTab(QTableView):
"""
model_row_number = self.source_model_selected_row_number()
log.info(f"set_row_as_next_track() {model_row_number=}")
log.debug(f"set_row_as_next_track() {model_row_number=}")
if model_row_number is None:
return
self.source_model.set_next_row(model_row_number)