Skip to content

Commit

Permalink
Remove the UPnP Video scanner
Browse files Browse the repository at this point in the history
Since the backend now does the scanning via the MythVideo plugin inherently,
there is no longer the need to scan again using the UPnP Media Scanner code.
It has been removed, and the corresponding data is now coming from the
videometadata table of the db.  The upnpmedia table should be removed shortly.

Original patch from #8801 by mattpyne@yahoo.co.uk

Modified to include subtitle where applicable
  • Loading branch information
Beirdo committed Feb 12, 2011
1 parent 5366399 commit e3b63db
Show file tree
Hide file tree
Showing 9 changed files with 138 additions and 628 deletions.
20 changes: 1 addition & 19 deletions mythtv/programs/mythbackend/main_helpers.cpp
Expand Up @@ -303,15 +303,6 @@ void log_rotate_handler(int)
log_rotate(0); log_rotate(0);
} }


void upnp_rebuild(int)
{
if (gCoreContext->IsMasterHost())
{
g_pUPnp->RebuildMediaMap();
}

}

void showUsage(const MythCommandLineParser &cmdlineparser, const QString &version) void showUsage(const MythCommandLineParser &cmdlineparser, const QString &version)
{ {
QString help = cmdlineparser.GetHelpString(false); QString help = cmdlineparser.GetHelpString(false);
Expand Down Expand Up @@ -430,10 +421,7 @@ int handle_command(const MythCommandLineParser &cmdline)


if (cmdline.WantUPnPRebuild()) if (cmdline.WantUPnPRebuild())
{ {
VERBOSE(VB_GENERAL, "Rebuilding UPNP Media Map"); VERBOSE(VB_GENERAL, "Rebuilding UPNP Media Map is no longer supported. Rescan videos using MythVideo.");

UPnpMedia *rebuildit = new UPnpMedia(false,false);
rebuildit->BuildMediaMap();


return BACKEND_EXIT_OK; return BACKEND_EXIT_OK;
} }
Expand Down Expand Up @@ -770,12 +758,6 @@ int run_backend(const MythCommandLineParser &cmdline)
pHS->RegisterExtension(httpStatus); pHS->RegisterExtension(httpStatus);
} }


if (ismaster)
{
// kill -USR1 mythbackendpid will force a upnpmedia rebuild
signal(SIGUSR1, &upnp_rebuild);
}

VERBOSE(VB_IMPORTANT, QString("Enabled verbose msgs: %1") VERBOSE(VB_IMPORTANT, QString("Enabled verbose msgs: %1")
.arg(verboseString)); .arg(verboseString));


Expand Down
4 changes: 0 additions & 4 deletions mythtv/programs/mythbackend/mediaserver.cpp
Expand Up @@ -15,7 +15,6 @@
#include "upnpcdstv.h" #include "upnpcdstv.h"
#include "upnpcdsmusic.h" #include "upnpcdsmusic.h"
#include "upnpcdsvideo.h" #include "upnpcdsvideo.h"
#include "upnpmedia.h"


////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -177,9 +176,6 @@ MediaServer::MediaServer( bool bIsMaster, bool bDisableUPnp /* = FALSE */ )
VERBOSE(VB_UPNP, "MediaServer::Registering UPnpCDSVideo Extension"); VERBOSE(VB_UPNP, "MediaServer::Registering UPnpCDSVideo Extension");


RegisterExtension(new UPnpCDSVideo()); RegisterExtension(new UPnpCDSVideo());

upnpMedia = new UPnpMedia(true,true);
//upnpMedia->BuildMediaMap();
} }


// VERBOSE(VB_UPNP, QString( "MediaServer::Adding Context Listener" )); // VERBOSE(VB_UPNP, QString( "MediaServer::Adding Context Listener" ));
Expand Down
4 changes: 0 additions & 4 deletions mythtv/programs/mythbackend/mediaserver.h
Expand Up @@ -17,7 +17,6 @@
#include "upnpcds.h" #include "upnpcds.h"
#include "upnpcmgr.h" #include "upnpcmgr.h"
#include "upnpmsrr.h" #include "upnpmsrr.h"
#include "upnpmedia.h"


////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
Expand All @@ -34,7 +33,6 @@ class MediaServer : public UPnp


UPnpCDS *m_pUPnpCDS; // Do not delete (auto deleted) UPnpCDS *m_pUPnpCDS; // Do not delete (auto deleted)
UPnpCMGR *m_pUPnpCMGR; // Do not delete (auto deleted) UPnpCMGR *m_pUPnpCMGR; // Do not delete (auto deleted)
UPnpMedia *upnpMedia;


QString m_sSharePath; QString m_sSharePath;


Expand All @@ -43,8 +41,6 @@ class MediaServer : public UPnp


virtual ~MediaServer(); virtual ~MediaServer();


void RebuildMediaMap(void) { upnpMedia->BuildMediaMap(); };

void RegisterExtension ( UPnpCDSExtension *pExtension ); void RegisterExtension ( UPnpCDSExtension *pExtension );
void UnregisterExtension( UPnpCDSExtension *pExtension ); void UnregisterExtension( UPnpCDSExtension *pExtension );


