diff options
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 55 |
1 files changed, 30 insertions, 25 deletions
@@ -258,31 +258,36 @@ int main (int argc, char **argv) { BarUiPrintSong (playlist, curStation->isQuickMix ? PianoFindStationById (ph.stations, playlist->stationId) : NULL); - /* setup artist and song name for scrobbling (playlist - * may be NULL later) */ - WardrobeSongInit (&scrobbleSong); - scrobbleSong.artist = strdup (playlist->artist); - scrobbleSong.title = strdup (playlist->title); - scrobbleSong.album = strdup (playlist->album); - scrobbleSong.started = time (NULL); - - /* setup player */ - memset (&player, 0, sizeof (player)); - - WaitressInit (&player.waith); - WaitressSetUrl (&player.waith, playlist->audioUrl); - - player.gain = playlist->fileGain; - player.audioFormat = playlist->audioFormat; - - /* throw event */ - BarUiStartEventCmd (&settings, "songstart", curStation, - playlist, PIANO_RET_OK); - - /* start player */ - pthread_create (&playerThread, NULL, BarPlayerThread, - &player); - } + + if (playlist->audioUrl == NULL) { + BarUiMsg (MSG_ERR, "Invalid song url.\n"); + } else { + /* setup artist and song name for scrobbling (playlist + * may be NULL later) */ + WardrobeSongInit (&scrobbleSong); + scrobbleSong.artist = strdup (playlist->artist); + scrobbleSong.title = strdup (playlist->title); + scrobbleSong.album = strdup (playlist->album); + scrobbleSong.started = time (NULL); + + /* setup player */ + memset (&player, 0, sizeof (player)); + + WaitressInit (&player.waith); + WaitressSetUrl (&player.waith, playlist->audioUrl); + + player.gain = playlist->fileGain; + player.audioFormat = playlist->audioFormat; + + /* throw event */ + BarUiStartEventCmd (&settings, "songstart", curStation, + playlist, PIANO_RET_OK); + + /* start player */ + pthread_create (&playerThread, NULL, BarPlayerThread, + &player); + } /* end if audioUrl == NULL */ + } /* end if playlist != NULL */ } /* end if curStation != NULL */ } |