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: just curious
From: Jerome Kuptz (jerome_at_geekrox.com)
Date: 2003-01-24


Well here is a patch for the player made against current cvs. It puts
the playlist in the root directory as "favorites.m3u". I took over the
Menu + Play combo (normally mute on the player) just to test until I can
dig up a better combo button to use :).

This is not complete, but should demonstrate the feature.

--jk

Jerome Kuptz wrote:

> My only issue is that I don't have a recorder. I could supply a patch
> for ppl to try on the player, but someone else would have to pick a
> key combo for the recorder. We could put it behind menus as well, but
> then that drastically reduces it's usefulness imo.
>
> --jk
>
> Eric Linenberg wrote:
>
>> this sounds awesome. I would love for there to be a favorites.m3u
>> file in the /.rockbox directory or something like that. I download
>> many mp3s from shoutcast and then listen to them as if I am listening
>> to the radio.
>>
>> -eric
>>
>> JK> Awhile back I did a preliminary favorite track(s) marker
>> functionality
>> JK> at the press of a combo button. Since we have file writes I
>> went ahead
>> JK> made it so that a favorites.m3u is created, and each selection is
>> JK> appended to the list. Thus it's very easy to go back later from
>> a large
>> JK> shuffle|playlist and play just the ones you really really like.
>> JK> Panasonic does/did this with their large cd players when they first
>> JK> started coming out.
>>
>> JK> I'm curious if ppl care about this type of feature before I put
>> anymore
>> JK> work into it. I have cvs access and could proceed with furthering
>> JK> development
>> JK> on it (clean up and such), but I would need someone to pick up on
>> the
>> JK> recorder testing/implementation (I don't have one).
>>
>> JK> The feature is described here as well, and was submitted long ago.
>> JK>
>> http://sourceforge.net/tracker/index.php?func=detail&group_id=44306&atid=439121&aid=562120
>>
>> JK> Comments? Thoughts? Useless?
>>
>> JK> --jk
>>
>>
>>
>>
>
>

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 24 Jan 2003 05:32:18 -0000
@@ -53,6 +53,44 @@
 static struct mp3entry* id3 = NULL;
 static char current_track_path[MAX_PATH+1];
 
+#define FAVORITES_FILE "/favorites.m3u"
+
+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);
+ 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 +613,18 @@
 
                 /* mute */
 #ifdef HAVE_PLAYER_KEYPAD
- case BUTTON_MENU | BUTTON_PLAY:
+ case BUTTON_MENU | BUTTON_PLAY:
+ save_favorite();
+ break;
 #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;
+#endif
+
 #ifdef HAVE_LCD_CHARCELLS
                 status_set_param(false);
 #endif
@@ -796,7 +837,6 @@
                     }
                 }
                 break;
-
                 /* volume up */
 #ifdef HAVE_RECORDER_KEYPAD
             case BUTTON_UP:
Index: wps.h
===================================================================
RCS file: /cvsroot/rockbox/apps/wps.h,v
retrieving revision 1.17
diff -u -r1.17 wps.h
--- wps.h 21 Nov 2002 09:32:32 -0000 1.17
+++ wps.h 24 Jan 2003 05:32:18 -0000
@@ -27,6 +27,7 @@
 int wps_show(void);
 bool refresh_wps(bool refresh_scroll);
 void handle_usb(void);
+bool save_favorite(void);
 
 #ifdef HAVE_RECORDER_KEYPAD
 bool f2_screen(void);



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