Commit Graph

1092 Commits

Author SHA1 Message Date
Anna Schumaker a74cd5e6d1 tests: Update tests for recent deck change
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:02 -04:00
Anna Schumaker 37a776ef24 playqueue test fixes
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:02 -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 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 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 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 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 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
Anna Schumaker 0f11ba0ee6 gui: Create a new test for the Collection tab
This is a bit cleaner that having one giant switch-statement based test.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:59 -04:00
Anna Schumaker 078cb546f5 deck: Initialize deck before library during testing
To properly set up callbacks.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:59 -04:00
Anna Schumaker e94063473e database: Check if files exist before opening
This prevents an error message (and possible corruption) by continuing
with the open() function even if the file doesn't exist.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:59 -04:00
Anna Schumaker 36b76dcfc3 tests: Exit on test failure
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:58 -04:00
Anna Schumaker 22cb20d4ce audio: Change state to NULL before quitting
This prevents a possible hang when de-initializing gstreamer.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:58 -04:00
Anna Schumaker aa21ab5602 file: Strip leading whitespace when reading strings
This was a bug I discovered when double clicking on paths in the
collection manager to change the path in the FileChooserWidget.

Before this patch, strings could be read as:
	<string> /home/anna/Music</string>

Now, the same string will be read as:
	<string>/home/anna/Music</string>

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:58 -04:00
Anna Schumaker 3d1e8872d3 gui: Create a common ocarina_init()
To initialize the needed backend modules, shared by normal main() and
testing main().

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:58 -04:00
Anna Schumaker 2ecb37f6dc Everything for a custom Gtk::TreeModel
I implemented an entire Gtk::TreeModel in this commit, plus some minor
supporting code in the library to look up playlist entries by index.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:58 -04:00
Anna Schumaker a0067c4542 gui: Respond to playqueue changed callbacks
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:58 -04:00
Anna Schumaker 2724b90281 gui: Add initial extra notebook tab
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:58 -04:00
Anna Schumaker f80203c5fe gui: Delete and disable library paths
The signal connections for these features are really difficult to test
programmatically, but I can test the effects by calling each function
directly.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:58 -04:00
Anna Schumaker f51ba3e3ec library: Create a function for enabling and disabling paths
I also update the deck tests, since this is where changes will show up.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:58 -04:00
Anna Schumaker a077b8cbad gui: Change directory on row double click
This allows a user to explore what has been added in each of their
library paths.  Right now I filter for directories only, but it may be a
good idea to change this in the future.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:58 -04:00
Anna Schumaker 74da7beba1 deck: Add a library playqueue
When no songs are on the deck a track will be played from the library.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:58 -04:00
Anna Schumaker 2535a2fe56 playqueue: Add a way to delete rows by track_id
This will be used to delete tracks that no longer exist in the library.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:58 -04:00
Anna Schumaker c2e7772ebe callbacks: Add initial callbacks
This patch adds library callbacks for adding a new path and for updating
tracks in a path.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:58 -04:00
Anna Schumaker 11704b2bfa gui: Add some collection manager tests
Test ok, update, and import buttons in a Glib::timeout based simulator.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:58 -04:00
Anna Schumaker eff294a7c7 library: Added an update_all() function
To update all paths in a library.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:58 -04:00
Anna Schumaker becf7f94bc gui: Begin implementing the gui
This adds the ocarina6.glade file and code for clicking the library
import button.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:58 -04:00
Anna Schumaker bb7c3b334a audio: Update expected output file
Somehow I missed this during my updates earlier.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:58 -04:00
Anna Schumaker c39a9058f4 tests: Update the Sconscript file
I reordered all the tests and adjusted for the subsystem renaming.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:57 -04:00
Anna Schumaker 5c5e4a1a66 audio: Implement the previous() function
To iterate backwards through the list of recently played songs.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:57 -04:00
Anna Schumaker bd2aaf73d1 audio: Updates for spec changes
This is mostly to add in checks for try / catch style error handling.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:57 -04:00
Anna Schumaker 360ebed1fa errors: Rename error codes
Gstreamer includes <errno.h>, which already defines several of these
symbols.  I rename them to avoid namespace collisions.  Perhaps a better
solution would be to use the errno.h definitions directly?

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:57 -04:00
Anna Schumaker 1d559865c8 deck: Updates for the playlist -> playqueue renaming
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:57 -04:00
Anna Schumaker 8e363fe7b2 playqueue: Add a function for resetting the current pointer
This is used for the recently played playqueue to iterate backwards when
the previous() function is called.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:57 -04:00
Anna Schumaker e889ca538f playqueue: Implement length tracking
I use this to know the running time of the playqueue, which will be
displayed on the GUI.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:57 -04:00
Anna Schumaker 82a57ec2b5 playqueue: Updates for my recent renaiming
Rename everything from playlist -> playqueue.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:57 -04:00
Anna Schumaker 5dd5ec6db0 library: Add a lookup_path() function
This returns a pointer to the library :: Library structure requested.
The gui will use this to display information about each path.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:57 -04:00
Anna Schumaker fa51433b94 library: Track the size of each path
I track the size of each library path for display purposes.  I also had
to add in a check for if a new track already exists in the db before
tagging it so updating a library should be much faster now.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:57 -04:00
Anna Schumaker a2665d4e41 library: Implement importing old libraries
This adds backwards-compatibility for Ocarina 5.11 libraries.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:57 -04:00
Anna Schumaker 94fdfda9fb file: Point FILE_TYPE_LEGACY to ~/.ocarina/library/
The legacy file type will only be used for importing old libraries, so
point things to this directory on construction.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:57 -04:00
Anna Schumaker 371b988dac library: Various updates
- Combine Artist and Genre struct
- Add in exceptions, rather than boolean returns
- Update the library through idle tasks

