static void visitTag(struct client *client, struct strset *set, struct song *song, enum tag_type tagType) { struct tag *tag = song->tag; bool found = false; if (tagType == LOCATE_TAG_FILE_TYPE) { song_print_uri(client, song); return; } if (!tag) return; for (unsigned i = 0; i < tag->num_items; i++) { if (tag->items[i]->type == tagType) { strset_add(set, tag->items[i]->value); found = true; } } if (!found) strset_add(set, ""); }
static int printSongInDirectory(struct song *song, G_GNUC_UNUSED void *data) { struct client *client = data; song_print_uri(client, song); return 0; }
static bool print_visitor_song(struct song *song, void *data, G_GNUC_UNUSED GError **error_r) { struct client *client = data; song_print_uri(client, song); return true; }
void queue_print_uris(struct client *client, const struct queue *queue, unsigned start, unsigned end) { assert(start <= end); assert(end <= queue_length(queue)); for (unsigned i = start; i < end; ++i) { client_printf(client, "%i:", i); song_print_uri(client, queue_get(queue, i)); } }
void song_print_info(struct client *client, struct song *song) { song_print_uri(client, song); if (song->end_ms > 0) client_printf(client, "Range: %u.%03u-%u.%03u\n", song->start_ms / 1000, song->start_ms % 1000, song->end_ms / 1000, song->end_ms % 1000); else if (song->start_ms > 0) client_printf(client, "Range: %u.%03u-\n", song->start_ms / 1000, song->start_ms % 1000); if (song->mtime > 0) { #ifndef G_OS_WIN32 struct tm tm; #endif const struct tm *tm2; #ifdef G_OS_WIN32 tm2 = gmtime(&song->mtime); #else tm2 = gmtime_r(&song->mtime, &tm); #endif if (tm2 != NULL) { char timestamp[32]; strftime(timestamp, sizeof(timestamp), #ifdef G_OS_WIN32 "%Y-%m-%dT%H:%M:%SZ", #else "%FT%TZ", #endif tm2); client_printf(client, "Last-Modified: %s\n", timestamp); } } if (song->tag) tag_print(client, song->tag); }