From e63e19b50773393064e7a458297b18a835e8b004 Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Thu, 29 Jul 2010 13:23:33 +0000 Subject: [PATCH] Fix Database red, move the cuesheet->token code into the skin engine git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27616 a1c6a512-1295-4272-9138-f99709370657 --- apps/cuesheet.c | 36 -------------------------- apps/cuesheet.h | 5 ---- apps/gui/skin_engine/skin_tokens.c | 38 ++++++++++++++++++++++++++++ apps/gui/skin_engine/wps_internals.h | 3 +++ 4 files changed, 41 insertions(+), 41 deletions(-) diff --git a/apps/cuesheet.c b/apps/cuesheet.c index a262b12d73..a6831fa97d 100644 --- a/apps/cuesheet.c +++ b/apps/cuesheet.c @@ -346,42 +346,6 @@ bool curr_cuesheet_skip(struct cuesheet *cue, int direction, unsigned long curr_ } } -const char *get_cuesheetid3_token(struct wps_token *token, struct mp3entry *id3, - int offset_tracks, char *buf, int buf_size) -{ - struct cuesheet *cue = id3?id3->cuesheet:NULL; - if (!cue || !cue->curr_track) - return NULL; - - struct cue_track_info *track = cue->curr_track; - if (offset_tracks) - { - if (cue->curr_track_idx+offset_tracks < cue->track_count) - track+=offset_tracks; - else - return NULL; - } - switch (token->type) - { - case SKIN_TOKEN_METADATA_ARTIST: - return *track->performer ? track->performer : NULL; - case SKIN_TOKEN_METADATA_COMPOSER: - return *track->songwriter ? track->songwriter : NULL; - case SKIN_TOKEN_METADATA_ALBUM: - return *cue->title ? cue->title : NULL; - case SKIN_TOKEN_METADATA_ALBUM_ARTIST: - return *cue->performer ? cue->performer : NULL; - case SKIN_TOKEN_METADATA_TRACK_TITLE: - return *track->title ? track->title : NULL; - case SKIN_TOKEN_METADATA_TRACK_NUMBER: - snprintf(buf, buf_size, "%d/%d", - cue->curr_track_idx+offset_tracks+1, cue->track_count); - return buf; - default: - return NULL; - } - return NULL; -} #ifdef HAVE_LCD_BITMAP static inline void draw_veritcal_line_mark(struct screen * screen, diff --git a/apps/cuesheet.h b/apps/cuesheet.h index 451fff5dbe..e8d77ca3a9 100644 --- a/apps/cuesheet.h +++ b/apps/cuesheet.h @@ -26,7 +26,6 @@ #include "screens.h" #include "file.h" #include "metadata.h" -#include "skin_engine/skin_tokens.h" #define MAX_NAME 80 /* Max length of information strings */ #define MAX_TRACKS 99 /* Max number of tracks in a cuesheet */ @@ -70,10 +69,6 @@ bool display_cuesheet_content(char* filename); /* finds the index of the current track played within a cuesheet */ int cue_find_current_track(struct cuesheet *cue, unsigned long curpos); -/* Get the id3 fields from the cuesheet */ -const char *get_cuesheetid3_token(struct wps_token *token, struct mp3entry *id3, - int offset_tracks, char *buf, int buf_size); - /* skip to next track in the cuesheet towards "direction" (which is 1 or -1) */ bool curr_cuesheet_skip(struct cuesheet *cue, int direction, unsigned long curr_pos); diff --git a/apps/gui/skin_engine/skin_tokens.c b/apps/gui/skin_engine/skin_tokens.c index c5e1ebc831..a05327907d 100644 --- a/apps/gui/skin_engine/skin_tokens.c +++ b/apps/gui/skin_engine/skin_tokens.c @@ -155,6 +155,42 @@ static int pitch_speed_enum(int range, int32_t val, int32_t normval) } #endif +const char *get_cuesheetid3_token(struct wps_token *token, struct mp3entry *id3, + int offset_tracks, char *buf, int buf_size) +{ + struct cuesheet *cue = id3?id3->cuesheet:NULL; + if (!cue || !cue->curr_track) + return NULL; + + struct cue_track_info *track = cue->curr_track; + if (offset_tracks) + { + if (cue->curr_track_idx+offset_tracks < cue->track_count) + track+=offset_tracks; + else + return NULL; + } + switch (token->type) + { + case SKIN_TOKEN_METADATA_ARTIST: + return *track->performer ? track->performer : NULL; + case SKIN_TOKEN_METADATA_COMPOSER: + return *track->songwriter ? track->songwriter : NULL; + case SKIN_TOKEN_METADATA_ALBUM: + return *cue->title ? cue->title : NULL; + case SKIN_TOKEN_METADATA_ALBUM_ARTIST: + return *cue->performer ? cue->performer : NULL; + case SKIN_TOKEN_METADATA_TRACK_TITLE: + return *track->title ? track->title : NULL; + case SKIN_TOKEN_METADATA_TRACK_NUMBER: + snprintf(buf, buf_size, "%d/%d", + cue->curr_track_idx+offset_tracks+1, cue->track_count); + return buf; + default: + return NULL; + } + return NULL; +} /* All tokens which only need the info to return a value go in here */ const char *get_id3_token(struct wps_token *token, struct mp3entry *id3, @@ -1392,3 +1428,5 @@ const char *get_token_value(struct gui_wps *gwps, return NULL; } } + + diff --git a/apps/gui/skin_engine/wps_internals.h b/apps/gui/skin_engine/wps_internals.h index ec37560e79..f8e025956e 100644 --- a/apps/gui/skin_engine/wps_internals.h +++ b/apps/gui/skin_engine/wps_internals.h @@ -329,6 +329,9 @@ const char *get_token_value(struct gui_wps *gwps, char *buf, int buf_size, int *intval); +/* Get the id3 fields from the cuesheet */ +const char *get_cuesheetid3_token(struct wps_token *token, struct mp3entry *id3, + int offset_tracks, char *buf, int buf_size); const char *get_id3_token(struct wps_token *token, struct mp3entry *id3, char *buf, int buf_size, int limit, int *intval); #if CONFIG_TUNER