I have not implemented importing Ocarina 5.11 libraries yet.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:57 -04:00
Anna Schumaker 114c22bb12 playlist: Implement reachitecting of playlists
I changed the two playlists that are supported, added in exception
handling, and removed the list() function since I will always know the
names of playlists.  I also rename everything to "playlist" from
"group".

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:57 -04:00
Anna Schumaker 914473e10a Rename playlist and group source files
Playlist -> playqueue
Group -> playlist

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:57 -04:00
Anna Schumaker ee100c0238 filter: Implement a "to lowercase" function
This function will convert the provided text to lowercase.  This really
isn't a filter function, but the filter already implements a lowercase
cache that should be useful.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:57 -04:00
Anna Schumaker acd8bd7b23 database: Implement updates to match my current design
- Force the primary key to be a string
- Throw error codes rather than 0

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:57 -04:00
Anna Schumaker ab8c15ecb7 file: Implement minor design changes
I had been returning success / failed boolean values for various
operations.  I think it's better to throw an exception in these
"exceptional" circumstances since error values can give more information
about why a function failed.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:57 -04:00
Anna Schumaker c65c8b06f2 audio: Implement pause after N tracks feature
This patch implements the pause-after-N-tracks feature.  I also included
various improvements to the audio code.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:56 -04:00
Anna Schumaker ee9a98737a audio: New features and improvements
- Seek(), position() and duration() functions are implemented
  - There are bugs in the test program :(
- Clean up next()

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:56 -04:00
Anna Schumaker edbdd1c66f audio: Begin implementing audio code
I have written play(), pause(), next() and seek_to() so far.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:56 -04:00
Anna Schumaker b8b215be35 deck: Save and restore the playlist deck
The read and write functions will be called by a higher up layer, so I
need to open the file manually in the test.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:56 -04:00
Anna Schumaker 83a8b5ae1d deck: Implement next()
I make sure to remove empty playlists from the deck and throw an error
if there are no playable tracks on the deck.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:56 -04:00
Anna Schumaker fecc10ab5e deck: Implement basic deck features
- Add playlists
- Remove playlists
- Rearrange playlists
- Get a playlist based on id

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:56 -04:00
Anna Schumaker 0c01751946 playlist: Implement next()
Random and sequential next, for both locked and unlocked playlists.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:56 -04:00
Anna Schumaker 168f08392d playlist: Implement read() and write()
The file will be passed in by the deck layer, since it stores multiple
files.  I just fake up a file in test_2() that is used for storing the
playlist.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:56 -04:00
Anna Schumaker 3a478ddba7 playlist: Implement playlist modification functions
I can now add and remove tracks, in addition to asking for the playlist
size.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:56 -04:00
Anna Schumaker 2d13b74c12 playlist: Create the initial playlist class
Right now it just knows the value of its flags variable.  More to come
soon!

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:56 -04:00
Anna Schumaker a3cf5daa18 library: Test adding new files to a directory
I recreate the directory deleted in test 6c and make sure everything is
added back to the database in new rows.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:56 -04:00
Anna Schumaker b759b9743d library: Implement library path validation
I scan the track database and remove files that no longer exist.  I
don't yet add in new tracks found in the directories.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:56 -04:00
Anna Schumaker 98f97b723a library: Update test 4
I made sure it's working and updated the expected output.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:56 -04:00
Anna Schumaker a50d8f6e0a database: Allow templated keys to the database index
This allows me to have a std::pair<> as a key if needed.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:56 -04:00
Anna Schumaker eaafaeb7d4 library: Updates for new database design
I need a templated primary key system to group together albums with
years.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:56 -04:00
Anna Schumaker 99718ade43 filter: Update filter test for Index class removal
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:56 -04:00
Anna Schumaker 97d889531a index: Remove the index class
This patch updates the design so indexes are built upon databases using
a special IndexEntry.  I also updated the tests/index/ test to match
the new system, but I have not updated filter or group tests yet.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:56 -04:00
Anna Schumaker f0533ef663 database: Make all databases unique
I require entries to have a "primary key" that is stored in a map to
make it easy to find database rows by key.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:56 -04:00
Anna Schumaker 4fc09978dc library: Lookup a song by id
If the id is valid, I fill out a song structure and return true.
If the id is invalid, I return false.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:55 -04:00
Anna Schumaker e314248f10 library: Find tags for each track
This is each song's track number, play count, and anything else specific
to a single file.  After updating, save all the changed databases.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:55 -04:00
Anna Schumaker 3f943aa1d6 library: Find album and genre tags
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:55 -04:00
Anna Schumaker 10fd3292fd library: Scan a directory
I don't build up a complete set of databases yet, but I do create the
Artist name database to use later.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:55 -04:00
Anna Schumaker 81429b0229 library: Add support for saving and restoring the library
Eventually these functions may have to become idle tasks, but for now I
write to disk whenever the library_db is changed and then read from disk
by calling the init() function.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:55 -04:00
Anna Schumaker 9ddbaf0b97 library: Implement basic path management
I can add and remove root-level directories from the library database.
I do not save the database when modified, and I don't yet run an update
on all the files.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:55 -04:00
Anna Schumaker fc3b5db59e database: Fix multiple issues
- Check if we are finding the "last" iterator in an empty database
- Better print() descriptions
- Print test return codes that aren't 0 to help find segfaults

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:55 -04:00
Anna Schumaker 8ccbad20cc database: Mark rows valid when inserted
It doesn't make sense to need to set this value outside of the database
code like I had been doing.  So when a new row is inserted mark it as
valid right away.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:55 -04:00
Anna Schumaker 6d94e78d23 database: Add a function for clearing databases
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:55 -04:00
Anna Schumaker 37d4085d27 filter: Use the index print functions
This cuts out some code that doesn't need to be duplicated.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:54 -04:00
Anna Schumaker 629cbeb2e9 index: Add a print() function
This function is used in debug mode to print the current status of the
index.  I also created a print_keys() function to only list the keys.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:54 -04:00
Anna Schumaker 79d592ed64 database: Add a function for printing
Other tests may need to print out a database.  To make this easier I've
added a print() function to the base database class.  This function will
only exist when CONFIG.TEST == True, so don't use it outside of testing!

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:54 -04:00
Anna Schumaker 1f9ff4ae2d config: Simplify setting up initial environment
Rather than setting up all variables twice, just call reset() to
initialize everything.  *BONUS* Reset can be used to initialize the
value of CONFIG.TEST!

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:54 -04:00
Anna Schumaker 9880e98d0d tests: Improve removing old test data
I was using my own cpp file to remove old test data to start with a
clean slate.  I've decided it's easier to just remove the files before
running tests if they exist.

I also use this patch to update the test design and add an idea for the
future.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:54 -04:00
Anna Schumaker 31ea73b0d9 file: Rewrite file test
For some reason I turned the file test into three separate files. All
other tests were in a single source file, so I updated file tests to
match.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:54 -04:00
Anna Schumaker 1482f5bcc8 print: Rename test from basic/ to print/
"basic" doesn't really fit the description for what I'm testing here.  I
was expecting to do a series of unrelated tests, but all I'm really
doing it testing the print function.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:54 -04:00
Anna Schumaker dd92ee853f database: Add a way for databases to have unique keys
The library will need databases that have unique values (such as the
artist or album tables).  This patch adds support for that in my
existing database code.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:54 -04:00
Anna Schumaker b176a48c6c library: Add fake library generating script
I assign tags to the 1, 10, 60, and 600 second long ogg files as they
are copied to the new library directory.  This is much faster than
generating sound files on the fly, but it makes this commit 2.5MB in
size...

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:54 -04:00
Anna Schumaker f417b48df8 idle: Add an idle queue
The idle queue is used to schedule tasks ... later.  This code was
mostly adoted from a reference TDD experiment by Josh Larson
(themutatedshrimp@gmail.com).  Thanks Josh!

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:53 -04:00
Anna Schumaker 5f30a71c55 group: Add good output
Don't clutter the testing step with output unless it's wrong output.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:53 -04:00
Anna Schumaker 7b7414c755 group: Implement basic groups support
I only handle the "All Music", "Library" and "Banned" groups at the
moment but I'll eventually add in more features (in future versions).

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:53 -04:00
Anna Schumaker c5f6716144 filter: Store good filter output
Now I don't need to see the entire test output when tests are run.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:53 -04:00
Anna Schumaker 755785799b index: Make sure we can index into keys that don't exist
This should just return a set of size 0.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:53 -04:00
Anna Schumaker 2b15048777 filter: Implement text filtering
Because every programming project needs a test case centered around
Discworld quotes ...

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:53 -04:00
Anna Schumaker 379a96fe13 index: Add in save and load functionality
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:53 -04:00
Anna Schumaker be0d3f3da4 index: Implement most of the index
I have everything except for save() and load() written.  My unittest is
fairly comprehensive and tests everything implemented so far, so with
any luck putting in save() and load() features will go quickly.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:53 -04:00
Anna Schumaker f124501c39 database: Add tests for databases without a filepath
These databases should not be saved to disk, since the user hasn't given
a valid filepath.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:53 -04:00
Anna Schumaker 412964bcf4 file: Update tests to check for empty filepaths
And make sure files follow the design by return false when opening an
invalid file.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:52 -04:00
Anna Schumaker 13313482d4 database: Make read() and write() functions for database entries
I had planned on using the stream operator for my database class but
this created some crazy compiler error that I was having difficulty
figuring out.  I decided to take the easy route for now and instead
create read() and write() functions that do exactly the same thing.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:52 -04:00
Anna Schumaker a5891a3338 database: Implement quick removal of items
Items will be marked "invalid" rather than directly removed from the
database.  This make it easier, since I won't need to reassign IDs to
every database item after the removed one.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:52 -04:00
Anna Schumaker 50a7c3dae6 database: Add funcions for database iteration
A database may have invalid rows.  If this is the case, then the next()
function needs to return the id of the next valid row.  I'm aware that
this could get horribly inefficient on large DBs with many invalid rows.
I don't expect people to delete large chunks of music all at once, but a
defragment tool is on my "todo" list for a future Ocarina version.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:52 -04:00
Anna Schumaker b3f5363445 database: Implement insert() and size()
I don't have the DatabaseEntry base class yet, but I will soon!

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:52 -04:00
Anna Schumaker f7a3eec35c file: Do not open files with an empty filepath
Instead mark them as invalid to keep from opening a directory instead of
a file.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:52 -04:00
Anna Schumaker fee08b1f94 database: Begin database code
I've been excited about this!  I think it'll be a better design than
what I had for Ocarina 5.x.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:52 -04:00
Bryan Schumaker 8c4e515145 Update copyright info
What's the point in continuing to commit as Bryan?  I'd rather commit as
me :)

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:52 -04:00
Bryan Schumaker f76021be99 tests: Remove the debug output file
I changed print to compile in the dprint() function when the testing
flag is enabled.  This allows tests to have the same output regardless
of debugging status.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:56:52 -04:00
Bryan Schumaker 0ed8e48668 tests: Various improvements
- Don't be verbose when removing files.
- Reverse diff order so output makes more sense.
- Only strip whitespace from the end of lines.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2014-04-06 19:56:52 -04:00
Bryan Schumaker 328c6f70e8 file: Implement reading and writing
- Inherit from fstream to gain access to << and >> operators.
- Make the file version accessable to the outside world.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2014-04-06 19:56:52 -04:00
Bryan Schumaker ecd56831f6 file: Open and close files
- Support OPEN_READ and OPEN_WRITE
- Update the design to accomidate for error checking
- Add lib/test.cpp containing basic functions that can be used for
  testing

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2014-04-06 19:56:52 -04:00
Bryan Schumaker e0a32c10ac lib: Add basic file class
The class resolves the path to the ocarina directory based on the file
hint provided.  NOTE: compile-debug.good and compile.good resolve paths
to my home directory.  Other users will need to change the values for
the test to pass.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2014-04-06 19:56:52 -04:00
Bryan Schumaker c65e0bdb2a build: Change CONFIG_* variables into a class
The class is in charge of resetting fields at will, and will be able to
maintain everything easier than if I were to do it by hand.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2014-04-06 19:56:52 -04:00
Bryan Schumaker 13a0d25e8f build: Only create a single build environment
I was using a debug and a release environment for programs, that way
both versions of tests could be checked.  Instead, it'll be simpler to
only use a single environment and then control debug information using
CONFIG_DEBUG.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2014-04-06 19:56:51 -04:00
Bryan Schumaker b5d3a663e0 print: Print the Ocarina version to a file
The basic/print.cpp test will write version information to a file using
both dprint() and print().

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2014-04-06 19:56:51 -04:00
Bryan Schumaker 7c67d062df build: Make it easier to change command line macros
I store release and debug options in a list so that env.Replace() can be
used to set, modify, and restore values.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2014-04-06 19:56:51 -04:00
Bryan Schumaker 38c074d898 build: Improve aliasing for tests
scons tests - Compile all tests
scons tests/basic - Compile basic tests
scons tests/basic/print - Compile text printing test

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2014-04-06 19:56:51 -04:00
Bryan Schumaker f75ba5a2b8 tests: Add a basic test
This test checks for the version.h file and then compiles it with and
without debugging enabled.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2014-04-06 19:56:51 -04:00
Bryan Schumaker 5f5f23bf9e Build: Create version.h using an Sconscript file
This lets me pull code out of the generic Sconstruct, so it can't be
bad!  I also removed the test directory since I never made unit tests.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-05-27 10:23:47 -04:00
Bryan Schumaker 5d687176e8 tests: Began creating test programs
I want these to help check for memory leaks and other problems.  Maybe
one day I can run them through Jenkins!

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-09 08:22:40 -05:00
Bryan Schumaker 1ed7e58c99 libsaria: Remove old tests
These files were created for developing small components during initial
design.  I haven't used them in a long time, and most are probably
obsolete by now.
2011-05-11 22:31:28 -04:00
Bryan Schumaker f869b17e2f Rename backup functions
Backup has been renamed to export
Restore has been renamed to import_xml
2010-12-18 14:52:31 -05:00
Bryan Schumaker 83ebf78d2b Tree prefs test persistance 2010-12-03 08:30:12 -05:00
Bryan Schumaker e56d2b807e Tree prefs test
This was used for developing the preferences tree.
2010-12-03 08:30:12 -05:00
Bryan Schumaker 701306fef6 libsaria sources change
Change files to reflect the rename of libsaria.collection to
libsaria.sources
2010-12-03 08:30:12 -05:00
Bryan Schumaker 2949535aba Val trees walk values
Val trees can walk through their values in addition to their paths.  A
doubly-linked val tree can also walk values backwards.
2010-12-03 08:29:15 -05:00
Bryan Schumaker fe449ffea4 Value Trees
Value trees store a value in addition to the path.  They come in normal
and doubly-linked flavors.
2010-12-03 08:29:15 -05:00
Bryan Schumaker 5dbbeb7dcb DLFSTrees
Doubly linked filesystem trees are both a doubly linked tree and a
filesystem tree.  They can walk paths backwards.
2010-12-03 08:29:15 -05:00
Bryan Schumaker 825a8b8346 Add DLTree()
This patch adds a double-linked tree class for use in storing the
library.  This class can walk backwards from a leaf node when
walk_backwards is called.
2010-12-03 08:29:15 -05:00
Bryan Schumaker 2dc7f58206 Rename libsaria.music
I decided that libsaria.music should be known as libsaria.audio.  It
makes more sense to me.
2010-12-03 08:29:14 -05:00
Bryan Schumaker 8ca67cd4c7 Libsaria trees
libsaria.path.make_tree(path) will return a tree rooted at path
2010-12-03 08:29:13 -05:00
Bryan Schumaker 65ccdb1780 Library backup
I can now backup the library to an xml file.  This will be useful for
library updates in the future.  The plan is to eventually backport this
feature to Ocarina 4.1 (To make the 4.1 -> 4.2 transition easier)
2010-11-19 22:51:56 -05:00
Bryan Schumaker 5c842def01 Generic cache
I have created a generic cache to hold information outside of the
library.  This could include album art or an artist bio.
2010-10-24 17:26:53 -04:00
Bryan Schumaker 6934974d75 Time strings
During scanning I convert the length into a time string ( "h:mm:ss" ).
This is drawn in the gui when a collection list is populated.
2010-10-11 18:22:05 -04:00
Bryan Schumaker 6c6477b677 Index filtering
I have implemented simple filtering over the library.  This will return
a set of visible songs based on the search pattern.
2010-10-10 23:06:54 -04:00
Bryan Schumaker 168025fb60 Collection Indexing
I can now add songs to a collection's index.  The index only works for
unicode string right now (all others must be converted)
2010-10-10 13:45:52 -04:00
Bryan Schumaker 2c27185679 Use new collection structure to populate the library list. 2010-10-08 13:09:42 -04:00
Bryan Schumaker adcb73dac9 Have a working doubly-linked tree based library.
I have a bit more to do before I support everything the old library did.
Mostly getattr work.
2010-10-06 23:31:36 -04:00
Bryan Schumaker ab29b2cb2b More work with collections based on doubly linked trees 2010-10-03 19:00:06 -04:00
Bryan Schumaker 31b470e597 Track tags in another double linked tree. Create a record for each
track linking to each tree.  Create a library filter for creating a
library.
2010-10-01 21:33:19 -04:00
Bryan Schumaker 8221411ca2 Double linked trees
I have begun working on doubly-linked trees for use in collections.
2010-10-01 12:32:24 -04:00
Bryan Schumaker 4a5085d973 File chooser window
I have created my own file chooser window that can select both files and
directories.  Currently, the "OK" button must be clicked to select
anything.
2010-09-12 19:11:37 -04:00
Bryan Schumaker 2aded0e67f Filesystem Selecting
Began experimenting with a filesystem selector that can select both
files and directories.
2010-09-10 17:46:42 -04:00
Bryan Schumaker 15cc5d22f0 Backend and frontend changes
Libsaria events now support starting specific callback functions in a
background thread.  This replaces starting a specific event in the
background.

