mirror of
https://github.com/SuperBFG7/ympd
synced 2025-01-10 17:30:35 +00:00
Added more columns also to the search
This commit is contained in:
parent
8b29d44496
commit
df3ba1c04c
@ -344,6 +344,18 @@ char* mpd_get_artist(struct mpd_song const *song)
|
|||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char* mpd_get_year(struct mpd_song const *song)
|
||||||
|
{
|
||||||
|
char *str;
|
||||||
|
|
||||||
|
str = (char *)mpd_song_get_tag(song, MPD_TAG_DATE, 0);
|
||||||
|
if(str == NULL){
|
||||||
|
str = basename((char *)mpd_song_get_uri(song));
|
||||||
|
}
|
||||||
|
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
int mpd_put_state(char *buffer, int *current_song_id, unsigned *queue_version)
|
int mpd_put_state(char *buffer, int *current_song_id, unsigned *queue_version)
|
||||||
{
|
{
|
||||||
struct mpd_status *status;
|
struct mpd_status *status;
|
||||||
@ -495,12 +507,12 @@ int mpd_put_browse(char *buffer, char *path, unsigned int offset)
|
|||||||
song = mpd_entity_get_song(entity);
|
song = mpd_entity_get_song(entity);
|
||||||
cur += json_emit_raw_str(cur, end - cur, "{\"type\":\"song\",\"uri\":");
|
cur += json_emit_raw_str(cur, end - cur, "{\"type\":\"song\",\"uri\":");
|
||||||
cur += json_emit_quoted_str(cur, end - cur, mpd_song_get_uri(song));
|
cur += json_emit_quoted_str(cur, end - cur, mpd_song_get_uri(song));
|
||||||
cur += json_emit_raw_str(cur, end - cur, ",\"duration\":");
|
|
||||||
cur += json_emit_int(cur, end - cur, mpd_song_get_duration(song));
|
|
||||||
cur += json_emit_raw_str(cur, end - cur, ",\"artist\":");
|
|
||||||
cur += json_emit_quoted_str(cur, end - cur, mpd_get_artist(song));
|
|
||||||
cur += json_emit_raw_str(cur, end - cur, ",\"album\":");
|
cur += json_emit_raw_str(cur, end - cur, ",\"album\":");
|
||||||
cur += json_emit_quoted_str(cur, end - cur, mpd_get_album(song));
|
cur += json_emit_quoted_str(cur, end - cur, mpd_get_album(song));
|
||||||
|
cur += json_emit_raw_str(cur, end - cur, ",\"artist\":");
|
||||||
|
cur += json_emit_quoted_str(cur, end - cur, mpd_get_artist(song));
|
||||||
|
cur += json_emit_raw_str(cur, end - cur, ",\"duration\":");
|
||||||
|
cur += json_emit_int(cur, end - cur, mpd_song_get_duration(song));
|
||||||
cur += json_emit_raw_str(cur, end - cur, ",\"title\":");
|
cur += json_emit_raw_str(cur, end - cur, ",\"title\":");
|
||||||
cur += json_emit_quoted_str(cur, end - cur, mpd_get_title(song));
|
cur += json_emit_quoted_str(cur, end - cur, mpd_get_title(song));
|
||||||
cur += json_emit_raw_str(cur, end - cur, "},");
|
cur += json_emit_raw_str(cur, end - cur, "},");
|
||||||
@ -557,6 +569,10 @@ int mpd_search(char *buffer, char *searchstr)
|
|||||||
while((song = mpd_recv_song(mpd.conn)) != NULL) {
|
while((song = mpd_recv_song(mpd.conn)) != NULL) {
|
||||||
cur += json_emit_raw_str(cur, end - cur, "{\"type\":\"song\",\"uri\":");
|
cur += json_emit_raw_str(cur, end - cur, "{\"type\":\"song\",\"uri\":");
|
||||||
cur += json_emit_quoted_str(cur, end - cur, mpd_song_get_uri(song));
|
cur += json_emit_quoted_str(cur, end - cur, mpd_song_get_uri(song));
|
||||||
|
cur += json_emit_raw_str(cur, end - cur, ",\"album\":");
|
||||||
|
cur += json_emit_quoted_str(cur, end - cur, mpd_get_album(song));
|
||||||
|
cur += json_emit_raw_str(cur, end - cur, ",\"artist\":");
|
||||||
|
cur += json_emit_quoted_str(cur, end - cur, mpd_get_artist(song));
|
||||||
cur += json_emit_raw_str(cur, end - cur, ",\"duration\":");
|
cur += json_emit_raw_str(cur, end - cur, ",\"duration\":");
|
||||||
cur += json_emit_int(cur, end - cur, mpd_song_get_duration(song));
|
cur += json_emit_int(cur, end - cur, mpd_song_get_duration(song));
|
||||||
cur += json_emit_raw_str(cur, end - cur, ",\"title\":");
|
cur += json_emit_raw_str(cur, end - cur, ",\"title\":");
|
||||||
|
Loading…
Reference in New Issue
Block a user