This lets us do a lot of the basic Thread operations through common
code, allowing us to focus on tagging in this file instead of basic
Thread controls.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This is much faster than removing tracks from their playlists one at a
time. I also clear and reload the Tracks table to clear out pointers to
old Tracks.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This includes both creating new Tracks and updating existing Tracks when
their tags have changed. New tracks are added to playlists using
idle=True so Gtk can spread out UI updates for each playlist so we don't
slow things down too much for the user.
This patch also adds a library argument to the Tagger thread
get_result() function which we pass to the Tagger class to be used by
Tracks.creat(). I also add an mtime argument to the Tagger thread
tag_file() function to pass down to the audio.tagger layer so we can
skip updating tracks that have not changed since the last scan.
Implements: #41 (Check for new or modified tags during startup)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
I expand on the libraries_view to include additional playlist
properties, and configure the default sort order to sort by filepath.
I then set up the library_tracks_view to make it easy to select tracks
that belong to a specific Library.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
I need to do something slightly different for each Playlist.
* Collection: I load tracks from the collection_view, which filters
tracks to those where the library is enabled but not deleting.
* Favorite Tracks: I load tracks from the favorites_view, which filters
tracks based on the tracks.favorite and library.deleting column.
* Most Played Tracks: I load tracks with a playcount greater than the
average playcount of all tracks (rounded up to the nearest integer).
* New Tracks: I load tracks that have been added within the last week.
* Previous Tracks: I load tracks that have been played since startup
using the system_tracks table. I take care to clear these entries
in the table during startup.
* Queued Tracks: Load tracks from the user_tracks table.
* Unplayed Tracks: I load tracks with a playcount equal to 0 and remove
when they are played.
* User-Defined Playlists: Load tracks from the track_playlist_link
table.
Additionally, I implement move_track_up() and move_track_down() support
for user playlists and queued tracks.
Finally, I update the have-next-track property to take into account if
the Collection has tracks too.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This uses a combination of an Idle Queue, ReaddirThread, and tagger
Thread to scan a directory path and tag the audio files found within. I
do this by adding a scan() function to each Library object to begin
scanning (if not already running).
Libraries also have a stop() function to cancel any pending idle tasks
and stop any running threads. The Library table makes sure to stop each
Library object during shutdown so we don't leave any hanging threads.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This table allows us to work with Library playlists that are represented
by a filesystem path. The user can manually enable or disable library
paths to prevent their tracks from showing up in the Collection
playlist. Additionally, library paths have an online property to
determine if the library still exists in the filesystem to prevent us
from removing tracks due to a broken NFS mount or symlink.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>