I have a library tab that is added to the main window through use of the
ocarina.add_tab function.

I have new tests for walking the tree and running multiple threads with
locks.
2010-08-19 23:02:30 -04:00
Bryan Schumaker d8cadb83e9 Collection Tree
I have implemented a tree to store store information about each track.
I now support tracks that have the same artist, album, and title.
2010-08-12 22:11:13 -04:00
Bryan Schumaker 71b3289f62 Improved collection indexing
I can now create an index over an entire collection faster.  The
bottleneck is still disk accesses, but I still think this was a good
challenge.
2010-08-12 08:27:21 -04:00
Bryan Schumaker 52b1236b29 Collection work
I've begun work on a generic collection class for the library, playlist,
and queue.  Tagpy functions have been merged into the
libsaria.collections.__init__.py file to make things easier.
2010-08-08 14:30:15 -04:00
Bryan Schumaker 25a0d0be9f Added audio functions
I have reworked the gstreamer functions from Ocarina 4.0 and combined
everything into one file.  I have also created an audio test that plays
a song from my library.
2010-08-07 19:39:46 -04:00
Bryan Schumaker 57ec240798 Added event system
I combined various parts of the Ocarina 4.0 event system into one file.
The new event file has threading abilities built in, so I no longer need
an external file for that
2010-08-07 14:23:50 -04:00
bjschuma 4d71ae824d Working Map class and test suite
I revised the Ocarina 4.0 map class so it will hopefully have better
performance.  I also began working on a new testing system so testing
specific changes should be easier than with Ocarina 4.0
2010-08-07 12:55:23 -04:00