Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

MediaPortal pvr addon: update to v1.2.2.111 (ffmpeg version only)

  • Loading branch information...
commit a76f5d4124a9f4d7d91fc7a7456ef729fe4fe500 1 parent d465c04
Marcel Groothuis authored opdenkamp committed

Showing 36 changed files with 846 additions and 431 deletions. Show diff stats Hide diff stats

  1. +1 1  addons/pvr.team-mediaportal.tvserver/addon.xml
  2. +25 0 addons/pvr.team-mediaportal.tvserver/changelog.txt
  3. +21 2 addons/pvr.team-mediaportal.tvserver/resources/language/Dutch/strings.xml
  4. +21 2 addons/pvr.team-mediaportal.tvserver/resources/language/English/strings.xml
  5. +4 0 addons/pvr.team-mediaportal.tvserver/resources/language/German/strings.xml
  6. +25 0 addons/pvr.team-mediaportal.tvserver/resources/language/Italian/strings.xml
  7. +2 2 addons/pvr.team-mediaportal.tvserver/resources/settings.xml
  8. +0 4 project/VS2010Express/XBMC for Windows.sln
  9. +0 34 xbmc/pvrclients/MediaPortal/AutoLock.cpp
  10. +0 29 xbmc/pvrclients/MediaPortal/AutoLock.h
  11. +0 64 xbmc/pvrclients/MediaPortal/CriticalSection.cpp
  12. +10 0 xbmc/pvrclients/MediaPortal/FileUtils.h
  13. +143 0 xbmc/pvrclients/MediaPortal/GenreTable.cpp
  14. +23 12 xbmc/pvrclients/MediaPortal/{CriticalSection.h → GenreTable.h}
  15. +5 7 xbmc/pvrclients/MediaPortal/Makefile.in
  16. +2 2 xbmc/pvrclients/MediaPortal/README
  17. +12 9 xbmc/pvrclients/MediaPortal/Socket.cpp
  18. +9 8 xbmc/pvrclients/MediaPortal/Socket.h
  19. +7 4 xbmc/pvrclients/MediaPortal/client.cpp
  20. +3 3 xbmc/pvrclients/MediaPortal/client.h
  21. +5 37 xbmc/pvrclients/MediaPortal/epg.cpp
  22. +3 11 xbmc/pvrclients/MediaPortal/epg.h
  23. +2 3 xbmc/pvrclients/MediaPortal/os-dependent.h
  24. +7 6 xbmc/pvrclients/MediaPortal/project/VS2010Express/XBMC_MPTV.vcxproj
  25. +15 9 xbmc/pvrclients/MediaPortal/project/VS2010Express/XBMC_MPTV.vcxproj.filters
  26. +155 131 xbmc/pvrclients/MediaPortal/pvrclient-mediaportal.cpp
  27. +7 5 xbmc/pvrclients/MediaPortal/pvrclient-mediaportal.h
  28. +75 41 xbmc/pvrclients/MediaPortal/recordings.cpp
  29. +16 0 xbmc/pvrclients/MediaPortal/recordings.h
  30. +2 2 xbmc/pvrclients/MediaPortal/timers.cpp
  31. +14 1 xbmc/pvrclients/MediaPortal/utils.cpp
  32. +9 0 xbmc/pvrclients/MediaPortal/utils.h
  33. +91 0 xbmc/pvrclients/MediaPortal/windows/FileUtils.cpp
  34. +104 0 xbmc/pvrclients/MediaPortal/windows/WindowsUtils.cpp
  35. +27 0 xbmc/pvrclients/MediaPortal/windows/WindowsUtils.h
  36. +1 2  xbmc/pvrclients/MediaPortal/windows/os_windows.h
2  addons/pvr.team-mediaportal.tvserver/addon.xml
... ... @@ -1,7 +1,7 @@
1 1 <?xml version="1.0" encoding="UTF-8"?>
2 2 <addon
3 3 id="pvr.team-mediaportal.tvserver"
4   - version="1.1.3.107"
  4 + version="1.2.2.111"
5 5 name="MediaPortal PVR Client (ffmpeg)"
6 6 provider-name="Marcel Groothuis">
7 7 <requires>
25 addons/pvr.team-mediaportal.tvserver/changelog.txt
... ... @@ -1,3 +1,28 @@
  1 +v1.2.2.11:
  2 +- Fixed: Day of the week mismatch for timers between MePo and XBMC. Credits: jajoflo
  3 +- Added: Trigger recording update on timer retrieval so the recording list is kept up to date when there is a new recording. Credits: jajoflo
  4 +- Fixed: tv group retrieval requested radio groups
  5 +- Added: add support for recording genre field
  6 +- Fixed: fixes for recording filepath split-up
  7 +- Added: show an error message when the recording filename or playback URL is empty
  8 +
  9 +v1.2.2.110:
  10 +- Added: use channel icons from MediaPortal (Windows, localhost only)
  11 +- Changed: switch from libPlatform + libTcpSocket to platform library
  12 +
  13 +v1.2.2.109:
  14 +- Fixed: fix mimetype for tv channels
  15 +- Fixed: make sure that OpenLiveStream does not return true due to m_iCurrentChannel when the TSReader fails in a later stage
  16 +- Fixed: compilation IOS/OSX/Linux
  17 +- Fixed: compile fixes for API move into ADDON namespace
  18 +- Added: show localized error messages when OpenLiveStream fails
  19 +- Added: signal status support
  20 +- Fixed: Don't return encrypted channels as group members when FTA only option is turned on
  21 +- Added: add more debug log information about the addon settings and status
  22 +- Added: add support for direct recording playback from network shares (smb, Windows only)
  23 +- Added: implement support for recording subdirectories
  24 +- Fixed: don't return radio channels/channelgroup/channelgroup mappings when radio support is disabled
  25 +
1 26 v1.1.3.107:
2 27 - Added: add additional checks for communication errors
3 28 - Fixed: trigger also a recording list update on timer changes
23 addons/pvr.team-mediaportal.tvserver/resources/language/Dutch/strings.xml
@@ -20,6 +20,25 @@
20 20 <string id="30041">MediaPortal</string>
21 21
22 22 <!-- on-screen error messages -->
23   - <string id="30050">Uw TVServerXBMC plugin v%s is te oud. U heeft minimaal versie v%s of nieuwer nodig!</string>
24   - <string id="30050">Uw TVServerXBMC plugin is te oud. U heeft minimaal versie v%s of nieuwer nodig!</string>
  23 + <string id="30050">Uw TVServerXBMC plugin '%s' is te oud. U heeft minimaal versie '%s' of nieuwer nodig!</string>
  24 + <string id="30051">Uw TVServerXBMC plugin is te oud. U heeft minimaal versie '%s' of nieuwer nodig!</string>
  25 + <string id="30052">Afspelen opname mislukt. Lege URL of bestandsnaam.</string>
  26 +
  27 + <!-- Status message strings corresponding to the MediaPortal TvResult enum -->
  28 + <string id="30060">Alle kaarten zijn bezet</string>
  29 + <string id="30061">Kanaal is gecodeerd</string>
  30 + <string id="30062">Geen video of audio gedetecteerd</string>
  31 + <string id="30063">Geen signaal</string>
  32 + <string id="30064">Onbekende fout</string>
  33 + <string id="30065">Graph starten mislukt</string>
  34 + <string id="30066">Onbekend kanaal</string>
  35 + <string id="30067">Geen tuning details</string>
  36 + <string id="30068">Kanaal is niet gekoppeld aan een kaart</string>
  37 + <string id="30069">Kaart is uitgeschakeld</string>
  38 + <string id="30070">Verbinding met slave verbroken</string>
  39 + <string id="30071">Niet de eigenaar</string>
  40 + <string id="30072">Aanmaken Graph mislukt</string>
  41 + <string id="30073">SW Encoder ontbreekt</string>
  42 + <string id="30074">Geen vrije diskruimte</string>
  43 + <string id="30075">Geen PMT gevonden</string>
