Ticket #6346: MythVideo.TVGrabbers.31709.diff

File MythVideo.TVGrabbers.31709.diff, 9.0 KB (added by robert.mcnamara@…, 15 years ago)

TV Grabber support and UI

  • mythvideo/mythvideo/globalsettings.cpp

     
    235235    return gc;
    236236}
    237237
     238HostLineEdit *SearchTVListingsCommand()
     239{
     240    HostLineEdit *gc = new HostLineEdit("mythvideo.TVListCommandLine");
     241    gc->setLabel(QObject::tr("Command to search for TV shows in MythVideo"));
     242    gc->setValue(GetShareDir() + "mythvideo/scripts/ttvdb.py -M");
     243    gc->setHelpText(QObject::tr("This command must be "
     244                    "executable by the user running MythVideo."));
     245    return gc;
     246}
     247
     248HostLineEdit *GetTVPostersCommand()
     249{
     250    HostLineEdit *gc = new HostLineEdit("mythvideo.TVPosterCommandLine");
     251    gc->setLabel(QObject::tr("Command to search for TV Season posters"));
     252    gc->setValue(GetShareDir() + "mythvideo/scripts/ttvdb.py -mP");
     253    gc->setHelpText(QObject::tr("This command must be "
     254                    "executable by the user running MythVideo."));
     255    return gc;
     256}
     257
     258HostLineEdit *GetTVFanartCommand()
     259{
     260    HostLineEdit *gc = new HostLineEdit("mythvideo.TVFanartCommandLine");
     261    gc->setLabel(QObject::tr("Command to search for movie fanart"));
     262    gc->setValue(GetShareDir() + "mythvideo/scripts/ttvdb.py -tF");
     263    gc->setHelpText(QObject::tr("This command must be "
     264                    "executable by the user running MythVideo."));
     265    return gc;
     266}
     267
     268HostLineEdit *GetTVDataCommand()
     269{
     270    HostLineEdit *gc = new HostLineEdit("mythvideo.TVDataCommandLine");
     271    gc->setLabel(QObject::tr("Command to extract data for TV Episodes"));
     272    gc->setValue(GetShareDir() + "mythvideo/scripts/ttvdb.py -D");
     273    gc->setHelpText(QObject::tr("This command must be "
     274                    "executable by the user running MythVideo."));
     275    return gc;
     276}
     277
    238278HostLineEdit *VideoStartupDirectory()
    239279{
    240280    HostLineEdit *gc = new HostLineEdit("VideoStartupDir");
     
    782844    VConfigPage page7(pages, false);
    783845    page7->addChild(trlr);
    784846
     847    // page 8
     848    VerticalConfigurationGroup *tvman =
     849            new VerticalConfigurationGroup(true, false);
     850    tvman->setLabel(QObject::tr("Television in MythVideo"));
     851    tvman->addChild(SearchTVListingsCommand());
     852    tvman->addChild(GetTVPostersCommand());
     853    tvman->addChild(GetTVFanartCommand());
     854    tvman->addChild(GetTVDataCommand());
     855
     856    VConfigPage page8(pages, false);
     857    page8->addChild(tvman);
     858
    785859    int page_num = 1;
    786860    for (ConfigPage::PageList::const_iterator p = pages.begin();
    787861         p != pages.end(); ++p, ++page_num)
  • mythvideo/mythvideo/videodlg.cpp

     
    467467        void Run(QString title, Metadata *item)
    468468        {
    469469            m_item = item;
     470            int m_season, m_episode;
     471            QString cmd;
     472            m_season = m_item->GetSeason();
     473            m_episode = m_item->GetEpisode();
    470474
    471             QString def_cmd = QDir::cleanPath(QString("%1/%2")
     475            if (m_season > 0 || m_episode > 0)
     476            {
     477                const QString def_cmd = QDir::cleanPath(QString("%1/%2")
    472478                    .arg(GetShareDir())
     479                    .arg("mythvideo/scripts/ttvdb.py -M"));
     480                cmd = gContext->GetSetting("mythvideo.TVListCommandLine",
     481                                                        def_cmd);
     482            }
     483            else
     484            {
     485                QString def_cmd = QDir::cleanPath(QString("%1/%2")
     486                    .arg(GetShareDir())
    473487                    .arg("mythvideo/scripts/tmdb.pl -M"));
    474488
    475             QString cmd = gContext->GetSetting("MovieListCommandLine", def_cmd);
    476 
    477             QStringList args;
    478             args += title;
    479             StartRun(cmd, args, "Video Search");
     489                cmd = gContext->GetSetting("MovieListCommandLine", def_cmd);
     490            }
     491                QStringList args;
     492                args += title;
     493                StartRun(cmd, args, "Video Search");
    480494        }
    481495
    482496      private:
     
    525539        void Run(QString video_uid, Metadata *item)
    526540        {
    527541            m_item = item;
    528             m_video_uid = video_uid;
     542            m_video_uid = video_uid;           
     543            int m_season, m_episode;
     544            m_season = m_item->GetSeason();
     545            m_episode = m_item->GetEpisode();
    529546
    530             const QString def_cmd = QDir::cleanPath(QString("%1/%2")
     547            if (m_season > 0 || m_episode > 0)
     548            {
     549                const QString def_cmd = QDir::cleanPath(QString("%1/%2")
    531550                    .arg(GetShareDir())
     551                    .arg("mythvideo/scripts/ttvdb.py -mD"));
     552                const QString cmd = gContext->GetSetting("mythvideo.TVDataCommandLine",
     553                                                        def_cmd);
     554                QStringList args;
     555                args << video_uid << QString::number(m_season)
     556                                  << QString::number(m_episode);
     557                StartRun(cmd, args, "Video Data Query");
     558            }
     559            else
     560            {
     561                const QString def_cmd = QDir::cleanPath(QString("%1/%2")
     562                    .arg(GetShareDir())
    532563                    .arg("mythvideo/scripts/tmdb.pl -D"));
    533             const QString cmd = gContext->GetSetting("MovieDataCommandLine",
     564                const QString cmd = gContext->GetSetting("MovieDataCommandLine",
    534565                                                        def_cmd);
    535 
    536             StartRun(cmd, QStringList(video_uid), "Video Data Query");
     566                StartRun(cmd, QStringList(video_uid), "Video Data Query");
     567            }
    537568        }
    538569
    539570      private:
     
    570601        void Run(QString video_uid, Metadata *item)
    571602        {
    572603            m_item = item;
     604            int m_season, m_episode;
     605            m_season = m_item->GetSeason();
     606            m_episode = m_item->GetEpisode();
    573607
    574             const QString default_cmd =
     608            if (m_season > 0 || m_episode > 0)
     609            {
     610                const QString def_cmd = QDir::cleanPath(QString("%1/%2")
     611                    .arg(GetShareDir())
     612                    .arg("mythvideo/scripts/ttvdb.py -mP"));
     613                const QString cmd = gContext->GetSetting("mythvideo.TVPosterCommandLine",
     614                                                        def_cmd);
     615                QStringList args;
     616                args << video_uid << QString::number(m_season)
     617                                  << QString::number(m_episode);
     618                StartRun(cmd, args, "Poster Query");
     619            }
     620            else
     621            {
     622                const QString default_cmd =
    575623                    QDir::cleanPath(QString("%1/%2")
    576624                                        .arg(GetShareDir())
    577625                                        .arg("mythvideo/scripts/tmdb.pl -P"));
    578             const QString cmd = gContext->GetSetting("MoviePosterCommandLine",
     626                const QString cmd = gContext->GetSetting("MoviePosterCommandLine",
    579627                                                        default_cmd);
    580             StartRun(cmd, QStringList(video_uid), "Poster Query");
     628
     629                StartRun(cmd, QStringList(video_uid), "Poster Query");
     630            }
    581631        }
    582632
    583633      private:
     
    627677        void Run(QString video_uid, Metadata *item)
    628678        {
    629679            m_item = item;
     680            int m_season, m_episode;
     681            m_season = m_item->GetSeason();
     682            m_episode = m_item->GetEpisode();
    630683
    631             const QString default_cmd =
     684            if (m_season > 0 || m_episode > 0)
     685            {
     686                const QString def_cmd = QDir::cleanPath(QString("%1/%2")
     687                    .arg(GetShareDir())
     688                    .arg("mythvideo/scripts/ttvdb.py -tF"));
     689                const QString cmd = gContext->GetSetting("mythvideo.TVFanartCommandLine",
     690                                                        def_cmd);
     691                QStringList args;
     692                args << video_uid << QString::number(m_season)
     693                                  << QString::number(m_episode);
     694                StartRun(cmd, args, "Fanart Query");
     695            }
     696            else
     697            {
     698                const QString default_cmd =
    632699                    QDir::cleanPath(QString("%1/%2")
    633700                                        .arg(GetShareDir())
    634                                         .arg("mythvideo/scripts/tmdb.pl -B"));
    635             const QString cmd = gContext->GetSetting("MovieFanartCommandLine",
     701                                        .arg("mythvideo/scripts/tmdb.pl -F"));
     702                const QString cmd = gContext->GetSetting("MovieFanartCommandLine",
    636703                                                        default_cmd);
    637             StartRun(cmd, QStringList(video_uid), "Fanart Query");
     704                StartRun(cmd, QStringList(video_uid), "Fanart Query");
     705            }
    638706        }
    639707
    640708      private: