Commit Graph

117 Commits

Author SHA1 Message Date
Bryan Schumaker
2fb2f97a43 libsaria: Fix compile errors
g++ must have gotten updated...

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:20 -04:00
Bryan Schumaker
c5a84807be libsaria: Remove InFile and OutFile classes
I do this all through either appdir or Read / Write tasks

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:17 -04:00
Bryan Schumaker
a944869093 libsaria: Clean out the Track class for re-implementation
This also removed the other `typedef sid_t` left in the header file.
I'll re-add in functions and variables as I need them, and hopefully
keep things working more efficiently.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:01:16 -04:00
Bryan Schumaker
db00eb0908 libsaria: Include missing header file
This was needed for unlink()

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-04-07 10:00:05 -04:00
Bryan Schumaker
dd5e73a2ba libsaria: Delete playlists and renderers when popped
This allows dynamic memory to be freed when we are done using it.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-03-04 10:02:03 -05:00
Bryan Schumaker
aaeb4d8fba libsaria: Replace SaveTask and LoadTask
I put in a generic IOTask function.  I'm sure this could eventually be
expanded to open and pass the appropriate stream to functions using this
task.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-23 09:57:52 -05:00
Bryan Schumaker
00274a836f libsaria: SaveTasks take an extra argument
I want to pass a Playlist through to save a changing playlist.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-19 17:17:25 -05:00
Bryan Schumaker
c452af1ce7 libsaria: LoadTasks take an extra argument
I want to pass a playlist argument through during playlist construction,
so I changed the LoadTask to handle it.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-19 17:17:25 -05:00
Bryan Schumaker
1470b908c2 libsaria: Remove dir.cpp.orig
Where did this file ever come from?

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-19 17:17:25 -05:00
Bryan Schumaker
1933689d4f Added copyright lines to everything
I probably should have done this earlier... oh well

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-19 17:17:24 -05:00
Bryan Schumaker
c3ed28250c libsaria: Return the correct saria directory
My environment variables were set in a way that the path
/home/bjschuma/~/.config/saria-debug was being returned as the working
directory.  Obviously this is wrong, so I changed the function to make
better use of default values when finding the directory.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-19 17:14:44 -05:00
Bryan Schumaker
280baa7572 libsaria: Allow different UIs to use a different pipe
The UI now passes in a string to use as the filename.  In addition, I
store the filename and remove it when the application is closed.  If the
pipe already exists, then I return the path without creating a new one.

Pipes will only be removed by the application that creates them.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-08 08:11:13 -05:00
Bryan Schumaker
82b9974448 libsaria: Get the path to the pipe file
This will either return the full path to the file or an empty string if
no pipe has been created.
2012-02-08 08:11:13 -05:00
Bryan Schumaker
e7e1bb352a libsaria: Remove OutFile print statement
It was triggering too often during a library update, so I removed it.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-08 08:11:13 -05:00
0d63656df8 Fixed bug with unset environment variable.
When either HOME or XDG_CONFIG_HOME are unset getenv() can return NULL.
C++ strings don't like being set to NULL, so we need to check for this
case.

Bryan: Edited Sconstruct and commit message.

Signed-off-by: Josh Larson <theMutatedShrimp@gmail.com>
Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-08 08:10:19 -05:00
Bryan Schumaker
fe7bf9e445 libsaria: Check if a song exists before loading it
This could lead to a segmentation fault if we don't do it...

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-02-07 22:25:13 -05:00
Bryan Schumaker
41ec0b68e0 libsaria: Validate library tracks after updating
I check two things during this step:

1) Does the file still exist?
2) Does the file have the same inode number?

