diff --git a/pvr.dvblink/changelog.txt b/pvr.dvblink/changelog.txt index 7ee7c31..371866a 100644 --- a/pvr.dvblink/changelog.txt +++ b/pvr.dvblink/changelog.txt @@ -1,5 +1,6 @@ [B]Version 4.7.2[/B] Added: PVR_RECORDING.iChannelUid and PVR_RECORDING.channelType support +Added: Setting to change the addon update interval [B]Version 4.7.1[/B] Added: Option to change default 'Prevent duplicate episodes' setting diff --git a/pvr.dvblink/resources/language/resource.language.en_gb/strings.po b/pvr.dvblink/resources/language/resource.language.en_gb/strings.po index 6c27967..a93f6ec 100644 --- a/pvr.dvblink/resources/language/resource.language.en_gb/strings.po +++ b/pvr.dvblink/resources/language/resource.language.en_gb/strings.po @@ -98,7 +98,69 @@ msgctxt "#30112" msgid "Timeshift buffer path" msgstr "" -#empty strings from id 30113 to 30199 +#empty strings from id 30113 to 30119 + +msgctxt "#30120" +msgid "1 min" +msgstr "" + +msgctxt "#30121" +msgid "2 min" +msgstr "" + +msgctxt "#30122" +msgid "3 min" +msgstr "" + +msgctxt "#30123" +msgid "4 min" +msgstr "" + +msgctxt "#30124" +msgid "5 min" +msgstr "" + +msgctxt "#30125" +msgid "6 min" +msgstr "" + +msgctxt "#30126" +msgid "7 min" +msgstr "" + +msgctxt "#30127" +msgid "8 min" +msgstr "" + +msgctxt "#30128" +msgid "9 min" +msgstr "" + +msgctxt "#30129" +msgid "10 min" +msgstr "" + +msgctxt "#30130" +msgid "20 min" +msgstr "" + +msgctxt "#30131" +msgid "30 min" +msgstr "" + +msgctxt "#30132" +msgid "40 min" +msgstr "" + +msgctxt "#30133" +msgid "50 min" +msgstr "" + +msgctxt "#30134" +msgid "60 min" +msgstr "" + +#empty strings from id 30135 to 30199 msgctxt "#30200" msgid "Advanced" diff --git a/pvr.dvblink/resources/settings.xml b/pvr.dvblink/resources/settings.xml index 6baca40..05d17c6 100644 --- a/pvr.dvblink/resources/settings.xml +++ b/pvr.dvblink/resources/settings.xml @@ -22,6 +22,7 @@ + diff --git a/src/DVBLinkClient.cpp b/src/DVBLinkClient.cpp index 3718dce..ceff81a 100644 --- a/src/DVBLinkClient.cpp +++ b/src/DVBLinkClient.cpp @@ -116,7 +116,7 @@ void DVBLinkClient::get_server_caps() DVBLinkClient::DVBLinkClient(CHelper_libXBMC_addon* xbmc, CHelper_libXBMC_pvr* pvr, CHelper_libKODI_guilib* gui, std::string clientname, std::string hostname, long port, bool showinfomsg, std::string username, - std::string password, bool add_episode_to_rec_title, bool group_recordings_by_series, bool no_group_single_rec, int default_rec_show_type) : + std::string password, bool add_episode_to_rec_title, bool group_recordings_by_series, bool no_group_single_rec, int default_update_interval, int default_rec_show_type) : connection_props_(hostname, port, username, password, clientname) { PVR = pvr; @@ -130,6 +130,58 @@ DVBLinkClient::DVBLinkClient(CHelper_libXBMC_addon* xbmc, CHelper_libXBMC_pvr* p no_group_single_rec_ = no_group_single_rec; default_rec_show_type_ = default_rec_show_type; timer_idx_seed_ = PVR_TIMER_NO_CLIENT_INDEX + 10; //arbitrary seed number, greater than + + switch (default_update_interval) + { + case 0: + default_update_interval_sec_ = UPDATE_INTERVAL_60_SEC; + break; + case 1: + default_update_interval_sec_ = UPDATE_INTERVAL_120_SEC; + break; + case 2: + default_update_interval_sec_ = UPDATE_INTERVAL_180_SEC; + break; + case 3: + default_update_interval_sec_ = UPDATE_INTERVAL_240_SEC; + break; + case 4: + default_update_interval_sec_ = UPDATE_INTERVAL_300_SEC; + break; + case 5: + default_update_interval_sec_ = UPDATE_INTERVAL_360_SEC; + break; + case 6: + default_update_interval_sec_ = UPDATE_INTERVAL_420_SEC; + break; + case 7: + default_update_interval_sec_ = UPDATE_INTERVAL_480_SEC; + break; + case 8: + default_update_interval_sec_ = UPDATE_INTERVAL_540_SEC; + break; + case 9: + default_update_interval_sec_ = UPDATE_INTERVAL_600_SEC; + break; + case 10: + default_update_interval_sec_ = UPDATE_INTERVAL_1200_SEC; + break; + case 11: + default_update_interval_sec_ = UPDATE_INTERVAL_1800_SEC; + break; + case 12: + default_update_interval_sec_ = UPDATE_INTERVAL_2400_SEC; + break; + case 13: + default_update_interval_sec_ = UPDATE_INTERVAL_3000_SEC; + break; + case 14: + default_update_interval_sec_ = UPDATE_INTERVAL_3600_SEC; + break; + default: + default_update_interval_sec_ = UPDATE_INTERVAL_300_SEC; + break; + } get_server_caps(); @@ -210,13 +262,12 @@ void *DVBLinkClient::Process() { XBMC->Log(LOG_DEBUG, "DVBLinkUpdateProcess:: thread started"); - time_t update_period_default_sec = 300; time_t update_period_timers_sec = 5; time_t update_period_recordings_sec = 1; time_t now; time(&now); - time_t next_update_time_timers = now + update_period_default_sec; - time_t next_update_time_recordings = now + update_period_default_sec; + time_t next_update_time_timers = now + default_update_interval_sec_; + time_t next_update_time_recordings = now + default_update_interval_sec_; while (m_updating) { @@ -235,7 +286,7 @@ void *DVBLinkClient::Process() if (now > next_update_time_timers) { PVR->TriggerTimerUpdate(); - next_update_time_timers = now + update_period_default_sec; + next_update_time_timers = now + default_update_interval_sec_; } if (m_update_timers_repeat) @@ -253,7 +304,7 @@ void *DVBLinkClient::Process() if (now > next_update_time_recordings) { PVR->TriggerRecordingUpdate(); - next_update_time_recordings = now + update_period_default_sec; + next_update_time_recordings = now + default_update_interval_sec_; } Sleep(100); diff --git a/src/DVBLinkClient.h b/src/DVBLinkClient.h index d938545..a6796ba 100644 --- a/src/DVBLinkClient.h +++ b/src/DVBLinkClient.h @@ -74,6 +74,23 @@ enum dvblink_client_rec_showtype_e dcrs_record_all = 0, dcrs_record_new_only = 1 }; +/* dvblink update interval values */ +const int UPDATE_INTERVAL_60_SEC = 60; +const int UPDATE_INTERVAL_120_SEC = 120; +const int UPDATE_INTERVAL_180_SEC = 180; +const int UPDATE_INTERVAL_240_SEC = 240; +const int UPDATE_INTERVAL_300_SEC = 300; +const int UPDATE_INTERVAL_360_SEC = 360; +const int UPDATE_INTERVAL_420_SEC = 420; +const int UPDATE_INTERVAL_480_SEC = 480; +const int UPDATE_INTERVAL_540_SEC = 540; +const int UPDATE_INTERVAL_600_SEC = 600; +const int UPDATE_INTERVAL_1200_SEC = 1200; +const int UPDATE_INTERVAL_1800_SEC = 1800; +const int UPDATE_INTERVAL_2400_SEC = 2400; +const int UPDATE_INTERVAL_3000_SEC = 3000; +const int UPDATE_INTERVAL_3600_SEC = 3600; + struct schedule_desc { schedule_desc(unsigned int idx, int type, int margin_before, int margin_after) @@ -127,7 +144,7 @@ class DVBLinkClient: public P8PLATFORM::CThread public: DVBLinkClient(ADDON::CHelper_libXBMC_addon* xbmc, CHelper_libXBMC_pvr* pvr, CHelper_libKODI_guilib* gui, std::string clientname, std::string hostname, long port, bool showinfomsg, std::string username, - std::string password, bool add_episode_to_rec_title, bool group_recordings_by_series, bool no_group_single_rec, int default_rec_show_type); + std::string password, bool add_episode_to_rec_title, bool group_recordings_by_series, bool no_group_single_rec, int default_update_interval, int default_rec_show_type); ~DVBLinkClient(void); const char *GetBackendVersion(); void GetAddonCapabilities(PVR_ADDON_CAPABILITIES* pCapabilities); @@ -210,6 +227,7 @@ class DVBLinkClient: public P8PLATFORM::CThread dvblinkremote::ChannelFavorites channel_favorites_; std::map inverse_channel_map_; bool no_group_single_rec_; + time_t default_update_interval_sec_; int default_rec_show_type_; std::map schedule_map_; std::map timer_idx_map_; diff --git a/src/client.cpp b/src/client.cpp index 6cc9034..a3523a9 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -57,6 +57,7 @@ bool g_bShowInfoMSG = DEFAULT_SHOWINFOMSG; ///< Show i int g_iHeight = DEFAULT_HEIGHT; ///< Height of stream when using transcoding (0: autodetect) int g_iWidth = DEFAULT_WIDTH; ///< Width of stream when using transcoding (0: autodetect) int g_iBitrate = DEFAULT_BITRATE; ///< Bitrate of stream when using transcoding +int g_iDefaultUpdateInterval = DEFAULT_UPDATE_INTERVAL; ///< Default update interval int g_iDefaultRecShowType = DEFAULT_RECORD_SHOW_TYPE; ///< Default record show type std::string g_szAudiotrack = DEFAULT_AUDIOTRACK; ///< Audiotrack to include in stream when using transcoding bool g_bUseTimeshift = DEFAULT_USETIMESHIFT; ///< Use timeshift @@ -270,6 +271,14 @@ ADDON_STATUS ADDON_Create(void* hdl, void* props) g_szAudiotrack = DEFAULT_AUDIOTRACK; } + /* Read setting "default_update_interval" from settings.xml */ + if (!XBMC->GetSetting("default_update_interval", &g_iDefaultUpdateInterval)) + { + /* If setting is unknown fallback to defaults */ + XBMC->Log(LOG_ERROR, "Couldn't get 'default_update_interval' setting, falling back to '4' (5 minutes) as default"); + g_iDefaultUpdateInterval = DEFAULT_UPDATE_INTERVAL; + } + /* Read setting "default_record_show_type" from settings.xml */ if (!XBMC->GetSetting("default_record_show_type", &g_iDefaultRecShowType)) { @@ -283,7 +292,7 @@ ADDON_STATUS ADDON_Create(void* hdl, void* props) g_lPort); dvblinkclient = new DVBLinkClient(XBMC, PVR, GUI, g_szClientname, g_szHostname, g_lPort, g_bShowInfoMSG, g_szUsername, - g_szPassword, g_bAddRecEpisode2title, g_bGroupRecBySeries, g_bNoGroupSingleRec, g_iDefaultRecShowType); + g_szPassword, g_bAddRecEpisode2title, g_bGroupRecBySeries, g_bNoGroupSingleRec, g_iDefaultUpdateInterval, g_iDefaultRecShowType); if (dvblinkclient->GetStatus()) m_CurStatus = ADDON_STATUS_OK; @@ -408,6 +417,11 @@ ADDON_STATUS ADDON_SetSetting(const char *settingName, const void *settingValue) if (tmp_sAudiotrack != g_szAudiotrack) return ADDON_STATUS_NEED_RESTART; } + else if (str == "default_update_interval") + { + XBMC->Log(LOG_INFO, "Changed Setting 'default_update_interval' from %u to %u", g_iDefaultUpdateInterval, *(int*) settingValue); + g_iDefaultUpdateInterval = *(int*) settingValue; + } else if (str == "default_record_show_type") { XBMC->Log(LOG_INFO, "Changed Setting 'default_record_show_type' from %u to %u", g_iDefaultRecShowType, *(int*) settingValue); diff --git a/src/client.h b/src/client.h index 2489398..6f73dd0 100644 --- a/src/client.h +++ b/src/client.h @@ -42,4 +42,5 @@ #define DEFAULT_ADDRECEPISODE2TITLE true #define DEFAULT_GROUPRECBYSERIES true #define DEFAULT_NOGROUP_SINGLE_REC false +#define DEFAULT_UPDATE_INTERVAL 4 #define DEFAULT_RECORD_SHOW_TYPE 1