diff options
author | Christian Soffke <christian.soffke@gmail.com> | 2021-12-27 03:36:31 +0100 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2021-12-28 11:06:10 -0500 |
commit | e8b912320561c1178d45eb12cf753be62e40ee73 (patch) | |
tree | 9ee7b3d865864abcbd0d52f4efbc57bf7292c7e3 | |
parent | 7d59bbd170454cf433a8214808d09fb58f3489d2 (diff) | |
download | rockbox-e8b912320561c1178d45eb12cf753be62e40ee73.tar.gz rockbox-e8b912320561c1178d45eb12cf753be62e40ee73.zip |
Database: show song's album in PictureFlow
Adds a 'PictureFlow' command to database context
menus for quickly bringing up the album for a
song in PictureFlow.
Change-Id: I88cd89e93d9418558c698a15fc7fb5d9a90fb262
-rw-r--r-- | apps/onplay.c | 11 | ||||
-rw-r--r-- | apps/plugins/pictureflow/pictureflow.c | 41 | ||||
-rw-r--r-- | apps/plugins/viewers.config | 3 |
3 files changed, 48 insertions, 7 deletions
diff --git a/apps/onplay.c b/apps/onplay.c index c3e1ebec54..aeda39ba14 100644 --- a/apps/onplay.c +++ b/apps/onplay.c | |||
@@ -1586,6 +1586,11 @@ MENUITEM_FUNCTION(list_viewers_item, 0, ID2P(LANG_ONPLAY_OPEN_WITH), | |||
1586 | MENUITEM_FUNCTION(properties_item, MENU_FUNC_USEPARAM, ID2P(LANG_PROPERTIES), | 1586 | MENUITEM_FUNCTION(properties_item, MENU_FUNC_USEPARAM, ID2P(LANG_PROPERTIES), |
1587 | onplay_load_plugin, (void *)"properties", | 1587 | onplay_load_plugin, (void *)"properties", |
1588 | clipboard_callback, Icon_NOICON); | 1588 | clipboard_callback, Icon_NOICON); |
1589 | #ifdef HAVE_TAGCACHE | ||
1590 | MENUITEM_FUNCTION(pictureflow_item, MENU_FUNC_USEPARAM, ID2P(LANG_ONPLAY_PICTUREFLOW), | ||
1591 | onplay_load_plugin, (void *)"pictureflow", | ||
1592 | clipboard_callback, Icon_NOICON); | ||
1593 | #endif | ||
1589 | static bool onplay_add_to_shortcuts(void) | 1594 | static bool onplay_add_to_shortcuts(void) |
1590 | { | 1595 | { |
1591 | shortcuts_add(SHORTCUT_BROWSER, selected_file); | 1596 | shortcuts_add(SHORTCUT_BROWSER, selected_file); |
@@ -1652,7 +1657,8 @@ static int clipboard_callback(int action, | |||
1652 | { | 1657 | { |
1653 | if (((selected_file_attr & FILE_ATTR_MASK) == | 1658 | if (((selected_file_attr & FILE_ATTR_MASK) == |
1654 | FILE_ATTR_AUDIO) && | 1659 | FILE_ATTR_AUDIO) && |
1655 | this_item == &properties_item) | 1660 | (this_item == &properties_item || |
1661 | this_item == &pictureflow_item)) | ||
1656 | return action; | 1662 | return action; |
1657 | return ACTION_EXIT_MENUITEM; | 1663 | return ACTION_EXIT_MENUITEM; |
1658 | } | 1664 | } |
@@ -1751,6 +1757,9 @@ MAKE_ONPLAYMENU( tree_onplay_menu, ID2P(LANG_ONPLAY_MENU_TITLE), | |||
1751 | &set_backdrop_item, | 1757 | &set_backdrop_item, |
1752 | #endif | 1758 | #endif |
1753 | &list_viewers_item, &create_dir_item, &properties_item, | 1759 | &list_viewers_item, &create_dir_item, &properties_item, |
1760 | #ifdef HAVE_TAGCACHE | ||
1761 | &pictureflow_item, | ||
1762 | #endif | ||
1754 | #ifdef HAVE_RECORDING | 1763 | #ifdef HAVE_RECORDING |
1755 | &set_recdir_item, | 1764 | &set_recdir_item, |
1756 | #endif | 1765 | #endif |
diff --git a/apps/plugins/pictureflow/pictureflow.c b/apps/plugins/pictureflow/pictureflow.c index 35afdaf7e4..ec6e51c34d 100644 --- a/apps/plugins/pictureflow/pictureflow.c +++ b/apps/plugins/pictureflow/pictureflow.c | |||
@@ -1613,11 +1613,10 @@ static int get_album_artist_alpha_next_index(void) | |||
1613 | return pf_idx.album_ct - 1; | 1613 | return pf_idx.album_ct - 1; |
1614 | } | 1614 | } |
1615 | 1615 | ||
1616 | static int get_wps_current_index(void) | 1616 | static int id3_get_index(struct mp3entry *id3) |
1617 | { | 1617 | { |
1618 | char* current_artist = UNTAGGED; | 1618 | char* current_artist = UNTAGGED; |
1619 | char* current_album = UNTAGGED; | 1619 | char* current_album = UNTAGGED; |
1620 | struct mp3entry *id3 = rb->audio_current_track(); | ||
1621 | 1620 | ||
1622 | if(id3) | 1621 | if(id3) |
1623 | { | 1622 | { |
@@ -3752,6 +3751,35 @@ static void rb_splash_added_to_playlist(void) | |||
3752 | } | 3751 | } |
3753 | #endif | 3752 | #endif |
3754 | 3753 | ||
3754 | |||
3755 | static void set_initial_slide(const char* selected_file) | ||
3756 | { | ||
3757 | if (selected_file == NULL) | ||
3758 | set_current_slide(id3_get_index(rb->audio_current_track())); | ||
3759 | else | ||
3760 | { | ||
3761 | struct mp3entry id3; | ||
3762 | #if defined(HAVE_TC_RAMCACHE) && defined(HAVE_DIRCACHE) | ||
3763 | if (rb->tagcache_fill_tags(&id3, selected_file)) | ||
3764 | set_current_slide(id3_get_index(&id3)); | ||
3765 | else | ||
3766 | #endif | ||
3767 | { | ||
3768 | int fd = rb->open(selected_file, O_RDONLY); | ||
3769 | if (fd >= 0) | ||
3770 | { | ||
3771 | if (rb->get_metadata(&id3, fd, selected_file)) | ||
3772 | set_current_slide(id3_get_index(&id3)); | ||
3773 | else | ||
3774 | set_current_slide(pf_cfg.last_album); | ||
3775 | rb->close(fd); | ||
3776 | } | ||
3777 | else | ||
3778 | set_current_slide(pf_cfg.last_album); | ||
3779 | } | ||
3780 | } | ||
3781 | } | ||
3782 | |||
3755 | /** | 3783 | /** |
3756 | Display an error message and wait for input. | 3784 | Display an error message and wait for input. |
3757 | */ | 3785 | */ |
@@ -3767,7 +3795,7 @@ static void error_wait(const char *message) | |||
3767 | Main function that also contain the main plasma | 3795 | Main function that also contain the main plasma |
3768 | algorithm. | 3796 | algorithm. |
3769 | */ | 3797 | */ |
3770 | static int pictureflow_main(void) | 3798 | static int pictureflow_main(const char* selected_file) |
3771 | { | 3799 | { |
3772 | int ret = SUCCESS; | 3800 | int ret = SUCCESS; |
3773 | 3801 | ||
@@ -3888,7 +3916,7 @@ static int pictureflow_main(void) | |||
3888 | 3916 | ||
3889 | recalc_offsets(); | 3917 | recalc_offsets(); |
3890 | reset_slides(); | 3918 | reset_slides(); |
3891 | set_current_slide(get_wps_current_index()); | 3919 | set_initial_slide(selected_file); |
3892 | 3920 | ||
3893 | char fpstxt[10]; | 3921 | char fpstxt[10]; |
3894 | int button; | 3922 | int button; |
@@ -4137,11 +4165,12 @@ enum plugin_status plugin_start(const void *parameter) | |||
4137 | lcd_fb = vp_main->buffer->fb_ptr; | 4165 | lcd_fb = vp_main->buffer->fb_ptr; |
4138 | 4166 | ||
4139 | int ret; | 4167 | int ret; |
4140 | (void) parameter; | 4168 | const char *file = parameter; |
4141 | 4169 | ||
4142 | void * buf; | 4170 | void * buf; |
4143 | size_t buf_size; | 4171 | size_t buf_size; |
4144 | bool prompt = (parameter && (((char *) parameter)[0] == ACTIVITY_MAINMENU)); | 4172 | bool prompt = (parameter && (((char *) parameter)[0] == ACTIVITY_MAINMENU)); |
4173 | bool file_id3 = (parameter && (((char *) parameter)[0] == '/')); | ||
4145 | 4174 | ||
4146 | if (!check_database(prompt)) | 4175 | if (!check_database(prompt)) |
4147 | { | 4176 | { |
@@ -4188,7 +4217,7 @@ enum plugin_status plugin_start(const void *parameter) | |||
4188 | pf_idx.buf = buf; | 4217 | pf_idx.buf = buf; |
4189 | pf_idx.buf_sz = buf_size; | 4218 | pf_idx.buf_sz = buf_size; |
4190 | 4219 | ||
4191 | ret = pictureflow_main(); | 4220 | ret = file_id3 ? pictureflow_main(file) : pictureflow_main(NULL); |
4192 | if ( ret == PLUGIN_OK || ret == PLUGIN_GOTO_WPS) { | 4221 | if ( ret == PLUGIN_OK || ret == PLUGIN_GOTO_WPS) { |
4193 | if (configfile_save(CONFIG_FILE, config, CONFIG_NUM_ITEMS, | 4222 | if (configfile_save(CONFIG_FILE, config, CONFIG_NUM_ITEMS, |
4194 | CONFIG_VERSION)) | 4223 | CONFIG_VERSION)) |
diff --git a/apps/plugins/viewers.config b/apps/plugins/viewers.config index 2bf052bb20..8aa0ac370a 100644 --- a/apps/plugins/viewers.config +++ b/apps/plugins/viewers.config | |||
@@ -103,3 +103,6 @@ z7,viewers/frotz,- | |||
103 | z8,viewers/frotz,- | 103 | z8,viewers/frotz,- |
104 | shopper,viewers/shopper,1 | 104 | shopper,viewers/shopper,1 |
105 | lnk,viewers/windows_lnk,- | 105 | lnk,viewers/windows_lnk,- |
106 | #ifdef HAVE_TAGCACHE | ||
107 | *,demos/pictureflow,- | ||
108 | #endif \ No newline at end of file | ||