If the answer to either of these is "no", then the track is removed from
the library.
2011-12-31 10:48:05 -05:00
Bryan Schumaker
8a0922c4a1 libsaria: Generic LoadFile() task
This was specific to the library namespace, but I think it makes more
sense to exist as a global class definition that can be reused by
others.
2011-12-30 20:22:47 -05:00
Bryan Schumaker
4dac0fe096 libsaria: New current_track() function
Instead of taking a callback function,  I instead find a pointer to the
current track and return this to the caller.
2011-12-30 19:47:13 -05:00
Bryan Schumaker
a44ecbb795 libsaria: Remove old readdir() function
It's not used anymore...
2011-12-30 19:15:03 -05:00
Bryan Schumaker
a74cea2e71 libsaria: Remove old TrackTag() class
It was basically a layer of misdirection that made it harder to use
Tracks.  The Track() class now does everything that the TrackTag() one
did.
2011-12-26 12:14:25 -05:00
Bryan Schumaker
5f20899b14 libsaria: Remove references to ino_t
I want to use sid_t instead.  It's more obvious what it's used for.
2011-12-25 23:29:35 -05:00
Bryan Schumaker
da118b2281 libsaria: Switch to the new OutFile() class
The new class is more convenient to work with since it's the output
stream with my save protocol built in.  I should have done this earlier!
2011-12-25 22:34:12 -05:00
Bryan Schumaker
5877d3ac4a libsaria: Created a new OutFile() class
Similar to how I created a new InFile() class.  The new one can be used
directly as a stream, only it has my save file protocol stuff built in.
2011-12-25 22:21:11 -05:00
Bryan Schumaker
6794ce15e5 libsaria: Return ifstream reference from operator>>
This allows me to chain calls to the same stream, cleaning up the code.
2011-12-25 22:20:04 -05:00
Bryan Schumaker
d39536d7d0 libsaria: Completely replace old InFile() class
My InFile2() class is clearer and simpler, so I've replaced InFile()
with it.
2011-12-25 21:24:02 -05:00
Bryan Schumaker
5e308202a0 libsaria: Create a new way to save files
I inherit from the ifstream class, so I can override the insertion
operator for string handling.  I can then use templates to save
everything else.
2011-12-25 21:16:09 -05:00
Bryan Schumaker
f7d7d5e038 libsaria: Add floats as preferenc type
Now I can store floating point numbers in addition to booleans.
2011-12-23 22:03:31 -05:00
Bryan Schumaker
304b581274 libsaria: Check if $HOME is part of $XDG_CONFIG_HOME
On one machine it is, on another it isn't.  This should be a solution
that works for everybody.
2011-12-11 20:26:39 -05:00
Bryan Schumaker
57bf72c4e5 libsaria: Get utf8 encoded strings from taglib
This should cut down on the number of pango errors that I see when
filing in lists.
2011-12-11 15:46:44 -05:00
Bryan Schumaker
0b4d9c25eb libsaria: Use absolute paths for saria dirs
I noticed that new save files weren't being created.  I now use the HOME
environment variable to construct an absolute path to write files to.
2011-12-11 15:46:40 -05:00
Bryan Schumaker
1c0084b2e9 libsaria: Created a generic format_text() function
This is used by the track tags for creating word lists.  I also use the
function to format filter search text.
2011-11-13 10:47:55 -05:00
Bryan Schumaker
7fc4e22795 libsaria: Call a dummy index function for each TrackTag
This function takes an inode and word list.  Soon it will add each
substring to an index.
2011-11-12 19:31:42 -05:00
Bryan Schumaker
fc50ceb34f libsaria: Format each tag as it is read in
I lowercase everything, strip out some characters, and create a linked
list of each word for each tag.
2011-11-12 19:21:41 -05:00
Bryan Schumaker
b3cb20dd5d libsaria: Properly set the inode for each track tag
I was setting local variables rather than the TrackTag variable.  No
wonder things didn't work
2011-11-06 13:09:59 -05:00
Bryan Schumaker
6d7828b946 libsaria: Store library path as a linked list of track tags
Lookup by id will be slighly slower, but now I will have one list for
each path that can be merged together and sorted to represent the
library.  This sounds like a good tradeoff to me, especially since I can
store an iterator to the current track when deciding what to play next.
This will give me much faster access to song for the current track.
2011-11-06 11:16:46 -05:00
Bryan Schumaker
9c0e61b42d libsaria: Create track tags with an inode
I need to store the inode somewhere if I want to use a linked list to
store LibraryPath data.  I currently have a map <ino_t, TrackTag>, so
the obvious choice is to store the inode in the TrackTag structure.
2011-11-06 10:54:45 -05:00
Bryan Schumaker
a975fcc2cc libsaria: Added a current_track() function
This function will generate a Track object based on the current file
stored by the audio.  I then pass this object to to provided function so
the UI can be updated.
2011-10-28 15:33:17 -04:00
Bryan Schumaker
a508b7ff72 libsaria: Rip out old library
The code was a bit messy and didn't make use of namespaces very well.
By converting to a set of functions (instead of a class) I can use
each function as a function pointer if I want to.  I am also able to
remove libsaria/library.cpp since this was just a set of wrapper
functions to the old static class functions.
2011-10-18 10:02:55 -04:00
Bryan Schumaker
c8daf92af4 libsaria: Save to XDG_CONFIG_HOME
I plan on storing all my preferences there rather than creating my own
save directory.  This will keep things consistent with other
applications the user may have.
2011-10-02 10:52:23 -04:00
Bryan Schumaker
1a7b8a5ae9 libsaria: Load a saved library
No point in saving a library if I can't make use of the save file later.
2011-09-30 08:12:26 -04:00
Bryan Schumaker
1d1ecc8d8c libsaria: Save the library scan results
I write each track to a file that will be read in on startup (once those
changes are committed)
2011-09-27 08:23:49 -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
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
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