175 Commits

Author SHA1 Message Date
ejurgensen
59bba5e261 [scan] Fix missing rescan if a file is modified quickly multiple times
If db_timestamp == file_mtime we didn't rescan, just pinged the file in the db

Fixes #1782
2024-07-26 16:04:01 +02:00
ejurgensen
2219e3ce75 [scan] Fix bug where playlist name isn't updated when m3u/pls file is renamed
Closes #1758
2024-06-12 13:12:37 +02:00
ejurgensen
1c17231b9e [spotify] Fix some logging inaccuracies 2024-04-05 23:45:08 +02:00
ejurgensen
9b12618b93 [scan] Fix date_released being set to 0 on platforms with musl
%F for ISO date format is only glibc. May affect other date parsing.

Closes #1730
2024-03-21 21:04:21 +01:00
ejurgensen
bf8e433a0e
[scan] Fix error in debug function 2024-03-20 09:27:30 +01:00
ejurgensen
49de0240b8 [scan] Remove obsolete comments 2024-03-01 23:37:17 +01:00
ejurgensen
4352f54c11 [scan] Use copy_file_range for Linux/FreeBSD file copy
FreeBSD doesn't seem to actually have copyfile.h
2024-03-01 22:59:23 +01:00
whatdoineed2do
2dc448fa30
[scan/library] Media rating sync (#1681)
Automatically read/write ratings to files in the library, if options read_rating/
write_rating are enabled. Also adds a max_rating so the user can set the rating
scale.

Doesn't sync automatic rating updates, because that could lead to whole-playlist
file rewriting.

Closes #1678 

---------

Co-authored-by: whatdoineed2do/Ray <whatdoineed2do@nospam.gmail.com>
Co-authored-by: ejurgensen <espenjurgensen@gmail.com>
2024-01-24 23:30:02 +01:00
ejurgensen
2871a03aa8 [spotify] Fixup commit 182255c 2024-01-01 17:34:07 +01:00
ejurgensen
182255cac8 [spotify] Fix double free on logout or exit
Fixes #1706
2024-01-01 16:33:12 +01:00
ejurgensen
2fa80b2fd9 [spotify] Remove logging of "No spotify refresh token found"
Logged every time the web UI is used due to call to /api/spotify and during
initscan, but it isn't an error, it just means the user isn't logged in.

Fixes #1701.
2023-12-22 23:29:40 +01:00
ejurgensen
5ea49c94de [library/db/jsonapi] Refactor adding items to queue via JSON API v2 2023-12-17 23:42:57 +01:00
ejurgensen
1ea90b9445 [library/db/jsonapi] Refactor adding items to queue via JSON API
Reduce code duplication and move database specific stuff from httpd_json.c
to db.c.
2023-12-17 23:42:57 +01:00
ejurgensen
f657780a42 [scan] Fix issue where albums get split
Regression from PR #1655. This reverts the metadata search to the method used
before the PR, so that search is done in the order set by the metadata maps.

This means the songalbumid is set by the tag with the highest precedence, not
just the first one found.

Closes #1696
2023-12-16 00:11:54 +01:00
ejurgensen
65c72c484b [misc] Add misc_xml.c to wrap mxml, fixes XML reading of CDATA (et al)
The change removes all direct calls to mxml from the modules that need an XML
parser (lastfm.c, pipe.c, rssscanner.c and httpd_rsp.c).

Even with the help of mxml, reading XML is hard, so a layer is added which
helps deal with stuff like whitespace and CDATA. This should make OwnTone more
resilient to any XML variations it might receive.

The changes fixes issue #1677.
2023-11-12 23:43:38 +01:00
ejurgensen
83ac327d7f [spotify] Don't log error if a playlist is empty
Fixes #1676
2023-10-28 17:38:37 +02:00
ejurgensen
369771bda5 [scan] Handle playlists with Unicode BOM
Closes #1674
2023-10-26 23:03:54 +02:00
ejurgensen
253a699001 [scan] Fix reading of FLAC tags
Regression from PR #1655. Closes #1673.
2023-10-26 22:40:23 +02:00
ejurgensen
e4c47c22b3 [scan] Fix issue where m3u genre doesn't override despite m3u_override = true
Closes #1668
2023-10-21 22:37:34 +02:00
ejurgensen
8796368b01 [scan] Fixup lyrics changes 2023-10-19 23:49:53 +02:00
X-Ryl669
9670f6b079 [httpd] Add fetching lyrics in the JSON api 2023-10-19 23:49:53 +02:00
X-Ryl669
cf8b3ecd3a [db,library] Add support for parsing lyrics and storing them in DB 2023-10-19 23:49:53 +02:00
ejurgensen
4662cd4cce [scan] Set consistent return type in check_path_in_directories() 2023-09-27 22:46:13 +02:00
ejurgensen
3f6c7405ed [spotify] Don't zero pthread lock when resetting credentials 2023-09-03 20:59:45 +02:00
whatdoineed2do/Ray
b9b8ced689 [scan] Handles case for file overwrite/move within library that previously original db entry for overwritten file
Fixes #1645
2023-09-01 09:17:54 +01:00
ejurgensen
7f2e05284b [scan] Read m3u8 playlists like m3u
Fixes #1639
2023-08-15 19:33:50 +02:00
ejurgensen
9f67f2d4fd [rss] Use "Unknown genre" instead of "Podcast" if no genre found
If the scanner doesn't set anything the genre will be set to unknown in db.c.

See issue #1618
2023-07-06 14:40:39 +02:00
ejurgensen
070cf6a5fc [spotify] Some cleanup of webapi client 2023-02-06 22:38:44 +01:00
ejurgensen
eee011180f [spotify] Make web api client thread safe
Protect http_session with a lock and don't use mutating globals in utility
functions where it is less clear if they are protected.
2023-02-06 22:38:44 +01:00
ejurgensen
af07f9eeb4 [scan] Changes to commit 9a3cb3b7
* 'split_genre' -> 'only_first_genre' + changed description
* fix memleak on multiple genre tags
2022-12-29 20:07:30 +01:00
whatdoineed2do/Ray
0c43de9735 [scan] option to use first genre on multi token genres
multiple genres are either supported by format (see flac/orbis) or are
handled by convention (see mp3) - ffmpeg presents either case as a
single string, seperated by ';' (ie "Pop;Rock")

Currently the server/db does not support multiple genres and will store
the ffmpeg string as-is which is unlikely the user intention.

Introduce 'split_genre' to take the first genre token
2022-12-29 20:07:30 +01:00
ejurgensen
b70188f4b8 [spotify] Fix commit 5e7bf182 to avoid picking too large images 2022-12-21 23:29:44 +01:00
ejurgensen
5e7bf1826c [spotify] Fix poor artwork resolution on playback from playlist start
Closes #1559
2022-12-21 17:39:41 +01:00
whatdoineed2do/Ray
7d26c2c954 [db,scan,jsonapi] bug fix to handle date_released before 1970, storing -ve values in db 2022-12-13 17:38:07 +00:00
ejurgensen
d468fd358e [spotify] Select best artwork size even when not ordered descending
Spotify web API docs say that images are ordered wideest first, but that isn't
happening right now, so don't rely on that for size selection.

Also makes sure we pick an image even when max_w is smaller than smallest
available image.
2022-10-30 20:31:58 +01:00
ejurgensen
684f55f603 [xcode] Align how ffmpeg API checks are done 2022-10-26 17:22:41 +02:00
whatdoineed2do
94c28386a6
[xcode] Use ffmpeg ch_layout instead of deprecated channel_layout/channels (#1536)
Co-authored-by: whatdoineed2do/Ray <whatdoineed2do@nospam.gmail.com>
2022-10-06 17:09:01 +02:00
chme
9340443a3b [spotify] Remove "Spotify saved" playlist
This special playlist was previously required to keep track of saved
albums tracks to avoid purging them after a rescan, since then the
rescan logic was changed to use the Spotify web api and this playlist
has no use anymore.
2022-06-03 07:06:17 +02:00
chme
efb9ba7767 [spotify] Additional cleanup of functionality only used with libspotify
- Remove playlist commands only used by libspotify: adding / removing
playlist command was used by the callbacks from libspotify to receive
incremental updates (did not work for some time)
- Remove "login" web api endpoint: no login into libspotify is required
any more. Spotify web api authorization follows the OAuth flow.
2022-06-03 07:06:17 +02:00
ejurgensen
0ca02687bd [spotify] Remove old libspotify integration
No longer works, libspotify has been sunset by Spotify
2022-05-25 22:49:35 +02:00
chme
d277f7c7b3 [http/spotify] Add support for http sessions across multiple requests
This change allows to reuse curl handles for multiple requests.
Reusing a curl handle improves performance if more than one request is
made against a service (connection, session cache, dns cache are kept
between requests).
2022-05-01 09:01:23 +02:00
chme
ecc139641a [spotify] Respect album_override setting when parsing Spotify tracks 2022-04-04 20:51:14 +02:00
ejurgensen
edd22b6874 [scan] Remove unused libunistring includes 2022-02-12 20:58:16 +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
cd4386228d [spotify] Coverity fixups 2022-01-20 20:17:38 +01:00
ejurgensen
a09da06e8f [scan] Coverity fixups 2022-01-20 20:17:38 +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
1418bfb245 [scan] Don't iTunes playlist scan timestamp on failed scan
Also some refactoring.

Closes #1359
2021-12-01 20:11:54 +01:00
ejurgensen
5e66dbd8c9 [spotify] Fix Spotify initialization issues
* loading library even though library playback login failed
2021-11-01 10:37:17 +01:00