25 44 </strings>
23 addons/pvr.team-mediaportal.tvserver/resources/language/English/strings.xml
@@ -20,6 +20,25 @@
20 20 <string id="30041">MediaPortal</string>
21 21
22 22 <!-- on-screen error messages -->
23   - <string id="30050">Your TVServerXBMC version v%s is too old. Please upgrade to v%s or higher!</string>
24   - <string id="30051">Your TVServerXBMC version is too old. Please upgrade to v%s or higher!</string>
  23 + <string id="30050">Your TVServerXBMC version '%s' is too old. Please upgrade to '%s' or higher!</string>
  24 + <string id="30051">Your TVServerXBMC version is too old. Please upgrade to '%s' or higher!</string>
  25 + <string id="30052">Recording playback failed. Empty URL of filename.</string>
  26 +
  27 + <!-- Status message strings corresponding to the MediaPortal TvResult enum -->
  28 + <string id="30060">All cards are busy</string>
  29 + <string id="30061">Channel is scrambled</string>
  30 + <string id="30062">No video or audio detected</string>
  31 + <string id="30063">No signal detected</string>
  32 + <string id="30064">Unknown error</string>
  33 + <string id="30065">Unable to start graph</string>
  34 + <string id="30066">Unknown channel</string>
  35 + <string id="30067">No tuning details</string>
  36 + <string id="30068">Channel is not mapped to any card</string>
  37 + <string id="30069">Card is disabled</string>
  38 + <string id="30070">Connection to slave failed</string>
  39 + <string id="30071">Not the owner</string>
  40 + <string id="30072">Graph building failed</string>
  41 + <string id="30073">SW Encoder missing</string>
  42 + <string id="30074">No free disk space</string>
  43 + <string id="30075">No PMT found</string>
25 44 </strings>
4 addons/pvr.team-mediaportal.tvserver/resources/language/German/strings.xml
@@ -14,4 +14,8 @@
14 14 <string id="30010">Wartezeit, nachdem ein Kanal abgestimmt worden ist (ms)</string>
15 15 <string id="30011">Aufnahmen aus Ordner lesen</string>
16 16 <string id="30012">Mediaportal Aufnahmeordner</string>
  17 +
  18 + <!-- on-screen error messages -->
  19 + <string id="30050">Ihre TVServerXBMC plugin v%s ist zu alt. Sie brauchen mindestens Version v%s!</string>
  20 + <string id="30051">Ihre TVServerXBMC plugin Version ist zu alt. Sie brauchen mindestens Version v%s!</string>
17 21 </strings>
25 addons/pvr.team-mediaportal.tvserver/resources/language/Italian/strings.xml
... ... @@ -0,0 +1,25 @@
  1 +<?xml version="1.0" encoding="utf-8" standalone="yes"?>
  2 +<strings>
  3 + <!-- settings labels -->
  4 + <string id="30000">Nome del server Mediaportal</string>
  5 + <string id="30001">Porta del plugin Mediaportal di XBMC</string>
  6 + <string id="30002">Solo Free-to-air</string>
  7 + <string id="30003">Includi Radio</string>
  8 +
  9 + <string id="30005">Timeout per la connessione (s)</string>
  10 + <string id="30006">Importa solo canali TV dal gruppo</string>
  11 + <string id="30007">Importa solo canali radio dal gruppo</string>
  12 + <string id="30008">Converti il nome del server nell'indirizzo IP</string>
  13 + <string id="30009">EPG: Leggi le stringhe dei generi (lento)</string>
  14 + <string id="30010">Tempo di attesa dopo il tuning di un canale (ms)</string>
  15 + <string id="30011">Registra direttamente (nessuno streaming)</string>
  16 + <string id="30012">Cartella di salvataggio per Mediaportal</string>
  17 +
  18 + <!-- category labels -->
  19 + <string id="30040">Connessione</string>
  20 + <string id="30041">MediaPortal</string>
  21 +
  22 + <!-- on-screen error messages -->
  23 + <string id="30050">La tua versione di TVServerXBMC v%s � troppo vecchia. Per favore, aggiornala a v%s o superiore!</string>
  24 + <string id="30051">La tua versione di TVServerXBMC � troppo vecchia. Per favore, aggiornala a v%s o superiore!</string>
  25 +</strings>
4 addons/pvr.team-mediaportal.tvserver/resources/settings.xml
@@ -4,7 +4,7 @@
4 4 <category label="30040">
5 5 <setting id="host" type="text" label="30000" option="urlencoded" default="127.0.0.1" />
6 6 <setting id="port" type="number" label="30001" default="9596" />
7   - <setting id="timeout" type="enum" label="30005" values="0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15" default="6"/>
  7 + <setting id="timeout" type="enum" label="30005" values="0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20" default="10"/>
8 8 </category>
9 9
10 10 <!-- Mediaportal -->
@@ -15,7 +15,7 @@
15 15 <setting id="radiogroup" type="text" label="30007" default="" />
16 16 <setting id="resolvertsphostname" type="bool" label="30008" default="true" />
17 17 <setting id="readgenre" type="bool" label="30009" default="false" />
18   - <setting id="sleeponrtspurl" type="enum" label="30010" values="0|100|200|300|400|500|600|700|800|900|1000|1200|1500|2000|2500" default="0"/>
  18 + <setting id="sleeponrtspurl" type="enum" label="30010" values="0|100|200|300|400|500|600|700|800|900|1000|1200|1500|2000|2500|3000" default="0"/>
