Commit Graph

107 Commits

Author SHA1 Message Date
Bryan Schumaker
78b445793a libsaria.path() with an FSTree()
I now have a function to walk all files in a filesystem and make an
FSTree().
2010-12-03 08:29:14 -05:00
Bryan Schumaker
d5231e9db1 FSTree()
FSTree() is a tree representing paths in a filesystem.  It has functions
for inserting paths and returning the paths it is storing.  A path is a
UNIX path: "/home/bjschuma" is the path to my home directory.
2010-12-03 08:29:14 -05:00
Bryan Schumaker
e6b968ed13 Load in background
The library and playlist can be loaded in the background to save time!
Also, I changed the library list to use the new populate function.!
2010-12-03 08:29:14 -05:00
Bryan Schumaker
aa79efe6f1 Remove whitespace 2010-12-03 08:29:14 -05:00
Bryan Schumaker
fd812885e8 Remove get_attr
This removes get_attr() as a library function (use get_attrs() instead)
2010-12-03 08:29:14 -05:00
Bryan Schumaker
02704b4d7e Use get_attrs
This changes various parts of ocarina / libsaria to use get_attrs()
instead of get_attr().
2010-12-03 08:29:14 -05:00
Bryan Schumaker
31bf833a50 Library get_attrs()
get_attrs() will return a list of requested attributes for a given song
id.  For now, I have changed get_attr() into a wrapper around get_attrs
that returns the first entry in the result list.
2010-12-03 08:29:14 -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
71a9a0a23f Added 'art' to library attrs
This attribute will return the path to the cached album art for the
song.
2010-12-03 08:29:13 -05:00
Bryan Schumaker
45c6097299 get_artwork_id()
If I already have the song id, there is no reason I should have to look
up the filepath to set the artwork.
2010-12-03 08:29:13 -05:00
Bryan Schumaker
15c4a273bf Playlist filtering
The new playlist module can be filtered again.
2010-12-03 08:29:13 -05:00
Bryan Schumaker
1de5243753 New playlist module
The playlist should be a standalone module rather than inheriting from
the same base class as the library.
2010-12-03 08:29:13 -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
f561e6b3e2 Remove library functions from collections.lens
I have removed some functions from the old library class since they have
been re-implemented in the library module.
2010-12-03 08:29:13 -05:00
Bryan Schumaker
643da7c12a New library filtering
The new library module can filter songs
2010-12-03 08:29:13 -05:00
Bryan Schumaker
ca331f6b64 Library play_id()
I have moved over the play_id function to the library module.
2010-12-03 08:29:13 -05:00
Bryan Schumaker
8356c58493 Library class -> library module
I think that the library will be cleaner if I turn it into a module
instead of keeping it a class.
2010-12-03 08:29:13 -05:00
Bryan Schumaker
85040621ed Bump the minor version number
This reflects that I am working on Ocarina 4.2 / Libsaria 1.2 now.
2010-12-03 08:28:05 -05:00
Bryan Schumaker
1703fff378 Modified backup code
The backup code needed to be modified so that it works with Ocarina 4.1.
This involved writing a function to walk library ids, and using the
lib_get_attr function from the collection.
2010-11-19 23:05:57 -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
8b2a0b9433 Added xml creation functions
These functions are designed to help create an xml document.
2010-11-19 22:51:42 -05:00
Bryan Schumaker
5833b1908c universal_open() needs escape character replacement
%20 and $22 should be replaced with " " and "\"" before using the path
to create a library.
2010-11-09 14:08:16 -05:00
Bryan Schumaker
bda392bc88 Correctly set __dev__ for libsaria and ocarina. 2010-11-06 13:36:03 -04:00
Bryan Schumaker
049e27c559 Ocarina 4.1 2010-11-05 18:38:44 -04:00
Bryan Schumaker
4a1ff91b57 Plugins check version
We should check plugin versions when loading them.  If the API changes
in a future version, then old plugins shouldn't work.
2010-11-05 08:15:32 -04:00
Bryan Schumaker
99c510dd20 Development plugin path
When libsaria.__dev__ is True, we should use a different path for
plugins.
2010-11-05 08:13:21 -04:00
Bryan Schumaker
16da9fda2b web.py escape character full replacement
Replace all special symbols, not just ' ' and '&'.
2010-11-04 10:14:31 -04:00
Bryan Schumaker
2b7b38da4f Merge branch 'master' of file:///home/bjschuma/public_html/git/ocarina
Conflicts:
	ocarina/image.py
