Commit Graph

51 Commits

Author SHA1 Message Date
Bryan Schumaker
86f4aca8f3 libsaria: Remove old threads.py module
Everything in here can easily be duplicated with one line of python
code.  Keeping this file does a good job at increasing complexity.
2011-05-08 10:58:41 -04:00
Bryan Schumaker
e2233e4106 libsaria: Remove old cache code
I've replaced it with a cache implemented in libsaria/storage.  The new
cache should be easier to use (or at least easier to maintain and
understand).
2011-05-07 17:10:20 -04:00
Bryan Schumaker
bafdc6ef20 libsaria: Manually set artwork through a copy_in_file() function
I created this function in the cache to make a generic way to copy
outside files into the cache tree.  It makes sense to do this in the
cache, since I want to keep everything self-contained.
2011-05-07 16:49:41 -04:00
Bryan Schumaker
2a78d870ee libsaria: Set artwork from a local file
I set it in the new cache, rather than using the old one.
2011-05-07 16:45:04 -04:00
Bryan Schumaker
0f1b5550aa libsaria: Change cache_func() argument order
I want to pass the file object last, I just think it looks better.
2011-05-07 15:58:33 -04:00
Bryan Schumaker
a7c7b85fdb libsaria: Get album art through new cache
I am working on replacing my old cache functions with something easier
to use.  I can now get album art out of the new cache.
2011-05-07 15:58:33 -04:00
Bryan Schumaker
904b475363 libsaria: Began new cache functions
I think the new cache will be more generic, and should work for just
about anything.  We'll see.
2011-05-07 15:58:33 -04:00
Bryan Schumaker
c1a2d74f7c libsaria: Move version information to new file
A bit of separation is good here, and it should help with managing the
code.
2011-05-07 15:58:33 -04:00
Bryan Schumaker
e64f93ef39 libsaria: New library source callback
Triggered upon scanning a new path to add to the library.
2011-05-01 12:46:17 -04:00
Bryan Schumaker
bc54ef0a98 libsaria: Add a load_playlist() callback
Called when playlists are loaded from file.
2011-05-01 12:46:17 -04:00
Bryan Schumaker
96b237631e libsaria: Remove POSTSETART event
Nothing was listening for it, and I am removing the event system soon
anyway
2011-05-01 12:46:17 -04:00
Bryan Schumaker
d0198cdd1a libsaria: Get artwork when songs are loaded
I may change this to something that has to be requested by the front
end, rather than always fetching it.  We'll see.
2011-05-01 12:46:17 -04:00
Bryan Schumaker
063869c7ca libsaria: Remove old file management code
I have new code for loading / saving objects, so I can remove the old
stuff.
2011-05-01 12:46:16 -04:00
Bryan Schumaker
dc8a69bc0d ocarina: Refresh library after loading
To show changes.  I also use the v1.3 decoder function to decode
exported libraries.
2011-05-01 12:27:30 -04:00
Bryan Schumaker
3d1b8773d5 ocarina: Added album art
I put it on the now playing page for now.  Eventually I'll put it in
other places, too.
2011-05-01 12:19:49 -04:00
Bryan Schumaker
212a846d8c libsaria: Cache removes path if it exists
I wasn't checking if the path exists before removing it, and this caused
an error.  Checking before removing is simple enough, though...
2011-05-01 11:59:29 -04:00
Bryan Schumaker
0c636bfd56 Clean up universal_open()
The cleaned up version chooses what function to call based on file
extention.  I use map.get() to pick a function, and use the open_music()
function as the default.
2010-12-27 12:06:22 -05:00
Bryan Schumaker
270d33d5ec Reset playlist before loading xspf file
Loading an xspf file should replace the current playlist, rather than
add to it.
2010-12-18 16:45:48 -05:00
Bryan Schumaker
aa0f832356 Refresh the playlist after loading
After we load an xspf file, we should refresh the playlist to reflect
changes.
2010-12-18 16:44:18 -05:00
Bryan Schumaker
da99d4b349 Load xspf playlists
This patch adds loading of xspf playlists
2010-12-18 16:39:17 -05:00
Bryan Schumaker
77f065b703 Export playlist to xspf
This patch adds support for saving a playlist as an xspf xml file.  I
only use the <location> tag to keep it simple.
2010-12-18 16:22:06 -05:00
Bryan Schumaker
8d423629be Add fewer library sources
If we are being asked to add a path that is a subdirectory of a current
library source then we shouldn't add it.
2010-12-18 15:28:53 -05:00
Bryan Schumaker
3c2f40c69e Move backup.py -> export.py, import v1.3 library
The move was supposed to be in the previous patch ... oops.

