1
0
mirror of https://github.com/spl0k/supysonic.git synced 2024-12-22 17:06:17 +00:00
Commit Graph

196 Commits

Author SHA1 Message Date
Carey Metcalfe
f106923f17 Remove unused 'Cache.protect' method 2019-02-03 22:56:03 -05:00
Carey Metcalfe
65d49a04c9 Implement a cache manager for album art and transcodes
Quick summary
-------------
- Adds a Cache class (plus tests for it) that provides an API for
  managing a cache of files on disk
- Adds two new settings to the configuration file: `cache_size` (default
  512MB) and `transcode_cache_size` (default 1GB).
- Creates two cache managers using the settings above: one for general
  stuff (currently album art) and one for transcodes
- Adds the caching of transcoded files to disk for future use
- Modifies the existing image caching to use the cache manager

Longer explanations and justifications
--------------------------------------
The reason I separated out transcodes into an entirely separate cache is
that I could imagine a single transcode pushing out a ton of smaller
images or other cached content. By separating them it should reduce the
number of deletes caused by adding something to the cache.

The cache manager allows for caching a value from a generator via
passthrough. This means that a generator can be transparently wrapped to
save its output in the cache. The bytes from the generator will be
written to a temp file in the cache and yielded back. When it completes,
the temp file will be renamed according to the provided cache key. This
is how caching transcoded music is implemented.

If multiple generators for the same key are started, they will all write
to individual temp files until they complete and race to overwrite each
other. Since the key should uniquely represent the content it indexes
the files will be identical so overwriting them is harmless.

The cache will store everything for a minimum amount of time
(configurable, default is set at 5 minutes). After this time has
elapsed, the data can be deleted to free up space. This minimum is so
that when you cache a file to the disk you can expect it to be there
after, even if another large file is added to the cache and requests
that some files are deleted to make space.

To ensure that a file will not be paged out of the cache regardless of
the minimum time, there is a `protect` context manager that will refuse
the delete the key from the cache as long as it's active.

