We can just pass 0 to the sorted function to indicate that the playlist
shouldn't be sorted by default. Let's also take this chance to rename
playlist_generic_init_sorted() -> playlist_generic_init()
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
If we have two albums by the same artist in the same year (such as a CD1
or CD2 postfix), then we'll end up mixing them together when sorting.
Fix this by changing the default sort order to
Artist -> Year -> Album -> Track Number
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This will be needed by the gui to find the current count at any time,
without waiting for a callback.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
Otherwise we might crash when we attempt to look at ar_tokens[0].
Reported-by: Josh Larson <themutatedshrimp@gmail.com>
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
The readd(), readu(), and readhu() functions are all used to read
various forms of integers. The readl() and readw() are for reading
either lines or individual whitespace-delimited words
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
I rename cache_file_write() to file_write(), and implement the
corresponding file_read() for binary data.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
I also take this opportunity to add a OPEN_WRITE_BINARY mode to support
writing binary data to files.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This function currently only supports opening files for reading, but it
will soon be expanded to supporting writes as well. To support binary
reads, I add a new OPEN_READ_BINARY open mode.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
I'll eventually want to support text and binary files in both locations,
so cache files might need access to this too.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This change means removing cache files is now supported. As a bonus,
we try to remove empty subdirectories to keep down the clutter.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This might also be useful for cache files to track their current state.
To help with accurate tracking, I take this opportunity to add a CLOSED
state that files default to.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
I also introduce a "file_operations" struct that will be used in the
future to do slightly different things for cache and data files.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
And rework the init functions at the same time to reflect that data
files can now be placed under a subdirectory.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
I'm going to create a unified struct file that should be able to share
code between data and cache files. The first step is to push the old
structure to the side so it can still be used in other places.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
I eventually want to make these fields const in the file code, so we
need a different way to manage and eventually free these strings.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
If a matching track isn't found in the track database, then use the new
track_alloc_external() function to allocate an external track with the
correct tags.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
There might be rare occasions where users want to play a track that
exists outside their music library. This patch adds support for
allocating and freeing these external tracks without adding them to the
track database.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
I'm struggling to come up with a good way to combine code for this with
code for track_add(), since the lookup mechanism is basically the same.
I'll keep them separate for now and think on it some more.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
It's possible that the user may pass us a subdirectory of a path that
has already been added to the library. We can use this to prevent
double-adding tracks if the user does this. Additionally, this function
can be used to help look up tracks using only a filepath.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
I want to use this to prevent users from adding a subdirectory of a path
that has already been added to the library.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
Let's just do everything inline and cut out the extra function calls to
make the code simpler. I also created functions to help tests send EOS
or error messages.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
And use these to trigger the state changed callback. Additionally, this
callback can now be used by tests to determine when we're done seeking.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
We only play local music, so we know that we're using a file and we
don't need a uridecodebin to figure it out for us.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
Add some whitespace to make it easier to follow what everything is. I
also rename audio_bus to audio_old_id to make it easier to add in a new
audio bus. Additionally, I changed test_audio_player() to
test_old_player() to make room for the new pipeline.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
If we don't, then the Collection playlist will include hidden tracks
when it initializes.
Fixes#109: Hidden tracks showing up in Collection
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
Users may make typos in naming playlists, or they might think up better
names for playlists later. Let's be friendly and give users a way to
change playlist names if desired.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This saves ~75MB in my testing, and can be a useful memory savor for the
case where all album art has been downloaded.
Implements #96: Allocate g_thread_pool as needed
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This way we don't need to keep including the same core libraries in
almost every file.
Implements #83: Include useful headers in core/core.h
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
The core_init_data only held three items, most of which don't get set
during testing. Removing this struct means several tests no longer need
to define a "dummy" initdata object to pass around during init.
Implements #92: Remove core_init_data
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
And make them optional, that way tests don't need to keep creating fake
callbacks if they don't need anything from the audio layer.
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
Rather than offering two init functions for testing. This lets the UI
select if they want async idle tasks (like Album Art fetching).
Implements #90: Give idle_init an async flag
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>