UniversalMusicController/metadata.c

40 lines
1010 B
C
Raw Normal View History

2020-05-29 12:21:05 +00:00
#include "metadata.h"
#include <stdio.h>
#include <stdlib.h>
void printSong( struct song_metadata *song ) {
if ( song->title == NULL )
return;
2020-05-29 18:27:46 +00:00
printf( "%s - %s\n", song->title, song->artist );
}
void printMeta( struct song_metadata *song ) {
if ( song->title == NULL )
return;
printf( "TITLE: %s\nALBUM: %s\nARTIST: %s\n", song->title, song->album,
song->artist );
2020-05-29 12:21:05 +00:00
if ( song->year != NULL ) {
2020-05-29 18:27:46 +00:00
printf( "YEAR: %s\n", song->year );
2020-05-29 12:21:05 +00:00
}
2020-05-29 18:27:46 +00:00
printf( "FILE: %s\n", song->file );
2020-05-29 12:21:05 +00:00
if ( song->art_uri != NULL ) {
2020-05-29 18:27:46 +00:00
printf( "ART: %s\n", song->art_uri );
2020-05-29 12:21:05 +00:00
}
}
2020-05-29 18:53:27 +00:00
void freeSong( struct song_metadata *song ) {
free( (void*)song->art_uri );
song->art_uri = NULL;
free( (void*)song->file );
song->file = NULL;
free( (void*)song->year );
song->year = NULL;
free( (void*)song->artist );
song->artist = NULL;
free( (void*)song->album );
song->album = NULL;
free( (void*)song->title );
song->title = NULL;
}