Commit Graph

2248 Commits

Author SHA1 Message Date
Anna Schumaker e8d63a15cf audio: Add a function to toggle playing
This will be used by the gui when the spacebar is pressed by the user.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:01 -04:00
Anna Schumaker e752e0f826 audio: Don't escape filepaths
This will actually be done automatically by the gstreamer code.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:01 -04:00
Anna Schumaker e9c398f5ef model: Don't escape all fields
Only the tooltip column needs to have escaped text.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:01 -04:00
Anna Schumaker dfbb98b2c6 audio: Escape filepaths before loading
This is for filepaths containing special characters.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:01 -04:00
Anna Schumaker bf010f2a84 gui: re-add by / from lines to current track
These were accidentally removed a few days ago.  Put them back!

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:01 -04:00
Anna Schumaker 92f466c310 model: Escape text before setting column values
Otherwise there could be gtk errors.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:01 -04:00
Anna Schumaker 03b44b9e16 Update play count
When a track finishes, I tell the library to update playcount.  Then,
the library triggers a callback to the playqueue deck telling it to
update.

This patch also finds and prints the track that causes a gstreamer
error.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:01 -04:00
Anna Schumaker 30c0d97d56 gui: Use track filepath as tooltip
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:01 -04:00
Anna Schumaker d240ff44bc playqueue: Change cur when tracks are directly selected
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:01 -04:00
Anna Schumaker e9416e6ace library: Properly set the track primary_key from file
First this was missing, then I set it to the short path, now it's
correct.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:01 -04:00
Anna Schumaker 7a78e649a0 library: Separate error messages with line breaks
This condition is only hit when trying to tag files that aren't
recognized as audio files.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:01 -04:00
Anna Schumaker c9f1c07fa3 playqueue: Add a function to clear the playqueue sort order
I do this when reading in a saved library sort order to make sure the
correct values are set.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:01 -04:00
Anna Schumaker 8dbb4684c7 deck: Update test after sorting changes
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:01 -04:00
Anna Schumaker 63df51a847 library: Set primary key in the Library class
To prevent duplicates from being added to the library.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:01 -04:00
Anna Schumaker 362acf163b playqueue: More sorting improvements
- Reimplement binary search for neater code
- Flip sort order when resetting sort if the first field is the one we
  are sorting by.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:01 -04:00
Anna Schumaker 77e7101f85 playqueue: Binary seach edge cases
Because some things were still out of order.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:01 -04:00
Anna Schumaker 23a518cf5a playqueue: Sorting improvements
- Put empty tags last
- Correct and edge case in my binary search

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:01 -04:00
Anna Schumaker 2e67a645c8 design updates
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:01 -04:00
Anna Schumaker 782bcf0143 gui: Compress some of the model functions
This is to have a single function to set the user pointer value.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:01 -04:00
Anna Schumaker 6706a998ca gui: Improve sorting visuals
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:01 -04:00
Anna Schumaker 2962d792d7 playqueue: Add flags to disable sorting
The history playqueue should never change sort order, so use this flag
to prevent user changes.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:00 -04:00
Anna Schumaker 6a227df41b playqueue: Write library sort order to disk
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:00 -04:00
Anna Schumaker f83f8d47fa gui: Click columns to sort
I set up a 3-second timeout to decrement the count.  When the count is
at 0, I reset sorting on the playlist.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:00 -04:00
Anna Schumaker d430e09a59 playqueue: Generic sorting
I don't save the sort order yet.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:00 -04:00
Anna Schumaker 8ab973cd85 gui: Play tracks when rows are selected
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:00 -04:00
Anna Schumaker 6659f18de3 audio: Load tracks by trackid
Used to select specific tracks to play.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:00 -04:00
Anna Schumaker d434b7ebbb playqueue: Sort by a generic list of fields
Eventually I'll be able to click on column headers to change the sort
value.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:00 -04:00
Anna Schumaker ddbbf0ea49 playqueue: Improve insertion sort with a binary search
My test was done with a library size of 8040.

Before this patch, I make 21919628 calls to my "less_than" function.
With this patch, I now make 101205 calls to my "less than" function.

This comes out to a 216-X improvement.  I should have done this sooner.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:00 -04:00
Anna Schumaker e256c24b20 playqueue: Sort playqueues if PQ_SORTED is enabled
I don't have user-configurable sorting (yet), but for now I'm sorting by
Artist -> Year -> Track #.

I also fix a bug where the library wasn't lowercasing artist, album,
genere, and track fields when reading from file.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:00 -04:00
Anna Schumaker cde7e5d96c gui: Change default page
Start on the collection page.  I eventually want to display the first
enable playqueue, though.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:00 -04:00
Anna Schumaker 1b8c55b0fc gui: Escape text before setting labels
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:00 -04:00
Anna Schumaker 00706cc33f playqueue: Add a flag to disable unnecessary callbacks
The history and collection playqueues are never saved to disk, so I only
care about saving when a flag is changed.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:00 -04:00
Anna Schumaker b490322f55 library: Don't send notifications if the library is disabled
In other words, don't add tracks to the collection playqueue if they are
disabled.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:00 -04:00
Anna Schumaker 97be413bcf gui: Add a second-stage init function for tabs
This gives them a chance to check playqueue flags after the queues are
loaded.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:00 -04:00
Anna Schumaker 018c4747a2 gui: Watch for clicks on the random button
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:00 -04:00
Anna Schumaker a98443872c deck: Save the deck whenever a queue changes
I read in the saved file when init() is called.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:00 -04:00
Anna Schumaker e7ecbeacda gui: Use the playqueue flags for displaying the random button
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:00 -04:00
Anna Schumaker a4d680b00e gui: Make OcarinaPage inherit from a vbox
Now we are passed the page on the switch_page() signal.  This saves time
iterating and comparing.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:00 -04:00
Anna Schumaker aa40f1dfd5 gui: Create a history tab
Used to show tracks that have recently played.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:00 -04:00
Anna Schumaker 6446b7e5ad audio: Access function for recent playqueue
The recent playqueue is needed for the history tab.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:00 -04:00
Anna Schumaker 7d10ebe5c3 gui: Split apart tab and tab label
I made a new tab label class to make it easier to have a few labels with
different layouts.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:00 -04:00
Anna Schumaker 9e68f8213b gui: Adjust tab sizing
Because "year" only had 1 pixel and wasn't showing up.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:00 -04:00
Anna Schumaker 60c35219c2 gui: Implement seeking
You can either click + drag the slider or use the keyboard to change the
current position.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:00 -04:00
Anna Schumaker 00d5258902 gui: Begin playback when pressing the next() button
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:59 -04:00
Anna Schumaker 2b57be8c66 audio: Send on_pause() callback when autopausing
Also seek to 0 when choosing the next track.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:59 -04:00
Anna Schumaker e1dbdb3ffb playqueue: Fix generated status string
- Correct spelling of "minutes"
- Don't pluralize if duration is only 1

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:59 -04:00
Anna Schumaker 3d44d20b31 gui: Fix arguments to ocarina_init()
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:59 -04:00
Anna Schumaker 05148ba832 gui: Add UI controls for changing pause status
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:59 -04:00
Anna Schumaker 1c99042efd audio: Add callbacks for changing pause status
When the count is changed or pausing finishes, I trigger this callback
to notify the UI.  I also added in a line to enable pausing any time the
count is incremented.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:59 -04:00
Anna Schumaker c346a5860a gui: Implement control buttons
Play, pause, stop and so on.  I also update labels and progress bars
during playback.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:59 -04:00