From 6111dc3195015b6946f01ba8b3716568dd0c379f Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 19 Oct 2016 17:48:12 +0200 Subject: [PATCH 01/14] filebrowser: fix 4a9f0cad640137d243772c7b3ebcacc64d80bd00 Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/85cd0952f28493a4673d9a7c5baab61f6d64be3f Author: vanhofen Date: 2016-10-19 (Wed, 19 Oct 2016) Origin message was: ------------------ - filebrowser: fix 4a9f0cad640137d243772c7b3ebcacc64d80bd00 ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/filebrowser.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/filebrowser.cpp b/src/gui/filebrowser.cpp index 0c3e5547e..29abece6c 100644 --- a/src/gui/filebrowser.cpp +++ b/src/gui/filebrowser.cpp @@ -1172,9 +1172,6 @@ void CFileBrowser::paintItem(unsigned int pos) std::string fileicon; unsigned int currpos = liststart + pos; - if (currpos >= filelist.size()) - return; - actual_file = &filelist[currpos]; bool i_selected = currpos == selected; @@ -1194,6 +1191,9 @@ void CFileBrowser::paintItem(unsigned int pos) frameBuffer->paintBoxRel(x,ypos, width- 15, fheight, COL_MENUCONTENT_PLUS_0); frameBuffer->paintBoxRel(x,ypos, width- 15, fheight, bgcolor, i_radius); + if (currpos >= filelist.size()) + return; + if (g_settings.filebrowser_showrights == 0 && S_ISREG(actual_file->Mode)) colwidth2 = 0; else From 3124e6bff143bb634b82ff14d8389f72b40fa722 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Thu, 20 Oct 2016 00:27:36 +0200 Subject: [PATCH 02/14] Revert "- filebrowser: fix 4a9f0cad640137d243772c7b3ebcacc64d80bd00" This reverts commit 6111dc3195015b6946f01ba8b3716568dd0c379f. Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/a2b1da8bc97a9741084c9f85456fc7676f760037 Author: vanhofen Date: 2016-10-20 (Thu, 20 Oct 2016) ------------------ This commit was generated by Migit --- src/gui/filebrowser.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/filebrowser.cpp b/src/gui/filebrowser.cpp index 29abece6c..0c3e5547e 100644 --- a/src/gui/filebrowser.cpp +++ b/src/gui/filebrowser.cpp @@ -1172,6 +1172,9 @@ void CFileBrowser::paintItem(unsigned int pos) std::string fileicon; unsigned int currpos = liststart + pos; + if (currpos >= filelist.size()) + return; + actual_file = &filelist[currpos]; bool i_selected = currpos == selected; @@ -1191,9 +1194,6 @@ void CFileBrowser::paintItem(unsigned int pos) frameBuffer->paintBoxRel(x,ypos, width- 15, fheight, COL_MENUCONTENT_PLUS_0); frameBuffer->paintBoxRel(x,ypos, width- 15, fheight, bgcolor, i_radius); - if (currpos >= filelist.size()) - return; - if (g_settings.filebrowser_showrights == 0 && S_ISREG(actual_file->Mode)) colwidth2 = 0; else From ad62b9afe77488c1fc74e8500d0bdb5dd42e0409 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Thu, 20 Oct 2016 00:27:36 +0200 Subject: [PATCH 03/14] filebrowser: fix 4a9f0cad640137d243772c7b3ebcacc64d80bd00; vol. 2 Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/efa4cae487c953db93e7213542bf84011e132f2a Author: vanhofen Date: 2016-10-20 (Thu, 20 Oct 2016) Origin message was: ------------------ - filebrowser: fix 4a9f0cad640137d243772c7b3ebcacc64d80bd00; vol. 2 ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/filebrowser.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui/filebrowser.cpp b/src/gui/filebrowser.cpp index 0c3e5547e..8a0f84f26 100644 --- a/src/gui/filebrowser.cpp +++ b/src/gui/filebrowser.cpp @@ -1173,7 +1173,11 @@ void CFileBrowser::paintItem(unsigned int pos) unsigned int currpos = liststart + pos; if (currpos >= filelist.size()) + { + // just paint an empty line + frameBuffer->paintBoxRel(x,ypos, width- 15, fheight, COL_MENUCONTENT_PLUS_0); return; + } actual_file = &filelist[currpos]; From 159dc909337400b09f4277d69d5ffa01ac1fffbc Mon Sep 17 00:00:00 2001 From: vanhofen Date: Fri, 21 Oct 2016 10:47:37 +0200 Subject: [PATCH 04/14] channellist: add small space between main-window and info-box Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/b42045507c59e9a42fa95f0d802f306bd0f553eb Author: vanhofen Date: 2016-10-21 (Fri, 21 Oct 2016) Origin message was: ------------------ - channellist: add small space between main-window and info-box ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/channellist.cpp | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index 8b508ffbd..5bb4f06ef 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -493,7 +493,7 @@ void CChannelList::calcSize() else info_height = 0; height = pig_on_win ? frameBuffer->getScreenHeight(): frameBuffer->getScreenHeightRel(); - height = height - info_height; + height = height - OFFSET_INTER - info_height; // calculate x position x = getScreenStartX(full_width); @@ -511,7 +511,7 @@ void CChannelList::calcSize() height = theight + listmaxshow*fheight + footerHeight; // calculate y position - y = getScreenStartY(height + info_height); + y = getScreenStartY(height + OFFSET_INTER + info_height); // calculate width/height of right info_zone and pip-box infozone_width = full_width - width; @@ -974,7 +974,7 @@ void CChannelList::hide() CChannelLogo = NULL; } - frameBuffer->paintBackgroundBoxRel(x, y, full_width, height + info_height); + frameBuffer->paintBackgroundBoxRel(x, y, full_width, height + OFFSET_INTER + info_height); clearItem2DetailsLine(); CInfoClock::getInstance()->enableInfoClock(!CInfoClock::getInstance()->isBlocked()); } @@ -1530,14 +1530,17 @@ void CChannelList::paintDetails(int index) if (!g_settings.channellist_show_infobox) return; + int ypos = y + height + OFFSET_INTER; + int ypos_a = ypos + OFFSET_INNER_SMALL; + CChannelEvent *p_event = NULL; //colored_events init bool colored_event_C = (g_settings.theme.colored_events_channellist == 1); bool colored_event_N = (g_settings.theme.colored_events_channellist == 2); - frameBuffer->paintBoxRel(x, y + height, full_width, info_height, COL_MENUCONTENTDARK_PLUS_0, RADIUS_LARGE); - frameBuffer->paintBoxFrame(x, y + height, full_width, info_height, 2, COL_FRAME_PLUS_0, RADIUS_LARGE); + frameBuffer->paintBoxRel(x, ypos, full_width, info_height, COL_MENUCONTENTDARK_PLUS_0, RADIUS_LARGE); + frameBuffer->paintBoxFrame(x, ypos, full_width, info_height, 2, COL_FRAME_PLUS_0, RADIUS_LARGE); if ((*chanlist).empty()) return; @@ -1587,7 +1590,7 @@ void CChannelList::paintDetails(int index) text3= text3+ " - "; xstart += g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->getRenderWidth(text3); - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, y+ height+ 5+ 2* fheight, full_width - 30- noch_len, text3, colored_event_C ? COL_COLORED_EVENTS_TEXT : COL_MENUCONTENTDARK_TEXT); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, ypos_a + 2*fheight, full_width - 30- noch_len, text3, colored_event_C ? COL_COLORED_EVENTS_TEXT : COL_MENUCONTENTDARK_TEXT); } if (!(text2.empty())) { @@ -1604,18 +1607,18 @@ void CChannelList::paintDetails(int index) } } #endif - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x+ xstart, y+ height+ 5+ fdescrheight+ fheight, full_width- xstart- 30- noch_len, text2, colored_event_C ? COL_COLORED_EVENTS_TEXT : COL_MENUCONTENTDARK_TEXT); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x+ xstart, ypos_a + fdescrheight+ fheight, full_width- xstart- 30- noch_len, text2, colored_event_C ? COL_COLORED_EVENTS_TEXT : COL_MENUCONTENTDARK_TEXT); } - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, y+ height+ 5+ fheight, full_width - 30 - seit_len, text1, colored_event_C ? COL_COLORED_EVENTS_TEXT : COL_MENUCONTENTDARK_TEXT); - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x+ full_width- 10- seit_len, y+ height+ 5+ fheight, seit_len, cSeit, colored_event_C ? COL_COLORED_EVENTS_TEXT : COL_MENUCONTENTDARK_TEXT); - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x+ full_width- 10- noch_len, y+ height+ 5+ fdescrheight+ fheight, noch_len, cNoch, colored_event_C ? COL_COLORED_EVENTS_TEXT : COL_MENUCONTENTDARK_TEXT); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, ypos_a + fheight, full_width - 30 - seit_len, text1, colored_event_C ? COL_COLORED_EVENTS_TEXT : COL_MENUCONTENTDARK_TEXT); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x+ full_width- 10- seit_len, ypos_a + fheight , seit_len, cSeit, colored_event_C ? COL_COLORED_EVENTS_TEXT : COL_MENUCONTENTDARK_TEXT); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x+ full_width- 10- noch_len, ypos_a + fdescrheight+ fheight, noch_len, cNoch, colored_event_C ? COL_COLORED_EVENTS_TEXT : COL_MENUCONTENTDARK_TEXT); } else if (IS_WEBTV((*chanlist)[index]->getChannelID())) { - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, y+ height+ 5+ fheight, full_width - 30, (*chanlist)[index]->getDesc(), colored_event_C ? COL_COLORED_EVENTS_TEXT : COL_MENUCONTENTDARK_TEXT, 0, true); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, ypos_a + fheight, full_width - 30, (*chanlist)[index]->getDesc(), colored_event_C ? COL_COLORED_EVENTS_TEXT : COL_MENUCONTENTDARK_TEXT, 0, true); } if (IS_WEBTV((*chanlist)[index]->getChannelID())) { - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, y+ height+ 5+ 2*fheight + fdescrheight, full_width - 30, (*chanlist)[index]->getUrl(), COL_MENUCONTENTDARK_TEXT, 0, true); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, ypos_a + 2*fheight + fdescrheight, full_width - 30, (*chanlist)[index]->getUrl(), COL_MENUCONTENTDARK_TEXT, 0, true); } else if(g_settings.channellist_foot == 0) { transponder t; CServiceManager::getInstance()->GetTransponder((*chanlist)[index]->getTransponderId(), t); @@ -1626,7 +1629,7 @@ void CChannelList::paintDetails(int index) else desc = desc + " (" + CServiceManager::getInstance()->GetSatelliteName((*chanlist)[index]->getSatellitePosition()) + ")"; - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, y+ height+ 5+ 2*fheight +fdescrheight, full_width - 30, desc.c_str(), COL_MENUCONTENTDARK_TEXT); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, ypos_a + 2*fheight +fdescrheight, full_width - 30, desc.c_str(), COL_MENUCONTENTDARK_TEXT); } else if( !displayNext && g_settings.channellist_foot == 1) { // next Event @@ -1640,8 +1643,8 @@ void CChannelList::paintDetails(int index) snprintf(buf, sizeof(buf), "%s", CurrentNext.next_name.c_str()); int from_len = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->getRenderWidth(cFrom); - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, y+ height+ 5+ 2*fheight+ fdescrheight, full_width - 30 - from_len, buf, colored_event_N ? COL_COLORED_EVENTS_TEXT :COL_MENUCONTENTDARK_TEXT); - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x+ full_width- 10- from_len, y+ height+ 5+ 2*fheight+ fdescrheight, from_len, cFrom, colored_event_N ? COL_COLORED_EVENTS_TEXT : COL_MENUCONTENTDARK_TEXT); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, ypos_a + 2*fheight+ fdescrheight, full_width - 30 - from_len, buf, colored_event_N ? COL_COLORED_EVENTS_TEXT :COL_MENUCONTENTDARK_TEXT); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x+ full_width- 10- from_len, ypos_a + 2*fheight+ fdescrheight, from_len, cFrom, colored_event_N ? COL_COLORED_EVENTS_TEXT : COL_MENUCONTENTDARK_TEXT); } } } @@ -1664,7 +1667,7 @@ void CChannelList::paintItem2DetailsLine (int pos) int xpos = x - ConnectLineBox_Width; int ypos1 = y + theight + pos*fheight + (fheight/2); - int ypos2 = y + height + (info_height/2); + int ypos2 = y + height + OFFSET_INTER + (info_height/2); // paint Line if detail info (and not valid list pos) if (pos >= 0) { From 58f0a8ce2bedb101217a5bfeaf0b3e51c6d61495 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Fri, 21 Oct 2016 10:47:37 +0200 Subject: [PATCH 05/14] moviebrowser: add possibility to add spacers to moviebrowser Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/75a2665b8780ee8d625fe970666ef418bdb0c884 Author: vanhofen Date: 2016-10-21 (Fri, 21 Oct 2016) Origin message was: ------------------ - moviebrowser: add possibility to add spacers to moviebrowser ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- data/locale/deutsch.locale | 2 ++ data/locale/english.locale | 2 ++ src/gui/moviebrowser/mb.cpp | 12 +++++++++--- src/gui/moviebrowser/mb_functions.h | 11 +++-------- src/gui/moviebrowser/mb_types.h | 9 +++------ src/system/locals.h | 2 ++ src/system/locals_intern.h | 2 ++ 7 files changed, 23 insertions(+), 17 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index fc15ae55b..00d20b221 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -1714,6 +1714,7 @@ moviebrowser.info_rating Bewertung moviebrowser.info_recorddate Aufnahmedatum moviebrowser.info_serie Serie moviebrowser.info_size Dateigröße (MB) +moviebrowser.info_spacer Abstandshalter moviebrowser.info_title Titel moviebrowser.info_videoformat Bildformat moviebrowser.last_play_max_items Zeilen 'zuletzt aufgenommen' @@ -1764,6 +1765,7 @@ moviebrowser.short_rating Vote moviebrowser.short_recorddate Datum moviebrowser.short_serie Serie moviebrowser.short_size Größe +moviebrowser.short_spacer moviebrowser.short_title Titel moviebrowser.start_head Film starten von Position: moviebrowser.start_record_start Aufnahmestart diff --git a/data/locale/english.locale b/data/locale/english.locale index 3ef0ab02c..3c0a9f71b 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -1714,6 +1714,7 @@ moviebrowser.info_rating Rating moviebrowser.info_recorddate Record date moviebrowser.info_serie Serie moviebrowser.info_size File size (MB) +moviebrowser.info_spacer Spacer moviebrowser.info_title Titel moviebrowser.info_videoformat Picture moviebrowser.last_play_max_items Number of lines last play @@ -1764,6 +1765,7 @@ moviebrowser.short_rating Vote moviebrowser.short_recorddate Date moviebrowser.short_serie Serie moviebrowser.short_size MB +moviebrowser.short_spacer moviebrowser.short_title Title moviebrowser.start_head Start movie from: moviebrowser.start_record_start Movie start diff --git a/src/gui/moviebrowser/mb.cpp b/src/gui/moviebrowser/mb.cpp index c63dfdcb2..fe136c50b 100644 --- a/src/gui/moviebrowser/mb.cpp +++ b/src/gui/moviebrowser/mb.cpp @@ -31,6 +31,7 @@ based on code of Steffen Hehn 'McClean' (C) 2009-2014 Stefan Seyfried + (C) 2016 Sven Hoefer outsourced: (C) 2016, Thilo Graf 'dbt' @@ -89,7 +90,7 @@ typedef struct dirent64 dirent_struct; #define NUMBER_OF_MOVIES_LAST 40 // This is the number of movies shown in last recored and last played list #define MOVIE_SMSKEY_TIMEOUT 800 -#define MESSAGEBOX_BROWSER_ROW_ITEM_COUNT 21 +#define MESSAGEBOX_BROWSER_ROW_ITEM_COUNT 22 const CMenuOptionChooser::keyval MESSAGEBOX_BROWSER_ROW_ITEM[MESSAGEBOX_BROWSER_ROW_ITEM_COUNT] = { { MB_INFO_FILENAME, LOCALE_MOVIEBROWSER_INFO_FILENAME }, @@ -112,7 +113,8 @@ const CMenuOptionChooser::keyval MESSAGEBOX_BROWSER_ROW_ITEM[MESSAGEBOX_BROWSER_ { MB_INFO_AUDIO, LOCALE_MOVIEBROWSER_INFO_AUDIO }, { MB_INFO_LENGTH, LOCALE_MOVIEBROWSER_INFO_LENGTH }, { MB_INFO_SIZE, LOCALE_MOVIEBROWSER_INFO_SIZE }, - { MB_INFO_RATING, LOCALE_MOVIEBROWSER_INFO_RATING } + { MB_INFO_RATING, LOCALE_MOVIEBROWSER_INFO_RATING }, + { MB_INFO_SPACER, LOCALE_MOVIEBROWSER_INFO_SPACER } }; #define MESSAGEBOX_YES_NO_OPTIONS_COUNT 2 @@ -170,6 +172,7 @@ const neutrino_locale_t m_localizedItemName[MB_INFO_MAX_NUMBER+1] = LOCALE_MOVIEBROWSER_SHORT_LENGTH, LOCALE_MOVIEBROWSER_SHORT_SIZE, LOCALE_MOVIEBROWSER_SHORT_RATING, + LOCALE_MOVIEBROWSER_SHORT_SPACER, NONEXISTANT_LOCALE }; @@ -195,6 +198,7 @@ const neutrino_locale_t m_localizedItemName[MB_INFO_MAX_NUMBER+1] = #define MB_ROW_WIDTH_LENGTH 10 #define MB_ROW_WIDTH_SIZE 12 #define MB_ROW_WIDTH_RATING 5 +#define MB_ROW_WIDTH_SPACER 1 const int m_defaultRowWidth[MB_INFO_MAX_NUMBER+1] = { @@ -219,6 +223,7 @@ const int m_defaultRowWidth[MB_INFO_MAX_NUMBER+1] = MB_ROW_WIDTH_LENGTH, MB_ROW_WIDTH_SIZE, MB_ROW_WIDTH_RATING, + MB_ROW_WIDTH_SPACER, 0 //MB_ROW_WIDTH_MAX_NUMBER }; static MI_MOVIE_INFO* playing_info; @@ -3439,7 +3444,8 @@ bool CMovieBrowser::getMovieInfoItem(MI_MOVIE_INFO& movie_info, MB_INFO_ITEM ite *item_string = str_tmp; } break; - case MB_INFO_MAX_NUMBER: // = 21 + case MB_INFO_SPACER: // = 21, + case MB_INFO_MAX_NUMBER: // = 22 default: *item_string=""; result = false; diff --git a/src/gui/moviebrowser/mb_functions.h b/src/gui/moviebrowser/mb_functions.h index 4c0ce19b1..a5fd547d3 100644 --- a/src/gui/moviebrowser/mb_functions.h +++ b/src/gui/moviebrowser/mb_functions.h @@ -31,6 +31,7 @@ based on code of Steffen Hehn 'McClean' (C) 2009-2014 Stefan Seyfried + (C) 2016 Sven Hoefer outsourced: (C) 2016, Thilo Graf 'dbt' @@ -39,13 +40,9 @@ #ifndef __MB_FUNCTIONS__ #define __MB_FUNCTIONS__ - #include "mb_types.h" #include - - - void strReplace(std::string& orig, const char* fstr, const std::string &rstr); static std::string rateFormat(int i) @@ -135,7 +132,6 @@ bool sortByDir(const MI_MOVIE_INFO* a, const MI_MOVIE_INFO* b) else return a->dirItNr < b->dirItNr; } - bool sortByLastPlay(const MI_MOVIE_INFO* a, const MI_MOVIE_INFO* b) { if (sortDirection) @@ -167,9 +163,8 @@ bool (* const sortBy[MB_INFO_MAX_NUMBER+1])(const MI_MOVIE_INFO* a, const MI_MOV NULL, //MB_INFO_LENGTH = 18, &sortBySize, //MB_INFO_SIZE = 19, &sortByRating, //MB_INFO_RATING = 20, - NULL //MB_INFO_MAX_NUMBER = 21 + NULL, //MB_INFO_SPACER = 21, + NULL //MB_INFO_MAX_NUMBER = 22 }; - - #endif /*__MB_FUNCTIONS__*/ diff --git a/src/gui/moviebrowser/mb_types.h b/src/gui/moviebrowser/mb_types.h index e8c62c087..b260d0ec7 100644 --- a/src/gui/moviebrowser/mb_types.h +++ b/src/gui/moviebrowser/mb_types.h @@ -31,19 +31,17 @@ based on code of Steffen Hehn 'McClean' (C) 2009-2014 Stefan Seyfried + (C) 2016 Sven Hoefer outsourced: (C) 2016, Thilo Graf 'dbt' */ - #include #ifndef __MB_TYPES__ #define __MB_TYPES__ - - /* !!!! Do NOT change the order of the enum, just add items at the end !!!! */ typedef enum { @@ -68,10 +66,10 @@ typedef enum MB_INFO_LENGTH = 18, MB_INFO_SIZE = 19, MB_INFO_RATING = 20, - MB_INFO_MAX_NUMBER = 21 // MUST be allways the last item in the list + MB_INFO_SPACER = 21, + MB_INFO_MAX_NUMBER = 22 // MUST be allways the last item in the list }MB_INFO_ITEM; - typedef enum { MB_DIRECTION_AUTO = 0, @@ -121,7 +119,6 @@ typedef enum MB_GUI_MAX_NUMBER = 5 // MUST be allways the last item in the list }MB_GUI; - typedef enum { MB_PARENTAL_LOCK_OFF = 0, diff --git a/src/system/locals.h b/src/system/locals.h index a80e31df8..1def8f162 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -1741,6 +1741,7 @@ typedef enum LOCALE_MOVIEBROWSER_INFO_RECORDDATE, LOCALE_MOVIEBROWSER_INFO_SERIE, LOCALE_MOVIEBROWSER_INFO_SIZE, + LOCALE_MOVIEBROWSER_INFO_SPACER, LOCALE_MOVIEBROWSER_INFO_TITLE, LOCALE_MOVIEBROWSER_INFO_VIDEOFORMAT, LOCALE_MOVIEBROWSER_LAST_PLAY_MAX_ITEMS, @@ -1791,6 +1792,7 @@ typedef enum LOCALE_MOVIEBROWSER_SHORT_RECORDDATE, LOCALE_MOVIEBROWSER_SHORT_SERIE, LOCALE_MOVIEBROWSER_SHORT_SIZE, + LOCALE_MOVIEBROWSER_SHORT_SPACER, LOCALE_MOVIEBROWSER_SHORT_TITLE, LOCALE_MOVIEBROWSER_START_HEAD, LOCALE_MOVIEBROWSER_START_RECORD_START, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index d759559ab..62c654dab 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -1741,6 +1741,7 @@ const char * locale_real_names[] = "moviebrowser.info_recorddate", "moviebrowser.info_serie", "moviebrowser.info_size", + "moviebrowser.info_spacer", "moviebrowser.info_title", "moviebrowser.info_videoformat", "moviebrowser.last_play_max_items", @@ -1791,6 +1792,7 @@ const char * locale_real_names[] = "moviebrowser.short_recorddate", "moviebrowser.short_serie", "moviebrowser.short_size", + "moviebrowser.short_spacer", "moviebrowser.short_title", "moviebrowser.start_head", "moviebrowser.start_record_start", From 3d3605983f737d60503eec9091dad766f798a87a Mon Sep 17 00:00:00 2001 From: TangoCash Date: Fri, 21 Oct 2016 10:47:37 +0200 Subject: [PATCH 06/14] adding remote timer (experimental) switch record timers to remote box or back with "play"-key Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/716e9f4d9b4f46cf422c3edb271de7f184dde920 Author: TangoCash Date: 2016-10-21 (Fri, 21 Oct 2016) ------------------ This commit was generated by Migit --- data/locale/deutsch.locale | 1 + data/locale/english.locale | 1 + lib/timerdclient/timerdtypes.h | 3 +- src/gui/timerlist.cpp | 195 ++++++++++++++++++++++++++++++++- src/gui/timerlist.h | 2 + src/neutrino.cpp | 3 + src/system/httptool.cpp | 67 +++++++++++ src/system/httptool.h | 2 + src/system/locals.h | 1 + src/system/locals_intern.h | 1 + src/system/settings.h | 1 + 11 files changed, 272 insertions(+), 5 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index 00d20b221..f87c2006e 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -2355,6 +2355,7 @@ timerlist.type.execplugin Plugin ausführen timerlist.type.nextprogram Nächstes Programm timerlist.type.record Aufnahme timerlist.type.remind Erinnerung +timerlist.type.remotebox Remote-Aufnahme timerlist.type.shutdown Shutdown timerlist.type.sleeptimer Sleeptimer timerlist.type.standby Standby diff --git a/data/locale/english.locale b/data/locale/english.locale index 3c0a9f71b..a599cea3c 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -2355,6 +2355,7 @@ timerlist.type.execplugin Execute plugin timerlist.type.nextprogram Next program timerlist.type.record Record timerlist.type.remind Reminder +timerlist.type.remotebox Remote-Record timerlist.type.shutdown Shutdown timerlist.type.sleeptimer Sleeptimer timerlist.type.standby Standby diff --git a/lib/timerdclient/timerdtypes.h b/lib/timerdclient/timerdtypes.h index 4e0c5001f..39481b97f 100644 --- a/lib/timerdclient/timerdtypes.h +++ b/lib/timerdclient/timerdtypes.h @@ -68,7 +68,8 @@ class CTimerd TIMER_REMIND, TIMER_SLEEPTIMER, TIMER_EXEC_PLUGIN, - TIMER_IMMEDIATE_RECORD + TIMER_IMMEDIATE_RECORD, + TIMER_REMOTEBOX }; enum CTimerEventStates diff --git a/src/gui/timerlist.cpp b/src/gui/timerlist.cpp index 8ba90569f..dc8966629 100644 --- a/src/gui/timerlist.cpp +++ b/src/gui/timerlist.cpp @@ -67,6 +67,9 @@ #include #include #include +#include + +#include #include #include @@ -249,6 +252,15 @@ public: } }; +std::string string_printf_helper(const char *fmt, ...) { + va_list arglist; + const int bufferlen = 4*1024; + char buffer[bufferlen] = {0}; + va_start(arglist, fmt); + vsnprintf(buffer, bufferlen, fmt, arglist); + va_end(arglist); + return std::string(buffer); +} CTimerList::CTimerList() { @@ -297,6 +309,23 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey) timerlist[selected].alarmTime, timerlist[selected].stopTime, timerlist[selected].eventRepeat, timerlist[selected].repeatCount,timerlist[selected].recordingDir); + } else if (timerlist[selected].eventType == CTimerd::TIMER_REMOTEBOX) + { + CHTTPTool httpTool; + std::string r_url; + r_url = "http://"; + r_url += g_settings.remotebox_address; + r_url += "/control/timer?action=new&update=1"; + r_url += "&alarm=" + to_string((int)timerlist[selected].alarmTime); + r_url += "&stop=" + to_string((int)timerlist[selected].stopTime); + r_url += "&announce=" + to_string((int)timerlist[selected].announceTime); + r_url += "&channel_id=" + string_printf_helper(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS, timerlist[selected].channel_id); + r_url += "&aj=on"; + r_url += "&rs=on"; + r_url += "&id=" + to_string((int)timerlist[selected].eventID); + //printf("[remotetimer] url:%s\n",r_url.c_str()); + r_url = httpTool.downloadString(r_url); + //printf("[remotetimer] status:%s\n",r_url.c_str()); } else { Timer->modifyTimerEvent(timerlist[selected].eventID, timerlist[selected].announceTime, @@ -306,6 +335,71 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey) } return menu_return::RETURN_EXIT; } + else if (strcmp(key, "send_remotetimer") == 0) + { + CHTTPTool httpTool; + std::string r_url; + r_url = "http://"; + r_url += g_settings.remotebox_address; + r_url += "/control/timer?action=new"; + r_url += "&alarm=" + to_string((int)timerlist[selected].alarmTime); + r_url += "&stop=" + to_string((int)timerlist[selected].stopTime); + r_url += "&announce=" + to_string((int)timerlist[selected].announceTime); + r_url += "&channel_id=" + string_printf_helper(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS, timerlist[selected].channel_id); + r_url += "&aj=on"; + r_url += "&rs=on"; + //printf("[remotetimer] url:%s\n",r_url.c_str()); + r_url = httpTool.downloadString(r_url); + //printf("[remotetimer] status:%s\n",r_url.c_str()); + if (r_url=="ok") + Timer->removeTimerEvent(timerlist[selected].eventID); + } + else if (strcmp(key, "fetch_remotetimer") == 0) + { + CHTTPTool httpTool; + std::string r_url; + r_url = "http://"; + r_url += g_settings.remotebox_address; + r_url += "/control/timer?action=remove"; + r_url += "&id=" + to_string((int)timerlist[selected].eventID); + //printf("[remotetimer] url:%s\n",r_url.c_str()); + r_url = httpTool.downloadString(r_url); + //printf("[remotetimer] status:%s\n",r_url.c_str()); + if (r_url=="ok") { + Timer->addRecordTimerEvent(timerlist[selected].channel_id, timerlist[selected].alarmTime, + timerlist[selected].stopTime, 0, 0, timerlist[selected].announceTime, + TIMERD_APIDS_CONF, true, timerlist[selected].announceTime > time(NULL)); + } + } + else if (strcmp(key, "del_remotetimer") == 0) + { + CHTTPTool httpTool; + std::string r_url; + r_url = "http://"; + r_url += g_settings.remotebox_address; + r_url += "/control/timer?action=remove"; + r_url += "&id=" + to_string((int)timerlist[selected].eventID); + //printf("[remotetimer] url:%s\n",r_url.c_str()); + r_url = httpTool.downloadString(r_url); + //printf("[remotetimer] status:%s\n",r_url.c_str()); + } + else if (strcmp(key, "update_remotetimer") == 0) + { + CHTTPTool httpTool; + std::string r_url; + r_url = "http://"; + r_url += g_settings.remotebox_address; + r_url += "/control/timer?action=new&update=1"; + r_url += "&alarm=" + to_string((int)timerlist[selected].alarmTime); + r_url += "&stop=" + to_string((int)timerlist[selected].stopTime); + r_url += "&announce=" + to_string((int)timerlist[selected].announceTime); + r_url += "&channel_id=" + string_printf_helper(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS, timerlist[selected].channel_id); + r_url += "&aj=on"; + r_url += "&rs=on"; + //printf("[remotetimer] url:%s\n",r_url.c_str()); + r_url = httpTool.downloadString(r_url); + //printf("[remotetimer] status:%s\n",r_url.c_str()); + } else if (strcmp(key, "newtimer") == 0) { timerNew.announceTime=timerNew.alarmTime-60; @@ -429,20 +523,22 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey) }*/ } -#define TimerListButtonsCount 5 +#define TimerListButtonsCount 6 struct button_label TimerListButtons[TimerListButtonsCount] = { { NEUTRINO_ICON_BUTTON_RED , LOCALE_TIMERLIST_DELETE }, { NEUTRINO_ICON_BUTTON_GREEN , LOCALE_TIMERLIST_NEW }, { NEUTRINO_ICON_BUTTON_YELLOW , LOCALE_TIMERLIST_RELOAD }, { NEUTRINO_ICON_BUTTON_BLUE , LOCALE_TIMERLIST_MODIFY }, - { NEUTRINO_ICON_BUTTON_INFO_SMALL, NONEXISTANT_LOCALE } + { NEUTRINO_ICON_BUTTON_INFO_SMALL, NONEXISTANT_LOCALE }, + { NEUTRINO_ICON_BUTTON_MENU_SMALL, NONEXISTANT_LOCALE } }; void CTimerList::updateEvents(void) { timerlist.clear(); Timer->getTimerList (timerlist); + remoteTimerList (timerlist); sort(timerlist.begin(), timerlist.end()); theight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); @@ -472,6 +568,55 @@ void CTimerList::updateEvents(void) y = getScreenStartY(height); } +void CTimerList::remoteTimerList(CTimerd::TimerList &rtimerlist) +{ + if (g_settings.remotebox_address.empty()) + return; + CHTTPTool httpTool; + std::string r_url; + r_url = "http://"; + r_url += g_settings.remotebox_address; + r_url += "/control/timer?format=json"; + r_url = httpTool.downloadString(r_url); + //printf("[remotetimer] timers:%s\n",r_url.c_str()); + + Json::Value root; + Json::Reader reader; + bool parsedSuccess = reader.parse(r_url, root, false); + if (!parsedSuccess) { + printf("Failed to parse JSON\n"); + printf("%s\n", reader.getFormattedErrorMessages().c_str()); + } + + Json::Value remotetimers = root["data"]["timer"][0]["timer_list"]; + + for (unsigned int i= 0; iremoveTimerEvent(timerlist[selected].eventID); update = true; } @@ -589,6 +757,13 @@ int CTimerList::show() else update=true; } + else if (msg==CRCInput::RC_setup) + { + hide(); + enterRemoteBox(); + update=true; + paint(); + } else if (msg==CRCInput::RC_yellow) { update=true; @@ -612,7 +787,7 @@ int CTimerList::show() CTimerd::responseGetTimer* timer=&timerlist[selected]; if (timer!=NULL) { - if (timer->eventType == CTimerd::TIMER_RECORD || timer->eventType == CTimerd::TIMER_ZAPTO) + if (timer->eventType == CTimerd::TIMER_RECORD || timer->eventType == CTimerd::TIMER_REMOTEBOX || timer->eventType == CTimerd::TIMER_ZAPTO) { hide(); if (timer->epgID != 0) @@ -655,6 +830,15 @@ void CTimerList::hide() } } +void CTimerList::enterRemoteBox() +{ + CMenuWidget* remboxmenu = new CMenuWidget(LOCALE_MAINSETTINGS_HEAD, NEUTRINO_ICON_SETTINGS, 40, MN_WIDGET_ID_NETWORKSETUP); + CIPInput remotebox_NetworkIP(LOCALE_NETWORKMENU_IPADDRESS , &g_settings.remotebox_address); + CMenuForwarder *m1 = new CMenuForwarder(LOCALE_NETWORKMENU_IPADDRESS , true, g_settings.remotebox_address , &remotebox_NetworkIP ); + remboxmenu->addItem( m1); + remboxmenu->exec(NULL, ""); +} + void CTimerList::paintItem(int pos) { int ypos = y+ theight+ pos*fheight*2; @@ -736,6 +920,7 @@ void CTimerList::paintItem(int pos) //case CTimerd::TIMER_NEXTPROGRAM : case CTimerd::TIMER_ZAPTO : case CTimerd::TIMER_RECORD : + case CTimerd::TIMER_REMOTEBOX : { zAddData = convertChannelId2String(timer.channel_id); // UTF-8 if (timer.apids != TIMERD_APIDS_CONF) @@ -848,7 +1033,7 @@ void CTimerList::paintFoot() if (timer != NULL) { //replace info button with dummy if timer is not type REC or ZAP - if (timer->eventType == CTimerd::TIMER_RECORD || timer->eventType == CTimerd::TIMER_ZAPTO) + if (timer->eventType == CTimerd::TIMER_RECORD || timer->eventType == CTimerd::TIMER_REMOTEBOX || timer->eventType == CTimerd::TIMER_ZAPTO) TimerListButtons[4].button = NEUTRINO_ICON_BUTTON_INFO_SMALL; else TimerListButtons[4].button = NEUTRINO_ICON_BUTTON_DUMMY_SMALL; @@ -914,6 +1099,8 @@ const char * CTimerList::convertTimerType2String(const CTimerd::CTimerEventTypes return g_Locale->getText(LOCALE_TIMERLIST_TYPE_SLEEPTIMER ); case CTimerd::TIMER_EXEC_PLUGIN : return g_Locale->getText(LOCALE_TIMERLIST_TYPE_EXECPLUGIN ); + case CTimerd::TIMER_REMOTEBOX : + return g_Locale->getText(LOCALE_TIMERLIST_TYPE_REMOTEBOX ); default : return g_Locale->getText(LOCALE_TIMERLIST_TYPE_UNKNOWN ); } diff --git a/src/gui/timerlist.h b/src/gui/timerlist.h index 6ca937ecb..65494d813 100644 --- a/src/gui/timerlist.h +++ b/src/gui/timerlist.h @@ -85,6 +85,8 @@ class CTimerList : public CMenuTarget, public CListHelpers int newTimer(); /* todo: properly import the enum CVFD::MODES */ int saved_dispmode; + void remoteTimerList(CTimerd::TimerList &timerlist); + void enterRemoteBox(); public: CTimerList(); diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 4b85e0928..9a4f346e0 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -458,6 +458,8 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.shutdown_min = configfile.getInt32("shutdown_min", 180); g_settings.sleeptimer_min = configfile.getInt32("sleeptimer_min", 0); + g_settings.remotebox_address = configfile.getString("timer_remotebox", ""); + g_settings.infobar_sat_display = configfile.getBool("infobar_sat_display" , true ); g_settings.infobar_show_channeldesc = configfile.getBool("infobar_show_channeldesc" , false ); g_settings.infobar_subchan_disp_pos = configfile.getInt32("infobar_subchan_disp_pos" , 0 ); @@ -1043,6 +1045,7 @@ void CNeutrinoApp::saveSetup(const char * fname) configfile.setInt32("shutdown_count" , g_settings.shutdown_count); configfile.setInt32("shutdown_min" , g_settings.shutdown_min ); configfile.setInt32("sleeptimer_min", g_settings.sleeptimer_min); + configfile.setString("timer_remotebox", g_settings.remotebox_address); configfile.setBool("infobar_sat_display" , g_settings.infobar_sat_display ); configfile.setBool("infobar_show_channeldesc" , g_settings.infobar_show_channeldesc ); configfile.setInt32("infobar_subchan_disp_pos" , g_settings.infobar_subchan_disp_pos ); diff --git a/src/system/httptool.cpp b/src/system/httptool.cpp index 8f89db96f..9f8aca4a4 100644 --- a/src/system/httptool.cpp +++ b/src/system/httptool.cpp @@ -41,6 +41,14 @@ void CHTTPTool::setStatusViewer( CProgressWindow* statusview ) statusViewer = statusview; } +size_t CHTTPTool::CurlWriteToString(void *ptr, size_t size, size_t nmemb, void *data) +{ + if (size * nmemb > 0) { + std::string* pStr = (std::string*) data; + pStr->append((char*) ptr, nmemb); + } + return size*nmemb; +} int CHTTPTool::show_progress( void *clientp, double dltotal, double dlnow, double /*ultotal*/, double /*ulnow*/ ) { @@ -127,3 +135,62 @@ printf("download code %d\n", res); return res==CURLE_OK; } + +std::string CHTTPTool::downloadString(const std::string & URL, int globalProgressEnd) +{ + CURL *curl; + CURLcode res; + std::string retString = ""; +#ifdef DEBUG +printf("url is %s\n", URL.c_str()); +#endif + res = (CURLcode) 1; + curl = curl_easy_init(); + if(curl) + { + iGlobalProgressEnd = globalProgressEnd; + if(statusViewer) + { + iGlobalProgressBegin = statusViewer->getGlobalStatus(); + } + curl_easy_setopt(curl, CURLOPT_URL, URL.c_str() ); + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &CHTTPTool::CurlWriteToString); + curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void*)&retString); + curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, show_progress); + curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, this); + curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0); + curl_easy_setopt(curl, CURLOPT_USERAGENT, userAgent.c_str()); + curl_easy_setopt(curl, CURLOPT_NOSIGNAL, (long)1); + curl_easy_setopt(curl, CURLOPT_TIMEOUT, 1800); + curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 10); + curl_easy_setopt(curl, CURLOPT_FAILONERROR, true); + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, false); +#ifdef DEBUG + curl_easy_setopt(curl, CURLOPT_VERBOSE, 1); +#endif + + if (!g_settings.softupdate_proxyserver.empty()) {//use proxyserver +#ifdef DEBUG +printf("use proxyserver : %s\n", g_settings.softupdate_proxyserver.c_str()); +#endif + curl_easy_setopt(curl, CURLOPT_PROXY, g_settings.softupdate_proxyserver.c_str()); + + if (!g_settings.softupdate_proxyusername.empty()) {//use auth + //printf("use proxyauth\n"); + std::string tmp = g_settings.softupdate_proxyusername; + tmp += ":"; + tmp += g_settings.softupdate_proxypassword; + curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD, tmp.c_str()); + } + } +#ifdef DEBUG +printf("going to download\n"); +#endif + res = curl_easy_perform(curl); + curl_easy_cleanup(curl); + } +#ifdef DEBUG +printf("download code %d\n", res); +#endif + return (res==CURLE_OK) ? retString : ""; +} diff --git a/src/system/httptool.h b/src/system/httptool.h index c0b3f487f..93a5f43c3 100644 --- a/src/system/httptool.h +++ b/src/system/httptool.h @@ -46,12 +46,14 @@ class CHTTPTool CProgressWindow* statusViewer; static int show_progress( void *clientp, double dltotal, double dlnow, double ultotal, double ulnow); + static size_t CurlWriteToString(void *ptr, size_t size, size_t nmemb, void *data); public: CHTTPTool(); void setStatusViewer( CProgressWindow* statusview ); bool downloadFile( const std::string & URL, const char * const downloadTarget, int globalProgressEnd=-1 ); + std::string downloadString(const std::string & URL, int globalProgressEnd=-1 ); }; diff --git a/src/system/locals.h b/src/system/locals.h index 1def8f162..1d7b43b3a 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -2382,6 +2382,7 @@ typedef enum LOCALE_TIMERLIST_TYPE_NEXTPROGRAM, LOCALE_TIMERLIST_TYPE_RECORD, LOCALE_TIMERLIST_TYPE_REMIND, + LOCALE_TIMERLIST_TYPE_REMOTEBOX, LOCALE_TIMERLIST_TYPE_SHUTDOWN, LOCALE_TIMERLIST_TYPE_SLEEPTIMER, LOCALE_TIMERLIST_TYPE_STANDBY, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index 62c654dab..f8bfb6dec 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -2382,6 +2382,7 @@ const char * locale_real_names[] = "timerlist.type.nextprogram", "timerlist.type.record", "timerlist.type.remind", + "timerlist.type.remotebox", "timerlist.type.shutdown", "timerlist.type.sleeptimer", "timerlist.type.standby", diff --git a/src/system/settings.h b/src/system/settings.h index 3128c4c16..87e7504b4 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -450,6 +450,7 @@ struct SNeutrinoSettings int recording_slow_warning; int recording_startstop_msg; int shutdown_timer_record_type; + std::string remotebox_address; std::string recording_filename_template; int recording_already_found_check; From 37bd46c514810c5163b9119d95f5cb90b19fe603 Mon Sep 17 00:00:00 2001 From: TangoCash Date: Fri, 21 Oct 2016 10:47:37 +0200 Subject: [PATCH 07/14] suppleental to last commit: fix time corrections for remote timers Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/9d198343406d78199e6067b813988bef3c255833 Author: TangoCash Date: 2016-10-21 (Fri, 21 Oct 2016) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/timerlist.cpp | 18 +++++++++++++----- src/gui/timerlist.h | 1 + 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/gui/timerlist.cpp b/src/gui/timerlist.cpp index dc8966629..f751add38 100644 --- a/src/gui/timerlist.cpp +++ b/src/gui/timerlist.cpp @@ -342,8 +342,8 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey) r_url = "http://"; r_url += g_settings.remotebox_address; r_url += "/control/timer?action=new"; - r_url += "&alarm=" + to_string((int)timerlist[selected].alarmTime); - r_url += "&stop=" + to_string((int)timerlist[selected].stopTime); + r_url += "&alarm=" + to_string((int)timerlist[selected].alarmTime + rem_pre); + r_url += "&stop=" + to_string((int)timerlist[selected].stopTime - rem_post); r_url += "&announce=" + to_string((int)timerlist[selected].announceTime); r_url += "&channel_id=" + string_printf_helper(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS, timerlist[selected].channel_id); r_url += "&aj=on"; @@ -366,8 +366,10 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey) r_url = httpTool.downloadString(r_url); //printf("[remotetimer] status:%s\n",r_url.c_str()); if (r_url=="ok") { - Timer->addRecordTimerEvent(timerlist[selected].channel_id, timerlist[selected].alarmTime, - timerlist[selected].stopTime, 0, 0, timerlist[selected].announceTime, + int pre,post; + Timer->getRecordingSafety(pre,post); + Timer->addRecordTimerEvent(timerlist[selected].channel_id, timerlist[selected].alarmTime + pre, + timerlist[selected].stopTime - post, 0, 0, timerlist[selected].announceTime, TIMERD_APIDS_CONF, true, timerlist[selected].announceTime > time(NULL)); } } @@ -587,6 +589,12 @@ void CTimerList::remoteTimerList(CTimerd::TimerList &rtimerlist) printf("Failed to parse JSON\n"); printf("%s\n", reader.getFormattedErrorMessages().c_str()); } + Json::Value delays = root["data"]["timer"][0]; + + rem_pre = atoi(delays["config"].get("pre_delay","").asString()); + rem_post = atoi(delays["config"].get("post_delay","").asString()); + + //printf("[remotetimer] pre:%d - post:%d\n", rem_pre, rem_post); Json::Value remotetimers = root["data"]["timer"][0]["timer_list"]; @@ -743,7 +751,7 @@ int CTimerList::show() if ((timerlist[selected].eventType == CTimerd::TIMER_REMOTEBOX) && (timerlist[selected].eventState < CTimerd::TIMERSTATE_ISRUNNING)) exec(this,"del_remotetimer"); else - Timer->removeTimerEvent(timerlist[selected].eventID); + Timer->removeTimerEvent(timerlist[selected].eventID); update = true; } } diff --git a/src/gui/timerlist.h b/src/gui/timerlist.h index 65494d813..4c83cc467 100644 --- a/src/gui/timerlist.h +++ b/src/gui/timerlist.h @@ -87,6 +87,7 @@ class CTimerList : public CMenuTarget, public CListHelpers int saved_dispmode; void remoteTimerList(CTimerd::TimerList &timerlist); void enterRemoteBox(); + int rem_pre,rem_post; public: CTimerList(); From 7bb55736b8a12581af30dc75fe279ad638d68da3 Mon Sep 17 00:00:00 2001 From: TangoCash Date: Fri, 21 Oct 2016 10:47:37 +0200 Subject: [PATCH 08/14] check if channel is present (send + fetch) Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/7f91b853f7a26ba70691fee576587a57a4cbb281 Author: TangoCash Date: 2016-10-21 (Fri, 21 Oct 2016) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/timerlist.cpp | 39 +++++++++++++++++++++++++++++++++++++-- src/gui/timerlist.h | 2 ++ 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/src/gui/timerlist.cpp b/src/gui/timerlist.cpp index f751add38..557e1f56e 100644 --- a/src/gui/timerlist.cpp +++ b/src/gui/timerlist.cpp @@ -335,7 +335,7 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey) } return menu_return::RETURN_EXIT; } - else if (strcmp(key, "send_remotetimer") == 0) + else if ((strcmp(key, "send_remotetimer") == 0) && remoteChanExists(timerlist[selected].channel_id)) { CHTTPTool httpTool; std::string r_url; @@ -354,7 +354,7 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey) if (r_url=="ok") Timer->removeTimerEvent(timerlist[selected].eventID); } - else if (strcmp(key, "fetch_remotetimer") == 0) + else if ((strcmp(key, "fetch_remotetimer") == 0) && localChanExists(timerlist[selected].channel_id)) { CHTTPTool httpTool; std::string r_url; @@ -570,6 +570,41 @@ void CTimerList::updateEvents(void) y = getScreenStartY(height); } +bool CTimerList::remoteChanExists(t_channel_id channel_id) +{ + if (g_settings.remotebox_address.empty()) + return false; + CHTTPTool httpTool; + std::string r_url; + r_url = "http://"; + r_url += g_settings.remotebox_address; + r_url += "/control/getchannel?format=json&id="; + r_url += string_printf_helper(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS, channel_id); + r_url = httpTool.downloadString(r_url); + + Json::Value root; + Json::Reader reader; + bool parsedSuccess = reader.parse(r_url, root, false); + if (!parsedSuccess) { + printf("Failed to parse JSON\n"); + printf("%s\n", reader.getFormattedErrorMessages().c_str()); + } + + r_url = root.get("success","false").asString(); + return (r_url == "true"); +} + +bool CTimerList::localChanExists(t_channel_id channel_id) +{ + if (g_settings.remotebox_address.empty()) + return false; + CZapitChannel * channel = CServiceManager::getInstance()->FindChannel(channel_id); + if (channel) + return true; + else + return false; +} + void CTimerList::remoteTimerList(CTimerd::TimerList &rtimerlist) { if (g_settings.remotebox_address.empty()) diff --git a/src/gui/timerlist.h b/src/gui/timerlist.h index 4c83cc467..1f84e1f46 100644 --- a/src/gui/timerlist.h +++ b/src/gui/timerlist.h @@ -87,6 +87,8 @@ class CTimerList : public CMenuTarget, public CListHelpers int saved_dispmode; void remoteTimerList(CTimerd::TimerList &timerlist); void enterRemoteBox(); + bool remoteChanExists(t_channel_id channel_id); + bool localChanExists(t_channel_id channel_id); int rem_pre,rem_post; public: From 5de9f564aae65c9487f976f29e27e84834347bc8 Mon Sep 17 00:00:00 2001 From: TangoCash Date: Fri, 21 Oct 2016 10:47:37 +0200 Subject: [PATCH 09/14] add multiple remote boxes Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/f354089763dcab1385043510c25e0ce5084cb496 Author: TangoCash Date: 2016-10-21 (Fri, 21 Oct 2016) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- lib/timerdclient/timerdtypes.h | 3 ++ src/gui/timerlist.cpp | 76 ++++++++++++++++++++++++---------- src/gui/timerlist.h | 1 + src/neutrino.cpp | 22 +++++++++- src/system/settings.h | 2 +- 5 files changed, 80 insertions(+), 24 deletions(-) diff --git a/lib/timerdclient/timerdtypes.h b/lib/timerdclient/timerdtypes.h index 39481b97f..c5522d790 100644 --- a/lib/timerdclient/timerdtypes.h +++ b/lib/timerdclient/timerdtypes.h @@ -162,6 +162,9 @@ class CTimerd char pluginName[EXEC_PLUGIN_NAME_MAXLEN]; //only filled if applicable char recordingDir[RECORD_DIR_MAXLEN]; //only filled if applicable char epgTitle[EPG_TITLE_MAXLEN]; //only filled if applicable + char remotebox_ip[15]; + int rem_pre; + int rem_post; bool operator< (const responseGetTimer& a) const { diff --git a/src/gui/timerlist.cpp b/src/gui/timerlist.cpp index 557e1f56e..987ce687e 100644 --- a/src/gui/timerlist.cpp +++ b/src/gui/timerlist.cpp @@ -314,7 +314,7 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey) CHTTPTool httpTool; std::string r_url; r_url = "http://"; - r_url += g_settings.remotebox_address; + r_url += timerlist[selected].remotebox_ip; r_url += "/control/timer?action=new&update=1"; r_url += "&alarm=" + to_string((int)timerlist[selected].alarmTime); r_url += "&stop=" + to_string((int)timerlist[selected].stopTime); @@ -340,10 +340,10 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey) CHTTPTool httpTool; std::string r_url; r_url = "http://"; - r_url += g_settings.remotebox_address; + r_url += timerlist[selected].remotebox_ip; r_url += "/control/timer?action=new"; - r_url += "&alarm=" + to_string((int)timerlist[selected].alarmTime + rem_pre); - r_url += "&stop=" + to_string((int)timerlist[selected].stopTime - rem_post); + r_url += "&alarm=" + to_string((int)timerlist[selected].alarmTime + timerlist[selected].rem_pre); + r_url += "&stop=" + to_string((int)timerlist[selected].stopTime - timerlist[selected].rem_post); r_url += "&announce=" + to_string((int)timerlist[selected].announceTime); r_url += "&channel_id=" + string_printf_helper(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS, timerlist[selected].channel_id); r_url += "&aj=on"; @@ -359,7 +359,7 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey) CHTTPTool httpTool; std::string r_url; r_url = "http://"; - r_url += g_settings.remotebox_address; + r_url += timerlist[selected].remotebox_ip; r_url += "/control/timer?action=remove"; r_url += "&id=" + to_string((int)timerlist[selected].eventID); //printf("[remotetimer] url:%s\n",r_url.c_str()); @@ -378,7 +378,7 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey) CHTTPTool httpTool; std::string r_url; r_url = "http://"; - r_url += g_settings.remotebox_address; + r_url += timerlist[selected].remotebox_ip; r_url += "/control/timer?action=remove"; r_url += "&id=" + to_string((int)timerlist[selected].eventID); //printf("[remotetimer] url:%s\n",r_url.c_str()); @@ -390,7 +390,7 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey) CHTTPTool httpTool; std::string r_url; r_url = "http://"; - r_url += g_settings.remotebox_address; + r_url += timerlist[selected].remotebox_ip; r_url += "/control/timer?action=new&update=1"; r_url += "&alarm=" + to_string((int)timerlist[selected].alarmTime); r_url += "&stop=" + to_string((int)timerlist[selected].stopTime); @@ -548,7 +548,8 @@ void CTimerList::updateEvents(void) //get footerHeight from paintButtons footerHeight = ::paintButtons(TimerListButtons, TimerListButtonsCount, 0, 0, 0, 0, 0, false); - width = w_max(g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getWidth()*56, 20); + //width = w_max(g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getWidth()*56, 20); + width = frameBuffer->getScreenWidth()*0.9; height = frameBuffer->getScreenHeight() - (2*theight); // max height listmaxshow = (height-theight)/(fheight*2); @@ -570,14 +571,35 @@ void CTimerList::updateEvents(void) y = getScreenStartY(height); } +void CTimerList::select_remotebox_ip() +{ + if (g_settings.timer_remotebox_ip.size() == 1) { + std::list::iterator it = g_settings.timer_remotebox_ip.begin(); + strncpy(timerlist[selected].remotebox_ip,it->c_str(),15); + } + + int select = 0; + CMenuWidget *m = new CMenuWidget(LOCALE_TIMERLIST_NAME, NEUTRINO_ICON_TIMER); + CMenuSelectorTarget * selector = new CMenuSelectorTarget(&select); + + for (std::list::iterator it = g_settings.timer_remotebox_ip.begin(); it != g_settings.timer_remotebox_ip.end(); ++it) + m->addItem(new CMenuForwarder(*it, true, NULL, selector, to_string(std::distance(g_settings.timer_remotebox_ip.begin(),it)).c_str())); + + int res = m->exec(NULL, ""); + + delete selector; + + std::list::iterator it = g_settings.timer_remotebox_ip.begin(); + std::advance(it,select); + strncpy(timerlist[selected].remotebox_ip,it->c_str(),15); +} + bool CTimerList::remoteChanExists(t_channel_id channel_id) { - if (g_settings.remotebox_address.empty()) - return false; CHTTPTool httpTool; std::string r_url; r_url = "http://"; - r_url += g_settings.remotebox_address; + r_url += timerlist[selected].remotebox_ip; r_url += "/control/getchannel?format=json&id="; r_url += string_printf_helper(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS, channel_id); r_url = httpTool.downloadString(r_url); @@ -596,8 +618,6 @@ bool CTimerList::remoteChanExists(t_channel_id channel_id) bool CTimerList::localChanExists(t_channel_id channel_id) { - if (g_settings.remotebox_address.empty()) - return false; CZapitChannel * channel = CServiceManager::getInstance()->FindChannel(channel_id); if (channel) return true; @@ -607,12 +627,15 @@ bool CTimerList::localChanExists(t_channel_id channel_id) void CTimerList::remoteTimerList(CTimerd::TimerList &rtimerlist) { - if (g_settings.remotebox_address.empty()) + if (g_settings.timer_remotebox_ip.size() == 0) return; + CHTTPTool httpTool; std::string r_url; + for (std::list::iterator it = g_settings.timer_remotebox_ip.begin(); + it != g_settings.timer_remotebox_ip.end(); ++it) { r_url = "http://"; - r_url += g_settings.remotebox_address; + r_url += *it; r_url += "/control/timer?format=json"; r_url = httpTool.downloadString(r_url); //printf("[remotetimer] timers:%s\n",r_url.c_str()); @@ -626,8 +649,8 @@ void CTimerList::remoteTimerList(CTimerd::TimerList &rtimerlist) } Json::Value delays = root["data"]["timer"][0]; - rem_pre = atoi(delays["config"].get("pre_delay","").asString()); - rem_post = atoi(delays["config"].get("post_delay","").asString()); + rem_pre = atoi(delays["config"].get("pre_delay","0").asString()); + rem_post = atoi(delays["config"].get("post_delay","0").asString()); //printf("[remotetimer] pre:%d - post:%d\n", rem_pre, rem_post); @@ -636,6 +659,9 @@ void CTimerList::remoteTimerList(CTimerd::TimerList &rtimerlist) for (unsigned int i= 0; ic_str(),15); + rtimer.rem_pre = rem_pre; + rtimer.rem_post = rem_post; rtimer.eventID = atoi(remotetimers[i].get("id","").asString()); rtimer.eventType = CTimerd::TIMER_REMOTEBOX; rtimer.eventState = (CTimerd::CTimerEventStates) atoi(remotetimers[i].get("state","").asString()); @@ -658,7 +684,7 @@ void CTimerList::remoteTimerList(CTimerd::TimerList &rtimerlist) rtimerlist.push_back(rtimer); } } - + } } int CTimerList::show() @@ -739,9 +765,10 @@ int CTimerList::show() else update=true; } - else if ((msg == CRCInput::RC_play) && !(timerlist.empty()) && !(g_settings.remotebox_address.empty())) + else if ((msg == CRCInput::RC_play) && !(timerlist.empty()) && (g_settings.timer_remotebox_ip.size() > 0)) { if (timerlist[selected].eventType == CTimerd::TIMER_RECORD ) { + select_remotebox_ip(); if (exec(this,"send_remotetimer")) { res=menu_return::RETURN_EXIT_ALL; @@ -784,7 +811,11 @@ int CTimerList::show() } if (killTimer) { if ((timerlist[selected].eventType == CTimerd::TIMER_REMOTEBOX) && (timerlist[selected].eventState < CTimerd::TIMERSTATE_ISRUNNING)) - exec(this,"del_remotetimer"); + if (exec(this,"del_remotetimer")) + { + res=menu_return::RETURN_EXIT_ALL; + loop=false; + } else Timer->removeTimerEvent(timerlist[selected].eventID); update = true; @@ -875,11 +906,13 @@ void CTimerList::hide() void CTimerList::enterRemoteBox() { +/* CMenuWidget* remboxmenu = new CMenuWidget(LOCALE_MAINSETTINGS_HEAD, NEUTRINO_ICON_SETTINGS, 40, MN_WIDGET_ID_NETWORKSETUP); CIPInput remotebox_NetworkIP(LOCALE_NETWORKMENU_IPADDRESS , &g_settings.remotebox_address); CMenuForwarder *m1 = new CMenuForwarder(LOCALE_NETWORKMENU_IPADDRESS , true, g_settings.remotebox_address , &remotebox_NetworkIP ); remboxmenu->addItem( m1); remboxmenu->exec(NULL, ""); +*/ } void CTimerList::paintItem(int pos) @@ -941,7 +974,8 @@ void CTimerList::paintItem(int pos) sprintf(srepeatcount,"%ux",timer.repeatCount); g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+fw*13+(real_width-fw*23)/2,ypos+fheight, (real_width-fw*13)/2-5, srepeatcount, color, fheight); } - g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+fw*13+(real_width-fw*13)/2,ypos+fheight, (real_width-fw*13)/2-5, convertTimerType2String(timer.eventType), color, fheight); + std::string t_type = (timer.eventType == CTimerd::TIMER_REMOTEBOX) ? std::string(convertTimerType2String(timer.eventType)) + " (" + std::string(timer.remotebox_ip) + ")" : convertTimerType2String(timer.eventType); + g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+fw*13+(real_width-fw*13)/2,ypos+fheight, (real_width-fw*13)/2-5, t_type, color, fheight); // paint rec icon when recording in progress if ((timer.eventType == CTimerd::TIMER_RECORD) && (CRecordManager::getInstance()->RecordingStatus(timer.channel_id))) { diff --git a/src/gui/timerlist.h b/src/gui/timerlist.h index 1f84e1f46..2085d8e98 100644 --- a/src/gui/timerlist.h +++ b/src/gui/timerlist.h @@ -87,6 +87,7 @@ class CTimerList : public CMenuTarget, public CListHelpers int saved_dispmode; void remoteTimerList(CTimerd::TimerList &timerlist); void enterRemoteBox(); + void select_remotebox_ip(); bool remoteChanExists(t_channel_id channel_id); bool localChanExists(t_channel_id channel_id); int rem_pre,rem_post; diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 9a4f346e0..07187bda3 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -458,7 +458,17 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.shutdown_min = configfile.getInt32("shutdown_min", 180); g_settings.sleeptimer_min = configfile.getInt32("sleeptimer_min", 0); - g_settings.remotebox_address = configfile.getString("timer_remotebox", ""); + g_settings.timer_remotebox_ip.clear(); + int timer_remotebox_ip_count = configfile.getInt32("timer_remotebox_ip_count", 0); + if (timer_remotebox_ip_count) { + for (int i = 0; i < timer_remotebox_ip_count; i++) { + std::string k = "timer_remotebox_ip_" + to_string(i); + std::string timer_remotebox_ip = configfile.getString(k, ""); + if (timer_remotebox_ip.empty()) + continue; + g_settings.timer_remotebox_ip.push_back(timer_remotebox_ip); + } + } g_settings.infobar_sat_display = configfile.getBool("infobar_sat_display" , true ); g_settings.infobar_show_channeldesc = configfile.getBool("infobar_show_channeldesc" , false ); @@ -1045,7 +1055,15 @@ void CNeutrinoApp::saveSetup(const char * fname) configfile.setInt32("shutdown_count" , g_settings.shutdown_count); configfile.setInt32("shutdown_min" , g_settings.shutdown_min ); configfile.setInt32("sleeptimer_min", g_settings.sleeptimer_min); - configfile.setString("timer_remotebox", g_settings.remotebox_address); + + int timer_remotebox_ip_count = 0; + for (std::list::iterator it = g_settings.timer_remotebox_ip.begin(); it != g_settings.timer_remotebox_ip.end(); ++it) { + std::string k = "timer_remotebox_ip_" + to_string(timer_remotebox_ip_count); + configfile.setString(k, *it); + timer_remotebox_ip_count++; + } + configfile.setInt32 ( "timer_remotebox_ip_count", g_settings.timer_remotebox_ip.size()); + configfile.setBool("infobar_sat_display" , g_settings.infobar_sat_display ); configfile.setBool("infobar_show_channeldesc" , g_settings.infobar_show_channeldesc ); configfile.setInt32("infobar_subchan_disp_pos" , g_settings.infobar_subchan_disp_pos ); diff --git a/src/system/settings.h b/src/system/settings.h index 87e7504b4..0411b60a6 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -450,7 +450,7 @@ struct SNeutrinoSettings int recording_slow_warning; int recording_startstop_msg; int shutdown_timer_record_type; - std::string remotebox_address; + std::list timer_remotebox_ip; std::string recording_filename_template; int recording_already_found_check; From 1f467ce4f2e9af75f47275f95f645ffa43140e47 Mon Sep 17 00:00:00 2001 From: TangoCash Date: Fri, 21 Oct 2016 10:47:37 +0200 Subject: [PATCH 10/14] varius fixes Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/fb26f93d9872d5a60d36e7b00ed422e81ec8a18b Author: TangoCash Date: 2016-10-21 (Fri, 21 Oct 2016) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- lib/timerdclient/timerdtypes.h | 2 +- src/gui/timerlist.cpp | 89 +++++++++++++++++++++++++++++----- 2 files changed, 79 insertions(+), 12 deletions(-) diff --git a/lib/timerdclient/timerdtypes.h b/lib/timerdclient/timerdtypes.h index c5522d790..040094c1e 100644 --- a/lib/timerdclient/timerdtypes.h +++ b/lib/timerdclient/timerdtypes.h @@ -162,7 +162,7 @@ class CTimerd char pluginName[EXEC_PLUGIN_NAME_MAXLEN]; //only filled if applicable char recordingDir[RECORD_DIR_MAXLEN]; //only filled if applicable char epgTitle[EPG_TITLE_MAXLEN]; //only filled if applicable - char remotebox_ip[15]; + char remotebox_ip[16]; int rem_pre; int rem_post; diff --git a/src/gui/timerlist.cpp b/src/gui/timerlist.cpp index 987ce687e..14bf92e16 100644 --- a/src/gui/timerlist.cpp +++ b/src/gui/timerlist.cpp @@ -575,7 +575,8 @@ void CTimerList::select_remotebox_ip() { if (g_settings.timer_remotebox_ip.size() == 1) { std::list::iterator it = g_settings.timer_remotebox_ip.begin(); - strncpy(timerlist[selected].remotebox_ip,it->c_str(),15); + strncpy(timerlist[selected].remotebox_ip,it->c_str(),sizeof(timerlist[selected].remotebox_ip)); + timerlist[selected].remotebox_ip[sizeof(timerlist[selected].remotebox_ip) - 1] = 0; } int select = 0; @@ -591,7 +592,8 @@ void CTimerList::select_remotebox_ip() std::list::iterator it = g_settings.timer_remotebox_ip.begin(); std::advance(it,select); - strncpy(timerlist[selected].remotebox_ip,it->c_str(),15); + strncpy(timerlist[selected].remotebox_ip,it->c_str(),sizeof(timerlist[selected].remotebox_ip)); + timerlist[selected].remotebox_ip[sizeof(timerlist[selected].remotebox_ip) - 1] = 0; } bool CTimerList::remoteChanExists(t_channel_id channel_id) @@ -613,6 +615,11 @@ bool CTimerList::remoteChanExists(t_channel_id channel_id) } r_url = root.get("success","false").asString(); + + if (r_url == "false") + ShowMsg(LOCALE_STREAMINFO_NOT_AVAILABLE, convertChannelId2String(channel_id), + CMessageBox::mbrOk, CMessageBox::mbOk, NULL, 450, 30, false); + return (r_url == "true"); } @@ -659,7 +666,8 @@ void CTimerList::remoteTimerList(CTimerd::TimerList &rtimerlist) for (unsigned int i= 0; ic_str(),15); + strncpy(rtimer.remotebox_ip,it->c_str(),sizeof(rtimer.remotebox_ip)); + rtimer.remotebox_ip[sizeof(rtimer.remotebox_ip) - 1] = 0; rtimer.rem_pre = rem_pre; rtimer.rem_post = rem_post; rtimer.eventID = atoi(remotetimers[i].get("id","").asString()); @@ -788,6 +796,13 @@ int CTimerList::show() } else if ((msg == CRCInput::RC_red) && !(timerlist.empty())) { + if ((timerlist[selected].eventType == CTimerd::TIMER_REMOTEBOX) && (timerlist[selected].eventState < CTimerd::TIMERSTATE_ISRUNNING)) { + if (exec(this,"del_remotetimer")) + { + res=menu_return::RETURN_EXIT_ALL; + loop=false; + } + } else { bool killTimer = true; if (CRecordManager::getInstance()->RecordingStatus(timerlist[selected].channel_id)) { CTimerd::RecordingStopInfo recinfo; @@ -810,17 +825,11 @@ int CTimerList::show() } } if (killTimer) { - if ((timerlist[selected].eventType == CTimerd::TIMER_REMOTEBOX) && (timerlist[selected].eventState < CTimerd::TIMERSTATE_ISRUNNING)) - if (exec(this,"del_remotetimer")) - { - res=menu_return::RETURN_EXIT_ALL; - loop=false; - } - else Timer->removeTimerEvent(timerlist[selected].eventID); update = true; } } + } else if (msg==CRCInput::RC_green) { if (newTimer()==menu_return::RETURN_EXIT_ALL) @@ -991,13 +1000,20 @@ void CTimerList::paintItem(int pos) } } + if ((timer.eventType == CTimerd::TIMER_REMOTEBOX) && timer.eventState == CTimerd::TIMERSTATE_ISRUNNING) { + int icol_w, icol_h; + frameBuffer->getIconSize(NEUTRINO_ICON_REC, &icol_w, &icol_h); + if ((icol_w > 0) && (icol_h > 0)) { + frameBuffer->paintIcon(NEUTRINO_ICON_REC, (x + real_width) - (icol_w + 8), ypos, 2*fheight); + } + } + std::string zAddData(""); switch (timer.eventType) { //case CTimerd::TIMER_NEXTPROGRAM : case CTimerd::TIMER_ZAPTO : case CTimerd::TIMER_RECORD : - case CTimerd::TIMER_REMOTEBOX : { zAddData = convertChannelId2String(timer.channel_id); // UTF-8 if (timer.apids != TIMERD_APIDS_CONF) @@ -1044,6 +1060,57 @@ void CTimerList::paintItem(int pos) } } break; + case CTimerd::TIMER_REMOTEBOX : + { + CHTTPTool httpTool; + std::string r_url; + r_url = "http://"; + r_url += std::string(timer.remotebox_ip); + r_url += "/control/getchannel?format=json&id="; + r_url += string_printf_helper(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS, timer.channel_id); + r_url = httpTool.downloadString(r_url); + + Json::Value root; + Json::Reader reader; + bool parsedSuccess = reader.parse(r_url, root, false); + if (!parsedSuccess) { + printf("Failed to parse JSON\n"); + printf("%s\n", reader.getFormattedErrorMessages().c_str()); + } + + Json::Value remotechannel = root["data"]["channel"][0]; + + zAddData = remotechannel.get("name","").asString(); + if (timer.apids != TIMERD_APIDS_CONF) + { + std::string sep = ""; + zAddData += " ("; + if (timer.apids & TIMERD_APIDS_STD) + { + zAddData += "STD"; + sep = "/"; + } + if (timer.apids & TIMERD_APIDS_ALT) + { + zAddData += sep; + zAddData += "ALT"; + sep = "/"; + } + if (timer.apids & TIMERD_APIDS_AC3) + { + zAddData += sep; + zAddData += "AC3"; +// sep = "/"; + } + zAddData += ')'; + } + if (strlen(timer.epgTitle)!=0) + { + zAddData += " : "; + zAddData += timer.epgTitle; + } + } + break; case CTimerd::TIMER_STANDBY: { zAddData = g_Locale->getText(timer.standby_on ? LOCALE_TIMERLIST_STANDBY_ON : LOCALE_TIMERLIST_STANDBY_OFF); From c1a8ca7b80cf0753e2020a150dd69beb36959edc Mon Sep 17 00:00:00 2001 From: TangoCash Date: Fri, 21 Oct 2016 10:47:37 +0200 Subject: [PATCH 11/14] add locals, add menu to manage box ip's Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/083c547e2767a1a6b2b8a01a4f87edd502bceda5 Author: TangoCash Date: 2016-10-21 (Fri, 21 Oct 2016) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- data/locale/deutsch.locale | 6 +++ data/locale/english.locale | 6 +++ src/gui/timerlist.cpp | 81 +++++++++++++++++++++++++++++++++----- src/gui/timerlist.h | 3 ++ src/system/locals.h | 6 +++ src/system/locals_intern.h | 6 +++ 6 files changed, 99 insertions(+), 9 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index f87c2006e..92dc38778 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -2091,6 +2091,12 @@ recordingmenu.vcr Videorekorder recordingmenu.vtxt_pid Teletext aufnehmen recordingmenu.zap_on_announce Umschalten bei Ankündigung recordtimer.announce Die Aufnahme beginnt in wenigen Minuten. +remotebox_add hinzufügen +remotebox_channel_na Kanal auf Remote-Box nicht verfügbar +remotebox_del löschen +remotebox_head Remote-Boxen +remotebox_ip Remote-Box IP +remotebox_mod bearbeiten reset_all Werkseinstellungen und Reboot reset_channels Lösche Kanäle reset_confirm Sind Sie sich sicher? diff --git a/data/locale/english.locale b/data/locale/english.locale index a599cea3c..de9e55ee9 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -2091,6 +2091,12 @@ recordingmenu.vcr vcr recordingmenu.vtxt_pid record teletext recordingmenu.zap_on_announce zap on recording announce recordtimer.announce Recording starts in a few minutes +remotebox_add add +remotebox_channel_na Channel not available on Remote-Box +remotebox_del delete +remotebox_head Remote-Boxes +remotebox_ip Remote-Box IP +remotebox_mod modify reset_all Factory reset and reboot reset_channels Delete all channels reset_confirm Are you sure ? diff --git a/src/gui/timerlist.cpp b/src/gui/timerlist.cpp index 14bf92e16..d4ebfd2c6 100644 --- a/src/gui/timerlist.cpp +++ b/src/gui/timerlist.cpp @@ -3,6 +3,8 @@ Timerliste by Zwen (C) 2009, 2011-2014 Stefan Seyfried + Remote Timers by + (C) 2016 TangoCash Homepage: http://dbox.cyberphoria.org/ @@ -291,6 +293,42 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey) { const char * key = actionKey.c_str(); + if(actionKey == "add_ip") { + std::string remoteip; + CIPInput remotebox_NetworkIP(LOCALE_REMOTEBOX_IP , &remoteip); + if (remotebox_NetworkIP.exec(NULL,"") == true) { + remboxmenu->addItem(new CMenuForwarder(remoteip, true, NULL, this, "cha_ip")); + remotebox_NetworkIP.hide(); + changed = true; + } + return menu_return::RETURN_EXIT; + } + + if(actionKey == "del_ip") { + selected = remboxmenu->getSelected(); + if (selected >= item_offset) { + remboxmenu->removeItem(selected); + remboxmenu->hide(); + selected = remboxmenu->getSelected(); + changed = true; + } + return menu_return::RETURN_EXIT; + } + + if(actionKey == "cha_ip") { + selected = remboxmenu->getSelected(); + CMenuItem* item = remboxmenu->getItem(selected); + CMenuForwarder *f = static_cast(item); + std::string remoteip = f->getName(); + CIPInput remotebox_NetworkIP(LOCALE_REMOTEBOX_IP , &remoteip); + if (remotebox_NetworkIP.exec(NULL,"") == true) { + f->setName(remoteip); + remotebox_NetworkIP.hide(); + changed = true; + } + return menu_return::RETURN_EXIT; + } + if (strcmp(key, "modifytimer") == 0) { timerlist[selected].announceTime = timerlist[selected].alarmTime -60; @@ -536,6 +574,13 @@ struct button_label TimerListButtons[TimerListButtonsCount] = { NEUTRINO_ICON_BUTTON_MENU_SMALL, NONEXISTANT_LOCALE } }; +#define RemoteBoxFooterButtonCount 3 +static const struct button_label RemoteBoxFooterButtons[RemoteBoxFooterButtonCount] = { + { NEUTRINO_ICON_BUTTON_RED, LOCALE_REMOTEBOX_DEL }, + { NEUTRINO_ICON_BUTTON_GREEN, LOCALE_REMOTEBOX_ADD }, + { NEUTRINO_ICON_BUTTON_OKAY, LOCALE_REMOTEBOX_MOD } +}; + void CTimerList::updateEvents(void) { timerlist.clear(); @@ -580,13 +625,13 @@ void CTimerList::select_remotebox_ip() } int select = 0; - CMenuWidget *m = new CMenuWidget(LOCALE_TIMERLIST_NAME, NEUTRINO_ICON_TIMER); + CMenuWidget *m = new CMenuWidget(LOCALE_REMOTEBOX_HEAD, NEUTRINO_ICON_TIMER); CMenuSelectorTarget * selector = new CMenuSelectorTarget(&select); for (std::list::iterator it = g_settings.timer_remotebox_ip.begin(); it != g_settings.timer_remotebox_ip.end(); ++it) m->addItem(new CMenuForwarder(*it, true, NULL, selector, to_string(std::distance(g_settings.timer_remotebox_ip.begin(),it)).c_str())); - int res = m->exec(NULL, ""); + m->exec(NULL, ""); delete selector; @@ -617,7 +662,7 @@ bool CTimerList::remoteChanExists(t_channel_id channel_id) r_url = root.get("success","false").asString(); if (r_url == "false") - ShowMsg(LOCALE_STREAMINFO_NOT_AVAILABLE, convertChannelId2String(channel_id), + ShowMsg(LOCALE_REMOTEBOX_CHANNEL_NA, convertChannelId2String(channel_id), CMessageBox::mbrOk, CMessageBox::mbOk, NULL, 450, 30, false); return (r_url == "true"); @@ -915,13 +960,31 @@ void CTimerList::hide() void CTimerList::enterRemoteBox() { -/* - CMenuWidget* remboxmenu = new CMenuWidget(LOCALE_MAINSETTINGS_HEAD, NEUTRINO_ICON_SETTINGS, 40, MN_WIDGET_ID_NETWORKSETUP); - CIPInput remotebox_NetworkIP(LOCALE_NETWORKMENU_IPADDRESS , &g_settings.remotebox_address); - CMenuForwarder *m1 = new CMenuForwarder(LOCALE_NETWORKMENU_IPADDRESS , true, g_settings.remotebox_address , &remotebox_NetworkIP ); - remboxmenu->addItem( m1); + remboxmenu = new CMenuWidget(LOCALE_REMOTEBOX_HEAD, NEUTRINO_ICON_TIMER); + remboxmenu->addKey(CRCInput::RC_red, this, "del_ip"); + remboxmenu->addKey(CRCInput::RC_green, this, "add_ip"); + + remboxmenu->addIntroItems(); + + item_offset = remboxmenu->getItemsCount(); + for (std::list::iterator it = g_settings.timer_remotebox_ip.begin(); + it != g_settings.timer_remotebox_ip.end(); ++it) + remboxmenu->addItem(new CMenuForwarder(*it, true, NULL, this, "cha_ip")); + + remboxmenu->setFooter(RemoteBoxFooterButtons, RemoteBoxFooterButtonCount); + remboxmenu->exec(NULL, ""); -*/ + remboxmenu->hide(); + if (changed) { + g_settings.timer_remotebox_ip.clear(); + for (int i = item_offset; i < remboxmenu->getItemsCount(); i++) { + CMenuItem *item = remboxmenu->getItem(i); + CMenuForwarder *f = static_cast(item); + g_settings.timer_remotebox_ip.push_back(f->getName()); + } + changed = false; + } + delete remboxmenu; } void CTimerList::paintItem(int pos) diff --git a/src/gui/timerlist.h b/src/gui/timerlist.h index 2085d8e98..8d31b84e9 100644 --- a/src/gui/timerlist.h +++ b/src/gui/timerlist.h @@ -91,6 +91,9 @@ class CTimerList : public CMenuTarget, public CListHelpers bool remoteChanExists(t_channel_id channel_id); bool localChanExists(t_channel_id channel_id); int rem_pre,rem_post; + int item_offset; + bool changed; + CMenuWidget *remboxmenu; public: CTimerList(); diff --git a/src/system/locals.h b/src/system/locals.h index 1d7b43b3a..f66030446 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -2118,6 +2118,12 @@ typedef enum LOCALE_RECORDINGMENU_VTXT_PID, LOCALE_RECORDINGMENU_ZAP_ON_ANNOUNCE, LOCALE_RECORDTIMER_ANNOUNCE, + LOCALE_REMOTEBOX_ADD, + LOCALE_REMOTEBOX_CHANNEL_NA, + LOCALE_REMOTEBOX_DEL, + LOCALE_REMOTEBOX_HEAD, + LOCALE_REMOTEBOX_IP, + LOCALE_REMOTEBOX_MOD, LOCALE_RESET_ALL, LOCALE_RESET_CHANNELS, LOCALE_RESET_CONFIRM, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index f8bfb6dec..2439efe55 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -2118,6 +2118,12 @@ const char * locale_real_names[] = "recordingmenu.vtxt_pid", "recordingmenu.zap_on_announce", "recordtimer.announce", + "remotebox_add", + "remotebox_channel_na", + "remotebox_del", + "remotebox_head", + "remotebox_ip", + "remotebox_mod", "reset_all", "reset_channels", "reset_confirm", From ee5d593d55fb994611a8251adc55f0c9d2da9bdc Mon Sep 17 00:00:00 2001 From: TangoCash Date: Fri, 21 Oct 2016 10:47:38 +0200 Subject: [PATCH 12/14] fix menue Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/9b0137377a02a9dc4a7f01ec7ed534276962b01b Author: TangoCash Date: 2016-10-21 (Fri, 21 Oct 2016) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/timerlist.cpp | 25 +++++++++---------------- src/gui/timerlist.h | 1 + 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/src/gui/timerlist.cpp b/src/gui/timerlist.cpp index d4ebfd2c6..01379289f 100644 --- a/src/gui/timerlist.cpp +++ b/src/gui/timerlist.cpp @@ -301,23 +301,23 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey) remotebox_NetworkIP.hide(); changed = true; } - return menu_return::RETURN_EXIT; + return menu_return::RETURN_REPAINT; } if(actionKey == "del_ip") { - selected = remboxmenu->getSelected(); - if (selected >= item_offset) { - remboxmenu->removeItem(selected); + bselected = remboxmenu->getSelected(); + if (bselected >= item_offset) { + remboxmenu->removeItem(bselected); remboxmenu->hide(); - selected = remboxmenu->getSelected(); + bselected = remboxmenu->getSelected(); changed = true; } - return menu_return::RETURN_EXIT; + return menu_return::RETURN_REPAINT; } if(actionKey == "cha_ip") { - selected = remboxmenu->getSelected(); - CMenuItem* item = remboxmenu->getItem(selected); + bselected = remboxmenu->getSelected(); + CMenuItem* item = remboxmenu->getItem(bselected); CMenuForwarder *f = static_cast(item); std::string remoteip = f->getName(); CIPInput remotebox_NetworkIP(LOCALE_REMOTEBOX_IP , &remoteip); @@ -326,7 +326,7 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey) remotebox_NetworkIP.hide(); changed = true; } - return menu_return::RETURN_EXIT; + return menu_return::RETURN_REPAINT; } if (strcmp(key, "modifytimer") == 0) @@ -887,10 +887,8 @@ int CTimerList::show() } else if (msg==CRCInput::RC_setup) { - hide(); enterRemoteBox(); update=true; - paint(); } else if (msg==CRCInput::RC_yellow) { @@ -905,11 +903,6 @@ int CTimerList::show() loop=false; } #endif - else if (msg==CRCInput::RC_setup) - { - res=menu_return::RETURN_EXIT_ALL; - loop=false; - } else if ( msg == CRCInput::RC_help || msg == CRCInput::RC_info) { CTimerd::responseGetTimer* timer=&timerlist[selected]; diff --git a/src/gui/timerlist.h b/src/gui/timerlist.h index 8d31b84e9..3ed0af33c 100644 --- a/src/gui/timerlist.h +++ b/src/gui/timerlist.h @@ -93,6 +93,7 @@ class CTimerList : public CMenuTarget, public CListHelpers int rem_pre,rem_post; int item_offset; bool changed; + int bselected; CMenuWidget *remboxmenu; public: From 8f48e56d7a303451016d32c9db7891b708e1c698 Mon Sep 17 00:00:00 2001 From: TangoCash Date: Fri, 21 Oct 2016 10:47:38 +0200 Subject: [PATCH 13/14] add play button in footer Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/cc5567e0efa19b28b5d372571d280aa2c62fd343 Author: TangoCash Date: 2016-10-21 (Fri, 21 Oct 2016) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/timerlist.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/timerlist.cpp b/src/gui/timerlist.cpp index 01379289f..a7ae8a3e5 100644 --- a/src/gui/timerlist.cpp +++ b/src/gui/timerlist.cpp @@ -563,7 +563,7 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey) }*/ } -#define TimerListButtonsCount 6 +#define TimerListButtonsCount 7 struct button_label TimerListButtons[TimerListButtonsCount] = { { NEUTRINO_ICON_BUTTON_RED , LOCALE_TIMERLIST_DELETE }, @@ -571,6 +571,7 @@ struct button_label TimerListButtons[TimerListButtonsCount] = { NEUTRINO_ICON_BUTTON_YELLOW , LOCALE_TIMERLIST_RELOAD }, { NEUTRINO_ICON_BUTTON_BLUE , LOCALE_TIMERLIST_MODIFY }, { NEUTRINO_ICON_BUTTON_INFO_SMALL, NONEXISTANT_LOCALE }, + { NEUTRINO_ICON_BUTTON_PLAY, NONEXISTANT_LOCALE }, { NEUTRINO_ICON_BUTTON_MENU_SMALL, NONEXISTANT_LOCALE } }; From a41206902ff16b122889e7173ecd5c1c57b9715b Mon Sep 17 00:00:00 2001 From: vanhofen Date: Fri, 21 Oct 2016 10:47:38 +0200 Subject: [PATCH 14/14] timerlist: auto-calculate TimerListButtonsCount Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/9a9fc2097b6d4b8330c811e75ded9162cdb01bf3 Author: vanhofen Date: 2016-10-21 (Fri, 21 Oct 2016) Origin message was: ------------------ - timerlist: auto-calculate TimerListButtonsCount ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/timerlist.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/timerlist.cpp b/src/gui/timerlist.cpp index a7ae8a3e5..346363342 100644 --- a/src/gui/timerlist.cpp +++ b/src/gui/timerlist.cpp @@ -563,17 +563,17 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey) }*/ } -#define TimerListButtonsCount 7 -struct button_label TimerListButtons[TimerListButtonsCount] = +struct button_label TimerListButtons[] = { { NEUTRINO_ICON_BUTTON_RED , LOCALE_TIMERLIST_DELETE }, { NEUTRINO_ICON_BUTTON_GREEN , LOCALE_TIMERLIST_NEW }, { NEUTRINO_ICON_BUTTON_YELLOW , LOCALE_TIMERLIST_RELOAD }, { NEUTRINO_ICON_BUTTON_BLUE , LOCALE_TIMERLIST_MODIFY }, { NEUTRINO_ICON_BUTTON_INFO_SMALL, NONEXISTANT_LOCALE }, - { NEUTRINO_ICON_BUTTON_PLAY, NONEXISTANT_LOCALE }, - { NEUTRINO_ICON_BUTTON_MENU_SMALL, NONEXISTANT_LOCALE } + { NEUTRINO_ICON_BUTTON_MENU_SMALL, NONEXISTANT_LOCALE }, + { NEUTRINO_ICON_BUTTON_PLAY , NONEXISTANT_LOCALE } }; +size_t TimerListButtonsCount = sizeof(TimerListButtons)/sizeof(TimerListButtons[0]); #define RemoteBoxFooterButtonCount 3 static const struct button_label RemoteBoxFooterButtons[RemoteBoxFooterButtonCount] = {