19 19 <setting id="userecordingsdir" type="bool" label="30011" default="false" />
20 20 <setting id="recordingsdir" type="folder" option="smb" label="30012" default="" />
21 21 </category>
4 project/VS2010Express/XBMC for Windows.sln
@@ -90,10 +90,6 @@ EndProject
90 90 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libXBMC_pvr", "..\..\lib\addons\library.xbmc.pvr\project\VS2010Express\libXBMC_pvr.vcxproj", "{6D8C91F8-992F-4C83-9DE3-485D64EF8420}"
91 91 EndProject
92 92 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pvrclient_mptv", "..\..\xbmc\pvrclients\MediaPortal\project\VS2010Express\XBMC_MPTV.vcxproj", "{74C9642E-1988-48DC-8404-11717C355378}"
93   - ProjectSection(ProjectDependencies) = postProject
94   - {E2DF1AC8-E9BF-43B8-B5D9-7EC3B513EEF1} = {E2DF1AC8-E9BF-43B8-B5D9-7EC3B513EEF1}
95   - {0F78AAF3-A188-4491-8BA6-203DC0B8D7F5} = {0F78AAF3-A188-4491-8BA6-203DC0B8D7F5}
96   - EndProjectSection
97 93 EndProject
98 94 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pvrclient_tvheadend", "..\..\xbmc\pvrclients\tvheadend\project\VS2010Express\XBMC_tvheadend.vcxproj", "{C04B0FB1-667D-4F1C-BDAE-A07CDFFA74A3}"
99 95 ProjectSection(ProjectDependencies) = postProject
34 xbmc/pvrclients/MediaPortal/AutoLock.cpp
... ... @@ -1,34 +0,0 @@
1   -/*
2   - * Copyright (C) 2005-2011 Team XBMC
3   - * http://www.xbmc.org
4   - *
5   - * This program is free software: you can redistribute it and/or modify
6   - * it under the terms of the GNU General Public License as published by
7   - * the Free Software Foundation, either version 2 of the License, or
8   - * (at your option) any later version.
9   - *
10   - * This program is distributed in the hope that it will be useful,
11   - * but WITHOUT ANY WARRANTY; without even the implied warranty of
12   - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13   - * GNU General Public License for more details.
14   - *
15   - * You should have received a copy of the GNU General Public License
16   - * along with this program. If not, see <http://www.gnu.org/licenses/>.
17   - */
18   -
19   -#include "AutoLock.h"
20   -
21   -/*
22   - * \brief CAutoLock constructor
23   - * \param pCritSec
24   - */
25   -CAutoLock::CAutoLock(CCriticalSection* pCritSec)
26   -{
27   - m_pAutoLock = pCritSec;
28   - m_pAutoLock->Lock();
29   -}
30   -
31   -CAutoLock::~CAutoLock()
32   -{
33   - m_pAutoLock->Unlock();
34   -}
29 xbmc/pvrclients/MediaPortal/AutoLock.h
... ... @@ -1,29 +0,0 @@
1   -#pragma once
2   -/*
3   - * Copyright (C) 2005-2011 Team XBMC
4   - * http://www.xbmc.org
5   - *
6   - * This program is free software: you can redistribute it and/or modify
7   - * it under the terms of the GNU General Public License as published by
8   - * the Free Software Foundation, either version 2 of the License, or
9   - * (at your option) any later version.
10   - *
11   - * This program is distributed in the hope that it will be useful,
12   - * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14   - * GNU General Public License for more details.
15   - *
16   - * You should have received a copy of the GNU General Public License
17   - * along with this program. If not, see <http://www.gnu.org/licenses/>.
18   - */
19   -
20   -#include "CriticalSection.h"
21   -
22   -class CAutoLock
23   -{
24   - public:
25   - CAutoLock(CCriticalSection* pCritSec);
26   - ~CAutoLock();
27   - protected:
28   - CCriticalSection* m_pAutoLock;
29   -};
64 xbmc/pvrclients/MediaPortal/CriticalSection.cpp
... ... @@ -1,64 +0,0 @@
1   -/*
2   - * Copyright (C) 2005-2011 Team XBMC
3   - * http://www.xbmc.org
4   - *
5   - * This program is free software: you can redistribute it and/or modify
6   - * it under the terms of the GNU General Public License as published by
7   - * the Free Software Foundation, either version 2 of the License, or
8   - * (at your option) any later version.
9   - *
10   - * This program is distributed in the hope that it will be useful,
11   - * but WITHOUT ANY WARRANTY; without even the implied warranty of
12   - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13   - * GNU General Public License for more details.
14   - *
15   - * You should have received a copy of the GNU General Public License
16   - * along with this program. If not, see <http://www.gnu.org/licenses/>.
17   - */
18   -
19   -#include "CriticalSection.h"
20   -
21   -CCriticalSection::CCriticalSection(void)
22   -{
23   -}
24   -
25   -void CCriticalSection::Initialize(void)
26   -{
27   -#ifdef TARGET_WINDOWS
28   - InitializeCriticalSection(&m_CriticalSection);
29   -#else
30   - pthread_mutexattr_t attr;
31   - pthread_mutexattr_init(&attr);
32   - pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
33   - pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
34   - pthread_mutex_init(&m_CriticalSection, &attr);
35   - pthread_mutexattr_destroy(&attr);
36   -#endif
37   -}
38   -
39   -CCriticalSection::~CCriticalSection(void)
40   -{
41   -#ifdef TARGET_WINDOWS
42   - DeleteCriticalSection(&m_CriticalSection);
43   -#else
44   - pthread_mutex_destroy(&m_CriticalSection);
45   -#endif
46   -}
47   -
48   -void CCriticalSection::Lock(void)
49   -{
50   -#ifdef TARGET_WINDOWS
51   - EnterCriticalSection(&m_CriticalSection);
52   -#else
53   - pthread_mutex_lock(&m_CriticalSection);
54   -#endif
55   -}
56   -
57   -void CCriticalSection::Unlock(void)
58   -{
59   -#ifdef TARGET_WINDOWS
60   - LeaveCriticalSection(&m_CriticalSection);
61   -#else
62   - pthread_mutex_unlock(&m_CriticalSection);
63   -#endif
64   -}
10 xbmc/pvrclients/MediaPortal/FileUtils.h
... ... @@ -0,0 +1,10 @@
  1 +#include <string>
  2 +
  3 +namespace OS
  4 +{
  5 + class CFile
  6 + {
  7 + public:
  8 + static bool Exists(const std::string& strFileName);
  9 + };
  10 +};