Expand Down
4 changes: 2 additions & 2 deletions mythtv/programs/mythbackend/mythbackend.pro
Expand Up @@ -21,13 +21,13 @@ QMAKE_CLEAN += $(TARGET)
HEADERS += autoexpire.h encoderlink.h filetransfer.h httpstatus.h mainserver.h HEADERS += autoexpire.h encoderlink.h filetransfer.h httpstatus.h mainserver.h
HEADERS += playbacksock.h scheduler.h server.h housekeeper.h backendutil.h HEADERS += playbacksock.h scheduler.h server.h housekeeper.h backendutil.h
HEADERS += upnpcdstv.h upnpcdsmusic.h upnpcdsvideo.h mediaserver.h HEADERS += upnpcdstv.h upnpcdsmusic.h upnpcdsvideo.h mediaserver.h
HEADERS += mythxml.h upnpmedia.h main_helpers.h backendcontext.h HEADERS += mythxml.h main_helpers.h backendcontext.h


SOURCES += autoexpire.cpp encoderlink.cpp filetransfer.cpp httpstatus.cpp SOURCES += autoexpire.cpp encoderlink.cpp filetransfer.cpp httpstatus.cpp
SOURCES += main.cpp mainserver.cpp playbacksock.cpp scheduler.cpp server.cpp SOURCES += main.cpp mainserver.cpp playbacksock.cpp scheduler.cpp server.cpp
SOURCES += housekeeper.cpp backendutil.cpp SOURCES += housekeeper.cpp backendutil.cpp
SOURCES += upnpcdstv.cpp upnpcdsmusic.cpp upnpcdsvideo.cpp mediaserver.cpp SOURCES += upnpcdstv.cpp upnpcdsmusic.cpp upnpcdsvideo.cpp mediaserver.cpp
SOURCES += mythxml.cpp upnpmedia.cpp main_helpers.cpp backendcontext.cpp SOURCES += mythxml.cpp main_helpers.cpp backendcontext.cpp


using_oss:DEFINES += USING_OSS using_oss:DEFINES += USING_OSS


Expand Down
35 changes: 29 additions & 6 deletions mythtv/programs/mythbackend/mythxml.cpp
Expand Up @@ -867,7 +867,7 @@ void MythXML::GetVideoArt( HTTPRequest *pRequest )


MSqlQuery query(MSqlQuery::InitCon()); MSqlQuery query(MSqlQuery::InitCon());


query.prepare("SELECT coverart FROM upnpmedia WHERE intid = :ITEMID"); query.prepare("SELECT coverfile FROM videometadata WHERE intid = :ITEMID");
query.bindValue(":ITEMID", sId); query.bindValue(":ITEMID", sId);


if (!query.exec()) if (!query.exec())
Expand All @@ -890,6 +890,24 @@ void MythXML::GetVideoArt( HTTPRequest *pRequest )
return; return;
} }


// ----------------------------------------------------------------------
// Not there? Perhaps we need to look in a storage group?
// ----------------------------------------------------------------------
StorageGroup sgroup("Coverart");
sFileName = sgroup.FindRecordingFile( sFileName );

if (sFileName != "")
{
VERBOSE(VB_IMPORTANT, QString("Found coverart '%1'").arg(sFileName));

pRequest->m_eResponseType = ResponseTypeFile;
pRequest->m_nResponseStatus = 200;
pRequest->m_sFileName = sFileName;
return;
}

VERBOSE(VB_IMPORTANT, QString("Not found '%1'").arg(sFileName));

} }


void MythXML::GetAlbumArt( HTTPRequest *pRequest ) void MythXML::GetAlbumArt( HTTPRequest *pRequest )
Expand Down Expand Up @@ -1752,8 +1770,6 @@ void MythXML::GetVideo( HttpWorkerThread *pThread,


if (pData == NULL) if (pData == NULL)
{ {
QString sBasePath = "";

// ------------------------------------------------------------------ // ------------------------------------------------------------------
// Load Track's FileName // Load Track's FileName
// ------------------------------------------------------------------ // ------------------------------------------------------------------
Expand All @@ -1762,7 +1778,7 @@ void MythXML::GetVideo( HttpWorkerThread *pThread,


if (query.isConnected()) if (query.isConnected())
{ {
query.prepare("SELECT filepath FROM upnpmedia WHERE intid = :KEY" ); query.prepare("SELECT filename FROM videometadata WHERE intid = :KEY" );
query.bindValue(":KEY", sId ); query.bindValue(":KEY", sId );


if (!query.exec()) if (!query.exec())
Expand All @@ -1773,8 +1789,15 @@ void MythXML::GetVideo( HttpWorkerThread *pThread,


if (query.next()) if (query.next())
{ {
pRequest->m_sFileName = QString( "%1/%2" ).arg( sBasePath ) QString sFileName = query.value(0).toString();
.arg( query.value(0).toString() );
if (!QFile::exists( sFileName ))
{
StorageGroup sgroup("Videos");
sFileName = sgroup.FindRecordingFile( sFileName );
}

pRequest->m_sFileName = sFileName;
} }
} }


Expand Down

0 comments on commit e3b63db

Please sign in to comment.