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
0103219f
Commit
0103219f
authored
Feb 09, 2012
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
playlist_queue: add start/end_index parameters
parent
e15b4f40
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
3 deletions
+21
-3
command.c
src/command.c
+3
-1
playlist_queue.c
src/playlist_queue.c
+14
-2
playlist_queue.h
src/playlist_queue.h
+4
-0
No files found.
src/command.c
View file @
0103219f
...
@@ -800,7 +800,9 @@ handle_load(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
...
@@ -800,7 +800,9 @@ handle_load(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
{
{
enum
playlist_result
result
;
enum
playlist_result
result
;
result
=
playlist_open_into_queue
(
argv
[
1
],
&
g_playlist
,
result
=
playlist_open_into_queue
(
argv
[
1
],
0
,
G_MAXUINT
,
&
g_playlist
,
client
->
player_control
,
true
);
client
->
player_control
,
true
);
if
(
result
!=
PLAYLIST_RESULT_NO_SUCH_LIST
)
if
(
result
!=
PLAYLIST_RESULT_NO_SUCH_LIST
)
return
print_playlist_result
(
client
,
result
);
return
print_playlist_result
(
client
,
result
);
...
...
src/playlist_queue.c
View file @
0103219f
...
@@ -28,6 +28,7 @@
...
@@ -28,6 +28,7 @@
enum
playlist_result
enum
playlist_result
playlist_load_into_queue
(
const
char
*
uri
,
struct
playlist_provider
*
source
,
playlist_load_into_queue
(
const
char
*
uri
,
struct
playlist_provider
*
source
,
unsigned
start_index
,
unsigned
end_index
,
struct
playlist
*
dest
,
struct
player_control
*
pc
,
struct
playlist
*
dest
,
struct
player_control
*
pc
,
bool
secure
)
bool
secure
)
{
{
...
@@ -35,7 +36,16 @@ playlist_load_into_queue(const char *uri, struct playlist_provider *source,
...
@@ -35,7 +36,16 @@ playlist_load_into_queue(const char *uri, struct playlist_provider *source,
struct
song
*
song
;
struct
song
*
song
;
char
*
base_uri
=
uri
!=
NULL
?
g_path_get_dirname
(
uri
)
:
NULL
;
char
*
base_uri
=
uri
!=
NULL
?
g_path_get_dirname
(
uri
)
:
NULL
;
while
((
song
=
playlist_plugin_read
(
source
))
!=
NULL
)
{
for
(
unsigned
i
=
0
;
i
<
end_index
&&
(
song
=
playlist_plugin_read
(
source
))
!=
NULL
;
++
i
)
{
if
(
i
<
start_index
)
{
/* skip songs before the start index */
if
(
!
song_in_database
(
song
))
song_free
(
song
);
continue
;
}
song
=
playlist_check_translate_song
(
song
,
base_uri
,
secure
);
song
=
playlist_check_translate_song
(
song
,
base_uri
,
secure
);
if
(
song
==
NULL
)
if
(
song
==
NULL
)
continue
;
continue
;
...
@@ -56,6 +66,7 @@ playlist_load_into_queue(const char *uri, struct playlist_provider *source,
...
@@ -56,6 +66,7 @@ playlist_load_into_queue(const char *uri, struct playlist_provider *source,
enum
playlist_result
enum
playlist_result
playlist_open_into_queue
(
const
char
*
uri
,
playlist_open_into_queue
(
const
char
*
uri
,
unsigned
start_index
,
unsigned
end_index
,
struct
playlist
*
dest
,
struct
player_control
*
pc
,
struct
playlist
*
dest
,
struct
player_control
*
pc
,
bool
secure
)
bool
secure
)
{
{
...
@@ -72,7 +83,8 @@ playlist_open_into_queue(const char *uri,
...
@@ -72,7 +83,8 @@ playlist_open_into_queue(const char *uri,
}
}
enum
playlist_result
result
=
enum
playlist_result
result
=
playlist_load_into_queue
(
uri
,
playlist
,
dest
,
pc
,
secure
);
playlist_load_into_queue
(
uri
,
playlist
,
start_index
,
end_index
,
dest
,
pc
,
secure
);
playlist_plugin_close
(
playlist
);
playlist_plugin_close
(
playlist
);
if
(
is
!=
NULL
)
if
(
is
!=
NULL
)
...
...
src/playlist_queue.h
View file @
0103219f
...
@@ -38,9 +38,12 @@ struct player_control;
...
@@ -38,9 +38,12 @@ struct player_control;
*
*
* @param uri the URI of the playlist, used to resolve relative song
* @param uri the URI of the playlist, used to resolve relative song
* URIs
* URIs
* @param start_index the index of the first song
* @param end_index the index of the last song (excluding)
*/
*/
enum
playlist_result
enum
playlist_result
playlist_load_into_queue
(
const
char
*
uri
,
struct
playlist_provider
*
source
,
playlist_load_into_queue
(
const
char
*
uri
,
struct
playlist_provider
*
source
,
unsigned
start_index
,
unsigned
end_index
,
struct
playlist
*
dest
,
struct
player_control
*
pc
,
struct
playlist
*
dest
,
struct
player_control
*
pc
,
bool
secure
);
bool
secure
);
...
@@ -50,6 +53,7 @@ playlist_load_into_queue(const char *uri, struct playlist_provider *source,
...
@@ -50,6 +53,7 @@ playlist_load_into_queue(const char *uri, struct playlist_provider *source,
*/
*/
enum
playlist_result
enum
playlist_result
playlist_open_into_queue
(
const
char
*
uri
,
playlist_open_into_queue
(
const
char
*
uri
,
unsigned
start_index
,
unsigned
end_index
,
struct
playlist
*
dest
,
struct
player_control
*
pc
,
struct
playlist
*
dest
,
struct
player_control
*
pc
,
bool
secure
);
bool
secure
);
...
...
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