143 xbmc/pvrclients/MediaPortal/GenreTable.cpp
... ... @@ -0,0 +1,143 @@
  1 +/*
  2 + * Copyright (C) 2005-2012 Team XBMC
  3 + * http://www.xbmc.org
  4 + *
  5 + * This program is free software: you can redistribute it and/or modify
  6 + * it under the terms of the GNU General Public License as published by
  7 + * the Free Software Foundation, either version 2 of the License, or
  8 + * (at your option) any later version.
  9 + *
  10 + * This program is distributed in the hope that it will be useful,
  11 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13 + * GNU General Public License for more details.
  14 + *
  15 + * You should have received a copy of the GNU General Public License
  16 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17 + *
  18 + */
  19 +
  20 +#include "client.h"
  21 +#include "GenreTable.h"
  22 +#include "lib/tinyxml/tinyxml.h"
  23 +
  24 +using namespace ADDON;
  25 +using namespace std;
  26 +
  27 +bool CGenreTable::LoadGenreXML(const std::string &filename)
  28 +{
  29 + TiXmlDocument xmlDoc;
  30 + if (!xmlDoc.LoadFile(filename))
  31 + {
  32 + XBMC->Log(LOG_DEBUG, "Unable to load %s: %s at line %d", filename.c_str(), xmlDoc.ErrorDesc(), xmlDoc.ErrorRow());
  33 + return false;
  34 + }
  35 +
  36 + XBMC->Log(LOG_DEBUG, "Opened %s to read genre string to type/subtype translation table", filename.c_str());
  37 +
  38 + TiXmlHandle hDoc(&xmlDoc);
  39 + TiXmlElement* pElem;
  40 + TiXmlHandle hRoot(0);
  41 + string sGenre;
  42 + const char* sGenreType = NULL;
  43 + const char* sGenreSubType = NULL;
  44 + genre_t genre;
  45 +
  46 + // block: genrestrings
  47 + pElem = hDoc.FirstChildElement("genrestrings").Element();
  48 + // should always have a valid root but handle gracefully if it does
  49 + if (!pElem)
  50 + {
  51 + XBMC->Log(LOG_DEBUG, "Could not find <genrestrings> element");
  52 + return false;
  53 + }
  54 +
  55 + //This should hold: pElem->Value() == "genrestrings"
  56 +
  57 + // save this for later
  58 + hRoot=TiXmlHandle(pElem);
  59 +
  60 + // iterate through all genre elements
  61 + TiXmlElement* pGenreNode = hRoot.FirstChildElement("genre").Element();
  62 + //This should hold: pGenreNode->Value() == "genre"
  63 +
  64 + if (!pGenreNode)
  65 + {
  66 + XBMC->Log(LOG_DEBUG, "Could not find <genre> element");
  67 + return false;
  68 + }
  69 +
  70 + for (; pGenreNode != NULL; pGenreNode = pGenreNode->NextSiblingElement("genre"))
  71 + {
  72 + const char* sGenreString = pGenreNode->GetText();
  73 +
  74 + if (sGenreString)
  75 + {
  76 + sGenreType = pGenreNode->Attribute("type");
  77 + sGenreSubType = pGenreNode->Attribute("subtype");
  78 +
  79 + if ((sGenreType) && (strlen(sGenreType) > 2))
  80 + {
  81 + if(sscanf(sGenreType + 2, "%x", &genre.type) != 1)
  82 + genre.type = 0;
  83 + }
  84 + else
  85 + {
  86 + genre.type = 0;
  87 + }
  88 +
  89 + if ((sGenreSubType) && (strlen(sGenreSubType) > 2 ))
  90 + {
  91 + if(sscanf(sGenreSubType + 2, "%x", &genre.subtype) != 1)
  92 + genre.subtype = 0;
  93 + }
  94 + else
  95 + {
  96 + genre.subtype = 0;
  97 + }
  98 +
  99 + if (genre.type > 0)
  100 + {
  101 + XBMC->Log(LOG_DEBUG, "Genre '%s' => 0x%x, 0x%x", sGenreString, genre.type, genre.subtype);
  102 + m_genremap.insert(std::pair<std::string, genre_t>(sGenreString, genre));
  103 + }
  104 + }
  105 + }
  106 +
  107 + return true;
  108 +}
  109 +
  110 +void CGenreTable::GenreToTypes(string& strGenre, int& genreType, int& genreSubType)
  111 +{
  112 + // The xmltv plugin from the MediaPortal TV Server can return genre
  113 + // strings in local language (depending on the external TV guide source).
  114 + // The only way to solve this at the XMBC side is to transfer the
  115 + // genre string to XBMC or to let this plugin (or the TVServerXBMC
  116 + // plugin) translate it into XBMC compatible (numbered) genre types
  117 + string m_genre = strGenre;
  118 +
  119 + if(m_genremap.size() > 0 && m_genre.length() > 0)
  120 + {
  121 + GenreMap::iterator it;
  122 +
  123 + std::transform(m_genre.begin(), m_genre.end(), m_genre.begin(), ::tolower);
  124 +
  125 + it = m_genremap.find(m_genre);
  126 + if (it != m_genremap.end())
  127 + {
  128 + genreType = it->second.type;
  129 + genreSubType = it->second.subtype;
  130 + }
  131 + else
  132 + {
  133 + XBMC->Log(LOG_DEBUG, "EPG: No mapping of '%s' to genre type/subtype found.", strGenre.c_str());
  134 + genreType = EPG_GENRE_USE_STRING;
  135 + genreSubType = 0;
  136 + }
  137 + }
  138 + else
  139 + {
  140 + genreType = 0;
  141 + genreSubType = 0;
  142 + }
  143 +}
35 xbmc/pvrclients/MediaPortal/CriticalSection.h → xbmc/pvrclients/MediaPortal/GenreTable.h
... ... @@ -1,6 +1,6 @@
1 1 #pragma once
2 2 /*
3   - * Copyright (C) 2005-2011 Team XBMC
  3 + * Copyright (C) 2005-2012 Team XBMC
4 4 * http://www.xbmc.org
5 5 *
6 6 * This program is free software: you can redistribute it and/or modify
@@ -17,18 +17,29 @@
17 17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 18 */
19 19
20   -#include "os-dependent.h"
  20 +#include <map>
  21 +#include <string>
