mirror of
https://github.com/owntone/owntone-server.git
synced 2025-01-14 08:15:02 -05:00
[scan] Fixes for #d2f0d7b
* Don't treat m3u's with m3u URL's as nested playlists * Dereference playlist paths in the m3u's
This commit is contained in:
parent
d2f0d7b53a
commit
6b007dcd26
@ -169,6 +169,7 @@ static int
|
|||||||
process_nested_playlist(int parent_id, const char *path)
|
process_nested_playlist(int parent_id, const char *path)
|
||||||
{
|
{
|
||||||
struct playlist_info *pli;
|
struct playlist_info *pli;
|
||||||
|
char *deref = NULL;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
// First set the type of the parent playlist to folder
|
// First set the type of the parent playlist to folder
|
||||||
@ -183,12 +184,19 @@ process_nested_playlist(int parent_id, const char *path)
|
|||||||
|
|
||||||
free_pli(pli, 0);
|
free_pli(pli, 0);
|
||||||
|
|
||||||
|
deref = realpath(path, NULL);
|
||||||
|
if (!deref)
|
||||||
|
{
|
||||||
|
DPRINTF(E_LOG, L_SCAN, "Could not dereference path '%s'\n", path);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
// Do we already have the playlist in the database?
|
// Do we already have the playlist in the database?
|
||||||
pli = db_pl_fetch_bypath(path);
|
pli = db_pl_fetch_bypath(deref);
|
||||||
if (!pli)
|
if (!pli)
|
||||||
{
|
{
|
||||||
pli = calloc(1, sizeof(struct playlist_info));
|
pli = calloc(1, sizeof(struct playlist_info));
|
||||||
ret = playlist_fill(pli, path);
|
ret = playlist_fill(pli, deref);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
@ -207,12 +215,14 @@ process_nested_playlist(int parent_id, const char *path)
|
|||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
free_pli(pli, 0);
|
free_pli(pli, 0);
|
||||||
|
free(deref);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
DPRINTF(E_LOG, L_SCAN, "Error processing nested playlist '%s' in playlist %d\n", path, parent_id);
|
DPRINTF(E_LOG, L_SCAN, "Error processing nested playlist '%s' in playlist %d\n", path, parent_id);
|
||||||
free_pli(pli, 0);
|
free_pli(pli, 0);
|
||||||
|
free(deref);
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -467,10 +477,10 @@ scan_playlist(const char *file, time_t mtime, int dir_id)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// URLs and playlists will be added to library, tracks should already be there
|
// URLs and playlists will be added to library, tracks should already be there
|
||||||
if (playlist_type(path) != PLAYLIST_UNKNOWN)
|
if (strncasecmp(path, "http://", 7) == 0 || strncasecmp(path, "https://", 8) == 0)
|
||||||
ret = process_nested_playlist(pl_id, path);
|
|
||||||
else if (strncasecmp(path, "http://", 7) == 0 || strncasecmp(path, "https://", 8) == 0)
|
|
||||||
ret = process_url(pl_id, path, &mfi);
|
ret = process_url(pl_id, path, &mfi);
|
||||||
|
else if (playlist_type(path) != PLAYLIST_UNKNOWN)
|
||||||
|
ret = process_nested_playlist(pl_id, path);
|
||||||
else
|
else
|
||||||
ret = process_regular_file(pl_id, path);
|
ret = process_regular_file(pl_id, path);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user