2010-11-03 23:07:18 -04:00
Bryan Schumaker
3ed0b10aab Only change play button when playing
If no song is playing and the play button is clicked we shouldn't switch
to the pause button.  This could confuse users.
2010-11-03 22:04:51 -04:00
Bryan Schumaker
4c916f2fd3 Reset playlist and library functions
These functions should be called to reset the library and playlist,
which is better than deleting the old files and making a new one.
2010-11-03 08:11:15 -04:00
Bryan Schumaker
7308ed8225 Web request error handling
Added a try / except block around placing a urllib2.urlopen().
Additionally, when there is an error I print it and return None.  This
will tell the cache to remove the opened file.
2010-11-02 21:08:37 -04:00
Bryan Schumaker
a97e82ef1c Up last played limit from 15 to 30 2010-11-02 19:20:11 -04:00
Bryan Schumaker
47f091b7ad collections should be saved as something.dl_tree, not somethingdl_tree 2010-11-01 11:56:07 -04:00
Bryan Schumaker
5a6b321ffe Rework collection saving to work with -dev appending 2010-11-01 08:24:53 -04:00
Bryan Schumaker
b408e4b727 Development and stable pickle files
When libsaria.__dev__ == True, we save data to a file with -dev appended
before the extention.
2010-11-01 08:22:38 -04:00
Bryan Schumaker
025a118290 Fix get_rand_candidate crash
For some reason the loop in get_rand_candidate was exiting earlier than
I thought.  For now, I am returning the last ID looked at to fix the
problem.  I expect there is a better solution, but this seems to work
until I can clean up the collection system.
2010-10-31 17:21:12 -04:00
Bryan Schumaker
aa9f517959 Walk filtered IDs
We already have a function for walking all song ids.  Collections should
be able to walk the filtered IDs too.
2010-10-31 17:20:20 -04:00
Bryan Schumaker
49328c5200 choose_next() already starts the NEXT event... 2010-10-31 17:19:46 -04:00
Bryan Schumaker
76eaa3eb16 NEXT event
Rather than call choose_next() directly, we should wrap this in a NEXT
event so that things can respond to it.
2010-10-30 13:52:38 -04:00
Bryan Schumaker
3087eb9954 init_var()
I made an init_var function that matches the init_pref function, only
for runtime variables.
2010-10-30 13:40:06 -04:00
Bryan Schumaker
1136e3f4af Cache path correction
If we look for a cache item that includes the directory seperator
character, then we should replace it with a different character.
2010-10-30 12:54:45 -04:00
Bryan Schumaker
c5a606193a Cache dir setup
The cache should use path.saria_dir() to determine the correct path,
rather than setting it directly.
2010-10-30 12:47:41 -04:00
Bryan Schumaker
356244e3be Gstreamer locking
Locking for gstreamer operations may help prevent a double free error I
was getting.
2010-10-30 12:09:28 -04:00
Bryan Schumaker
b000bbf808 Basic playlist deduplication
Before adding songs to the playlist, check if the playlist already
contains the song id.
2010-10-28 08:30:46 -04:00
Bryan Schumaker
4f899c4834 Delete empty cache files
When a cache filler function returns without success, we need to delete
the empty file we create so that it doesn't trigger a false positive the
next time we access it.
2010-10-27 09:09:18 -04:00
Bryan Schumaker
3a81afdc92 last.fm for album art
Whenever a new song is loaded, we check the cache for album art.  If we
don't have art yet, then we place a request to the last.fm to find an
image.
2010-10-26 22:44:09 -04:00
Bryan Schumaker
657d016017 libsaria/web.py
This file contains a url class designed to make it easy to build up a
url and then place a python urllib2 request.
2010-10-26 22:40:00 -04:00
Bryan Schumaker
e3327093ad libsaria/xm.py
xm.py contains helpful xml parsing functions that we can use for
decoding last.fm requests.
2010-10-26 22:39:04 -04:00
Bryan Schumaker
3b92b00d87 Cache should check for success of func()
We return after checking if the fetcher function succeeds.  To do this
properly, we should store the value we get so that the cached file can
be closed before returning.
2010-10-26 22:33:28 -04:00
Bryan Schumaker
b204743e1b Print iterations
For now, print the number of iterations it takes to choose a song at
random.
2010-10-26 22:30:01 -04:00