21 22
22   -class CCriticalSection
23   -{
24   - public:
25   - CCriticalSection();
26   - virtual ~CCriticalSection();
  23 +typedef struct genre {
  24 + int type;
  25 + int subtype;
  26 +} genre_t;
  27 +
  28 +typedef std::map<std::string, genre_t> GenreMap;
27 29
28   - void Initialize(void);
29   - void Lock(void);
30   - void Unlock(void);
  30 +class CGenreTable
  31 +{
  32 +public:
  33 + CGenreTable(const std::string &filename) { LoadGenreXML(filename); };
  34 + bool LoadGenreXML(const std::string &filename);
31 35
32   - protected:
33   - criticalsection_t m_CriticalSection;
  36 + /**
  37 + * \brief Convert a genre string into a type/subtype combination using the data in the GenreMap
  38 + * \param strGenre (in)
  39 + * \param genreType (out)
  40 + * \param genreSubType (out)
  41 + */
  42 + void GenreToTypes(std::string& strGenre, int& genreType, int& genreSubType);
  43 +private:
  44 + GenreMap m_genremap;
34 45 };
12 xbmc/pvrclients/MediaPortal/Makefile.in
@@ -5,9 +5,9 @@
5 5 # how to reach the author.
6 6 #
7 7
8   -LIBS = @abs_top_srcdir@/lib/libTcpSocket/libTcpSocket.a lib/tinyxml/tinyxml.a -ldl
  8 +LIBS = lib/tinyxml/tinyxml.a -ldl
9 9 LIBDIR = @abs_top_srcdir@/addons/pvr.team-mediaportal.tvserver
10   -LIB = @abs_top_srcdir@/addons/pvr.team-mediaportal.tvserver/XBMC_MPTV.pvr
  10 +LIB = $(LIBDIR)/XBMC_MPTV.pvr
11 11
12 12 SRCS = channels.cpp \
13 13 client.cpp \
@@ -18,18 +18,16 @@ SRCS = channels.cpp \
18 18 Socket.cpp \
19 19 uri.cpp \
20 20 utils.cpp \
21   - CriticalSection.cpp \
22   - AutoLock.cpp \
23   - Cards.cpp
  21 + Cards.cpp \
  22 + GenreTable.cpp
24 23
25 24 include ../Makefile.include
26 25
27 26 clean:
28 27 -rm -f $(OBJS) $(LIB) *.P *~
29 28 $(MAKE) -C lib/tinyxml clean
30   - $(MAKE) -C @abs_top_srcdir@/lib/libTcpSocket clean
  29 +
31 30
32 31 $(LIB): $(OBJS)
33   - $(MAKE) -C @abs_top_srcdir@/lib/libTcpSocket
34 32 $(MAKE) -C lib/tinyxml
35 33 $(SILENT_CPP) $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -g $(OBJS) $(LIBS) $(LIBDIRS) $(SILIB) -o $(LIB)
4 xbmc/pvrclients/MediaPortal/README
@@ -6,8 +6,8 @@ Supported platforms (pvrclient):
6 6 - OSX (should work, not tested by me)
7 7
8 8 Dependencies:
9   -- MediaPortal TVServer 1.1.0 or higher
10   -- TVServerXBMC v1.1.0.90 or higher
  9 +- MediaPortal TVServer 1.1.x or 1.2.x. May work also on newer versions
  10 +- TVServerXBMC v1.1.0.100 or higher
11 11
12 12 THIS IS A PRELIMINARY README AND IS SUBJECT TO CHANGE!!!
13 13
21 xbmc/pvrclients/MediaPortal/Socket.cpp
@@ -16,17 +16,16 @@
16 16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 17 *
18 18 */
19   -extern "C" {
20   -#include "libTcpSocket/os-dependent_socket.h"
21   -}
22 19 #include "libXBMC_addon.h"
23 20 #include "utils.h"
  21 +#include <string>
  22 +#include "os-dependent.h"
24 23 #include "client.h"
25 24 #include "Socket.h"
26   -#include <string>
27 25
28 26 using namespace std;
29 27 using namespace ADDON;
  28 +using namespace MPTV;
30 29
31 30 namespace MPTV
32 31 {
@@ -83,12 +82,16 @@ bool Socket::setHostname ( const std::string host )
83 82 return true;
84 83 }
85 84
86   -
87 85 bool Socket::close()
88 86 {
89 87 if (is_valid())
90 88 {
91   - tcp_close(_sd);
  89 + if (_sd != SOCKET_ERROR)
  90 +#ifdef TARGET_WINDOWS
  91 + closesocket(_sd);
  92 +#else
  93 + ::close(_sd);
  94 +#endif
92 95 _sd = INVALID_SOCKET;
93 96 osCleanup();
94 97 return true;
@@ -493,7 +496,7 @@ bool Socket::is_valid() const
493 496 return (_sd != INVALID_SOCKET);
494 497 }
495 498
496   -#if defined(_WIN32) || defined(_WIN64)
  499 +#if defined(TARGET_WINDOWS)
497 500 bool Socket::set_non_blocking ( const bool b )
498 501 {
499 502 u_long iMode;
@@ -635,7 +638,7 @@ void Socket::osCleanup()
635 638 }
636 639 }
637 640
638   -#elif defined _LINUX
  641 +#elif defined TARGET_LINUX
639 642 bool Socket::set_non_blocking ( const bool b )
640 643 {
641 644 int opts;
@@ -747,6 +750,6 @@ void Socket::osCleanup()
747 750 {
748 751 // Not needed for Linux
749 752 }
750   -#endif //_WINDOWS || _LINUX
  753 +#endif //TARGET_WINDOWS || TARGET_LINUX
751 754
752 755 } //namespace MPTV
17 xbmc/pvrclients/MediaPortal/Socket.h
@@ -22,11 +22,11 @@ namespace MPTV //Prevent name clash with Live555 Socket
22 22 {
23 23
24 24 //Include platform specific datatypes, header files, defines and constants:
25   -#if defined __WINDOWS__ || defined WIN32 || defined _WINDOWS
26   - #ifdef _WINSOCKAPI_
27   - #undef _WINSOCKAPI_
28   - #endif
  25 +#if defined TARGET_WINDOWS
  26 + #define WIN32_LEAN_AND_MEAN // Enable LEAN_AND_MEAN support
  27 + #pragma warning(disable:4005) // Disable "warning C4005: '_WINSOCKAPI_' : macro redefinition"
29 28 #include <winsock2.h>
  29 + #pragma warning(default:4005)
30 30 #include <windows.h>
31 31
32 32 #ifndef NI_MAXHOST
@@ -42,7 +42,7 @@ namespace MPTV //Prevent name clash with Live555 Socket
42 42 #ifndef port_t
43 43 typedef unsigned short port_t;
44 44 #endif
45   -#elif defined _LINUX
  45 +#elif defined TARGET_LINUX || defined TARGET_DARWIN
46 46 #include <sys/types.h> /* for socket,connect */
47 47 #include <sys/socket.h> /* for socket,connect */
48 48 #include <sys/un.h> /* for Unix socket */
@@ -56,7 +56,8 @@ namespace MPTV //Prevent name clash with Live555 Socket
56 56 typedef int SOCKET;
57 57 typedef sockaddr SOCKADDR;
58 58 typedef sockaddr_in SOCKADDR_IN;
59   -
  59 + #define INVALID_SOCKET (-1)
  60 + #define SOCKET_ERROR (-1)
60 61 #else
61 62 #error Platform specific socket support is not yet available on this platform!
62 63 #endif
@@ -79,7 +80,7 @@ enum SocketFamily
79 80
80 81 enum SocketDomain
81 82 {
82   - #if defined _LINUX
  83 + #if defined TARGET_LINUX || defined TARGET_DARWIN
83 84 pf_unix = PF_UNIX,
84 85 pf_local = PF_LOCAL,
85 86 #endif
@@ -287,7 +288,7 @@ class Socket
287 288 enum SocketType _type; ///< Socket Type
288 289 enum SocketDomain _domain; ///< Socket domain
289 290
290   - #ifdef _WINDOWS
  291 + #ifdef TARGET_WINDOWS
291 292 WSADATA _wsaData; ///< Windows Socket data
292 293 static int win_usage_count; ///< Internal Windows usage counter used to prevent a global WSACleanup when more than one Socket object is used
293 294 #endif
11 xbmc/pvrclients/MediaPortal/client.cpp
@@ -248,7 +248,7 @@ void ADDON_ReadSettings(void)
248 248 if (!XBMC->GetSetting("readgenre", &g_bReadGenre))
249 249 {
250 250 /* If setting is unknown fallback to defaults */
251   - XBMC->Log(LOG_ERROR, "Couldn't get 'resolvertsphostname' setting, falling back to 'true' as default");
  251 + XBMC->Log(LOG_ERROR, "Couldn't get 'readgenre' setting, falling back to 'true' as default");
252 252 g_bReadGenre = DEFAULT_READ_GENRE;
253 253 }
254 254
@@ -416,7 +416,10 @@ PVR_ERROR GetStreamProperties(PVR_STREAM_PROPERTIES *pProperties)
416 416 //-----------------------------------------------------------------------------
417 417 const char * GetBackendName(void)
418 418 {
419   - return g_client->GetBackendName();
  419 + if (g_client)
  420 + return g_client->GetBackendName();
  421 + else
  422 + return "";
420 423 }
421 424
422 425 //-- GetBackendVersion --------------------------------------------------------
@@ -457,7 +460,7 @@ PVR_ERROR GetBackendTime(time_t *localTime, int *gmtOffset)
457 460 if (!g_client)
458 461 return PVR_ERROR_SERVER_ERROR;
459 462 else
460   - return g_client->GetMPTVTime(localTime, gmtOffset);
  463 + return g_client->GetBackendTime(localTime, gmtOffset);
461 464 }
462 465
463 466 PVR_ERROR DialogChannelScan()
@@ -677,7 +680,7 @@ PVR_ERROR SignalStatus(PVR_SIGNAL_STATUS &signalStatus)
677 680 if (!g_client)
678 681 return PVR_ERROR_SERVER_ERROR;
679 682 else
680   - return g_client->GetSignalStatus(signalStatus);
  683 + return g_client->SignalStatus(signalStatus);
681 684 }
682 685
683 686 /*******************************************/
6 xbmc/pvrclients/MediaPortal/client.h
@@ -23,7 +23,7 @@
23 23 #ifndef CLIENT_H
24 24 #define CLIENT_H
25 25
26   -#include "utils/StdString.h"
  26 +#include "platform/util/StdString.h"
27 27 #include "libXBMC_addon.h"
28 28 #include "libXBMC_pvr.h"
29 29
@@ -31,7 +31,7 @@
31 31 #define DEFAULT_PORT 9596
32 32 #define DEFAULT_FTA_ONLY false
33 33 #define DEFAULT_RADIO true
34   -#define DEFAULT_TIMEOUT 6
  34 +#define DEFAULT_TIMEOUT 10
35 35 #define DEFAULT_HANDLE_MSG false
36 36 #define DEFAULT_RESOLVE_RTSP_HOSTNAME true
37 37 #define DEFAULT_READ_GENRE false
@@ -64,7 +64,7 @@ extern std::string g_szTVGroup;
64 64 extern std::string g_szRadioGroup;
65 65
66 66 extern ADDON::CHelper_libXBMC_addon *XBMC;
67   -extern CHelper_libXBMC_pvr *PVR;
  67 +extern CHelper_libXBMC_pvr *PVR;
68 68
69 69 extern int g_iTVServerXBMCBuild;
70 70
42 xbmc/pvrclients/MediaPortal/epg.cpp
@@ -31,7 +31,7 @@ using namespace ADDON;
31 31
32 32 cEpg::cEpg()
33 33 {
34   - m_genremap = NULL;
  34 + m_genretable = NULL;
35 35 Reset();
36 36 }
37 37
@@ -108,7 +108,8 @@ bool cEpg::ParseLine(string& data)
108 108 m_title = epgfields[2];
109 109 m_description = epgfields[3];
110 110 m_shortText = epgfields[2];
111   - SetGenre(epgfields[4], 0, 0);
  111 + m_genre = epgfields[4];
  112 + if (m_genretable) m_genretable->GenreToTypes(m_genre, m_genre_type, m_genre_subtype);
112 113
113 114 if( epgfields.size() >= 15 )
114 115 {
@@ -142,40 +143,7 @@ bool cEpg::ParseLine(string& data)
142 143 return false;
143 144 }
144 145
145   -void cEpg::SetGenreMap(GenreMap* genremap)
  146 +void cEpg::SetGenreTable(CGenreTable* genretable)
146 147 {
147   - m_genremap = genremap;
148   -}
149   -
150   -void cEpg::SetGenre(string& Genre, int genreType, int genreSubType)
151   -{
152   - // The xmltv plugin from the MediaPortal TV Server can return genre
153   - // strings in local language (depending on the external TV guide source).
154   - // The only way to solve this at the XMBC side is to transfer the
155   - // genre string to XBMC or to let this plugin (or the TVServerXBMC
156   - // plugin) translate it into XBMC compatible (numbered) genre types
157   - m_genre = Genre;
158   - m_genre_subtype = 0;
159   -
160   - if(g_bReadGenre && m_genremap && m_genre.length() > 0)
161   - {
162   - std::map<std::string, genre_t>::iterator it;
163   -
164   - std::transform(m_genre.begin(), m_genre.end(), m_genre.begin(), ::tolower);
165   -
166   - it = m_genremap->find(m_genre);
167   - if (it != m_genremap->end())
168   - {
169   - m_genre_type = it->second.type;
170   - m_genre_subtype = it->second.subtype;
171   - }
172   - else
173   - {
174   - XBMC->Log(LOG_DEBUG, "EPG: No mapping of '%s' to genre type/subtype found.", Genre.c_str());
175   - m_genre_type = EPG_GENRE_USE_STRING;
176   - m_genre_subtype = 0;
177   - }
178   - } else {
179   - m_genre_type = 0;
180   - }
  148 + m_genretable = genretable;
181 149 }
14 xbmc/pvrclients/MediaPortal/epg.h
@@ -24,20 +24,13 @@
24 24 #define __EPG_H
25 25
26 26 #include <stdlib.h>
27   -#include <map>
28 27 #include <string>
29 28 #include "libXBMC_addon.h"
30 29 #include "libXBMC_pvr.h"
  30 +#include "GenreTable.h"
31 31
32 32 using namespace std;
33 33
34   -typedef struct genre {
35   - int type;
36   - int subtype;
37   -} genre_t;
38   -
39   -typedef std::map<std::string, genre_t> GenreMap;
40   -
41 34 class cEpg
42 35 {
43 36 private:
@@ -58,8 +51,7 @@ class cEpg
58 51 int m_seriesNumber;
59 52 int m_starRating;
60 53 int m_parentalRating;
61   - GenreMap* m_genremap;
62   - void SetGenre(string& Genre, int genreType, int genreSubType);
  54 + CGenreTable* m_genretable;
63 55
64 56 public:
65 57 cEpg();
@@ -84,7 +76,7 @@ class cEpg
84 76 const char* EpisodePart(void) const { return m_episodePart.c_str(); };
85 77 int StarRating(void) const { return m_starRating; };
86 78 int ParentalRating(void) const { return m_parentalRating; };
87   - void SetGenreMap(GenreMap* genremap);
  79 + void SetGenreTable(CGenreTable* genremap);
88 80 };
89 81
90 82 #endif //__EPG_H
5 xbmc/pvrclients/MediaPortal/os-dependent.h
@@ -19,11 +19,10 @@
19 19 */
20 20
21 21 #if defined(TARGET_WINDOWS)
22   -// I don't want pthread_win32 stuff to be included
23   -#define PTHREAD_H
  22 +#define NOMINMAX // don't define min() and max() to prevent a clash with std::min() and std::max
24 23 #endif
25 24
26   -#include "libPlatform/os-dependent.h"
  25 +#include "platform/os.h"
27 26
28 27 #if defined(TARGET_WINDOWS)
29 28 # include "windows/os_windows.h"
13 xbmc/pvrclients/MediaPortal/project/VS2010Express/XBMC_MPTV.vcxproj
@@ -51,8 +51,8 @@
51 51 <TargetExt Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.pvr</TargetExt>
52 52 <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">XBMC_MPTV_win32</TargetName>
53 53 <TargetExt Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.pvr</TargetExt>
54   - <IncludePath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)\..\..\xbmc\;$(SolutionDir)\..\..\lib\;$(IncludePath)</IncludePath>
55   - <IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)\..\..\xbmc\;$(SolutionDir)\..\..\lib\;$(IncludePath)</IncludePath>
  54 + <IncludePath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)\..\..\xbmc\;$(SolutionDir)\..\..\lib\;$(IncludePath);..\..\</IncludePath>
  55 + <IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)\..\..\xbmc\;$(SolutionDir)\..\..\lib\;$(IncludePath);..\..\</IncludePath>
