2002-06-25 09:09:45 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2002 Jerome Kuptz
|
|
|
|
*
|
|
|
|
* All files in this archive are subject to the GNU General Public License.
|
|
|
|
* See the file COPYING in the source tree root for full license agreement.
|
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
2002-06-25 08:58:11 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#include "file.h"
|
|
|
|
#include "lcd.h"
|
|
|
|
#include "button.h"
|
|
|
|
#include "kernel.h"
|
|
|
|
#include "tree.h"
|
|
|
|
#include "debug.h"
|
|
|
|
#include "sprintf.h"
|
|
|
|
#include "settings.h"
|
|
|
|
#include "wps.h"
|
|
|
|
|
|
|
|
|
|
|
|
#define LINE_Y 1 /* initial line */
|
|
|
|
|
|
|
|
#define PLAY_DISPLAY_DEFAULT 0
|
|
|
|
#define PLAY_DISPLAY_FILENAME_SCROLL 1
|
|
|
|
#define PLAY_DISPLAY_TRACK_TITLE 2
|
|
|
|
|
|
|
|
/* demonstrates showing different formats from playtune */
|
|
|
|
void wps_show_play(char* filename)
|
|
|
|
{
|
2002-06-25 09:09:45 +00:00
|
|
|
char buffer[256];
|
|
|
|
mp3entry mp3;
|
|
|
|
mp3info(&mp3,filename);
|
2002-06-25 08:58:11 +00:00
|
|
|
|
2002-06-25 09:09:45 +00:00
|
|
|
snprintf(buffer,sizeof(buffer), "%s", mp3.path);
|
2002-06-25 08:58:11 +00:00
|
|
|
|
2002-06-25 09:09:45 +00:00
|
|
|
lcd_clear_display();
|
2002-06-25 08:58:11 +00:00
|
|
|
|
2002-06-25 09:09:45 +00:00
|
|
|
switch (global_settings.wps_display)
|
|
|
|
{
|
|
|
|
case PLAY_DISPLAY_TRACK_TITLE:
|
|
|
|
{
|
|
|
|
char ch = '/';
|
|
|
|
char* end;
|
|
|
|
char* szDelimit;
|
|
|
|
char szArtist[32];
|
2002-06-25 08:58:11 +00:00
|
|
|
|
2002-06-25 09:09:45 +00:00
|
|
|
char* szTok = strtok_r(buffer, "/", &end);
|
|
|
|
szTok = strtok_r(NULL, "/", &end);
|
2002-06-25 08:58:11 +00:00
|
|
|
|
2002-06-25 09:09:45 +00:00
|
|
|
/* Assume path format of: Genre/Artist/Album/Mp3_file */
|
|
|
|
strncpy(szArtist,szTok,sizeof(szArtist));
|
|
|
|
szArtist[sizeof(szArtist)-1] = 0;
|
|
|
|
szDelimit = strrchr(buffer, ch);
|
2002-06-25 08:58:11 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_LCD_BITMAP
|
2002-06-25 09:09:45 +00:00
|
|
|
lcd_puts(0,0, szArtist?szArtist:"<nothing>");
|
|
|
|
lcd_puts_scroll(0,LINE_Y,(++szDelimit));
|
2002-06-25 08:58:11 +00:00
|
|
|
#else
|
2002-06-25 09:09:45 +00:00
|
|
|
lcd_puts(0,0, szArtist?szArtist:"<nothing>");
|
|
|
|
lcd_puts_scroll(0,1,(++szDelimit));
|
2002-06-25 08:58:11 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2002-06-25 09:09:45 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case PLAY_DISPLAY_FILENAME_SCROLL:
|
|
|
|
{
|
|
|
|
int ch = '/';
|
|
|
|
char* szLast = strrchr(buffer, ch);
|
|
|
|
|
|
|
|
if (szLast)
|
|
|
|
{
|
|
|
|
lcd_puts_scroll(0,0, (++szLast));
|
|
|
|
} else {
|
|
|
|
lcd_puts_scroll(0,0, buffer);
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case PLAY_DISPLAY_DEFAULT:
|
|
|
|
{
|
2002-06-25 08:58:11 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
2002-06-25 09:09:45 +00:00
|
|
|
lcd_puts(0, 0, "[id3 info]");
|
|
|
|
lcd_puts(0, LINE_Y, mp3.title?mp3.title:"");
|
|
|
|
lcd_puts(0, LINE_Y+1, mp3.album?mp3.album:"");
|
|
|
|
lcd_puts(0, LINE_Y+2, mp3.artist?mp3.artist:"");
|
2002-06-25 08:58:11 +00:00
|
|
|
|
2002-06-25 09:09:45 +00:00
|
|
|
snprintf(buffer,sizeof(buffer), "%d ms", mp3.length);
|
|
|
|
lcd_puts(0, LINE_Y+3, buffer);
|
2002-06-25 08:58:11 +00:00
|
|
|
|
2002-06-25 09:09:45 +00:00
|
|
|
snprintf(buffer,sizeof(buffer), "%d kbits", mp3.bitrate);
|
2002-06-25 08:58:11 +00:00
|
|
|
|
2002-06-25 09:09:45 +00:00
|
|
|
lcd_puts(0, LINE_Y+4, buffer);
|
2002-06-25 08:58:11 +00:00
|
|
|
|
2002-06-25 09:09:45 +00:00
|
|
|
snprintf(buffer,sizeof(buffer), "%d Hz", mp3.frequency);
|
|
|
|
lcd_puts(0, LINE_Y+5, buffer);
|
2002-06-25 08:58:11 +00:00
|
|
|
#else
|
|
|
|
|
2002-06-25 09:09:45 +00:00
|
|
|
lcd_puts(0, 0, mp3.artist?mp3.artist:"<no artist>");
|
|
|
|
lcd_puts(0, 1, mp3.title?mp3.title:"<no title>");
|
2002-06-25 08:58:11 +00:00
|
|
|
#endif
|
2002-06-25 09:09:45 +00:00
|
|
|
break;
|
|
|
|
}
|
2002-06-25 08:58:11 +00:00
|
|
|
|
2002-06-25 09:09:45 +00:00
|
|
|
}
|
2002-06-25 08:58:11 +00:00
|
|
|
|
|
|
|
lcd_update();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* experimental idea still being sorted out, but want it in the the code tree still so that important playlist info is not forgotten. */
|
|
|
|
#if 0
|
|
|
|
void wps_show_playlist(char* current, playlist_info_t *list)
|
|
|
|
{
|
|
|
|
int ch = '/';
|
|
|
|
char* szLast = strrchr(current, ch);
|
|
|
|
char buf[16];
|
|
|
|
|
|
|
|
buf[15] = 0;
|
|
|
|
|
|
|
|
snprintf(buf, sizeof(buf), "[%d/%d]", list->index, list->amount);
|
|
|
|
|
|
|
|
lcd_clear_display();
|
|
|
|
|
|
|
|
#ifdef HAVE_LCD_BITMAP
|
2002-06-25 09:09:45 +00:00
|
|
|
lcd_puts(0, 0, "[Playlist Mode]");
|
|
|
|
lcd_puts_scroll(0,LINE_Y, (++szLast));
|
|
|
|
lcd_puts(0, LINE_Y+1, buf);
|
2002-06-25 08:58:11 +00:00
|
|
|
#else
|
2002-06-25 09:09:45 +00:00
|
|
|
lcd_puts_scroll(0,0, (++szLast));
|
|
|
|
lcd_puts(0,1,buf);
|
2002-06-25 08:58:11 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2002-06-25 09:09:45 +00:00
|
|
|
lcd_update();
|
2002-06-25 08:58:11 +00:00
|
|
|
}
|
|
|
|
#endif
|