Browse files

Add a SCAN_MUSIC command to the myth protocol

For the moment it just runs mythutil --scanmusic on the master BE
  • Loading branch information...
1 parent 8ed610f commit 8aefe1bcf0f855d33b542083f185d7ae829436b3 Paul Harrison committed Jan 18, 2014
Showing with 21 additions and 0 deletions.
  1. +20 −0 mythtv/programs/mythbackend/mainserver.cpp
  2. +1 −0 mythtv/programs/mythbackend/mainserver.h
View
20 mythtv/programs/mythbackend/mainserver.cpp
@@ -793,6 +793,10 @@ void MainServer::ProcessRequestWork(MythSocket *sock)
{
HandleScanVideos(pbs);
}
+ else if (command == "SCAN_MUSIC")
+ {
+ HandleScanMusic(pbs);
+ }
else if (command == "ALLOW_SHUTDOWN")
{
if (tokens.size() != 1)
@@ -5152,6 +5156,22 @@ void MainServer::HandleScanVideos(PlaybackSock *pbs)
SendResponse(pbssock, retlist);
}
+void MainServer::HandleScanMusic(PlaybackSock *pbs)
+{
+ MythSocket *pbssock = pbs->getSocket();
+
+ QStringList retlist;
+
+ QScopedPointer<MythSystem> cmd(MythSystem::Create("mythutil --scanmusic",
+ kMSAutoCleanup | kMSRunBackground |
+ kMSDontDisableDrawing | kMSProcessEvents |
+ kMSDontBlockInputDevs));
+ retlist << "OK";
+
+ if (pbssock)
+ SendResponse(pbssock, retlist);
+}
+
void MainServer::HandleFileTransferQuery(QStringList &slist,
QStringList &commands,
PlaybackSock *pbs)
View
1 mythtv/programs/mythbackend/mainserver.h
@@ -216,6 +216,7 @@ class MainServer : public QObject, public MythSocketCBs
void HandleSettingQuery(QStringList &tokens, PlaybackSock *pbs);
void HandleSetSetting(QStringList &tokens, PlaybackSock *pbs);
void HandleScanVideos(PlaybackSock *pbs);
+ void HandleScanMusic(PlaybackSock *pbs);
void HandleVersion(MythSocket *socket, const QStringList &slist);
void HandleBackendRefresh(MythSocket *socket);
void HandleQueryLoad(PlaybackSock *pbs);

0 comments on commit 8aefe1b

Please sign in to comment.