56 56 </PropertyGroup>
57 57 <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
58 58 <ClCompile>
@@ -118,13 +118,12 @@
118 118 </Link>
119 119 </ItemDefinitionGroup>
120 120 <ItemGroup>
121   - <ClCompile Include="..\..\AutoLock.cpp" />
122 121 <ClCompile Include="..\..\Cards.cpp" />
123 122 <ClCompile Include="..\..\channels.cpp" />
124 123 <ClCompile Include="..\..\client.cpp" />
125 124 <ClCompile Include="..\..\..\..\..\addons\library.xbmc.addon\dlfcn-win32.cpp" />
126   - <ClCompile Include="..\..\CriticalSection.cpp" />
127 125 <ClCompile Include="..\..\epg.cpp" />
  126 + <ClCompile Include="..\..\GenreTable.cpp" />
128 127 <ClCompile Include="..\..\lib\tinyxml\tinystr.cpp" />
129 128 <ClCompile Include="..\..\lib\tinyxml\tinyxml.cpp" />
130 129 <ClCompile Include="..\..\lib\tinyxml\tinyxmlerror.cpp" />
@@ -135,15 +134,16 @@
135 134 <ClCompile Include="..\..\timers.cpp" />
136 135 <ClCompile Include="..\..\uri.cpp" />
137 136 <ClCompile Include="..\..\utils.cpp" />
  137 + <ClCompile Include="..\..\windows\FileUtils.cpp" />
  138 + <ClCompile Include="..\..\windows\WindowsUtils.cpp" />
