Commit Graph

47 Commits

Author SHA1 Message Date
ejurgensen
d2f4efa1bf [misc] Centralize thread naming plus name websocket thread 2021-07-05 21:40:31 +02:00
ejurgensen
a67c74ba6c [spotify] Introduce own spotifyc as replacement for libspotify 2021-05-31 11:54:30 +02:00
ejurgensen
5f1686695a [-] Name update forked-daapd -> owntone throughout the code 2021-04-24 23:54:20 +02:00
whatdoineed2do/Ray
4082f9e215 [library] Add function to delete playlist by id that directly
invalidates the REST API client caches
2020-11-28 08:27:52 +01:00
chme
3fbe16ac1b [library] Directly notify listeners of db changes after adding new items 2020-11-22 11:09:31 +01:00
ejurgensen
2d8521139c [library] Add action to library_schedule_callback()
Makes it possible for the caller to request that a previous callback is
replaced, so we don't end up with more and more callbacks. Also add other
options for future use.
2020-04-04 21:07:16 +02:00
ejurgensen
2ee5f6d747 [library] Change implementation of item_add, event cb and drop item_remove. 2020-04-04 21:07:16 +02:00
whatdoineed2do/Ray
8b02ea9d6b [library] RSS support: new library interface item_{add.remove} and all library modules to register (timer) events 2020-04-04 21:07:16 +02:00
ejurgensen
77a8de3bea [scan] Fix db_pl_add() so it always returns correct id 2020-02-08 10:55:15 +01:00
ejurgensen
ba1c536ca3 [library] Let library_media_save() return errors 2020-02-08 10:55:15 +01:00
ejurgensen
abdc0d6d27 [library] Some refactoring of the library module
Misc refactoring, e.g. alignment of how modules save tracks and playlists, incl
use of mfi and pli. Also try to avoid direct calls between library and player.
2020-02-08 10:55:15 +01:00
ejurgensen
942628f914 [library] Check for all scanning methods in library_init() 2020-02-08 10:53:59 +01:00
whatdoineed2do/Ray
a1a49b9497 [library] validate mandatory methods for source or die 2020-02-06 19:37:16 +00:00
ejurgensen
4ab734343c [-] Free events on exit (turns out event_base_free does not free them)
Credit @whatdoineed2do, ref. pr #797
2019-09-09 22:23:00 +02:00
whatdoineed2do/Ray
8f311d4360 [library] support forced metadata scan of library, via '.meta-rescan' file 2019-07-09 13:54:59 +02:00
chme
0ded6d63bf [db/jsonapi] New admin value for Last-Modified in JSON API header
This adds a new timestamp value "db_modified" into the admin db table.
In addition to the existing "db_update" admin value, this value is also
updated if rating, play-/skip-count or seek changes for a
media_info_file (files db table).

This should improve the caching behavior in clients of the JSON API
(especially the player web interface) in refreshing its data if some of
this values changes.
2019-01-31 09:42:53 +01:00
ejurgensen
734b4e9851 [db] Transfer some library tag fixup to the db's generic fixup
Transfer setting defaults for media_kind and item_kind. Also sets
default media_kind for queue_items.
2018-12-31 15:55:49 +01:00
ejurgensen
1de8f39264 [db] Generic fixup + align fixing up between mfi, pli and queue_item
The idea here is to make sure the fixing up of tags is done in a consistent
manner. For strings, this means stuff like trimming and empty strings -> null
are applied the same unless there are special exception rules set. It also
means that defaults are applied the same across structs, e.g. "Unknown artist"
for both mfi->artist and queue_item->artist.

The change is also necessary because we want to remove trimming from the sql
query and instead implement it ourselves.
2018-12-31 15:55:49 +01:00
chme
a8e8dc1999 [library/db/filescanner/spotify] Reshuffle after adding non library
items to the queue
2018-11-11 07:01:22 +01:00
chme
8d8663e93d [db/queue] Support adding non-library items at a given position to the
queue
2018-10-25 19:36:43 +02:00
chme
60ebac076b Refactor adding non library items to the queue
Instead of asking a client to first scan the path into a media_file_info
object and afterwards add it to the queue, we now offer a library
function to directly add a path.

The library-source that can handle the given path translates the path
into new queue item(s) and adds them to the queue.
2018-04-15 22:09:28 +02:00
chme
cd96ec579a [db/library] Use "PRAGMA optimize" instead of "ANALYZE"
ANALYZE collects and saves statistics even if there were no database
changes and the last collected data is still good.

According to the sqlite3 documentation, it is recommended to use "PRAGMA
optimize" which will call "ANALYZE" if it is necessary. "PRAGMA
optimize" will run "ANALYZE" based on prior queries on the same database
connection. It is recommended to run optimize before closing the
connection.

