Commit Graph

220 Commits

Author SHA1 Message Date
ejurgensen
54c2667aea [misc] Use fcntl+O_NONBLOCK when binding instead of socket+SOCK_NONBLOCK
socket() with SOCK_NONBLOCK (O_NONBLOCK) seems not to be possible on MacOS, it
yields 'Protocol wrong type for socket'. Switch to using fcntl() and O_NONBLOCK
instead, hopefully works better cross-platform.

Closes #1644
2023-09-01 17:13:33 +02:00
Marek Skrobacki
469fcf6707
[mpd] Sanitize newline characters in ID3 tag values (#1615)
Fixes https://github.com/owntone/owntone-server/issues/1613
2023-08-12 23:57:28 +02:00
ejurgensen
631996f133 [mpd] Decouple mpd and httpd
mpd is based on evhttp, so if httpd should use another backend they need to be
decoupled. No need to use httpd_send_reply/error, since CORS headers are not
relevant to MPD artwork serving.
2023-03-07 21:01:10 +01:00
chme
1d2e4dc7a8 [db,library] Add "scan_kind" field to playlists, directories and files
(db upgrade to v22.00)

`scan_kind` identifies the library "scanner" component that created the
item and is responsible to keep it up to date (rescan).

The library update now supports passing a `scan_kind` to update only the
items of one particular "scanner". This allows e. g. to only update the
item from the Spotify library or only update the RSS feeds.

The OwnTone database is upgraded to v22.00 and the `scan_kind` columns
in `files`, `playlists`, `directories` are identified by:

 1. Check if item is part of a RSS playlist (podcast RSS feed), they
belong to the "rssscanner"
 2. Check if item has a Spotify `virtual_path`, they belong to the
"spotifyscanner"
 3. Remaining items belong to the "filescanner"
2022-01-22 10:38:31 +01:00
ejurgensen
33837f0382 [mpd] Coverity fixups 2022-01-20 21:42:05 +01:00
chme
8becdee8f1 [db] Refactor db_query_fetch_* functions to take the output parameter
first and the input parameter as last parameter
2021-12-28 07:23:56 +01:00
chme
a65ee4462e [db] Refactor fetching query result into generic function
Additionally changes the return value in case the end of the result set
is reached.
2021-12-28 06:55:35 +01:00
ejurgensen
d2f4efa1bf [misc] Centralize thread naming plus name websocket thread 2021-07-05 21:40:31 +02:00
ejurgensen
d3cc8a52f8 [mpd] Minor fixup 2021-05-28 16:57:57 +02:00
ejurgensen
5f1686695a [-] Name update forked-daapd -> owntone throughout the code 2021-04-24 23:54:20 +02:00
ejurgensen
d2a5f939f5 [mpd] Bind via misc.c's net_xxx methods 2021-03-31 23:55:25 +02:00
ejurgensen
7871d71a9c [misc] Add utility network functions, incl configurable addr binding
Also make misc.c/h a bit less messy.
2021-03-31 23:55:25 +02:00
chme
0334269989 [mpd] Support search/find/count with modified-since filter criteria 2021-01-16 10:45:15 +01:00
chme
59bac6b068 [mpd] Add missing OK response line, if multiple commands are sent
without beeing wrapped in a command list
2020-11-22 11:33:40 +01:00
chme
ccaa7967bf [mpd] Fix nextsong/nextsongid in status cmd response 2020-11-22 11:33:40 +01:00
ejurgensen
695927de2a [artwork] Remove old artwork_get_xxx in favor of new which has a format arg 2020-11-18 23:23:05 +01:00
ejurgensen
5736217315 [db] Change prototype of db_admin_getxxx() functions
Makes it possible for caller to distinguish between "not set" and "set to 0".
2020-02-23 20:30:35 +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
chme
6e5d6791ff [player/dacp/mpd/jsonapi] Combine seek commands into one with mode param
Also changes relative seeking behavior:
- seeking behind the the current track only switches to the previous
track, if we are not more than 3 seconds into the current track,
otherwise starts current track from the beginning
- seeking beyond the current track will start the next track from the
beginning
2019-10-20 14:36:21 +02:00
chme
d88182820c [mpd] Fix initial value of 'songpos' in play command 2019-09-07 08:31:31 +02:00
ejurgensen
a28e370c4f
Merge pull request #748 from chme/conf_deprecated
[conf] Gracefully handle the change of config options for modifying playlists
2019-06-16 22:05:08 +02:00
chme
9351d905f2 [mpd] Handle deprecated config options gracefully 2019-06-15 12:21:27 +02:00
ejurgensen
4f5966c9ff [db] Speed up Q_PL query used by e.g. '/databases/1/containers' request
The previous solution would use subqueries to count the number of items and
streams in each playlist, which means that response time gets pretty slow if
there are many playlists.

This commit also includes a number of lesser db code changes.
2019-05-30 21:19:40 +02:00
whatdoineed2do/Ray
d28f7f43b7 [jsonapi,mpd,conf] save playlist via JSON api
- new endpoint api/queue/save?name= to .m3u via library_save()
- refact for common cfg for playlist save options
2019-05-30 07:23:04 +02:00
chme
81753d44a7 [mpd] Report support for protocol version 0.20 2019-01-28 22:40:25 +01:00
chme
f77c216650 [mpd] Refactor parsing filter/window arguments and add support for
"group" argument in "list" command
2019-01-28 22:40:25 +01:00
chme
e015032292 [mpd] Add duration attribute with millisecond precision 2019-01-28 22:40:25 +01:00
chme
5bd94df4a6 [mpd] Add listfiles command
For now listfiles simply returns the same result as lsinfo (no support
for listing files not part of the library)
2019-01-28 22:40:25 +01:00
chme
1f2b608d62 [mpd] Fix wrong number of format parameters for safe_asprintf
Fixes a segfault in cases where the default playlist directory config
(in the mpd section of the configuration file) was set/activated.
2019-01-26 10:07:48 +01:00
chme
116c315a84 [player] Rename struct spk_info to player_speaker_info 2019-01-22 17:47:15 +01:00
chme
534bbdb477 [artwork] Introduce constant for default artwork width/height 2018-11-28 20:28:38 +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
7252b3e509 [db] Add support to add items to the queue at specified position 2018-09-16 09:36:43 +02:00
chme
41e99ca3cd [db/mpd/jsonapi] Include artist and album count in filecount query; add
count endpoint and additional metadata to JSON API; remove unused
artist-/album-count queries
2018-05-09 22:29:52 +02:00
chme
7dd8955a92 [filescanner] Add http stream to the library prior to adding to a
persistent playlist
2018-04-15 22:09:28 +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
ejurgensen
ea6fd1476a [db] Improve speed of browse queries (issue #478)
Before, we returned either unordered (for RSP, meaning client had to
sort) or ordered by a client selected sort_clause[]. The latter are
multi-purpose and therefore not optimised for browse queries.

To speed up, we predefine the entire set of browse queries, including
order, with matching indices. The predefined queries are used except
if the client explicitly requests a non-default order or query.

As a special bonus, the commit also allows queries with I_SUB that
have an offset but no limit.
2018-03-02 21:11:31 +01:00
chme
8b2d40d46f Initialize local variables to silence OpenWrt compiler warnings 2018-02-22 21:35:38 +01:00
chme
43887d160f [mpd] Refactor commands to enable/disable/toggle/volume for outputs 2018-02-10 09:04:18 +01:00
chme
93879c6f90 [player] Refactor speaker enumerate callback 2018-02-10 09:04:18 +01:00
chme
141c4e926b [mpd] Formatting of channel and sticker handler list 2017-12-28 16:12:56 +01:00
chme
8ad6f75815 [mpd] Refactor minimum argument check 2017-12-28 16:12:56 +01:00
Wolfgang Scherer
a7f9d633a3 [mpd] minimal urlhandlers command 2017-12-24 02:46:40 +01:00
chme
434be28460 [mpd] Support position parameter in command 'addid' 2017-12-22 11:24:43 +01:00
chme
a1372c692e [mpd] Implement 'playlistfind' and 'playlistsearch' 2017-12-22 11:24:43 +01:00
chme
6f4f7c5b16 [mpd] command 'currentsong': report current item if player is stopped 2017-12-22 11:24:43 +01:00
chme
80e0808b18 [mpd] command 'status': report current/next if player is stopped 2017-12-22 11:24:43 +01:00
chme
4034582f1a [mpd] Fix 'noidle' command handling
The noidle command did not prevent idle events to be sent to the client
directly when they occured. This resulted e. g. in M.A.L.P. in errors
trying to play an album from the library)
2017-12-16 08:19:45 +01:00
chme
e7d6fbb9fc [listener/etc.] Rename LISTENER_STICKER to LISTENER_RATING
Unit there is a real sticker implementation, make it clear, that the
event is only triggered for rating changes.
2017-12-15 19:08:32 +01:00
chme
9f1568349b [mpd] minor cleanup 2017-12-15 19:08:32 +01:00