Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Rockbox mail archive

Subject: Re: favorites list
From: Jerome Kuptz (jerome_at_geekrox.com)
Date: 2003-02-03


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
@@ -53,6 +53,59 @@
 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)
 {
@@ -575,15 +628,16 @@
 
                 /* 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
@@ -759,17 +813,22 @@
                     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;
@@ -796,7 +855,6 @@
                     }
                 }
                 break;
-
                 /* volume up */
 #ifdef HAVE_RECORDER_KEYPAD
             case BUTTON_UP:



Page was last modified "Jan 10 2012" The Rockbox Crew
aaa