|
Rockbox mail archiveSubject: Re: favorites listRe: favorites list
From: Jerome Kuptz <jerome_at_geekrox.com>
Date: Sun, 02 Feb 2003 17:22:30 -0800 Well here is a more mature patch for this feature (I've sent others). Only works on the player as that is all I have :). It's patched against the latest CVS from Feb 2. Use On + Play while an mp3 is playing in the wps info screen. It builds a playlist of all the files you mark this way. Then if you want to play them just navigate to the root directory and select "favorites.m3u." Yes I will be putting this into cvs eventually. Though I would like if Bjorn/Daniel/Linus or somebody to take a look at how I handled the key combo in wps_show. It works, but I've got this nagging feeling it is just not quite right. enjoy, --jk Matthew P. OReilly wrote: >Done. Thanks for the reminder - since the feature email list was split from >this one, I had since forgotten about the feature comments. > >Thx >Matt > >-----Original Message----- >From: owner-rockbox_at_cool.haxx.se [mailto:owner-rockbox_at_cool.haxx.se]On >Behalf Of Robert Hak >Sent: Tuesday, January 28, 2003 10:50 PM >To: rockbox_at_cool.haxx.se >Subject: RE: favorites list > > > >This is already on the feature request list. Check that and add your >opinion to it. > >On Tue, 28 Jan 2003, Matthew P. OReilly wrote: > > > >yesterday i was playing shuffle mode on the entire drive (app. 4000 songs). >i was thinking that it would be nice to have the option of marking good >ones (or bad ones, for that matter). ><< > >I second this idea... I think that marking bad mp3s is a great thing!! (And >marking favorites is cool, too.) > >Matt > > > >+-- --- --- --- --- --- --- --- --- --- --- --- --- --+ >| Robert E. Hak < http://phobos.ramapo.edu/~rhak > | > >"I don't know where I'm going yet / But I'm getting there." > from "Easy Tonight" by John Ondrasik of Five For Fighting > > > > > Index: wps.c =================================================================== RCS file: /cvsroot/rockbox/apps/wps.c,v retrieving revision 1.173 diff -u -r1.173 wps.c --- wps.c 23 Jan 2003 14:28:16 -0000 1.173 +++ wps.c 3 Feb 2003 01:07:05 -0000 _at__at_ -53,6 +53,59 _at__at_ static struct mp3entry* id3 = NULL; static char current_track_path[MAX_PATH+1]; +#define FAVORITES_FILE "/favorites.m3u" + +bool check_fave_key(void) +{ + bool ret = false; + + switch ( button_get(true) ) { + case BUTTON_ON | BUTTON_PLAY: + ret = true; + save_favorite(); + break; + default: + break; + } + return ret; +} + +bool save_favorite() +{ + bool sucess = false; + int fd, seek, result, len; + + if (!(mpeg_status() & MPEG_STATUS_PLAY)) + return sucess; + + fd = open(FAVORITES_FILE, O_WRONLY); + + // creat the file if it does not return on open. + if (fd < 0) + fd = creat(FAVORITES_FILE, 0); + + if (fd > 0) + { + + len = strlen(current_track_path); + + // seek to the end of file + seek = lseek(fd, 0, SEEK_END); + // append the current mp3 path + current_track_path[len] = '\n'; + result = write(fd, current_track_path, len + 1); + current_track_path[len] = '\0'; + + if (result > 0) + sucess = true; + + close(fd); + } + + return sucess; +} + + #ifdef HAVE_PLAYER_KEYPAD void player_change_volume(int button) { _at__at_ -575,15 +628,16 _at__at_ /* mute */ #ifdef HAVE_PLAYER_KEYPAD - case BUTTON_MENU | BUTTON_PLAY: + case BUTTON_MENU | BUTTON_PLAY: #else case BUTTON_F1 | BUTTON_PLAY: #endif - if ( muted ) - mpeg_sound_set(SOUND_VOLUME, global_settings.volume); + if ( muted ) + mpeg_sound_set(SOUND_VOLUME, global_settings.volume); else mpeg_sound_set(SOUND_VOLUME, 0); muted = !muted; + #ifdef HAVE_LCD_CHARCELLS status_set_param(false); #endif _at__at_ -759,17 +813,22 _at__at_ case 0: /* otherwise, exit to browser */ #else - status_set_record(false); - status_set_audio(false); + if (!check_fave_key() || lastbutton != BUTTON_ON | BUTTON_PLAY) { + status_set_record(false); + status_set_audio(false); + lcd_stop_scroll(); + + /* set dir browser to current playing song */ + if (global_settings.browse_current && + current_track_path[0] != '\0') + set_current_file(current_track_path); + + return 0; + } else { + restore = true; + } + break; #endif - lcd_stop_scroll(); - - /* set dir browser to current playing song */ - if (global_settings.browse_current && - current_track_path[0] != '\0') - set_current_file(current_track_path); - - return 0; #ifdef HAVE_RECORDER_KEYPAD } break; _at__at_ -796,7 +855,6 _at__at_ } } break; - /* volume up */ #ifdef HAVE_RECORDER_KEYPAD case BUTTON_UP: Received on 2003-02-03 Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy |