Did some memory optimisation, moved some files and created a completely not tested gui class that will list an artist's tracks.
Made tracks return an already existing object when they get created with a path of an already existing track object.
This commit is contained in:
parent
9ae1704e4a
commit
7edaebc3c3
7 changed files with 77 additions and 4 deletions
|
@ -2,9 +2,10 @@
|
|||
|
||||
import os
|
||||
from PyQt6.QtWidgets import QTabWidget, QAbstractItemView
|
||||
|
||||
from ..player.playlist import Playlist
|
||||
from ..ui.library import LibraryWidget
|
||||
from ..ui.playlist import PlaylistView
|
||||
from ..ui.library.library import LibraryWidget
|
||||
from ..ui.playlist_view import PlaylistView
|
||||
|
||||
|
||||
class Library:
|
||||
|
@ -18,9 +19,13 @@ class Library:
|
|||
self.main_library_widget = LibraryWidget(self)
|
||||
self.library_widgets = [self.main_library_widget]
|
||||
|
||||
self.loaded_tracks = {} # dict of {track path: track}
|
||||
|
||||
self.playlists = []
|
||||
self.temporary_playlist = None
|
||||
|
||||
self.artist_playlists = []
|
||||
|
||||
def load(self):
|
||||
self.load_playlists()
|
||||
|
||||
|
@ -77,6 +82,8 @@ class Library:
|
|||
if self.app.player.current_playlist is not None:
|
||||
self.app.settings.latest_playlist = self.app.player.current_playlist.path
|
||||
|
||||
print(self.loaded_tracks)
|
||||
|
||||
def new_playlist(self):
|
||||
playlist = Playlist(self.app, self.app.utils.unique_name("New Playlist"))
|
||||
playlist.loaded = True
|
||||
|
@ -121,3 +128,11 @@ class Library:
|
|||
def import_playlist(self, playlist_path: str):
|
||||
self.open_playlist(playlist_path)
|
||||
|
||||
def loaded_track(self, track_path: str):
|
||||
"""
|
||||
Returns either a loaded track with the given path or None if there is none.
|
||||
"""
|
||||
|
||||
if track_path in self.loaded_tracks:
|
||||
return self.loaded_tracks[track_path]
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue