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

808 Commits

Author SHA1 Message Date
Alban
ba289065ce
Stupid comma 2019-04-13 19:01:34 +02:00
Alban
7edc30d683
Fixed setup.py 2019-04-13 18:54:39 +02:00
spl0k
3924ada03e Added a config variable to define if the watcher should be started 2019-04-13 17:14:03 +02:00
spl0k
55e9db61d8 Docs update 2019-04-13 16:58:12 +02:00
spl0k
a3d3c66c74 watchdog is now required
Even if the watcher is unused, due to imports
2019-04-13 16:27:55 +02:00
spl0k
c7f1499d46 Make Python2 happy 2019-04-13 16:02:32 +02:00
spl0k
5b0b5ff29b Removed invalid test
The watcher now keeps running even if there's nothing to watch initially
so we can add watched folder later on
2019-04-10 21:29:00 +02:00
spl0k
57aea188c2 Fixed potential error/freeze when getting a secret key 2019-04-10 21:21:25 +02:00
spl0k
afbd84a5b9 Changed how the DaemonClient get its address + better exception
I'm still not satisfied but can't come up with a good solution
2019-04-10 21:15:18 +02:00
spl0k
751f00dac8 Daemon now listen for remot commands, adding/removing watched folders on the fly
#77 part 5
2019-04-08 19:16:41 +02:00
spl0k
970ee6ee3c Merge branch 'master' into daemon-rework 2019-04-07 16:44:17 +02:00
spl0k
c938f225e9 Store cookie key in db rather than cache 2019-04-07 16:35:26 +02:00
spl0k
92fed40f87 Use mtime as folder/track creation date
Closes #145
2019-04-07 15:25:13 +02:00
spl0k
db2799ef7e Reworked how the watcher is started 2019-03-31 18:06:45 +02:00
spl0k
270fa9883b Removing executable flag from files that shouldn't have it 2019-03-31 16:37:56 +02:00
spl0k
7ff56bc4ad Add indexes on all foreign keys
Should help with query performance issues such as #140
2019-03-24 17:26:14 +01:00
spl0k
780c96c404 Fixed issues with float bitrate and empty tags
Thanks to @nextfullstorm
Closes #139
2019-03-23 17:08:46 +01:00
spl0k
e2cc51a0f0 Fixed issues when the watcher is set to log to /dev/null 2019-03-23 16:20:19 +01:00
spl0k
c0d9d616c8 Truncate artist, album and title when scanning
Closes #138
2019-03-10 11:52:18 +01:00
spl0k
a73d42b9d8 Make MySQL happy with binary data
Closes #137
2019-03-10 11:38:55 +01:00
spl0k
5367f068e1 Giving credit where credit is due 2019-02-09 16:19:30 +01:00
spl0k
54149a605c Update docs about caching 2019-02-09 16:09:38 +01:00
spl0k
cf846e88ee Merge remote-tracking branch 'pR0Ps/feature/transcode-cache' 2019-02-09 15:49:30 +01:00
spl0k
29429bbbf2 Sanitize tags a bit when readong them
Closes #133, closes #134
2019-02-09 15:48:16 +01:00
spl0k
d7bbbfe383 Added test case for #133 2019-02-09 15:39:58 +01:00
Carey Metcalfe
07342529e0 Ensure transcoding failures are never cached
By re-raising any exceptions that `transcode` encounters while running
the transcode, it ensures that `set_generated` will also see the
exception, preventing it from caching an incomplete transcode.
2019-02-03 23:24:26 -05:00
Carey Metcalfe
0ac2376e07 Fix issues with hanging transcoding processes
When a connection that is consuming a generated response is closed,
Flask closes the generator making it raise the special `GeneratorExit`
exception when the program tries to yield from it again. Because the
`transcode` function was called (returning a generator) before being
passed into `set_generated`, the exception was being handled in the
wrong order.

By passing the `transcode` function to `set_generated` and letting
`set_transcode` call it to return a generator while generating the
response for the client, the exception properly bubbles up through
`transcode` into `set_generated`. This allows both of them to handle it
properly by stopping the subproceses and not caching the incomplete
response data respectively.
2019-02-03 23:23:00 -05:00
Carey Metcalfe
f106923f17 Remove unused 'Cache.protect' method 2019-02-03 22:56:03 -05:00
spl0k
53d8660683 Don't pretty print XML output 2019-02-03 19:35:05 +01:00
Carey Metcalfe
7fa1501112 Cache lyrics obtained from ChartLyrics
Lyrics are stored as json in a zlib-compressed file.
2019-01-19 15:39:10 -05:00
Carey Metcalfe
3db489aa7b Add compatibility shims for Python 2.7
- `os.scandir` (provided by a 3rd party package in 2.7)
- `os.replace` (doesn't exist in 2.7 - have to use `os.rename` instead)
- `os.utime` (the times param is required in 2.7)
2019-01-19 15:37:09 -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
Carey Metcalfe
69c43b749b Use HTTPS when communicating with Last.fm 2019-01-17 04:48:35 -05: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
6b86f3a43a Added getSongsByGenre 2018-12-08 17:42:20 +01:00
spl0k
ac306f2725 Added method to list genres 2018-12-08 17:18:58 +01:00
spl0k
9af8ee22e0 Docs update for recent watcher logging changes 2018-11-11 19:38:13 +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
306fc202bd
Add a timeout when fetching remote resources 2018-10-31 13:20:38 -04:00
spl0k
370b5bae77 Added note about token based auth 2018-10-28 15:47:52 +01:00
spl0k
a187a73122 Commit right after registering a new client
Closes #117
2018-10-28 15:14:48 +01:00
spl0k
fd5d53f253 Removed useless transaction handling from latest migrations 2018-10-20 16:03:46 +02:00
spl0k
889b83b761 Merge remote-tracking branch 'TaizoSimpson/master' 2018-10-20 15:59:38 +02:00
Taizo Simpson
25cb354f78
Merge branch 'embed_as_metadata' 2018-10-14 15:18:16 -04:00
Taizo Simpson
f7dc6292fd
Switched from python to sql migration 2018-10-14 15:09:06 -04:00
spl0k
ed0a8fccd0 Merge remote-tracking branch 'pR0Ps/bugfix/kill-transcode-processes' 2018-10-13 14:26:05 +02:00