File: tools.h

package info (click to toggle)
vdr-plugin-markad 4.2.15-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,084 kB
  • sloc: cpp: 22,441; python: 613; makefile: 270; sh: 95
file content (98 lines) | stat: -rw-r--r-- 2,035 bytes parent folder | download | duplicates (2)
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
/*
 * tools.h: A program for the Video Disk Recorder
 *
 * See the README file for copyright information and how to reach the author.
 *
 */

#ifndef __tools_h_
#define __tools_h_

#include <chrono>


// flags for CompareChannelName()
#define IGNORE_NOTHING 0   // exact match
#define IGNORE_HD      1   // ignore HD
#define IGNORE_COUNTRY 2   // ignore e.g. _Austria
#define IGNORE_CITY    4   // ignore e.g. _Berlin


/**
 * common tools class
 */
class cTools {
public:
    cTools();
    ~cTools();

    /**
    * log a separator line
    * @param main      true logs double line, single line otherwise
    */
    static void LogSeparator(const bool main = false);

    /**
    * log start of section and store timestamp
    * @param name section name
    */
    void StartSection(const char* name);

    /**
    * log end of section and calculate elapsed time
    * @param name section name
    * return elapsed time in ms
    */
    int EndSection(const char* name) const;

    /**
    * compare channel name pair
    * @param nameA      first name
    * @param nameB      second name
    * @param flags      compaire criteria
    */
    bool CompareChannelName(const char *nameA, const char *nameB, const int flags);

private:
    /**
    * list of states and counties in channel name to ignore
    */
    const char* countries[3] = {
        "_AUSTRIA",
        "_ÖSTERREICH",
        "_BAYERN"
    };


    /**
    * list of cities in channel name to ignore
    */
    const char* cities[21] = {
        "_BERLIN",
        "_BRANDENBURG",
        "_HH",
        "_NDS",
        "_BW",
        "_RP",
        "_KöLN",
        "_AACHEN",
        "_BIELEFELD",
        "_BONN",
        "_DORTMUND",
        "_DUISBURG",
        "_DüSSELDORF",
        "_ESSEN",
        "_MüNSTER",
        "_SACHSEN",
        "_S-ANHALT",
        "_SIEGEN",
        "_WUPPERTAG",
        "_SüD",
        "_NORD"
    };


    std::chrono::high_resolution_clock::time_point startSectionTime = {};  //!< start time of section
    //!<
};
#endif