From ab3575b5a2a8af518f9d3b1267f6dcf2355731d4 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Tue, 27 Feb 2018 00:54:05 +0100 Subject: [PATCH] movieplayer: allow to display plackback time instead of movietitle on vfd Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/e620d9e544a5d3d588713763f59312f89b38f1ba Author: vanhofen Date: 2018-02-27 (Tue, 27 Feb 2018) Origin message was: ------------------ - movieplayer: allow to display plackback time instead of movietitle on vfd --- data/locale/deutsch.locale | 2 ++ data/locale/english.locale | 2 ++ src/gui/mediaplayer_setup.cpp | 7 +++++++ src/gui/movieplayer.cpp | 32 ++++++++++++++++++++++++++++---- src/gui/movieplayer.h | 2 +- src/neutrino.cpp | 2 ++ src/system/locals.h | 2 ++ src/system/locals_intern.h | 2 ++ src/system/settings.h | 1 + 9 files changed, 47 insertions(+), 5 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index f24527f8a..e5ceeaf0c 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -1396,6 +1396,7 @@ menu.hint_movie Wiedergabe von Filmen menu.hint_moviebrowser_fonts Ändern Sie die Schriftgrößen im Moviebrowser (Meine Aufnahmen) menu.hint_moviebrowser_setup Auswahl- und Anzeigeoptionen einstellen. menu.hint_movieplayer_bisection_jump Startwert für den bisektionalen Modus, um mit Seite hoch/runter vor- bzw. zurückzuspringen +menu.hint_movieplayer_display_playtime Zeigt während der Wiedergabe die Spielzeit anstatt des Fimtitels im VFD menu.hint_movieplayer_plugin Wählen Sie ein Plugin, das mit einer Schnellstart-Taste im Movieplayer-Modus gestartet wird menu.hint_net_broadcast Ändern Sie die Broadcast-Adresse.\nWenn Sie unsicher sind, verwenden Sie zuletzt .255 menu.hint_net_dhcp Verwenden Sie einen DHCP-Server für die automatische Vergabe einer IP-Adresse im Netzwerk @@ -2043,6 +2044,7 @@ movieplayer.bookmarkname Bookmark Name movieplayer.bookmarkname_hint1 Geben Sie den Namen für das neue Lesezeichen ein movieplayer.bookmarkname_hint2 movieplayer.chapters Kapitel +movieplayer.display_playtime Zeige Spielzeit im VFD movieplayer.fileplayback_audio Multiformat-Audiowiedergabe movieplayer.fileplayback_video Multiformat-Videowiedergabe movieplayer.head Movieplayer diff --git a/data/locale/english.locale b/data/locale/english.locale index f8b30f5fe..95d1b4ec1 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -1396,6 +1396,7 @@ menu.hint_movie Play movies menu.hint_moviebrowser_fonts Change moviebrowser (My recordings) font sizes menu.hint_moviebrowser_setup Set selection and display options. menu.hint_movieplayer_bisection_jump Start value for bisectional mode to jump forward/backward with page up/down +menu.hint_movieplayer_display_playtime While playback show playtime instead of movietitle on VFD menu.hint_movieplayer_plugin Choose a plugin that's executed with the one touch key in movieplayer mode menu.hint_net_broadcast Enter broadcast address\nif unsure, use IP address with last .255 menu.hint_net_dhcp Use DHCP server to auto-configure @@ -2043,6 +2044,7 @@ movieplayer.bookmarkname Bookmarkname movieplayer.bookmarkname_hint1 Enter a name for your new bookmark movieplayer.bookmarkname_hint2 movieplayer.chapters Chapters +movieplayer.display_playtime Show playtime in VFD movieplayer.fileplayback_audio Multiformat audio playback movieplayer.fileplayback_video Multiformat video playback movieplayer.head Movieplayer diff --git a/src/gui/mediaplayer_setup.cpp b/src/gui/mediaplayer_setup.cpp index a2c5726d9..d8ddd11f7 100644 --- a/src/gui/mediaplayer_setup.cpp +++ b/src/gui/mediaplayer_setup.cpp @@ -38,6 +38,7 @@ #include #include +#include #include #include @@ -113,6 +114,12 @@ int CMediaPlayerSetup::showMediaPlayerSetup() mf->setHint(NEUTRINO_ICON_HINT_YTPLAY, LOCALE_MENU_HINT_YTPLAY_SETUP); mediaSetup->addItem(mf); + mediaSetup->addItem(GenericMenuSeparator); + + CMenuOptionChooser *mc; + mc = new CMenuOptionChooser(LOCALE_MOVIEPLAYER_DISPLAY_PLAYTIME, &g_settings.movieplayer_display_playtime, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, g_info.hw_caps->display_xres >= 8); + mc->setHint("", LOCALE_MENU_HINT_MOVIEPLAYER_DISPLAY_PLAYTIME); + mediaSetup->addItem(mc); int res = mediaSetup->exec (NULL, ""); selected = mediaSetup->getSelected(); diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index f5f595155..8c476dfa0 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -490,12 +490,26 @@ int CMoviePlayerGui::exec(CMenuTarget * parent, const std::string & actionKey) return menu_ret; } -void CMoviePlayerGui::updateLcd() +void CMoviePlayerGui::updateLcd(bool display_playtime) { char tmp[20]; std::string lcd; std::string name; + if (display_playtime) + { + int ss = position/1000; + int hh = ss/3600; + ss -= hh * 3600; + int mm = ss/60; + ss -= mm * 60; + lcd = to_string(hh/10) + to_string(hh%10) + ":" + to_string(mm/10) + to_string(mm%10) + ":" + to_string(ss/10) + to_string(ss%10); + + CVFD::getInstance()->setMode(LCD_MODE); + CVFD::getInstance()->showMenuText(0, lcd.c_str(), -1, true); + return; + } + if (isMovieBrowser && p_movie_info && !p_movie_info->epgTitle.empty() && p_movie_info->epgTitle.size() && strncmp(p_movie_info->epgTitle.c_str(), "not", 3)) name = p_movie_info->epgTitle; else @@ -1475,9 +1489,9 @@ void CMoviePlayerGui::PlayFileLoop(void) while (playstate >= CMoviePlayerGui::PLAY) { - if (update_lcd) { + if (update_lcd || g_settings.movieplayer_display_playtime) { update_lcd = false; - updateLcd(); + updateLcd(g_settings.movieplayer_display_playtime); } if (first_start) { usleep(80000); @@ -1872,6 +1886,8 @@ void CMoviePlayerGui::PlayFileLoop(void) if (fromInfoviewer) { disableOsdElements(NO_MUTE); + if (g_settings.movieplayer_display_playtime) + updateLcd(false); // force title #ifdef ENABLE_LUA if (isLuaPlay && haveLuaInfoFunc) { @@ -1900,6 +1916,8 @@ void CMoviePlayerGui::PlayFileLoop(void) bool restore = FileTimeOSD->IsVisible(); FileTimeOSD->kill(); + if (g_settings.movieplayer_display_playtime) + updateLcd(false); // force title if (msg == CRCInput::RC_epg) g_EventList->exec(CNeutrinoApp::getInstance()->channelList->getActiveChannel_ChannelID(), CNeutrinoApp::getInstance()->channelList->getActiveChannelName()); else if (msg == NeutrinoMessages::SHOW_EPG) @@ -1939,6 +1957,7 @@ void CMoviePlayerGui::PlayFileLoop(void) // do nothing } else if (msg == (neutrino_msg_t) CRCInput::RC_setup) { CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::SHOW_MAINMENU, 0); + update_lcd = true; } else if (msg == CRCInput::RC_red || msg == CRCInput::RC_green || msg == CRCInput::RC_yellow || msg == CRCInput::RC_blue ) { //maybe move FileTimeOSD->kill to Usermenu to simplify this call bool restore = FileTimeOSD->IsVisible(); @@ -2037,6 +2056,8 @@ void CMoviePlayerGui::callInfoViewer(bool init_vzap_it) } if (timeshift != TSHIFT_MODE_OFF) { + if (g_settings.movieplayer_display_playtime) + updateLcd(false); // force title g_InfoViewer->showTitle(CNeutrinoApp::getInstance()->channelList->getActiveChannel()); return; } @@ -2067,7 +2088,6 @@ void CMoviePlayerGui::callInfoViewer(bool init_vzap_it) } if (p_movie_info) { - if(duration <= 0) UpdatePosition(); @@ -2087,11 +2107,15 @@ void CMoviePlayerGui::callInfoViewer(bool init_vzap_it) if (channelName.empty()) channelName = pretty_name; + if (g_settings.movieplayer_display_playtime) + updateLcd(false); // force title g_InfoViewer->showMovieTitle(playstate, mi->epgId >>16, channelName, mi->epgTitle, mi->epgInfo1, duration, position, repeat_mode, init_vzap_it ? 0 /*IV_MODE_DEFAULT*/ : 1 /*IV_MODE_VIRTUAL_ZAP*/); return; } + if (g_settings.movieplayer_display_playtime) + updateLcd(false); // force title /* not moviebrowser => use the filename as title */ g_InfoViewer->showMovieTitle(playstate, 0, pretty_name, info_1, info_2, duration, position, repeat_mode); } diff --git a/src/gui/movieplayer.h b/src/gui/movieplayer.h index 483d251af..749f5e904 100644 --- a/src/gui/movieplayer.h +++ b/src/gui/movieplayer.h @@ -207,7 +207,7 @@ class CMoviePlayerGui : public CMenuTarget void handleMovieBrowser(neutrino_msg_t msg, int position = 0); bool SelectFile(); - void updateLcd(); + void updateLcd(bool display_playtime = false); bool convertSubtitle(std::string &text); void selectChapter(); diff --git a/src/neutrino.cpp b/src/neutrino.cpp index dd12bbc92..b98db8ab9 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -939,6 +939,7 @@ int CNeutrinoApp::loadSetup(const char * fname) //Movie-Player g_settings.movieplayer_repeat_on = configfile.getInt32("movieplayer_repeat_on", CMoviePlayerGui::REPEAT_OFF); g_settings.movieplayer_bisection_jump = configfile.getInt32("movieplayer_bisection_jump", 5); //NI + g_settings.movieplayer_display_playtime = configfile.getInt32("movieplayer_display_playtime", 0); g_settings.youtube_dev_id = configfile.getString("youtube_dev_id","AIzaSyBLdZe7M3rpNMZqSj-3IEvjbb2hATWJIdM"); //NI g_settings.youtube_enabled = configfile.getInt32("youtube_enabled", 1); g_settings.youtube_enabled = g_settings.youtube_enabled && check_youtube_dev_id(); @@ -1644,6 +1645,7 @@ void CNeutrinoApp::saveSetup(const char * fname) //Movie-Player configfile.setInt32( "movieplayer_repeat_on", g_settings.movieplayer_repeat_on ); configfile.setInt32( "movieplayer_bisection_jump", g_settings.movieplayer_bisection_jump ); //NI + configfile.setInt32( "movieplayer_display_playtime", g_settings.movieplayer_display_playtime ); configfile.setString( "youtube_dev_id", g_settings.youtube_dev_id ); configfile.setInt32( "youtube_enabled", g_settings.youtube_enabled ); configfile.setString( "tmdb_api_key", g_settings.tmdb_api_key ); diff --git a/src/system/locals.h b/src/system/locals.h index 269367aed..a75eda84a 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -1423,6 +1423,7 @@ typedef enum LOCALE_MENU_HINT_MOVIEBROWSER_FONTS, LOCALE_MENU_HINT_MOVIEBROWSER_SETUP, LOCALE_MENU_HINT_MOVIEPLAYER_BISECTION_JUMP, + LOCALE_MENU_HINT_MOVIEPLAYER_DISPLAY_PLAYTIME, LOCALE_MENU_HINT_MOVIEPLAYER_PLUGIN, LOCALE_MENU_HINT_NET_BROADCAST, LOCALE_MENU_HINT_NET_DHCP, @@ -2070,6 +2071,7 @@ typedef enum LOCALE_MOVIEPLAYER_BOOKMARKNAME_HINT1, LOCALE_MOVIEPLAYER_BOOKMARKNAME_HINT2, LOCALE_MOVIEPLAYER_CHAPTERS, + LOCALE_MOVIEPLAYER_DISPLAY_PLAYTIME, LOCALE_MOVIEPLAYER_FILEPLAYBACK_AUDIO, LOCALE_MOVIEPLAYER_FILEPLAYBACK_VIDEO, LOCALE_MOVIEPLAYER_HEAD, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index d154a55dc..a6a4a502b 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -1423,6 +1423,7 @@ const char * locale_real_names[] = "menu.hint_moviebrowser_fonts", "menu.hint_moviebrowser_setup", "menu.hint_movieplayer_bisection_jump", + "menu.hint_movieplayer_display_playtime", "menu.hint_movieplayer_plugin", "menu.hint_net_broadcast", "menu.hint_net_dhcp", @@ -2070,6 +2071,7 @@ const char * locale_real_names[] = "movieplayer.bookmarkname_hint1", "movieplayer.bookmarkname_hint2", "movieplayer.chapters", + "movieplayer.display_playtime", "movieplayer.fileplayback_audio", "movieplayer.fileplayback_video", "movieplayer.head", diff --git a/src/system/settings.h b/src/system/settings.h index 4bed73894..232b02d64 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -805,6 +805,7 @@ struct SNeutrinoSettings //movieplayer int movieplayer_repeat_on; int movieplayer_bisection_jump; //NI + int movieplayer_display_playtime; std::string youtube_dev_id; int youtube_enabled; std::string tmdb_api_key;