parent
0a4730e5a7
commit
b46830f010
@ -11,7 +11,7 @@ from datetime import datetime, timedelta
|
|||||||
from log import DEBUG, EXCEPTION
|
from log import DEBUG, EXCEPTION
|
||||||
|
|
||||||
from PyQt5.QtCore import Qt, QTimer, QUrl
|
from PyQt5.QtCore import Qt, QTimer, QUrl
|
||||||
from PyQt5.QtGui import QFontMetrics, QPainter
|
from PyQt5.QtGui import QColor, QFontMetrics, QPainter
|
||||||
from PyQt5.QtWebEngineWidgets import QWebEngineView as QWebView
|
from PyQt5.QtWebEngineWidgets import QWebEngineView as QWebView
|
||||||
from PyQt5.QtWidgets import (
|
from PyQt5.QtWidgets import (
|
||||||
QApplication,
|
QApplication,
|
||||||
@ -479,8 +479,6 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
|
|
||||||
# Play next track
|
# Play next track
|
||||||
self.current_track = self.next_track
|
self.current_track = self.next_track
|
||||||
self.set_tab_colour(self.current_track_playlist_tab,
|
|
||||||
QColor("black"))
|
|
||||||
self.current_track_playlist_tab = self.next_track_playlist_tab
|
self.current_track_playlist_tab = self.next_track_playlist_tab
|
||||||
self.set_tab_colour(self.current_track_playlist_tab,
|
self.set_tab_colour(self.current_track_playlist_tab,
|
||||||
QColor(Config.COLOUR_CURRENT_TAB))
|
QColor(Config.COLOUR_CURRENT_TAB))
|
||||||
@ -505,6 +503,12 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
else:
|
else:
|
||||||
self.next_track = self.next_track_playlist_tab = None
|
self.next_track = self.next_track_playlist_tab = None
|
||||||
|
|
||||||
|
if self.next_track_playlist_tab and (
|
||||||
|
self.current_track_playlist_tab !=
|
||||||
|
self.next_track_playlist_tab):
|
||||||
|
self.set_tab_colour(self.next_track_playlist_tab,
|
||||||
|
QColor(Config.COLOUR_NEXT_TAB))
|
||||||
|
|
||||||
# Tell database to record it as played
|
# Tell database to record it as played
|
||||||
self.current_track.update_lastplayed()
|
self.current_track.update_lastplayed()
|
||||||
Playdates.add_playdate(session, self.current_track)
|
Playdates.add_playdate(session, self.current_track)
|
||||||
@ -558,18 +562,32 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
if not next_track_id:
|
if not next_track_id:
|
||||||
next_track_id = (
|
next_track_id = (
|
||||||
self.visible_playlist_tab().set_selected_as_next())
|
self.visible_playlist_tab().set_selected_as_next())
|
||||||
if next_track_id:
|
if not next_track_id:
|
||||||
|
return
|
||||||
|
|
||||||
|
# The next track has been selected on the currently-visible
|
||||||
|
# playlist. However, there may already be a 'next track'
|
||||||
|
# selected on another playlist that the user is overriding,
|
||||||
|
# in which case we need to reset that playlist.
|
||||||
if self.next_track_playlist_tab != self.visible_playlist_tab():
|
if self.next_track_playlist_tab != self.visible_playlist_tab():
|
||||||
|
# We need to reset the ex-next-track playlist
|
||||||
if self.next_track_playlist_tab:
|
if self.next_track_playlist_tab:
|
||||||
self.next_track_playlist_tab.clear_next()
|
self.next_track_playlist_tab.clear_next()
|
||||||
|
# Reset tab colour if it NOT the current playing tab
|
||||||
|
if (self.next_track_playlist_tab !=
|
||||||
|
self.current_track_playlist_tab):
|
||||||
self.set_tab_colour(self.next_track_playlist_tab,
|
self.set_tab_colour(self.next_track_playlist_tab,
|
||||||
QColor("black"))
|
QColor(Config.COLOUR_NORMAL_TAB))
|
||||||
self.next_track_playlist_tab = self.visible_playlist_tab()
|
self.next_track_playlist_tab = self.visible_playlist_tab()
|
||||||
|
# self.next_track_playlist_tab is now set to correct
|
||||||
|
# playlist
|
||||||
if (self.next_track_playlist_tab !=
|
if (self.next_track_playlist_tab !=
|
||||||
self.current_track_playlist_tab):
|
self.current_track_playlist_tab):
|
||||||
self.set_tab_colour(self.next_track_playlist_tab,
|
self.set_tab_colour(self.next_track_playlist_tab,
|
||||||
QColor(Config.COLOUR_NEXT_TAB))
|
QColor(Config.COLOUR_NEXT_TAB))
|
||||||
|
|
||||||
self.next_track = Tracks.get_track(session, next_track_id)
|
self.next_track = Tracks.get_track(session, next_track_id)
|
||||||
|
|
||||||
self.update_headers()
|
self.update_headers()
|
||||||
|
|
||||||
def select_unplayed(self):
|
def select_unplayed(self):
|
||||||
@ -619,6 +637,13 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
|
|
||||||
DEBUG(f"musicmuster.stop_playing({fade=})", True)
|
DEBUG(f"musicmuster.stop_playing({fade=})", True)
|
||||||
|
|
||||||
|
if self.current_track_playlist_tab == self.next_track_playlist_tab:
|
||||||
|
self.set_tab_colour(self.current_track_playlist_tab,
|
||||||
|
QColor(Config.COLOUR_NEXT_TAB))
|
||||||
|
else:
|
||||||
|
self.set_tab_colour(self.current_track_playlist_tab,
|
||||||
|
QColor(Config.COLOUR_NORMAL_TAB))
|
||||||
|
|
||||||
if not self.music.playing():
|
if not self.music.playing():
|
||||||
DEBUG("musicmuster.stop_playing(): not playing", True)
|
DEBUG("musicmuster.stop_playing(): not playing", True)
|
||||||
self.end_of_track_actions()
|
self.end_of_track_actions()
|
||||||
@ -650,7 +675,7 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
if not self.playing():
|
if not self.playing():
|
||||||
return
|
return
|
||||||
|
|
||||||
self.music.set_position(self.get_current_silence_at() - 1000)
|
self.music.set_position(self.current_track.silence_at - 1000)
|
||||||
|
|
||||||
def test_skip_to_fade(self):
|
def test_skip_to_fade(self):
|
||||||
"Skip current track to 1 second before fade"
|
"Skip current track to 1 second before fade"
|
||||||
@ -658,7 +683,7 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
if not self.music.playing():
|
if not self.music.playing():
|
||||||
return
|
return
|
||||||
|
|
||||||
self.music.set_position(self.get_current_fade_at() - 1000)
|
self.music.set_position(self.current_track.fade_at - 1000)
|
||||||
|
|
||||||
def tick(self):
|
def tick(self):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@ -965,13 +965,17 @@ class PlaylistTab(QTableWidget):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
track_id = self._get_row_id(row)
|
track_id = self._get_row_id(row)
|
||||||
if track_id:
|
if not track_id:
|
||||||
|
return None
|
||||||
|
|
||||||
if self._track_path_is_readable(track_id):
|
if self._track_path_is_readable(track_id):
|
||||||
self._meta_set_next(row)
|
self._meta_set_next(row)
|
||||||
self.master_process.set_next_track(track_id)
|
self.master_process.set_next_track(track_id)
|
||||||
else:
|
else:
|
||||||
self._meta_set_unreadable(row)
|
self._meta_set_unreadable(row)
|
||||||
track_id = None
|
track_id = None
|
||||||
|
self._repaint()
|
||||||
|
|
||||||
return track_id
|
return track_id
|
||||||
|
|
||||||
def _repaint(self, clear_selection=True):
|
def _repaint(self, clear_selection=True):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user