mirror of
https://git.wetfence.xyz/RandyTheSilly/jellyPod.git
synced 2026-10-26 23:39:56 -04:00
Redesign Jellyfin API data operations
This commit is contained in:
1 parent
79045d8b4b
commit
f7b4805ba1
2 files changed
+50
-72
No files matched your search
+11
-26
@@ -4,13 +4,10 @@
|
||||
|
||||
typedef enum {
|
||||
NAV_SCOPE_MAIN = 0,
|
||||
NAV_SCOPE_ALPHA = 1,
|
||||
NAV_SCOPE_SEARCH = 1,
|
||||
NAV_SCOPE_ARTISTS = 2,
|
||||
NAV_SCOPE_ALBUMS = 3,
|
||||
NAV_SCOPE_ALBUM_TRACKS = 4,
|
||||
NAV_SCOPE_PLAYLISTS = 5,
|
||||
NAV_SCOPE_PLAYLIST_TRACKS = 6,
|
||||
NAV_SCOPE_NOW_PLAYING = 7
|
||||
} NavScope;
|
||||
|
||||
// layer-age
|
||||
@@ -40,7 +37,7 @@ static GFont s_font_chicago;
|
||||
#endif
|
||||
#endif
|
||||
static const GRect s_menu_grect = GRect(MARGIN_X, BAR_HEIGHT + MARGIN_Y, PBL_DISPLAY_WIDTH - (MARGIN_X * 2), PBL_DISPLAY_HEIGHT - (MARGIN_Y * 2));
|
||||
static const char *s_main_menu_options[3] = {"Artists", "Playlists", "Now Playing"};
|
||||
static const char *s_main_menu_options[4] = {"Shuffle Songs", "Shuffle Artists", "> All Artists", "> Search Artists"};
|
||||
|
||||
////////////////////// PKJS //////////////////////
|
||||
|
||||
@@ -52,7 +49,7 @@ static void inbox_received_handler(DictionaryIterator *iter, void *context) {
|
||||
}
|
||||
}
|
||||
|
||||
static void to_pkjs_scope_change(NavScope scope, const char *jfId, bool shuffleInScope) {
|
||||
static void to_pkjs_scope_change(NavScope scope) {
|
||||
if (!s_pkjs_ready) {
|
||||
return;
|
||||
}
|
||||
@@ -65,16 +62,6 @@ static void to_pkjs_scope_change(NavScope scope, const char *jfId, bool shuffleI
|
||||
}
|
||||
dict_write_uint8(out, MESSAGE_KEY_OUT_MENU_NAV_SCOPE, scope);
|
||||
|
||||
if (shuffleInScope) {
|
||||
// tell PKJS to shuffle if a shuffle option was clicked
|
||||
dict_write_uint8(out, MESSAGE_KEY_OUT_SHUFFLE_MODE, shuffleInScope); // if true, PKJS side shuffles IDs in scope and passes them to JF API
|
||||
} else if (jfId) {
|
||||
// otherwise, send the selected jfId, if present;
|
||||
// for artists/albums/playlists, determines next data set returned to C;
|
||||
// for tracks, starts sequential playback (sequential relative to entire library unless scope is playlist)
|
||||
dict_write_cstring(out, MESSAGE_KEY_OUT_JFID, jfId);
|
||||
}
|
||||
|
||||
result = app_message_outbox_send();
|
||||
if (result != APP_MSG_OK) {
|
||||
return;
|
||||
@@ -84,12 +71,11 @@ static void to_pkjs_scope_change(NavScope scope, const char *jfId, bool shuffleI
|
||||
static uint16_t menu_get_num_rows(MenuLayer *menu_layer, uint16_t section_index, void *context) {
|
||||
switch (s_current_menu_scope) {
|
||||
case NAV_SCOPE_MAIN:
|
||||
return 3;
|
||||
case NAV_SCOPE_ALPHA:
|
||||
return 4;
|
||||
case NAV_SCOPE_SEARCH:
|
||||
case NAV_SCOPE_ARTISTS:
|
||||
case NAV_SCOPE_ALBUMS:
|
||||
case NAV_SCOPE_ALBUM_TRACKS:
|
||||
case NAV_SCOPE_PLAYLISTS:
|
||||
default:
|
||||
return 99;
|
||||
}
|
||||
@@ -100,11 +86,10 @@ static void menu_draw_row(GContext *ctx, const Layer *cell_layer, MenuIndex *cel
|
||||
case NAV_SCOPE_MAIN:
|
||||
custom_menu_cell_title_draw(ctx, cell_layer, s_main_menu_options[cell_index->row], NULL, s_font_chicago, MARGIN_X);
|
||||
break;
|
||||
case NAV_SCOPE_ALPHA:
|
||||
case NAV_SCOPE_SEARCH:
|
||||
case NAV_SCOPE_ARTISTS:
|
||||
case NAV_SCOPE_ALBUMS:
|
||||
case NAV_SCOPE_ALBUM_TRACKS:
|
||||
case NAV_SCOPE_PLAYLISTS:
|
||||
default:
|
||||
return;
|
||||
}
|
||||
@@ -115,20 +100,20 @@ static void menu_select_click(struct MenuLayer *menu_layer, MenuIndex *clicked_i
|
||||
case NAV_SCOPE_MAIN:
|
||||
switch (clicked_index->row) {
|
||||
case 0:
|
||||
to_pkjs_scope_change(NAV_SCOPE_ALPHA, NULL, false);
|
||||
break;
|
||||
case 1:
|
||||
to_pkjs_scope_change(NAV_SCOPE_PLAYLISTS, NULL, false);
|
||||
break;
|
||||
case 2:
|
||||
to_pkjs_scope_change(NAV_SCOPE_ARTISTS);
|
||||
break;
|
||||
default:
|
||||
to_pkjs_scope_change(NAV_SCOPE_NOW_PLAYING, NULL, false); // TODO
|
||||
to_pkjs_scope_change(NAV_SCOPE_SEARCH);
|
||||
}
|
||||
return;
|
||||
case NAV_SCOPE_ALPHA:
|
||||
case NAV_SCOPE_SEARCH:
|
||||
case NAV_SCOPE_ARTISTS:
|
||||
case NAV_SCOPE_ALBUMS:
|
||||
case NAV_SCOPE_ALBUM_TRACKS:
|
||||
case NAV_SCOPE_PLAYLISTS:
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user