static void decode_txx (Tuple * tuple, const guchar * data, gint size) { gchar * text = decode_text_frame (data, size); if (text == NULL) return; gchar *separator = strchr(text, 0); if (separator == NULL) return; gchar * value = separator + 1; TAGDBG ("TXX: %s = %s.\n", text, value); tuple_associate_string (tuple, -1, text, value); g_free (text); }
static void associate_int (Tuple * tuple, gint field, const gchar * customfield, const guchar * data, gint size) { gchar * text = decode_text_frame (data, size); if (text == NULL || atoi (text) < 1) { g_free (text); return; } if (customfield != NULL) TAGDBG ("Custom field %s = %s.\n", customfield, text); else TAGDBG ("Field %i = %s.\n", field, text); tuple_associate_int (tuple, field, customfield, atoi (text)); g_free (text); }
static void associate_string (Tuple * tuple, int field, const char * customfield, const unsigned char * data, int size) { char * text = decode_text_frame (data, size); if (text == NULL || ! text[0]) { g_free (text); return; } if (customfield != NULL) TAGDBG ("Custom field %s = %s.\n", customfield, text); else TAGDBG ("Field %i = %s.\n", field, text); tuple_set_str (tuple, field, customfield, text); g_free (text); }
static void decode_genre (Tuple * tuple, const guchar * data, gint size) { gint numericgenre; gchar * text = decode_text_frame (data, size); if (text == NULL) return; if (text[0] == '(') numericgenre = atoi (text + 1); else numericgenre = atoi (text); if (numericgenre > 0) { tuple_associate_string(tuple, FIELD_GENRE, NULL, convert_numericgenre_to_text(numericgenre)); return; } tuple_associate_string(tuple, FIELD_GENRE, NULL, text); g_free (text); return; }
static void decode_genre (Tuple * tuple, const unsigned char * data, int size) { int numericgenre; char * text = decode_text_frame (data, size); if (text == NULL) return; if (text[0] == '(') numericgenre = atoi (text + 1); else numericgenre = atoi (text); if (numericgenre > 0) tuple_set_str (tuple, FIELD_GENRE, NULL, convert_numericgenre_to_text (numericgenre)); else tuple_set_str (tuple, FIELD_GENRE, NULL, text); g_free (text); return; }