The cache has a maximum size, however this is more of a recommendation
as opposed to a hard limit. The actual size will frequently exceed the
limit temporarily until something can be paged out.
2019-01-19 15:37:08 -05:00
spl0k
3b6186ebfc JSON: '_value_' -> 'value'
Closes #136
2019-01-19 15:04:56 +01:00
spl0k
7cfd958eeb Skip lyrics tests if ChartLyrics is down 2019-01-13 17:26:00 +01:00
spl0k
25c5c8277e Add support for downloadong folders and albums
Ref #131
2019-01-13 17:18:27 +01:00
spl0k
ac306f2725 Added method to list genres 2018-12-08 17:18:58 +01:00
spl0k
b195aca12f watcher: log to stderr when no logfile is set 2018-11-11 19:29:58 +01:00
spl0k
f5bab00a1c Small touches on logging
Most notably not relying in Flask's logger, as this cause issues
at the end of tests on Python 2.7
Fixes #96
2018-11-11 18:58:46 +01:00
spl0k
8132e38d46 Delete track dependents before tracks on folder deletion
Fixes #129
2018-11-01 14:02:12 +01:00
Taizo Simpson
066658f167
Consider embeded art when serializing albums, add relevant test 2018-10-12 19:07:48 -04:00
Taizo Simpson
2c4ec6c0e8
Whether or not a track has embeded art is tracked just like any other metadata, to reduce disk r/w and mem usage and a lot of other things.
WARNING: This needs migrations before being merged to master
2018-10-10 12:59:20 -04:00
Taizo Simpson
f43fecaf34
Added tests for reporting embeded cover art in folders and tracks 2018-10-09 13:04:17 -04:00
Taizo Simpson
a2add86550
Added tests for flac and ogg 2018-10-08 21:19:22 -04:00
Taizo Simpson
4bbcbd0acf
Art extraction is now done as a method of Track; cover_art() only extracts cover art if given a track ID; Cache embeded art 2018-10-08 20:05:45 -04:00
Taizo Simpson
29e462e0b8
Added test case for embeded album art 2018-10-08 15:30:38 -04:00
spl0k
0f1a31e677 Fixed test 2018-09-15 16:11:17 +02:00
spl0k
5a065c75ae Merge branch 'master' into db-setup 2018-09-15 16:04:43 +02:00
spl0k
1a15b95155 Merge branch 'master' into issue90 2018-09-08 15:37:08 +02:00
spl0k
dbf817ea9e Automatically create DB tables if needed 2018-08-29 14:56:28 +02:00
spl0k
9c58b695ff Watcher now handles cover art
Closes #92
2018-08-28 17:44:32 +02:00
spl0k
38f718b4df Using new pony on_connect decorator
Revert "Restore SQLite case insensitive LIKE"
This reverts commit a08689e8c0.
2018-08-11 16:16:34 +02:00
spl0k
a08689e8c0 Restore SQLite case insensitive LIKE
See ponyorm/pony#367
2018-08-05 15:35:29 +02:00
spl0k
78cf84e136 Remove invalid folders before scanning for covers
Fixes #101
2018-06-24 13:19:04 +02:00
spl0k
405a26a20a Don't restrict cover art to 'cover.jpg' files
Ref #81
2018-05-21 16:16:06 +02:00
spl0k
2b1977892e Generate a secret key only once 2018-04-01 12:32:36 +02:00
spl0k
921e4c7c30 Fixed playlists tests 2018-03-22 19:18:28 +01:00
spl0k
6ac969e2c5 Index folder and track path
Speeds up scanning
2018-03-17 23:25:26 +01:00
spl0k
b72daea109 Improved folder deletion 2018-03-15 20:50:01 +01:00
spl0k
9eb1bf63d7 API: stream.view: added support for 'estimateContentLength' 2018-03-10 23:04:57 +01:00
spl0k
a6b894c586 API: marked explicitly unsupported methods/parameters as such 2018-03-10 22:15:40 +01:00
spl0k
adb4e7e89b API: improved client preference passing 2018-03-10 18:35:00 +01:00
spl0k
0988d4319e Unified file headers 2018-03-04 21:49:56 +01:00
spl0k
4cbc8765e0 Refactored FolderManager to raise exceptions
rather than returning status codes
2018-03-04 17:36:35 +01:00
spl0k
ef9e7af026 Refactored UserManager to raise exceptions
rather than returning status codes
2018-03-02 22:51:49 +01:00
spl0k
58b8a1171a More error refactoring 2018-02-25 22:28:47 +01:00
spl0k
177b0cce0d Refactoring API error handling 2018-02-25 11:39:26 +01:00
spl0k
86892f375d Reenabled skipped tests 2018-02-18 16:51:05 +01:00
spl0k
005ae4803b More formatter refactoring 2018-02-11 12:40:10 +01:00
spl0k
66b6eb341e Tests: removed context/module unload dance
Was a workaround for issues fixed by blueprints
2018-01-29 22:09:28 +01:00
spl0k
b33e8ae6d1 Set mimetype when creating the response, don't try to fix it afterwards
Ref #76
2018-01-27 15:18:44 +01:00
spl0k
8275966db0 Dropped simplejson dependency
Ref #79
2018-01-21 22:02:32 +01:00
spl0k
c6992a4726 Fixed reading malformed tags
Fixes #86
2018-01-21 14:42:27 +01:00
spl0k
954c75bc35 Ignore files with a badly encoded path
Closes #85
2018-01-20 18:26:58 +01:00
spl0k
fd67eb9cd4 Fixed DeprecationWarnings 2018-01-16 23:16:13 +01:00
spl0k
420003dfc1 Py3: fixed remaining errors (hidden due to skipped tests)
Ref #75
2018-01-16 22:19:24 +01:00
spl0k
7edb246b1e Py3: str/bytes, iterators, etc.
It seems to work on Python 3 now!
Ref #75
2018-01-11 23:08:53 +01:00
spl0k
1a79fe3d70 Py3: basestring
Ref #75
2018-01-08 23:13:50 +01:00
spl0k
8674965c03 Read config files without interpolation
Fixes #84
2018-01-08 19:17:00 +01:00
spl0k
1605fcd202 Py3: imports, exceptions, dicts
Ref #75
2018-01-06 00:33:45 +01:00
spl0k
df63919634 Look at my pony, my pony is amazing 2017-12-23 22:59:04 +01:00
spl0k
53fd4865cb Get on my pony 2017-12-21 23:29:00 +01:00
spl0k
6daedc6919 I'm on a pony 2017-12-19 23:16:55 +01:00
spl0k
2428ffeb57 Scanner, CLI and watcher are on a pony 2017-12-17 23:25:34 +01:00
spl0k
a4b9a97271 All managers get a pony 2017-12-16 17:42:53 +01:00
spl0k
6bd61e0388 Getting out of the storm on a pony 2017-12-16 13:53:43 +01:00
spl0k
8046457661 Relative imports 2017-12-12 22:24:18 +01:00
spl0k
5d969e4c71 LastFM "test" 2017-12-10 18:48:23 +01:00
spl0k
daf34271b4 IniConfig tests 2017-12-10 18:48:08 +01:00
spl0k
332fd0446f CLI basic tests 2017-12-10 17:53:02 +01:00
spl0k
0a47ef89a5 CLI: fixed foreign key errors on user deletion 2017-12-10 15:11:50 +01:00
spl0k
4a99e52caa Added (skipped) transcoding tests 2017-12-07 23:33:32 +01:00
spl0k
8813cbd326 More watcher tests 2017-12-06 23:19:16 +01:00
spl0k
f63a9ed4cc First steps of a watcher test suite 2017-12-05 23:18:39 +01:00
spl0k
2ea7224815 Fixed tests init 2017-12-05 09:11:53 +01:00
spl0k
5d23b38bf3 Tests use a temporary cache directory 2017-11-27 22:55:18 +01:00
spl0k
9ffe40aa2c Reactivated config-dependent test 2017-11-27 22:46:09 +01:00
spl0k
a62976ba9d Reworked config handling 2017-11-27 22:30:13 +01:00
spl0k
4ca48fd31c Testing the scanner 2017-11-25 22:21:58 +01:00
spl0k
d88a1b6d0b Web UI user section tests 2017-11-24 19:24:58 +01:00
spl0k
b998bb0684 Web UI: reworked how data is passed to templates
Logged user is pushed in request data
No more 'username' session key
Small fixes along the way
2017-11-22 22:07:06 +01:00
spl0k
9a58d067ab Added playlists management tests 2017-11-20 21:33:38 +01:00
spl0k
79613aed84 Increased managers tests coverage 2017-11-20 21:32:35 +01:00
spl0k
be47a259a8 Added folder management UI tests 2017-11-19 17:49:31 +01:00
spl0k
2cf6d01489 Test architecture unifying 2017-11-17 23:26:25 +01:00
spl0k
74ce600e03 Updated getMusicFolders test 2017-11-17 20:00:26 +01:00
spl0k
fd52a04535 Media retrieval (minus transcoding) tests 2017-11-17 19:56:14 +01:00
spl0k
1cf44d1d1d star/unstar/rating/scrobble tests
The `scrobble` test is skipped, it passes but causes some weird
error on exit.
2017-11-14 23:19:54 +01:00
spl0k
5084c745dc Listing endpoints tests 2017-11-11 00:13:18 +01:00
spl0k
27bd7bce0c Added playlist tests 2017-11-08 23:21:52 +01:00
spl0k
6f713e12db Added tests for search and chat 2017-11-03 23:15:48 +01:00
spl0k
d19886fafa Rewritten and improved existing tests 2017-11-01 20:55:35 +01:00
spl0k
8a14ef496d Added tests on API auth, format and such 2017-10-29 16:08:00 +01:00
spl0k
8f5fcc82f5 Response formatting tests 2017-10-28 21:18:34 +02:00
spl0k
955a678df3 Improved existing managers tests 2017-10-28 15:54:41 +02:00
spl0k
fa4b1eca84 A bit of sorting 2017-10-28 11:42:46 +02:00
spl0k
ea8d2baa14 More data model tests 2017-10-27 21:42:36 +02:00
spl0k
ba70d0aadb Renamed test module 2017-10-26 23:17:37 +02:00
spl0k
b04c23ea77 More tests 2017-10-26 23:16:20 +02:00
spl0k
4c6cb99833 Adding some tests... 2017-10-26 21:52:13 +02:00
Óscar García Amor
09ce5ae455 Update tests to check UTF-8 passwords 2017-08-07 14:37:05 +02:00
Óscar García Amor
d9d90ffacf Retab and change header to frontend __init__.py 2017-08-07 13:10:06 +02:00
Óscar García Amor
f8254532ed WIP: Added unit tests for API and frontend 2017-07-14 20:57:08 +02:00
Óscar García Amor
a7ec45f2fd WIP: Reorder tests 2017-07-14 17:28:46 +02:00
Óscar García Amor
d4b3074662 WIP: Adding unit tests for API User 2017-07-14 15:23:44 +02:00
Óscar García Amor
9fcd4e8c52 WIP: Added unit tests for FolderManager 2017-07-14 12:14:10 +02:00
Óscar García Amor
5f40192f1d WIP: Added unit tests for UserManager 2017-07-13 22:02:03 +02:00