From: Francois B <mrs...@us...> - 2004-08-23 03:37:10
|
Update of /cvsroot/openneo/openneo/apps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15678 Modified Files: playlist.h playlist.c Log Message: Playlist code is being replaced with the DJ. This file is still usefull for the bookmarks Index: playlist.c =================================================================== RCS file: /cvsroot/openneo/openneo/apps/playlist.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** playlist.c 20 Jul 2004 23:27:31 -0000 1.13 --- playlist.c 23 Aug 2004 03:36:57 -0000 1.14 *************** *** 100,103 **** --- 100,105 ---- #include "lang.h" #include "flags.h" + #include "dir_buffer.h" + static struct playlist_info playlist; *************** *** 177,229 **** } - int do_clear_playlist(struct do_params* params) - { - (void)params; - mpeg_stop(); - playlist_create( 0, 0 ); - return 0; - } - - int do_next_track(struct do_params* params) - { - (void)params; - mpeg_next(); - return 0; - } - - int do_prev_track(struct do_params* params) - { (void)params; - mpeg_prev(); - return 0; - } - - int do_change_playlist_shuffle(struct do_params* params) - { - return settings_change_bool( params->flags, &global_settings.playlist_shuffle, str(LANG_SHUFFLE), NULL ); - } - - int do_change_playlist_repeat(struct do_params* params) - { - int rc; - int old_repeat; - char* names[] = { str(LANG_OFF), - str(LANG_REPEAT_ALL), - str(LANG_REPEAT_ONE) }; - - old_repeat = global_settings.repeat_mode; - - rc = settings_change_options( params->flags, &global_settings.repeat_mode, str(LANG_REPEAT), names, 3, NULL ); - - if (old_repeat != global_settings.repeat_mode) - mpeg_flush_and_reload_tracks(); - - return rc; - } - #ifdef VOICE void playlist_voice_mode( bool mode ) { ! if( !global_settings.voice_on || (current_status.voice_mode == mode) ) return; --- 179,187 ---- } #ifdef VOICE void playlist_voice_mode( bool mode ) { ! if( !global_settings.voice || (current_status.voice_mode == mode) ) return; *************** *** 258,262 **** } ! mpeg_register_callbacks( playlist_check, on_get_next_track, playlist_next, on_playing ); mpeg_play(current_status.offset, rollback, true); } --- 216,220 ---- } ! mpeg_register_callbacks( playlist_check, on_get_next_track, playlist_next ); mpeg_play(current_status.offset, rollback, true); } *************** *** 278,282 **** } ! /* Called by the mpeg driver often with the new elapsed time/frames */ void on_playing( void ) { --- 236,240 ---- } ! /* Called by the mpeg driver often */ void on_playing( void ) { *************** *** 573,582 **** int button; int insert_pos; ! struct browse_item* items; unsigned int attr; /* use the tree browser dircache to load files */ ! num_files = load_dir(dirname, SHOW_MUSIC); ! items = browse_get_items(); if( !num_files ) --- 531,540 ---- int button; int insert_pos; ! struct dir_item* items; unsigned int attr; /* use the tree browser dircache to load files */ ! num_files = dir_buffer_load(dirname, SHOW_MUSIC); ! items = dir_buffer_items(); if( !num_files ) *************** *** 599,605 **** attr = GET_ATTRIBUTES(items[i].offset_attr); ! buffer_filepath(GET_OFFSET(items[i].offset_attr), buf ); ! if( attr == BROWSE_ATTR_DIR ) { if( !recurse ) --- 557,563 ---- attr = GET_ATTRIBUTES(items[i].offset_attr); ! dir_buffer_get_filepath(GET_OFFSET(items[i].offset_attr), buf, MAX_PATH ); ! if( attr == DIR_ATTR_DIR ) { if( !recurse ) *************** *** 611,615 **** /* we now need to reload our current directory */ ! num_files = load_dir( dirname, SHOW_MUSIC ); } else { --- 569,573 ---- /* we now need to reload our current directory */ ! num_files = dir_buffer_load( dirname, SHOW_MUSIC ); } else { *************** *** 2176,2282 **** } - /* save the current dynamic playlist to specified file */ - int playlist_save(char *filename) - { - int fd; - int i, index; - int count = 0; - char tmp_buf[MAX_PATH+1]; - int result = 0; - - if (playlist.control_fd < 0) - { - msg_error( str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); - return -1; - } - - if (playlist.amount <= 0) - return -1; - - /* use current working directory as base for pathname */ - if (format_track_path(tmp_buf, filename, sizeof(tmp_buf), - strlen(filename)+1, getcwd(NULL, -1)) < 0) - return -1; - - fd = fopen(tmp_buf, O_CREAT|O_WRONLY|O_TRUNC); - if (fd < 0) - { - msg_error( str(LANG_PLAYLIST_ACCESS_ERROR)); - return -1; - } - - display_playlist_count(count, str(LANG_PLAYLIST_SAVE_COUNT)); - - index = playlist.first_index; - for (i=0; i<playlist.amount; i++) - { - bool control_file; - bool queue; - int seek; - int button; - - /* user abort */ - button=button_get(false); - button &= ~BUTTON_IR; - if(button == BUTTON_STOP) - break; - - control_file = playlist.indices[index] & PLAYLIST_INSERT_TYPE_MASK; - queue = playlist.indices[index] & PLAYLIST_QUEUE_MASK; - seek = playlist.indices[index] & PLAYLIST_SEEK_MASK; - - /* Don't save queued files */ - if (!queue) - { - if (get_filename(seek, control_file, tmp_buf, MAX_PATH+1) < 0) - { - result = -1; - break; - } - - if (fprintf(fd, "%s\n", tmp_buf) < 0) - { - msg_error( str(LANG_PLAYLIST_CONTROL_UPDATE_ERROR)); - result = -1; - break; - } - - count++; - - if ((count%PLAYLIST_DISPLAY_COUNT) == 0) - display_playlist_count(count, str(LANG_PLAYLIST_SAVE_COUNT)); - - yield(); - } - - index = (index+1)%playlist.amount; - } - - display_playlist_count(count, str(LANG_PLAYLIST_SAVE_COUNT)); - - fclose(fd); - - return result; - } - - #define DEFAULT_PLAYLIST_NAME "/dynamic.m3u" - - - int do_save_playlist( struct do_params* params ) - { - char filename[MAX_PATH+1]; - - (void)params; - - strncpy( filename, DEFAULT_PLAYLIST_NAME, sizeof(filename) ); - - if( kbd_input(&filename[1], sizeof(filename)-1) != 0 ) - { - playlist_save(filename); - - /* reload in case playlist_save changed cwd */ - browse_queue_reload(); - } - - return FLAGS_REDRAW_ALL; - } --- 2134,2135 ---- Index: playlist.h =================================================================== RCS file: /cvsroot/openneo/openneo/apps/playlist.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** playlist.h 26 Jun 2004 14:58:22 -0000 1.7 --- playlist.h 23 Aug 2004 03:36:57 -0000 1.8 *************** *** 149,158 **** ! int do_clear_playlist(struct do_params* params); ! int do_save_playlist( struct do_params* params ); ! int do_next_track(struct do_params* params); ! int do_prev_track(struct do_params* params); ! int do_change_playlist_shuffle(struct do_params* params); ! int do_change_playlist_repeat(struct do_params* params); #endif /* __PLAYLIST_H__ */ --- 149,154 ---- ! ! #endif /* __PLAYLIST_H__ */ |