138 139 </ItemGroup>
139 140 <ItemGroup>
140   - <ClInclude Include="..\..\AutoLock.h" />
141 141 <ClInclude Include="..\..\Cards.h" />
142 142 <ClInclude Include="..\..\channels.h" />
143 143 <ClInclude Include="..\..\client.h" />
144 144 <ClInclude Include="..\..\..\..\..\addons\library.xbmc.addon\dlfcn-win32.h" />
145   - <ClInclude Include="..\..\CriticalSection.h" />
146 145 <ClInclude Include="..\..\epg.h" />
  146 + <ClInclude Include="..\..\FileUtils.h" />
147 147 <ClInclude Include="..\..\lib\tinyxml\tinystr.h" />
148 148 <ClInclude Include="..\..\lib\tinyxml\tinyxml.h" />
149 149 <ClInclude Include="..\..\os-dependent.h" />
@@ -155,6 +155,7 @@
155 155 <ClInclude Include="..\..\uri.h" />
156 156 <ClInclude Include="..\..\utils.h" />
157 157 <ClInclude Include="..\..\windows\os_windows.h" />
  158 + <ClInclude Include="..\..\windows\WindowsUtils.h" />
158 159 </ItemGroup>
159 160 <ItemGroup>
160 161 <None Include="..\..\README" />
24 xbmc/pvrclients/MediaPortal/project/VS2010Express/XBMC_MPTV.vcxproj.filters
@@ -18,6 +18,9 @@
18 18 <Filter Include="Header Files\windows">
19 19 <UniqueIdentifier>{cdeb5df5-f5b2-482d-9cb4-9e13a05233bd}</UniqueIdentifier>
20 20 </Filter>
  21 + <Filter Include="Source Files\windows">
  22 + <UniqueIdentifier>{a514608f-59ee-4524-b1bc-2ca2ad6dde70}</UniqueIdentifier>
  23 + </Filter>
21 24 </ItemGroup>
22 25 <ItemGroup>
23 26 <ClCompile Include="..\..\channels.cpp">
@@ -65,10 +68,13 @@
65 68 <ClCompile Include="..\..\lib\tinyxml\tinyxmlparser.cpp">
66 69 <Filter>Source Files\tinyXML</Filter>
67 70 </ClCompile>
68   - <ClCompile Include="..\..\AutoLock.cpp">
69   - <Filter>Source Files</Filter>
  71 + <ClCompile Include="..\..\windows\FileUtils.cpp">
  72 + <Filter>Source Files\windows</Filter>
  73 + </ClCompile>
  74 + <ClCompile Include="..\..\windows\WindowsUtils.cpp">
  75 + <Filter>Source Files\windows</Filter>
70 76 </ClCompile>
71   - <ClCompile Include="..\..\CriticalSection.cpp">
  77 + <ClCompile Include="..\..\GenreTable.cpp">
