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
7e66f341
Commit
7e66f341
authored
Nov 06, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
playlist_list: added function playlist_list_open_path()
Added an interface for loading playlists from a local file.
parent
f3203b5d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
0 deletions
+47
-0
playlist_list.c
src/playlist_list.c
+36
-0
playlist_list.h
src/playlist_list.h
+11
-0
No files found.
src/playlist_list.c
View file @
7e66f341
...
...
@@ -204,3 +204,39 @@ playlist_list_open_stream(struct input_stream *is, const char *uri)
return
NULL
;
}
static
bool
playlist_suffix_supported
(
const
char
*
suffix
)
{
assert
(
suffix
!=
NULL
);
for
(
unsigned
i
=
0
;
playlist_plugins
[
i
]
!=
NULL
;
++
i
)
{
const
struct
playlist_plugin
*
plugin
=
playlist_plugins
[
i
];
if
(
playlist_plugins_enabled
[
i
]
&&
stringFoundInStringArray
(
plugin
->
suffixes
,
suffix
))
return
true
;
}
return
false
;
}
struct
playlist_provider
*
playlist_list_open_path
(
struct
input_stream
*
is
,
const
char
*
path_fs
)
{
const
char
*
suffix
;
struct
playlist_provider
*
playlist
;
assert
(
path_fs
!=
NULL
);
suffix
=
uri_get_suffix
(
path_fs
);
if
(
suffix
==
NULL
||
!
playlist_suffix_supported
(
suffix
)
||
!
input_stream_open
(
is
,
path_fs
))
return
NULL
;
playlist
=
playlist_list_open_stream_suffix
(
is
,
suffix
);
if
(
playlist
==
NULL
)
input_stream_close
(
is
);
return
playlist
;
}
src/playlist_list.h
View file @
7e66f341
...
...
@@ -51,4 +51,15 @@ playlist_list_open_uri(const char *uri);
struct
playlist_provider
*
playlist_list_open_stream
(
struct
input_stream
*
is
,
const
char
*
uri
);
/**
* Opens a playlist from a local file.
*
* @param is an uninitialized #input_stream object (must be closed
* with input_stream_close() if this function succeeds)
* @param path_fs the path of the playlist file
* @return a playlist, or NULL on error
*/
struct
playlist_provider
*
playlist_list_open_path
(
struct
input_stream
*
is
,
const
char
*
path_fs
);
#endif
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