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
304639c9
Commit
304639c9
authored
Jun 09, 2004
by
Warren Dukes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implmented ID functions, need to implemented id commands
git-svn-id:
https://svn.musicpd.org/mpd/trunk@1407
09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent
1ca828c4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
64 additions
and
1 deletion
+64
-1
playlist.c
src/playlist.c
+64
-1
No files found.
src/playlist.c
View file @
304639c9
...
...
@@ -463,6 +463,32 @@ int playlistInfo(FILE * fp, int song) {
return
0
;
}
# define checkSongId(id) { \
if(id < 0 || id >= PLAYLIST_HASH_MULT*playlist_max_length || \
playlist.idToNum[id] == -1 ) \
{ \
commandError(fp, ACK_ERROR_NO_EXIST, \
"song id doesn't exist: \"%i\"", id); \
return -1; \
} \
}
int
playlistId
(
FILE
*
fp
,
int
id
)
{
int
i
;
int
begin
=
0
;
int
end
=
playlist
.
length
;
if
(
id
>=
0
)
{
checkSongId
(
id
);
begin
=
playlist
.
idToNum
[
id
];
end
=
begin
+
1
;
}
for
(
i
=
begin
;
i
<
end
;
i
++
)
printPlaylistSongInfo
(
fp
,
i
);
return
0
;
}
void
swapSongs
(
int
song1
,
int
song2
)
{
Song
*
sTemp
;
int
iTemp
;
...
...
@@ -634,7 +660,6 @@ int swapSongsInPlaylist(FILE * fp, int song1, int song2) {
"song doesn't exist:
\"
%i
\"
"
,
song2
);
return
-
1
;
}
if
(
playlist_state
==
PLAYLIST_STATE_PLAY
)
{
if
(
playlist
.
queued
>=
0
)
{
...
...
@@ -673,6 +698,14 @@ int swapSongsInPlaylist(FILE * fp, int song1, int song2) {
return
0
;
}
int
swapSongsInPlaylistById
(
FILE
*
fp
,
int
id1
,
int
id2
)
{
checkSongId
(
id1
);
checkSongId
(
id2
);
return
swapSongsInPlaylist
(
fp
,
playlist
.
idToNum
[
id1
],
playlist
.
idToNum
[
id2
]);
}
#define moveSongFromTo(from, to) { \
playlist.idToNum[playlist.numToId[from]] = to; \
playlist.numToId[to] = playlist.numToId[from]; \
...
...
@@ -748,6 +781,12 @@ int deleteFromPlaylist(FILE * fp, int song) {
return
0
;
}
int
deleteFromPlaylistById
(
FILE
*
fp
,
int
id
)
{
checkSongId
(
id
);
return
deleteFromPlaylist
(
fp
,
playlist
.
idToNum
[
id
]);
}
void
deleteASongFromPlaylist
(
Song
*
song
)
{
int
i
;
...
...
@@ -839,6 +878,16 @@ int playPlaylist(FILE * fp, int song, int stopOnError) {
return
playPlaylistOrderNumber
(
fp
,
i
);
}
int
playPlaylistById
(
FILE
*
fp
,
int
id
,
int
stopOnError
)
{
if
(
id
==
-
1
)
{
return
playPlaylist
(
fp
,
id
,
stopOnError
);
}
checkSongId
(
id
);
return
playPlaylist
(
fp
,
playlist
.
idToNum
[
id
],
stopOnError
);
}
void
syncCurrentPlayerDecodeMetadata
()
{
Song
*
songPlayer
=
playerCurrentDecodeSong
();
Song
*
song
;
...
...
@@ -1032,6 +1081,14 @@ int moveSongInPlaylist(FILE * fp, int from, int to) {
return
0
;
}
int
moveSongInPlaylistById
(
FILE
*
fp
,
int
id1
,
int
id2
)
{
checkSongId
(
id1
);
checkSongId
(
id2
);
return
moveSongInPlaylist
(
fp
,
playlist
.
idToNum
[
id1
],
playlist
.
idToNum
[
id2
]);
}
void
orderPlaylist
()
{
int
i
;
...
...
@@ -1398,3 +1455,9 @@ int seekSongInPlaylist(FILE * fp, int song, float time) {
return
playerSeek
(
fp
,
playlist
.
songs
[
playlist
.
order
[
i
]],
time
);
}
int
seekSongInPlaylistById
(
FILE
*
fp
,
int
id
,
float
time
)
{
checkSongId
(
id
);
return
seekSongInPlaylist
(
fp
,
playlist
.
idToNum
[
id
],
time
);
}
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