72 78 <Filter>Source Files</Filter>
73 79 </ClCompile>
74 80 </ItemGroup>
@@ -112,12 +118,6 @@
112 118 <ClInclude Include="..\..\lib\tinyxml\tinyxml.h">
113 119 <Filter>Header Files\tinyXML</Filter>
114 120 </ClInclude>
115   - <ClInclude Include="..\..\AutoLock.h">
116   - <Filter>Header Files</Filter>
117   - </ClInclude>
118   - <ClInclude Include="..\..\CriticalSection.h">
119   - <Filter>Header Files</Filter>
120   - </ClInclude>
121 121 <ClInclude Include="..\..\os-dependent.h">
122 122 <Filter>Header Files</Filter>
123 123 </ClInclude>
@@ -127,6 +127,12 @@
127 127 <ClInclude Include="..\..\posix\os_posix.h">
128 128 <Filter>Header Files\windows</Filter>
129 129 </ClInclude>
  130 + <ClInclude Include="..\..\windows\WindowsUtils.h">
  131 + <Filter>Header Files\windows</Filter>
  132 + </ClInclude>
  133 + <ClInclude Include="..\..\FileUtils.h">
  134 + <Filter>Header Files</Filter>
  135 + </ClInclude>
130 136 </ItemGroup>
131 137 <ItemGroup>
132 138 <None Include="..\..\README" />
286 xbmc/pvrclients/MediaPortal/pvrclient-mediaportal.cpp
@@ -22,6 +22,7 @@
22 22 #include <stdlib.h>
23 23
24 24 #include "os-dependent.h"
  25 +#include "platform/util/timeutils.h"
25 26
26 27 #include "client.h"
27 28 #include "timers.h"
@@ -30,8 +31,10 @@
30 31 #include "epg.h"
31 32 #include "utils.h"
32 33 #include "pvrclient-mediaportal.h"
33   -#include "AutoLock.h"
34   -#include "lib/tinyxml/tinyxml.h"
  34 +
  35 +#ifdef TARGET_WINDOWS
  36 +#include "FileUtils.h"
  37 +#endif
35 38
36 39 using namespace std;
37 40 using namespace ADDON;
@@ -40,13 +43,13 @@ using namespace ADDON;
40 43 int g_iTVServerXBMCBuild = 0;
41 44
42 45 /* PVR client version (don't forget to update also the addon.xml and the Changelog.txt files) */
43   -#define PVRCLIENT_MEDIAPORTAL_VERSION_STRING "1.2.1.108"
  46 +#define PVRCLIENT_MEDIAPORTAL_VERSION_STRING "1.2.2.111"
44 47
45 48 /* TVServerXBMC plugin supported versions */
46 49 #define TVSERVERXBMC_MIN_VERSION_STRING "1.1.0.70"
47 50 #define TVSERVERXBMC_MIN_VERSION_BUILD 70
48   -#define TVSERVERXBMC_RECOMMENDED_VERSION_STRING "1.1.x.107"
49   -#define TVSERVERXBMC_RECOMMENDED_VERSION_BUILD 107
  51 +#define TVSERVERXBMC_RECOMMENDED_VERSION_STRING "1.1.x.109 or 1.2.2.111"
  52 +#define TVSERVERXBMC_RECOMMENDED_VERSION_BUILD 110
50 53
51 54 /************************************************************/
52 55 /** Class interface */
@@ -62,7 +65,8 @@ cPVRClientMediaPortal::cPVRClientMediaPortal()
62 65 m_BackendUTCoffset = 0;
63 66 m_BackendTime = 0;
64 67 m_bStop = true;
65   - m_mutex.Initialize();
  68 + m_genretable = NULL;
  69 + m_iLastRecordingUpdate = 0;
66 70 }
67 71
68 72 cPVRClientMediaPortal::~cPVRClientMediaPortal()
@@ -71,13 +75,14 @@ cPVRClientMediaPortal::~cPVRClientMediaPortal()
71 75 if (m_bConnected)
72 76 Disconnect();
73 77 SAFE_DELETE(m_tcpclient);
  78 + SAFE_DELETE(m_genretable);
74 79 }
75 80
76 81 string cPVRClientMediaPortal::SendCommand(string command)
77 82 {
78 83 int code;
79 84 vector<string> lines;
80   - CAutoLock critsec(&m_mutex);
  85 + PLATFORM::CLockObject critsec(m_mutex);
81 86
82 87 if ( !m_tcpclient->send(command) )
83 88 {
@@ -107,7 +112,7 @@ string cPVRClientMediaPortal::SendCommand(string command)
107 112
108 113 bool cPVRClientMediaPortal::SendCommand2(string command, int& code, vector<string>& lines)
109 114 {
110   - CAutoLock critsec(&m_mutex);
  115 + PLATFORM::CLockObject critsec(m_mutex);
111 116
112 117 if ( !m_tcpclient->send(command) )
113 118 {
@@ -195,7 +200,7 @@ bool cPVRClientMediaPortal::Connect()
195 200 // Check for the minimal requirement: 1.1.0.70
196 201 if( g_iTVServerXBMCBuild < TVSERVERXBMC_MIN_VERSION_BUILD ) //major < 1 || minor < 1 || revision < 0 || build < 70
197 202 {
198   - XBMC->Log(LOG_ERROR, "Your TVServerXBMC version v%s is too old. Please upgrade to v%s or higher!", fields[1].c_str(), TVSERVERXBMC_MIN_VERSION_STRING);
  203 + XBMC->Log(LOG_ERROR, "Your TVServerXBMC version '%s' is too old. Please upgrade to '%s' or higher!", fields[1].c_str(), TVSERVERXBMC_MIN_VERSION_STRING);
199 204 XBMC->QueueNotification(QUEUE_ERROR, XBMC->GetLocalizedString(30050), fields[1].c_str(), TVSERVERXBMC_MIN_VERSION_STRING);
200 205 return false;
201 206 }
@@ -206,13 +211,13 @@ bool cPVRClientMediaPortal::Connect()
206 211 // Advice to upgrade:
207 212 if( g_iTVServerXBMCBuild < TVSERVERXBMC_RECOMMENDED_VERSION_BUILD )
208 213 {
209   - XBMC->Log(LOG_INFO, "It is adviced to upgrade your TVServerXBMC version v%s to v%s or higher!", fields[1].c_str(), TVSERVERXBMC_RECOMMENDED_VERSION_STRING);
  214 + XBMC->Log(LOG_INFO, "It is adviced to upgrade your TVServerXBMC version '%s' to '%s' or higher!", fields[1].c_str(), TVSERVERXBMC_RECOMMENDED_VERSION_STRING);
210 215 }
211 216 }
212 217 }
213 218 else
214 219 {
215   - XBMC->Log(LOG_ERROR, "Your TVServerXBMC version is too old. Please upgrade to v%s or higher!", TVSERVERXBMC_MIN_VERSION_STRING);
  220 + XBMC->Log(LOG_ERROR, "Your TVServerXBMC version is too old. Please upgrade to '%s' or higher!", TVSERVERXBMC_MIN_VERSION_STRING);
216 221 XBMC->QueueNotification(QUEUE_ERROR, XBMC->GetLocalizedString(30051), TVSERVERXBMC_MIN_VERSION_STRING);
217 222 return false;
218 223 }
@@ -241,8 +246,7 @@ bool cPVRClientMediaPortal::Connect()
241