Commit Graph

415 Commits

Author SHA1 Message Date
caiocotts 54f98497c2
Use wchar_t for TagLib filenames on Windows (#1310)
* Use wchar_t for tagLib filenames on Windows

* Make TagLib default extractor for all platforms.

* Organize imports

Co-authored-by: Deluan <deluan@navidrome.org>
2021-08-28 19:35:54 -04:00
Deluan d481864035 Some small refactorings 2021-08-22 12:16:49 -04:00
Deluan 143f5ba9d5 Import song duration with hundredths when using TagLib
This is how ffmpeg extractor currently works, and it makes album durations more precise.
2021-08-20 21:42:01 -04:00
caio e9d0abe0bc Support local paths as urls in playlists. 2021-08-02 23:53:47 -04:00
Deluan b66c39451f Fix build 2021-07-24 11:45:46 -04:00
Deluan 4ed01bad86 Use `ffmpeg` extractor by default on Windows
This is to avoid issue with unicode chars in filenames. See #810
2021-07-24 11:35:49 -04:00
Deluan d3975d206a Reorganize metadata extractors code 2021-07-24 11:10:19 -04:00
Deluan 6c550819fd Use TagLib to detect whether a media file has embedded cover or not 2021-07-24 01:59:53 -04:00
Deluan 91325071a6 Change fallback extractor to taglib, the default option 2021-07-22 23:08:47 -04:00
Deluan 876dda83f2 Reduce number of calls to `lstat`.
Should make the scanner a bit faster, specially in networked filesystems
2021-07-21 22:17:37 -04:00
Deluan 8afa2cd833 Remove dependency of deprecated `ioutil` package 2021-07-20 20:12:28 -04:00
Deluan 2742977c63 Fix multiple id3v2.4 genres appearing as one big concatenated genre 2021-07-20 17:45:08 -04:00
Deluan 69f71be98a Add more tests 2021-07-20 17:45:08 -04:00
Deluan 3a356499ae Fix lint error 2021-07-20 17:45:08 -04:00
Deluan 39da741a80 Add multiple genres to MediaFile 2021-07-20 17:45:08 -04:00
Deluan 7cd3a8ba67 Add genre tables, read multiple-genres from tags 2021-07-20 17:45:08 -04:00
Deluan 882b02c747 Fix forceRescan not re-importing all tracks 2021-07-19 10:32:33 -04:00
Deluan e61cf3217d Reapply the fix from #1054, but without getting into an infinite look in case of SMB fs errors. See #1164 2021-07-17 21:06:53 -04:00
Deluan eb8ffc6f76 Fix infinite loop when the fs fails. Closes #1164 2021-07-16 09:38:58 -04:00
Deluan 8d56ec898e Use AlbumArtist tag even for compilations, when it is specified.
If the tracks' AlbumArtists are different, then use "Various Artists"
2021-07-15 11:53:08 -04:00
Deluan 5bd33455a1 Fix deadlock situation when events are sent too fast to the broker 2021-07-01 10:42:00 -04:00
Deluan b65e76293a Only send events to clients who need it
- User events (star, rating, plays) only sent to same user
- Don't send to the client (browser window) that originated the event
2021-06-15 18:59:26 -04:00
Deluan 667701be02 Less `warning` messages when first running it.
They are actually `info` messages
2021-06-13 19:27:01 -04:00
Deluan 7f85ecd515 Trigger a UI refresh when the scanner finds changes.
Closes #1025
2021-06-09 21:02:20 -04:00
Deluan 9da9d73c1d Don't panic when taglib returns an error 2021-05-31 18:26:46 -04:00
Deluan cd242695ba Foundational work to enable multi-valued tags 2021-05-31 18:08:12 -04:00
Deluan fa0e6dda5b Remove C++11 warning in macOS 2021-05-14 16:03:11 -04:00
Deluan e047008f7d Fix test 2021-05-14 15:38:28 -04:00
Deluan 3cac00ad13 Upgrade TagLib to 1.12 2021-05-14 14:31:07 -04:00
Deluan f8dbc41b6d Breaking change: Add `ScanSchedule`, allows interval and cron based configurations.
See https://pkg.go.dev/github.com/robfig/cron#hdr-CRON_Expression_Format for expression syntax.

`ScanInterval` will still work for the time being. The only situation it does not work is when you want to disable periodic scanning by setting `ScanInterval=0`. If you want to disable it, please set `ScanSchedule=""`

Closes #1085
2021-05-06 17:56:10 -04:00
Brian Schrameck 30bb3f7b43
BPM metadata enhancement (#1087)
* BPM metadata enhancement

Related to #1036.

Adds BPM to the stored metadata about MediaFiles.

Displays BPM in the following locations:
- Listing songs in the song list (desktop, sortable)
- Listing songs in playlists (desktop, sortable)
- Listing songs in albums (desktop)
- Expanding song details

When listing, shows a blank field if no BPM is present. When showing song details, shows a question mark.

Updates test MP3 file to have BPM tag. Updated test to ensure tag is read correctly.

Updated localization files. Most languages just use "BPM" as discovered during research on Wikipedia. However, a couple use some different nomenclature. Spanish uses PPM and Japanese uses M.M.

* Enhances support for BPM metadata extraction

- Supports reading floating point BPM (still storing it as an integer) and FFmpeg as the extractor
- Replaces existing .ogg test file with one that shouldn't fail randomly
- Adds supporting tests for both FFmpeg and TagLib

* Addresses various issues with PR #1087.

- Adds index for BPM. Removes drop column as it's not supported by SQLite (duh).
- Removes localizations for BPM as those will be done in POEditor.
- Moves BPM before Comment in Song Details and removes BPM altogether if it's empty.
- Omits empty BPM in JSON responses, eliminating need for FunctionField.
- Fixes copy/paste error in ffmpeg_test.
2021-05-05 21:35:01 -04:00
Deluan b478b0af02 FIx ffmpeg output regex too rigid 2021-05-03 21:26:44 -04:00
Deluan c3316e201e Fix cover art detection with ffmpeg 4.4 2021-05-03 20:25:31 -04:00
Deluan 8a07bac2a2 Fix SIGUSR1 work when ScanInterval=0 2021-04-29 13:10:10 -04:00
whorfin 20d2726faa
Improve scanner (#1054)
* Handle subdirectories without rx permission correctly
Allow ogg files w/o metadata, having taglib behave more like ffmpeg

* Fix test for walk_dir_tree, fix full reading of files in permission-
constrained directories, allow directories with leading ellipses

* Sorted directory traversal is preferred, and cleanup tests

* Small refactoring to clean-up `loadDir` function and to remove some "warnings" from IntelliJ

Co-authored-by: Deluan <deluan@navidrome.org>
2021-04-28 19:51:02 -04:00
Deluan 0142352280 Fix build tag 2021-04-23 21:42:22 -04:00
Deluan d5c7a81888 Disable SIGUSR1 handler for Windows (not available) 2021-04-23 21:22:04 -04:00
Deluan 1e539f4e54 Add trigger scan when receiving SIGUSR1 signal 2021-04-23 20:40:28 -04:00
Deluan c33c71ae6d Comment out flaky tests 2021-03-22 09:52:29 -04:00
Deluan 720e2357b7 Add option to sort Recently Added by file's mtime instead of time of import. 2021-03-12 18:18:35 -05:00
Deluan 6ee45a9ccc Move project to Navidrome GitHub organization 2021-02-06 21:46:35 -05:00
Deluan c5686c4884 Replace periodic scanner cancellation channel with a context 2021-01-31 17:37:54 -05:00
Deluan 7c23bd0890 Fix log message, as it is also used for `taglib` 2020-12-25 12:45:38 -05:00
Deluan ea2f94658a Error should always be nil 2020-12-20 13:28:33 -05:00
Deluan a241865209 Add elapsed time when scanner does not detect any new changes 2020-12-13 20:48:16 -05:00
Deluan 8b92796a5c Disconnect the client if the output buffer fills up 2020-12-12 18:26:30 -05:00
Deluan 0cde8cbf2e Fix logging field case 2020-12-11 11:26:06 -05:00
Deluan f29bb211d1 Better termination handling in Scanner's progress 2020-11-25 19:05:36 -05:00
Deluan a1dcb9a4e3 Show folders scanned instead of files scanned 2020-11-16 00:36:12 -05:00
Deluan 7efc32d136 Ignore "Cover (front)" tag when using `ffmpeg` extractor 2020-11-12 23:17:06 -05:00
Deluan c09ba509b2 Fine tune scan status behaviour 2020-11-12 16:12:31 -05:00
Deluan 0e7163eb2c Sanitize comments and lyrics on import, as they are rendered as HTML on the UI 2020-11-11 12:26:47 -05:00
Deluan 98af68ac99 Import comments and lyrics 2020-11-11 10:43:17 -05:00
Deluan aee4eb71c4 Add support for multi-line tags 2020-11-11 09:45:46 -05:00
Deluan 714100e24b Remove old TODO 2020-11-09 19:50:14 -05:00
Deluan 2b1a5f579a Adding a communication channel between server and clients using SSE 2020-11-09 16:12:50 -05:00
Deluan 779d4a1c85 Revert "Process empty folders as changed folders"
This reverts commit e07152b695.
2020-11-02 07:57:47 -05:00
Deluan e07152b695 Process empty folders as changed folders
This is a workaround for rclone not changing the directory modtime when you delete all folders from it (happens when you are moveing things around with beets)
2020-11-01 23:25:34 -05:00
Deluan ee5a0698c0 Simplify scanner utilization 2020-11-01 18:37:17 -05:00
Deluan 8e584ee020 Update count on `getScanStatus` 2020-11-01 16:54:33 -05:00
Deluan 145a5708ca Stop tag_scanner when waltDirTree is interrupted by errors
Otherwise, tag_scanner remove tracks from folders that would come after the error
2020-10-31 00:06:28 -04:00
Deluan 84384da8d1 Better naming for function 2020-10-30 13:14:53 -04:00
Deluan 4d6c9482ff Recover from panic when reading invalid id2 tags
Workaround for #596
2020-10-30 09:53:38 -04:00
Deluan cdd44a2830 Abort scan when media folder is empty
This is to prevent all data being deleted in the case where a mount is not available
2020-10-30 09:39:36 -04:00
Deluan 00ec6cf042 Process changed folders as they are discovered 2020-10-29 23:47:43 -04:00
Deluan 2f394623c8 WIP 2020-10-29 23:19:26 -04:00
Deluan 464e251d19 Only start the cache warming after all folders were scanned 2020-10-27 20:11:25 -04:00
Deluan d0bf37a8a9 Move mock datastore to tests package 2020-10-27 15:23:49 -04:00
Deluan 1e56f4da76 Add simple cache warmer, disabled by default 2020-10-25 23:22:52 -04:00
Deluan 1cfa7b2272 Change MediaFolder.ID type to int32 2020-10-25 23:22:52 -04:00
Deluan af7eaa2b7a Add scanner status 2020-10-25 23:22:52 -04:00
Deluan 4514a54744 Fix ignoring hidden folders when scanning 2020-10-22 13:59:54 -04:00
Deluan b5e20c1934 Ignore invalid MBIDs (ex: discogs IDs) 2020-10-20 17:45:32 -04:00
Deluan 6663c079e0 Add MBIDs to media_file, album and artist 2020-10-20 16:27:22 -04:00
Deluan 26d2af17a3 Fix read `DISCNUMBER` as a DiscNumber tag in ffmpeg extractor 2020-10-06 17:06:47 -04:00
Deluan 665b1f6898 Fix auto-imported playlists losing the "Public" status. Fix #479 2020-10-05 12:40:44 -04:00
Deluan f859772723 Remove dangling tracks after changing MusicFolder. Fix #445 2020-10-02 16:18:45 -04:00
Fernando Rios 80b8b69cee Fix compilation of C++ code on certain linux systems 2020-09-26 13:08:28 -04:00
Deluan afe5a5b32a Fix extracting tags with spaces in the tagname ("Ex: Album Artist") 2020-09-22 14:42:36 -04:00
Deluan caeff2862a Remove dependency on C++17 2020-09-10 15:16:47 -04:00
Deluan a3ecc41e47 Change taglib extractor log level to trace 2020-09-08 13:33:07 -04:00
Deluan 4d18212f5d Extract all id3 frames from file 2020-09-08 13:33:07 -04:00
Deluan 5dea258058 Extract basic tags, as a fallback 2020-09-08 13:33:07 -04:00
Deluan 0802ab73d7 Trim tag value, not tag key 2020-09-08 13:33:07 -04:00
Deluan 865b9cd545 Trim spaces from tags 2020-09-08 13:33:07 -04:00
Deluan e70ec53983 Rewrite taglib integration, now with TCMP 2020-09-08 13:33:07 -04:00
Deluan 2d0031f709 Parse more date formats 2020-09-08 13:33:07 -04:00
Deluan 78ecda5239 Get the first occurrence of multi-valued tags 2020-09-08 13:33:07 -04:00
Deluan a1879ff871 Reorganize tests 2020-09-08 13:33:07 -04:00
Deluan 34eda3c8fc Add config option to select tag extractor (taglib, ffmpeg) 2020-09-08 13:33:07 -04:00
Deluan 506899b083 Add more fallback options for main tags 2020-09-08 13:33:07 -04:00
Deluan 3a4e2523dd Fix possible concurrency issue 2020-09-08 13:33:07 -04:00
Deluan 58a0c44600 Embed audiotags lib, to make it static compilable 2020-09-08 13:33:07 -04:00
Deluan df4328819d Initial implementation of `taglib` MetadataExtractor 2020-09-08 13:33:07 -04:00
Deluan 1187ee7cc1 Moved Metadata Extraction to its own package 2020-09-08 13:33:07 -04:00
Deluan 0beec552b1 Introduce Metadata and MetadataExtractor interfaces 2020-09-08 13:33:07 -04:00
Deluan 6820e120cb Test for accented article sanitization 2020-09-08 09:40:41 -04:00
Deluan 28aefb4858 Fix sanitizing accented articles 2020-09-08 09:36:08 -04:00
Deluan a45c08f217 Ignore "hidden" files when importing a folder 2020-08-21 11:50:18 -04:00
Deluan b836871161 Handle CR, LF and CRLF line endings when importing Playlists 2020-08-19 12:22:41 -04:00
Deluan 28d1428c90 Add option to disable .m3u auto-import 2020-08-02 23:17:13 -04:00
Deluan f29e1eb248 Remove repeated call 2020-08-02 15:19:42 -04:00
Deluan f992b5663f Remove old scanner 2020-07-27 12:34:44 -04:00
Deluan 4e4fcb2304 Small refactorings, better var/function names 2020-07-27 10:51:50 -04:00
Deluan 60178c264d Keep annotations if tracks were already in DB 2020-07-23 03:26:39 -04:00
Deluan 040c7f1e7d Add missing call to refresh artists 2020-07-22 15:37:24 -04:00
Deluan 036f9d6730 Flush albums and artists after each folder added/updated/deleted 2020-07-22 12:56:50 -04:00
Deluan f96e2f6c4f Process deleted folders even if there are no changed folders 2020-07-22 01:29:44 -04:00
Deluan 7a5285ae47 When deleting folders, only flush artists/albums after deleting the mediaFiles 2020-07-22 01:00:16 -04:00
Deluan ba347bc0b1 Detect moved folders 2020-07-22 00:42:12 -04:00
Deluan d268075046 Change the default scanner to use new implementation 2020-07-19 21:39:06 -04:00
Deluan feca030c6d Give warning when playlists are not imported due to not having an admin user 2020-07-19 13:58:46 -04:00
Deluan 6adba03868 Renamed misleading function name 2020-07-17 22:55:51 -04:00
Deluan 609d172259 Use first admin user for all scan operations 2020-07-17 22:55:51 -04:00
Deluan 9cf8c92cae Break up processChangedDir into smaller functions 2020-07-17 22:55:51 -04:00
Deluan 8f512a40f7 Refactored playlist auto-import support 2020-07-17 22:55:51 -04:00
Deluan b9b6ce066b Auto-Import playlists found in the Music Folder 2020-07-17 22:55:51 -04:00
Deluan 3239be4a4d Change log level of some scanner operations 2020-07-17 12:49:37 -04:00
Deluan 51c295d1de Add new scanner algorithm, can be enabled with DevNewScanner config option 2020-07-17 12:06:49 -04:00
Deluan de0cc1f268 Move LoadAllAudioFiles tests to the proper test file 2020-07-16 18:18:48 -04:00
Deluan e7f6ba8f35 Move LoadAllAudioFiles function to the right file 2020-07-16 17:42:26 -04:00
Deluan aae43f4452 Remove unneeded `\n` 2020-07-13 11:49:06 -04:00
Deluan d4347f20ae Remove redundant log message 2020-07-12 20:42:38 -04:00
Deluan ee0ae0a06c Fix lint errors 2020-07-12 13:36:22 -04:00
Deluan 064da8e034 Add more trace logging to scanner 2020-07-12 13:30:03 -04:00
Deluan c2f40ea8a3 Show totals at the end of scan 2020-07-12 12:35:23 -04:00
Deluan f694e471fb Make private types unexported 2020-07-12 11:55:19 -04:00
Deluan dc8368c89c Return counter from DeleteByPath 2020-07-12 11:53:07 -04:00
Deluan 2f8b01015d Change log level for "path unavailable" 2020-07-04 11:36:57 -04:00
Deluan 17830d63b4 Ignore m3u files when scanning 2020-07-03 21:06:33 -04:00
Deluan bcaf330233 Make sure to select cover art from media_file that has it. Fix #360 2020-06-27 22:16:07 -04:00
Deluan ab1c943d1f Force album/artist refresh when folder changes, to cater for cover art files 2020-06-27 18:41:55 -04:00
Deluan eb109ebeb4 Remove duplicated helper functions, move them to `utils` package 2020-06-24 20:48:42 -04:00
Deluan 653b5ea9d3 Replace map[string]bool with map[string]struct{} 2020-06-14 03:11:16 -04:00
Deluan e73b71aaf7 Remove tracks from DB that were deleted while Navidrome was not running. Fixes #151 2020-06-14 03:11:16 -04:00
Deluan 01919661e9 Skip unreadable directories. Fixes #328 2020-06-14 03:11:16 -04:00
Deluan 3190611ec8 Call `ffmpeg` in batches 2020-06-14 03:11:16 -04:00
Deluan 238020c839 Handle folders with lots of albums and/or artists 2020-06-14 03:11:16 -04:00
Deluan 17df63b550 Fix `child.size` and `directory.playCount` compatibility with Subsonic API. Fixes #304 2020-05-19 23:51:23 -04:00
Deluan a4183aea8c Unexport private functions 2020-05-18 15:06:33 -04:00
Deluan 9e845cb116 Skip scanning folders if they contain a `.ndignore` file. Closes #297 2020-05-18 14:37:01 -04:00
Deluan 5ce3135f00 Fix gosec's G601 2020-05-13 15:32:42 -04:00
Deluan 0d9361734f Import and display disc subtitles 2020-05-12 12:57:53 -04:00
Deluan 5862157a2c Move test file to fixtures folder 2020-04-28 11:59:47 -04:00
Deluan ddeefad501 Fix `goimport` and `gosec` warnings 2020-04-26 15:07:36 -04:00
Deluan 5cd453afeb Fix all `errcheck` warnings 2020-04-26 15:07:36 -04:00
Deluan 03c3c192ed Fixing static checks about passing nil context 2020-04-26 15:07:36 -04:00
Deluan 1dd3a794f8 Reduce level of "invalid year" log message 2020-04-24 16:00:14 -04:00
Deluan 6c5dd245fe Parse TSO2 (seems that ffmpeg does not process this tag in some situations) 2020-04-24 15:02:20 -04:00
Deluan 371e8ab6ca Generate Order Fields based on sanitized version of original fields 2020-04-24 15:02:20 -04:00