mirror of
https://github.com/owntone/owntone-server.git
synced 2025-04-22 11:35:43 -04:00
[scan] Add option to prefer M3U extinf metadata for URL streams
This commit is contained in:
parent
5e13bac867
commit
a95762f36f
@ -155,6 +155,10 @@ library {
|
|||||||
# to trigger a rescan.
|
# to trigger a rescan.
|
||||||
# filescan_disable = false
|
# filescan_disable = false
|
||||||
|
|
||||||
|
# Should artists and titles in M3U playlists that contain internet radio
|
||||||
|
# URL's override what we get by querying the radio station?
|
||||||
|
# m3u_overrides = false
|
||||||
|
|
||||||
# Should iTunes metadata override ours?
|
# Should iTunes metadata override ours?
|
||||||
# itunes_overrides = false
|
# itunes_overrides = false
|
||||||
|
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
#include "db.h"
|
#include "db.h"
|
||||||
#include "library/filescanner.h"
|
#include "library/filescanner.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
#include "conffile.h"
|
||||||
#include "library.h"
|
#include "library.h"
|
||||||
|
|
||||||
/* Formats we can read so far */
|
/* Formats we can read so far */
|
||||||
@ -77,10 +78,27 @@ process_url(int pl_id, const char *path, time_t mtime, int extinf, struct media_
|
|||||||
{
|
{
|
||||||
char virtual_path[PATH_MAX];
|
char virtual_path[PATH_MAX];
|
||||||
char *pos;
|
char *pos;
|
||||||
|
char *preserve_artist;
|
||||||
|
char *preserve_title;
|
||||||
int ret;
|
int ret;
|
||||||
|
int m3u_overrides;
|
||||||
|
|
||||||
|
m3u_overrides = cfg_getbool(cfg_getsec(cfg, "library"), "m3u_overrides");
|
||||||
|
preserve_artist = NULL;
|
||||||
|
preserve_title = NULL;
|
||||||
|
|
||||||
if (extinf)
|
if (extinf)
|
||||||
DPRINTF(E_INFO, L_SCAN, "Playlist has EXTINF metadata, artist is '%s', title is '%s'\n", mfi->artist, mfi->title);
|
{
|
||||||
|
DPRINTF(E_INFO, L_SCAN, "Playlist '%s' has EXTINF metadata, artist is '%s', title is '%s'\n", path, mfi->artist, mfi->title);
|
||||||
|
|
||||||
|
if (m3u_overrides)
|
||||||
|
{
|
||||||
|
preserve_artist = mfi->artist;
|
||||||
|
preserve_title = mfi->title;
|
||||||
|
mfi->artist = NULL;
|
||||||
|
mfi->title = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mfi->id = db_file_id_bypath(path);
|
mfi->id = db_file_id_bypath(path);
|
||||||
mfi->path = strdup(path);
|
mfi->path = strdup(path);
|
||||||
@ -104,6 +122,14 @@ process_url(int pl_id, const char *path, time_t mtime, int extinf, struct media_
|
|||||||
mfi->description = strdup("MPEG audio file");
|
mfi->description = strdup("MPEG audio file");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m3u_overrides && (preserve_artist || preserve_title))
|
||||||
|
{
|
||||||
|
free(mfi->artist);
|
||||||
|
free(mfi->title);
|
||||||
|
mfi->artist = preserve_artist;
|
||||||
|
mfi->title = preserve_title;
|
||||||
|
}
|
||||||
|
|
||||||
if (!mfi->title)
|
if (!mfi->title)
|
||||||
mfi->title = strdup(mfi->fname);
|
mfi->title = strdup(mfi->fname);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user