void play_next(struct info *data) { char errormsg[] = "Next mix not found."; int errn; struct track *t; libvlc_media_t *media; /* Check if we are already on the last track. * If so request a similar mix and continue playing. */ if (data->m->track_count > 0) { if (data->m->track[data->m->track_count-1]->last == TRUE) { errn = search_nextmix(data); if (errn == ERROR) { draw_error(errormsg); data->state = START; return; } } } t = mix_nexttrack(data); if (t == NULL) return; media = libvlc_media_new_location(data->vlc_inst, t->url); if (media == NULL) return; libvlc_media_player_set_media(data->vlc_mp, media); (void)libvlc_media_player_play(data->vlc_mp); libvlc_media_release(media); }
void play_skip(struct info *data) { char errormsg[] = "Skip not allowed."; struct track *t; t = data->m->track[data->m->track_count-1]; if (t == NULL) return; if (t->skip_allowed == TRUE && t->last == FALSE) { play_next(data); } else draw_error(errormsg); }
void play_nextmix(struct info *data) { char errormsg[] = "Next mix not found."; int errn; errn = search_nextmix(data); if (errn == ERROR) { draw_error(errormsg); data->state = START; return; } data->scroll = 0; play_next(data); }
/* DDS????: Display Error */ void display_error(enum error err) { unsigned int language; struct image *bgimage; language = get_language(); fprintf(stderr, "Fatal Error number %d\n", err); exit(-1); /* Draw background if we can, otherwise clear screen */ bgimage = get_message_mayfail(language, MSG_BACKGROUND); if (bgimage) paste_image(0, 0, bgimage); else clear_screen(); /* Use electorate "1" here for the numbers. */ draw_error(get_message_mayfail(language, MSG_ERROR), get_preference_image_mayfail(1, (unsigned int)err), err); }
/* DDS????: Display Error */ void display_error(enum error err) { unsigned int language; struct image *bgimage; language = get_language(); /* Draw background if we can, otherwise clear screen */ bgimage = get_message_mayfail(language, MSG_BACKGROUND); if (bgimage) paste_image(0, 0, bgimage); else clear_screen(); /* Message to tell them */ play_audio(true, get_audio("error.raw")); /* Use electorate "1" here for the numbers. */ draw_error(get_message_mayfail(language, MSG_ERROR), get_preference_image_mayfail(1, (unsigned int)err), err); /* Loop until reset. */ wait_for_reset(); }
void dir_draw() { switch(dir_ui) { case 0: if(dir_fatalerr) fprintf(stderr, "%s.\n", dir_fatalerr); break; case 1: if(dir_fatalerr) fprintf(stderr, "\r%s.\n", dir_fatalerr); else if(dir_output.size) fprintf(stderr, "\r%-55s %8d files /%s", cropstr(dir_curpath, 55), dir_output.items, formatsize(dir_output.size)); else fprintf(stderr, "\r%-65s %8d files", cropstr(dir_curpath, 65), dir_output.items); break; case 2: browse_draw(); if(dir_fatalerr) draw_error(dir_curpath, dir_fatalerr); else draw_progress(); break; } }