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 "tv.h"
18 #include "playbacksock.h"
19 #include "mthreadpool.h"
20 #include "encoderlink.h"
21 #include "exitcodes.h"
22 #include "filetransfer.h"
23 #include "scheduler.h"
24 #include "livetvchain.h"
25 #include "autoexpire.h"
26 #include "mythsocket.h"
27 #include "mythdeque.h"
28 #include "mythdownloadmanager.h"
29 
30 #ifdef DeleteFile
31 #undef DeleteFile
32 #endif
33 
34 class QUrl;
35 class MythServer;
36 class QTimer;
37 class FileSystemInfo;
38 class MetadataFactory;
39 class FreeSpaceUpdater;
40 
42 {
43  friend class MainServer;
44  public:
45  DeleteStruct(MainServer *ms, QString filename, QString title,
46  uint chanid, QDateTime recstartts, QDateTime recendts,
47  uint recordedId,
48  bool forceMetadataDelete) :
49  m_ms(ms), m_filename(std::move(filename)), m_title(std::move(title)),
50  m_chanid(chanid), m_recstartts(std::move(recstartts)),
51  m_recendts(std::move(recendts)), m_recordedid(recordedId),
52  m_forceMetadataDelete(forceMetadataDelete)
53  {
54  }
55 
56  DeleteStruct(MainServer *ms, QString filename, int fd, off_t size) :
57  m_ms(ms), m_filename(std::move(filename)), m_fd(fd), m_size(size)
58  {
59  }
60 
61  protected:
62  MainServer *m_ms {nullptr};
63  QString m_filename;
64  QString m_title;
66  QDateTime m_recstartts;
67  QDateTime m_recendts;
69  bool m_forceMetadataDelete {false};
70  int m_fd {-1};
72 };
73 
74 class DeleteThread : public QRunnable, public DeleteStruct
75 {
76  public:
77  DeleteThread(MainServer *ms, const QString& filename, const QString& title, uint chanid,
78  QDateTime recstartts, QDateTime recendts, uint recordingId,
79  bool forceMetadataDelete) :
80  DeleteStruct(ms, filename, title, chanid, std::move(recstartts),
81  std::move(recendts), recordingId, forceMetadataDelete) {}
82  void start(void)
83  { MThreadPool::globalInstance()->startReserved(this, "DeleteThread"); }
84  void run(void) override; // QRunnable
85 };
86 
87 class TruncateThread : public QRunnable, public DeleteStruct
88 {
89  public:
90  TruncateThread(MainServer *ms, const QString& filename, int fd, off_t size) :
91  DeleteStruct(ms, filename, fd, size) {}
92  void start(void)
93  { MThreadPool::globalInstance()->start(this, "Truncate"); }
94  void run(void) override; // QRunnable
95 };
96 
97 class RenameThread : public QRunnable
98 {
99 public:
101  QString src, QString dst)
102  : m_ms(ms), m_pbs(pbs), m_src(std::move(src)), m_dst(std::move(dst)) {}
103  void run(void) override; // QRunnable
104 
105 private:
106  static QMutex s_renamelock;
107 
110  QString m_src, m_dst;
111 };
112 
113 class MainServer : public QObject, public MythSocketCBs
114 {
115  Q_OBJECT
116 
117  friend class DeleteThread;
118  friend class TruncateThread;
119  friend class FreeSpaceUpdater;
120  friend class RenameThread;
121  public:
122  MainServer(bool master, int port,
123  QMap<int, EncoderLink *> *tvList,
125 
126  ~MainServer() override;
127 
128  void Stop(void);
129 
130  void customEvent(QEvent *e) override; // QObject
131 
132  bool isClientConnected(bool onlyBlockingClients = false);
133  void ShutSlaveBackendsDown(const QString &haltcmd);
134 
135  void ProcessRequest(MythSocket *sock);
136 
137  void readyRead(MythSocket *socket) override; // MythSocketCBs
138  void connectionClosed(MythSocket *socket) override; // MythSocketCBs
139  void connectionFailed(MythSocket *socket) override // MythSocketCBs
140  { (void)socket; }
141  void connected(MythSocket *socket) override // MythSocketCBs
142  { (void)socket; }
143 
144  void DeletePBS(PlaybackSock *sock);
145 
146  size_t GetCurrentMaxBitrate(void);
147  void BackendQueryDiskSpace(QStringList &strlist, bool consolidated,
148  bool allHosts);
149  void GetFilesystemInfos(QList<FileSystemInfo> &fsInfos,
150  bool useCache=true);
151 
152  int GetExitCode() const { return m_exitCode; }
153 
154  void UpdateSystemdStatus(void);
155 
156  protected slots:
157  void reconnectTimeout(void);
158  void deferredDeleteSlot(void);
159  static void autoexpireUpdate(void);
160 
161  private slots:
162  void NewConnection(qt_socket_fd_t socketDescriptor);
163 
164  private:
165 
166  void ProcessRequestWork(MythSocket *sock);
167  void HandleAnnounce(QStringList &slist, QStringList commands,
168  MythSocket *socket);
169  void HandleDone(MythSocket *socket);
170 
171  void GetActiveBackends(QStringList &hosts);
173  void HandleIsActiveBackendQuery(const QStringList &slist, PlaybackSock *pbs);
174  void HandleMoveFile(PlaybackSock *pbs, const QString &storagegroup,
175  const QString &src, const QString &dst);
176  bool HandleDeleteFile(const QStringList &slist, PlaybackSock *pbs);
177  bool HandleDeleteFile(const QString& filename, const QString& storagegroup,
178  PlaybackSock *pbs = nullptr);
179  void HandleQueryRecordings(const QString& type, PlaybackSock *pbs);
180  void HandleQueryRecording(QStringList &slist, PlaybackSock *pbs);
181  void HandleStopRecording(QStringList &slist, PlaybackSock *pbs);
183  void HandleDeleteRecording(QString &chanid, QString &starttime,
184  PlaybackSock *pbs, bool forceMetadataDelete,
185  bool forgetHistory);
186  void HandleDeleteRecording(QStringList &slist, PlaybackSock *pbs,
187  bool forceMetadataDelete);
189  bool forceMetadataDelete, bool expirer=false,
190  bool forgetHistory=false);
191  void HandleUndeleteRecording(QStringList &slist, PlaybackSock *pbs);
193  void HandleForgetRecording(QStringList &slist, PlaybackSock *pbs);
194  void HandleRescheduleRecordings(const QStringList &request,
195  PlaybackSock *pbs);
196  bool HandleAddChildInput(uint inputid);
198  void HandleQueryFreeSpace(PlaybackSock *pbs, bool allHosts);
200  void HandleQueryCheckFile(QStringList &slist, PlaybackSock *pbs);
201  void HandleQueryFileExists(QStringList &slist, PlaybackSock *pbs);
202  void HandleQueryFindFile(QStringList &slist, PlaybackSock *pbs);
203  void HandleQueryFileHash(QStringList &slist, PlaybackSock *pbs);
205  void HandleGetPendingRecordings(PlaybackSock *pbs, const QString& table = "", int recordid=-1);
207  void HandleGetConflictingRecordings(QStringList &slist, PlaybackSock *pbs);
209  void HandleSGGetFileList(QStringList &sList, PlaybackSock *pbs);
210  void HandleSGFileQuery(QStringList &sList, PlaybackSock *pbs);
211  void HandleGetFreeInputInfo(PlaybackSock *pbs, uint excluded_input);
212  void HandleGetNextFreeRecorder(QStringList &slist, PlaybackSock *pbs);
217  void HandleRecorderQuery(QStringList &slist, QStringList &commands,
218  PlaybackSock *pbs);
219  void HandleSetNextLiveTVDir(QStringList &commands, PlaybackSock *pbs);
220  void HandleFileTransferQuery(QStringList &slist, QStringList &commands,
221  PlaybackSock *pbs);
222  void HandleGetRecorderNum(QStringList &slist, PlaybackSock *pbs);
223  void HandleGetRecorderFromNum(QStringList &slist, PlaybackSock *pbs);
224  void HandleMessage(QStringList &slist, PlaybackSock *pbs);
225  void HandleSetVerbose(const QStringList &slist, PlaybackSock *pbs);
226  void HandleSetLogLevel(const QStringList &slist, PlaybackSock *pbs);
227  void HandleGenPreviewPixmap(QStringList &slist, PlaybackSock *pbs);
228  void HandlePixmapLastModified(QStringList &slist, PlaybackSock *pbs);
229  void HandlePixmapGetIfModified(const QStringList &slist, PlaybackSock *pbs);
230  void HandleIsRecording(const QStringList &slist, PlaybackSock *pbs);
231  void HandleCheckRecordingActive(QStringList &slist, PlaybackSock *pbs);
232  void HandleFillProgramInfo(QStringList &slist, PlaybackSock *pbs);
233  void HandleSetChannelInfo(QStringList &slist, PlaybackSock *pbs);
234  void HandleRemoteEncoder(QStringList &slist, QStringList &commands,
235  PlaybackSock *pbs);
236  void HandleLockTuner(PlaybackSock *pbs, int cardid = -1);
237  void HandleFreeTuner(int cardid, PlaybackSock *pbs);
238  void HandleCutMapQuery(const QString &chanid, const QString &starttime,
239  PlaybackSock *pbs, bool commbreak);
240  void HandleCommBreakQuery(const QString &chanid, const QString &starttime,
241  PlaybackSock *pbs);
242  void HandleCutlistQuery(const QString &chanid, const QString &starttime,
243  PlaybackSock *pbs);
244  void HandleBookmarkQuery(const QString &chanid, const QString &starttime,
245  PlaybackSock *pbs);
246  void HandleSetBookmark(QStringList &tokens, PlaybackSock *pbs);
247  void HandleSettingQuery(const QStringList &tokens, PlaybackSock *pbs);
248  void HandleSetSetting(const QStringList &tokens, PlaybackSock *pbs);
250  void HandleScanMusic(const QStringList &slist, PlaybackSock *pbs);
251  void HandleMusicTagUpdateVolatile(const QStringList &slist, PlaybackSock *pbs);
252  void HandleMusicTagUpdateMetadata(const QStringList &slist, PlaybackSock *pbs);
253  void HandleMusicFindAlbumArt(const QStringList &slist, PlaybackSock *pbs);
254  void HandleMusicTagGetImage(const QStringList &slist, PlaybackSock *pbs);
255  void HandleMusicTagAddImage(const QStringList &slist, PlaybackSock *pbs);
256  void HandleMusicTagRemoveImage(const QStringList &slist, PlaybackSock *pbs);
257  void HandleMusicTagChangeImage(const QStringList &slist, PlaybackSock *pbs);
258  void HandleMusicCalcTrackLen(const QStringList &slist, PlaybackSock *pbs);
259  void HandleMusicFindLyrics(const QStringList &slist, PlaybackSock *pbs);
260  void HandleMusicGetLyricGrabbers(const QStringList &slist, PlaybackSock *pbs);
261  void HandleMusicSaveLyrics(const QStringList &slist, PlaybackSock *pbs);
262  void HandleVersion(MythSocket *socket, const QStringList &slist);
263  void HandleBackendRefresh(MythSocket *socket);
269  void HandleBlockShutdown(bool blockShutdown, PlaybackSock *pbs);
270  void HandleDownloadFile(const QStringList &command, PlaybackSock *pbs);
271  void HandleSlaveDisconnectedEvent(const MythEvent &event);
272 
273  void SendResponse(MythSocket *sock, QStringList &commands);
274  void SendErrorResponse(MythSocket *sock, const QString &error);
275  void SendErrorResponse(PlaybackSock *pbs, const QString &error);
276  static void SendSlaveDisconnectedEvent(const QList<uint> &offlineEncoderIDs,
277  bool needsReschedule);
278 
279  static void getGuideDataThrough(QDateTime &GuideDataThrough);
280 
281  PlaybackSock *GetSlaveByHostname(const QString &hostname);
286 
287  static QString LocalFilePath(const QString &path, const QString &wantgroup);
288 
289  int GetfsID(const QList<FileSystemInfo>::iterator& fsInfo);
290 
291  void DoTruncateThread(DeleteStruct *ds);
292  void DoDeleteThread(DeleteStruct *ds);
293  static void DeleteRecordedFiles(DeleteStruct *ds);
294  static void DoDeleteInDB(DeleteStruct *ds);
295 
296  LiveTVChain *GetExistingChain(const QString &id);
299  void AddToChains(LiveTVChain *chain);
300  void DeleteChain(LiveTVChain *chain);
301 
302  void SetExitCode(int exitCode, bool closeApplication);
303 
304  static int DeleteFile(const QString &filename, bool followLinks,
305  bool deleteBrokenSymlinks = false);
306  static int OpenAndUnlink(const QString &filename);
307  static bool TruncateAndClose(ProgramInfo *pginfo,
308  int fd, const QString &filename,
309  off_t fsize);
310 
311  vector<LiveTVChain*> m_liveTVChains;
313 
314  QMap<int, EncoderLink *> *m_encoderList {nullptr};
315 
318 
319  QReadWriteLock m_sockListLock;
320  vector<PlaybackSock *> m_playbackList;
321  vector<FileTransfer *> m_fileTransferList;
322  QSet<MythSocket*> m_controlSocketList;
323  vector<MythSocket*> m_decrRefSocketList;
324 
329 
330  QTimer *m_masterServerReconnect {nullptr}; // audited ref #5318
332 
334 
335  QMutex m_deletelock;
337 
339 
340  Scheduler *m_sched {nullptr};
341  AutoExpire *m_expirer {nullptr};
343 
345  {
347  QDateTime ts;
348  };
349 
351  QTimer *m_deferredDeleteTimer {nullptr}; // audited ref #5318
353 
354  QTimer *m_autoexpireUpdateTimer {nullptr}; // audited ref #5318
356 
357  QMap<QString, int> m_fsIDcache;
359  QList<FileSystemInfo> m_fsInfosCache;
361 
363  QMap<QString, QString> m_downloadURLs;
364 
366 
367  using RequestedBy = QHash<QString,QString>;
369 
370  bool m_stopped {false};
371 
373 };
374 
375 #endif
376 
377 /* vim: set expandtab tabstop=4 shiftwidth=4: */
MainServer::m_controlSocketList
QSet< MythSocket * > m_controlSocketList
Definition: mainserver.h:322
MainServer::SendErrorResponse
void SendErrorResponse(MythSocket *sock, const QString &error)
Definition: mainserver.cpp:2114
Scheduler
Definition: scheduler.h:46
RenameThread::s_renamelock
static QMutex s_renamelock
Definition: mainserver.h:106
MainServer::AddToChains
void AddToChains(LiveTVChain *chain)
Definition: mainserver.cpp:8015
e
QDomElement e
Definition: mythplugins/mytharchive/mytharchivehelper/main.cpp:1420
TruncateThread::start
void start(void)
Definition: mainserver.h:92
MainServer::HandleMusicTagChangeImage
void HandleMusicTagChangeImage(const QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:6365
MainServer::m_mythserver
MythServer * m_mythserver
Definition: mainserver.h:316
tv.h
DeleteStruct::m_filename
QString m_filename
Definition: mainserver.h:63
DeleteThread::run
void run(void) override
Runs the Qt event loop unless we have a QRunnable, in which case we run the runnable run instead.
GENERIC_EXIT_OK
#define GENERIC_EXIT_OK
Exited with no error.
Definition: exitcodes.h:10
MainServer::DeleteRecordedFiles
static void DeleteRecordedFiles(DeleteStruct *ds)
Definition: mainserver.cpp:2521
MainServer::LocalFilePath
static QString LocalFilePath(const QString &path, const QString &wantgroup)
Definition: mainserver.cpp:8049
TruncateThread
Definition: mainserver.h:88
MainServer::connected
void connected(MythSocket *socket) override
Definition: mainserver.h:141
RenameThread::run
void run(void) override
Definition: mainserver.cpp:5496
MainServer::m_fsIDcacheLock
QMutex m_fsIDcacheLock
Definition: mainserver.h:358
MainServer::HandleQueryTimeZone
void HandleQueryTimeZone(PlaybackSock *pbs)
Definition: mainserver.cpp:3587
DeleteStruct::DeleteStruct
DeleteStruct(MainServer *ms, QString filename, int fd, off_t size)
Definition: mainserver.h:56
MainServer::ProcessRequestWork
void ProcessRequestWork(MythSocket *sock)
Definition: mainserver.cpp:463
MainServer::HandleMusicTagRemoveImage
void HandleMusicTagRemoveImage(const QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:6687
MainServer::GetFilesystemInfos
void GetFilesystemInfos(QList< FileSystemInfo > &fsInfos, bool useCache=true)
Definition: mainserver.cpp:5359
MainServer::m_encoderList
QMap< int, EncoderLink * > * m_encoderList
Definition: mainserver.h:314
MainServer::HandleGetNextFreeRecorder
void HandleGetNextFreeRecorder(QStringList &slist, PlaybackSock *pbs)
DeleteStruct::m_title
QString m_title
Definition: mainserver.h:64
MainServer::HandleMusicCalcTrackLen
void HandleMusicCalcTrackLen(const QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:6015
MainServer::HandleBackendRefresh
void HandleBackendRefresh(MythSocket *socket)
Definition: mainserver.cpp:7700
MainServer::GetExistingChain
LiveTVChain * GetExistingChain(const QString &id)
Definition: mainserver.cpp:7985
MainServer::HandleQueryMemStats
void HandleQueryMemStats(PlaybackSock *pbs)
Definition: mainserver.cpp:3559
MainServer::m_previewRequestedBy
RequestedBy m_previewRequestedBy
Definition: mainserver.h:368
MainServer::m_addChildInputLock
QMutex m_addChildInputLock
Definition: mainserver.h:342
title
QString title
Definition: mythplugins/mytharchive/mytharchivehelper/main.cpp:636
MainServer::HandleSGFileQuery
void HandleSGFileQuery(QStringList &sList, PlaybackSock *pbs)
Definition: mainserver.cpp:4190
MainServer::m_deferredDeleteLock
QMutex m_deferredDeleteLock
Definition: mainserver.h:350
MainServer::m_autoexpireUpdateTimer
QTimer * m_autoexpireUpdateTimer
Definition: mainserver.h:354
MainServer::NewConnection
void NewConnection(qt_socket_fd_t socketDescriptor)
Definition: mainserver.cpp:435
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:5715
MainServer::DeferredDeleteStruct
Definition: mainserver.h:345
tvList
QMap< int, EncoderLink * > tvList
Definition: backendcontext.cpp:7
MainServer::m_masterServer
PlaybackSock * m_masterServer
Definition: mainserver.h:331
MainServer::BackendQueryDiskSpace
void BackendQueryDiskSpace(QStringList &strlist, bool consolidated, bool allHosts)
Definition: mainserver.cpp:5143
MainServer::HandleGetExpiringRecordings
void HandleGetExpiringRecordings(PlaybackSock *pbs)
Definition: mainserver.cpp:3893
MainServer::m_liveTVChainsLock
QMutex m_liveTVChainsLock
Definition: mainserver.h:312
MythEvent
This class is used as a container for messages.
Definition: mythevent.h:17
MainServer::HandleMessage
void HandleMessage(QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:7241
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:2660
DeleteThread::DeleteThread
DeleteThread(MainServer *ms, const QString &filename, const QString &title, uint chanid, QDateTime recstartts, QDateTime recendts, uint recordingId, bool forceMetadataDelete)
Definition: mainserver.h:77
MainServer::HandleCommBreakQuery
void HandleCommBreakQuery(const QString &chanid, const QString &starttime, PlaybackSock *pbs)
Definition: mainserver.cpp:5658
MainServer::GetPlaybackBySock
PlaybackSock * GetPlaybackBySock(MythSocket *socket)
Warning you must hold a sockListLock lock before calling this.
Definition: mainserver.cpp:7959
DeleteThread
Definition: deletethread.h:20
MainServer
Definition: mainserver.h:114
AutoExpire
Used to expire recordings to make space for new recordings.
Definition: autoexpire.h:61
playbacksock.h
MainServer::HandleIsRecording
void HandleIsRecording(const QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:7329
MainServer::m_masterFreeSpaceListLock
QMutex m_masterFreeSpaceListLock
Definition: mainserver.h:325
MainServer::OpenAndUnlink
static int OpenAndUnlink(const QString &filename)
Opens a file, unlinks it and returns the file descriptor.
Definition: mainserver.cpp:2717
MainServer::HandleSetVerbose
void HandleSetVerbose(const QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:7269
MainServer::customEvent
void customEvent(QEvent *e) override
Definition: mainserver.cpp:1114
MainServer::HandleGetRecorderNum
void HandleGetRecorderNum(QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:7156
MainServer::HandleQueryFileHash
void HandleQueryFileHash(QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:3653
RenameThread::m_src
QString m_src
Definition: mainserver.h:110
DeleteStruct::DeleteStruct
DeleteStruct(MainServer *ms, QString filename, QString title, uint chanid, QDateTime recstartts, QDateTime recendts, uint recordedId, bool forceMetadataDelete)
Definition: mainserver.h:45
MainServer::autoexpireUpdate
static void autoexpireUpdate(void)
Definition: mainserver.cpp:430
DeleteStruct::m_chanid
uint m_chanid
Definition: mainserver.h:65
MainServer::HandleMusicFindAlbumArt
void HandleMusicFindAlbumArt(const QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:6159
MainServer::m_exitCode
int m_exitCode
Definition: mainserver.h:365
TruncateThread::run
void run(void) override
Definition: mainserver.cpp:5518
MainServer::RequestedBy
QHash< QString, QString > RequestedBy
Definition: mainserver.h:367
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:2747
MainServer::HandleQueryFreeSpace
void HandleQueryFreeSpace(PlaybackSock *pbs, bool allHosts)
Definition: mainserver.cpp:3416
DeleteStruct::m_fd
int m_fd
Definition: mainserver.h:70
mythdeque.h
scheduler.h
MainServer::m_masterFreeSpaceList
QStringList m_masterFreeSpaceList
Definition: mainserver.h:328
MainServer::readyRead
void readyRead(MythSocket *socket) override
Definition: mainserver.cpp:445
FileTransfer
Definition: libs/libmythprotoserver/sockethandler/filetransfer.h:20
MainServer::connectionClosed
void connectionClosed(MythSocket *socket) override
Definition: mainserver.cpp:7745
MainServer::m_fsIDcache
QMap< QString, int > m_fsIDcache
Definition: mainserver.h:357
MainServer::GetMediaServerByHostname
PlaybackSock * GetMediaServerByHostname(const QString &hostname)
Definition: mainserver.cpp:7938
MainServer::HandleMusicTagUpdateMetadata
void HandleMusicTagUpdateMetadata(const QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:6072
MythSocket
Class for communcating between myth backends and frontends.
Definition: mythsocket.h:27
MainServer::UpdateSystemdStatus
void UpdateSystemdStatus(void)
Definition: mainserver.cpp:8302
MainServer::HandleGetPendingRecordings
void HandleGetPendingRecordings(PlaybackSock *pbs, const QString &table="", int recordid=-1)
Definition: mainserver.cpp:3809
MainServer::DeleteChain
void DeleteChain(LiveTVChain *chain)
Definition: mainserver.cpp:8023
MainServer::SendSlaveDisconnectedEvent
static void SendSlaveDisconnectedEvent(const QList< uint > &offlineEncoderIDs, bool needsReschedule)
Definition: mainserver.cpp:8287
MainServer::HandleSetNextLiveTVDir
void HandleSetNextLiveTVDir(QStringList &commands, PlaybackSock *pbs)
Definition: mainserver.cpp:4881
MainServer::HandleSetLogLevel
void HandleSetLogLevel(const QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:7296
MainServer::HandleAnnounce
void HandleAnnounce(QStringList &slist, QStringList commands, MythSocket *socket)
Definition: mainserver.cpp:1739
MainServer::GetChainWithRecording
LiveTVChain * GetChainWithRecording(const ProgramInfo &pginfo)
Definition: mainserver.cpp:8005
autoexpire.h
expirer
AutoExpire * expirer
Definition: backendcontext.cpp:8
MainServer::HandleGetFreeInputInfo
void HandleGetFreeInputInfo(PlaybackSock *pbs, uint excluded_input)
Definition: mainserver.cpp:4384
MainServer::HandleQueryRecording
void HandleQueryRecording(QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:2289
MainServer::DoHandleUndeleteRecording
void DoHandleUndeleteRecording(RecordingInfo &recinfo, PlaybackSock *pbs)
Definition: mainserver.cpp:3184
MainServer::HandleStopRecording
void HandleStopRecording(QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:2859
MainServer::HandleGetConflictingRecordings
void HandleGetConflictingRecordings(QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:3875
pbs
Definition: pbs.py:1
MainServer::DeletePBS
void DeletePBS(PlaybackSock *sock)
Definition: mainserver.cpp:7733
MainServer::HandleMusicTagGetImage
void HandleMusicTagGetImage(const QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:6311
MainServer::HandleSlaveDisconnectedEvent
void HandleSlaveDisconnectedEvent(const MythEvent &event)
Definition: mainserver.cpp:8274
MainServer::DoHandleStopRecording
void DoHandleStopRecording(RecordingInfo &recinfo, PlaybackSock *pbs)
Definition: mainserver.cpp:2888
MainServer::ShutSlaveBackendsDown
void ShutSlaveBackendsDown(const QString &haltcmd)
Sends the Slavebackends the request to shut down using haltcmd.
Definition: mainserver.cpp:8255
MainServer::HandleDeleteRecording
void HandleDeleteRecording(QString &chanid, QString &starttime, PlaybackSock *pbs, bool forceMetadataDelete, bool forgetHistory)
Definition: mainserver.cpp:2977
MainServer::isClientConnected
bool isClientConnected(bool onlyBlockingClients=false)
Definition: mainserver.cpp:8226
MainServer::HandleSettingQuery
void HandleSettingQuery(const QStringList &tokens, PlaybackSock *pbs)
Definition: mainserver.cpp:5750
MainServer::s_truncate_and_close_lock
static QMutex s_truncate_and_close_lock
Definition: mainserver.h:355
MythServer
Definition: mythsocketmanager.h:22
MainServer::HandleMusicTagUpdateVolatile
void HandleMusicTagUpdateVolatile(const QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:5955
MainServer::m_decrRefSocketList
vector< MythSocket * > m_decrRefSocketList
Definition: mainserver.h:323
MainServer::HandleScanMusic
void HandleScanMusic(const QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:5886
MainServer::HandleGoToSleep
void HandleGoToSleep(PlaybackSock *pbs)
Definition: mainserver.cpp:3385
MainServer::HandleMusicFindLyrics
void HandleMusicFindLyrics(const QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:6813
MainServer::HandleDeleteFile
bool HandleDeleteFile(const QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:5537
MainServer::HandleQueryLoad
void HandleQueryLoad(PlaybackSock *pbs)
Definition: mainserver.cpp:3491
filetransfer.h
MainServer::kMasterServerReconnectTimeout
static const uint kMasterServerReconnectTimeout
Definition: mainserver.h:372
MainServer::m_ismaster
bool m_ismaster
Definition: mainserver.h:333
DeleteStruct
Definition: mainserver.h:42
MainServer::HandleQueryFindFile
void HandleQueryFindFile(QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:3983
filename
QString filename
Definition: mythplugins/mytharchive/mytharchivehelper/main.cpp:637
MainServer::HandleBlockShutdown
void HandleBlockShutdown(bool blockShutdown, PlaybackSock *pbs)
Definition: mainserver.cpp:7706
MainServer::HandleRemoteEncoder
void HandleRemoteEncoder(QStringList &slist, QStringList &commands, PlaybackSock *pbs)
Definition: mainserver.cpp:4943
MainServer::reconnectTimeout
void reconnectTimeout(void)
Definition: mainserver.cpp:8142
MainServer::HandleCheckRecordingActive
void HandleCheckRecordingActive(QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:2820
MainServer::HandleCutlistQuery
void HandleCutlistQuery(const QString &chanid, const QString &starttime, PlaybackSock *pbs)
Definition: mainserver.cpp:5673
MainServer::GetfsID
int GetfsID(const QList< FileSystemInfo >::iterator &fsInfo)
Definition: mainserver.cpp:5106
DeleteStruct::m_recstartts
QDateTime m_recstartts
Definition: mainserver.h:66
MainServer::HandleGetFreeRecorder
void HandleGetFreeRecorder(PlaybackSock *pbs)
MythSocketCBs
Definition: mythsocket_cb.h:12
MainServer::DeferredDeleteStruct::ts
QDateTime ts
Definition: mainserver.h:347
MainServer::HandleCutMapQuery
void HandleCutMapQuery(const QString &chanid, const QString &starttime, PlaybackSock *pbs, bool commbreak)
Definition: mainserver.cpp:5617
MainServer::MainServer
MainServer(bool master, int port, QMap< int, EncoderLink * > *tvList, Scheduler *sched, AutoExpire *expirer)
Definition: mainserver.cpp:240
MainServer::m_deferredDeleteTimer
QTimer * m_deferredDeleteTimer
Definition: mainserver.h:351
MainServer::m_expirer
AutoExpire * m_expirer
Definition: mainserver.h:341
uint
unsigned int uint
Definition: compat.h:141
MainServer::m_masterServerReconnect
QTimer * m_masterServerReconnect
Definition: mainserver.h:330
MainServer::DeferredDeleteStruct::sock
PlaybackSock * sock
Definition: mainserver.h:346
MainServer::HandlePixmapGetIfModified
void HandlePixmapGetIfModified(const QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:7565
MainServer::HandleMusicSaveLyrics
void HandleMusicSaveLyrics(const QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:6987
MainServer::HandleDone
void HandleDone(MythSocket *socket)
Definition: mainserver.cpp:2103
PlaybackSock
Definition: playbacksock.h:28
RenameThread::m_dst
QString m_dst
Definition: mainserver.h:110
MetadataFactory
Definition: metadatafactory.h:86
MainServer::m_masterFreeSpaceListUpdater
FreeSpaceUpdater *volatile m_masterFreeSpaceListUpdater
Definition: mainserver.h:326
MainServer::HandleGetScheduledRecordings
void HandleGetScheduledRecordings(PlaybackSock *pbs)
Definition: mainserver.cpp:3861
MainServer::m_downloadURLs
QMap< QString, QString > m_downloadURLs
Definition: mainserver.h:363
MainServer::getGuideDataThrough
static void getGuideDataThrough(QDateTime &GuideDataThrough)
Definition: mainserver.cpp:3782
MainServer::GetFileTransferBySock
FileTransfer * GetFileTransferBySock(MythSocket *socket)
Warning you must hold a sockListLock lock before calling this.
Definition: mainserver.cpp:7977
off_t
#define off_t
Definition: mythiowrapper.cpp:238
MainServer::GetSlaveByHostname
PlaybackSock * GetSlaveByHostname(const QString &hostname)
Definition: mainserver.cpp:7915
RenameThread
Definition: mainserver.h:98
MainServer::GetExitCode
int GetExitCode() const
Definition: mainserver.h:152
MainServer::HandleQueryRecordings
void HandleQueryRecordings(const QString &type, PlaybackSock *pbs)
Definition: mainserver.cpp:2162
DeleteStruct::m_recendts
QDateTime m_recendts
Definition: mainserver.h:67
MainServer::HandleQueryGuideDataThrough
void HandleQueryGuideDataThrough(PlaybackSock *pbs)
Definition: mainserver.cpp:3793
MainServer::HandleLockTuner
void HandleLockTuner(PlaybackSock *pbs, int cardid=-1)
Definition: mainserver.cpp:4263
mthreadpool.h
sched
Scheduler * sched
MainServer::DoHandleDeleteRecording
void DoHandleDeleteRecording(RecordingInfo &recinfo, PlaybackSock *pbs, bool forceMetadataDelete, bool expirer=false, bool forgetHistory=false)
Definition: mainserver.cpp:3020
MThreadPool
Definition: mthreadpool.h:18
livetvchain.h
MainServer::HandleSetSetting
void HandleSetSetting(const QStringList &tokens, PlaybackSock *pbs)
Definition: mainserver.cpp:5844
MainServer::HandleVersion
void HandleVersion(MythSocket *socket, const QStringList &slist)
Definition: mainserver.cpp:1674
DeleteStruct::m_forceMetadataDelete
bool m_forceMetadataDelete
Definition: mainserver.h:69
ProgramInfo
Holds information on recordings and videos.
Definition: programinfo.h:68
MainServer::m_playbackList
vector< PlaybackSock * > m_playbackList
Definition: mainserver.h:320
MainServer::HandleQueryCheckFile
void HandleQueryCheckFile(QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:3602
MainServer::HandleQueryFileExists
void HandleQueryFileExists(QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:3720
MainServer::HandleUndeleteRecording
void HandleUndeleteRecording(QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:3166
MainServer::m_stopped
bool m_stopped
Definition: mainserver.h:370
MainServer::HandlePixmapLastModified
void HandlePixmapLastModified(QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:7501
MainServer::m_masterBackendOverride
bool m_masterBackendOverride
Definition: mainserver.h:338
MainServer::ProcessRequest
void ProcessRequest(MythSocket *sock)
Definition: mainserver.cpp:454
MainServer::m_threadPool
MThreadPool m_threadPool
Definition: mainserver.h:336
MainServer::HandleFileTransferQuery
void HandleFileTransferQuery(QStringList &slist, QStringList &commands, PlaybackSock *pbs)
Definition: mainserver.cpp:7059
MainServer::HandleIsActiveBackendQuery
void HandleIsActiveBackendQuery(const QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:5083
MainServer::~MainServer
~MainServer() override
Definition: mainserver.cpp:354
RenameThread::m_pbs
PlaybackSock & m_pbs
Definition: mainserver.h:109
MainServer::HandleActiveBackendsQuery
void HandleActiveBackendsQuery(PlaybackSock *pbs)
Definition: mainserver.cpp:5075
MainServer::HandleQueryHostname
void HandleQueryHostname(PlaybackSock *pbs)
Definition: mainserver.cpp:3544
MythDeque
MythDeque is similar to QPtrQueue, while being based off deque, this allows that items that are not a...
Definition: mythdeque.h:29
MainServer::HandleScanVideos
void HandleScanVideos(PlaybackSock *pbs)
Definition: mainserver.cpp:5866
MainServer::HandleFreeTuner
void HandleFreeTuner(int cardid, PlaybackSock *pbs)
Definition: mainserver.cpp:4344
FileSystemInfo
Definition: filesysteminfo.h:16
MythSocketCBs::error
virtual void error(MythSocket *, int)
Definition: mythsocket_cb.h:16
MainServer::deferredDeleteSlot
void deferredDeleteSlot(void)
Definition: mainserver.cpp:7715
MainServer::m_liveTVChains
vector< LiveTVChain * > m_liveTVChains
Definition: mainserver.h:311
MainServer::HandleGetFreeRecorderCount
void HandleGetFreeRecorderCount(PlaybackSock *pbs)
MainServer::m_fsInfosCache
QList< FileSystemInfo > m_fsInfosCache
Definition: mainserver.h:359
MainServer::HandleRescheduleRecordings
void HandleRescheduleRecordings(const QStringList &request, PlaybackSock *pbs)
This function processes the received network protocol message to reschedule recordings.
Definition: mainserver.cpp:3235
MainServer::m_fsInfosCacheLock
QMutex m_fsInfosCacheLock
Definition: mainserver.h:360
MainServer::HandleMusicGetLyricGrabbers
void HandleMusicGetLyricGrabbers(const QStringList &slist, PlaybackSock *pbs)
This function processes the received network protocol message to get the names of all scripts the gra...
Definition: mainserver.cpp:6905
MainServer::m_metadatafactory
MetadataFactory * m_metadatafactory
Definition: mainserver.h:317
MainServer::SendResponse
void SendResponse(MythSocket *sock, QStringList &commands)
Definition: mainserver.cpp:2124
MainServer::m_masterFreeSpaceListWait
QWaitCondition m_masterFreeSpaceListWait
Definition: mainserver.h:327
MainServer::HandleGetRecorderFromNum
void HandleGetRecorderFromNum(QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:7204
MainServer::HandleGetConnectedRecorderList
void HandleGetConnectedRecorderList(PlaybackSock *pbs)
MainServer::m_downloadURLsLock
QMutex m_downloadURLsLock
Definition: mainserver.h:362
MainServer::HandleForgetRecording
void HandleForgetRecording(QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:3363
MainServer::GetFileTransferByID
FileTransfer * GetFileTransferByID(int id)
Warning you must hold a sockListLock lock before calling this.
Definition: mainserver.cpp:7968
MainServer::m_sockListLock
QReadWriteLock m_sockListLock
Definition: mainserver.h:319
MainServer::GetCurrentMaxBitrate
size_t GetCurrentMaxBitrate(void)
Definition: mainserver.cpp:5116
MainServer::m_fileTransferList
vector< FileTransfer * > m_fileTransferList
Definition: mainserver.h:321
MainServer::HandleSGGetFileList
void HandleSGGetFileList(QStringList &sList, PlaybackSock *pbs)
Definition: mainserver.cpp:3907
RenameThread::RenameThread
RenameThread(MainServer &ms, PlaybackSock &pbs, QString src, QString dst)
Definition: mainserver.h:100
DeleteStruct::m_size
off_t m_size
Definition: mainserver.h:71
musicbrainzngs.caa.hostname
string hostname
Definition: caa.py:17
MainServer::HandleDownloadFile
void HandleDownloadFile(const QStringList &command, PlaybackSock *pbs)
Definition: mainserver.cpp:5770
RenameThread::m_ms
MainServer & m_ms
Definition: mainserver.h:108
MainServer::SetExitCode
void SetExitCode(int exitCode, bool closeApplication)
Definition: mainserver.cpp:8042
MainServer::HandleRecorderQuery
void HandleRecorderQuery(QStringList &slist, QStringList &commands, PlaybackSock *pbs)
Definition: mainserver.cpp:4504
MainServer::m_deferredDeleteList
MythDeque< DeferredDeleteStruct > m_deferredDeleteList
Definition: mainserver.h:352
MainServer::HandleQueryUptime
void HandleQueryUptime(PlaybackSock *pbs)
Definition: mainserver.cpp:3522
MainServer::HandleGetFreeRecorderList
void HandleGetFreeRecorderList(PlaybackSock *pbs)
DeleteThread::start
void start(void)
Definition: mainserver.h:82
exitcodes.h
mythdownloadmanager.h
MainServer::HandleMoveFile
void HandleMoveFile(PlaybackSock *pbs, const QString &storagegroup, const QString &src, const QString &dst)
Definition: mainserver.cpp:5444
MainServer::HandleGenPreviewPixmap
void HandleGenPreviewPixmap(QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:7359
MainServer::HandleMusicTagAddImage
void HandleMusicTagAddImage(const QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:6532
MainServer::DoTruncateThread
void DoTruncateThread(DeleteStruct *ds)
Definition: mainserver.cpp:5524
MainServer::m_deletelock
QMutex m_deletelock
Definition: mainserver.h:335
MThreadPool::globalInstance
static MThreadPool * globalInstance(void)
Definition: mthreadpool.cpp:306
MainServer::Stop
void Stop(void)
Definition: mainserver.cpp:360
MainServer::GetActiveBackends
void GetActiveBackends(QStringList &hosts)
Definition: mainserver.cpp:5057
MainServer::HandleQueryFreeSpaceSummary
void HandleQueryFreeSpaceSummary(PlaybackSock *pbs)
Definition: mainserver.cpp:3448
mythsocket.h
TruncateThread::TruncateThread
TruncateThread(MainServer *ms, const QString &filename, int fd, off_t size)
Definition: mainserver.h:90
qt_socket_fd_t
qintptr qt_socket_fd_t
Definition: mythqtcompat.h:4
DeleteStruct::m_recordedid
uint m_recordedid
Definition: mainserver.h:68
FreeSpaceUpdater
Definition: mainserver.cpp:172
MThreadPool::startReserved
void startReserved(QRunnable *runnable, const QString &debugName, int waitForAvailMS=0)
Definition: mthreadpool.cpp:360
MainServer::m_sched
Scheduler * m_sched
Definition: mainserver.h:340
MainServer::DoDeleteInDB
static void DoDeleteInDB(DeleteStruct *ds)
Definition: mainserver.cpp:2594
MThreadPool::start
void start(QRunnable *runnable, const QString &debugName, int priority=0)
Definition: mthreadpool.cpp:341
MainServer::DoDeleteThread
void DoDeleteThread(DeleteStruct *ds)
Definition: mainserver.cpp:2373
MainServer::connectionFailed
void connectionFailed(MythSocket *socket) override
Definition: mainserver.h:139
MainServer::HandleFillProgramInfo
void HandleFillProgramInfo(QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:2334
MainServer::HandleAddChildInput
bool HandleAddChildInput(uint inputid)
Definition: mainserver.cpp:3255
MainServer::HandleSetChannelInfo
void HandleSetChannelInfo(QStringList &slist, PlaybackSock *pbs)
Definition: mainserver.cpp:4908
DeleteStruct::m_ms
MainServer * m_ms
Definition: mainserver.h:62
MainServer::HandleBookmarkQuery
void HandleBookmarkQuery(const QString &chanid, const QString &starttime, PlaybackSock *pbs)
Definition: mainserver.cpp:5689
LiveTVChain
Keeps track of recordings in a current LiveTV instance.
Definition: livetvchain.h:32