diff -Nru kodi-pvr-vbox-4.5.0/CMakeLists.txt kodi-pvr-vbox-4.6.0/CMakeLists.txt --- kodi-pvr-vbox-4.5.0/CMakeLists.txt 2013-05-31 22:59:22.000000000 +0000 +++ kodi-pvr-vbox-4.6.0/CMakeLists.txt 2013-05-31 22:59:22.000000000 +0000 @@ -13,10 +13,9 @@ ${PROJECT_SOURCE_DIR}) # Sources and headers -set(VBOX_SOURCES +set(VBOX_SOURCES src/client.h - src/client.cpp - src/compat.h) + src/client.cpp) set(VBOX_SOURCES_VBOX src/vbox/CategoryGenreMapper.h @@ -46,13 +45,13 @@ src/vbox/Utilities.h src/vbox/VBox.h src/vbox/VBox.cpp) - -set(VBOX_SOURCES_VBOX_REQUEST + +set(VBOX_SOURCES_VBOX_REQUEST src/vbox/request/ApiRequest.h src/vbox/request/ApiRequest.cpp src/vbox/request/FileRequest.h src/vbox/request/Request.h) - + set(VBOX_SOURCES_VBOX_RESPONSE src/vbox/response/Content.h src/vbox/response/Content.cpp @@ -60,14 +59,14 @@ src/vbox/response/Response.h src/vbox/response/Response.cpp) -set(VBOX_SOURCES_TIMESHIFT +set(VBOX_SOURCES_TIMESHIFT src/timeshift/Buffer.h src/timeshift/Buffer.cpp src/timeshift/DummyBuffer.h src/timeshift/FilesystemBuffer.h src/timeshift/FilesystemBuffer.cpp) - -set(VBOX_SOURCES_XMLTV + +set(VBOX_SOURCES_XMLTV src/xmltv/Channel.h src/xmltv/Channel.cpp src/xmltv/Guide.h @@ -92,9 +91,9 @@ lib/tinyxml2/tinyxml2.cpp) source_group("Library Files\\tinyxml2" FILES ${VBOX_LIBRARIES_TINYXML2}) - + # Resource files -set(VBOX_RESOURCES +set(VBOX_RESOURCES README.md pvr.vbox/addon.xml.in pvr.vbox/changelog.txt @@ -106,8 +105,8 @@ source_group("Resource Files" FILES ${VBOX_RESOURCES}) # Append our custom file definitions -list(APPEND VBOX_SOURCES - ${VBOX_SOURCES_VBOX} +list(APPEND VBOX_SOURCES + ${VBOX_SOURCES_VBOX} ${VBOX_SOURCES_VBOX_REQUEST} ${VBOX_SOURCES_VBOX_RESPONSE} ${VBOX_SOURCES_TIMESHIFT} diff -Nru kodi-pvr-vbox-4.5.0/debian/changelog kodi-pvr-vbox-4.6.0/debian/changelog --- kodi-pvr-vbox-4.5.0/debian/changelog 2013-05-31 22:59:22.000000000 +0000 +++ kodi-pvr-vbox-4.6.0/debian/changelog 2013-05-31 22:59:22.000000000 +0000 @@ -1,4 +1,4 @@ -kodi-pvr-vbox (4.5.0-1~xenial) xenial; urgency=low +kodi-pvr-vbox (4.6.0-1~xenial) xenial; urgency=low [ kodi ] * autogenerated dummy changelog diff -Nru kodi-pvr-vbox-4.5.0/pvr.vbox/addon.xml.in kodi-pvr-vbox-4.6.0/pvr.vbox/addon.xml.in --- kodi-pvr-vbox-4.5.0/pvr.vbox/addon.xml.in 2013-05-31 22:59:22.000000000 +0000 +++ kodi-pvr-vbox-4.6.0/pvr.vbox/addon.xml.in 2013-05-31 22:59:22.000000000 +0000 @@ -1,7 +1,7 @@ @ADDON_DEPENDS@ diff -Nru kodi-pvr-vbox-4.5.0/pvr.vbox/changelog.txt kodi-pvr-vbox-4.6.0/pvr.vbox/changelog.txt --- kodi-pvr-vbox-4.5.0/pvr.vbox/changelog.txt 2013-05-31 22:59:22.000000000 +0000 +++ kodi-pvr-vbox-4.6.0/pvr.vbox/changelog.txt 2013-05-31 22:59:22.000000000 +0000 @@ -1,292 +1,297 @@ +4.6.0 +- Fix timezone offset changing kodi time +- remove compat functions as no longer needed +- Remove external xmltv as xmltv supported by vbox + 4.5.0 - - Implement GetStreamTimes API for timeshifting support - - Mac build script - - Fix compiler warnings - - Add appveyor.yml +- Implement GetStreamTimes API for timeshifting support +- Mac build script +- Fix compiler warnings +- Add appveyor.yml 4.4.3 - - Fixed wrong size caused crash in Android Oreo (8) +- Fixed wrong size caused crash in Android Oreo (8) 4.4.1 - - Fix recordings playback not working (was broken since v4.2.0) +- Fix recordings playback not working (was broken since v4.2.0) 4.4.0 - - Updated to PVR addon API v5.10.0 +- Updated to PVR addon API v5.10.0 4.3.2 - - Updated to PVR addon API v5.9.0 +- Updated to PVR addon API v5.9.0 4.3.0 - - Updated to PVR addon API v5.8.0 +- Updated to PVR addon API v5.8.0 4.2.0 - - Updated to PVR addon API v5.7.0 +- Updated to PVR addon API v5.7.0 4.1.1 - - Updated to PVR addon API v5.4.0 +- Updated to PVR addon API v5.4.0 4.1.0 - - Updated to PVR addon API v5.3.0 +- Updated to PVR addon API v5.3.0 4.0.5 - - Remove of never used addon interface function +- Remove of never used addon interface function 4.0.5 - - Update Debian package control - - PVR addon callback way changes +- Update Debian package control +- PVR addon callback way changes 4.0.4 - - removed old no more needed version functions +- removed old no more needed version functions 4.0.3 - - set dependency versions automatic during build - - removed never used kodi to addon functions - - improve build system +- set dependency versions automatic during build +- removed never used kodi to addon functions +- improve build system 4.0.2 - - fixed some Coverity issues - - fixed Travis CI builds - - fixed recordings and timers not loading +- fixed some Coverity issues +- fixed Travis CI builds +- fixed recordings and timers not loading 4.0.1 - - fixed crash caused by empty XML strings - - ignore programme if no start/end time or channel - - updated Language files from Transifex +- fixed crash caused by empty XML strings +- ignore programme if no start/end time or channel +- updated Language files from Transifex 4.0.0 - - initial Kodi v18 version +- initial Kodi v18 version 3.6.7 - - add missing changelog entries - - reformat the changelog +- add missing changelog entries +- reformat the changelog 3.6.6 - - fixed Travis CI builds - - fixed recordings and timers not loading +- fixed Travis CI builds +- fixed recordings and timers not loading 3.6.5 - - updated Language files from Transifex +- updated Language files from Transifex 3.6.4 - - updated Language files from Transifex +- updated Language files from Transifex 3.6.3 - - fixed crash caused by empty XML strings - - ignore programme if no start/end time or channel - - updated Language files from Transifex +- fixed crash caused by empty XML strings +- ignore programme if no start/end time or channel +- updated Language files from Transifex 3.6.2 - - fixed more Coverity issues - - updated Language files from Transifex +- fixed more Coverity issues +- updated Language files from Transifex 3.6.1 - - fixed some Coverity issues +- fixed some Coverity issues 3.6.0 - - Added series (timer rules) implementation for manual + series - - Added genre mapping from category tags - - Added channels & guide database version check to prevent redundant fetching - - Added rescannig EPG (in the backend) to TV settings client specific menu - - Added fetching EPG (from backend to addon) to TV settings client specific menu - - Changed display of channel order setting in settings screen - - Added popup reminders (no switch) setting / canceling from EPG + channels context menus (in client actions) - - Added support for setting recording margins in TV Settings (if version is 2.57+, both can be set, otherwise - larger margin is set for both ends) - - Reduced getting signal status frequency to a minimum of 10 seconds - - Fixed crashes caused by channel names containing only whitespaces +- Added series (timer rules) implementation for manual + series +- Added genre mapping from category tags +- Added channels & guide database version check to prevent redundant fetching +- Added rescannig EPG (in the backend) to TV settings client specific menu +- Added fetching EPG (from backend to addon) to TV settings client specific menu +- Changed display of channel order setting in settings screen +- Added popup reminders (no switch) setting / canceling from EPG + channels context menus (in client actions) +- Added support for setting recording margins in TV Settings (if version is 2.57+, both can be set, otherwise - larger margin is set for both ends) +- Reduced getting signal status frequency to a minimum of 10 seconds +- Fixed crashes caused by channel names containing only whitespaces 3.5.0 - - fixed Travis CI builds - - ignore guide programs with the title "String format is not supported" - - fixed major buffering and stuttering on Kodi Krypton - - support channel icons from the backend again - - minor refactoring +- fixed Travis CI builds +- ignore guide programs with the title "String format is not supported" +- fixed major buffering and stuttering on Kodi Krypton +- support channel icons from the backend again +- minor refactoring 3.4.4 - - updated Language files from Transifex +- updated Language files from Transifex 3.4.3 - - updated Language files from Transifex +- updated Language files from Transifex 3.4.2 - - updated Language files from Transifex +- updated Language files from Transifex 3.4.1 - - updated Language files from Transifex +- updated Language files from Transifex 3.4.0 - - Cmake: rename find_package kodi to Kodi +- Cmake: rename find_package kodi to Kodi 3.3.1 - - Fix includes +- Fix includes 3.3.0 - - Updated to PVR addon API v5.2.0 +- Updated to PVR addon API v5.2.0 3.2.0 - - Updated to PVR addon API v5.1.0 +- Updated to PVR addon API v5.1.0 3.1.0 - - Updated to PVR addon API v5.0.0 +- Updated to PVR addon API v5.0.0 3.0.1 - - updated Language files from Transifex +- updated Language files from Transifex 3.0.0 - - Initial Kodi Krypton version. +- Initial Kodi Krypton version. 2.1.9 - - Fixed recording bug for program names with whitespaces +- Fixed recording bug for program names with whitespaces 2.1.8 - - Added support for all VBox Comm product families (2 letters, starts with "V") +- Added support for all VBox Comm product families (2 letters, starts with "V") 2.1.7 - - updated Language files from Transifex +- updated Language files from Transifex 2.1.6 - - updated Language files from Transifex +- updated Language files from Transifex 2.1.5 - - updated Language files from Transifex +- updated Language files from Transifex 2.1.4 - - fixed a deadlock that could occur once the addon had been running for some time +- fixed a deadlock that could occur once the addon had been running for some time 2.1.3 - - Updated to PVR API v4.1.0 +- Updated to PVR API v4.1.0 2.1.2 - - Updated to PVR API v4.0.0 +- Updated to PVR API v4.0.0 2.1.1 - - Updated to PVR API v3.0.0 (API 1.9.7 Compatibility mode) +- Updated to PVR API v3.0.0 (API 1.9.7 Compatibility mode) 2.1.0 - - Updated to PVR API v2.1.0 - - Automatically fill in platform and library name +- Updated to PVR API v2.1.0 +- Automatically fill in platform and library name 2.0.2 - - debian packaging: fix library install path - - miscellaneous backend fixes +- debian packaging: fix library install path +- miscellaneous backend fixes 2.0.1 - - support event/programme icons from external guide data - - improve XMLTV reading, should hopefully fix some issues +- support event/programme icons from external guide data +- improve XMLTV reading, should hopefully fix some issues 2.0.0 - - updated to PVR Addon API v2.0.0 +- updated to PVR Addon API v2.0.0 1.3.5 - - updated Language files from Transifex +- updated Language files from Transifex 1.3.4 - - fixed some minor bugs introduced in the last version - - improved fault tolerance and logging when loading external guide data and the channel mapping file +- fixed some minor bugs introduced in the last version +- improved fault tolerance and logging when loading external guide data and the channel mapping file 1.3.3 - - compare channel names case-insensitively when mapping between the internal and external guide - - fixed some issues during startup which could lead to crashes - - use the specified connection timeout when streaming too, not just for API communication - - fixed a bug where the timeshift buffer could get "stuck" if a channel didn't open successfully - - bypass timeshifting for radio channels, fixes radio playback stuttering for now - - fixed crash when using external XMLTV from an invalid/missing file +- compare channel names case-insensitively when mapping between the internal and external guide +- fixed some issues during startup which could lead to crashes +- use the specified connection timeout when streaming too, not just for API communication +- fixed a bug where the timeshift buffer could get "stuck" if a channel didn't open successfully +- bypass timeshifting for radio channels, fixes radio playback stuttering for now +- fixed crash when using external XMLTV from an invalid/missing file 1.3.2 - - fixed Coverity issues - - gracefully handle exceptions when parsing external XMLTV data +- fixed Coverity issues +- gracefully handle exceptions when parsing external XMLTV data 1.3.1 - - fix Windows build +- fix Windows build 1.3.0 - - bumped minimum required firmware version to 2.48 - - improved error messages when XML parsing fails - - include current delivery system in the mux signal status field - - fix some issues with timezones, especially when using external EPG data - - fixed recordings being unnamed when external EPG data is used - - show recordings with errors in Kodi (so they can be deleted) - - minor updates to the README - - don't abort guide retrieval just because one part of it failed - - refactored the XMLTV code to make it more robust - - added ability to use channel icons from external XMLTV - - added option to use HTTPS for API communication - - upgrade tinyxml2 to the latest version, ship locally instead of relying on system libraries +- bumped minimum required firmware version to 2.48 +- improved error messages when XML parsing fails +- include current delivery system in the mux signal status field +- fix some issues with timezones, especially when using external EPG data +- fixed recordings being unnamed when external EPG data is used +- show recordings with errors in Kodi (so they can be deleted) +- minor updates to the README +- don't abort guide retrieval just because one part of it failed +- refactored the XMLTV code to make it more robust +- added ability to use channel icons from external XMLTV +- added option to use HTTPS for API communication +- upgrade tinyxml2 to the latest version, ship locally instead of relying on system libraries 1.2.0 - - fixed a potential crash when loading XMLTV data - - added ability to customize the mapping of XMLTV channels (see the README for more details) - - fixed missing "Connection timeout" setting label - - changed the default HTTP port for external connections to 19999 - - changed the default value for "Prefer external XMLTV over OTA" to false +- fixed a potential crash when loading XMLTV data +- added ability to customize the mapping of XMLTV channels (see the README for more details) +- fixed missing "Connection timeout" setting label +- changed the default HTTP port for external connections to 19999 +- changed the default value for "Prefer external XMLTV over OTA" to false 1.1.1 - - fixed some build issues - - minor README update +- fixed some build issues +- minor README update 1.1.0 - - added separate connection settings for internal and external networks. The addon automatically tries the internal settings first and switches to the external ones. - - added settings for controlling the connection timeout +- added separate connection settings for internal and external networks. The addon automatically tries the internal settings first and switches to the external ones. +- added settings for controlling the connection timeout 1.0.2 - - fixed Android version (wrong addon name) - - fixed a bad include (thanks bkuhls) +- fixed Android version (wrong addon name) +- fixed a bad include (thanks bkuhls) 1.0.1 - - updated to use new libplatform-dev +- updated to use new libplatform-dev 1.0.0 - - fixed some potential crashes when shutting down Kodi or restarting the addon - - speed up shutdown when a guide retrieval is in process +- fixed some potential crashes when shutting down Kodi or restarting the addon +- speed up shutdown when a guide retrieval is in process 0.9.9 - - added a small compatibility layer to enable building on Android which lacks some C++11 features +- added a small compatibility layer to enable building on Android which lacks some C++11 features 0.9.8 - - fixed GCC and Clang builds +- fixed GCC and Clang builds 0.9.7 - - fixed some more signal status values between channel switches - - adjusted the signal strength algorithm - - fixed a crash when loading certain recordings - - linked recordings with their respective EPG events so the "currently recording" icon is properly displayed in the EPG grid - - properly ignore recordings that are in an error state - - refactored the port settings to take advantage of the new API - - added ability to watch and actually delete certain external recordings +- fixed some more signal status values between channel switches +- adjusted the signal strength algorithm +- fixed a crash when loading certain recordings +- linked recordings with their respective EPG events so the "currently recording" icon is properly displayed in the EPG grid +- properly ignore recordings that are in an error state +- refactored the port settings to take advantage of the new API +- added ability to watch and actually delete certain external recordings 0.9.6 - - fixed building on Mac OS X +- fixed building on Mac OS X 0.9.5 - - fixed some issues with the timeshift buffer - - fixed Linux build (thanks dhead666) - - changed so that recordings without an ID (mostly external ones) are not visible since they can't be deleted - - +- fixed some issues with the timeshift buffer +- fixed Linux build (thanks dhead666) +- changed so that recordings without an ID (mostly external ones) are not visible since they can't be deleted +- 0.9.4 - - fixed compatibility with older tinyxml2 libraries - - fixed Debian packaging - - reshuffled some code - - fixed bogus signal status values between channel switches - - fixed a bug which caused the addon to require a restart everytime the addon settings dialog was opened and closed +- fixed compatibility with older tinyxml2 libraries +- fixed Debian packaging +- reshuffled some code +- fixed bogus signal status values between channel switches +- fixed a bug which caused the addon to require a restart everytime the addon settings dialog was opened and closed 0.9.3 - - greatly improve Linux compatibility - - fixed a bunch of issues found by static analysis - - actually use the "Port" setting - - fixed a crash when the VBox has external recordings - - fixed a bug in the timeshift buffer which could lead to infinite buffering +- greatly improve Linux compatibility +- fixed a bunch of issues found by static analysis +- actually use the "Port" setting +- fixed a crash when the VBox has external recordings +- fixed a bug in the timeshift buffer which could lead to infinite buffering 0.9.2 - - changed the update loop to only trigger updates when something has actually changed - - changed the minimum VBox software version to 2.47.105 - - show modulation in the signal status +- changed the update loop to only trigger updates when something has actually changed +- changed the minimum VBox software version to 2.47.105 +- show modulation in the signal status 0.9.1 - - fixed initial stuttering when timeshift is enabled - - fixed signal status being broken after a few seconds - - fixed recordings being accidentally removed when cancelled - - fixed scheduling recordings for channels without EPG data or with only external EPG data - - added proper way to notify Kodi of any changes retrieved during the update loop +- fixed initial stuttering when timeshift is enabled +- fixed signal status being broken after a few seconds +- fixed recordings being accidentally removed when cancelled +- fixed scheduling recordings for channels without EPG data or with only external EPG data +- added proper way to notify Kodi of any changes retrieved during the update loop 0.9.0 - - initial release +- initial release diff -Nru kodi-pvr-vbox-4.5.0/pvr.vbox/resources/language/resource.language.en_gb/strings.po kodi-pvr-vbox-4.6.0/pvr.vbox/resources/language/resource.language.en_gb/strings.po --- kodi-pvr-vbox-4.5.0/pvr.vbox/resources/language/resource.language.en_gb/strings.po 2013-05-31 22:59:22.000000000 +0000 +++ kodi-pvr-vbox-4.6.0/pvr.vbox/resources/language/resource.language.en_gb/strings.po 2013-05-31 22:59:22.000000000 +0000 @@ -54,21 +54,7 @@ msgid "EPG" msgstr "" -msgctxt "#30101" -msgid "Use external XMLTV" -msgstr "" - -msgctxt "#30102" -msgid "External XMLTV path" -msgstr "" - -msgctxt "#30103" -msgid "Prefer external EPG over OTA" -msgstr "" - -msgctxt "#30104" -msgid "Use channel icons from external XMLTV" -msgstr "" +#empty strings from id 30101 to 30104 msgctxt "#30105" msgid "Channel numbers set by" diff -Nru kodi-pvr-vbox-4.5.0/pvr.vbox/resources/settings.xml kodi-pvr-vbox-4.6.0/pvr.vbox/resources/settings.xml --- kodi-pvr-vbox-4.5.0/pvr.vbox/resources/settings.xml 2013-05-31 22:59:22.000000000 +0000 +++ kodi-pvr-vbox-4.6.0/pvr.vbox/resources/settings.xml 2013-05-31 22:59:22.000000000 +0000 @@ -17,14 +17,10 @@ - - - - - + diff -Nru kodi-pvr-vbox-4.5.0/README.md kodi-pvr-vbox-4.6.0/README.md --- kodi-pvr-vbox-4.5.0/README.md 2013-05-31 22:59:22.000000000 +0000 +++ kodi-pvr-vbox-4.6.0/README.md 2013-05-31 22:59:22.000000000 +0000 @@ -1,11 +1,10 @@ -[![Build Status](https://travis-ci.org/kodi-pvr/pvr.vbox.svg?branch=master)](https://travis-ci.org/kodi-pvr/pvr.vbox) +[![Build Status](https://travis-ci.org/kodi-pvr/pvr.vbox.svg?branch=Leia)](https://travis-ci.org/kodi-pvr/pvr.vbox/branches) +[![Build Status](https://ci.appveyor.com/api/projects/status/github/kodi-pvr/pvr.vuplus?branch=Leia&svg=true)](https://ci.appveyor.com/project/kodi-pvr/pvr-vuplus?branch=Leia) [![Coverity Scan Build Status](https://scan.coverity.com/projects/5120/badge.svg)](https://scan.coverity.com/projects/5120) # VBox Home TV Gateway PVR Client -This repository provides a [Kodi](http://kodi.tv) PVR addon for -interfacing with the VBox Communications XTi TV Gateway devices. This -README serves as a quick overview of the functionality and architecture +This repository provides a [Kodi](http://kodi.tv) PVR addon for interfacing with the VBox Communications XTi TV Gateway devices. This README serves as a quick overview of the functionality and architecture of the addon, to make it easier for others to possible contribute. ## Build instructions @@ -48,9 +47,7 @@ ### Windows -These instructions may be outdated. I'm assuming here that you'll check -out all source code into `C:\Projects`, you'll have to adjust that if -you use another path. +These instructions may be outdated. I'm assuming here that you'll check out all source code into `C:\Projects`, you'll have to adjust that if you use another path. 1. Check out the Kodi source from Github (`C:\Projects\xbmc`) and make sure you have Microsoft Visual Studio 2013 installed. 2. Check out this repository (`C:\Projects\pvr.vbox`) @@ -62,31 +59,39 @@ ## Settings -This list contains some explanation for the non-obvious settings: +There are two tabs in the settings dialog with identical settings, which means you can configure your addon to contact the VBox TV Gateway using both its internal and external address/port. This is useful for e.g. a laptop which is not permanently inside your internal network. When the addon starts it first attempts to make a connection using the internal settings. If that fails, it will try the external settings instead. The addon restarts itself if the connection is lost so it will automatically switch back without having to restart Kodi. -* `Connection`: There are two tabs in the settings dialog with identical settings, which means you can configure your addon to contact the VBox TV Gateway using both its internal and external address/port. This is useful for e.g. a laptop which is not permanently inside your internal network. When the addon starts it first attempts to make a connection using the internal settings. If that fails, it will try the external settings instead. The addon restarts itself if the connection is lost so it will automatically switch back without having to restart Kodi. - * `HTTP and UPnP port`: You'll only need to change these from their respective defaults if you wish to use a VBox TV Gateway over the Internet (i.e. the external connection settings tab) and you're using asymmetric port forwarding (e.g. port 8080 -> 80 and 12345 -> 55555). The HTTP port is used to communicate with the device while the UPnP port is used when streaming media. -* `Prefer external EPG over OTA`: If a specific channel has guide data both from the VBox itself and from the external XMLTV file, this setting controls which guide data is used. Note that the external data is always used if the VBox doesn't provide any guide data for a specific channel. -* `Timeshift buffer path`: The path where the timeshift buffer files should be stored when timeshifting is enabled. Make sure you have a reasonable amount of disk space available since the buffer will grow indefinitely until you stop watching or switch channels! - -### Using external XMLTV guide data - -The addon supports specifying the path to an XMLTV file which will be used for guide data for channels that the VBox doesn't provide any EPG data for. You can also make the addon prefer the external guide data by enabling the `Prefer external EPG over OTA` checkbox in the settings (see above for possible caveats). For this feature to work, the addon needs a way to map channel names from the VBox with channel names in the XMLTV file. - -When the addon starts, it looks for and loads channel name mappings from a file named `channel_mappings.xml` in the addon's data folder (`userdata\addon_data\pvr.vbox`). If this file doesn't exist it is created. The file has the following structure: - -```xml - - - - - - - ... - -``` +### Connection - Internal +Connection settings to use when connecting from your local network. For a local network connection the port values should not need to be modified. -When creating the default map, only channels which names match perfectly will be mapped automatically. The rest of the channel mappings are empty, like MTV3 HD and Nelonen HD in the example above. To map these to the correct channels, simply modify the file and restart Kodi. +* **Hostname or IP address**: The IP address or hostname of your VBox when accessed from the local network. +* **HTTP port**: The port used to connect to your VBox when accessed from the local network. Default value is `80`. +* **HTTPS port**: The port used to connect to your VBox if using HTTPS when accessed from the local network. The default `0` means this is disabled and HTTP will be used instead. +* **UPnP port**: The port used to connect to your VBox via UPnP when accessed from the local network. Default value is `55555`. +* **Connection timeout (seconds)**: The value used (in seconds) to denote when a connection attempt has failed when accessed from the local network. Default value is `3`. + +### Connection - External +Connection settings to use when connecting from the internet. The ports should only need to change if you're using asymmetric port forwarding (e.g. port 8080 -> 80 and 12345 -> 55555). The HTTP port is used to communicate with the device while the UPnP port is used when streaming media. + +* **Hostname or IP address**: The IP address or hostname of your VBox when accessed from the internet. +* **HTTP port**: The port used to connect to your VBox when accessed from the internet. +* **HTTPS port**: The port used to connect to your VBox if using HTTPS when accessed from the internet. The default `0` means this is disabled and HTTP will be used instead. +* **UPnP port**: The port used to connect to your VBox via UPnP when accessed from the internet. Default value is `55555`. +* **Connection timeout (seconds)**: The value used (in seconds) to denote when a connection attempt has failed when accessed from the internet. Default value is `10`. + +### EPG +Settings related to the EPG. + +* **Channel numbers set by**: Channel numbers be set via either of the following two options: + - `LCN (Logical Channel Number) from backend` - The channel numbers as set on the backend. + - `Channel index in backend` - Starting from 1 number the channels as per the order they appear on the backend. +* **Reminder time (minutes before programme start)**: The amount of time in minutes prior to a programme start that a reminder should pop up. + +### Timeshift +Settings related to the timeshift. + +* **Enable timeshifting**: If enabled allows pause, rewind and fast-forward of live TV. +* **Timeshift buffer path**: The path where the timeshift buffer files should be stored when timeshifting is enabled. Make sure you have a reasonable amount of disk space available since the buffer will grow indefinitely until you stop watching or switch channels. ### Architecture @@ -101,7 +106,7 @@ * the request failed to execute, i.e. the backend was unavailable * the XML parsing failed, i.e. the response was invalid * the request succeeded but the response represented an error - + Similar to the XMLTV code, the code for the timeshift buffer is fairly generic and lives in a separate `timeshift` namespace. Currently there is a base class for all buffers and two implementations, a `FilesystemBuffer` which buffers the data to a file on disc, and a `DummyBuffer` which just relays the read operations to the underlying input handle. This is required since Kodi uses a different code paths depending on whether clients handle input streams on their own or not, and we need this particular code path for other features like signal status handling to work. ### Versioning diff -Nru kodi-pvr-vbox-4.5.0/src/client.cpp kodi-pvr-vbox-4.6.0/src/client.cpp --- kodi-pvr-vbox-4.5.0/src/client.cpp 2013-05-31 22:59:22.000000000 +0000 +++ kodi-pvr-vbox-4.6.0/src/client.cpp 2013-05-31 22:59:22.000000000 +0000 @@ -23,7 +23,6 @@ #include "p8-platform/util/util.h" #include "kodi/xbmc_pvr_dll.h" #include "client.h" -#include "compat.h" #include "vbox/Exceptions.h" #include "vbox/VBox.h" #include "vbox/ContentIdentifier.h" @@ -57,10 +56,6 @@ int g_internalConnectionTimeout; int g_externalConnectionTimeout; -bool g_useExternalXmltv; -std::string g_externalXmltvPath; -bool g_preferExternalXmltv; -bool g_useExternalXmltvIcons; ChannelOrder g_setChannelIdUsingOrder; unsigned int g_remindMinsBeforeProg; bool g_timeshiftEnabled; @@ -102,10 +97,6 @@ UPDATE_INT(g_externalUpnpPort, "external_upnp_port", 55555); UPDATE_INT(g_internalConnectionTimeout, "connection_timeout", 3); UPDATE_INT(g_externalConnectionTimeout, "external_connection_timeout", 10); - UPDATE_INT(g_useExternalXmltv, "use_external_xmltv", false); - UPDATE_STR(g_externalXmltvPath, "external_xmltv_path", buffer, ""); - UPDATE_INT(g_preferExternalXmltv, "prefer_external_xmltv", false); - UPDATE_INT(g_useExternalXmltvIcons, "use_external_xmltv_icons", false); UPDATE_INT(g_setChannelIdUsingOrder, "set_channelid_using_order", CH_ORDER_BY_LCN); UPDATE_INT(g_remindMinsBeforeProg, "reminder_mins_before_prog", 0); UPDATE_INT(g_timeshiftEnabled, "timeshift_enabled", false); @@ -158,10 +149,6 @@ g_externalConnectionTimeout }; - settings.m_useExternalXmltv = g_useExternalXmltv; - settings.m_externalXmltvPath = g_externalXmltvPath; - settings.m_preferExternalXmltv = g_preferExternalXmltv; - settings.m_useExternalXmltvIcons = g_useExternalXmltvIcons; settings.m_setChannelIdUsingOrder = g_setChannelIdUsingOrder; settings.m_remindMinsBeforeProg = g_remindMinsBeforeProg; settings.m_timeshiftEnabled = g_timeshiftEnabled; @@ -274,10 +261,6 @@ UPDATE_INT("external_https_port", int, settings.m_externalConnectionParams.httpsPort); UPDATE_INT("external_upnp_port", int, settings.m_externalConnectionParams.upnpPort); UPDATE_INT("external_connection_timeout", int, settings.m_externalConnectionParams.timeout); - UPDATE_INT("use_external_xmltv", bool, settings.m_useExternalXmltv); - UPDATE_STR("external_xmltv_path", settings.m_externalXmltvPath); - UPDATE_INT("prefer_external_xmltv", bool, settings.m_preferExternalXmltv); - UPDATE_INT("use_external_xmltv_icons", bool, settings.m_useExternalXmltvIcons); UPDATE_INT("set_channelid_using_order", ChannelOrder, settings.m_setChannelIdUsingOrder); UPDATE_INT("reminder_mins_before_prog", unsigned int, settings.m_remindMinsBeforeProg) UPDATE_INT("timeshift_enabled", bool, settings.m_timeshiftEnabled); @@ -467,7 +450,7 @@ strncpy(recording.strChannelName, item->m_channelName.c_str(), sizeof(recording.strChannelName)); - strncpy(recording.strRecordingId, compat::to_string(id).c_str(), + strncpy(recording.strRecordingId, std::to_string(id).c_str(), sizeof(recording.strRecordingId)); strncpy(recording.strTitle, item->m_title.c_str(), @@ -506,7 +489,7 @@ PVR_ERROR DeleteRecording(const PVR_RECORDING &recording) { try { - unsigned int id = compat::stoui(recording.strRecordingId); + unsigned int id = static_cast(std::stoi(recording.strRecordingId)); if (g_vbox->DeleteRecordingOrTimer(id)) return PVR_ERROR_NO_ERROR; @@ -526,7 +509,7 @@ SAFE_DELETE(recordingReader); recordingReader = nullptr; - unsigned int id = compat::stoui(recording.strRecordingId); + unsigned int id = static_cast(std::stoi(recording.strRecordingId)); auto &recordings = g_vbox->GetRecordingsAndTimers(); auto recIt = std::find_if(recordings.begin(), recordings.end(), [id](const RecordingPtr &item) @@ -1136,13 +1119,6 @@ return true; } -static time_t GetOffsetTime(time_t time) -{ - std::string xmltvTime = g_vbox->CreateTimestamp(time); - std::string tzString = ::xmltv::Utilities::GetTimezoneOffset(xmltvTime); - return ::xmltv::Utilities::GetTimezoneAdjustment(tzString); -} - static bool SetManualReminder(const PVR_MENUHOOK_DATA &item) { time_t currTime = time(nullptr), reminderTime; @@ -1157,10 +1133,7 @@ try { // create the current time's formatted timestamp (for user input) - time_t tzOs = GetOffsetTime(currTime); - // add timezone offset - currTime += tzOs; - std::tm tm = *std::gmtime(&currTime); + std::tm tm = *std::localtime(&currTime); // get program time & name (from user dialogs) if (!GUI->Dialog_Numeric_ShowAndGetDate(tm, "Program starts at")) @@ -1171,8 +1144,8 @@ return false; std::string progTitle(buffer); - // remove timezone offset - reminderTime = compat::timegm(&tm) - tzOs; + + reminderTime = std::mktime(&tm); // add reminder using manual time & title g_vbox->AddReminder(selectedChannel, reminderTime, progTitle); } diff -Nru kodi-pvr-vbox-4.5.0/src/compat.h kodi-pvr-vbox-4.6.0/src/compat.h --- kodi-pvr-vbox-4.5.0/src/compat.h 2013-05-31 22:59:22.000000000 +0000 +++ kodi-pvr-vbox-4.6.0/src/compat.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,102 +0,0 @@ -#pragma once -/* -* Copyright (C) 2015 Sam Stenvall -* -* This Program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2, or (at your option) -* any later version. -* -* This Program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with XBMC; see the file COPYING. If not, write to -* the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, -* MA 02110-1301 USA -* http://www.gnu.org/copyleft/gpl.html -* -*/ - -#include -#include -#include -#include - -namespace compat -{ - /** - * Android doesn't fully support C++11 so std::to_string() is missing - */ - template std::string to_string(const T& value) - { - std::ostringstream oss; - oss << value; - return oss.str(); - } - - /** - * Android doesn't fully support C++11 so std::stoi() is missing - */ - template int stoi(const T& value) - { - std::istringstream iss(value); - - int result; - iss >> result; - return result; - } - - /** - * Android doesn't fully support C++11 so std::stol() is missing, we provide - * a limited version which does the job - */ - template long stol(const T& value) - { - std::istringstream iss(value); - - long result; - iss >> result; - return result; - } - - /** - * Converts the specified value to an unsigned int - */ - template unsigned int stoui(const T& value) - { - std::istringstream iss(value); - - unsigned int result; - iss >> result; - return result; - } - - /** - * Android doesn't have timegm() and Windows calls it _mkgmtime() - * Source: http://linux.die.net/man/3/timegm - */ - inline time_t timegm(struct tm *tm) - { -#ifdef _WIN32 - return _mkgmtime(tm); -#else - time_t ret; - char *tz; - - tz = getenv("TZ"); - setenv("TZ", "", 1); - tzset(); - ret = mktime(tm); - if (tz) - setenv("TZ", tz, 1); - else - unsetenv("TZ"); - tzset(); - - return ret; -#endif - } -} diff -Nru kodi-pvr-vbox-4.5.0/src/vbox/ChannelStreamingStatus.cpp kodi-pvr-vbox-4.6.0/src/vbox/ChannelStreamingStatus.cpp --- kodi-pvr-vbox-4.5.0/src/vbox/ChannelStreamingStatus.cpp 2013-05-31 22:59:22.000000000 +0000 +++ kodi-pvr-vbox-4.6.0/src/vbox/ChannelStreamingStatus.cpp 2013-05-31 22:59:22.000000000 +0000 @@ -20,7 +20,6 @@ */ #include "ChannelStreamingStatus.h" -#include "../compat.h" #include #include @@ -71,7 +70,7 @@ try { // Convert the RF level to an integer - rfLevel = compat::stoui(m_rfLevel); + rfLevel = static_cast(std::stoi(m_rfLevel)); // If the level is above the maximum we consider it to be perfect if (rfLevel > RFLEVEL_MAX) @@ -99,7 +98,7 @@ try { // Make sure it's not detected as hexadecimal - return compat::stol(m_ber); + return std::stol(m_ber); } catch (std::invalid_argument) { diff -Nru kodi-pvr-vbox-4.5.0/src/vbox/ContentIdentifier.h kodi-pvr-vbox-4.6.0/src/vbox/ContentIdentifier.h --- kodi-pvr-vbox-4.5.0/src/vbox/ContentIdentifier.h 2013-05-31 22:59:22.000000000 +0000 +++ kodi-pvr-vbox-4.6.0/src/vbox/ContentIdentifier.h 2013-05-31 22:59:22.000000000 +0000 @@ -26,7 +26,6 @@ #include "SeriesRecording.h" #include "../xmltv/Programme.h" #include "../xmltv/Utilities.h" -#include "../compat.h" namespace vbox { /** @@ -53,7 +52,7 @@ static unsigned int GetUniqueId(const vbox::Recording *recording) { std::hash hasher; - std::string timestamp = compat::to_string(::xmltv::Utilities::XmltvToUnixTime(recording->m_endTime)); + std::string timestamp = std::to_string(::xmltv::Utilities::XmltvToUnixTime(recording->m_endTime)); int uniqueId = hasher(std::string(recording->m_title) + timestamp); return std::abs(uniqueId); } @@ -65,7 +64,7 @@ static unsigned int GetUniqueId(const vbox::SeriesRecording *series) { std::hash hasher; - std::string timestamp = compat::to_string(::xmltv::Utilities::XmltvToUnixTime(series->m_endTime)); + std::string timestamp = std::to_string(::xmltv::Utilities::XmltvToUnixTime(series->m_endTime)); int uniqueId = hasher(std::string(series->m_title) + timestamp); return std::abs(uniqueId); } @@ -76,7 +75,7 @@ static unsigned int GetUniqueId(const xmltv::Programme *programme) { std::hash hasher; - std::string timestamp = compat::to_string(::xmltv::Utilities::XmltvToUnixTime(programme->m_endTime)); + std::string timestamp = std::to_string(::xmltv::Utilities::XmltvToUnixTime(programme->m_endTime)); int uniqueId = hasher(std::string(programme->m_title) + timestamp); return std::abs(uniqueId); } diff -Nru kodi-pvr-vbox-4.5.0/src/vbox/request/ApiRequest.cpp kodi-pvr-vbox-4.6.0/src/vbox/request/ApiRequest.cpp --- kodi-pvr-vbox-4.5.0/src/vbox/request/ApiRequest.cpp 2013-05-31 22:59:22.000000000 +0000 +++ kodi-pvr-vbox-4.6.0/src/vbox/request/ApiRequest.cpp 2013-05-31 22:59:22.000000000 +0000 @@ -22,7 +22,6 @@ #include "ApiRequest.h" #include "../../client.h" #include "../../xmltv/Utilities.h" -#include "../../compat.h" #include using namespace vbox::request; @@ -89,7 +88,7 @@ // Optionally append the connection timeout if (m_timeout > 0) - url += "|connection-timeout=" + compat::to_string(m_timeout); + url += "|connection-timeout=" + std::to_string(m_timeout); return url; } @@ -106,12 +105,12 @@ void ApiRequest::AddParameter(const std::string &name, int value) { - m_parameters[name].push_back(compat::to_string(value)); + m_parameters[name].push_back(std::to_string(value)); } void ApiRequest::AddParameter(const std::string &name, unsigned int value) { - m_parameters[name].push_back(compat::to_string(value)); + m_parameters[name].push_back(std::to_string(value)); } void ApiRequest::SetTimeout(int timeout) diff -Nru kodi-pvr-vbox-4.5.0/src/vbox/response/Content.cpp kodi-pvr-vbox-4.6.0/src/vbox/response/Content.cpp --- kodi-pvr-vbox-4.5.0/src/vbox/response/Content.cpp 2013-05-31 22:59:22.000000000 +0000 +++ kodi-pvr-vbox-4.6.0/src/vbox/response/Content.cpp 2013-05-31 22:59:22.000000000 +0000 @@ -25,7 +25,6 @@ #include "../Channel.h" #include "../../xmltv/Utilities.h" #include "../../xmltv/Guide.h" -#include "../../compat.h" #include "../../vbox/VBox.h" using namespace tinyxml2; @@ -120,7 +119,7 @@ if (lcnValue.find("lcn_") != std::string::npos) lcnValue = lcnValue.substr(4); - channel->m_number = compat::stoui(lcnValue); + channel->m_number = static_cast(std::stoi(lcnValue)); } // Set icon URL if it exists diff -Nru kodi-pvr-vbox-4.5.0/src/vbox/Settings.h kodi-pvr-vbox-4.6.0/src/vbox/Settings.h --- kodi-pvr-vbox-4.5.0/src/vbox/Settings.h 2013-05-31 22:59:22.000000000 +0000 +++ kodi-pvr-vbox-4.6.0/src/vbox/Settings.h 2013-05-31 22:59:22.000000000 +0000 @@ -87,10 +87,6 @@ public: ConnectionParameters m_internalConnectionParams; ConnectionParameters m_externalConnectionParams; - bool m_useExternalXmltv; - std::string m_externalXmltvPath; - bool m_preferExternalXmltv; - bool m_useExternalXmltvIcons; ChannelOrder m_setChannelIdUsingOrder; unsigned int m_remindMinsBeforeProg; bool m_timeshiftEnabled; diff -Nru kodi-pvr-vbox-4.5.0/src/vbox/SoftwareVersion.cpp kodi-pvr-vbox-4.6.0/src/vbox/SoftwareVersion.cpp --- kodi-pvr-vbox-4.5.0/src/vbox/SoftwareVersion.cpp 2013-05-31 22:59:22.000000000 +0000 +++ kodi-pvr-vbox-4.6.0/src/vbox/SoftwareVersion.cpp 2013-05-31 22:59:22.000000000 +0000 @@ -20,15 +20,14 @@ */ #include "SoftwareVersion.h" -#include "../compat.h" using namespace vbox; std::string SoftwareVersion::GetString() const { - return compat::to_string(m_major) + "." + - compat::to_string(m_minor) + "." + - compat::to_string(m_revision); + return std::to_string(m_major) + "." + + std::to_string(m_minor) + "." + + std::to_string(m_revision); } SoftwareVersion SoftwareVersion::ParseString(const std::string &string) diff -Nru kodi-pvr-vbox-4.5.0/src/vbox/VBox.cpp kodi-pvr-vbox-4.6.0/src/vbox/VBox.cpp --- kodi-pvr-vbox-4.5.0/src/vbox/VBox.cpp 2013-05-31 22:59:22.000000000 +0000 +++ kodi-pvr-vbox-4.6.0/src/vbox/VBox.cpp 2013-05-31 22:59:22.000000000 +0000 @@ -26,7 +26,6 @@ #include #include "p8-platform/util/timeutils.h" #include "../client.h" -#include "../compat.h" #include "ContentIdentifier.h" #include "Exceptions.h" #include "Utilities.h" @@ -88,7 +87,7 @@ Log(LOG_INFO, std::string(" uboot version: " + boardInfo.GetString("UbootVersion")).c_str()); Log(LOG_INFO, std::string(" kernel version: " + boardInfo.GetString("KernelVersion")).c_str()); Log(LOG_INFO, std::string(" software version: " + boardInfo.GetString("SoftwareVersion")).c_str()); - Log(LOG_INFO, std::string(" number of tuners: " + compat::to_string(boardInfo.GetInteger("TunersNumber"))).c_str()); + Log(LOG_INFO, std::string(" number of tuners: " + std::to_string(boardInfo.GetInteger("TunersNumber"))).c_str()); // Construct backend information m_backendInformation.name = model; @@ -276,16 +275,6 @@ RetrieveRecordings(false); RetrieveGuide(false); - if (m_settings.m_useExternalXmltv) - { - RetrieveExternalGuide(); - InitializeChannelMapper(); - - // Retrieve the channels again if the user prefers external channel icons - if (m_settings.m_useExternalXmltvIcons) - RetrieveChannels(); - } - while (m_active) { // check for reminders each iteration @@ -310,9 +299,6 @@ // one-time guide retrieval (from PVR manager settings) else if (m_shouldSyncEpg) { - if (m_settings.m_useExternalXmltv) - RetrieveExternalGuide(); - RetrieveGuide(); m_shouldSyncEpg = false; } @@ -320,10 +306,6 @@ else if (lapCounter % (12 * 60) == 0) RetrieveGuide(); - // Update the external guide data every 12 * 60 * 12 = 12 hours - if (m_settings.m_useExternalXmltv && lapCounter % (12 * 60 * 12) == 0) - RetrieveExternalGuide(); - lapCounter++; usleep(5000 * 1000); // for some infinitely retarded reason, std::thread::sleep_for doesn't work } @@ -335,10 +317,6 @@ if (!m_settings.m_internalConnectionParams.AreValid()) return false; - // Check guide settings - if (m_settings.m_useExternalXmltv && m_settings.m_externalXmltvPath.empty()) - return false; - // Check timeshift settings if (m_settings.m_timeshiftEnabled && !XBMC->CanOpenDirectory(m_settings.m_timeshiftBufferPath.c_str())) return false; @@ -882,24 +860,6 @@ Schedule schedule; schedule.schedule = m_guide.GetSchedule(channel->m_xmltvName); - // Try to use the external guide data if a) it's loaded, b) the user prefers - // it or c) if no schedule was found - if (m_stateHandler.GetState() >= StartupState::EXTERNAL_GUIDE_LOADED && - (m_settings.m_preferExternalXmltv || !schedule.schedule)) - { - // Consult the channel mapper to find the corresponding external channel name - std::string mappedName = m_guideChannelMapper->GetExternalChannelName(channel->m_name); - std::string xmltvName = m_externalGuide.GetChannelId(mappedName); - - if (!mappedName.empty() && !xmltvName.empty()) - { - Log(LOG_DEBUG, "Using external guide data for channel %s", channel->m_name.c_str()); - - schedule.schedule = m_externalGuide.GetSchedule(xmltvName); - schedule.origin = Schedule::Origin::EXTERNAL_GUIDE; - } - } - return schedule; } @@ -978,12 +938,6 @@ response::XMLTVResponseContent content(response->GetReplyElement()); auto channels = content.GetChannels(); - // Optionally swap the channel icons for the ones in the external guide - if (m_settings.m_useExternalXmltvIcons && - m_stateHandler.GetState() >= StartupState::EXTERNAL_GUIDE_LOADED) - { - SwapChannelIcons(channels); - } // Add the batch to all channels allChannels.insert(allChannels.end(), channels.begin(), channels.end()); } @@ -1128,61 +1082,6 @@ m_stateHandler.EnterState(StartupState::GUIDE_LOADED); } -void VBox::RetrieveExternalGuide(bool triggerEvent/* = true*/) -{ - Log(LOG_INFO, "Loading external guide data"); - - try - { - request::FileRequest request(m_settings.m_externalXmltvPath); - response::ResponsePtr response = PerformRequest(request); - response::XMLTVResponseContent content(response->GetReplyElement()); - auto externalGuide = content.GetGuide(); - - LogGuideStatistics(externalGuide); - - { - std::unique_lock lock(m_mutex); - m_externalGuide = externalGuide; - } - - if (triggerEvent) - OnGuideUpdated(); - - if (m_stateHandler.GetState() < StartupState::EXTERNAL_GUIDE_LOADED) - m_stateHandler.EnterState(StartupState::EXTERNAL_GUIDE_LOADED); - } - catch (VBoxException &e) - { - LogException(e); - Log(LOG_INFO, "Failed to retrieve external guide data"); - } -} - -void VBox::InitializeChannelMapper() -{ - // Abort if we're already initialized or the external guide is not loaded - if (m_guideChannelMapper || - m_stateHandler.GetState() < StartupState::EXTERNAL_GUIDE_LOADED) - { - return; - } - - Log(LOG_INFO, "Loading external guide channel mapper"); - - m_guideChannelMapper = GuideChannelMapperPtr( - new GuideChannelMapper(m_guide, m_externalGuide)); - - try { - m_guideChannelMapper->Initialize(); - } - catch (VBoxException &e) - { - LogException(e); - Log(LOG_INFO, "Failed to load the external guide channel mapper"); - } -} - void VBox::InitializeGenreMapper() { // Abort if we're already initialized or the external guide is not loaded diff -Nru kodi-pvr-vbox-4.5.0/src/vbox/VBox.h kodi-pvr-vbox-4.6.0/src/vbox/VBox.h --- kodi-pvr-vbox-4.5.0/src/vbox/VBox.h 2013-05-31 22:59:22.000000000 +0000 +++ kodi-pvr-vbox-4.6.0/src/vbox/VBox.h 2013-05-31 22:59:22.000000000 +0000 @@ -226,11 +226,9 @@ void RetrieveChannels(bool triggerEvent = true); void RetrieveRecordings(bool triggerEvent = true); void RetrieveGuide(bool triggerEvent = true); - void RetrieveExternalGuide(bool triggerEvent = true); ReminderPtr GetActiveReminder(); void DisplayReminder(const ReminderPtr &reminder); void RetrieveReminders(); - void InitializeChannelMapper(); void InitializeGenreMapper(); void SwapChannelIcons(std::vector &channels); void SendScanEPG(std::string &rEpgDetectionCheckMethod) const; diff -Nru kodi-pvr-vbox-4.5.0/src/xmltv/Utilities.cpp kodi-pvr-vbox-4.6.0/src/xmltv/Utilities.cpp --- kodi-pvr-vbox-4.5.0/src/xmltv/Utilities.cpp 2013-05-31 22:59:22.000000000 +0000 +++ kodi-pvr-vbox-4.6.0/src/xmltv/Utilities.cpp 2013-05-31 22:59:22.000000000 +0000 @@ -20,7 +20,6 @@ */ #include "Utilities.h" -#include "../compat.h" #include "lib/tinyxml2/tinyxml2.h" #include #include @@ -33,6 +32,56 @@ const char* Utilities::XMLTV_DATETIME_FORMAT = "%Y%m%d%H%M%S"; const char* Utilities::XMLTV_TIMEZONE_OFFSET_FORMAT = "%03d%02d"; +namespace +{ + +// Adapted from https://stackoverflow.com/a/31533119 + +// Conversion from UTC date to second, signed 64-bit adjustable epoch version. +// Written by François Grieu, 2015-07-21; public domain. + +long long MakeTime(int year, int month, int day) +{ + return static_cast(year) * 365 + year / 4 - year / 100 * 3 / 4 + (month + 2) * 153 / 5 + day; +} + +long long GetUTCTime(int year, int mon, int mday, int hour, int min, int sec) +{ + int m = mon - 1; + int y = year + 100; + + if (m < 2) + { + m += 12; + --y; + } + + return (((MakeTime(y, m, mday) - MakeTime(1970 + 99, 12, 1)) * 24 + hour) * 60 + min) * 60 + sec; +} + +long long ParseDateTime(const std::string& strDate) +{ + int year = 2000; + int mon = 1; + int mday = 1; + int hour = 0; + int min = 0; + int sec = 0; + char offset_sign = '+'; + int offset_hours = 0; + int offset_minutes = 0; + + std::sscanf(strDate.c_str(), "%04d%02d%02d%02d%02d%02d %c%02d%02d", &year, &mon, &mday, &hour, &min, &sec, &offset_sign, &offset_hours, &offset_minutes); + + long offset_of_date = (offset_hours * 60 + offset_minutes) * 60; + if (offset_sign == '-') + offset_of_date = -offset_of_date; + + return GetUTCTime(year, mon, mday, hour, min, sec) - offset_of_date; +} + +} // unnamed namespace + std::string Utilities::GetTimezoneOffset(const std::string timestamp) { std::string xmltvTime = timestamp; @@ -67,26 +116,7 @@ time_t Utilities::XmltvToUnixTime(const std::string &time) { - std::tm timeinfo; - - // Convert the timestamp, disregarding the timezone offset - sscanf(time.c_str(), "%04d%02d%02d%02d%02d%02d", - &timeinfo.tm_year, &timeinfo.tm_mon, &timeinfo.tm_mday, - &timeinfo.tm_hour, &timeinfo.tm_min, &timeinfo.tm_sec); - - timeinfo.tm_year -= 1900; - timeinfo.tm_mon -= 1; - timeinfo.tm_isdst = -1; - - time_t unixTime = compat::timegm(&timeinfo); - - // Adjust for eventual timezone offset - std::string tzOffset = GetTimezoneOffset(time); - - if (!tzOffset.empty()) - unixTime -= GetTimezoneAdjustment(tzOffset); - - return unixTime; + return static_cast(ParseDateTime(time)); } std::string Utilities::UnixTimeToXmltv(const time_t timestamp, @@ -174,7 +204,7 @@ if (!pText) throw std::invalid_argument("No text in element"); std::string content = pText; - value = compat::stoi(content); + value = std::stoi(content); } catch (std::invalid_argument) { @@ -195,7 +225,7 @@ if (!pText) throw std::invalid_argument("No text in element"); std::string content = pText; - value = compat::stoui(content); + value = static_cast(std::stoi(content)); } catch (std::invalid_argument) {