Skip to content

Commit

Permalink
Merge pull request #32 from zcsizmadia/master
Browse files Browse the repository at this point in the history
Use correct channel number parsed from GuideNumber
  • Loading branch information
zcsizmadia committed Jan 8, 2017
2 parents baeafbd + c8812f2 commit b5762b7
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -39,6 +39,6 @@ before_script:
- cd $TRAVIS_BUILD_DIR/..
- git clone --depth=1 https://github.com/xbmc/xbmc.git
- cd pvr.hdhomerun && mkdir build && cd build
- cmake -DADDONS_TO_BUILD=pvr.hdhomerun -DADDON_SRC_PREFIX=$TRAVIS_BUILD_DIR/.. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$TRAVIS_BUILD_DIR/../xbmc/addons -DPACKAGE_ZIP=1 $TRAVIS_BUILD_DIR/../xbmc/project/cmake/addons
- cmake -DADDONS_TO_BUILD=pvr.hdhomerun -DADDON_SRC_PREFIX=$TRAVIS_BUILD_DIR/.. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$TRAVIS_BUILD_DIR/../xbmc/addons -DPACKAGE_ZIP=1 $TRAVIS_BUILD_DIR/../xbmc/cmake/addons

script: make
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -9,7 +9,7 @@ HDHomeRun PVR client addon for [Kodi] (http://kodi.tv)
1. `git clone https://github.com/xbmc/xbmc.git`
2. `git clone https://github.com/kodi-pvr/pvr.hdhomerun.git`
3. `cd pvr.hdhomerun && mkdir build && cd build`
4. `cmake -DADDONS_TO_BUILD=pvr.hdhomerun -DADDON_SRC_PREFIX=../.. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=../../xbmc/addons -DPACKAGE_ZIP=1 ../../xbmc/project/cmake/addons`
4. `cmake -DADDONS_TO_BUILD=pvr.hdhomerun -DADDON_SRC_PREFIX=../.. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=../../xbmc/addons -DPACKAGE_ZIP=1 ../../xbmc/cmake/addons`
5. `make`

### Windows
Expand All @@ -20,7 +20,7 @@ HDHomeRun PVR client addon for [Kodi] (http://kodi.tv)
4. `cd pvr.hdhomerun`
5. `mkdir build`
6. `cd build`
7. `cmake -G "Visual Studio 14" -DADDONS_TO_BUILD=pvr.hdhomerun -DCMAKE_BUILD_TYPE=Debug -DADDON_SRC_PREFIX=%ROOT% -DCMAKE_INSTALL_PREFIX=%ROOT%\xbmc\addons -DCMAKE_USER_MAKE_RULES_OVERRIDE=%ROOT%\xbmc\project\cmake\scripts\windows\c-flag-overrides.cmake -DCMAKE_USER_MAKE_RULES_OVERRIDE_CXX=%ROOT%\xbmc\project\cmake\scripts\windows\cxx-flag-overrides.cmake -DPACKAGE_ZIP=1 %ROOT%\xbmc\project\cmake\addons`
7. `cmake -G "Visual Studio 14" -DADDONS_TO_BUILD=pvr.hdhomerun -DCMAKE_BUILD_TYPE=Debug -DADDON_SRC_PREFIX=%ROOT% -DCMAKE_INSTALL_PREFIX=%ROOT%\xbmc\addons -DCMAKE_USER_MAKE_RULES_OVERRIDE=%ROOT%\xbmc\project\cmake\scripts\windows\c-flag-overrides.cmake -DCMAKE_USER_MAKE_RULES_OVERRIDE_CXX=%ROOT%\xbmc\project\cmake\scripts\windows\cxx-flag-overrides.cmake -DPACKAGE_ZIP=1 %ROOT%\xbmc\cmake\addons`
8. `cmake --build . --config Debug`

## Useful links
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Expand Up @@ -29,5 +29,5 @@ build_script:
- mkdir build
- cd build
# Must use absolute path for cmake to build depends correctly
- cmake -G "%GENERATOR%" -DADDONS_TO_BUILD=%ADDON% -DCMAKE_BUILD_TYPE=%CONFIG% -DADDON_SRC_PREFIX=%ROOT% -DCMAKE_INSTALL_PREFIX=%ROOT%\xbmc\addons -DCMAKE_USER_MAKE_RULES_OVERRIDE=%ROOT%\xbmc\project\cmake\scripts\windows\c-flag-overrides.cmake -DCMAKE_USER_MAKE_RULES_OVERRIDE_CXX=%ROOT%\xbmc\project\cmake\scripts\windows\cxx-flag-overrides.cmake -DPACKAGE_ZIP=1 %ROOT%\xbmc\project\cmake\addons
- cmake -G "%GENERATOR%" -DADDONS_TO_BUILD=%ADDON% -DCMAKE_BUILD_TYPE=%CONFIG% -DADDON_SRC_PREFIX=%ROOT% -DCMAKE_INSTALL_PREFIX=%ROOT%\xbmc\addons -DCMAKE_USER_MAKE_RULES_OVERRIDE=%ROOT%\xbmc\project\cmake\scripts\windows\c-flag-overrides.cmake -DCMAKE_USER_MAKE_RULES_OVERRIDE_CXX=%ROOT%\xbmc\project\cmake\scripts\windows\cxx-flag-overrides.cmake -DPACKAGE_ZIP=1 %ROOT%\xbmc\cmake\addons
- cmake --build . --config %CONFIG%
2 changes: 1 addition & 1 deletion pvr.hdhomerun/addon.xml.in
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<addon
id="pvr.hdhomerun"
version="3.0.1"
version="3.0.2"
name="PVR HDHomeRun Client"
provider-name="Zoltan Csizmadia (zcsizmadia@gmail.com)">
<requires>
Expand Down
3 changes: 3 additions & 0 deletions pvr.hdhomerun/changelog.txt
@@ -1,3 +1,6 @@
v3.0.2
- Correct channel Number if back-end provided channel number is used

v3.0.0
- Initial Kodi v18 version

Expand Down
20 changes: 17 additions & 3 deletions src/HDHomeRunTuners.cpp
Expand Up @@ -208,15 +208,15 @@ bool HDHomeRunTuners::Update(int nMode)
(g.Settings.bHideDuplicateChannels && guideNumberSet.find(jsonChannel["GuideNumber"].asString()) != guideNumberSet.end()));

jsonChannel["_UID"] = PvrCalculateUniqueId(jsonChannel["GuideName"].asString() + jsonChannel["URL"].asString());
jsonChannel["_ChannelName"] = jsonChannel["GuideNumber"].asString() + " " + jsonChannel["GuideName"].asString();
jsonChannel["_ChannelName"] = jsonChannel["GuideName"].asString();

// Find guide entry
for (nGuideIndex = 0; nGuideIndex < pTuner->Guide.size(); nGuideIndex++)
{
const Json::Value& jsonGuide = pTuner->Guide[nGuideIndex];
if (jsonGuide["GuideNumber"].asString() == jsonChannel["GuideNumber"].asString())
{
jsonChannel["_ChannelName"] = jsonChannel["GuideNumber"].asString() + " " + jsonGuide["Affiliate"].asString();
jsonChannel["_ChannelName"] = jsonGuide["Affiliate"].asString();
jsonChannel["_IconPath"] = jsonGuide["ImageURL"].asString();
break;
}
Expand All @@ -225,11 +225,24 @@ bool HDHomeRunTuners::Update(int nMode)
jsonChannel["_Hide"] = bHide;

if (bHide)
{
jsonChannel["_ChannelNumber"] = 0;
jsonChannel["_SubChannelNumber"] = 0;
}
else
{
jsonChannel["_ChannelNumber"] = nChannelNumber++;
int nChannel = 0, nSubChannel = 0;
if (sscanf(jsonChannel["GuideNumber"].asString().c_str(), "%d.%d", &nChannel, &nSubChannel) != 2)
{
nSubChannel = 0;
if (sscanf(jsonChannel["GuideNumber"].asString().c_str(), "%d", &nChannel) != 1)
nChannel = nChannelNumber;
}
jsonChannel["_ChannelNumber"] = nChannel;
jsonChannel["_SubChannelNumber"] = nSubChannel;
guideNumberSet.insert(jsonChannel["GuideNumber"].asString());

nChannelNumber++;
}
}

Expand Down Expand Up @@ -280,6 +293,7 @@ PVR_ERROR HDHomeRunTuners::PvrGetChannels(ADDON_HANDLE handle, bool bRadio)

pvrChannel.iUniqueId = jsonChannel["_UID"].asUInt();
pvrChannel.iChannelNumber = jsonChannel["_ChannelNumber"].asUInt();
pvrChannel.iSubChannelNumber = jsonChannel["_SubChannelNumber"].asUInt();
PVR_STRCPY(pvrChannel.strChannelName, jsonChannel["_ChannelName"].asString().c_str());
PVR_STRCPY(pvrChannel.strStreamURL, jsonChannel["URL"].asString().c_str());
PVR_STRCPY(pvrChannel.strIconPath, jsonChannel["_IconPath"].asString().c_str());
Expand Down

0 comments on commit b5762b7

Please sign in to comment.