2023-03-06 14:42:04 +01:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
// Copyright The Music Player Daemon Project
|
2010-06-25 21:45:04 +02:00
|
|
|
|
2019-02-13 21:55:15 +01:00
|
|
|
#include "LocateUri.hxx"
|
2013-01-02 18:38:32 +01:00
|
|
|
#include "PlaylistAny.hxx"
|
2014-02-07 21:29:31 +01:00
|
|
|
#include "PlaylistStream.hxx"
|
2013-01-02 18:38:32 +01:00
|
|
|
#include "PlaylistMapper.hxx"
|
2018-01-20 19:56:44 +01:00
|
|
|
#include "SongEnumerator.hxx"
|
2018-11-19 12:49:45 +01:00
|
|
|
#include "config.h"
|
2010-06-25 21:45:04 +02:00
|
|
|
|
2018-01-20 19:56:44 +01:00
|
|
|
std::unique_ptr<SongEnumerator>
|
2019-02-13 21:55:15 +01:00
|
|
|
playlist_open_any(const LocatedUri &located_uri,
|
2014-02-07 20:22:26 +01:00
|
|
|
#ifdef ENABLE_DATABASE
|
|
|
|
const Storage *storage,
|
|
|
|
#endif
|
2018-06-22 19:37:18 +02:00
|
|
|
Mutex &mutex)
|
2010-06-25 21:45:04 +02:00
|
|
|
{
|
2019-02-13 21:55:15 +01:00
|
|
|
switch (located_uri.type) {
|
|
|
|
case LocatedUri::Type::ABSOLUTE:
|
|
|
|
return playlist_open_remote(located_uri.canonical_uri, mutex);
|
|
|
|
|
|
|
|
case LocatedUri::Type::PATH:
|
|
|
|
return playlist_open_path(located_uri.path, mutex);
|
|
|
|
|
|
|
|
case LocatedUri::Type::RELATIVE:
|
|
|
|
return playlist_mapper_open(located_uri.canonical_uri,
|
2014-02-07 20:22:26 +01:00
|
|
|
#ifdef ENABLE_DATABASE
|
|
|
|
storage,
|
|
|
|
#endif
|
2018-06-22 19:37:18 +02:00
|
|
|
mutex);
|
2019-02-13 21:55:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
gcc_unreachable();
|
2010-06-25 21:45:04 +02:00
|
|
|
}
|