Tidy up moving to PlaylistTrack object
This commit is contained in:
parent
4beafe7cfc
commit
daf8069de2
@ -97,8 +97,8 @@ def get_tags(path: str) -> Dict[str, Union[str, int]]:
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_relative_date(past_date: datetime, reference_date: datetime = None) \
|
def get_relative_date(past_date: datetime,
|
||||||
-> str:
|
reference_date: Optional[datetime] = None) -> str:
|
||||||
"""
|
"""
|
||||||
Return how long before reference_date past_date is as string.
|
Return how long before reference_date past_date is as string.
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
# import os
|
# import os
|
||||||
import threading
|
import threading
|
||||||
import vlc
|
import vlc # type: ignore
|
||||||
#
|
#
|
||||||
from config import Config
|
from config import Config
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|||||||
@ -671,7 +671,6 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
|
|
||||||
# Get list of track rows for this playlist
|
# Get list of track rows for this playlist
|
||||||
plrs = PlaylistRows.get_rows_with_tracks(session, playlist_id)
|
plrs = PlaylistRows.get_rows_with_tracks(session, playlist_id)
|
||||||
import ipdb; ipdb.set_trace()
|
|
||||||
with open(path, "w") as f:
|
with open(path, "w") as f:
|
||||||
# Required directive on first line
|
# Required directive on first line
|
||||||
f.write("#EXTM3U\n")
|
f.write("#EXTM3U\n")
|
||||||
@ -1444,12 +1443,6 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
if self.playing:
|
if self.playing:
|
||||||
self.stop_playing()
|
self.stop_playing()
|
||||||
|
|
||||||
def update_next_track(self, track):
|
|
||||||
"""Update next track with passed details"""
|
|
||||||
|
|
||||||
self.next_track = TrackData(track)
|
|
||||||
self.update_headers()
|
|
||||||
|
|
||||||
def update_headers(self) -> None:
|
def update_headers(self) -> None:
|
||||||
"""
|
"""
|
||||||
Update last / current / next track headers
|
Update last / current / next track headers
|
||||||
|
|||||||
@ -682,7 +682,7 @@ class PlaylistTab(QTableWidget):
|
|||||||
userdata_item.setData(self.ROW_TRACK_ID, 0)
|
userdata_item.setData(self.ROW_TRACK_ID, 0)
|
||||||
|
|
||||||
if repaint:
|
if repaint:
|
||||||
self.update_display(session, clear_selection=False)
|
self.update_display(session)
|
||||||
|
|
||||||
def insert_track(self, session: Session, track: Tracks,
|
def insert_track(self, session: Session, track: Tracks,
|
||||||
note: str = None, repaint: bool = True) -> None:
|
note: str = None, repaint: bool = True) -> None:
|
||||||
@ -981,22 +981,17 @@ class PlaylistTab(QTableWidget):
|
|||||||
self.resizeRowsToContents()
|
self.resizeRowsToContents()
|
||||||
self.setColumnWidth(len(columns) - 1, 0)
|
self.setColumnWidth(len(columns) - 1, 0)
|
||||||
|
|
||||||
def update_display(self, session, clear_selection: bool = True) -> None:
|
def update_display(self, session: Session) -> None:
|
||||||
"""
|
"""
|
||||||
Set row colours, fonts, etc
|
Set row colours, fonts, etc
|
||||||
|
|
||||||
Actions required:
|
Actions required:
|
||||||
- Clear selection if required
|
|
||||||
- Render notes in correct colour
|
- Render notes in correct colour
|
||||||
- Render current, next and unplayable tracks in correct colour
|
- Render current, next and unplayable tracks in correct colour
|
||||||
- Set start and end times
|
- Set start and end times
|
||||||
- Show unplayed tracks in bold
|
- Show unplayed tracks in bold
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Clear selection if required
|
|
||||||
if clear_selection:
|
|
||||||
self.clear_selection()
|
|
||||||
|
|
||||||
current_row: Optional[int] = self._get_current_track_row()
|
current_row: Optional[int] = self._get_current_track_row()
|
||||||
next_row: Optional[int] = self._get_next_track_row()
|
next_row: Optional[int] = self._get_next_track_row()
|
||||||
played = [
|
played = [
|
||||||
|
|||||||
@ -41,3 +41,7 @@ flakehell = "^0.9.0"
|
|||||||
requires = ["poetry-core>=1.0.0"]
|
requires = ["poetry-core>=1.0.0"]
|
||||||
build-backend = "poetry.core.masonry.api"
|
build-backend = "poetry.core.masonry.api"
|
||||||
|
|
||||||
|
[tool.mypy]
|
||||||
|
mypy_path = "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-oWgGw1IG-py3.9:/home/kae/git/musicmuster/app"
|
||||||
|
plugins = "sqlalchemy.ext.mypy.plugin"
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user