MythTV  master
mainserver.h
Go to the documentation of this file.
1 #ifndef MAINSERVER_H_
2 #define MAINSERVER_H_
3 
4 #include <utility>
5 #include <vector>
6 
7 // Qt headers
8 #include <QReadWriteLock>
9 #include <QStringList>
10 #include <QRunnable>
11 #include <QEvent>
12 #include <QMutex>
13 #include <QHash>
14 #include <QMap>
15 
16 // MythTV headers
17 #include "libmythbase/exitcodes.h"
19 #include "libmythbase/mythdeque.h"
21 #include "libmythbase/mythsocket.h"
22 #include "libmythtv/livetvchain.h"
23 #include "libmythtv/tv.h"
24 
25 // mythbackend headers
26 #include "autoexpire.h"
27 #include "encoderlink.h"
28 #include "filetransfer.h"
29 #include "playbacksock.h"
30 #include "scheduler.h"
31 
32 #ifdef DeleteFile
33 #undef DeleteFile
34 #endif
35 
36 class QUrl;
37 class MythServer;
38 class QTimer;
39 class FileSystemInfo;
40 class MetadataFactory;
41 class FreeSpaceUpdater;
42 
44 {
45  friend class MainServer;
46  public:
47  DeleteStruct(MainServer *ms, QString filename, QString title,
48  uint chanid, QDateTime recstartts, QDateTime recendts,
49  uint recordedId,
50  bool forceMetadataDelete) :
51  m_ms(ms), m_filename(std::move(filename)), m_title(std::move(title)),
52  m_chanid(chanid), m_recstartts(std::move(recstartts)),
53  m_recendts(std::move(recendts)), m_recordedid(recordedId),
54  m_forceMetadataDelete(forceMetadataDelete)
55  {
56  }
57 
58  DeleteStruct(MainServer *ms, QString filename, int fd, off_t size) :
59  m_ms(ms), m_filename(std::move(filename)), m_fd(fd), m_size(size)
60  {
61  }
62 
63  protected:
64  MainServer *m_ms {nullptr};
65  QString m_filename;
66  QString m_title;
68  QDateTime m_recstartts;
69  QDateTime m_recendts;
71  bool m_forceMetadataDelete {false};
72  int m_fd {-1};
74 };
75 
76 class DeleteThread : public QRunnable, public DeleteStruct
77 {
78  public:
79  DeleteThread(MainServer *ms, const QString& filename, const QString& title, uint chanid,
80  QDateTime recstartts, QDateTime recendts, uint recordingId,
81  bool forceMetadataDelete) :
82  DeleteStruct(ms, filename, title, chanid, std::move(recstartts),
83  std::move(recendts), recordingId, forceMetadataDelete) {}
84  void start(void)
85  { MThreadPool::globalInstance()->startReserved(this, "DeleteThread"); }
86  void run(void) override; // QRunnable
87 };
88 
89 class TruncateThread : public QRunnable, public DeleteStruct
90 {
91  public:
92  TruncateThread(MainServer *ms, const QString& filename, int fd, off_t size) :
93  DeleteStruct(ms, filename, fd, size) {}
94  void start(void)
95  { MThreadPool::globalInstance()->start(this, "Truncate"); }
96  void run(void) override; // QRunnable
97 };
98 
99 class RenameThread : public QRunnable
100 {
101 public:
103  QString src, QString dst)
104  : m_ms(ms), m_pbs(pbs), m_src(std::move(src)), m_dst(std::move(dst)) {}
105  void run(void) override; // QRunnable
106 
107 private:
108  static QMutex s_renamelock;
109 
112  QString m_src, m_dst;
113 };
114 
115 class MainServer : public QObject, public MythSocketCBs
116 {
117  Q_OBJECT
118 
119  friend class DeleteThread;
120  friend class TruncateThread;
121  friend class FreeSpaceUpdater;
122  friend class RenameThread;
123  public:
124  MainServer(bool master, int port,
125  QMap<int, EncoderLink *> *tvList,
127 
128  ~MainServer() override;
129 
130  void Stop(void);
131 
132  void customEvent(QEvent *e) override; // QObject
133 
134  bool isClientConnected(bool onlyBlockingClients = false);
135  void ShutSlaveBackendsDown(const QString &haltcmd);
136 
137  void ProcessRequest(MythSocket *sock);
138 
139  void readyRead(MythSocket *socket) override; // MythSocketCBs
140  void connectionClosed(MythSocket *socket) override; // MythSocketCBs
141  void connectionFailed(MythSocket *socket) override // MythSocketCBs
142  { (void)socket; }
143  void connected(MythSocket *socket) override // MythSocketCBs
144  { (void)socket; }
145 
146  void DeletePBS(PlaybackSock *sock);
147 
148  size_t GetCurrentMaxBitrate(void);
149  void BackendQueryDiskSpace(QStringList &strlist, bool consolidated,
150  bool allHosts);
151  void GetFilesystemInfos(QList<FileSystemInfo> &fsInfos,
152  bool useCache=true);
153 
154  int GetExitCode() const { return m_exitCode; }
155 
156  void UpdateSystemdStatus(void);
157  void GetActiveBackends(QStringList &hosts);
159 
160  protected slots:
161  void reconnectTimeout(void);
162  void deferredDeleteSlot(void);
163  static void autoexpireUpdate(void);
164 
165  private slots:
166  void NewConnection(qintptr socketDescriptor);
167 
168  private:
169 
170  void ProcessRequestWork(MythSocket *sock);
171  void HandleAnnounce(QStringList &slist, QStringList commands,
172  MythSocket *socket);
173  void HandleDone(MythSocket *socket);
175  void HandleIsActiveBackendQuery(const QStringList &slist, PlaybackSock *pbs);
176  void HandleMoveFile(PlaybackSock *pbs, const QString &storagegroup,
177  const QString &src, const QString &dst);
178  bool HandleDeleteFile(const QStringList &slist, PlaybackSock *pbs);
179  bool HandleDeleteFile(const QString& filename, const QString& storagegroup,
180  PlaybackSock *pbs = nullptr);
181  void HandleQueryRecordings(const QString& type, PlaybackSock *pbs);
182  void HandleQueryRecording(QStringList &slist, PlaybackSock *pbs);
183  void HandleStopRecording(QStringList &slist, PlaybackSock *pbs);
185  void HandleDeleteRecording(QString &chanid, QString &starttime,
186  PlaybackSock *pbs, bool forceMetadataDelete,
187  bool forgetHistory);
188  void HandleDeleteRecording(QStringList &slist, PlaybackSock *pbs,
189  bool forceMetadataDelete);
191  bool forceMetadataDelete, bool lexpirer=false,
192  bool forgetHistory=false);
193  void HandleUndeleteRecording(QStringList &slist, PlaybackSock *pbs);
195  void HandleForgetRecording(QStringList &slist, PlaybackSock *pbs);
196  void HandleRescheduleRecordings(const QStringList &request,
197  PlaybackSock *pbs);
198  bool HandleAddChildInput(uint inputid);
200  void HandleQueryFreeSpace(PlaybackSock *pbs, bool allHosts);
202  void HandleQueryCheckFile(QStringList &slist, PlaybackSock *pbs);
203  void HandleQueryFileExists(QStringList &slist, PlaybackSock *pbs);
204  void HandleQueryFindFile(QStringList &slist, PlaybackSock *pbs);
205  void HandleQueryFileHash(QStringList &slist, PlaybackSock *pbs);
207  void HandleGetPendingRecordings(PlaybackSock *pbs, const QString& table = "", int recordid=-1);
209  void HandleGetConflictingRecordings(QStringList &slist, PlaybackSock *pbs);
211  void HandleSGGetFileList(QStringList &sList, PlaybackSock *pbs);
212  void HandleSGFileQuery(QStringList &sList, PlaybackSock *pbs);
213  void HandleGetFreeInputInfo(PlaybackSock *pbs, uint excluded_input);
214  void HandleGetNextFreeRecorder(QStringList &slist, PlaybackSock *pbs);
219  void HandleRecorderQuery(QStringList &slist, QStringList &commands,
220  PlaybackSock *pbs);
221  void HandleSetNextLiveTVDir(QStringList &commands, PlaybackSock *pbs);
222  void HandleFileTransferQuery(QStringList &slist, QStringList &commands,
223  PlaybackSock *pbs);
224  void HandleGetRecorderNum(QStringList &slist, PlaybackSock *pbs);
225  void HandleGetRecorderFromNum(QStringList &slist, PlaybackSock *pbs);
226  void HandleMessage(QStringList &slist, PlaybackSock *pbs);
227  void HandleSetVerbose(const QStringList &slist, PlaybackSock *pbs);
228  void HandleSetLogLevel(const QStringList &slist, PlaybackSock *pbs);
229  void HandleGenPreviewPixmap(QStringList &slist, PlaybackSock *pbs);
230  void HandlePixmapLastModified(QStringList &slist, PlaybackSock *pbs);
231  void HandlePixmapGetIfModified(const QStringList &slist, PlaybackSock *pbs);
232  void HandleIsRecording(const QStringList &slist, PlaybackSock *pbs);
233  void HandleCheckRecordingActive(QStringList &slist, PlaybackSock *pbs);
234  void HandleFillProgramInfo(QStringList &slist, PlaybackSock *pbs);
235  void HandleSetChannelInfo(QStringList &slist, PlaybackSock *pbs);
236  void HandleRemoteEncoder(QStringList &slist, QStringList &commands,
237  PlaybackSock *pbs);
238  void HandleLockTuner(PlaybackSock *pbs, int cardid = -1);
239  void HandleFreeTuner(int cardid, PlaybackSock *pbs);
240  void HandleCutMapQuery(const QString &chanid, const QString &starttime,
241  PlaybackSock *pbs, bool commbreak);
242  void HandleCommBreakQuery(const QString &chanid, const QString &starttime,
243  PlaybackSock *pbs);
244  void HandleCutlistQuery(const QString &chanid, const QString &starttime,
245  PlaybackSock *pbs);
246  void HandleBookmarkQuery(const QString &chanid, const QString &starttime,
247  PlaybackSock *pbs);
248  void HandleSetBookmark(QStringList &tokens, PlaybackSock *pbs);
249  void HandleSettingQuery(const QStringList &tokens, PlaybackSock *pbs);
250  void HandleSetSetting(const QStringList &tokens, PlaybackSock *pbs);
252  void HandleScanMusic(const QStringList &slist, PlaybackSock *pbs);
253  void HandleMusicTagUpdateVolatile(const QStringList &slist, PlaybackSock *pbs);
254  void HandleMusicTagUpdateMetadata(const QStringList &slist, PlaybackSock *pbs);
255  void HandleMusicFindAlbumArt(const QStringList &slist, PlaybackSock *pbs);
256  void HandleMusicTagGetImage(const QStringList &slist, PlaybackSock *pbs);
257  void HandleMusicTagAddImage(const QStringList &slist, PlaybackSock *pbs);
258  void HandleMusicTagRemoveImage(const QStringList &slist, PlaybackSock *pbs);
259  void HandleMusicTagChangeImage(const QStringList &slist, PlaybackSock *pbs);
260  void HandleMusicCalcTrackLen(const QStringList &slist, PlaybackSock *pbs);
261  void HandleMusicFindLyrics(const QStringList &slist, PlaybackSock *pbs);
262  void HandleMusicGetLyricGrabbers(const QStringList &slist, PlaybackSock *pbs);
263  void HandleMusicSaveLyrics(const QStringList &slist, PlaybackSock *pbs);
264  void HandleVersion(MythSocket *socket, const QStringList &slist);
265  void HandleBackendRefresh(MythSocket *socket);
271  void HandleBlockShutdown(bool blockShutdown, PlaybackSock *pbs);
272  void HandleDownloadFile(const QStringList &command, PlaybackSock *pbs);
273  void HandleSlaveDisconnectedEvent(const MythEvent &event);
274 
275  void SendResponse(MythSocket *sock, QStringList &commands);
276  void SendErrorResponse(MythSocket *sock, const QString &error);
277  void SendErrorResponse(PlaybackSock *pbs, const QString &error);
278  static void SendSlaveDisconnectedEvent(const QList<uint> &offlineEncoderIDs,
279  bool needsReschedule);
280 
281  static void getGuideDataThrough(QDateTime &GuideDataThrough);
282 
283  PlaybackSock *GetSlaveByHostname(const QString &hostname);
287 
288  static QString LocalFilePath(const QString &path, const QString &wantgroup);
289 
290  int GetfsID(const QList<FileSystemInfo>::iterator& fsInfo);
291 
292  void DoTruncateThread(DeleteStruct *ds);
293  void DoDeleteThread(DeleteStruct *ds);
294  static void DeleteRecordedFiles(DeleteStruct *ds);
295  static void DoDeleteInDB(DeleteStruct *ds);
296 
297  LiveTVChain *GetExistingChain(const QString &id);
300  void AddToChains(LiveTVChain *chain);
301  void DeleteChain(LiveTVChain *chain);
302 
303  void SetExitCode(int exitCode, bool closeApplication);
304 
305  static int DeleteFile(const QString &filename, bool followLinks,
306  bool deleteBrokenSymlinks = false);
307  static int OpenAndUnlink(const QString &filename);
308  static bool TruncateAndClose(ProgramInfo *pginfo,
309  int fd, const QString &filename,
310  off_t fsize);
311 
312  std::vector<LiveTVChain*> m_liveTVChains;
314 
315  QMap<int, EncoderLink *> *m_encoderList {nullptr};
316 
319 
320  QReadWriteLock m_sockListLock;
321  std::vector<PlaybackSock *> m_playbackList;
322  std::vector<FileTransfer *> m_fileTransferList;
323  QSet<MythSocket*> m_controlSocketList;
324  std::vector<MythSocket*> m_decrRefSocketList;
325 
330 
331  QTimer *m_masterServerReconnect {nullptr}; // audited ref #5318
333 
335 
336  QMutex m_deletelock;
338 
340 
341  Scheduler *m_sched {nullptr};
342  AutoExpire *m_expirer {nullptr};
344 
346  {
348  QDateTime ts;
349  };
350 
352  QTimer *m_deferredDeleteTimer {nullptr}; // audited ref #5318
354 
355  QTimer *m_autoexpireUpdateTimer {nullptr}; // audited ref #5318
357 
358  QMap<QString, int> m_fsIDcache;
360  QList<FileSystemInfo> m_fsInfosCache;
362 
364  QMap<QString, QString> m_downloadURLs;
365 
367 
368  using RequestedBy = QHash<QString,QString>;
370 
371  bool m_stopped {false};
372 
373  static const std::chrono::milliseconds kMasterServerReconnectTimeout;
374 };
375 
376 #endif
377 
378 /* vim: set expandtab tabstop=4 shiftwidth=4: */
MainServer::m_controlSocketList
QSet< MythSocket * > m_controlSocketList
Definition: mainserver.h:323
MainServer::SendErrorResponse
void SendErrorResponse(MythSocket *sock, const QString &error)
Definition: mainserver.cpp:2127
Scheduler
Definition: scheduler.h:45
RenameThread::s_renamelock
static QMutex s_renamelock
Definition: mainserver.h:108
MainServer::AddToChains
void AddToChains(LiveTVChain *chain)
Definition: mainserver.cpp:8057
MainServer::kMasterServerReconnectTimeout
static const std::chrono::milliseconds kMasterServerReconnectTimeout
Definition: mainserver.h:373
TruncateThread::start
void start(void)
Definition: mainserver.h:94
MainServer::HandleMusicTagChangeImage
void HandleMusicTagChangeImage(const QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:6381
MainServer::m_mythserver
MythServer * m_mythserver
Definition: mainserver.h:317
tv.h
DeleteStruct::m_filename
QString m_filename
Definition: mainserver.h:65
MainServer::DeleteRecordedFiles
static void DeleteRecordedFiles(DeleteStruct *ds)
Definition: mainserver.cpp:2533
MainServer::m_fileTransferList
std::vector< FileTransfer * > m_fileTransferList
Definition: mainserver.h:322
MainServer::LocalFilePath
static QString LocalFilePath(const QString &path, const QString &wantgroup)
Definition: mainserver.cpp:8091
TruncateThread
Definition: mainserver.h:89
MainServer::connected
void connected(MythSocket *socket) override
Definition: mainserver.h:143
RenameThread::run
void run(void) override
Definition: mainserver.cpp:5512
MainServer::m_fsIDcacheLock
QMutex m_fsIDcacheLock
Definition: mainserver.h:359
MainServer::HandleQueryTimeZone
void HandleQueryTimeZone(PlaybackSock *pbs)
Definition: mainserver.cpp:3598
DeleteStruct::DeleteStruct
DeleteStruct(MainServer *ms, QString filename, int fd, off_t size)
Definition: mainserver.h:58
MainServer::ProcessRequestWork
void ProcessRequestWork(MythSocket *sock)
Definition: mainserver.cpp:464
MainServer::HandleMusicTagRemoveImage
void HandleMusicTagRemoveImage(const QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:6703
MainServer::GetFilesystemInfos
void GetFilesystemInfos(QList< FileSystemInfo > &fsInfos, bool useCache=true)
Definition: mainserver.cpp:5376
MainServer::m_encoderList
QMap< int, EncoderLink * > * m_encoderList
Definition: mainserver.h:315
MainServer::HandleGetNextFreeRecorder
void HandleGetNextFreeRecorder(QStringList &slist, PlaybackSock *pbs)
DeleteStruct::m_title
QString m_title
Definition: mainserver.h:66
MainServer::HandleMusicCalcTrackLen
void HandleMusicCalcTrackLen(const QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:6031
MainServer::HandleBackendRefresh
void HandleBackendRefresh(MythSocket *socket)
Definition: mainserver.cpp:7742
MainServer::GetExistingChain
LiveTVChain * GetExistingChain(const QString &id)
Definition: mainserver.cpp:8027
MainServer::HandleQueryMemStats
void HandleQueryMemStats(PlaybackSock *pbs)
Definition: mainserver.cpp:3570
MainServer::m_previewRequestedBy
RequestedBy m_previewRequestedBy
Definition: mainserver.h:369
MainServer::m_addChildInputLock
QMutex m_addChildInputLock
Definition: mainserver.h:343
MainServer::HandleSGFileQuery
void HandleSGFileQuery(QStringList &sList, PlaybackSock *pbs)
Definition: mainserver.cpp:4203
MainServer::m_deferredDeleteLock
QMutex m_deferredDeleteLock
Definition: mainserver.h:351
MainServer::m_autoexpireUpdateTimer
QTimer * m_autoexpireUpdateTimer
Definition: mainserver.h:355
RecordingInfo
Holds information on a TV Program one might wish to record.
Definition: recordinginfo.h:35
MainServer::HandleSetBookmark
void HandleSetBookmark(QStringList &tokens, PlaybackSock *pbs)
Definition: mainserver.cpp:5731
MainServer::DeferredDeleteStruct
Definition: mainserver.h:345
MainServer::m_masterServer
PlaybackSock * m_masterServer
Definition: mainserver.h:332
MainServer::BackendQueryDiskSpace
void BackendQueryDiskSpace(QStringList &strlist, bool consolidated, bool allHosts)
Definition: mainserver.cpp:5157
MainServer::HandleGetExpiringRecordings
void HandleGetExpiringRecordings(PlaybackSock *pbs)
Definition: mainserver.cpp:3904
MainServer::m_liveTVChainsLock
QMutex m_liveTVChainsLock
Definition: mainserver.h:313
MythEvent
This class is used as a container for messages.
Definition: mythevent.h:16
sched
Scheduler * sched
MainServer::HandleMessage
void HandleMessage(QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:7257
MainServer::DeleteFile
static int DeleteFile(const QString &filename, bool followLinks, bool deleteBrokenSymlinks=false)
Deletes links and unlinks the main file and returns the descriptor.
Definition: mainserver.cpp:2671
DeleteThread::DeleteThread
DeleteThread(MainServer *ms, const QString &filename, const QString &title, uint chanid, QDateTime recstartts, QDateTime recendts, uint recordingId, bool forceMetadataDelete)
Definition: mainserver.h:79
MainServer::NewConnection
void NewConnection(qintptr socketDescriptor)
Definition: mainserver.cpp:436
MainServer::HandleCommBreakQuery
void HandleCommBreakQuery(const QString &chanid, const QString &starttime, PlaybackSock *pbs)
Definition: mainserver.cpp:5674
MainServer::GetPlaybackBySock
PlaybackSock * GetPlaybackBySock(MythSocket *socket)
Warning you must hold a sockListLock lock before calling this.
Definition: mainserver.cpp:8001
DeleteThread
Definition: deletethread.h:19
MainServer
Definition: mainserver.h:115
AutoExpire
Used to expire recordings to make space for new recordings.
Definition: autoexpire.h:60
playbacksock.h
MainServer::HandleIsRecording
void HandleIsRecording(const QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:7345
MainServer::m_masterFreeSpaceListLock
QMutex m_masterFreeSpaceListLock
Definition: mainserver.h:326
MainServer::OpenAndUnlink
static int OpenAndUnlink(const QString &filename)
Opens a file, unlinks it and returns the file descriptor.
Definition: mainserver.cpp:2728
MainServer::HandleSetVerbose
void HandleSetVerbose(const QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:7285
MainServer::customEvent
void customEvent(QEvent *e) override
Definition: mainserver.cpp:1115
MainServer::HandleGetRecorderNum
void HandleGetRecorderNum(QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:7172
MainServer::HandleQueryFileHash
void HandleQueryFileHash(QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:3664
RenameThread::m_src
QString m_src
Definition: mainserver.h:112
DeleteStruct::DeleteStruct
DeleteStruct(MainServer *ms, QString filename, QString title, uint chanid, QDateTime recstartts, QDateTime recendts, uint recordedId, bool forceMetadataDelete)
Definition: mainserver.h:47
MainServer::autoexpireUpdate
static void autoexpireUpdate(void)
Definition: mainserver.cpp:431
DeleteStruct::m_chanid
uint m_chanid
Definition: mainserver.h:67
MainServer::HandleMusicFindAlbumArt
void HandleMusicFindAlbumArt(const QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:6175
MainServer::m_exitCode
int m_exitCode
Definition: mainserver.h:366
TruncateThread::run
void run(void) override
Definition: mainserver.cpp:5534
GENERIC_EXIT_OK
@ GENERIC_EXIT_OK
Exited with no error.
Definition: exitcodes.h:11
MainServer::RequestedBy
QHash< QString, QString > RequestedBy
Definition: mainserver.h:368
MainServer::TruncateAndClose
static bool TruncateAndClose(ProgramInfo *pginfo, int fd, const QString &filename, off_t fsize)
Repeatedly truncate an open file in small increments.
Definition: mainserver.cpp:2758
MainServer::HandleQueryFreeSpace
void HandleQueryFreeSpace(PlaybackSock *pbs, bool allHosts)
Definition: mainserver.cpp:3427
MThreadPool::startReserved
void startReserved(QRunnable *runnable, const QString &debugName, std::chrono::milliseconds waitForAvailMS=0ms)
Definition: mthreadpool.cpp:371
DeleteStruct::m_fd
int m_fd
Definition: mainserver.h:72
mythdeque.h
scheduler.h
MainServer::m_masterFreeSpaceList
QStringList m_masterFreeSpaceList
Definition: mainserver.h:329
MainServer::readyRead
void readyRead(MythSocket *socket) override
Definition: mainserver.cpp:446
FileTransfer
Definition: libs/libmythprotoserver/sockethandler/filetransfer.h:18
MainServer::connectionClosed
void connectionClosed(MythSocket *socket) override
Definition: mainserver.cpp:7787
MainServer::m_playbackList
std::vector< PlaybackSock * > m_playbackList
Definition: mainserver.h:321
MainServer::m_fsIDcache
QMap< QString, int > m_fsIDcache
Definition: mainserver.h:358
MainServer::GetMediaServerByHostname
PlaybackSock * GetMediaServerByHostname(const QString &hostname)
Definition: mainserver.cpp:7980
MainServer::HandleMusicTagUpdateMetadata
void HandleMusicTagUpdateMetadata(const QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:6088
MythSocket
Class for communcating between myth backends and frontends.
Definition: mythsocket.h:25
MainServer::UpdateSystemdStatus
void UpdateSystemdStatus(void)
Definition: mainserver.cpp:8344
MainServer::HandleGetPendingRecordings
void HandleGetPendingRecordings(PlaybackSock *pbs, const QString &table="", int recordid=-1)
Definition: mainserver.cpp:3820
MainServer::DeleteChain
void DeleteChain(LiveTVChain *chain)
Definition: mainserver.cpp:8065
MainServer::SendSlaveDisconnectedEvent
static void SendSlaveDisconnectedEvent(const QList< uint > &offlineEncoderIDs, bool needsReschedule)
Definition: mainserver.cpp:8329
MainServer::HandleSetNextLiveTVDir
void HandleSetNextLiveTVDir(QStringList &commands, PlaybackSock *pbs)
Definition: mainserver.cpp:4894
MainServer::HandleSetLogLevel
void HandleSetLogLevel(const QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:7312
MainServer::HandleAnnounce
void HandleAnnounce(QStringList &slist, QStringList commands, MythSocket *socket)
Definition: mainserver.cpp:1752
MainServer::GetChainWithRecording
LiveTVChain * GetChainWithRecording(const ProgramInfo &pginfo)
Definition: mainserver.cpp:8047
autoexpire.h
MainServer::HandleGetFreeInputInfo
void HandleGetFreeInputInfo(PlaybackSock *pbs, uint excluded_input)
Definition: mainserver.cpp:4397
MainServer::HandleQueryRecording
void HandleQueryRecording(QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:2302
MainServer::DoHandleUndeleteRecording
void DoHandleUndeleteRecording(RecordingInfo &recinfo, PlaybackSock *pbs)
Definition: mainserver.cpp:3195
MainServer::m_liveTVChains
std::vector< LiveTVChain * > m_liveTVChains
Definition: mainserver.h:312
MainServer::HandleStopRecording
void HandleStopRecording(QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:2870
MainServer::HandleGetConflictingRecordings
void HandleGetConflictingRecordings(QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:3886
pbs
Definition: pbs.py:1
MainServer::DeletePBS
void DeletePBS(PlaybackSock *sock)
Definition: mainserver.cpp:7775
MainServer::HandleMusicTagGetImage
void HandleMusicTagGetImage(const QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:6327
MainServer::HandleSlaveDisconnectedEvent
void HandleSlaveDisconnectedEvent(const MythEvent &event)
Definition: mainserver.cpp:8316
MainServer::DoHandleStopRecording
void DoHandleStopRecording(RecordingInfo &recinfo, PlaybackSock *pbs)
Definition: mainserver.cpp:2899
MainServer::ShutSlaveBackendsDown
void ShutSlaveBackendsDown(const QString &haltcmd)
Sends the Slavebackends the request to shut down using haltcmd.
Definition: mainserver.cpp:8297
MainServer::HandleDeleteRecording
void HandleDeleteRecording(QString &chanid, QString &starttime, PlaybackSock *pbs, bool forceMetadataDelete, bool forgetHistory)
Definition: mainserver.cpp:2988
MainServer::isClientConnected
bool isClientConnected(bool onlyBlockingClients=false)
Definition: mainserver.cpp:8268
MainServer::HandleSettingQuery
void HandleSettingQuery(const QStringList &tokens, PlaybackSock *pbs)
Definition: mainserver.cpp:5766
MainServer::s_truncate_and_close_lock
static QMutex s_truncate_and_close_lock
Definition: mainserver.h:356
MythServer
Definition: serverpool.h:131
MainServer::HandleMusicTagUpdateVolatile
void HandleMusicTagUpdateVolatile(const QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:5971
MainServer::HandleScanMusic
void HandleScanMusic(const QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:5902
MainServer::HandleGoToSleep
void HandleGoToSleep(PlaybackSock *pbs)
Definition: mainserver.cpp:3396
MainServer::HandleMusicFindLyrics
void HandleMusicFindLyrics(const QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:6829
MainServer::HandleDeleteFile
bool HandleDeleteFile(const QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:5553
MainServer::HandleQueryLoad
void HandleQueryLoad(PlaybackSock *pbs)
Definition: mainserver.cpp:3502
filetransfer.h
MainServer::m_ismaster
bool m_ismaster
Definition: mainserver.h:334
DeleteStruct
Definition: mainserver.h:43
MainServer::HandleQueryFindFile
void HandleQueryFindFile(QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:3994
MainServer::HandleBlockShutdown
void HandleBlockShutdown(bool blockShutdown, PlaybackSock *pbs)
Definition: mainserver.cpp:7748
MainServer::HandleRemoteEncoder
void HandleRemoteEncoder(QStringList &slist, QStringList &commands, PlaybackSock *pbs)
Definition: mainserver.cpp:4956
DeleteThread::run
void run() override
Runs the Qt event loop unless we have a QRunnable, in which case we run the runnable run instead.
Definition: deletethread.cpp:35
MainServer::reconnectTimeout
void reconnectTimeout(void)
Definition: mainserver.cpp:8184
MainServer::HandleCheckRecordingActive
void HandleCheckRecordingActive(QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:2831
MainServer::HandleCutlistQuery
void HandleCutlistQuery(const QString &chanid, const QString &starttime, PlaybackSock *pbs)
Definition: mainserver.cpp:5689
MainServer::GetfsID
int GetfsID(const QList< FileSystemInfo >::iterator &fsInfo)
Definition: mainserver.cpp:5120
DeleteStruct::m_recstartts
QDateTime m_recstartts
Definition: mainserver.h:68
MainServer::HandleGetFreeRecorder
void HandleGetFreeRecorder(PlaybackSock *pbs)
MythSocketCBs
Definition: mythsocket_cb.h:13
MainServer::DeferredDeleteStruct::ts
QDateTime ts
Definition: mainserver.h:348
MainServer::HandleCutMapQuery
void HandleCutMapQuery(const QString &chanid, const QString &starttime, PlaybackSock *pbs, bool commbreak)
Definition: mainserver.cpp:5633
MainServer::MainServer
MainServer(bool master, int port, QMap< int, EncoderLink * > *tvList, Scheduler *sched, AutoExpire *expirer)
Definition: mainserver.cpp:241
MainServer::m_deferredDeleteTimer
QTimer * m_deferredDeleteTimer
Definition: mainserver.h:352
MainServer::m_expirer
AutoExpire * m_expirer
Definition: mainserver.h:342
uint
unsigned int uint
Definition: compat.h:79
MainServer::m_masterServerReconnect
QTimer * m_masterServerReconnect
Definition: mainserver.h:331
MainServer::DeferredDeleteStruct::sock
PlaybackSock * sock
Definition: mainserver.h:347
MainServer::HandlePixmapGetIfModified
void HandlePixmapGetIfModified(const QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:7603
MainServer::HandleMusicSaveLyrics
void HandleMusicSaveLyrics(const QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:7003
MainServer::HandleDone
void HandleDone(MythSocket *socket)
Definition: mainserver.cpp:2116
PlaybackSock
Definition: playbacksock.h:27
RenameThread::m_dst
QString m_dst
Definition: mainserver.h:112
MetadataFactory
Definition: metadatafactory.h:85
MainServer::m_masterFreeSpaceListUpdater
FreeSpaceUpdater *volatile m_masterFreeSpaceListUpdater
Definition: mainserver.h:327
MainServer::HandleGetScheduledRecordings
void HandleGetScheduledRecordings(PlaybackSock *pbs)
Definition: mainserver.cpp:3872
MainServer::m_downloadURLs
QMap< QString, QString > m_downloadURLs
Definition: mainserver.h:364
MainServer::getGuideDataThrough
static void getGuideDataThrough(QDateTime &GuideDataThrough)
Definition: mainserver.cpp:3793
MainServer::GetFileTransferBySock
FileTransfer * GetFileTransferBySock(MythSocket *socket)
Warning you must hold a sockListLock lock before calling this.
Definition: mainserver.cpp:8019
off_t
#define off_t
Definition: mythiowrapper.cpp:241
MainServer::GetSlaveByHostname
PlaybackSock * GetSlaveByHostname(const QString &hostname)
Definition: mainserver.cpp:7957
RenameThread
Definition: mainserver.h:99
MainServer::GetExitCode
int GetExitCode() const
Definition: mainserver.h:154
MainServer::HandleQueryRecordings
void HandleQueryRecordings(const QString &type, PlaybackSock *pbs)
Definition: mainserver.cpp:2175
DeleteStruct::m_recendts
QDateTime m_recendts
Definition: mainserver.h:69
MainServer::HandleQueryGuideDataThrough
void HandleQueryGuideDataThrough(PlaybackSock *pbs)
Definition: mainserver.cpp:3804
MainServer::HandleLockTuner
void HandleLockTuner(PlaybackSock *pbs, int cardid=-1)
Definition: mainserver.cpp:4276
mthreadpool.h
MThreadPool
Definition: mthreadpool.h:18
livetvchain.h
MainServer::HandleSetSetting
void HandleSetSetting(const QStringList &tokens, PlaybackSock *pbs)
Definition: mainserver.cpp:5860
MainServer::HandleVersion
void HandleVersion(MythSocket *socket, const QStringList &slist)
Definition: mainserver.cpp:1687
DeleteStruct::m_forceMetadataDelete
bool m_forceMetadataDelete
Definition: mainserver.h:71
ProgramInfo
Holds information on recordings and videos.
Definition: programinfo.h:67
MainServer::HandleQueryCheckFile
void HandleQueryCheckFile(QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:3613
MainServer::HandleQueryFileExists
void HandleQueryFileExists(QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:3731
MainServer::HandleUndeleteRecording
void HandleUndeleteRecording(QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:3177
MainServer::m_stopped
bool m_stopped
Definition: mainserver.h:371
MainServer::HandlePixmapLastModified
void HandlePixmapLastModified(QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:7539
MainServer::m_masterBackendOverride
bool m_masterBackendOverride
Definition: mainserver.h:339
MainServer::ProcessRequest
void ProcessRequest(MythSocket *sock)
Definition: mainserver.cpp:455
MainServer::m_threadPool
MThreadPool m_threadPool
Definition: mainserver.h:337
MainServer::HandleFileTransferQuery
void HandleFileTransferQuery(QStringList &slist, QStringList &commands, PlaybackSock *pbs)
Definition: mainserver.cpp:7075
MainServer::HandleIsActiveBackendQuery
void HandleIsActiveBackendQuery(const QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:5097
MainServer::~MainServer
~MainServer() override
Definition: mainserver.cpp:355
RenameThread::m_pbs
PlaybackSock & m_pbs
Definition: mainserver.h:111
MainServer::HandleActiveBackendsQuery
void HandleActiveBackendsQuery(PlaybackSock *pbs)
Definition: mainserver.cpp:5089
MainServer::HandleQueryHostname
void HandleQueryHostname(PlaybackSock *pbs)
Definition: mainserver.cpp:3555
MythDeque
MythDeque is similar to QPtrQueue, while being based off deque, this allows that items that are not a...
Definition: mythdeque.h:27
MainServer::HandleScanVideos
void HandleScanVideos(PlaybackSock *pbs)
Definition: mainserver.cpp:5882
MainServer::HandleFreeTuner
void HandleFreeTuner(int cardid, PlaybackSock *pbs)
Definition: mainserver.cpp:4357
FileSystemInfo
Definition: filesysteminfo.h:15
std
Definition: mythchrono.h:23
MythSocketCBs::error
virtual void error(MythSocket *, int)
Definition: mythsocket_cb.h:18
MainServer::deferredDeleteSlot
void deferredDeleteSlot(void)
Definition: mainserver.cpp:7757
MainServer::HandleGetFreeRecorderCount
void HandleGetFreeRecorderCount(PlaybackSock *pbs)
MainServer::m_fsInfosCache
QList< FileSystemInfo > m_fsInfosCache
Definition: mainserver.h:360
MainServer::HandleRescheduleRecordings
void HandleRescheduleRecordings(const QStringList &request, PlaybackSock *pbs)
Definition: mainserver.cpp:3246
MainServer::m_fsInfosCacheLock
QMutex m_fsInfosCacheLock
Definition: mainserver.h:361
MainServer::HandleMusicGetLyricGrabbers
void HandleMusicGetLyricGrabbers(const QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:6921
MainServer::m_metadatafactory
MetadataFactory * m_metadatafactory
Definition: mainserver.h:318
MainServer::SendResponse
void SendResponse(MythSocket *sock, QStringList &commands)
Definition: mainserver.cpp:2137
MainServer::m_masterFreeSpaceListWait
QWaitCondition m_masterFreeSpaceListWait
Definition: mainserver.h:328
MainServer::HandleGetRecorderFromNum
void HandleGetRecorderFromNum(QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:7220
MainServer::HandleGetConnectedRecorderList
void HandleGetConnectedRecorderList(PlaybackSock *pbs)
MainServer::m_downloadURLsLock
QMutex m_downloadURLsLock
Definition: mainserver.h:363
MainServer::HandleForgetRecording
void HandleForgetRecording(QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:3374
MainServer::GetFileTransferByID
FileTransfer * GetFileTransferByID(int id)
Warning you must hold a sockListLock lock before calling this.
Definition: mainserver.cpp:8010
MainServer::m_sockListLock
QReadWriteLock m_sockListLock
Definition: mainserver.h:320
MainServer::GetCurrentMaxBitrate
size_t GetCurrentMaxBitrate(void)
Definition: mainserver.cpp:5130
MainServer::HandleSGGetFileList
void HandleSGGetFileList(QStringList &sList, PlaybackSock *pbs)
Definition: mainserver.cpp:3918
RenameThread::RenameThread
RenameThread(MainServer &ms, PlaybackSock &pbs, QString src, QString dst)
Definition: mainserver.h:102
expirer
AutoExpire * expirer
DeleteStruct::m_size
off_t m_size
Definition: mainserver.h:73
musicbrainzngs.caa.hostname
string hostname
Definition: caa.py:17
MainServer::HandleDownloadFile
void HandleDownloadFile(const QStringList &command, PlaybackSock *pbs)
Definition: mainserver.cpp:5786
RenameThread::m_ms
MainServer & m_ms
Definition: mainserver.h:110
MainServer::SetExitCode
void SetExitCode(int exitCode, bool closeApplication)
Definition: mainserver.cpp:8084
MainServer::HandleRecorderQuery
void HandleRecorderQuery(QStringList &slist, QStringList &commands, PlaybackSock *pbs)
Definition: mainserver.cpp:4517
MainServer::m_deferredDeleteList
MythDeque< DeferredDeleteStruct > m_deferredDeleteList
Definition: mainserver.h:353
MainServer::HandleQueryUptime
void HandleQueryUptime(PlaybackSock *pbs)
Definition: mainserver.cpp:3533
MainServer::HandleGetFreeRecorderList
void HandleGetFreeRecorderList(PlaybackSock *pbs)
DeleteThread::start
void start(void)
Definition: mainserver.h:84
exitcodes.h
mythdownloadmanager.h
MainServer::HandleMoveFile
void HandleMoveFile(PlaybackSock *pbs, const QString &storagegroup, const QString &src, const QString &dst)
Definition: mainserver.cpp:5460
MainServer::m_decrRefSocketList
std::vector< MythSocket * > m_decrRefSocketList
Definition: mainserver.h:324
MainServer::HandleGenPreviewPixmap
void HandleGenPreviewPixmap(QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:7375
MainServer::HandleMusicTagAddImage
void HandleMusicTagAddImage(const QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:6548
MainServer::DoTruncateThread
void DoTruncateThread(DeleteStruct *ds)
Definition: mainserver.cpp:5540
MainServer::m_deletelock
QMutex m_deletelock
Definition: mainserver.h:336
build_compdb.filename
filename
Definition: build_compdb.py:21
MThreadPool::globalInstance
static MThreadPool * globalInstance(void)
Definition: mthreadpool.cpp:317
MainServer::Stop
void Stop(void)
Definition: mainserver.cpp:361
MainServer::GetActiveBackends
void GetActiveBackends(QStringList &hosts)
Definition: mainserver.cpp:5071
MainServer::HandleQueryFreeSpaceSummary
void HandleQueryFreeSpaceSummary(PlaybackSock *pbs)
Definition: mainserver.cpp:3459
mythsocket.h
TruncateThread::TruncateThread
TruncateThread(MainServer *ms, const QString &filename, int fd, off_t size)
Definition: mainserver.h:92
DeleteStruct::m_recordedid
uint m_recordedid
Definition: mainserver.h:70
FreeSpaceUpdater
Definition: mainserver.cpp:174
MainServer::m_sched
Scheduler * m_sched
Definition: mainserver.h:341
MainServer::DoDeleteInDB
static void DoDeleteInDB(DeleteStruct *ds)
Definition: mainserver.cpp:2605
MThreadPool::start
void start(QRunnable *runnable, const QString &debugName, int priority=0)
Definition: mthreadpool.cpp:352
MainServer::DoDeleteThread
void DoDeleteThread(DeleteStruct *ds)
Definition: mainserver.cpp:2386
MainServer::connectionFailed
void connectionFailed(MythSocket *socket) override
Definition: mainserver.h:141
MainServer::HandleFillProgramInfo
void HandleFillProgramInfo(QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:2347
MainServer::HandleAddChildInput
bool HandleAddChildInput(uint inputid)
Definition: mainserver.cpp:3266
MainServer::HandleSetChannelInfo
void HandleSetChannelInfo(QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:4921
DeleteStruct::m_ms
MainServer * m_ms
Definition: mainserver.h:64
MainServer::DoHandleDeleteRecording
void DoHandleDeleteRecording(RecordingInfo &recinfo, PlaybackSock *pbs, bool forceMetadataDelete, bool lexpirer=false, bool forgetHistory=false)
Definition: mainserver.cpp:3031
MainServer::HandleBookmarkQuery
void HandleBookmarkQuery(const QString &chanid, const QString &starttime, PlaybackSock *pbs)
Definition: mainserver.cpp:5705
LiveTVChain
Keeps track of recordings in a current LiveTV instance.
Definition: livetvchain.h:34