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
acf0d141
Commit
acf0d141
authored
Nov 11, 2008
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
playlist: track song metadata changes
When the tag of the current song changes (e.g. a new tag was sent in the stream), update the playlist, so clients pick up the new tag.
parent
81d2076b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
12 deletions
+14
-12
playlist.c
src/playlist.c
+9
-12
playlist.h
src/playlist.h
+5
-0
No files found.
src/playlist.c
View file @
acf0d141
...
...
@@ -830,13 +830,8 @@ enum playlist_result playPlaylistById(int id, int stopOnError)
static
void
syncCurrentPlayerDecodeMetadata
(
void
)
{
struct
song
*
songPlayer
=
playerCurrentDecodeSong
();
struct
song
*
song
;
int
songNum
;
char
path_max_tmp
[
MPD_PATH_MAX
];
if
(
!
songPlayer
)
return
;
if
(
playlist_state
!=
PLAYLIST_STATE_PLAY
)
return
;
...
...
@@ -844,16 +839,18 @@ static void syncCurrentPlayerDecodeMetadata(void)
songNum
=
playlist
.
order
[
playlist
.
current
];
song
=
playlist
.
songs
[
songNum
];
if
(
!
song_is_file
(
song
)
&&
0
==
strcmp
(
song_get_url
(
song
,
path_max_tmp
),
songPlayer
->
url
)
&&
!
tag_equal
(
song
->
tag
,
songPlayer
->
tag
))
{
assert
(
!
song_in_database
(
song
));
if
(
song
!=
playlist
.
prev_song
)
{
/* song change: initialize playlist.prev_{song,tag} */
playlist
.
prev_song
=
song
;
playlist
.
prev_tag
=
song
->
tag
;
}
else
if
(
song
->
tag
!=
playlist
.
prev_tag
)
{
/* tag change: update playlist */
if
(
song
->
tag
)
tag_free
(
song
->
tag
);
song
->
tag
=
tag_dup
(
songPlayer
->
tag
);
playlist
.
songMod
[
songNum
]
=
playlist
.
version
;
incrPlaylistVersion
();
playlist
.
prev_tag
=
song
->
tag
;
}
}
...
...
src/playlist.h
View file @
acf0d141
...
...
@@ -54,6 +54,11 @@ typedef struct _Playlist {
bool
repeat
;
bool
random
;
uint32_t
version
;
/** used by syncCurrentPlayerDecodeMetadata() to detect tag changes */
const
struct
song
*
prev_song
;
/** used by syncCurrentPlayerDecodeMetadata() to detect tag changes */
const
struct
tag
*
prev_tag
;
}
Playlist
;
extern
bool
playlist_saveAbsolutePaths
;
...
...
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