mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-27 07:35:57 -05:00
Fix DAAP songlist generation after code move to dmap_common
Handling of the sort tags was left into httpd_daap.c where the code runs after the song is added to the songlist - effectively adding the sort tags to the *next* song, leading to incorrect sort tags on the current song.
This commit is contained in:
parent
49a9ff64dc
commit
a70a45d925
@ -369,7 +369,7 @@ dmap_send_error(struct evhttp_request *req, char *container, char *errmsg)
|
||||
|
||||
|
||||
int
|
||||
dmap_encode_file_metadata(struct evbuffer *songlist, struct evbuffer *song, struct db_media_file_info *dbmfi, const struct dmap_field **meta, int nmeta, int force_wav)
|
||||
dmap_encode_file_metadata(struct evbuffer *songlist, struct evbuffer *song, struct db_media_file_info *dbmfi, const struct dmap_field **meta, int nmeta, int sort_tags, int force_wav)
|
||||
{
|
||||
const struct dmap_field_map *dfm;
|
||||
const struct dmap_field *df;
|
||||
@ -479,6 +479,17 @@ dmap_encode_file_metadata(struct evbuffer *songlist, struct evbuffer *song, stru
|
||||
DPRINTF(E_DBG, L_DAAP, "Done with meta tag %s (%s)\n", df->desc, *strval);
|
||||
}
|
||||
|
||||
if (sort_tags)
|
||||
{
|
||||
dmap_add_string(song, "assn", dbmfi->title_sort);
|
||||
dmap_add_string(song, "assa", dbmfi->artist_sort);
|
||||
dmap_add_string(song, "assu", dbmfi->album_sort);
|
||||
dmap_add_string(song, "assl", dbmfi->album_artist_sort);
|
||||
|
||||
if (dbmfi->composer_sort)
|
||||
dmap_add_string(song, "assc", dbmfi->composer_sort);
|
||||
}
|
||||
|
||||
val = 0;
|
||||
if (want_mikd)
|
||||
val += 9;
|
||||
|
@ -79,6 +79,6 @@ dmap_send_error(struct evhttp_request *req, char *container, char *errmsg);
|
||||
|
||||
|
||||
int
|
||||
dmap_encode_file_metadata(struct evbuffer *songlist, struct evbuffer *song, struct db_media_file_info *dbmfi, const struct dmap_field **meta, int nmeta, int force_wav);
|
||||
dmap_encode_file_metadata(struct evbuffer *songlist, struct evbuffer *song, struct db_media_file_info *dbmfi, const struct dmap_field **meta, int nmeta, int sort_tags, int force_wav);
|
||||
|
||||
#endif /* !__DMAP_HELPERS_H__ */
|
||||
|
@ -1046,7 +1046,7 @@ daap_reply_songlist_generic(struct evhttp_request *req, struct evbuffer *evbuf,
|
||||
|
||||
transcode = transcode_needed(req->input_headers, dbmfi.codectype);
|
||||
|
||||
ret = dmap_encode_file_metadata(songlist, song, &dbmfi, meta, nmeta, transcode);
|
||||
ret = dmap_encode_file_metadata(songlist, song, &dbmfi, meta, nmeta, 1, transcode);
|
||||
if (ret < 0)
|
||||
{
|
||||
DPRINTF(E_LOG, L_DAAP, "Failed to encode song metadata\n");
|
||||
@ -1055,15 +1055,6 @@ daap_reply_songlist_generic(struct evhttp_request *req, struct evbuffer *evbuf,
|
||||
break;
|
||||
}
|
||||
|
||||
/* Always include sort tags */
|
||||
dmap_add_string(song, "assn", dbmfi.title_sort);
|
||||
dmap_add_string(song, "assa", dbmfi.artist_sort);
|
||||
dmap_add_string(song, "assu", dbmfi.album_sort);
|
||||
dmap_add_string(song, "assl", dbmfi.album_artist_sort);
|
||||
|
||||
if (dbmfi.composer_sort)
|
||||
dmap_add_string(song, "assc", dbmfi.composer_sort);
|
||||
|
||||
if (sort_headers)
|
||||
{
|
||||
ret = daap_sort_build(sctx, dbmfi.title_sort);
|
||||
|
@ -818,7 +818,7 @@ raop_metadata_prepare(int id, uint64_t rtptime)
|
||||
goto out_query;
|
||||
}
|
||||
|
||||
ret = dmap_encode_file_metadata(rmd->metadata, tmp, &dbmfi, NULL, 0, 1);
|
||||
ret = dmap_encode_file_metadata(rmd->metadata, tmp, &dbmfi, NULL, 0, 0, 1);
|
||||
evbuffer_free(tmp);
|
||||
if (ret < 0)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user