Debian Codegraph @

src/settings.h

raw
1 /*
2 * Copyright (C) 2020-2021 Team Kodi (https://kodi.tv)
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 * See LICENSE.md for more information.
6 */
7
8 #pragma once
9
10 #include "timers.h"
11
12 #include <kodi/AddonBase.h>
13
14 #define DEFAULT_HOST "127.0.0.1"
15 #define DEFAULT_PORT 9596
16 #define DEFAULT_FTA_ONLY false
17 #define DEFAULT_RADIO true
18 #define DEFAULT_TIMEOUT 10
19 #define DEFAULT_HANDLE_MSG false
20 #define DEFAULT_RESOLVE_RTSP_HOSTNAME false
21 #define DEFAULT_READ_GENRE false
22 #define DEFAULT_SLEEP_RTSP_URL 0
23 #define DEFAULT_USE_REC_DIR false
24 #define DEFAULT_TVGROUP ""
25 #define DEFAULT_RADIOGROUP ""
26 #define DEFAULT_DIRECT_TS_FR false
27 #define DEFAULT_SMBUSERNAME "Guest"
28 #define DEFAULT_SMBPASSWORD ""
29
30 enum eStreamingMethod
31 {
32 TSReader = 0,
33 ffmpeg = 1
34 };
35
36 class ATTR_DLL_LOCAL CSettings
37 {
38 public:
39 static CSettings& Get();
40
41 bool Load();
42 ADDON_STATUS SetSetting(const std::string& settingName, const kodi::addon::CSettingValue& settingValue);
43
44 const std::string& GetHostname() const { return m_szHostname; }
45 int GetPort() const { return m_iPort; }
46 int GetConnectTimeout() const { return m_iConnectTimeout; }
47 int GetSleepOnRTSPurl() const { return m_iSleepOnRTSPurl; }
48 bool GetOnlyFTA() const { return m_bOnlyFTA; }
49 bool GetRadioEnabled() const { return m_bRadioEnabled; }
50 bool GetHandleMessages() const { return m_bHandleMessages; }
51 bool GetResolveRTSPHostname() const { return m_bResolveRTSPHostname; }
52 bool GetReadGenre() const { return m_bReadGenre; }
53 bool GetEnableOldSeriesDlg() const { return m_bEnableOldSeriesDlg; }
54 const std::string& GetTVGroup() const { return m_szTVGroup; }
55 const std::string& GetRadioGroup() const { return m_szRadioGroup; }
56 const std::string& GetSMBusername() const { return m_szSMBusername; }
57 const std::string& GetSMBpassword() const { return m_szSMBpassword; }
58 eStreamingMethod GetStreamingMethod() const { return m_eStreamingMethod; }
59 TvDatabase::KeepMethodType GetKeepMethodType() const { return m_KeepMethodType; }
60 int GetDefaultRecordingLifeTime() const { return m_DefaultRecordingLifeTime; }
61 bool GetFastChannelSwitch() const { return m_bFastChannelSwitch; }
62 bool GetUseRTSP() const { return m_bUseRTSP; }
63
64 private:
65 CSettings() = default;
66
67 /// The Host name or IP of the MediaPortal TV Server
68 std::string m_szHostname = DEFAULT_HOST;
69 /// The TVServerKodi listening port (default: 9596)
70 int m_iPort = DEFAULT_PORT;
71 /// The Socket connection timeout
72 int m_iConnectTimeout = DEFAULT_TIMEOUT;
73 /// An optional delay between tuning a channel and opening the corresponding
74 /// RTSP stream in Kodi (default: 0)
75 int m_iSleepOnRTSPurl = DEFAULT_SLEEP_RTSP_URL;
76 /// Send only Free-To-Air Channels inside Channel list to Kodi
77 bool m_bOnlyFTA = DEFAULT_FTA_ONLY;
78 /// Send also Radio channels list to Kodi
79 bool m_bRadioEnabled = DEFAULT_RADIO;
80 /// Send VDR's OSD status messages to Kodi OSD
81 bool m_bHandleMessages = DEFAULT_HANDLE_MSG;
82 /// Resolve the server hostname in the rtsp URLs to an IP at the TV Server
83 /// side (default: false)
84 bool m_bResolveRTSPHostname = DEFAULT_RESOLVE_RTSP_HOSTNAME;
85 /// Read the genre strings from MediaPortal and translate them into Kodi DVB
86 /// genre id's (only English)
87 bool m_bReadGenre = DEFAULT_READ_GENRE;
88 /// Show the old pre-Jarvis series recording dialog
89 bool m_bEnableOldSeriesDlg = false;
90 /// Import only TV channels from this TV Server TV group
91 std::string m_szTVGroup = DEFAULT_TVGROUP;
92 /// Import only radio channels from this TV Server radio group
93 std::string m_szRadioGroup = DEFAULT_RADIOGROUP;
94 /// Windows user account used to access share
95 std::string m_szSMBusername = DEFAULT_SMBUSERNAME;
96 /// Windows user password used to access share Leave empty to use current user
97 /// when running on Windows
98 std::string m_szSMBpassword = DEFAULT_SMBPASSWORD;
99 ///
100 eStreamingMethod m_eStreamingMethod = TSReader;
101 ///
102 TvDatabase::KeepMethodType m_KeepMethodType = TvDatabase::Always;
103 /// The default days which are configured in kodi
104 int m_DefaultRecordingLifeTime = 100;
105 /// Don't stop an existing timeshift on a channel switch
106 bool m_bFastChannelSwitch = true;
107 /// Use RTSP streaming when using the tsreader
108 bool m_bUseRTSP = false;
109 };