Merge pull request #4676 from jmarshallnz/dont_set_scraper_on_tvshow_on_nfo
[vuplus_xbmc] / xbmc / utils / TuxBoxUtil.h
1 #pragma once
2
3 /*
4  *      Copyright (C) 2005-2013 Team XBMC
5  *      http://xbmc.org
6  *
7  *  This Program is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License as published by
9  *  the Free Software Foundation; either version 2, or (at your option)
10  *  any later version.
11  *
12  *  This Program is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  *  GNU General Public License for more details.
16  *
17  *  You should have received a copy of the GNU General Public License
18  *  along with XBMC; see the file COPYING.  If not, see
19  *  <http://www.gnu.org/licenses/>.
20  *
21  */
22
23 #include "StdString.h"
24 #include "threads/Thread.h"
25
26 class CURL;
27 class TiXmlElement;
28 class CFileItem;
29 class CFileItemList;
30
31 struct STREAMINFO
32 {
33   CStdString frontend;
34   CStdString service_name;
35   CStdString service_reference;
36   CStdString provider;
37   CStdString vpid;
38   CStdString apid;
39   CStdString pcrpid;
40   CStdString tpid;
41   CStdString tsid;
42   CStdString onid;
43   CStdString sid;
44   CStdString pmt;
45   CStdString video_format;
46   CStdString supported_crypt_systems;
47   CStdString used_crypt_systems;
48   CStdString satellite;
49   CStdString frequency;
50   CStdString symbol_rate;
51   CStdString polarisation;
52   CStdString inversion;
53   CStdString fec;
54   CStdString snr;
55   CStdString agc;
56   CStdString ber;
57   CStdString lock;
58   CStdString sync;
59 };
60 struct VIDEOSUBCHANNEL
61 {
62   std::vector<CStdString> reference;
63   std::vector<CStdString> name;
64   std::vector<CStdString> selected;
65   CStdString current_name;
66   bool mode;
67 };
68 typedef struct AUDIOCHANNEL
69 {
70   CStdString pid;
71   CStdString selected;
72   CStdString name;
73 } sAudioChannel;
74 struct CURRENTSERVICEDATA
75 {
76   CStdString service_name;
77   CStdString service_reference;
78   std::vector<AUDIOCHANNEL> audio_channels;
79   int requested_audio_channel;
80   CStdString audio_track;
81   CStdString current_event_date;
82   CStdString current_event_time;
83   CStdString current_event_start;
84   CStdString current_event_duration;
85   CStdString current_event_description;
86   CStdString current_event_details;
87   CStdString next_event_date;
88   CStdString next_event_time;
89   CStdString next_event_start;
90   CStdString next_event_duration;
91   CStdString next_event_description;
92   CStdString next_event_details;
93 };
94 struct BOXSTATUS
95 {
96   CStdString current_time;
97   CStdString standby;
98   CStdString recording;
99   CStdString mode;
100   CStdString ip;
101 };
102 struct BOXSINFO
103 {
104   CStdString image_version;
105   CStdString image_url;
106   CStdString image_comment;
107   CStdString image_catalog;
108   CStdString firmware;
109   CStdString fpfirmware;
110   CStdString webinterface;
111   CStdString model;
112   CStdString manufacturer;
113   CStdString processor;
114   CStdString usbstick;
115   CStdString disk;
116 };
117 struct SERVICE_EPG
118 {
119   CStdString service_reference;
120   CStdString service_name;
121   CStdString image_comment;
122   CStdString event;
123   CStdString date;
124   CStdString time;
125   CStdString duration;
126   CStdString descritption;
127   CStdString genre;
128   CStdString genrecategory;
129   CStdString start;
130   CStdString details;
131 };
132 struct ZAPSTREAM
133 {
134   bool initialized;
135   bool available;
136 };
137 class CTuxBoxUtil
138 {
139   public:
140     STREAMINFO sStrmInfo;
141     CURRENTSERVICEDATA sCurSrvData;
142     BOXSTATUS sBoxStatus;
143     BOXSINFO sBoxInfo;
144     SERVICE_EPG sServiceEPG;
145     VIDEOSUBCHANNEL vVideoSubChannel;
146     ZAPSTREAM sZapstream;
147
148     CTuxBoxUtil(void);
149     virtual ~CTuxBoxUtil(void);
150
151     bool GetZapUrl(const CStdString& strPath, CFileItem &items);
152     bool ParseBouquets(TiXmlElement *root, CFileItemList &items, CURL &url, CStdString strFilter, CStdString strChild);
153     bool ParseBouquetsEnigma2(TiXmlElement *root, CFileItemList &items, CURL &url, CStdString& strFilter, CStdString& strChild);
154     bool ParseChannels(TiXmlElement *root, CFileItemList &items, CURL &url, CStdString strFilter, CStdString strChild);
155     bool ParseChannelsEnigma2(TiXmlElement *root, CFileItemList &items, CURL &url, CStdString& strFilter, CStdString& strChild);
156     bool ZapToUrl(CURL url, const CStdString &pathOption);
157     bool StreamInformations(TiXmlElement *pRootElement);
158     bool CurrentServiceData(TiXmlElement *pRootElement);
159     bool BoxStatus(TiXmlElement *pRootElement);
160     bool BoxInfo(TiXmlElement *pRootElement);
161     bool ServiceEPG(TiXmlElement *pRootElement);
162     bool GetHttpXML(CURL url,CStdString strRequestType);
163     bool GetGUIRequestedAudioChannel(AUDIOCHANNEL& sRequestedAC);
164     bool GetRequestedAudioChannel(AUDIOCHANNEL& sRequestedAC);
165     bool GetVideoSubChannels(CStdString& strVideoSubChannelName, CStdString& strVideoSubChannelPid);
166     bool GetVideoChannels(TiXmlElement *pRootElement);
167     bool CreateNewItem(const CFileItem& item, CFileItem& item_new);
168     bool InitZapstream(const CStdString& strPath);
169     bool SetAudioChannel(const CStdString& strPath, const AUDIOCHANNEL& sAC);
170
171     CStdString GetPicon(CStdString strServiceName);
172     CStdString GetSubMode(int iMode, CStdString& strXMLRootString, CStdString& strXMLChildString);
173     CStdString DetectSubMode(CStdString strSubMode, CStdString& strXMLRootString, CStdString& strXMLChildString);
174 };
175 extern CTuxBoxUtil g_tuxbox;
176
177 class CTuxBoxService : public CThread
178 {
179 public:
180   CTuxBoxService();
181   ~CTuxBoxService();
182
183   bool Start();
184   void Stop();
185   bool IsRunning();
186
187   virtual void OnExit();
188   virtual void OnStartup();
189   virtual void Process();
190 };
191 extern CTuxBoxService g_tuxboxService;