Beispiel #1
0
MetaGrabberScript::MetaGrabberScript(const QString &path) :
    m_type(kGrabberInvalid), m_version(0.0), m_valid(false)
{
    if (path.isEmpty())
        return;
    m_fullcommand = path;
    if (path[0] != '/')
        m_fullcommand.prepend(QString("%1metadata").arg(GetShareDir()));

    MythSystemLegacy grabber(path, QStringList() << "-v",
                             kMSRunShell | kMSStdOut);
    grabber.Run();
    if (grabber.Wait() != GENERIC_EXIT_OK)
        // script failed
        return;

    QByteArray result = grabber.ReadAll();
    if (result.isEmpty())
        // no output
        return;

    QDomDocument doc;
    doc.setContent(result, true);
    QDomElement root = doc.documentElement();
    if (root.isNull())
        // no valid XML
        return;

    ParseGrabberVersion(root);
    if (m_name.isEmpty())
        // XML not processed correctly
        return;

    m_valid = true;
}
Beispiel #2
0
bool HardwareProfile::DeleteProfile(void)
{
    if (m_uuid.isEmpty())
        return false;

    LOG(VB_GENERAL, LOG_INFO,
             QString("Deleting the following hardware profile: %1")
                     .arg(m_uuid));

    QString cmd = GetShareDir() + "hardwareprofile/deleteProfile.py";
    QStringList args;
    MythSystemLegacy system(cmd, args, kMSRunShell | kMSStdOut);

    system.Run();
    if (system.Wait() == GENERIC_EXIT_OK)
    {
        gCoreContext->SaveSetting("HardwareProfileUUID", "");
        gCoreContext->SaveSetting("HardwareProfilePublicUUID", "");
        Disable();
        return true;
    }
    else
        return false;

    return false;
}
ScreenListMap loadScreens()
{
    ScreenListMap screens;
    QStringList searchpath = GetMythUI()->GetThemeSearchPath();

    // Check the theme first if it has its own weather-screens.xml

    QStringList::iterator it;
    for (it = searchpath.begin(); it != searchpath.end(); ++it)
    {
        QString filename = (*it) + "weather-screens.xml";
        if (doLoadScreens(filename, screens))
        {
            LOG(VB_GENERAL, LOG_INFO,
                QString("Loading from: %1").arg(filename));
            break;
        }
    }

    //  Also load from the default file in case the theme file doesn't
    //  exist or the theme file doesn't define all the screens

    QString filename = GetShareDir() + "mythweather/weather-screens.xml";

    if (!doLoadScreens(filename, screens))
    {
        LOG(VB_GENERAL, LOG_ERR,
            QString("Unable to parse weather-screens.xml"));
    }

    return screens;
}
Beispiel #4
0
// Load the font.  Copied, generally, from OSD::LoadFont.
bool MHIContext::LoadFont(QString name)
{
    QString fullnameA = GetConfDir() + "/" + name;
    QByteArray fnameA = fullnameA.toAscii();
    FT_Error errorA = FT_New_Face(ft_library, fnameA.constData(), 0, &m_face);
    if (!errorA)
        return true;

    QString fullnameB = GetFontsDir() + name;
    QByteArray fnameB = fullnameB.toAscii();
    FT_Error errorB = FT_New_Face(ft_library, fnameB.constData(), 0, &m_face);
    if (!errorB)
        return true;

    QString fullnameC = GetShareDir() + "themes/" + name;
    QByteArray fnameC = fullnameC.toAscii();
    FT_Error errorC = FT_New_Face(ft_library, fnameC.constData(), 0, &m_face);
    if (!errorC)
        return true;

    QString fullnameD = name;
    QByteArray fnameD = fullnameD.toAscii();
    FT_Error errorD = FT_New_Face(ft_library, fnameD.constData(), 0, &m_face);
    if (!errorD)
        return true;

    LOG(VB_GENERAL, LOG_ERR, QString("[mhi] Unable to find font: %1").arg(name));
    return false;
}
Beispiel #5
0
void SearchEditor::fillGrabberButtonList()
{
    for (GrabberScript::scriptList::iterator i = m_grabberList.begin();
            i != m_grabberList.end(); ++i)
    {
        MythUIButtonListItem *item =
                    new MythUIButtonListItem(m_grabbers, (*i)->GetTitle());
        if (item)
        {
            item->SetText((*i)->GetTitle(), "title");
            item->SetData(qVariantFromValue(*i));
            QString img = (*i)->GetImage();
            QString thumb;
            if (!img.startsWith("/") && !img.isEmpty())
                thumb = QString("%1mythnetvision/icons/%2").arg(GetShareDir())
                            .arg((*i)->GetImage());
            else
                thumb = img;
            item->SetImage(thumb);
            item->setCheckable(true);
            item->setChecked(MythUIButtonListItem::NotChecked);
            QFileInfo fi((*i)->GetCommandline());
            if (findSearchGrabberInDB(fi.fileName(), VIDEO))
                item->setChecked(MythUIButtonListItem::FullChecked);
        }
        else
            delete item;
    }
}
Beispiel #6
0
GrabberScript* findSearchGrabberByCommand(const QString& commandline,
                                          ArticleType type)
{
    MSqlQuery query(MSqlQuery::InitCon());
    query.prepare("SELECT name,thumbnail,author,description,commandline,"
                  "version,search,tree FROM internetcontent "
                  "WHERE commandline = :COMMAND AND "
                  "type = :TYPE AND host = :HOST AND "
                  "search = 1;");
    QFileInfo fi(commandline);
    query.bindValue(":COMMAND", fi.fileName());
    query.bindValue(":HOST", gCoreContext->GetHostName());
    query.bindValue(":TYPE", type);
    if (!query.exec() || !query.isActive()) {
        MythDB::DBError("Search find in db", query);
    }

    QString title = query.value(0).toString();
    QString image = query.value(1).toString();
    QString author = query.value(2).toString();
    QString desc = query.value(3).toString();
    QString command = QString("%1/internetcontent/%2").arg(GetShareDir())
                        .arg(query.value(4).toString());
    double ver = query.value(5).toDouble();
    bool search = query.value(6).toBool();
    bool tree = query.value(7).toBool();

    GrabberScript *tmp = new GrabberScript(title, image, type, author, search,
                                     tree, desc, command, ver);
    return tmp;
}
Beispiel #7
0
GrabberScript::scriptList findAllDBSearchGrabbers(ArticleType type)
{
    MSqlQuery query(MSqlQuery::InitCon());
    query.prepare("SELECT name,thumbnail,author,description,commandline,"
                  "version,search,tree FROM internetcontent "
                  "WHERE host = :HOST AND type = :TYPE "
                  "AND search = 1 ORDER BY name;");
    query.bindValue(":HOST", gCoreContext->GetHostName());
    query.bindValue(":TYPE", type);
    if (!query.exec() || !query.isActive()) {
        MythDB::DBError("Search find in db", query);
    }

    GrabberScript::scriptList tmp;

    while (query.next())
    {
        QString title = query.value(0).toString();
        QString image = query.value(1).toString();
        QString author = query.value(2).toString();
        QString desc = query.value(3).toString();
        QString commandline = QString("%1/internetcontent/%2").arg(GetShareDir())
                            .arg(query.value(4).toString());
        double ver = query.value(5).toDouble();
        bool search = query.value(6).toBool();
        bool tree = query.value(7).toBool();

        GrabberScript *script = new GrabberScript(title, image, type, author, search,
                                     tree, desc, commandline, ver);
        tmp.append(script);
    }

    return tmp;
}
Beispiel #8
0
HttpServer::HttpServer() : QTcpServer(), ThreadPool("HTTP")
{
    setMaxPendingConnections(20);
    InitializeThreads();

    // ----------------------------------------------------------------------
    // Build Platform String
    // ----------------------------------------------------------------------

#ifdef USING_MINGW
    g_sPlatform = QString( "Windows %1.%1" )
        .arg(LOBYTE(LOWORD(GetVersion())))
        .arg(HIBYTE(LOWORD(GetVersion())));
#else
    struct utsname uname_info;

    uname( &uname_info );

    g_sPlatform = QString( "%1 %2" ).arg( uname_info.sysname )
                                    .arg( uname_info.release );
#endif

    // ----------------------------------------------------------------------
    // Initialize Share Path
    // ----------------------------------------------------------------------

    m_sSharePath = GetShareDir();
    VERBOSE(VB_UPNP, QString( "HttpServer() - SharePath = %1")
            .arg(m_sSharePath));

    // -=>TODO: Load Config XML
    // -=>TODO: Load & initialize - HttpServerExtensions
}
bool HardwareProfile::SubmitProfile(void)
{
    if (m_uuid.isEmpty())
        return false;

    if (!m_hardwareProfile.isEmpty())
        LOG(VB_GENERAL, LOG_INFO,
                 QString("Submitting the following hardware profile:  %1")
                         .arg(m_hardwareProfile));

    QString cmd = GetShareDir() + "hardwareprofile/sendProfile.py";
    QStringList args;
    args << "--submitOnly";
    args << "-a";
    MythSystemLegacy system(cmd, args, kMSRunShell | kMSStdOut);

    system.Run();
    if (system.Wait() == GENERIC_EXIT_OK)
    {
        GenerateUUIDs();
        gCoreContext->SaveSetting("HardwareProfileUUID", GetPrivateUUID());
        gCoreContext->SaveSetting("HardwareProfilePublicUUID", GetPublicUUID());
        gCoreContext->SaveSetting("HardwareProfileLastUpdated",
                                  MythDate::current_iso_string());
        return true;
    }
    else
        return false;

    return false;
}
Beispiel #10
0
bool HardwareProfile::SubmitProfile(void)
{
    if (m_uuid.isEmpty())
        return false;

    if (!m_hardwareProfile.isEmpty())
        VERBOSE(VB_GENERAL, QString("Submitting the following hardware profile:\n%1")
                            .arg(m_hardwareProfile));

    QString cmd = GetShareDir() + "hardwareprofile/sendProfile.py";
    QStringList args;
    args << "--submitOnly";
    args << "-a";
    MythSystem system(cmd, args, kMSRunShell | kMSStdOut | kMSBuffered);

    system.Run();
    if (system.Wait() == GENERIC_EXIT_OK)
    {
        GenerateUUIDs();
        gCoreContext->SaveSetting("HardwareProfileUUID", GetPrivateUUID());
        gCoreContext->SaveSetting("HardwareProfilePublicUUID", GetPublicUUID());
        gCoreContext->SaveSetting("HardwareProfileLastUpdated",
                                  QDateTime::currentDateTime().toString(Qt::ISODate));
        return true;
    }
    else
        return false;

    return false;
}
Beispiel #11
0
bool HardwareProfile::DeleteProfile(void)
{
    if (m_uuid.isEmpty())
        return false;

    VERBOSE(VB_GENERAL, QString("Deleting the following hardware profile: %1")
                            .arg(m_uuid));

    QString cmd = GetShareDir() + "hardwareprofile/deleteProfile.py";
    QStringList args;
    MythSystem system(cmd, args, kMSRunShell | kMSStdOut | kMSBuffered);

    system.Run();
    if (system.Wait() == GENERIC_EXIT_OK)
    {
        gCoreContext->SaveSetting("HardwareProfileUUID", "");
        gCoreContext->SaveSetting("HardwareProfilePublicUUID", "");
        gCoreContext->SaveSetting("HardwareProfileLastUpdated",
                                  QDateTime::currentDateTime().toString(Qt::ISODate));
        return true;
    }
    else
        return false;

    return false;
}
Beispiel #12
0
MetadataLookupList MetadataDownload::handleVideoUndetermined(
                                                    MetadataLookup* lookup)
{
    MetadataLookupList list;

    QString def_cmd = QDir::cleanPath(QString("%1/%2")
        .arg(GetShareDir())
        .arg("metadata/Television/ttvdb.py"));

    QString cmd = gCoreContext->GetSetting("TelevisionGrabber", def_cmd);

    // Can't trust the inetref with so little information.

    QStringList args;
    args.append(QString("-l")); // Language Flag
    args.append(gCoreContext->GetLanguage()); // UI Language
    args.append(QString("-N"));
    QString title = lookup->GetTitle();
    args.append(ShellEscape(title));
    QString subtitle = lookup->GetSubtitle();
    args.append(ShellEscape(subtitle));

    // Try to do a title/subtitle lookup
    list = runGrabber(cmd, args, lookup, false);

    // If there were no results for that, fall back to a movie lookup.
    if (!list.size())
        list = handleMovie(lookup);

    if (list.count() == 1)
        list.at(0)->SetStep(GETDATA);

    return list;
}
Beispiel #13
0
HttpServer::HttpServer(const QString &sApplicationPrefix) :
    ServerPool(), m_sSharePath(GetShareDir()),
    m_pHtmlServer(new HtmlServerExtension(m_sSharePath, sApplicationPrefix)),
    m_threadPool("HttpServerPool"), m_running(true)
{
    setMaxPendingConnections(20);

    // ----------------------------------------------------------------------
    // Build Platform String
    // ----------------------------------------------------------------------
    {
        QMutexLocker locker(&s_platformLock);
#ifdef _WIN32
        s_platform = QString("Windows %1.%2")
            .arg(LOBYTE(LOWORD(GetVersion())))
            .arg(HIBYTE(LOWORD(GetVersion())));
#else
        struct utsname uname_info;
        uname( &uname_info );
        s_platform = QString("%1 %2")
            .arg(uname_info.sysname).arg(uname_info.release);
#endif
    }

    LOG(VB_UPNP, LOG_INFO, QString("HttpServer() - SharePath = %1")
            .arg(m_sSharePath));

    // -=>TODO: Load Config XML
    // -=>TODO: Load & initialize - HttpServerExtensions
}
Beispiel #14
0
GrabberList MetaGrabberScript::GetList(GrabberType type,
                                       bool refresh)
{
    InitializeStaticMaps();

    GrabberList tmpGrabberList, retGrabberList;
    {
        QMutexLocker listLock(&grabberLock);
        QDateTime now = MythDate::current();

        // refresh grabber scripts every 60 seconds
        // this might have to be revised, or made more intelligent if
        // the delay during refreshes is too great
        if (refresh || !grabberAge.isValid() ||
            (grabberAge.secsTo(now) > kGrabberRefresh))
        {
            grabberList.clear();
            LOG(VB_GENERAL, LOG_DEBUG, LOC + "Clearing grabber cache");

            // loop through different types of grabber scripts and the 
            // directories they are stored in
            QMap<GrabberType, GrabberOpts>::const_iterator it;
            for (it = grabberTypes.begin(); it != grabberTypes.end(); ++it)
            {
                QString path = (it->path).arg(GetShareDir());
                QStringList scripts = QDir(path).entryList(QDir::Files);
                if (scripts.count() == 0)
                    // no scripts found
                    continue;

                // loop through discovered scripts
                QStringList::const_iterator it2 = scripts.begin();
                for (; it2 != scripts.end(); ++it2)
                {
                    QString cmd = QString("%1%2").arg(path).arg(*it2);
                    MetaGrabberScript script(cmd);

                    if (script.IsValid())
                    {
                        LOG(VB_GENERAL, LOG_DEBUG, LOC + "Adding " + script.m_command);
                        grabberList.append(script);
                    }
                 }
            }

            grabberAge = now;
        }

        tmpGrabberList = grabberList;
    }

    GrabberList::const_iterator it = tmpGrabberList.begin();
    for (; it != tmpGrabberList.end(); ++it)
    {
        if ((type == kGrabberAll) || (it->GetType() == type))
            retGrabberList.append(*it);
    }

    return retGrabberList;
}
Beispiel #15
0
/** \brief Locates the appropriate menu file from which to parse the menu
 *
 *  \param menuname file name of the menu you want to find
 *  \return the directory in which the menu file is found
 */
