Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
297e2747
Commit
297e2747
authored
Feb 07, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PlaylistMapper: use class Storage instead of Mapper.cxx
parent
77de2331
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
63 additions
and
11 deletions
+63
-11
SongLoader.hxx
src/SongLoader.hxx
+6
-0
PlaylistAny.cxx
src/playlist/PlaylistAny.cxx
+10
-2
PlaylistAny.hxx
src/playlist/PlaylistAny.hxx
+6
-1
PlaylistMapper.cxx
src/playlist/PlaylistMapper.cxx
+18
-5
PlaylistMapper.hxx
src/playlist/PlaylistMapper.hxx
+8
-1
PlaylistQueue.cxx
src/playlist/PlaylistQueue.cxx
+9
-1
Print.cxx
src/playlist/Print.cxx
+6
-1
No files found.
src/SongLoader.hxx
View file @
297e2747
...
...
@@ -60,6 +60,12 @@ public:
:
client
(
nullptr
)
{}
#endif
#ifdef ENABLE_DATABASE
const
Storage
*
GetStorage
()
const
{
return
storage
;
}
#endif
gcc_nonnull_all
DetachedSong
*
LoadSong
(
const
char
*
uri_utf8
,
Error
&
error
)
const
;
...
...
src/playlist/PlaylistAny.cxx
View file @
297e2747
...
...
@@ -24,9 +24,17 @@
#include "util/UriUtil.hxx"
SongEnumerator
*
playlist_open_any
(
const
char
*
uri
,
Mutex
&
mutex
,
Cond
&
cond
)
playlist_open_any
(
const
char
*
uri
,
#ifdef ENABLE_DATABASE
const
Storage
*
storage
,
#endif
Mutex
&
mutex
,
Cond
&
cond
)
{
return
uri_has_scheme
(
uri
)
?
playlist_open_remote
(
uri
,
mutex
,
cond
)
:
playlist_mapper_open
(
uri
,
mutex
,
cond
);
:
playlist_mapper_open
(
uri
,
#ifdef ENABLE_DATABASE
storage
,
#endif
mutex
,
cond
);
}
src/playlist/PlaylistAny.hxx
View file @
297e2747
...
...
@@ -23,6 +23,7 @@
class
Mutex
;
class
Cond
;
class
SongEnumerator
;
class
Storage
;
/**
* Opens a playlist from the specified URI, which can be either an
...
...
@@ -30,6 +31,10 @@ class SongEnumerator;
* music orplaylist directory.
*/
SongEnumerator
*
playlist_open_any
(
const
char
*
uri
,
Mutex
&
mutex
,
Cond
&
cond
);
playlist_open_any
(
const
char
*
uri
,
#ifdef ENABLE_DATABASE
const
Storage
*
storage
,
#endif
Mutex
&
mutex
,
Cond
&
cond
);
#endif
src/playlist/PlaylistMapper.cxx
View file @
297e2747
...
...
@@ -24,6 +24,7 @@
#include "PlaylistRegistry.hxx"
#include "Mapper.hxx"
#include "fs/AllocatedPath.hxx"
#include "storage/StorageInterface.hxx"
#include "util/UriUtil.hxx"
#include <assert.h>
...
...
@@ -57,21 +58,32 @@ playlist_open_in_playlist_dir(const char *uri, Mutex &mutex, Cond &cond)
* Load a playlist from the configured music directory.
*/
static
SongEnumerator
*
playlist_open_in_music_dir
(
const
char
*
uri
,
Mutex
&
mutex
,
Cond
&
cond
)
playlist_open_in_storage
(
const
char
*
uri
,
const
Storage
*
storage
,
Mutex
&
mutex
,
Cond
&
cond
)
{
assert
(
uri_safe_local
(
uri
));
const
auto
path
=
map_uri_fs
(
uri
);
if
(
path
.
IsNull
())
if
(
storage
==
nullptr
)
return
nullptr
;
{
const
auto
path
=
storage
->
MapFS
(
uri
);
if
(
!
path
.
IsNull
())
return
playlist_open_path
(
path
.
c_str
(),
mutex
,
cond
);
}
const
auto
uri2
=
storage
->
MapUTF8
(
uri
);
return
playlist_open_remote
(
uri
,
mutex
,
cond
);
}
#endif
SongEnumerator
*
playlist_mapper_open
(
const
char
*
uri
,
Mutex
&
mutex
,
Cond
&
cond
)
playlist_mapper_open
(
const
char
*
uri
,
#ifdef ENABLE_DATABASE
const
Storage
*
storage
,
#endif
Mutex
&
mutex
,
Cond
&
cond
)
{
if
(
spl_valid_name
(
uri
))
{
auto
playlist
=
playlist_open_in_playlist_dir
(
uri
,
...
...
@@ -82,7 +94,8 @@ playlist_mapper_open(const char *uri, Mutex &mutex, Cond &cond)
#ifdef ENABLE_DATABASE
if
(
uri_safe_local
(
uri
))
{
auto
playlist
=
playlist_open_in_music_dir
(
uri
,
mutex
,
cond
);
auto
playlist
=
playlist_open_in_storage
(
uri
,
storage
,
mutex
,
cond
);
if
(
playlist
!=
nullptr
)
return
playlist
;
}
...
...
src/playlist/PlaylistMapper.hxx
View file @
297e2747
...
...
@@ -20,15 +20,22 @@
#ifndef MPD_PLAYLIST_MAPPER_HXX
#define MPD_PLAYLIST_MAPPER_HXX
#include "check.h"
class
Mutex
;
class
Cond
;
class
SongEnumerator
;
class
Storage
;
/**
* Opens a playlist from an URI relative to the playlist or music
* directory.
*/
SongEnumerator
*
playlist_mapper_open
(
const
char
*
uri
,
Mutex
&
mutex
,
Cond
&
cond
);
playlist_mapper_open
(
const
char
*
uri
,
#ifdef ENABLE_DATABASE
const
Storage
*
storage
,
#endif
Mutex
&
mutex
,
Cond
&
cond
);
#endif
src/playlist/PlaylistQueue.cxx
View file @
297e2747
...
...
@@ -28,6 +28,10 @@
#include "thread/Cond.hxx"
#include "fs/Traits.hxx"
#ifdef ENABLE_DATABASE
#include "SongLoader.hxx"
#endif
PlaylistResult
playlist_load_into_queue
(
const
char
*
uri
,
SongEnumerator
&
e
,
unsigned
start_index
,
unsigned
end_index
,
...
...
@@ -72,7 +76,11 @@ playlist_open_into_queue(const char *uri,
Mutex
mutex
;
Cond
cond
;
auto
playlist
=
playlist_open_any
(
uri
,
mutex
,
cond
);
auto
playlist
=
playlist_open_any
(
uri
,
#ifdef ENABLE_DATABASE
loader
.
GetStorage
(),
#endif
mutex
,
cond
);
if
(
playlist
==
nullptr
)
return
PlaylistResult
::
NO_SUCH_LIST
;
...
...
src/playlist/Print.cxx
View file @
297e2747
...
...
@@ -28,6 +28,7 @@
#include "fs/Traits.hxx"
#include "thread/Mutex.hxx"
#include "thread/Cond.hxx"
#include "client/Client.hxx"
static
void
playlist_provider_print
(
Client
&
client
,
const
char
*
uri
,
...
...
@@ -59,7 +60,11 @@ playlist_file_print(Client &client, const char *uri, bool detail)
Mutex
mutex
;
Cond
cond
;
SongEnumerator
*
playlist
=
playlist_open_any
(
uri
,
mutex
,
cond
);
SongEnumerator
*
playlist
=
playlist_open_any
(
uri
,
#ifdef ENABLE_DATABASE
client
.
GetStorage
(),
#endif
mutex
,
cond
);
if
(
playlist
==
nullptr
)
return
false
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment