-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTvGuideFetch.hpp
More file actions
99 lines (73 loc) · 2.89 KB
/
TvGuideFetch.hpp
File metadata and controls
99 lines (73 loc) · 2.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
//============================================================================
// Name : TvGuideFetch
// Author : John Saunders
// Copyright : Copyright (c) 2009 John Saunders
// Description : Fetch Australian XMLTV guide data from oztivo
//============================================================================
#ifndef TVGUIDEFETCH_HPP
#define TVGUIDEFETCH_HPP
#include <vector>
#include "Config.hpp"
#include "HttpFetch.hpp"
#include "Channel.hpp"
class TvGuideFetch
{
public:
TvGuideFetch();
~TvGuideFetch();
// Main entry point.
int main(int argc, char **argv);
private:
// Method called to print the grabber version.
static void printVersion(CmdParser& parser);
// Method called to print the grabber description.
static void printDescription(CmdParser& parser);
// Method called to print the grabber capabilities.
static void printCapabilities(CmdParser& parser);
// Method called to print the preferred access method.
static void printPreferredMethod(CmdParser& parser);
// Method called for command line help/errors.
static void printUsage(CmdParser& parser);
// Print a default configuration as a starting point.
void printDefaultConfig();
// Read a line and strip trailing return characters.
std::string readLine();
// Formulate the default cache directory path.
std::string cacheDirectory();
// Construct and print the XMLTV guide data.
void printGuideData(std::ostream& out);
// Initialise the configuration.
void initConfiguration();
// Fetch the list of channels and valid days.
void fetchDatalist(XmlDoc& datalist);
// Find a channel with the specified id.
bool findChannel(XmlNav& nav, const std::string& id);
// Fill in the channel with settings from the config.
bool populateSettings(XmlNav nav, Channel& chan);
// Fill in the channel with data from the source channel.
bool populateSource(XmlNav nav, Channel& chan, bool fillin = false);
// Convert string to integer with strict error checking.
bool validPositiveInt(const std::string& str, int& num);
// Convert string to integer with range check.
bool validInt(const std::string& str, int& num, int min, int max);
// Get the date string YYYY-MM-DD at the offset from today.
std::string getDate(int offset);
// Display a warning message.
void warnUser(const std::string& msg);
// Display an error message and exit quickly.
void bailOut(const std::string& msg);
// Parsed command line switches and arguments.
unsigned char m_quietFlag;
const char *m_outputPath;
int m_daysToFetch;
int m_offsetFromToday;
const char *m_configFilePath;
unsigned char m_debugFlag;
int m_forcedTimeZone;
// Collaborations with other objects.
CmdParser& m_cmdParser;
Config& m_config;
HttpFetch& m_httpFetch;
std::vector<Channel> m_channels;
};
#endif