Skip to content
Permalink
Browse files

Remove the UPnP Video scanner

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 Aug 22, 2010
1 parent 5366399 commit e3b63db691422f3116c10bb0bff61b5d89c833a1
@@ -303,15 +303,6 @@ void log_rotate_handler(int)
log_rotate(0);
}

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

}

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

if (cmdline.WantUPnPRebuild())
{
VERBOSE(VB_GENERAL, "Rebuilding UPNP Media Map");

UPnpMedia *rebuildit = new UPnpMedia(false,false);
rebuildit->BuildMediaMap();
VERBOSE(VB_GENERAL, "Rebuilding UPNP Media Map is no longer supported. Rescan videos using MythVideo.");

return BACKEND_EXIT_OK;
}
@@ -770,12 +758,6 @@ int run_backend(const MythCommandLineParser &cmdline)
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")
.arg(verboseString));

@@ -15,7 +15,6 @@
#include "upnpcdstv.h"
#include "upnpcdsmusic.h"
#include "upnpcdsvideo.h"
#include "upnpmedia.h"

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

RegisterExtension(new UPnpCDSVideo());

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

// VERBOSE(VB_UPNP, QString( "MediaServer::Adding Context Listener" ));
@@ -17,7 +17,6 @@
#include "upnpcds.h"
#include "upnpcmgr.h"
#include "upnpmsrr.h"
#include "upnpmedia.h"

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

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

QString m_sSharePath;

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

virtual ~MediaServer();

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

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

@@ -21,13 +21,13 @@ QMAKE_CLEAN += $(TARGET)
HEADERS += autoexpire.h encoderlink.h filetransfer.h httpstatus.h mainserver.h
HEADERS += playbacksock.h scheduler.h server.h housekeeper.h backendutil.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 += main.cpp mainserver.cpp playbacksock.cpp scheduler.cpp server.cpp
SOURCES += housekeeper.cpp backendutil.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

@@ -867,7 +867,7 @@ void MythXML::GetVideoArt( HTTPRequest *pRequest )

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);

if (!query.exec())
@@ -890,6 +890,24 @@ void MythXML::GetVideoArt( HTTPRequest *pRequest )
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 )
@@ -1752,8 +1770,6 @@ void MythXML::GetVideo( HttpWorkerThread *pThread,

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

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

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 );

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

if (query.next())
{
pRequest->m_sFileName = QString( "%1/%2" ).arg( sBasePath )
.arg( query.value(0).toString() );
QString sFileName = query.value(0).toString();

if (!QFile::exists( sFileName ))
{
StorageGroup sgroup("Videos");
sFileName = sgroup.FindRecordingFile( sFileName );
}

pRequest->m_sFileName = sFileName;
}
}

0 comments on commit e3b63db

Please sign in to comment.
You can’t perform that action at this time.