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
52638c68
Commit
52638c68
authored
Jan 07, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Playlist: convert functions to methods
parent
400ff1c8
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
406 additions
and
403 deletions
+406
-403
Makefile.am
Makefile.am
+0
-1
DatabaseQueue.cxx
src/DatabaseQueue.cxx
+1
-2
Partition.hxx
src/Partition.hxx
+122
-0
PlayerCommands.cxx
src/PlayerCommands.cxx
+26
-35
Playlist.cxx
src/Playlist.cxx
+0
-0
Playlist.hxx
src/Playlist.hxx
+128
-119
PlaylistControl.cxx
src/PlaylistControl.cxx
+86
-107
PlaylistEdit.cxx
src/PlaylistEdit.cxx
+0
-0
PlaylistGlobal.cxx
src/PlaylistGlobal.cxx
+2
-3
PlaylistInternal.hxx
src/PlaylistInternal.hxx
+0
-56
PlaylistPrint.cxx
src/PlaylistPrint.cxx
+1
-2
PlaylistQueue.cxx
src/PlaylistQueue.cxx
+1
-1
PlaylistSave.cxx
src/PlaylistSave.cxx
+4
-4
PlaylistState.cxx
src/PlaylistState.cxx
+11
-21
QueueCommands.cxx
src/QueueCommands.cxx
+23
-49
UpdateRemove.cxx
src/UpdateRemove.cxx
+1
-3
No files found.
Makefile.am
View file @
52638c68
...
@@ -113,7 +113,6 @@ mpd_headers = \
...
@@ -113,7 +113,6 @@ mpd_headers = \
src/page.h
\
src/page.h
\
src/Playlist.hxx
\
src/Playlist.hxx
\
src/playlist_error.h
\
src/playlist_error.h
\
src/PlaylistInternal.hxx
\
src/playlist_plugin.h
\
src/playlist_plugin.h
\
src/playlist_list.h
\
src/playlist_list.h
\
src/playlist/extm3u_playlist_plugin.h
\
src/playlist/extm3u_playlist_plugin.h
\
...
...
src/DatabaseQueue.cxx
View file @
52638c68
...
@@ -30,8 +30,7 @@ static bool
...
@@ -30,8 +30,7 @@ static bool
AddToQueue
(
Partition
&
partition
,
song
&
song
,
GError
**
error_r
)
AddToQueue
(
Partition
&
partition
,
song
&
song
,
GError
**
error_r
)
{
{
enum
playlist_result
result
=
enum
playlist_result
result
=
playlist_append_song
(
&
partition
.
playlist
,
&
partition
.
pc
,
partition
.
playlist
.
AppendSong
(
partition
.
pc
,
&
song
,
NULL
);
&
song
,
NULL
);
if
(
result
!=
PLAYLIST_RESULT_SUCCESS
)
{
if
(
result
!=
PLAYLIST_RESULT_SUCCESS
)
{
g_set_error
(
error_r
,
playlist_quark
(),
result
,
g_set_error
(
error_r
,
playlist_quark
(),
result
,
"Playlist error"
);
"Playlist error"
);
...
...
src/Partition.hxx
View file @
52638c68
...
@@ -38,6 +38,128 @@ struct Partition {
...
@@ -38,6 +38,128 @@ struct Partition {
:
playlist
(
max_length
),
:
playlist
(
max_length
),
pc
(
buffer_chunks
,
buffered_before_play
)
{
pc
(
buffer_chunks
,
buffered_before_play
)
{
}
}
void
ClearQueue
()
{
playlist
.
Clear
(
pc
);
}
enum
playlist_result
AppendFile
(
const
char
*
path_fs
,
unsigned
*
added_id
=
nullptr
)
{
return
playlist
.
AppendFile
(
pc
,
path_fs
,
added_id
);
}
enum
playlist_result
AppendURI
(
const
char
*
uri_utf8
,
unsigned
*
added_id
=
nullptr
)
{
return
playlist
.
AppendURI
(
pc
,
uri_utf8
,
added_id
);
}
enum
playlist_result
DeletePosition
(
unsigned
position
)
{
return
playlist
.
DeletePosition
(
pc
,
position
);
}
enum
playlist_result
DeleteId
(
unsigned
id
)
{
return
playlist
.
DeleteId
(
pc
,
id
);
}
/**
* Deletes a range of songs from the playlist.
*
* @param start the position of the first song to delete
* @param end the position after the last song to delete
*/
enum
playlist_result
DeleteRange
(
unsigned
start
,
unsigned
end
)
{
return
playlist
.
DeleteRange
(
pc
,
start
,
end
);
}
void
DeleteSong
(
const
song
&
song
)
{
playlist
.
DeleteSong
(
pc
,
song
);
}
void
Shuffle
(
unsigned
start
,
unsigned
end
)
{
playlist
.
Shuffle
(
pc
,
start
,
end
);
}
enum
playlist_result
MoveRange
(
unsigned
start
,
unsigned
end
,
int
to
)
{
return
playlist
.
MoveRange
(
pc
,
start
,
end
,
to
);
}
enum
playlist_result
MoveId
(
unsigned
id
,
int
to
)
{
return
playlist
.
MoveId
(
pc
,
id
,
to
);
}
enum
playlist_result
SwapPositions
(
unsigned
song1
,
unsigned
song2
)
{
return
playlist
.
SwapPositions
(
pc
,
song1
,
song2
);
}
enum
playlist_result
SwapIds
(
unsigned
id1
,
unsigned
id2
)
{
return
playlist
.
SwapIds
(
pc
,
id1
,
id2
);
}
enum
playlist_result
SetPriorityRange
(
unsigned
start_position
,
unsigned
end_position
,
uint8_t
priority
)
{
return
playlist
.
SetPriorityRange
(
pc
,
start_position
,
end_position
,
priority
);
}
enum
playlist_result
SetPriorityId
(
unsigned
song_id
,
uint8_t
priority
)
{
return
playlist
.
SetPriorityId
(
pc
,
song_id
,
priority
);
}
void
Stop
()
{
playlist
.
Stop
(
pc
);
}
enum
playlist_result
PlayPosition
(
int
position
)
{
return
playlist
.
PlayPosition
(
pc
,
position
);
}
enum
playlist_result
PlayId
(
int
id
)
{
return
playlist
.
PlayId
(
pc
,
id
);
}
void
PlayNext
()
{
return
playlist
.
PlayNext
(
pc
);
}
void
PlayPrevious
()
{
return
playlist
.
PlayPrevious
(
pc
);
}
enum
playlist_result
SeekSongPosition
(
unsigned
song_position
,
float
seek_time
)
{
return
playlist
.
SeekSongPosition
(
pc
,
song_position
,
seek_time
);
}
enum
playlist_result
SeekSongId
(
unsigned
song_id
,
float
seek_time
)
{
return
playlist
.
SeekSongId
(
pc
,
song_id
,
seek_time
);
}
enum
playlist_result
SeekCurrent
(
float
seek_time
,
bool
relative
)
{
return
playlist
.
SeekCurrent
(
pc
,
seek_time
,
relative
);
}
void
SetRepeat
(
bool
new_value
)
{
playlist
.
SetRepeat
(
pc
,
new_value
);
}
bool
GetRandom
()
const
{
return
playlist
.
GetRandom
();
}
void
SetRandom
(
bool
new_value
)
{
playlist
.
SetRandom
(
pc
,
new_value
);
}
void
SetSingle
(
bool
new_value
)
{
playlist
.
SetSingle
(
pc
,
new_value
);
}
void
SetConsume
(
bool
new_value
)
{
playlist
.
SetConsume
(
new_value
);
}
};
};
#endif
#endif
src/PlayerCommands.cxx
View file @
52638c68
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
#include "ClientInternal.hxx"
#include "ClientInternal.hxx"
#include "Volume.hxx"
#include "Volume.hxx"
#include "OutputAll.hxx"
#include "OutputAll.hxx"
#include "Partition.hxx"
#include "protocol/Result.hxx"
#include "protocol/Result.hxx"
#include "protocol/ArgParser.hxx"
#include "protocol/ArgParser.hxx"
...
@@ -34,7 +35,6 @@ extern "C" {
...
@@ -34,7 +35,6 @@ extern "C" {
}
}
#include "replay_gain_config.h"
#include "replay_gain_config.h"
#include "PlayerControl.hxx"
#include <errno.h>
#include <errno.h>
...
@@ -62,12 +62,10 @@ enum command_return
...
@@ -62,12 +62,10 @@ enum command_return
handle_play
(
Client
*
client
,
int
argc
,
char
*
argv
[])
handle_play
(
Client
*
client
,
int
argc
,
char
*
argv
[])
{
{
int
song
=
-
1
;
int
song
=
-
1
;
enum
playlist_result
result
;
if
(
argc
==
2
&&
!
check_int
(
client
,
&
song
,
argv
[
1
]))
if
(
argc
==
2
&&
!
check_int
(
client
,
&
song
,
argv
[
1
]))
return
COMMAND_RETURN_ERROR
;
return
COMMAND_RETURN_ERROR
;
result
=
playlist_play
(
&
client
->
playlist
,
client
->
player_control
,
enum
playlist_result
result
=
client
->
partition
.
PlayPosition
(
song
);
song
);
return
print_playlist_result
(
client
,
result
);
return
print_playlist_result
(
client
,
result
);
}
}
...
@@ -75,13 +73,11 @@ enum command_return
...
@@ -75,13 +73,11 @@ enum command_return
handle_playid
(
Client
*
client
,
int
argc
,
char
*
argv
[])
handle_playid
(
Client
*
client
,
int
argc
,
char
*
argv
[])
{
{
int
id
=
-
1
;
int
id
=
-
1
;
enum
playlist_result
result
;
if
(
argc
==
2
&&
!
check_int
(
client
,
&
id
,
argv
[
1
]))
if
(
argc
==
2
&&
!
check_int
(
client
,
&
id
,
argv
[
1
]))
return
COMMAND_RETURN_ERROR
;
return
COMMAND_RETURN_ERROR
;
result
=
playlist_play_id
(
&
client
->
playlist
,
client
->
player_control
,
enum
playlist_result
result
=
client
->
partition
.
PlayId
(
id
);
id
);
return
print_playlist_result
(
client
,
result
);
return
print_playlist_result
(
client
,
result
);
}
}
...
@@ -89,7 +85,7 @@ enum command_return
...
@@ -89,7 +85,7 @@ enum command_return
handle_stop
(
Client
*
client
,
handle_stop
(
Client
*
client
,
G_GNUC_UNUSED
int
argc
,
G_GNUC_UNUSED
char
*
argv
[])
G_GNUC_UNUSED
int
argc
,
G_GNUC_UNUSED
char
*
argv
[])
{
{
playlist_stop
(
&
client
->
playlist
,
client
->
player_control
);
client
->
partition
.
Stop
(
);
return
COMMAND_RETURN_OK
;
return
COMMAND_RETURN_OK
;
}
}
...
@@ -155,23 +151,23 @@ handle_status(Client *client,
...
@@ -155,23 +151,23 @@ handle_status(Client *client,
COMMAND_STATUS_MIXRAMPDELAY
": %f
\n
"
COMMAND_STATUS_MIXRAMPDELAY
": %f
\n
"
COMMAND_STATUS_STATE
": %s
\n
"
,
COMMAND_STATUS_STATE
": %s
\n
"
,
volume_level_get
(),
volume_level_get
(),
playlist
_get_repeat
(
&
playlist
),
playlist
.
GetRepeat
(
),
playlist
_get_random
(
&
playlist
),
playlist
.
GetRandom
(
),
playlist
_get_single
(
&
playlist
),
playlist
.
GetSingle
(
),
playlist
_get_consume
(
&
playlist
),
playlist
.
GetConsume
(
),
playlist_get_version
(
&
playlist
),
(
unsigned
long
)
playlist
.
GetVersion
(
),
playlist
_get_length
(
&
playlist
),
playlist
.
GetLength
(
),
(
int
)(
pc_get_cross_fade
(
client
->
player_control
)
+
0.5
),
(
int
)(
pc_get_cross_fade
(
client
->
player_control
)
+
0.5
),
pc_get_mixramp_db
(
client
->
player_control
),
pc_get_mixramp_db
(
client
->
player_control
),
pc_get_mixramp_delay
(
client
->
player_control
),
pc_get_mixramp_delay
(
client
->
player_control
),
state
);
state
);
song
=
playlist
_get_current_song
(
&
playlist
);
song
=
playlist
.
GetCurrentPosition
(
);
if
(
song
>=
0
)
{
if
(
song
>=
0
)
{
client_printf
(
client
,
client_printf
(
client
,
COMMAND_STATUS_SONG
": %i
\n
"
COMMAND_STATUS_SONG
": %i
\n
"
COMMAND_STATUS_SONGID
": %u
\n
"
,
COMMAND_STATUS_SONGID
": %u
\n
"
,
song
,
playlist
_get_song_id
(
&
playlist
,
song
));
song
,
playlist
.
PositionToId
(
song
));
}
}
if
(
player_status
.
state
!=
PLAYER_STATE_STOP
)
{
if
(
player_status
.
state
!=
PLAYER_STATE_STOP
)
{
...
@@ -204,12 +200,12 @@ handle_status(Client *client,
...
@@ -204,12 +200,12 @@ handle_status(Client *client,
g_free
(
error
);
g_free
(
error
);
}
}
song
=
playlist
_get_next_song
(
&
playlist
);
song
=
playlist
.
GetNextPosition
(
);
if
(
song
>=
0
)
{
if
(
song
>=
0
)
{
client_printf
(
client
,
client_printf
(
client
,
COMMAND_STATUS_NEXTSONG
": %i
\n
"
COMMAND_STATUS_NEXTSONG
": %i
\n
"
COMMAND_STATUS_NEXTSONGID
": %u
\n
"
,
COMMAND_STATUS_NEXTSONGID
": %u
\n
"
,
song
,
playlist
_get_song_id
(
&
playlist
,
song
));
song
,
playlist
.
PositionToId
(
song
));
}
}
return
COMMAND_RETURN_OK
;
return
COMMAND_RETURN_OK
;
...
@@ -226,7 +222,7 @@ handle_next(Client *client,
...
@@ -226,7 +222,7 @@ handle_next(Client *client,
const
bool
single
=
playlist
.
queue
.
single
;
const
bool
single
=
playlist
.
queue
.
single
;
playlist
.
queue
.
single
=
false
;
playlist
.
queue
.
single
=
false
;
playlist_next
(
&
playlist
,
client
->
player_control
);
client
->
partition
.
PlayNext
(
);
playlist
.
queue
.
single
=
single
;
playlist
.
queue
.
single
=
single
;
return
COMMAND_RETURN_OK
;
return
COMMAND_RETURN_OK
;
...
@@ -236,7 +232,7 @@ enum command_return
...
@@ -236,7 +232,7 @@ enum command_return
handle_previous
(
Client
*
client
,
handle_previous
(
Client
*
client
,
G_GNUC_UNUSED
int
argc
,
G_GNUC_UNUSED
char
*
argv
[])
G_GNUC_UNUSED
int
argc
,
G_GNUC_UNUSED
char
*
argv
[])
{
{
playlist_previous
(
&
client
->
playlist
,
client
->
player_control
);
client
->
partition
.
PlayPrevious
(
);
return
COMMAND_RETURN_OK
;
return
COMMAND_RETURN_OK
;
}
}
...
@@ -247,7 +243,7 @@ handle_repeat(Client *client, G_GNUC_UNUSED int argc, char *argv[])
...
@@ -247,7 +243,7 @@ handle_repeat(Client *client, G_GNUC_UNUSED int argc, char *argv[])
if
(
!
check_bool
(
client
,
&
status
,
argv
[
1
]))
if
(
!
check_bool
(
client
,
&
status
,
argv
[
1
]))
return
COMMAND_RETURN_ERROR
;
return
COMMAND_RETURN_ERROR
;
playlist_set_repeat
(
&
client
->
playlist
,
client
->
player_control
,
status
);
client
->
partition
.
SetRepeat
(
status
);
return
COMMAND_RETURN_OK
;
return
COMMAND_RETURN_OK
;
}
}
...
@@ -258,7 +254,7 @@ handle_single(Client *client, G_GNUC_UNUSED int argc, char *argv[])
...
@@ -258,7 +254,7 @@ handle_single(Client *client, G_GNUC_UNUSED int argc, char *argv[])
if
(
!
check_bool
(
client
,
&
status
,
argv
[
1
]))
if
(
!
check_bool
(
client
,
&
status
,
argv
[
1
]))
return
COMMAND_RETURN_ERROR
;
return
COMMAND_RETURN_ERROR
;
playlist_set_single
(
&
client
->
playlist
,
client
->
player_control
,
status
);
client
->
partition
.
SetSingle
(
status
);
return
COMMAND_RETURN_OK
;
return
COMMAND_RETURN_OK
;
}
}
...
@@ -269,7 +265,7 @@ handle_consume(Client *client, G_GNUC_UNUSED int argc, char *argv[])
...
@@ -269,7 +265,7 @@ handle_consume(Client *client, G_GNUC_UNUSED int argc, char *argv[])
if
(
!
check_bool
(
client
,
&
status
,
argv
[
1
]))
if
(
!
check_bool
(
client
,
&
status
,
argv
[
1
]))
return
COMMAND_RETURN_ERROR
;
return
COMMAND_RETURN_ERROR
;
playlist_set_consume
(
&
client
->
playlist
,
status
);
client
->
partition
.
SetConsume
(
status
);
return
COMMAND_RETURN_OK
;
return
COMMAND_RETURN_OK
;
}
}
...
@@ -280,8 +276,8 @@ handle_random(Client *client, G_GNUC_UNUSED int argc, char *argv[])
...
@@ -280,8 +276,8 @@ handle_random(Client *client, G_GNUC_UNUSED int argc, char *argv[])
if
(
!
check_bool
(
client
,
&
status
,
argv
[
1
]))
if
(
!
check_bool
(
client
,
&
status
,
argv
[
1
]))
return
COMMAND_RETURN_ERROR
;
return
COMMAND_RETURN_ERROR
;
playlist_set_random
(
&
client
->
playlist
,
client
->
player_control
,
status
);
client
->
partition
.
SetRandom
(
status
);
audio_output_all_set_replay_gain_mode
(
replay_gain_get_real_mode
(
client
->
p
laylist
.
queue
.
random
));
audio_output_all_set_replay_gain_mode
(
replay_gain_get_real_mode
(
client
->
p
artition
.
GetRandom
()
));
return
COMMAND_RETURN_OK
;
return
COMMAND_RETURN_OK
;
}
}
...
@@ -297,15 +293,14 @@ enum command_return
...
@@ -297,15 +293,14 @@ enum command_return
handle_seek
(
Client
*
client
,
G_GNUC_UNUSED
int
argc
,
char
*
argv
[])
handle_seek
(
Client
*
client
,
G_GNUC_UNUSED
int
argc
,
char
*
argv
[])
{
{
unsigned
song
,
seek_time
;
unsigned
song
,
seek_time
;
enum
playlist_result
result
;
if
(
!
check_unsigned
(
client
,
&
song
,
argv
[
1
]))
if
(
!
check_unsigned
(
client
,
&
song
,
argv
[
1
]))
return
COMMAND_RETURN_ERROR
;
return
COMMAND_RETURN_ERROR
;
if
(
!
check_unsigned
(
client
,
&
seek_time
,
argv
[
2
]))
if
(
!
check_unsigned
(
client
,
&
seek_time
,
argv
[
2
]))
return
COMMAND_RETURN_ERROR
;
return
COMMAND_RETURN_ERROR
;
result
=
playlist_seek_song
(
&
client
->
playlist
,
client
->
player_control
,
enum
playlist_result
result
=
song
,
seek_time
);
client
->
partition
.
SeekSongPosition
(
song
,
seek_time
);
return
print_playlist_result
(
client
,
result
);
return
print_playlist_result
(
client
,
result
);
}
}
...
@@ -313,16 +308,14 @@ enum command_return
...
@@ -313,16 +308,14 @@ enum command_return
handle_seekid
(
Client
*
client
,
G_GNUC_UNUSED
int
argc
,
char
*
argv
[])
handle_seekid
(
Client
*
client
,
G_GNUC_UNUSED
int
argc
,
char
*
argv
[])
{
{
unsigned
id
,
seek_time
;
unsigned
id
,
seek_time
;
enum
playlist_result
result
;
if
(
!
check_unsigned
(
client
,
&
id
,
argv
[
1
]))
if
(
!
check_unsigned
(
client
,
&
id
,
argv
[
1
]))
return
COMMAND_RETURN_ERROR
;
return
COMMAND_RETURN_ERROR
;
if
(
!
check_unsigned
(
client
,
&
seek_time
,
argv
[
2
]))
if
(
!
check_unsigned
(
client
,
&
seek_time
,
argv
[
2
]))
return
COMMAND_RETURN_ERROR
;
return
COMMAND_RETURN_ERROR
;
result
=
playlist_seek_song_id
(
&
client
->
playlist
,
enum
playlist_result
result
=
client
->
player_control
,
client
->
partition
.
SeekSongId
(
id
,
seek_time
);
id
,
seek_time
);
return
print_playlist_result
(
client
,
result
);
return
print_playlist_result
(
client
,
result
);
}
}
...
@@ -336,9 +329,7 @@ handle_seekcur(Client *client, G_GNUC_UNUSED int argc, char *argv[])
...
@@ -336,9 +329,7 @@ handle_seekcur(Client *client, G_GNUC_UNUSED int argc, char *argv[])
return
COMMAND_RETURN_ERROR
;
return
COMMAND_RETURN_ERROR
;
enum
playlist_result
result
=
enum
playlist_result
result
=
playlist_seek_current
(
&
client
->
playlist
,
client
->
partition
.
SeekCurrent
(
seek_time
,
relative
);
client
->
player_control
,
seek_time
,
relative
);
return
print_playlist_result
(
client
,
result
);
return
print_playlist_result
(
client
,
result
);
}
}
...
...
src/Playlist.cxx
View file @
52638c68
This diff is collapsed.
Click to expand it.
src/Playlist.hxx
View file @
52638c68
...
@@ -75,165 +75,147 @@ struct playlist {
...
@@ -75,165 +75,147 @@ struct playlist {
~
playlist
()
{
~
playlist
()
{
}
}
};
void
uint32_t
GetVersion
()
const
{
playlist_global_init
();
return
queue
.
version
;
}
void
unsigned
GetLength
()
const
{
playlist_tag_changed
(
struct
playlist
*
playlist
);
return
queue
.
GetLength
();
}
unsigned
PositionToId
(
unsigned
position
)
const
{
return
queue
.
PositionToId
(
position
);
}
gcc_pure
int
GetCurrentPosition
()
const
;
/**
gcc_pure
* Returns the "queue" object of the global playlist instance.
int
GetNextPosition
()
const
;
/**
* Returns the song object which is currently queued. Returns
* none if there is none (yet?) or if MPD isn't playing.
*/
*/
static
inline
const
struct
queue
*
gcc_pure
playlist_get_queue
(
const
struct
playlist
*
playlist
)
const
struct
song
*
GetQueuedSong
()
const
;
{
return
&
playlist
->
queue
;
}
void
/**
playlist_clear
(
struct
playlist
*
playlist
,
struct
player_control
*
pc
);
* This is the "PLAYLIST" event handler. It is invoked by the
* player thread whenever it requests a new queued song, or
* when it exits.
*/
void
SyncWithPlayer
(
player_control
&
pc
);
/**
protected
:
* Appends a local file (outside the music database) to the playlist.
/**
* Called by all editing methods after a modification.
* Updates the queue version and emits #IDLE_PLAYLIST.
*/
void
OnModified
();
/**
* Updates the "queued song". Calculates the next song
* according to the current one (if MPD isn't playing, it
* takes the first song), and queues this song. Clears the
* old queued song if there was one.
*
*
* Note: the caller is responsible for checking permissions.
* @param prev the song which was previously queued, as
* determined by playlist_get_queued_song()
*/
*/
enum
playlist_result
void
UpdateQueuedSong
(
player_control
&
pc
,
const
song
*
prev
);
playlist_append_file
(
struct
playlist
*
playlist
,
struct
player_control
*
pc
,
const
char
*
path_fs
,
unsigned
*
added_id
);
enum
playlist_result
public
:
playlist_append_uri
(
struct
playlist
*
playlist
,
struct
player_control
*
pc
,
void
Clear
(
player_control
&
pc
);
const
char
*
file
,
unsigned
*
added_id
);
enum
playlist_result
void
TagChanged
();
playlist_append_song
(
struct
playlist
*
playlist
,
struct
player_control
*
pc
,
struct
song
*
song
,
unsigned
*
added_id
);
enum
playlist_result
enum
playlist_result
AppendSong
(
player_control
&
pc
,
playlist_delete
(
struct
playlist
*
playlist
,
struct
player_control
*
pc
,
struct
song
*
song
,
unsigned
song
);
unsigned
*
added_id
=
nullptr
);
/**
/**
* Deletes a range of songs from the playlist.
* Appends a local file (outside the music database) to the
* playlist.
*
*
* @param start the position of the first song to delete
* Note: the caller is responsible for checking permissions.
* @param end the position after the last song to delete
*/
*/
enum
playlist_result
enum
playlist_result
AppendFile
(
player_control
&
pc
,
playlist_delete_range
(
struct
playlist
*
playlist
,
struct
player_control
*
pc
,
const
char
*
path_fs
,
unsigned
start
,
unsigned
end
);
unsigned
*
added_id
=
nullptr
);
enum
playlist_result
enum
playlist_result
AppendURI
(
player_control
&
pc
,
playlist_delete_id
(
struct
playlist
*
playlist
,
struct
player_control
*
pc
,
const
char
*
uri_utf8
,
unsigned
song
);
unsigned
*
added_id
=
nullptr
);
void
playlist_stop
(
struct
playlist
*
playlist
,
struct
player_control
*
pc
);
enum
playlist_result
protected
:
playlist_play
(
struct
playlist
*
playlist
,
struct
player_control
*
pc
,
void
DeleteInternal
(
player_control
&
pc
,
int
song
);
unsigned
song
,
const
struct
song
**
queued_p
);
enum
playlist_result
public
:
playlist_play_id
(
struct
playlist
*
playlist
,
struct
player_control
*
pc
,
enum
playlist_result
DeletePosition
(
player_control
&
pc
,
int
song
);
unsigned
position
);
void
enum
playlist_result
DeleteOrder
(
player_control
&
pc
,
playlist_next
(
struct
playlist
*
playlist
,
struct
player_control
*
pc
);
unsigned
order
)
{
return
DeletePosition
(
pc
,
queue
.
OrderToPosition
(
order
));
void
}
playlist_sync
(
struct
playlist
*
playlist
,
struct
player_control
*
pc
);
void
enum
playlist_result
DeleteId
(
player_control
&
pc
,
unsigned
id
);
playlist_previous
(
struct
playlist
*
playlist
,
struct
player_control
*
pc
);
void
/**
playlist_shuffle
(
struct
playlist
*
playlist
,
struct
player_control
*
pc
,
* Deletes a range of songs from the playlist.
*
* @param start the position of the first song to delete
* @param end the position after the last song to delete
*/
enum
playlist_result
DeleteRange
(
player_control
&
pc
,
unsigned
start
,
unsigned
end
);
unsigned
start
,
unsigned
end
);
void
void
DeleteSong
(
player_control
&
pc
,
const
song
&
song
);
playlist_delete_song
(
struct
playlist
*
playlist
,
struct
player_control
*
pc
,
const
struct
song
*
song
);
enum
playlist_result
void
Shuffle
(
player_control
&
pc
,
unsigned
start
,
unsigned
end
);
playlist_move_range
(
struct
playlist
*
playlist
,
struct
player_control
*
pc
,
enum
playlist_result
MoveRange
(
player_control
&
pc
,
unsigned
start
,
unsigned
end
,
int
to
);
unsigned
start
,
unsigned
end
,
int
to
);
enum
playlist_result
enum
playlist_result
MoveId
(
player_control
&
pc
,
unsigned
id
,
int
to
);
playlist_move_id
(
struct
playlist
*
playlist
,
struct
player_control
*
pc
,
unsigned
id
,
int
to
);
enum
playlist_result
enum
playlist_result
SwapPositions
(
player_control
&
pc
,
playlist_swap_songs
(
struct
playlist
*
playlist
,
struct
player_control
*
pc
,
unsigned
song1
,
unsigned
song2
);
unsigned
song1
,
unsigned
song2
);
enum
playlist_result
enum
playlist_result
SwapIds
(
player_control
&
pc
,
playlist_swap_songs_id
(
struct
playlist
*
playlist
,
struct
player_control
*
pc
,
unsigned
id1
,
unsigned
id2
);
unsigned
id1
,
unsigned
id2
);
enum
playlist_result
enum
playlist_result
SetPriorityRange
(
player_control
&
pc
,
playlist_set_priority
(
struct
playlist
*
playlist
,
struct
player_control
*
pc
,
unsigned
start_position
,
unsigned
start_position
,
unsigned
end_position
,
unsigned
end_position
,
uint8_t
priority
);
uint8_t
priority
);
enum
playlist_result
enum
playlist_result
SetPriorityId
(
player_control
&
pc
,
playlist_set_priority_id
(
struct
playlist
*
playlist
,
struct
player_control
*
pc
,
unsigned
song_id
,
uint8_t
priority
);
unsigned
song_id
,
uint8_t
priority
);
bool
void
Stop
(
player_control
&
pc
);
playlist_get_repeat
(
const
struct
playlist
*
playlist
);
void
playlist_set_repeat
(
struct
playlist
*
playlist
,
struct
player_control
*
pc
,
bool
status
);
bool
playlist_get_random
(
const
struct
playlist
*
playlist
);
void
playlist_set_random
(
struct
playlist
*
playlist
,
struct
player_control
*
pc
,
bool
status
);
bool
playlist_get_single
(
const
struct
playlist
*
playlist
);
void
playlist_set_single
(
struct
playlist
*
playlist
,
struct
player_control
*
pc
,
bool
status
);
bool
playlist_get_consume
(
const
struct
playlist
*
playlist
);
void
playlist_set_consume
(
struct
playlist
*
playlist
,
bool
status
);
int
enum
playlist_result
PlayPosition
(
player_control
&
pc
,
int
position
);
playlist_get_current_song
(
const
struct
playlist
*
playlist
);
int
void
PlayOrder
(
player_control
&
pc
,
int
order
);
playlist_get_next_song
(
const
struct
playlist
*
playlist
);
unsigned
enum
playlist_result
PlayId
(
player_control
&
pc
,
int
id
);
playlist_get_song_id
(
const
struct
playlist
*
playlist
,
unsigned
song
);
int
void
PlayNext
(
player_control
&
pc
);
playlist_get_length
(
const
struct
playlist
*
playlist
);
unsigned
long
void
PlayPrevious
(
player_control
&
pc
);
playlist_get_version
(
const
struct
playlist
*
playlist
);
enum
playlist_result
enum
playlist_result
SeekSongPosition
(
player_control
&
pc
,
playlist_seek_song
(
struct
playlist
*
playlist
,
struct
player_control
*
pc
,
unsigned
song_position
,
unsigned
song
,
float
seek_time
);
float
seek_time
);
enum
playlist_result
enum
playlist_result
SeekSongId
(
player_control
&
pc
,
playlist_seek_song_id
(
struct
playlist
*
playlist
,
struct
player_control
*
pc
,
unsigned
song_id
,
float
seek_time
);
unsigned
id
,
float
seek_time
);
/**
/**
* Seek within the current song. Fails if MPD is not currently
* Seek within the current song. Fails if MPD is not currently
* playing.
* playing.
*
*
...
@@ -241,10 +223,37 @@ playlist_seek_song_id(struct playlist *playlist, struct player_control *pc,
...
@@ -241,10 +223,37 @@ playlist_seek_song_id(struct playlist *playlist, struct player_control *pc,
* @param relative if true, then the specified time is relative to the
* @param relative if true, then the specified time is relative to the
* current position
* current position
*/
*/
enum
playlist_result
enum
playlist_result
SeekCurrent
(
player_control
&
pc
,
playlist_seek_current
(
struct
playlist
*
playlist
,
struct
player_control
*
pc
,
float
seek_time
,
bool
relative
);
float
seek_time
,
bool
relative
);
bool
GetRepeat
()
const
{
return
queue
.
repeat
;
}
void
SetRepeat
(
player_control
&
pc
,
bool
new_value
);
bool
GetRandom
()
const
{
return
queue
.
random
;
}
void
SetRandom
(
player_control
&
pc
,
bool
new_value
);
bool
GetSingle
()
const
{
return
queue
.
single
;
}
void
SetSingle
(
player_control
&
pc
,
bool
new_value
);
bool
GetConsume
()
const
{
return
queue
.
consume
;
}
void
SetConsume
(
bool
new_value
);
};
void
playlist_global_init
();
void
void
playlist_increment_version_all
(
struct
playlist
*
playlist
);
playlist_increment_version_all
(
struct
playlist
*
playlist
);
...
...
src/PlaylistControl.cxx
View file @
52638c68
...
@@ -23,7 +23,7 @@
...
@@ -23,7 +23,7 @@
*/
*/
#include "config.h"
#include "config.h"
#include "Playlist
Internal
.hxx"
#include "Playlist.hxx"
#include "PlayerControl.hxx"
#include "PlayerControl.hxx"
#include "song.h"
#include "song.h"
...
@@ -33,244 +33,223 @@
...
@@ -33,244 +33,223 @@
#define G_LOG_DOMAIN "playlist"
#define G_LOG_DOMAIN "playlist"
void
void
playlist
_stop
(
struct
playlist
*
playlist
,
struct
player_control
*
pc
)
playlist
::
Stop
(
player_control
&
pc
)
{
{
if
(
!
play
list
->
play
ing
)
if
(
!
playing
)
return
;
return
;
assert
(
playlist
->
current
>=
0
);
assert
(
current
>=
0
);
g_debug
(
"stop"
);
g_debug
(
"stop"
);
pc_stop
(
pc
);
pc_stop
(
&
pc
);
playlist
->
queued
=
-
1
;
queued
=
-
1
;
play
list
->
play
ing
=
false
;
playing
=
false
;
if
(
playlist
->
queue
.
random
)
{
if
(
queue
.
random
)
{
/* shuffle the playlist, so the next playback will
/* shuffle the playlist, so the next playback will
result in a new random order */
result in a new random order */
unsigned
current_position
=
unsigned
current_position
=
queue
.
OrderToPosition
(
current
);
playlist
->
queue
.
OrderToPosition
(
playlist
->
current
);
playlist
->
queue
.
ShuffleOrder
();
queue
.
ShuffleOrder
();
/* make sure that "current" stays valid, and the next
/* make sure that "current" stays valid, and the next
"play" command plays the same song again */
"play" command plays the same song again */
playlist
->
current
=
current
=
queue
.
PositionToOrder
(
current_position
);
playlist
->
queue
.
PositionToOrder
(
current_position
);
}
}
}
}
enum
playlist_result
enum
playlist_result
playlist_play
(
struct
playlist
*
playlist
,
struct
player_control
*
pc
,
playlist
::
PlayPosition
(
player_control
&
pc
,
int
song
)
int
song
)
{
{
unsigned
i
=
song
;
pc_clear_error
(
&
pc
);
pc_clear_error
(
pc
);
unsigned
i
=
song
;
if
(
song
==
-
1
)
{
if
(
song
==
-
1
)
{
/* play any song ("current" song, or the first song */
/* play any song ("current" song, or the first song */
if
(
playlist
->
queue
.
IsEmpty
())
if
(
queue
.
IsEmpty
())
return
PLAYLIST_RESULT_SUCCESS
;
return
PLAYLIST_RESULT_SUCCESS
;
if
(
play
list
->
play
ing
)
{
if
(
playing
)
{
/* already playing: unpause playback, just in
/* already playing: unpause playback, just in
case it was paused, and return */
case it was paused, and return */
pc_set_pause
(
pc
,
false
);
pc_set_pause
(
&
pc
,
false
);
return
PLAYLIST_RESULT_SUCCESS
;
return
PLAYLIST_RESULT_SUCCESS
;
}
}
/* select a song: "current" song, or the first one */
/* select a song: "current" song, or the first one */
i
=
playlist
->
current
>=
0
i
=
current
>=
0
?
playlist
->
current
?
current
:
0
;
:
0
;
}
else
if
(
!
playlist
->
queue
.
IsValidPosition
(
song
))
}
else
if
(
!
queue
.
IsValidPosition
(
song
))
return
PLAYLIST_RESULT_BAD_RANGE
;
return
PLAYLIST_RESULT_BAD_RANGE
;
if
(
playlist
->
queue
.
random
)
{
if
(
queue
.
random
)
{
if
(
song
>=
0
)
if
(
song
>=
0
)
/* "i" is currently the song position (which
/* "i" is currently the song position (which
would be equal to the order number in
would be equal to the order number in
no-random mode); convert it to a order
no-random mode); convert it to a order
number, because random mode is enabled */
number, because random mode is enabled */
i
=
playlist
->
queue
.
PositionToOrder
(
song
);
i
=
queue
.
PositionToOrder
(
song
);
if
(
!
play
list
->
play
ing
)
if
(
!
playing
)
playlist
->
current
=
0
;
current
=
0
;
/* swap the new song with the previous "current" one,
/* swap the new song with the previous "current" one,
so playback continues as planned */
so playback continues as planned */
playlist
->
queue
.
SwapOrders
(
i
,
playlist
->
current
);
queue
.
SwapOrders
(
i
,
current
);
i
=
playlist
->
current
;
i
=
current
;
}
}
playlist
->
stop_on_error
=
false
;
stop_on_error
=
false
;
playlist
->
error_count
=
0
;
error_count
=
0
;
playlist_play_order
(
playlist
,
pc
,
i
);
PlayOrder
(
pc
,
i
);
return
PLAYLIST_RESULT_SUCCESS
;
return
PLAYLIST_RESULT_SUCCESS
;
}
}
enum
playlist_result
enum
playlist_result
playlist_play_id
(
struct
playlist
*
playlist
,
struct
player_control
*
pc
,
playlist
::
PlayId
(
player_control
&
pc
,
int
id
)
int
id
)
{
{
int
song
;
if
(
id
==
-
1
)
return
PlayPosition
(
pc
,
id
);
if
(
id
==
-
1
)
{
return
playlist_play
(
playlist
,
pc
,
id
);
}
song
=
playlist
->
queue
.
IdToPosition
(
id
);
int
song
=
queue
.
IdToPosition
(
id
);
if
(
song
<
0
)
if
(
song
<
0
)
return
PLAYLIST_RESULT_NO_SUCH_SONG
;
return
PLAYLIST_RESULT_NO_SUCH_SONG
;
return
playlist_play
(
playlist
,
pc
,
song
);
return
PlayPosition
(
pc
,
song
);
}
}
void
void
playlist
_next
(
struct
playlist
*
playlist
,
struct
player_control
*
pc
)
playlist
::
PlayNext
(
player_control
&
pc
)
{
{
int
next_order
;
if
(
!
playing
)
int
current
;
if
(
!
playlist
->
playing
)
return
;
return
;
assert
(
!
playlist
->
queue
.
IsEmpty
());
assert
(
!
queue
.
IsEmpty
());
assert
(
playlist
->
queue
.
IsValidOrder
(
playlist
->
current
));
assert
(
queue
.
IsValidOrder
(
current
));
c
urrent
=
playlist
->
current
;
c
onst
int
old_current
=
current
;
playlist
->
stop_on_error
=
false
;
stop_on_error
=
false
;
/* determine the next song from the queue's order list */
/* determine the next song from the queue's order list */
next_order
=
playlist
->
queue
.
GetNextOrder
(
playlist
->
current
);
const
int
next_order
=
queue
.
GetNextOrder
(
current
);
if
(
next_order
<
0
)
{
if
(
next_order
<
0
)
{
/* no song after this one: stop playback */
/* no song after this one: stop playback */
playlist_stop
(
playlist
,
pc
);
Stop
(
pc
);
/* reset "current song" */
/* reset "current song" */
playlist
->
current
=
-
1
;
current
=
-
1
;
}
}
else
else
{
{
if
(
next_order
==
0
&&
playlist
->
queue
.
random
)
{
if
(
next_order
==
0
&&
queue
.
random
)
{
/* The queue told us that the next song is the first
/* The queue told us that the next song is the first
song. This means we are in repeat mode. Shuffle
song. This means we are in repeat mode. Shuffle
the queue order, so this time, the user hears the
the queue order, so this time, the user hears the
songs in a different than before */
songs in a different than before */
assert
(
playlist
->
queue
.
repeat
);
assert
(
queue
.
repeat
);
playlist
->
queue
.
ShuffleOrder
();
queue
.
ShuffleOrder
();
/* note that
playlist->current and playlist->
queued are
/* note that
current and
queued are
now invalid, but playlist_play_order() will
now invalid, but playlist_play_order() will
discard them anyway */
discard them anyway */
}
}
playlist_play_order
(
playlist
,
pc
,
next_order
);
PlayOrder
(
pc
,
next_order
);
}
}
/* Consume mode removes each played songs. */
/* Consume mode removes each played songs. */
if
(
playlist
->
queue
.
consume
)
if
(
queue
.
consume
)
playlist_delete
(
playlist
,
pc
,
DeleteOrder
(
pc
,
old_current
);
playlist
->
queue
.
OrderToPosition
(
current
));
}
}
void
void
playlist
_previous
(
struct
playlist
*
playlist
,
struct
player_control
*
pc
)
playlist
::
PlayPrevious
(
player_control
&
pc
)
{
{
if
(
!
play
list
->
play
ing
)
if
(
!
playing
)
return
;
return
;
assert
(
playlist
->
queue
.
GetLength
()
>
0
);
assert
(
!
queue
.
IsEmpty
()
);
if
(
playlist
->
current
>
0
)
{
int
order
;
if
(
current
>
0
)
{
/* play the preceding song */
/* play the preceding song */
playlist_play_order
(
playlist
,
pc
,
order
=
current
-
1
;
playlist
->
current
-
1
);
}
else
if
(
queue
.
repeat
)
{
}
else
if
(
playlist
->
queue
.
repeat
)
{
/* play the last song in "repeat" mode */
/* play the last song in "repeat" mode */
playlist_play_order
(
playlist
,
pc
,
order
=
queue
.
GetLength
()
-
1
;
playlist
->
queue
.
GetLength
()
-
1
);
}
else
{
}
else
{
/* re-start playing the current song if it's
/* re-start playing the current song if it's
the first one */
the first one */
playlist_play_order
(
playlist
,
pc
,
playlist
->
current
)
;
order
=
current
;
}
}
PlayOrder
(
pc
,
order
);
}
}
enum
playlist_result
enum
playlist_result
playlist_seek_song
(
struct
playlist
*
playlist
,
struct
player_control
*
pc
,
playlist
::
SeekSongPosition
(
player_control
&
pc
,
unsigned
song
,
float
seek_time
)
unsigned
song
,
float
seek_time
)
{
{
const
struct
song
*
queued
;
if
(
!
queue
.
IsValidPosition
(
song
))
unsigned
i
;
bool
success
;
if
(
!
playlist
->
queue
.
IsValidPosition
(
song
))
return
PLAYLIST_RESULT_BAD_RANGE
;
return
PLAYLIST_RESULT_BAD_RANGE
;
queued
=
playlist_get_queued_song
(
playlist
);
const
struct
song
*
queued_song
=
GetQueuedSong
(
);
if
(
playlist
->
queue
.
random
)
unsigned
i
=
queue
.
random
i
=
playlist
->
queue
.
PositionToOrder
(
song
);
?
queue
.
PositionToOrder
(
song
)
else
:
song
;
i
=
song
;
pc_clear_error
(
pc
);
pc_clear_error
(
&
pc
);
playlist
->
stop_on_error
=
true
;
stop_on_error
=
true
;
playlist
->
error_count
=
0
;
error_count
=
0
;
if
(
!
play
list
->
playing
||
(
unsigned
)
playlist
->
current
!=
i
)
{
if
(
!
play
ing
||
(
unsigned
)
current
!=
i
)
{
/* seeking is not within the current song - prepare
/* seeking is not within the current song - prepare
song change */
song change */
play
list
->
play
ing
=
true
;
playing
=
true
;
playlist
->
current
=
i
;
current
=
i
;
queued
=
NULL
;
queued
_song
=
nullptr
;
}
}
struct
song
*
the_song
=
struct
song
*
the_song
=
song_dup_detached
(
queue
.
GetOrder
(
i
));
song_dup_detached
(
playlist
->
queue
.
GetOrder
(
i
));
if
(
!
pc_seek
(
&
pc
,
the_song
,
seek_time
))
{
success
=
pc_seek
(
pc
,
the_song
,
seek_time
);
UpdateQueuedSong
(
pc
,
queued_song
);
if
(
!
success
)
{
playlist_update_queued_song
(
playlist
,
pc
,
queued
);
return
PLAYLIST_RESULT_NOT_PLAYING
;
return
PLAYLIST_RESULT_NOT_PLAYING
;
}
}
playlist
->
queued
=
-
1
;
queued
=
-
1
;
playlist_update_queued_song
(
playlist
,
pc
,
NULL
);
UpdateQueuedSong
(
pc
,
NULL
);
return
PLAYLIST_RESULT_SUCCESS
;
return
PLAYLIST_RESULT_SUCCESS
;
}
}
enum
playlist_result
enum
playlist_result
playlist_seek_song_id
(
struct
playlist
*
playlist
,
struct
player_control
*
pc
,
playlist
::
SeekSongId
(
player_control
&
pc
,
unsigned
id
,
float
seek_time
)
unsigned
id
,
float
seek_time
)
{
{
int
song
=
playlist
->
queue
.
IdToPosition
(
id
);
int
song
=
queue
.
IdToPosition
(
id
);
if
(
song
<
0
)
if
(
song
<
0
)
return
PLAYLIST_RESULT_NO_SUCH_SONG
;
return
PLAYLIST_RESULT_NO_SUCH_SONG
;
return
playlist_seek_song
(
playlist
,
pc
,
song
,
seek_time
);
return
SeekSongPosition
(
pc
,
song
,
seek_time
);
}
}
enum
playlist_result
enum
playlist_result
playlist_seek_current
(
struct
playlist
*
playlist
,
struct
player_control
*
pc
,
playlist
::
SeekCurrent
(
player_control
&
pc
,
float
seek_time
,
bool
relative
)
float
seek_time
,
bool
relative
)
{
{
if
(
!
play
list
->
play
ing
)
if
(
!
playing
)
return
PLAYLIST_RESULT_NOT_PLAYING
;
return
PLAYLIST_RESULT_NOT_PLAYING
;
if
(
relative
)
{
if
(
relative
)
{
struct
player_status
status
;
struct
player_status
status
;
pc_get_status
(
pc
,
&
status
);
pc_get_status
(
&
pc
,
&
status
);
if
(
status
.
state
!=
PLAYER_STATE_PLAY
&&
if
(
status
.
state
!=
PLAYER_STATE_PLAY
&&
status
.
state
!=
PLAYER_STATE_PAUSE
)
status
.
state
!=
PLAYER_STATE_PAUSE
)
...
@@ -282,5 +261,5 @@ playlist_seek_current(struct playlist *playlist, struct player_control *pc,
...
@@ -282,5 +261,5 @@ playlist_seek_current(struct playlist *playlist, struct player_control *pc,
if
(
seek_time
<
0
)
if
(
seek_time
<
0
)
seek_time
=
0
;
seek_time
=
0
;
return
playlist_seek_song
(
playlist
,
pc
,
playlist
->
current
,
seek_time
);
return
SeekSongPosition
(
pc
,
current
,
seek_time
);
}
}
src/PlaylistEdit.cxx
View file @
52638c68
This diff is collapsed.
Click to expand it.
src/PlaylistGlobal.cxx
View file @
52638c68
...
@@ -34,14 +34,13 @@ extern "C" {
...
@@ -34,14 +34,13 @@ extern "C" {
static
void
static
void
playlist_tag_event
(
void
)
playlist_tag_event
(
void
)
{
{
playlist_tag_changed
(
&
global_partition
->
playlist
);
global_partition
->
playlist
.
TagChanged
(
);
}
}
static
void
static
void
playlist_event
(
void
)
playlist_event
(
void
)
{
{
playlist_sync
(
&
global_partition
->
playlist
,
global_partition
->
playlist
.
SyncWithPlayer
(
global_partition
->
pc
);
&
global_partition
->
pc
);
}
}
void
void
...
...
src/PlaylistInternal.hxx
deleted
100644 → 0
View file @
400ff1c8
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/*
* Internal header for the components of the playlist code.
*
*/
#ifndef MPD_PLAYLIST_INTERNAL_HXX
#define MPD_PLAYLIST_INTERNAL_HXX
#include "Playlist.hxx"
struct
player_control
;
/**
* Returns the song object which is currently queued. Returns none if
* there is none (yet?) or if MPD isn't playing.
*/
const
struct
song
*
playlist_get_queued_song
(
struct
playlist
*
playlist
);
/**
* Updates the "queued song". Calculates the next song according to
* the current one (if MPD isn't playing, it takes the first song),
* and queues this song. Clears the old queued song if there was one.
*
* @param prev the song which was previously queued, as determined by
* playlist_get_queued_song()
*/
void
playlist_update_queued_song
(
struct
playlist
*
playlist
,
struct
player_control
*
pc
,
const
struct
song
*
prev
);
void
playlist_play_order
(
struct
playlist
*
playlist
,
struct
player_control
*
pc
,
int
orderNum
);
#endif
src/PlaylistPrint.cxx
View file @
52638c68
...
@@ -80,8 +80,7 @@ playlist_print_id(Client *client, const struct playlist *playlist,
...
@@ -80,8 +80,7 @@ playlist_print_id(Client *client, const struct playlist *playlist,
bool
bool
playlist_print_current
(
Client
*
client
,
const
struct
playlist
*
playlist
)
playlist_print_current
(
Client
*
client
,
const
struct
playlist
*
playlist
)
{
{
int
current_position
=
playlist_get_current_song
(
playlist
);
int
current_position
=
playlist
->
GetCurrentPosition
();
if
(
current_position
<
0
)
if
(
current_position
<
0
)
return
false
;
return
false
;
...
...
src/PlaylistQueue.cxx
View file @
52638c68
...
@@ -52,7 +52,7 @@ playlist_load_into_queue(const char *uri, struct playlist_provider *source,
...
@@ -52,7 +52,7 @@ playlist_load_into_queue(const char *uri, struct playlist_provider *source,
if
(
song
==
NULL
)
if
(
song
==
NULL
)
continue
;
continue
;
result
=
playlist_append_song
(
dest
,
pc
,
song
,
NULL
);
result
=
dest
->
AppendSong
(
*
pc
,
song
);
song_free
(
song
);
song_free
(
song
);
if
(
result
!=
PLAYLIST_RESULT_SUCCESS
)
{
if
(
result
!=
PLAYLIST_RESULT_SUCCESS
)
{
g_free
(
base_uri
);
g_free
(
base_uri
);
...
...
src/PlaylistSave.cxx
View file @
52638c68
...
@@ -132,8 +132,7 @@ playlist_load_spl(struct playlist *playlist, struct player_control *pc,
...
@@ -132,8 +132,7 @@ playlist_load_spl(struct playlist *playlist, struct player_control *pc,
for
(
unsigned
i
=
start_index
;
i
<
end_index
;
++
i
)
{
for
(
unsigned
i
=
start_index
;
i
<
end_index
;
++
i
)
{
const
auto
&
uri_utf8
=
contents
[
i
];
const
auto
&
uri_utf8
=
contents
[
i
];
if
((
playlist_append_uri
(
playlist
,
pc
,
uri_utf8
.
c_str
(),
if
((
playlist
->
AppendURI
(
*
pc
,
uri_utf8
.
c_str
()))
!=
PLAYLIST_RESULT_SUCCESS
)
{
nullptr
))
!=
PLAYLIST_RESULT_SUCCESS
)
{
/* for windows compatibility, convert slashes */
/* for windows compatibility, convert slashes */
char
*
temp2
=
g_strdup
(
uri_utf8
.
c_str
());
char
*
temp2
=
g_strdup
(
uri_utf8
.
c_str
());
char
*
p
=
temp2
;
char
*
p
=
temp2
;
...
@@ -142,9 +141,10 @@ playlist_load_spl(struct playlist *playlist, struct player_control *pc,
...
@@ -142,9 +141,10 @@ playlist_load_spl(struct playlist *playlist, struct player_control *pc,
*
p
=
'/'
;
*
p
=
'/'
;
p
++
;
p
++
;
}
}
if
((
playlist_append_uri
(
playlist
,
pc
,
temp2
,
NULL
))
!=
PLAYLIST_RESULT_SUCCESS
)
{
if
(
playlist
->
AppendURI
(
*
pc
,
temp2
)
!=
PLAYLIST_RESULT_SUCCESS
)
g_warning
(
"can't add file
\"
%s
\"
"
,
temp2
);
g_warning
(
"can't add file
\"
%s
\"
"
,
temp2
);
}
g_free
(
temp2
);
g_free
(
temp2
);
}
}
}
}
...
...
src/PlaylistState.cxx
View file @
52638c68
...
@@ -145,26 +145,16 @@ playlist_state_restore(const char *line, TextFile &file,
...
@@ -145,26 +145,16 @@ playlist_state_restore(const char *line, TextFile &file,
seek_time
=
seek_time
=
atoi
(
&
(
line
[
strlen
(
PLAYLIST_STATE_FILE_TIME
)]));
atoi
(
&
(
line
[
strlen
(
PLAYLIST_STATE_FILE_TIME
)]));
}
else
if
(
g_str_has_prefix
(
line
,
PLAYLIST_STATE_FILE_REPEAT
))
{
}
else
if
(
g_str_has_prefix
(
line
,
PLAYLIST_STATE_FILE_REPEAT
))
{
if
(
strcmp
playlist
->
SetRepeat
(
*
pc
,
(
&
(
line
[
strlen
(
PLAYLIST_STATE_FILE_REPEAT
)]),
strcmp
(
&
(
line
[
strlen
(
PLAYLIST_STATE_FILE_REPEAT
)]),
"1"
)
==
0
)
{
"1"
)
==
0
);
playlist_set_repeat
(
playlist
,
pc
,
true
);
}
else
playlist_set_repeat
(
playlist
,
pc
,
false
);
}
else
if
(
g_str_has_prefix
(
line
,
PLAYLIST_STATE_FILE_SINGLE
))
{
}
else
if
(
g_str_has_prefix
(
line
,
PLAYLIST_STATE_FILE_SINGLE
))
{
if
(
strcmp
playlist
->
SetSingle
(
*
pc
,
(
&
(
line
[
strlen
(
PLAYLIST_STATE_FILE_SINGLE
)]),
strcmp
(
&
(
line
[
strlen
(
PLAYLIST_STATE_FILE_SINGLE
)]),
"1"
)
==
0
)
{
"1"
)
==
0
);
playlist_set_single
(
playlist
,
pc
,
true
);
}
else
playlist_set_single
(
playlist
,
pc
,
false
);
}
else
if
(
g_str_has_prefix
(
line
,
PLAYLIST_STATE_FILE_CONSUME
))
{
}
else
if
(
g_str_has_prefix
(
line
,
PLAYLIST_STATE_FILE_CONSUME
))
{
if
(
strcmp
playlist
->
SetConsume
(
strcmp
(
&
(
line
[
strlen
(
PLAYLIST_STATE_FILE_CONSUME
)]),
(
&
(
line
[
strlen
(
PLAYLIST_STATE_FILE_CONSUME
)]),
"1"
)
==
0
);
"1"
)
==
0
)
{
playlist_set_consume
(
playlist
,
true
);
}
else
playlist_set_consume
(
playlist
,
false
);
}
else
if
(
g_str_has_prefix
(
line
,
PLAYLIST_STATE_FILE_CROSSFADE
))
{
}
else
if
(
g_str_has_prefix
(
line
,
PLAYLIST_STATE_FILE_CROSSFADE
))
{
pc_set_cross_fade
(
pc
,
pc_set_cross_fade
(
pc
,
atoi
(
line
+
strlen
(
PLAYLIST_STATE_FILE_CROSSFADE
)));
atoi
(
line
+
strlen
(
PLAYLIST_STATE_FILE_CROSSFADE
)));
...
@@ -188,7 +178,7 @@ playlist_state_restore(const char *line, TextFile &file,
...
@@ -188,7 +178,7 @@ playlist_state_restore(const char *line, TextFile &file,
}
}
}
}
playlist
_set_random
(
playlist
,
pc
,
random_mode
);
playlist
->
SetRandom
(
*
pc
,
random_mode
);
if
(
!
playlist
->
queue
.
IsEmpty
())
{
if
(
!
playlist
->
queue
.
IsEmpty
())
{
if
(
!
playlist
->
queue
.
IsValidPosition
(
current
))
if
(
!
playlist
->
queue
.
IsValidPosition
(
current
))
...
@@ -210,9 +200,9 @@ playlist_state_restore(const char *line, TextFile &file,
...
@@ -210,9 +200,9 @@ playlist_state_restore(const char *line, TextFile &file,
if
(
state
==
PLAYER_STATE_STOP
/* && config_option */
)
if
(
state
==
PLAYER_STATE_STOP
/* && config_option */
)
playlist
->
current
=
current
;
playlist
->
current
=
current
;
else
if
(
seek_time
==
0
)
else
if
(
seek_time
==
0
)
playlist
_play
(
playlist
,
pc
,
current
);
playlist
->
PlayPosition
(
*
pc
,
current
);
else
else
playlist
_seek_song
(
playlist
,
pc
,
current
,
seek_time
);
playlist
->
SeekSongPosition
(
*
pc
,
current
,
seek_time
);
if
(
state
==
PLAYER_STATE_PAUSE
)
if
(
state
==
PLAYER_STATE_PAUSE
)
pc_pause
(
pc
);
pc_pause
(
pc
);
...
...
src/QueueCommands.cxx
View file @
52638c68
...
@@ -27,6 +27,7 @@
...
@@ -27,6 +27,7 @@
#include "PlaylistPrint.hxx"
#include "PlaylistPrint.hxx"
#include "ClientFile.hxx"
#include "ClientFile.hxx"
#include "ClientInternal.hxx"
#include "ClientInternal.hxx"
#include "Partition.hxx"
#include "protocol/ArgParser.hxx"
#include "protocol/ArgParser.hxx"
#include "protocol/Result.hxx"
#include "protocol/Result.hxx"
#include "ls.hxx"
#include "ls.hxx"
...
@@ -50,10 +51,7 @@ handle_add(Client *client, G_GNUC_UNUSED int argc, char *argv[])
...
@@ -50,10 +51,7 @@ handle_add(Client *client, G_GNUC_UNUSED int argc, char *argv[])
if
(
!
client_allow_file
(
client
,
path
,
&
error
))
if
(
!
client_allow_file
(
client
,
path
,
&
error
))
return
print_error
(
client
,
error
);
return
print_error
(
client
,
error
);
result
=
playlist_append_file
(
&
client
->
playlist
,
result
=
client
->
partition
.
AppendFile
(
path
);
client
->
player_control
,
path
,
NULL
);
return
print_playlist_result
(
client
,
result
);
return
print_playlist_result
(
client
,
result
);
}
}
...
@@ -64,9 +62,7 @@ handle_add(Client *client, G_GNUC_UNUSED int argc, char *argv[])
...
@@ -64,9 +62,7 @@ handle_add(Client *client, G_GNUC_UNUSED int argc, char *argv[])
return
COMMAND_RETURN_ERROR
;
return
COMMAND_RETURN_ERROR
;
}
}
result
=
playlist_append_uri
(
&
client
->
playlist
,
result
=
client
->
partition
.
AppendURI
(
uri
);
client
->
player_control
,
uri
,
NULL
);
return
print_playlist_result
(
client
,
result
);
return
print_playlist_result
(
client
,
result
);
}
}
...
@@ -91,10 +87,7 @@ handle_addid(Client *client, int argc, char *argv[])
...
@@ -91,10 +87,7 @@ handle_addid(Client *client, int argc, char *argv[])
if
(
!
client_allow_file
(
client
,
path
,
&
error
))
if
(
!
client_allow_file
(
client
,
path
,
&
error
))
return
print_error
(
client
,
error
);
return
print_error
(
client
,
error
);
result
=
playlist_append_file
(
&
client
->
playlist
,
result
=
client
->
partition
.
AppendFile
(
path
,
&
added_id
);
client
->
player_control
,
path
,
&
added_id
);
}
else
{
}
else
{
if
(
uri_has_scheme
(
uri
)
&&
!
uri_supported_scheme
(
uri
))
{
if
(
uri_has_scheme
(
uri
)
&&
!
uri_supported_scheme
(
uri
))
{
command_error
(
client
,
ACK_ERROR_NO_EXIST
,
command_error
(
client
,
ACK_ERROR_NO_EXIST
,
...
@@ -102,9 +95,7 @@ handle_addid(Client *client, int argc, char *argv[])
...
@@ -102,9 +95,7 @@ handle_addid(Client *client, int argc, char *argv[])
return
COMMAND_RETURN_ERROR
;
return
COMMAND_RETURN_ERROR
;
}
}
result
=
playlist_append_uri
(
&
client
->
playlist
,
result
=
client
->
partition
.
AppendURI
(
uri
,
&
added_id
);
client
->
player_control
,
uri
,
&
added_id
);
}
}
if
(
result
!=
PLAYLIST_RESULT_SUCCESS
)
if
(
result
!=
PLAYLIST_RESULT_SUCCESS
)
...
@@ -114,15 +105,11 @@ handle_addid(Client *client, int argc, char *argv[])
...
@@ -114,15 +105,11 @@ handle_addid(Client *client, int argc, char *argv[])
unsigned
to
;
unsigned
to
;
if
(
!
check_unsigned
(
client
,
&
to
,
argv
[
2
]))
if
(
!
check_unsigned
(
client
,
&
to
,
argv
[
2
]))
return
COMMAND_RETURN_ERROR
;
return
COMMAND_RETURN_ERROR
;
result
=
playlist_move_id
(
&
client
->
playlist
,
result
=
client
->
partition
.
MoveId
(
added_id
,
to
);
client
->
player_control
,
added_id
,
to
);
if
(
result
!=
PLAYLIST_RESULT_SUCCESS
)
{
if
(
result
!=
PLAYLIST_RESULT_SUCCESS
)
{
enum
command_return
ret
=
enum
command_return
ret
=
print_playlist_result
(
client
,
result
);
print_playlist_result
(
client
,
result
);
playlist_delete_id
(
&
client
->
playlist
,
client
->
partition
.
DeleteId
(
added_id
);
client
->
player_control
,
added_id
);
return
ret
;
return
ret
;
}
}
}
}
...
@@ -135,14 +122,11 @@ enum command_return
...
@@ -135,14 +122,11 @@ enum command_return
handle_delete
(
Client
*
client
,
G_GNUC_UNUSED
int
argc
,
char
*
argv
[])
handle_delete
(
Client
*
client
,
G_GNUC_UNUSED
int
argc
,
char
*
argv
[])
{
{
unsigned
start
,
end
;
unsigned
start
,
end
;
enum
playlist_result
result
;
if
(
!
check_range
(
client
,
&
start
,
&
end
,
argv
[
1
]))
if
(
!
check_range
(
client
,
&
start
,
&
end
,
argv
[
1
]))
return
COMMAND_RETURN_ERROR
;
return
COMMAND_RETURN_ERROR
;
result
=
playlist_delete_range
(
&
client
->
playlist
,
enum
playlist_result
result
=
client
->
partition
.
DeleteRange
(
start
,
end
);
client
->
player_control
,
start
,
end
);
return
print_playlist_result
(
client
,
result
);
return
print_playlist_result
(
client
,
result
);
}
}
...
@@ -150,13 +134,11 @@ enum command_return
...
@@ -150,13 +134,11 @@ enum command_return
handle_deleteid
(
Client
*
client
,
G_GNUC_UNUSED
int
argc
,
char
*
argv
[])
handle_deleteid
(
Client
*
client
,
G_GNUC_UNUSED
int
argc
,
char
*
argv
[])
{
{
unsigned
id
;
unsigned
id
;
enum
playlist_result
result
;
if
(
!
check_unsigned
(
client
,
&
id
,
argv
[
1
]))
if
(
!
check_unsigned
(
client
,
&
id
,
argv
[
1
]))
return
COMMAND_RETURN_ERROR
;
return
COMMAND_RETURN_ERROR
;
result
=
playlist_delete_id
(
&
client
->
playlist
,
enum
playlist_result
result
=
client
->
partition
.
DeleteId
(
id
);
client
->
player_control
,
id
);
return
print_playlist_result
(
client
,
result
);
return
print_playlist_result
(
client
,
result
);
}
}
...
@@ -176,8 +158,7 @@ handle_shuffle(G_GNUC_UNUSED Client *client,
...
@@ -176,8 +158,7 @@ handle_shuffle(G_GNUC_UNUSED Client *client,
if
(
argc
==
2
&&
!
check_range
(
client
,
&
start
,
&
end
,
argv
[
1
]))
if
(
argc
==
2
&&
!
check_range
(
client
,
&
start
,
&
end
,
argv
[
1
]))
return
COMMAND_RETURN_ERROR
;
return
COMMAND_RETURN_ERROR
;
playlist_shuffle
(
&
client
->
playlist
,
client
->
player_control
,
client
->
partition
.
Shuffle
(
start
,
end
);
start
,
end
);
return
COMMAND_RETURN_OK
;
return
COMMAND_RETURN_OK
;
}
}
...
@@ -185,7 +166,7 @@ enum command_return
...
@@ -185,7 +166,7 @@ enum command_return
handle_clear
(
G_GNUC_UNUSED
Client
*
client
,
handle_clear
(
G_GNUC_UNUSED
Client
*
client
,
G_GNUC_UNUSED
int
argc
,
G_GNUC_UNUSED
char
*
argv
[])
G_GNUC_UNUSED
int
argc
,
G_GNUC_UNUSED
char
*
argv
[])
{
{
playlist_clear
(
&
client
->
playlist
,
client
->
player_control
);
client
->
partition
.
ClearQueue
(
);
return
COMMAND_RETURN_OK
;
return
COMMAND_RETURN_OK
;
}
}
...
@@ -296,9 +277,8 @@ handle_prio(Client *client, int argc, char *argv[])
...
@@ -296,9 +277,8 @@ handle_prio(Client *client, int argc, char *argv[])
return
COMMAND_RETURN_ERROR
;
return
COMMAND_RETURN_ERROR
;
enum
playlist_result
result
=
enum
playlist_result
result
=
playlist_set_priority
(
&
client
->
playlist
,
client
->
partition
.
SetPriorityRange
(
start_position
,
client
->
player_control
,
end_position
,
start_position
,
end_position
,
priority
);
priority
);
if
(
result
!=
PLAYLIST_RESULT_SUCCESS
)
if
(
result
!=
PLAYLIST_RESULT_SUCCESS
)
return
print_playlist_result
(
client
,
result
);
return
print_playlist_result
(
client
,
result
);
...
@@ -327,9 +307,7 @@ handle_prioid(Client *client, int argc, char *argv[])
...
@@ -327,9 +307,7 @@ handle_prioid(Client *client, int argc, char *argv[])
return
COMMAND_RETURN_ERROR
;
return
COMMAND_RETURN_ERROR
;
enum
playlist_result
result
=
enum
playlist_result
result
=
playlist_set_priority_id
(
&
client
->
playlist
,
client
->
partition
.
SetPriorityId
(
song_id
,
priority
);
client
->
player_control
,
song_id
,
priority
);
if
(
result
!=
PLAYLIST_RESULT_SUCCESS
)
if
(
result
!=
PLAYLIST_RESULT_SUCCESS
)
return
print_playlist_result
(
client
,
result
);
return
print_playlist_result
(
client
,
result
);
}
}
...
@@ -342,14 +320,14 @@ handle_move(Client *client, G_GNUC_UNUSED int argc, char *argv[])
...
@@ -342,14 +320,14 @@ handle_move(Client *client, G_GNUC_UNUSED int argc, char *argv[])
{
{
unsigned
start
,
end
;
unsigned
start
,
end
;
int
to
;
int
to
;
enum
playlist_result
result
;
if
(
!
check_range
(
client
,
&
start
,
&
end
,
argv
[
1
]))
if
(
!
check_range
(
client
,
&
start
,
&
end
,
argv
[
1
]))
return
COMMAND_RETURN_ERROR
;
return
COMMAND_RETURN_ERROR
;
if
(
!
check_int
(
client
,
&
to
,
argv
[
2
]))
if
(
!
check_int
(
client
,
&
to
,
argv
[
2
]))
return
COMMAND_RETURN_ERROR
;
return
COMMAND_RETURN_ERROR
;
result
=
playlist_move_range
(
&
client
->
playlist
,
client
->
player_control
,
start
,
end
,
to
);
enum
playlist_result
result
=
client
->
partition
.
MoveRange
(
start
,
end
,
to
);
return
print_playlist_result
(
client
,
result
);
return
print_playlist_result
(
client
,
result
);
}
}
...
@@ -358,14 +336,12 @@ handle_moveid(Client *client, G_GNUC_UNUSED int argc, char *argv[])
...
@@ -358,14 +336,12 @@ handle_moveid(Client *client, G_GNUC_UNUSED int argc, char *argv[])
{
{
unsigned
id
;
unsigned
id
;
int
to
;
int
to
;
enum
playlist_result
result
;
if
(
!
check_unsigned
(
client
,
&
id
,
argv
[
1
]))
if
(
!
check_unsigned
(
client
,
&
id
,
argv
[
1
]))
return
COMMAND_RETURN_ERROR
;
return
COMMAND_RETURN_ERROR
;
if
(
!
check_int
(
client
,
&
to
,
argv
[
2
]))
if
(
!
check_int
(
client
,
&
to
,
argv
[
2
]))
return
COMMAND_RETURN_ERROR
;
return
COMMAND_RETURN_ERROR
;
result
=
playlist_move_id
(
&
client
->
playlist
,
client
->
player_control
,
enum
playlist_result
result
=
client
->
partition
.
MoveId
(
id
,
to
);
id
,
to
);
return
print_playlist_result
(
client
,
result
);
return
print_playlist_result
(
client
,
result
);
}
}
...
@@ -373,14 +349,14 @@ enum command_return
...
@@ -373,14 +349,14 @@ enum command_return
handle_swap
(
Client
*
client
,
G_GNUC_UNUSED
int
argc
,
char
*
argv
[])
handle_swap
(
Client
*
client
,
G_GNUC_UNUSED
int
argc
,
char
*
argv
[])
{
{
unsigned
song1
,
song2
;
unsigned
song1
,
song2
;
enum
playlist_result
result
;
if
(
!
check_unsigned
(
client
,
&
song1
,
argv
[
1
]))
if
(
!
check_unsigned
(
client
,
&
song1
,
argv
[
1
]))
return
COMMAND_RETURN_ERROR
;
return
COMMAND_RETURN_ERROR
;
if
(
!
check_unsigned
(
client
,
&
song2
,
argv
[
2
]))
if
(
!
check_unsigned
(
client
,
&
song2
,
argv
[
2
]))
return
COMMAND_RETURN_ERROR
;
return
COMMAND_RETURN_ERROR
;
result
=
playlist_swap_songs
(
&
client
->
playlist
,
client
->
player_control
,
song1
,
song2
);
enum
playlist_result
result
=
client
->
partition
.
SwapPositions
(
song1
,
song2
);
return
print_playlist_result
(
client
,
result
);
return
print_playlist_result
(
client
,
result
);
}
}
...
@@ -388,14 +364,12 @@ enum command_return
...
@@ -388,14 +364,12 @@ enum command_return
handle_swapid
(
Client
*
client
,
G_GNUC_UNUSED
int
argc
,
char
*
argv
[])
handle_swapid
(
Client
*
client
,
G_GNUC_UNUSED
int
argc
,
char
*
argv
[])
{
{
unsigned
id1
,
id2
;
unsigned
id1
,
id2
;
enum
playlist_result
result
;
if
(
!
check_unsigned
(
client
,
&
id1
,
argv
[
1
]))
if
(
!
check_unsigned
(
client
,
&
id1
,
argv
[
1
]))
return
COMMAND_RETURN_ERROR
;
return
COMMAND_RETURN_ERROR
;
if
(
!
check_unsigned
(
client
,
&
id2
,
argv
[
2
]))
if
(
!
check_unsigned
(
client
,
&
id2
,
argv
[
2
]))
return
COMMAND_RETURN_ERROR
;
return
COMMAND_RETURN_ERROR
;
result
=
playlist_swap_songs_id
(
&
client
->
playlist
,
client
->
player_control
,
enum
playlist_result
result
=
client
->
partition
.
SwapIds
(
id1
,
id2
);
id1
,
id2
);
return
print_playlist_result
(
client
,
result
);
return
print_playlist_result
(
client
,
result
);
}
}
src/UpdateRemove.cxx
View file @
52638c68
...
@@ -64,9 +64,7 @@ song_remove_event(void)
...
@@ -64,9 +64,7 @@ song_remove_event(void)
sticker_song_delete
(
removed_song
);
sticker_song_delete
(
removed_song
);
#endif
#endif
playlist_delete_song
(
&
global_partition
->
playlist
,
global_partition
->
DeleteSong
(
*
removed_song
);
&
global_partition
->
pc
,
removed_song
);
/* clear "removed_song" and send signal to update thread */
/* clear "removed_song" and send signal to update thread */
g_mutex_lock
(
remove_mutex
);
g_mutex_lock
(
remove_mutex
);
...
...
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