Commit Graph

1334 Commits

Author SHA1 Message Date
Anna Schumaker 5c267c8a9d curds: Add helpful library functions
This adds some convenience around controlling the library thread.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-03-26 11:20:01 -04:00
Anna Schumaker f715945536 curds: Add a tags.clear() function
This makes it a little easier to reset the tags before running a new
test.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-03-26 10:55:01 -04:00
Anna Schumaker 5469cb9298 rind: Reset the playlist treeview when changing playlists
We could put a lot of effort into deleting all the rows and resetting
them, but it's easier just to clear the model and set it again.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-03-24 17:35:24 -04:00
Anna Schumaker 16b5e1e990 rind: Add previous button and playlist to the UI
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-03-24 17:32:16 -04:00
Anna Schumaker e433097309 rind: Gst unit test cleanups
I noticed that I was getting some unexpected behavior due to the global
Audio class still running in parallel with my testing class. This patch
fixes that by adding an easy disconnect function for signals, and also
implements some other improvements to waiting for state changes.

Additionally, I added a check to see if we have already set the
playbin's "uri" property before picking the next track when calling
next().

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-03-24 17:30:56 -04:00
Anna Schumaker 3afffc54d4 curds: Add the Previous playlist to the playlist manager
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-03-23 13:43:54 -04:00
Anna Schumaker c794faf95c curds: Add a Previous playlist
This playlist is designed to hold all the tracks that have been selected
for playback, and iterate through them backwards if needed.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-03-23 10:15:17 -04:00
Anna Schumaker a5535a5daa curds: Set collection random value through the Playlist class
We still fix the value, but if we ever add extra handling in the base
class then we'll be able to catch it.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-03-23 10:13:59 -04:00
Anna Schumaker f765536c86 curds: Don't loop len(1) playlists
We need to check if looping is true, even if length is one, before
setting the current index.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-03-23 10:12:14 -04:00
Anna Schumaker 61d6221e30 rind: Change to the selected playlist
This doesn't change which playlist is currently playing music, but it
does change which one the user sees.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-03-22 17:42:15 -04:00
Anna Schumaker 014f2c89ab rind: Only allow selecting playlists in the sidebar
Selecting a playlist during scanning caused a segmentation fault so I
had to push row-changed signals into the main thread through the use of
an idle task.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-03-22 17:36:02 -04:00
Anna Schumaker e4755aae6d rind: Remove shadows from scrolled windows
And change the GtkPaned widget to have a small handle. This sets the
division between the playlist manager and the playlist to a single line,
which I think looks really slick

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-03-21 15:37:37 -04:00
Anna Schumaker e403fd6ba9 rind: Show the fill level when tracks are loaded
This is a small detail, but I like the idea of having an indicator when
tracks are loaded or not.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-03-21 14:22:14 -04:00
Anna Schumaker b9035abf8a rind: Respond to the playbin's about-to-finish signal
We use this to load the next track without changing the pipeline state,
which should give us smoother audio switching.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-03-21 14:14:43 -04:00
Anna Schumaker c447c9e2b7 rind: Clean up the gstreamer tests
The common setup and tear down code helps keep everything in sync.
Additionally, we no longer need to wait for duration changes, which have
always been unreliable.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-03-21 13:35:25 -04:00
Anna Schumaker a48a2ada76 rind: Set Title and Artist from gstreamer tags
This helps us prepare for the about-to-finish signal by setting this
information when gstreamer starts playing the next track.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-03-21 13:11:58 -04:00
Anna Schumaker bd37bfd3f7 gst: Don't pass "play" value to audio.load()
We don't have a reason to set this anything other than True, so let's
just automatically start playing the track. Additionally, change the
playbin to READY instead of NULL to help playback start a little faster.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-03-21 11:50:32 -04:00
Anna Schumaker a9f48534e5 rind: Add seek support
I put a smaller progress bar into the header area that users can use for
seeking or checking the current position. I also add two labels to show
time played and time remaining in the current track.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-03-21 09:52:39 -04:00
Anna Schumaker 5885228fd1 rind: Add a random button
We use this to toggle the random property of playlists

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-03-20 10:45:28 -04:00
Anna Schumaker ae92da8e82 rind: Escape text before setting title and subtitle
We're using GLib markup, so we need to escape special characters so they
can be drawn properly

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-03-20 10:31:36 -04:00
Anna Schumaker 754a8beadd curds: Add exception handling for invalid tracks
Users might have images or ripping logs mixed in with their tracks, so
let's make sure we don't crash if we try to scan one of these.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-03-20 10:12:02 -04:00
Anna Schumaker 72a947621c rind: Replace window title and subtitle with a custom widget
This lets me control size and justification of the text. Additionally, I
put everything into a scrolled window just in case a track has a really
long title name.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-03-20 09:58:23 -04:00
Anna Schumaker c636b3fd5e rind: More icon and spacing changes
I switch around the sidebar icons again, and also make the header bar
icons larger to make them easier to press with touchscreens

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-03-20 09:58:06 -04:00
Anna Schumaker e1c52e33b7 rind: Import gst from __init__.py
Otherwise it won't be loaded on startup.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-03-19 12:18:40 -04:00
Anna Schumaker 60da00adf8 rind: Add play, pause, and next buttons
And also change the window title and subtitle when loading a new track

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-03-19 12:17:58 -04:00
Anna Schumaker eb5b32893d curds: Change collection icon to audio-x-generic
This is a little larger than the emblem, so I think it'll look better

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-03-19 12:12:26 -04:00
Anna Schumaker 9341a56f11 curds: Change Library Playlist icons folder-music
Library paths are directories on disk, so it makes sense to use the
folder-music icon to represent them.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-03-19 11:22:20 -04:00
Anna Schumaker b42c654c2c rind: Begin audio code
I don't yet have UI widgets, but this should cover the basics of audio
playback.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-03-18 17:19:33 -04:00
Anna Schumaker e9e056e925 rind: PlaylistModel.get_value() should check for out-of-bounds iterators
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-03-18 17:18:16 -04:00
Anna Schumaker b642e762f7 curds: Add a next() function to the PlaylistManager
I'll eventually make this more complex when I add in more playlists, but
for now it just calls next on the Collection playlist

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-03-18 17:15:16 -04:00
Anna Schumaker 57b642265c rind: Add library playlists to the playlist manager
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-03-17 11:15:04 -04:00
Anna Schumaker 9f690ae204 curds: Make it easier for the UI to access the LibraryPlaylist class
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-03-17 10:59:09 -04:00
Anna Schumaker 524af59ec1 curds: Improve the LibraryManager
I change it to a sorted list for easier indexing by the UI iterators.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-03-17 10:58:44 -04:00
Anna Schumaker 0873f0458c curds: Add a less than operator for playlists
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-03-17 10:58:14 -04:00
Anna Schumaker e6cc3716eb rind: Add one to MangaerModel iter user_data
This lets us use 0 to represent a child that we haven't descended down.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-03-16 09:17:22 -04:00
Anna Schumaker 6539299212 rind: Add an iter_playlist() function to the MangaerModel
Converting between a TreeIter and a playlist is very useful, so
implement that functionality now.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-03-16 09:17:22 -04:00
Anna Schumaker 4c256f7656 curds: Add playlist to string formatting
We could do this in the UI, but it's almost easier to implement in the
backend.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-03-16 09:17:22 -04:00
Anna Schumaker a983947200 rind: Add another treeview for a playlist selector
Right now it just supports one level of playlists, but others will be
implemented as we go on.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-03-16 09:17:18 -04:00
Anna Schumaker ad9c79826c curds: Add icons to playlists
This UI is going to use this for the playlist selector

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-03-15 15:06:05 -04:00
Anna Schumaker 414545818f curds: Improve extracting ints from mutagen metadata
Some tracks in my library aren't formatted as expected, so let's improve
our parsing code to better handle integers.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-03-15 08:40:25 -04:00
Anna Schumaker 31d7ae26fa rind: Implement the PlaylistModel
This is a special tree model that translates our Playlist object into a
format that GTK understands.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-03-15 08:40:25 -04:00
Anna Schumaker 94ef044b59 curds: Add the PlaylistManager to the main import
This way the rind can use a global instance, rather than needing to make
their own,

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-03-14 12:07:30 -04:00
Anna Schumaker 7bbd1df902 curds: Playlists no longer inherit from list
I was having trouble with bound methods when using notifications, since
all empty playlists were getting identified as the same empty list
object. Removing the inheritance fixes the problem.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-03-14 12:06:07 -04:00
Anna Schumaker 3529aa5395 curds: Rename on-add notification to add-track
This matches the rest of my notification naming style

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-03-14 10:39:07 -04:00
Anna Schumaker d42492ced5 rind: Add gtk Application and Builder
I also add a basic UI file that contains the main window. I'll add on to
the gui from here.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-03-13 15:48:35 -04:00
Anna Schumaker 22b3953be0 curds: Create a Collection playlist type
This represents all tracks added to the collection, from across all
library paths. We also fix the value of Playlist.loop to "True" and
prevent changing it

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-03-13 10:37:47 -04:00
Anna Schumaker 57f32aaa58 curds: Only allow one instance of a track on playlists
This makes removing tracks from playlists way easier, since there is
only ever one instance of the track.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-03-12 14:54:05 -04:00
Anna Schumaker dca914860b curds: Add extra playlist next() tests
We want to make sure we get the expected results when calling next() on
empty playlists and with playlists that only have one track.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-03-12 11:09:00 -04:00
Anna Schumaker 63d6168229 curds: Add support for random next
I try to prevent the same track from getting selected twice in a row by
incrementing the current pointer rather than setting it directly, and
reducing the random range slightly.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-03-12 10:50:12 -04:00
Anna Schumaker 2286665024 curds: Add a function for picking the next track
If "loop" is True, then we loop back to the beginning of the playlist
when we reach the end.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-03-12 10:00:09 -04:00