From: Francois B <mrs...@us...> - 2004-08-23 03:27:47
|
Update of /cvsroot/openneo/openneo/apps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13158 Modified Files: playlist_viewer.c Log Message: Uses the DJ, option to delete track Index: playlist_viewer.c =================================================================== RCS file: /cvsroot/openneo/openneo/apps/playlist_viewer.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** playlist_viewer.c 9 Jul 2004 22:14:17 -0000 1.12 --- playlist_viewer.c 23 Aug 2004 03:27:06 -0000 1.13 *************** *** 12,18 **** #include <string.h> #include <sprintf.h> ! #include "playlist.h" ! #include "mpeg.h" ! #include "screens.h" #include "settings.h" #include "menu.h" --- 12,17 ---- #include <string.h> #include <sprintf.h> ! #include "kernel.h" ! //#include "screens.h" #include "settings.h" #include "menu.h" *************** *** 22,63 **** #include "list.h" #include "button.h" int playlist_cachesection( struct list* pl, unsigned int start, unsigned int count ) { unsigned int i; ! int len, playlist_start; ! struct playlist_track_info info; char buf[MAX_PATH]; - char* b; int index; ! ! if( (start + count) > (unsigned int) playlist_amount() ) ! count = playlist_amount() - start; ! ! playlist_start = start + (unsigned int)playlist_get_first_index(); for( i=0; i<count; i++ ){ ! index = (playlist_start + i ) % pl->count_total; ! ! if( playlist_get_track_info( index, &info ) < 0){ ! msg_error( "PL Getting Track %d", index ); ! return LIST_EXIT; } ! //Keep filename only ! b = strrchr( info.filename, '/'); ! ! if( b ) ! b++; ! else ! b = info.filename; ! ! len = snprintf( buf, sizeof(buf), "%d %s", start + i+1, b ); //Remove trailing extension ! if (!strcasecmp(&buf[len-4], ".mp3") || ! !strcasecmp(&buf[len-4], ".mp2") || ! !strcasecmp(&buf[len-4], ".mpa")) buf[len-4] = '\0'; --- 21,51 ---- #include "list.h" #include "button.h" + #include "dj.h" int playlist_cachesection( struct list* pl, unsigned int start, unsigned int count ) { unsigned int i; ! int len; char buf[MAX_PATH]; int index; ! char* track; ! ! if( (start + count) > (unsigned int) dj_playlist_count() ) ! count = dj_playlist_count() - start; for( i=0; i<count; i++ ){ ! index = start + i; ! ! track = dj_get_track_name(index); ! if(!track) { ! msg_error("bad track %d", index ); ! return -1; } ! len = snprintf( buf, sizeof(buf), "%d %s", index+1, track ); //Remove trailing extension ! if (!strcasecmp(&buf[len-4], ".mp3") || !strcasecmp(&buf[len-4], ".mp2") || !strcasecmp(&buf[len-4], ".mpa")) buf[len-4] = '\0'; *************** *** 71,74 **** --- 59,64 ---- int playlist_onbutton( struct list* pl, int button, unsigned long index, struct list_item* pitem ) { + (void)pitem; + switch( button ){ *************** *** 76,81 **** if( index != (unsigned long)pl->selected_item ){ ! mpeg_stop(); ! playlist_start( (index + playlist_get_first_index()) % pl->count_total , 0, 0 ); pl->selected_item = (long)index; } --- 66,70 ---- if( index != (unsigned long)pl->selected_item ){ ! dj_play_list( index, 0, 0, false ); pl->selected_item = (long)index; } *************** *** 83,90 **** //Pause ! if( mpeg_status() & MPEG_STATUS_PAUSE ) ! mpeg_resume(); ! else if( mpeg_status() & MPEG_STATUS_PLAY ) ! mpeg_pause(); } return FLAGS_REDRAW_ALL; --- 72,79 ---- //Pause ! if( dj_get_status() == DJ_STATUS_PAUSED ) ! dj_resume(); ! else if( dj_get_status() == DJ_STATUS_PLAYING ) ! dj_pause(); } return FLAGS_REDRAW_ALL; *************** *** 92,96 **** case BUTTON_STOP: ! playlist_stop(); break; --- 81,97 ---- case BUTTON_STOP: ! do_action( DO_STOP, BUTTON_STOP ); ! return LIST_EXIT; ! ! case BUTTON_LEFT: ! ! if( !dj_remove_playlist_track(index ) ) { ! pl->count_total--; ! ! if( pl->count_total == 0 ) ! return LIST_EXIT; ! else ! return LIST_RELOAD_CACHE; ! } break; *************** *** 105,112 **** { unsigned long total; ! long cur_track; int rc = LIST_NO_ERROR; ! if( mpeg_status() & MPEG_STATUS_PAUSE ) pl->selected_cursor = CGRAM6_CHAR; //Pause icon else --- 106,113 ---- { unsigned long total; ! int cur_track; int rc = LIST_NO_ERROR; ! if( dj_get_status() & DJ_STATUS_PAUSED ) pl->selected_cursor = CGRAM6_CHAR; //Pause icon else *************** *** 114,126 **** //Update Total count if required ! total = (unsigned long)playlist_amount(); if( total != pl->count_total ){ pl->count_total = total; ! rc = FLAGS_REDRAW_ALL; } ! if( playlist_isplaying() ) { ! cur_track = (long)playlist_get_display_index()-1; if( cur_track != pl->selected_item ){ --- 115,131 ---- //Update Total count if required ! total = (unsigned long)dj_playlist_count(); if( total != pl->count_total ){ pl->count_total = total; ! ! if( total == 0 ) ! return LIST_EXIT; ! else ! rc = FLAGS_REDRAW_ALL; } ! if( dj_is_playing() == DJ_TYPE_PLAYLIST ) { ! cur_track = dj_get_playing_index(); if( cur_track != pl->selected_item ){ *************** *** 140,144 **** { struct list playlist; ! lcd_set_cgram_bank( CGRAM_BANK_WPS ); --- 145,154 ---- { struct list playlist; ! ! if( dj_playlist_count() == 0 ) { ! msg_splash(HZ, MSG_CENTER|MSG_VCENTER, "Empty playlist" ); ! return state_get_previous(); ! } ! lcd_set_cgram_bank( CGRAM_BANK_WPS ); *************** *** 146,152 **** playlist.cursor = RARROW_CHAR; playlist.selected_cursor = CGRAM5_CHAR; ! playlist.count_total = playlist_amount(); playlist.max_cached = 100; ! playlist.selected_item = playlist_get_display_index() - 1; playlist.p_cachesection = playlist_cachesection; playlist.p_onidle = playlist_onidle; --- 156,162 ---- playlist.cursor = RARROW_CHAR; playlist.selected_cursor = CGRAM5_CHAR; ! playlist.count_total = dj_playlist_count(); playlist.max_cached = 100; ! playlist.selected_item = dj_get_playing_index(); playlist.p_cachesection = playlist_cachesection; playlist.p_onidle = playlist_onidle; |