(see https://www.sqlite.org/lang_analyze.html)
2018-02-26 18:41:28 +01:00
chme
c00febd8ac [library] remove initialization of globals to zero 2017-12-15 19:08:32 +01:00
chme
ef52f4ddc0 Rework user rating updates 2017-12-15 19:08:32 +01:00
chme
4800f9943b [db] Rename 'ADMIN_*' defines to 'DB_ADMIN_*' 2017-11-19 22:08:23 +01:00
chme
38ab4b9676 [db] Functions to read/store int in the admin table and introduce
constants for admin table keys
2017-11-19 22:08:23 +01:00
chme
1cdb9f450d [library/mpd] Store db update time in admin table and trigger DATABASE
event on init/rescan only if an update/insert occurred
2017-11-17 19:40:04 +01:00
Wolfgang Scherer
37aaf73f6a [library] Deferrable library update time with persistence (TBD) 2017-11-17 18:12:03 +01:00
Wolfgang Scherer
e7e2b2c9a6 [library] Decrease library update delay and clarify purpose 2017-11-17 18:12:03 +01:00
ejurgensen
0c2773039b [-] Fix alsa.c null pointer deref + some minor bugs and do some housekeeping
Thanks to Denis Denisov and cppcheck for notifying about the below. The leaks
are edge cases, but the warning of dereference of avail in alsa.c points at
a bug that could probably cause actual crashes.

[src/evrtsp/rtsp.c:1352]: (warning) Assignment of function parameter has no effect outside the function. Did you forget dereferencing it?
[src/httpd_daap.c:228]: (error) Memory leak: s
[src/library.c:280]: (warning) %d in format string (no. 2) requires 'int' but the argument type is 'unsigned int'.
[src/library.c:284]: (warning) %d in format string (no. 2) requires 'int' but the argument type is 'unsigned int'.
[src/library/filescanner_playlist.c:251]: (error) Resource leak: fp
[src/library/filescanner_playlist.c:273]: (error) Resource leak: fp
[src/outputs/alsa.c:143]: (warning) Assignment of function parameter has no effect outside the function. Did you forget dereferencing it?
[src/outputs/alsa.c:657]: (warning) Possible null pointer dereference: avail
[src/outputs/dummy.c:75]: (warning) Assignment of function parameter has no effect outside the function. Did you forget dereferencing it?
[src/outputs/fifo.c:245]: (warning) Assignment of function parameter has no effect outside the function. Did you forget dereferencing it?
[src/outputs/raop.c:1806]: (warning) Assignment of function parameter has no effect outside the function. Did you forget dereferencing it?
[src/outputs/raop.c:1371]: (warning) %u in format string (no. 1) requires 'unsigned int' but the argument type is 'signed int'.
[src/outputs/raop.c:1471]: (warning) %u in format string (no. 1) requires 'unsigned int' but the argument type is 'signed int'.
[src/outputs/raop_verification.c:705] -> [src/outputs/raop_verification.c:667]: (warning) Either the condition 'if(len_M)' is redundant or there is possible null pointer dereference: len_M.
2017-10-05 22:13:01 +02:00
chme
f81d33701b [listener/library] Notify listeners about start/finish of library update 2017-08-27 11:54:32 +02:00
chme
f84e87913c [library] Allow save/add/delete of playlists if source supports it 2017-08-09 21:30:23 +02:00
chme
888710612c [library] Add missing attribute mapping from mfi to queue item 2017-03-19 18:30:46 +01:00
chme
59ade61d7b [library] Rename constants 2017-03-19 18:30:46 +01:00
chme
e6f49b721f [library] New functions to support scan metadata for arbitrary path and
adding a mfi as a queue item
2017-03-19 18:30:46 +01:00
chme
bdd08f516f [library] Rename 'library_process_media' to 'library_add_media' 2017-03-19 18:30:46 +01:00
chme
dadba23efc Refactor library scan of media files
Remove the data_kind specific parts out of the general library functions
and into their (library) source specific functions.
2017-03-19 18:30:46 +01:00
chme
3896f61d06 [dacp] Keep the now playing item in the queue when calling (#353)
playqueueedit_clear
2017-02-11 09:28:35 +01:00
ejurgensen
97aa544945 [library] Move library update trigger to new library module 2017-01-28 22:20:35 +01:00
chme
77086c9b82 [library] Check for init/deinit functions in library source 2017-01-18 20:12:14 +01:00
chme
528614909c [filescanner/library] Move filescanner to subfolder 2017-01-13 19:02:47 +01:00
chme
9c9c583b81 [library] move declaration scan_metadata_ffmpeg back to filescanner.h 2017-01-13 18:56:37 +01:00
chme
510d38c059 [library/filescanner/spotify] Rework full-rescan logic 2017-01-13 18:56:37 +01:00
chme
adac1d3b5f [spotify] Trigger scan after retrieving a valid access token from the
webinterface

Library now offers the function "library_exec_async". This allows
library sources to offer functions that will be executed in
the library thread. Useful to allow partial scans of only one source.
2017-01-13 18:56:37 +01:00
chme
ae1a45bacc [library/spotify] Implement rescan in spotify.c and purge old files
after rescan
2017-01-13 18:56:37 +01:00
chme
1672b67040 [library/filescanner] Move purging of old content to library; Remove
ping for spotify files in filescanner (not needed, either they get
updated through the init-scan or purged)
2017-01-13 18:56:37 +01:00
chme
56ce3f9cba [library/filescanner/spotify] Add library source abstraction and new
"library" thread

- Implement filescanner as a library_source
- Add library source implementation for spotify
- Move process_media_info to library with small adjustments:
  - Remove dependency to F_SCAN_TYPE defines
  - Pass data_kind as parameter
  - Pass media_kind and compilation as parameter if a source forces a
specific value for these
- Move declaration of scan_ffmpeg to library; add
library_add_playlist_info to library
2017-01-13 18:56:37 +01:00