QString MythThemedMenu::findMenuFile(const QString &menuname)
{
    QString testdir = GetConfDir() + '/' + menuname;
    QFile file(testdir);
    if (file.exists())
        return testdir;
    else
        LOG(VB_FILE, LOG_DEBUG, "No menu file " + testdir);

    testdir = GetMythUI()->GetMenuThemeDir() + '/' + menuname;
    file.setFileName(testdir);
    if (file.exists())
        return testdir;
    else
        LOG(VB_FILE, LOG_DEBUG, "No menu file " + testdir);

    testdir = GetMythUI()->GetThemeDir() + '/' + menuname;
    file.setFileName(testdir);
    if (file.exists())
        return testdir;
    else
        LOG(VB_FILE, LOG_DEBUG, "No menu file " + testdir);

    testdir = GetShareDir() + menuname;
    file.setFileName(testdir);
    if (file.exists())
        return testdir;
    else
        LOG(VB_FILE, LOG_DEBUG, "No menu file " + testdir);

    testdir = "../mythfrontend/" + menuname;
    file.setFileName(testdir);
    if (file.exists())
        return testdir;
    else
        LOG(VB_FILE, LOG_DEBUG, "No menu file " + testdir);

    testdir = GetShareDir() + "themes/defaultmenu/" + menuname;
    file.setFileName(testdir);
    if (file.exists())
        return testdir;
    else
        LOG(VB_FILE, LOG_DEBUG, "No menu file " + testdir);

    return QString();
}
Beispiel #16
0
QString MetaGrabberScript::GetRelPath(void) const
{
    QString share = GetShareDir();
    if (m_fullcommand.startsWith(share))
        return m_fullcommand.right(m_fullcommand.size() - share.size());

    return QString();
}
Beispiel #17
0
static HostLineEdit *MythArchiveShareDir()
{
    HostLineEdit *gc = new HostLineEdit("MythArchiveShareDir");
    gc->setLabel(QObject::tr("MythArchive Share Directory"));
    gc->setValue(GetShareDir() + "mytharchive/");
    gc->setHelpText(QObject::tr("Location where MythArchive stores its scripts, "
            "intro movies and theme files"));
    return gc;
};
Beispiel #18
0
QString MetadataDownload::GetTelevisionGrabber()
{
    QString def_cmd = "metadata/Television/ttvdb.py";
    QString db_cmd = gCoreContext->GetSetting("TelevisionGrabber", def_cmd);

    return QDir::cleanPath(QString("%1/%2")
            .arg(GetShareDir())
            .arg(db_cmd));
}
Beispiel #19
0
QString MetadataDownload::GetGameGrabber()
{
    QString def_cmd = "metadata/Game/giantbomb.py";
    QString db_cmd = gCoreContext->GetSetting("mythgame.MetadataGrabber", def_cmd);

    return QDir::cleanPath(QString("%1/%2")
            .arg(GetShareDir())
            .arg(db_cmd));
}
Beispiel #20
0
QString MetadataDownload::GetMovieGrabber()
{
    QString def_cmd = "metadata/Movie/tmdb.py";
    QString db_cmd = gCoreContext->GetSetting("MovieGrabber", def_cmd);

    return QDir::cleanPath(QString("%1/%2")
            .arg(GetShareDir())
            .arg(db_cmd));
}
Beispiel #21
0
QString HardwareProfile::GetHardwareProfile() const
{
    QString cmd = GetShareDir() + "hardwareprofile/sendProfile.py";
    QStringList args;
    args << "-p";
    MythSystemLegacy system(cmd, args, kMSRunShell | kMSStdOut);

    system.Run();
    system.Wait();
    return system.ReadAll();
}
Beispiel #22
0
MetadataLookupList MetadataDownload::handleMovie(MetadataLookup* lookup)
{
    MetadataLookupList list;

    QString mxml;
    QString nfo;

    if (!lookup->GetFilename().isEmpty())
    {
        mxml = getMXMLPath(lookup->GetFilename());
        nfo = getNFOPath(lookup->GetFilename());
    }

    if (mxml.isEmpty() && nfo.isEmpty())
    {
        QString def_cmd = QDir::cleanPath(QString("%1/%2")
            .arg(GetShareDir())
            .arg("metadata/Movie/tmdb.py"));

        QString cmd = gCoreContext->GetSetting("MovieGrabber", def_cmd);

        QStringList args;
        args.append(QString("-l")); // Language Flag
        args.append(gCoreContext->GetLanguage()); // UI Language

        // If the inetref is populated, even in kLookupSearch mode,
        // become a kLookupData grab and use that.
        if (lookup->GetStep() == kLookupSearch &&
            (!lookup->GetInetref().isEmpty() &&
             lookup->GetInetref() != "00000000"))
            lookup->SetStep(kLookupData);

        if (lookup->GetStep() == kLookupSearch)
        {
            args.append(QString("-M"));
            QString title = lookup->GetTitle();
            args.append(title);
        }
        else if (lookup->GetStep() == kLookupData)
        {
            args.append(QString("-D"));
            args.append(lookup->GetInetref());
        }
        list = runGrabber(cmd, args, lookup);
    }
    else if (!mxml.isEmpty())
        list = readMXML(mxml, lookup);
    else if (!nfo.isEmpty())
        list = readNFO(nfo, lookup);

    return list;
}
Beispiel #23
0
static HostFileBrowserSetting *MythArchiveShareDir()
{
    HostFileBrowserSetting *gc = new HostFileBrowserSetting("MythArchiveShareDir");

    gc->setLabel(ArchiveSettings::tr("MythArchive Share Directory"));
    gc->setValue(GetShareDir() + "mytharchive/");

    gc->setHelpText(ArchiveSettings::tr("Location where MythArchive stores its "
                                        "scripts, intro movies and theme "
                                        "files"));
    gc->SetTypeFilter(QDir::AllDirs | QDir::Hidden);

    return gc;
};
Beispiel #24
0
MetadataLookupList MetadataDownload::handleTelevision(MetadataLookup* lookup)
{
    MetadataLookupList list;

    QString def_cmd = QDir::cleanPath(QString("%1/%2")
        .arg(GetShareDir())
        .arg("metadata/Television/ttvdb.py"));

    QString cmd = gCoreContext->GetSetting("TelevisionGrabber", def_cmd);

    QStringList args;
    args.append(QString("-l")); // Language Flag
    args.append(gCoreContext->GetLanguage()); // UI Language

    // If the inetref is populated, even in kLookupSearch mode,
    // become a kLookupData grab and use that.
    if (lookup->GetStep() == kLookupSearch &&
        (!lookup->GetInetref().isEmpty() &&
         lookup->GetInetref() != "00000000"))
        lookup->SetStep(kLookupData);

    if (lookup->GetStep() == kLookupSearch)
    {
        args.append(QString("-M"));
        if (lookup->GetInetref().isEmpty() ||
            lookup->GetInetref() == "00000000")
        {
            QString title = lookup->GetTitle();
            args.append(title);
        }
        else
        {
            QString inetref = lookup->GetInetref();
            args.append(inetref);
        }
    }
    else if (lookup->GetStep() == kLookupData)
    {
        args.append(QString("-D"));
        args.append(lookup->GetInetref());
        args.append(QString::number(lookup->GetSeason()));
        args.append(QString::number(lookup->GetEpisode()));
    }
    list = runGrabber(cmd, args, lookup);
    return list;
}
Beispiel #25
0
void HardwareProfile::GenerateUUIDs(void)
{
    QString fileprefix = GetConfDir() + "/HardwareProfile";
    QDir dir(fileprefix);
    if (!dir.exists())
        dir.mkdir(fileprefix);

    // Generate the Private Hardware UUID (or recover them from the DB or file)

    QString fileUUID = GetPrivateUUIDFromFile();

    if (fileUUID.isEmpty() && m_uuid.isEmpty())
    {
        LOG(VB_GENERAL, LOG_INFO,
                 "No UUID in DB or File, generating new UUID...");

        QString cmd = GetShareDir() + "hardwareprofile/sendProfile.py";
        QStringList args;
        args << "-p";
        MythSystemLegacy system(cmd, args, kMSRunShell | kMSStdOut);

        system.Run();
        system.Wait();
        m_hardwareProfile = system.ReadAll();
        m_uuid = GetPrivateUUIDFromFile();
    }
    else if (fileUUID.isEmpty())
    {
        LOG(VB_GENERAL, LOG_INFO,
                 QString("Writing Database UUID to local file: %1")
                         .arg(m_uuid));
        WritePrivateUUIDToFile(m_uuid);
    }
    else if (m_uuid.isEmpty())
    {
        LOG(VB_GENERAL, LOG_INFO,
                 QString("Profile UUID found in local file: %1")
                         .arg(fileUUID));
        m_uuid = fileUUID;
    }

    // Get the Public UUID from file

    m_publicuuid = GetPublicUUIDFromFile();
}
Beispiel #26
0
bool MetadataDownload::TelevisionGrabberWorks()
{
    bool ret = false;

    QString def_cmd = QDir::cleanPath(QString("%1/%2")
        .arg(GetShareDir())
        .arg("metadata/Television/ttvdb.py"));

    QString cmd = gCoreContext->GetSetting("TelevisionGrabber", def_cmd);

    ret = runGrabberTest(cmd);

    if (!ret)
        LOG(VB_GENERAL, LOG_INFO,
            QString("Television grabber not functional.  Aborting this run."));

    return ret;
}
Beispiel #27
0
MediaServer::MediaServer(void) :
    m_pUPnpCDS(NULL), m_pUPnpCMGR(NULL),
    m_sSharePath(GetShareDir())
{
    VERBOSE(VB_UPNP, "MediaServer:ctor:Begin");

    // ----------------------------------------------------------------------
    // Initialize Configuration class (Database for Servers)
    // ----------------------------------------------------------------------

    SetConfiguration( new DBConfiguration() );

    // ----------------------------------------------------------------------
    // Create mini HTTP Server
    // ----------------------------------------------------------------------

    VERBOSE(VB_UPNP, "MediaServer:ctor:End");
}
Beispiel #28
0
MetadataLookupList MetadataDownload::handleRecordingGeneric(
                                                    MetadataLookup* lookup)
{
    // We only enter this mode if we are pretty darn sure this is a TV show,
    // but we're for some reason looking up a generic, or the title didn't
    // exactly match in one of the earlier lookups.  This is a total
    // hail mary to try to get at least *series* level info and art/inetref.

    MetadataLookupList list;

    QString def_cmd = QDir::cleanPath(QString("%1/%2")
            .arg(GetShareDir())
            .arg("metadata/Television/ttvdb.py"));

    QString cmd = gCoreContext->GetSetting("TelevisionGrabber", def_cmd);

    QStringList args;

    args.append(QString("-l")); // Language Flag
    args.append(gCoreContext->GetLanguage()); // UI Language
    args.append("-M");
    QString title = lookup->GetTitle();
    args.append(title);
    lookup->SetSubtype(kProbableGenericTelevision);
    int origseason = lookup->GetSeason();
    int origepisode = lookup->GetEpisode();

    if (origseason == 0 && origepisode == 0)
    {
        lookup->SetSeason(1);
        lookup->SetEpisode(1);
    }

    list = runGrabber(cmd, args, lookup, true);

    if (list.count() == 1)
        list.at(0)->SetStep(kLookupData);

    lookup->SetSeason(origseason);
    lookup->SetEpisode(origepisode);

    return list;
}
Beispiel #29
0
HttpServer::HttpServer() : QTcpServer(), ThreadPool("HTTP")
{
    setMaxPendingConnections(20);
    InitializeThreads();

    // ----------------------------------------------------------------------
    // Build Platform String
    // ----------------------------------------------------------------------

#ifdef USING_MINGW
    g_sPlatform = QString( "Windows %1.%2" )
        .arg(LOBYTE(LOWORD(GetVersion())))
        .arg(HIBYTE(LOWORD(GetVersion())));
#else
    struct utsname uname_info;

    uname( &uname_info );

    g_sPlatform = QString( "%1 %2" ).arg( uname_info.sysname )
                                    .arg( uname_info.release );
#endif

    // ----------------------------------------------------------------------
    // Initialize Share Path
    // ----------------------------------------------------------------------

    m_sSharePath = GetShareDir();
    VERBOSE(VB_UPNP, QString( "HttpServer() - SharePath = %1")
            .arg(m_sSharePath));

    // ----------------------------------------------------------------------
    // The HtmlServer Extension is our fall back if a request isn't processed
    // by any other extension.  (This is needed here since it listens for
    // '/' as it's base url ).
    // ----------------------------------------------------------------------

    m_pHtmlServer = new HtmlServerExtension( m_sSharePath );


    // -=>TODO: Load Config XML
    // -=>TODO: Load & initialize - HttpServerExtensions
}
Beispiel #30
0
MediaServer::MediaServer(void) :
#ifdef USING_LIBDNS_SD
    m_bonjour(NULL),
#endif
    m_pUPnpCDS(NULL), m_pUPnpCMGR(NULL),
    m_sSharePath(GetShareDir())
{
    LOG(VB_UPNP, LOG_INFO, "MediaServer:ctor:Begin");

    // ----------------------------------------------------------------------
    // Initialize Configuration class (Database for Servers)
    // ----------------------------------------------------------------------

    SetConfiguration( new DBConfiguration() );

    // ----------------------------------------------------------------------
    // Create mini HTTP Server
    // ----------------------------------------------------------------------

    LOG(VB_UPNP, LOG_INFO, "MediaServer:ctor:End");
}