static OpusTags * tags_list(DB_playItem_t *it, OggOpusFile *opusfile, int link) { const OpusTags *orig = op_tags (opusfile, link); OpusTags *tags = calloc (1, sizeof (OpusTags)); if (!tags) return NULL; deadbeef->pl_lock (); for (DB_metaInfo_t *m = deadbeef->pl_get_metadata_head (it); m; m = m->next) { if (strchr (":!_", m->key[0])) { break; } char *key = strdupa (m->key); if (!strcasecmp(key, "R128_TRACK_GAIN")) { continue; } split_tag (tags, oggedit_map_tag (key, "meta2tag"), m->value, m->valuesize); } deadbeef->pl_unlock (); // preserve album art int i = 0; const char *tag; while ((tag = opus_tags_query(orig, ALBUM_ART_KEY, i++))) { split_tag (tags, ALBUM_ART_KEY, tag, (int)strlen (tag) + 1); } return tags; }
static FileTags GetOpusFileTags(OggOpusFile *of) //---------------------------------------------- { FileTags tags; const OpusTags *ot = op_tags(of, -1); if(!ot) { return tags; } tags.encoder = UStringFromOpus(opus_tags_query(ot, "ENCODER", 0)); tags.title = UStringFromOpus(opus_tags_query(ot, "TITLE", 0)); tags.comments = UStringFromOpus(opus_tags_query(ot, "DESCRIPTION", 0)); tags.bpm = UStringFromOpus(opus_tags_query(ot, "BPM", 0)); // non-standard tags.artist = UStringFromOpus(opus_tags_query(ot, "ARTIST", 0)); tags.album = UStringFromOpus(opus_tags_query(ot, "ALBUM", 0)); tags.trackno = UStringFromOpus(opus_tags_query(ot, "TRACKNUMBER", 0)); tags.year = UStringFromOpus(opus_tags_query(ot, "DATE", 0)); tags.url = UStringFromOpus(opus_tags_query(ot, "CONTACT", 0)); tags.genre = UStringFromOpus(opus_tags_query(ot, "GENRE", 0)); return tags; }