diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index dd3a7dfe0..c76350a70 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -1881,6 +1881,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' @@ -1931,6 +1932,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 @@ -2314,6 +2316,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? @@ -2590,6 +2598,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 21090c2e0..710f75668 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -1881,6 +1881,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 @@ -1931,6 +1932,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 @@ -2313,6 +2315,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 ? @@ -2589,6 +2597,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 56e24651a..2caaf99fb 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 @@ -165,6 +166,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[16]; + int rem_pre; + int rem_post; bool channel_ci; //NI bool operator< (const responseGetTimer& a) const diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index bc1697fcd..5f27ee4e0 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -501,7 +501,7 @@ void CChannelList::calcSize() else info_height = 0; height = frameBuffer->getScreenHeightRel(); //NI - height = height - info_height; + height = height - OFFSET_INTER - info_height; // calculate x position x = getScreenStartX(full_width); @@ -519,7 +519,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; @@ -992,6 +992,7 @@ void CChannelList::hide() delete CChannelLogo; CChannelLogo = NULL; } + frameBuffer->paintBackground(); //NI clear whole screen clearItem2DetailsLine(); CInfoClock::getInstance()->enableInfoClock(!CInfoClock::getInstance()->isBlocked()); @@ -1552,14 +1553,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, 1, COL_FRAME_PLUS_0, RADIUS_LARGE); //NI + frameBuffer->paintBoxRel(x, ypos, full_width, info_height, COL_MENUCONTENTDARK_PLUS_0, RADIUS_LARGE); + frameBuffer->paintBoxFrame(x, ypos, full_width, info_height, 1, COL_FRAME_PLUS_0, RADIUS_LARGE); //NI if ((*chanlist).empty()) return; @@ -1609,7 +1613,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())) { @@ -1626,18 +1630,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); @@ -1648,7 +1652,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 @@ -1662,8 +1666,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); } } } @@ -1686,7 +1690,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) { diff --git a/src/gui/filebrowser.cpp b/src/gui/filebrowser.cpp index 96f4c78fe..eb4e639c2 100644 --- a/src/gui/filebrowser.cpp +++ b/src/gui/filebrowser.cpp @@ -1174,7 +1174,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]; diff --git a/src/gui/moviebrowser/mb.cpp b/src/gui/moviebrowser/mb.cpp index a53d81571..d8b7d033f 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-2015 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 @@ -177,6 +179,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 }; @@ -202,6 +205,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] = { @@ -226,6 +230,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; @@ -3553,7 +3558,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/gui/timerlist.cpp b/src/gui/timerlist.cpp index b1b55c48e..b9b3ff2d5 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/ @@ -67,6 +69,9 @@ #include #include #include +#include + +#include #include #include @@ -249,6 +254,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() { @@ -279,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_REPAINT; + } + + if(actionKey == "del_ip") { + bselected = remboxmenu->getSelected(); + if (bselected >= item_offset) { + remboxmenu->removeItem(bselected); + remboxmenu->hide(); + bselected = remboxmenu->getSelected(); + changed = true; + } + return menu_return::RETURN_REPAINT; + } + + if(actionKey == "cha_ip") { + 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); + if (remotebox_NetworkIP.exec(NULL,"") == true) { + f->setName(remoteip); + remotebox_NetworkIP.hide(); + changed = true; + } + return menu_return::RETURN_REPAINT; + } + if (strcmp(key, "modifytimer") == 0) { timerlist[selected].announceTime = timerlist[selected].alarmTime -60; @@ -297,6 +347,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 += 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); + 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 +373,73 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey) } return menu_return::RETURN_EXIT; } + else if ((strcmp(key, "send_remotetimer") == 0) && remoteChanExists(timerlist[selected].channel_id)) + { + CHTTPTool httpTool; + std::string r_url; + r_url = "http://"; + r_url += timerlist[selected].remotebox_ip; + r_url += "/control/timer?action=new"; + 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"; + 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) && localChanExists(timerlist[selected].channel_id)) + { + CHTTPTool httpTool; + std::string r_url; + r_url = "http://"; + 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()); + r_url = httpTool.downloadString(r_url); + //printf("[remotetimer] status:%s\n",r_url.c_str()); + if (r_url=="ok") { + 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)); + } + } + else if (strcmp(key, "del_remotetimer") == 0) + { + CHTTPTool httpTool; + std::string r_url; + r_url = "http://"; + 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()); + 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 += 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); + 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 +563,30 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey) }*/ } -#define TimerListButtonsCount 5 -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_INFO_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] = { + { 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(); Timer->getTimerList (timerlist); + remoteTimerList (timerlist); sort(timerlist.begin(), timerlist.end()); theight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); @@ -450,7 +594,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); @@ -472,6 +617,129 @@ 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(),sizeof(timerlist[selected].remotebox_ip)); + timerlist[selected].remotebox_ip[sizeof(timerlist[selected].remotebox_ip) - 1] = 0; + } + + int select = 0; + 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())); + + 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(),sizeof(timerlist[selected].remotebox_ip)); + timerlist[selected].remotebox_ip[sizeof(timerlist[selected].remotebox_ip) - 1] = 0; +} + +bool CTimerList::remoteChanExists(t_channel_id channel_id) +{ + CHTTPTool httpTool; + std::string r_url; + r_url = "http://"; + 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); + + 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(); + + if (r_url == "false") + ShowMsg(LOCALE_REMOTEBOX_CHANNEL_NA, convertChannelId2String(channel_id), + CMessageBox::mbrOk, CMessageBox::mbOk, NULL, 450, 30, false); + + return (r_url == "true"); +} + +bool CTimerList::localChanExists(t_channel_id channel_id) +{ + CZapitChannel * channel = CServiceManager::getInstance()->FindChannel(channel_id); + if (channel) + return true; + else + return false; +} + +void CTimerList::remoteTimerList(CTimerd::TimerList &rtimerlist) +{ + 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 += *it; + 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 delays = root["data"]["timer"][0]; + + 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); + + Json::Value remotetimers = root["data"]["timer"][0]["timer_list"]; + + for (unsigned int i= 0; ic_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()); + rtimer.eventType = CTimerd::TIMER_REMOTEBOX; + rtimer.eventState = (CTimerd::CTimerEventStates) atoi(remotetimers[i].get("state","").asString()); + if ( remotetimers[i]["repeat"].get("count","").asString() == "-") + rtimer.repeatCount = 0; + else + rtimer.repeatCount = atoi(remotetimers[i]["repeat"].get("count","").asString()); + rtimer.eventRepeat = (CTimerd::CTimerEventRepeat)(atoi(remotetimers[i]["repeat"].get("number","").asString()) & 0x1FF); + std::string wd = remotetimers[i]["repeat"].get("weekdays","").asString(); + CTimerdClient().getWeekdaysFromStr(&rtimer.eventRepeat, wd); + rtimer.alarmTime = (time_t) atoll(remotetimers[i]["alarm"][0].get("digits","").asString().c_str()); + rtimer.announceTime = (time_t) atoll(remotetimers[i]["announce"][0].get("digits","").asString().c_str()); + rtimer.stopTime = (time_t) atoll(remotetimers[i]["stop"][0].get("digits","").asString().c_str()); + rtimer.epgID = (event_id_t) atoi(remotetimers[i].get("epg_id","").asString()); + sscanf(remotetimers[i].get("channel_id","").asString().c_str(), SCANF_CHANNEL_ID_TYPE, &rtimer.channel_id); + strncpy(rtimer.epgTitle,remotetimers[i].get("title","").asString().c_str(),51); + if (remotetimers[i]["audio"].get("apids_conf","").asString() == "true") + rtimer.apids = TIMERD_APIDS_CONF; + //printf("[remotetimer] r-timer:%s - %s\n", remotetimers[i].get("channel_id","").asString().c_str(), remotetimers[i].get("title","").asString().c_str()); + rtimerlist.push_back(rtimer); + } + } + } +} int CTimerList::show() { @@ -551,8 +819,36 @@ int CTimerList::show() else update=true; } + 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; + loop=false; + } + else + update=true; + } else if (timerlist[selected].eventType == CTimerd::TIMER_REMOTEBOX ) { + if (exec(this,"fetch_remotetimer")) + { + res=menu_return::RETURN_EXIT_ALL; + loop=false; + } + else + update=true; + } + } 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; @@ -575,10 +871,11 @@ int CTimerList::show() } } if (killTimer) { - Timer->removeTimerEvent(timerlist[selected].eventID); + Timer->removeTimerEvent(timerlist[selected].eventID); update = true; } } + } else if (msg==CRCInput::RC_green) { if (newTimer()==menu_return::RETURN_EXIT_ALL) @@ -589,6 +886,11 @@ int CTimerList::show() else update=true; } + else if (msg==CRCInput::RC_setup) + { + enterRemoteBox(); + update=true; + } else if (msg==CRCInput::RC_yellow) { update=true; @@ -602,17 +904,12 @@ 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]; 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 +952,35 @@ void CTimerList::hide() } } +void CTimerList::enterRemoteBox() +{ + 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) { int ypos = y+ theight+ pos*fheight*2; @@ -714,7 +1040,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))) { @@ -730,6 +1057,14 @@ 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) { @@ -783,6 +1118,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); @@ -849,7 +1235,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; @@ -915,6 +1301,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..3ed0af33c 100644 --- a/src/gui/timerlist.h +++ b/src/gui/timerlist.h @@ -85,6 +85,16 @@ 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(); + void select_remotebox_ip(); + bool remoteChanExists(t_channel_id channel_id); + bool localChanExists(t_channel_id channel_id); + int rem_pre,rem_post; + int item_offset; + bool changed; + int bselected; + CMenuWidget *remboxmenu; public: CTimerList(); diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 76c9e90e8..89de31673 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -526,6 +526,18 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.shutdown_min = configfile.getInt32("shutdown_min", 000); //NI g_settings.sleeptimer_min = configfile.getInt32("sleeptimer_min", 0); + 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 ); g_settings.infobar_subchan_disp_pos = configfile.getInt32("infobar_subchan_disp_pos" , 0 ); @@ -1173,6 +1185,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); + + 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/httptool.cpp b/src/system/httptool.cpp index d57325029..7ba5f8eec 100644 --- a/src/system/httptool.cpp +++ b/src/system/httptool.cpp @@ -45,6 +45,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*/ ) { @@ -133,3 +141,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 93e04a4f2..0399414b4 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, int connecttimeout=10, int timeout=1800); //NI + std::string downloadString(const std::string & URL, int globalProgressEnd=-1 ); }; diff --git a/src/system/locals.h b/src/system/locals.h index 5eaadada8..4f9f86c42 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -1908,6 +1908,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, @@ -1958,6 +1959,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, @@ -2340,6 +2342,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, @@ -2616,6 +2624,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 b6644acf0..efafae68e 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -1908,6 +1908,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", @@ -1958,6 +1959,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", @@ -2340,6 +2342,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", @@ -2616,6 +2624,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 957ef5a2f..6648cd3e5 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -463,6 +463,7 @@ struct SNeutrinoSettings int recording_fill_warning; //NI int recording_startstop_msg; int shutdown_timer_record_type; + std::list timer_remotebox_ip; std::string recording_filename_template; int recording_already_found_check;