Repository navigation
Check only title in track title replacement - #1281
Conversation
|
@flyingmutant |
|
Can you please explain why is this change required? |
|
Normally if a track doesn't have tags then |
Sure. When I was doing something with playerctl, tracks that had no title tag just gave nothing. So I looked at the code and found that the title would be filled in with the filename if there was no title tag, but that didn't show in the metadata that playerctl gave me. So I deleted that bit in the PR, and it actually gave me the filename in the metadata. I didn't really understand what the condition was there for, but now @gavtroy is telling me that it breaks something when removed. I guess this could also be done in mpris.c without breaking something? if (ti->title) {
char corrected[u_str_print_size(ti->title)];
u_to_utf8(corrected, ti->title);
CK(mpris_msg_append_ss_dict(reply,
"xesam:title", corrected));
} |
|
@gavtroy What do you think of this? mpris.c #include "path.h"
...
if (ti->title) {
char corrected[u_str_print_size(ti->title)];
u_to_utf8(corrected, ti->title);
CK(mpris_msg_append_ss_dict(reply,
"xesam:title", corrected));
}else{
char corrected[u_str_print_size(path_basename(ti->filename))];
u_to_utf8(corrected, path_basename(ti->filename));
CK(mpris_msg_append_ss_dict(reply,
"xesam:title", corrected));
} |
|
With spaces around the else tidied up, looks good to me. |
|
@flyingmutant now gavtroy approves, can this be put in? |
We only need to check if title is null to replace it with the filename in the track info.