This one also adds in importing a v1.3 library xml file.
2010-12-18 15:03:24 -05: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
c08655c1fa More reformatting and comments 2010-12-18 14:49:35 -05:00
Bryan Schumaker
c49a39ad46 Encode v1.3 library
This patch changes the encode functions to export a v1.3 library
2010-12-18 14:46:31 -05:00
Bryan Schumaker
cafc19fbed Don't set score when importing library
The score system has been replaced with a like / dislike system.  Score
is no longer an attribute that can be set.
2010-12-18 14:36:21 -05:00
Bryan Schumaker
8349efe8c7 Library export formatting changes
This patch rearranges the decode functions to put decoders for a single
version together.  I also removed some extra whitespace and clearly
labeled the decoding sections.
2010-12-18 14:33:17 -05:00
Bryan Schumaker
b6c9c12ea9 Remove datetime module import
This was added to test timing changes for my recent pickle improvements.
2010-12-16 11:02:32 -05:00
Bryan Schumaker
84eb73d2a2 Pickling improvements
By using pickle correctly, I can now load in files significantly faster
than the old way.  Library loading times have gone from about 3 seconds
to 0.25 seconds.  I like this.
2010-12-16 09:29:06 -05:00
Bryan Schumaker
d01d75cbe5 Find artwork using new get_attrs()
Using the new get_attrs() function makes things easier, and allows us to
find artwork for songs played that aren't in the library.
2010-12-12 08:55:30 -05:00
Bryan Schumaker
4749c49e16 Use the file source
When opening a file, we should use the file source instead of directly
loading it.
2010-12-07 20:47:32 -05:00
Bryan Schumaker
f063da5b56 Began work on virtual sources
Virtual sources should make it easier to do things with the current song
without having to know anything about it (such as a song id or file
path).
2010-12-05 17:11:41 -05:00
Bryan Schumaker
b6dba32e47 Rename file2id in backup
It is easier to use file_id
2010-12-05 13:42:23 -05:00
Bryan Schumaker
3eeb35d81c Stop using file_to_id
We should now use file_id located in libsaria.path
2010-12-05 13:40:39 -05:00
Bryan Schumaker
fff834a14c Find file_id for a given path
Finding the id of a file shouldn't be the job of the library.  Instead,
it should exist as part of the path minipulation code.
2010-12-05 13:29:10 -05:00
Bryan Schumaker
3e0b8de257 Rename library.sources
I think that "locations" is a better name than "sources".  Also, it
avoids the confusion of library sources and current track sources.
2010-12-05 13:11:31 -05:00
Bryan Schumaker
6b92d199e2 Only back up changed files
We only need to back up files with a score != 0 and count != 0
2010-12-03 08:36:13 -05:00
Bryan Schumaker
e5f85fab5c Library importing
I can now import both v1.1 and v1.2 libraries.  I split this into
appropriate functions for each version.
2010-12-03 08:36:13 -05:00
Bryan Schumaker
e9fe8321af Backup sources and improvements
I already have a "dumb import" (retag all files based on the filepath)
so there is no point in storing extra attributes when I am only going to
find them again during importing.  Instead, we should only store the
information we need: filepath, score, and playcount.

Additionally, I now store the list of sources in the library backup.
2010-12-03 08:36:13 -05:00
Bryan Schumaker
72f85f9f92 Create a set locked function for album art
We appear to already be locked when we get to the setter function.  I
was getting deadlocked when trying to do anything.  To fix this, I
made it so I can set images without needing the lock.
2010-12-03 08:35:15 -05:00
Bryan Schumaker
bb8632cf69 Albumart set from local file
I can pass the file location to the lastfm module to set the artwork
from a local file rather than from a web location.
2010-12-03 08:35:14 -05:00
Bryan Schumaker
0cbf344fa6 Cache delete items
I can now delete things from the cache in addition to adding things.
2010-12-03 08:35:14 -05:00
Bryan Schumaker
8fa2c29fa5 Import old library
I can now import files from an Ocarina 4.1 library exported as xml.
Ocarina 4.2 keeps track of a list of sources, but 4.1 does not.  For
importing to work properly, the library needs to be rescanned before
running the import.  The import will set the playcount and score
attributes for each file.
2010-12-03 08:35:14 -05:00
Bryan Schumaker
9e82d32489 Move lastfm to path/ 2010-12-03 08:31:03 -05:00
Bryan Schumaker
487e8c39be Move generic saving / loading functions
These belong under path/
2010-12-03 08:31:03 -05:00
Bryan Schumaker
80deb45a3e Move cache into path/
The cache modifies files, so it can be part of path/
2010-12-03 08:31:03 -05:00
Bryan Schumaker
1e7f63aa2d Moved backup.py to path/
This moves the backup functions to a more reasonable place.
2010-12-03 08:31:03 -05:00
Bryan Schumaker
36cf384cf2 Import trees from libsaria.trees 2010-12-03 08:30:14 -05:00
Bryan Schumaker
dcc5a937ae Added basename() to path
This will be useful for finding the file referred to by a path.
2010-12-03 08:30:13 -05:00