Commit Graph

548 Commits

Author SHA1 Message Date
Bryan Schumaker 517faceb99 libsaria: Add tasks to the front and back of the queue
Queueing a task to run immediately can be useful, especially if it's
something like saving data as part of a "checkpoint"
2011-09-27 08:22:24 -04:00
Bryan Schumaker a97da1dd05 libsaria: Create the saria dir on startup
This is either ~/.saria or ~/.saria-debug, depending on if we're running
a debug build or not.
2011-09-22 08:21:57 -04:00
Bryan Schumaker 2017e8a2f1 libsaria: Play tracks based on inode number
This allows the UI to pass in an inode returned by the track list used
to set up the display.
2011-09-20 08:34:02 -04:00
Bryan Schumaker 0326b9c7e4 libsaria: Add accessor functions for Track and Tag classes
I need to get at these variables to add them to a list in the UI
2011-09-19 19:47:31 -04:00
Bryan Schumaker 6dfe4de57b libsaria: Create a list of all tracks in a library
This list will eventually be used to fill in a gtk listview, but for now
I gather all the information in one place.
2011-09-18 18:06:54 -04:00
Bryan Schumaker 69beb10d6b libsaria: Added LIBRARY_REFRESH callback
This callback is triggered during a library update to tell the UI that a
new version of the library is available.
2011-09-18 17:25:57 -04:00
Bryan Schumaker 7aff13f382 libsaria: Add tags to the library
I add each scanned track to the library for use later.
2011-09-18 12:20:59 -04:00
Bryan Schumaker a685023bcb libsaria: Convert length into a string
I format it into mm:ss format for UIs to display.
2011-09-18 11:39:18 -04:00
Bryan Schumaker 3255b045f0 libsaria: Find audio properties of each scanned song
This gives me the length, bitrate, sample rate and number of channels.
2011-09-18 11:23:44 -04:00
Bryan Schumaker 333a3a4b04 libsaria: Tag files to add to the library
I collect the artist / album / title / ... tags and add them to a class.
2011-09-17 14:16:06 -04:00
Bryan Schumaker 2c2e058b49 libsaria: Use new print functions
This mostly involved switching each print() to a println() to end the
line.
2011-09-17 13:50:13 -04:00
Bryan Schumaker ef5da936b4 libsaria: New print functions
I added a print(int) function to print out integer values.  I also
created println() functions for strings and ints.
2011-09-17 13:48:09 -04:00
Bryan Schumaker 1abdd945ae libsaria: Create scan tasks for each subdirectory
I want to recursively scan each directory for music files.
2011-09-17 12:56:39 -04:00
Bryan Schumaker 5167c6f012 libsaria: Read a directory into two vectors
I separate out directories and files so they can be processed
differenty.
2011-09-17 12:27:20 -04:00
Bryan Schumaker 59fbd0c696 libsaria: Notify UI when the idle queue size has changed
When the first task is queued, I trigger a callback so the UI can start
processing when idle.  I return the size of the queue from both
run_task() and queue_task() so the UI knows when to stop processing
callbacks.
2011-09-13 17:27:46 -04:00
Bryan Schumaker e94ca6b9d6 libsaria: Rename UpdateTask to ScanTask
I feel that ScanTask is a better name
2011-09-13 08:04:59 -04:00
Bryan Schumaker b84b7b415d libsaria: Remove .swo files
They shouldn't have been added in the first place...
2011-09-13 08:04:25 -04:00
Bryan Schumaker b43fcc4b05 libsaria: Queue an idle task to update the library
I don't actually perform a library update at this point, but I do create
a new task and add it to the update queue.  When the run_task() function
is called, the task is removed from the queue and deleted.
2011-09-12 14:18:23 -04:00
Bryan Schumaker 7840f491a1 libsaria: Move idle header files to idle directory 2011-09-12 11:27:58 -04:00
Bryan Schumaker 8a83b57010 libsaria: Create a new include/libsaria/audio.h
This file contains the audio init function.
2011-09-12 11:20:12 -04:00
Bryan Schumaker 679bf41cc1 libsaria: Move include/audio.h to the audio directory
The audio class can easily be defined in a file located in the audio/
directory.  This frees up the audio.h name for a UI-facing include file.
2011-09-12 11:14:23 -04:00
Bryan Schumaker d3b8020bbe libsaria: Remove libsaria class
I replaced the class functions with simple functions that exist in
multiple files.  I think things will be easier to work with now.
2011-09-12 11:08:56 -04:00
Bryan Schumaker dbce5c244a libsaria: Move idle trigger to new file
I think the idle code will be easier to manage if it is in its own file.
2011-09-12 10:38:27 -04:00
Bryan Schumaker c3eb748f44 libsaria: Move idle object out of libsaria class
This helps me prepare to remove the libsaria class.
2011-09-12 10:30:22 -04:00
Bryan Schumaker 33fe24fc64 Remove callbacks from libsaria class
These can easily exist as its own set of functions, and I want to remove
the libsaria class in the future.
2011-09-10 13:46:09 -04:00
Bryan Schumaker 84c0f7fe21 libsaria: Create an idle driver and idle task
Right now both classes are empty, but eventually I will add in support
for creating new idle tasks and for removing tasks from the idle queue.
2011-09-10 11:22:03 -04:00
Bryan Schumaker bd6aea830b libsaria: Fix finding audio duration
I needed to pass in a value for the format argument...
2011-09-03 23:09:31 -04:00
Bryan Schumaker ded2c559af libsaria: Fix up the audio seek() function
It now seeks forward or backward through a song by dt seconds.
2011-09-03 23:03:31 -04:00
Bryan Schumaker 77a7f84110 libsaria: Created a seek_to() function
This function will seek to an absolute percentage of a song, rather than
by some displaced amount.
2011-09-03 22:32:12 -04:00
Bryan Schumaker 4b3b1babbc libsaria: Add progress file
This will include code for seeking and getting the current position in
the song.  Right now I just have a function for resetting the position
to the beginning of the song.
2011-09-03 21:55:42 -04:00
Bryan Schumaker e10a8e97f4 libsaria: Create convenience functions for libsaria
Now I won't have to keep using libsaria_get() to access parts of
libsaria.  This should also cut down on the number of things that need
to be recompiled when libsaria is changed...
2011-09-03 21:07:52 -04:00
Bryan Schumaker ceddd240ca libsaria: Added a get_volume() function
I use this function to get the current volume levels.  I added and extra
variable to the Audio class to track what the current volume is.
2011-09-03 10:24:34 -04:00
Bryan Schumaker 5a8cafa4d8 libsaria: Add a VOLUME callback
This will be triggered whenever the volume changes through the libsaria
class.
2011-09-03 10:08:54 -04:00
Bryan Schumaker f354a305ae libsaria: Change volume function
I introduced a function for directly setting the new volume level.  It
does not allow changing by some value.
2011-09-03 09:49:09 -04:00
Bryan Schumaker feaa34b8db libsaria: Remove audio check_state() function
It was empty because I decided to go along a different route.
2011-08-27 12:40:10 -04:00
Bryan Schumaker bf1d423b2f libsaria: Don't auto-load songs passed on startup
I would rather have the front end program load the song rather than
assuming that everything should be loaded right away.  This also gives
front end programs a chance to register callbacks before loading.
2011-08-27 12:35:28 -04:00
Bryan Schumaker 2888e741e8 libsaria: Added callback framework
I have created generic functions for registering and triggering
callbacks.  New callbacks can be added by creating a new constant in the
callback_t enum.
2011-08-27 12:34:19 -04:00
Bryan Schumaker 5dea1ae42a libsaria: Audio return values when changing state
play() and pause() now return true or false base on if the state change
request succeeds or fails.  This can be used later to determine if a
callback should be triggered.
2011-08-27 12:32:06 -04:00
Bryan Schumaker 1831046685 libsaria: Created a load() function
Calling this function will load a song.
2011-08-23 08:28:35 -04:00
Bryan Schumaker 6e47ec49df libsaria: Added a stop function
I stop playback, and seek to the beginning.  I do this as to different
function calls in the Libsaria class so callbacks will still trigger
(once they have been implemented).
2011-08-22 08:27:34 -04:00
Bryan Schumaker 3e2f374bf8 libsaria: created Audio() class
This class will be used to control gstreamer functions.  So far, it can
load a song, play, and pause.
2011-08-21 19:24:33 -04:00
Bryan Schumaker ec2c848a90 Libsaria class can play and pause music
Eventually the class will contain an audio instance, so there won't be a
global play or pause function anymore.
2011-08-21 18:10:18 -04:00
Bryan Schumaker dd5ad9e87d Began Libsaria() class
This class will act as an interface for the Ocarina front-end.
2011-08-21 15:45:15 -04:00
Bryan Schumaker b939fa12a4 Print function only prints if debugging is enabled
I want to keep actual output to a minimum when running a release
version.
2011-08-21 15:27:59 -04:00
Bryan Schumaker ae5b3a358e Play and pause buttons work
They play and pause music...
2011-08-20 12:12:53 -04:00
Bryan Schumaker 53d8718053 Open a window and play a song
I start ocarina with a file.  I play the song right away, and open a
window so that gtk_main() can quit when closed.
2011-08-15 07:53:25 -04:00
Bryan Schumaker c0ace6fed6 Basic initializiation code
I print some messages to the screen and I have a makefile to compile
libsaria and gui code.
2011-08-14 11:35:37 -04:00
Bryan Schumaker b8e8f7179c Remove Ocarina 4 files
Get them out of the way to begin work on Ocarina 5
2011-08-14 10:46:22 -04:00
Bryan Schumaker 1a45e95f9a Ocarina 4.9 2011-06-24 23:45:04 -04:00
Bryan Schumaker 4b852eff28 libsaria: Fix dattr access
dattrs need a song id to search the dictionary.  I was passing the name
of the requested attribute instead.  As a result, dattrs were always
returning the default value.
2011-06-24 23:21:44 -04:00
Bryan Schumaker 9be5b10112 libsaria: Clear cur_id when loading file
This allows me to return the correct attributes for a random song loaded
by the user.
2011-06-23 10:21:24 -04:00
Bryan Schumaker f87f5f25cf libsaria: Run server based on stored stetting
I have a toggle_state() function to toggle the server and save the state
for the next session.
2011-06-18 14:09:27 -04:00
Bryan Schumaker 868359a4a4 libsaria: Catch errors when writing cache files
The user doesn't want to see these...
2011-06-18 13:27:21 -04:00
Bryan Schumaker e6ba5c3139 libsaria: Remove path from library
I need to delete it, save the library, and rebulid the tree and index.
2011-06-18 11:22:24 -04:00
Bryan Schumaker 083cbf738c libsaria: Added function for listing the library
This makes it easier for the gui to know what is in the library.
2011-06-18 11:09:44 -04:00
Bryan Schumaker e055976e07 libsaria: Start server in a try / except block
I can catch the exception and print out a nicer message this way.
2011-06-18 10:24:45 -04:00
Bryan Schumaker 72f7ec90eb libsaria: Remove unused function
I don't need the file_empty() function in the cache anymore
2011-06-18 09:44:34 -04:00
Bryan Schumaker 7319767ac3 libsaria: Don't automatically create cache file
The cache filler function will pass back a string to be written to this
file.  If this string != None, then I create the file and fill it.
2011-06-18 09:39:55 -04:00
Bryan Schumaker e6849dc5cd libsaria: Only delete empty cache files
For some reason I was trying to delete files that don't even exist in
the cache!  This was stupid and caused an error.  Now I only delete
empty files
2011-06-18 09:28:53 -04:00
Bryan Schumaker 97902d0730 libsaria: Remove print statement
I added it for debugging.  I don't need it anymore.
2011-06-17 23:53:01 -04:00
Bryan Schumaker e8e0c5d743 libsaria: Return album art as part of all_attrs()
If the album art exists, I might as well return it so it can be set in
the main gtk thread.  If it doesn't exist, I'll trigger a web search for
it.
2011-06-17 23:42:20 -04:00
Bryan Schumaker 851c7251a2 libsaria: Wrong variable initialization
Finding attributes for songs not in the library will run if "found"
is initialized to False instead of True...
2011-06-17 23:21:23 -04:00
Bryan Schumaker 12cb9a900a libsaria: Switch most code to use all_attrs()
all_attrs() is my new way of doing things, so it makes sense to use it
now.
2011-06-17 20:23:32 -04:00
Bryan Schumaker 2c341085b4 libsaria: Add sources.get_cur_id()
I think a function for finding the current song id will be useful if I
want to remove the old get_attrs() function...
2011-06-17 20:02:11 -04:00
Bryan Schumaker 645b70b33c libsaria: Introduce libsaria.sources.all_attrs()
This patch introduces a new function "all_attrs()" which will return a
dictionary containing all the attributes for the current song.  To help
the gui, I pass this dictionary during an on_load() callback.
2011-06-17 19:47:04 -04:00
Bryan Schumaker 5a735aa625 libsaria: Clear cur_id correctly
I do this if the song isn't found in the library, rather than as part of
opening a track from disk.
2011-06-16 18:53:27 -04:00
Bryan Schumaker 8f3c4b7c6f libsaria: Fix library browser web page
It needs to use the new library functions to avoid an error.
2011-06-16 18:19:42 -04:00
Bryan Schumaker 9bc22e0d1d Begin Ocarina 4.9 2011-06-16 18:19:22 -04:00
Bryan Schumaker 05ae0a2505 Ocarina 4.8 2011-06-16 11:15:45 -04:00
Bryan Schumaker 23781e24a8 libsaria: Sometimes the server doesn't exist
I shouldn't try shutting down the web server if it hasn't been imported.
This will only lead to an error...
2011-06-16 11:15:01 -04:00
Bryan Schumaker 0e5bd0d908 libsaria: Fix library updating
I need to reindex and rebuild the tree on each update.  I also need to
notify the front-end that things have changed.
2011-06-09 09:44:40 -04:00
Bryan Schumaker e0ad57c541 libsaria: Fix playing songs from outside of library
The song was loading, but attributes weren't updating.  I also use this
patch to begin playback when a song is loaded (I was tired of manually
pressing play every time)
2011-06-09 08:35:02 -04:00
Bryan Schumaker 071257d77d libsaria: Fix saving playlists
I was still using old functions, rather than my new ones.
2011-05-29 18:22:29 -04:00
Bryan Schumaker 1f84f2755b libsaria: Fix playlist num_visible()
When the playlist is changed, I need to test song ids against the
visible set to get the correct number
2011-05-29 14:59:29 -04:00
Bryan Schumaker 884c55cdd5 libsaria: Fix queue num_visible()
When songs are removed from the queue, they should also be removed from
the visible set, otherwise num_visible() will never change.
2011-05-29 14:59:15 -04:00
Bryan Schumaker c9dee00727 libsaria: Actually add libsaria.sources.attrs
I forgot to add this file a few commits ago... oops...
2011-05-28 16:15:07 -04:00
Bryan Schumaker 0a644752a4 libsaria: Add in play count dattr
I want to track how often songs are played.  This patch gives me the
ability to do that.
2011-05-28 16:13:02 -04:00
Bryan Schumaker 49f7829706 libsaria: Add dynamic attributes
Dynamic attributes are attributes of a track that can change during run
time (like status, playcount, etc).  I only initialize these when they
are first set, and I save after each change.

This patch adds in the dattr framework and the "like" dattr.
2011-05-28 16:04:42 -04:00
Bryan Schumaker 114ac13c7a libsaria: Added TODO idea to playlist
I want to do type checking after loading objects.  This can be done once
during storage.load_obj, rather than after load_obj
2011-05-28 15:40:19 -04:00
Bryan Schumaker 1cbb1fb969 libsaria: Remove more path code 2011-05-26 16:04:07 -04:00
Bryan Schumaker 07c673fa47 libsaria: Remove unused libsaria.path code
I eventually want to get rid of this directory, so removing this code
helps.
2011-05-26 15:55:59 -04:00
Bryan Schumaker e59a613499 libsaria: Remove Source() class
Nothing uses it anymore, so it can be removed.
2011-05-26 09:25:56 -04:00
Bryan Schumaker 6398b3dd9a libsaria: Find attributes for songs not in library
I use the same Track() class that the library does.  I have to create
an instance of this class each time the function is called, but this is
ok since it is not the case I am trying to optimize for.
2011-05-26 09:18:43 -04:00
Bryan Schumaker b7a45a3e18 libsaria: Controls need to import libsaria
I don't know why I didn't already do this...
2011-05-26 09:02:06 -04:00
Bryan Schumaker 38b075a701 libsaria: Turn get_attrs_id into a function pointer
I was doing an extra python lookup every time this function was used.
Turning it into a function pointer should cut down on this.
2011-05-25 21:22:23 -04:00
Bryan Schumaker 756c98285b libsaria: Only shutdown server when server exists
I now always call the shutdown() function to close the server.  This
function checks if the server pointer has been set, and if it has it
calls the server's shutdown() function.
2011-05-25 21:09:43 -04:00
Bryan Schumaker c79677e77a libsaria: Initialize controls on import
This avoids an unnecessary function call, it also makes things easier to
read and maintain.
2011-05-25 21:07:53 -04:00
Bryan Schumaker d41286c83c libsaria: Import lastfm during import
I was doing this during an init() function.  It should be more efficient
to just do this right away.
2011-05-25 21:00:07 -04:00
Bryan Schumaker e2c4d78fa8 libsaria: Remove oldlibrary
Nothing uses it anymore, so it can be removed.
2011-05-25 20:50:46 -04:00
Bryan Schumaker 46b7f35224 libsaria: Remove oldlibrary from startup
Now it is no longer being imported anywhere.  I think I can remove it
now...
2011-05-25 20:48:32 -04:00
Bryan Schumaker 6bc6235e01 libsaria: Remove unused import pointers 2011-05-24 08:06:03 -04:00
Bryan Schumaker 9505373198 libsaria: inc_count() in sources
Doesn't do anything yet, but it will eventually (once I start tracking
dynamic attrs)
2011-05-24 08:02:18 -04:00
Bryan Schumaker 6b0ccce530 libsaria: Remove oldlibrary from export code 2011-05-24 07:58:47 -04:00
Bryan Schumaker d8f47e8d4d libsaria: Remove new_source() functions
I have new functions for creating the library, so this (and associated
callbacks) are no longer needed.
2011-05-23 10:07:19 -04:00
Bryan Schumaker 913ee9f931 libsaria: Remove library export and import
Using export / import functions for library updates can be a pain.  I
don't plan on changing the library file format any time soon, so I don't
need to keep this code around.
2011-05-23 10:04:05 -04:00
Bryan Schumaker c4629024a6 libsaria: Add ids to queue visible set
When adding songs to the queue, we also need to add the ids to the
visible set if they are visible.  Without this step, we won't have an
easy way of knowing how many IDs are visible.
2011-05-23 09:18:30 -04:00
Bryan Schumaker d7ba67ee38 libsaria: Remove oldlibrary usage from playlist
The idea is to remove this from everywhere.  The playlist is a good
start.
2011-05-23 09:05:56 -04:00
Bryan Schumaker de1acd8a23 libsaria: Playlist filtering and next() fixes
I removed the old playlist filtering code, since I now have a generic
way of doing this.  I also fixed the next function to use the revised
get_attrs() function.
2011-05-22 10:14:10 -04:00
Bryan Schumaker bfeeb7f568 libsaria: Correct library num_visible()
Simply return the length of matching songs in the index.
2011-05-22 09:45:10 -04:00
Bryan Schumaker 39198ff2ce libsaria: Set initial matching ids
This should be initialized to the set of all ids to begin with.  That
way everything will match.
2011-05-22 09:34:30 -04:00