Ticket #6158: PBBMVExport.6.diff

File PBBMVExport.6.diff, 22.7 KB (added by robert.mcnamara@…, 15 years ago)

Adds smart hunting for banner/fanart/coverfile

  • mythtv/programs/mythfrontend/playbackbox.cpp

     
    2020#include "mythdirs.h"
    2121#include "mythcontext.h"
    2222#include "mythdbcon.h"
     23#include "mythdb.h"
    2324#include "mythverbose.h"
    2425#include "programinfo.h"
    2526#include "scheduledrecording.h"
     
    4445#define LOC QString("PlaybackBox: ")
    4546#define LOC_ERR QString("PlaybackBox Error: ")
    4647
     48QString customExportFile = NULL;
     49QString customExportDir = NULL;
     50
    4751#define REC_CAN_BE_DELETED(rec) \
    4852    ((((rec)->programflags & FL_INUSEPLAYING) == 0) && \
    4953     ((((rec)->programflags & FL_INUSERECORDING) == 0) || \
     
    18151819    RemoteStopRecording(rec);
    18161820}
    18171821
     1822void PlaybackBox::mvexport(ProgramInfo *rec)
     1823{
     1824
     1825    // User Rating Adjustment
     1826    QString exportRating = QString::number((int)((rec->stars * 10.0) + 0.5));
     1827
     1828    // Stuff necessary to perform the copy command
     1829
     1830    QString copyFrom = rec->GetPlaybackURL(false, true);
     1831    QString baseMVDir = gContext->GetSetting("VideoStartupDir");
     1832    QString MVFileFormat;
     1833    QString MVDirFormat;
     1834    QString copyToDir;
     1835    QString copyToFile;
     1836    QString extension;
     1837
     1838    // Check the original extension
     1839
     1840    QRegExp rx(".*\\.(\\w+)$");
     1841    int pos = rx.indexIn(copyFrom);
     1842    if (pos > -1)
     1843    {
     1844        extension = rx.cap(1);
     1845    }
     1846    else
     1847    {
     1848        extension = "";
     1849    }
     1850
     1851    // If a custom export string is used, use it.
     1852    // Also replace %VARIABLES% with actual values.
     1853
     1854    if (customExportFile.isEmpty())
     1855    {
     1856        QString defaultDir = gContext->GetSetting("TVExportDirFormat",
     1857                              "Television/%TITLE%/");
     1858        QString defaultFile = gContext->GetSetting("TVExportFileFormat",
     1859                              "%TITLE% - %SUBTITLE%");
     1860        MVDirFormat = replaceExportVariables(rec, defaultDir);
     1861        MVFileFormat = replaceExportVariables(rec, defaultFile);
     1862    }
     1863    else
     1864    {
     1865        MVDirFormat = replaceExportVariables(rec, customExportDir);
     1866        MVFileFormat = replaceExportVariables(rec, customExportFile);
     1867    }
     1868
     1869    copyToDir = QString("%1/%2/").arg(baseMVDir).arg(MVDirFormat);
     1870    copyToFile = QString("%1/%2.%3").arg(copyToDir)
     1871                         .arg(MVFileFormat).arg(extension);
     1872
     1873
     1874    // File and Directory Definitions
     1875
     1876    QFile fromFile(copyFrom);
     1877    QDir toDir(copyToDir);
     1878    QFile toFile(copyToFile);
     1879
     1880    if (!toDir.exists())
     1881    {
     1882        // Attempt to create path to export point.
     1883        toDir.mkpath(copyToDir);
     1884        toDir.mkdir(copyToDir);
     1885        if (!toDir.exists())
     1886        {
     1887            VERBOSE(VB_IMPORTANT, QString("Unable to create directory %1! "
     1888                                          "Please ensure the preceding path "
     1889                                          "exists and is writeable.").arg(copyToDir));   
     1890            return;
     1891        }
     1892    }
     1893
     1894    // Perform the actual copy.
     1895
     1896    long long int bytesCopied = copy(toFile,fromFile);
     1897
     1898    if (bytesCopied != -1)
     1899    {
     1900        // Add File into videometadata
     1901
     1902        MSqlQuery query(MSqlQuery::InitCon());
     1903
     1904        query.prepare("INSERT INTO videometadata (title,plot,year,category,"
     1905                          "userrating,length,filename,showlevel,inetref, "
     1906                          "browse) VALUES (:TITLE, :PLOT, :YEAR, :CATEGORY, "
     1907                          ":USERRATING, :LENGTH, :FILENAME, :SHOWLEVEL, "
     1908                          ":INETREF, :BROWSE)");
     1909
     1910        query.bindValue(":TITLE", MVFileFormat);
     1911        query.bindValue(":PLOT", rec->description);
     1912        query.bindValue(":YEAR", rec->originalAirDate.toString("yyyy"));
     1913        query.bindValue(":CATEGORY", rec->category);
     1914        query.bindValue(":USERRATING", exportRating);
     1915        query.bindValue(":LENGTH", rec->lenMins);
     1916        query.bindValue(":FILENAME", copyToFile);
     1917        query.bindValue(":SHOWLEVEL", 1);
     1918        query.bindValue(":INETREF", 0);
     1919        query.bindValue(":BROWSE", 1);
     1920
     1921        if (!query.exec() || !query.isActive())
     1922        {
     1923            MythDB::DBError("video metadata update", query);
     1924            return;
     1925        }
     1926
     1927        // Move recordedmarkup for file into videometadata
     1928
     1929        MSqlQuery markup(MSqlQuery::InitCon());
     1930
     1931        markup.prepare("INSERT INTO filemarkup (filename,mark,offset,type) "
     1932                      "SELECT :FILENAME, mark, data, type from "
     1933                      "recordedmarkup where chanid=:CHANID and starttime=:STARTTIME");
     1934
     1935        markup.bindValue(":FILENAME", copyToFile);
     1936        markup.bindValue(":CHANID", rec->chanid);
     1937        markup.bindValue(":STARTTIME", rec->recstartts);
     1938
     1939        if (!markup.exec() || !markup.isActive())
     1940        {
     1941            MythDB::DBError("video metadata update", markup);
     1942            return;
     1943        }
     1944
     1945        // Copy and set preview image as screenshot
     1946        // If Banners, cover files, or fanart exist with
     1947        // seriesID as the name, use them automatically.
     1948
     1949        QString screenshotFile = getPreviewImage(rec);
     1950        QString MVScreenshotDir = gContext->GetSetting("VideoScreenshotDir");
     1951        QString MVScreenshotFile = QString("%1/%2.png").arg(MVScreenshotDir).arg(MVFileFormat);
     1952
     1953        QString MVBannerDir = gContext->GetSetting("VideoBannerDir");
     1954        QString bannerFile = testImageFiles(MVBannerDir, rec->seriesid, rec->title);
     1955        if (!bannerFile.isNull())
     1956            VERBOSE(VB_IMPORTANT, QString("Found Banner File Match: %1").arg(bannerFile));
     1957
     1958        QString MVFanartDir = gContext->GetSetting("VideoFanartDir");
     1959        QString fanartFile = testImageFiles(MVFanartDir, rec->seriesid, rec->title);
     1960        if (!fanartFile.isNull())
     1961            VERBOSE(VB_IMPORTANT, QString("Found Fanart File Match: %1").arg(fanartFile));
     1962
     1963        QString MVCoverDir = gContext->GetSetting("VideoArtworkDir");
     1964        QString coverFile = testImageFiles(MVCoverDir, rec->seriesid, rec->title);
     1965        if (!coverFile.isNull())
     1966            VERBOSE(VB_IMPORTANT, QString("Found Cover File Match: %1").arg(coverFile));
     1967
     1968        VERBOSE(VB_IMPORTANT, QString("Copying %1 to %2").arg(screenshotFile).arg(MVScreenshotFile));
     1969
     1970        QFile fromScreenshot(screenshotFile);
     1971        QFile toScreenshot(MVScreenshotFile);
     1972        long long int screenshotBytesCopied;
     1973       
     1974        if (!screenshotFile.isNull())
     1975            screenshotBytesCopied = copy(toScreenshot,fromScreenshot);
     1976
     1977        if (!bannerFile.isNull() || !fanartFile.isNull() || !coverFile.isNull())
     1978        {
     1979            MSqlQuery images(MSqlQuery::InitCon());
     1980
     1981            images.prepare("UPDATE videometadata set screenshot=:SCREENSHOTFILE, "
     1982                           "banner=:BANNERFILE, fanart=:FANARTFILE, coverfile=:COVERFILE "
     1983                           "where filename=:FILENAME");
     1984
     1985            images.bindValue(":SCREENSHOTFILE", MVScreenshotFile);
     1986            images.bindValue(":BANNERFILE", bannerFile);
     1987            images.bindValue(":FANARTFILE", fanartFile);
     1988            images.bindValue(":COVERFILE", coverFile);
     1989            images.bindValue(":FILENAME", copyToFile);
     1990
     1991            if (!images.exec() || !images.isActive())
     1992            {
     1993                MythDB::DBError("video metadata update", images);
     1994                 return;
     1995            }
     1996        }
     1997        else
     1998        {
     1999            VERBOSE(VB_IMPORTANT, QString("Copy succeeded, but no images "
     2000                    "were copied or found.").arg(screenshotBytesCopied));
     2001            return;
     2002        }
     2003        VERBOSE(VB_IMPORTANT, QString("Copy succeeded, %1 bytes copied.").arg(bytesCopied));
     2004    }
     2005    else
     2006    {
     2007        VERBOSE(VB_IMPORTANT, QString("Copy unsuccessful, check all permissions."));
     2008    }
     2009
     2010customExportDir.clear();
     2011customExportFile.clear();
     2012
     2013}
     2014
     2015QString PlaybackBox::testImageFiles(QString &testDirectory, QString &seriesID,
     2016                                    QString &titleIn)
     2017{
     2018    QString foundFile;
     2019 
     2020    // Attempts to match image file in specified directory.
     2021    // Falls back like this:
     2022    //
     2023    //     Pushing Daisies 5.png
     2024    //     PushingDaisies5.png
     2025    //     PushingDaisiesSeason5.png
     2026    //     Pushing Daisies Season 5 Episode 1.png
     2027    //     PuShinG DaisIES s05e01.png
     2028    //     etc. (you get it)   
     2029    //
     2030    // Or any permutation thereof including -,_, or . instead of space
     2031    // Then, match by seriesid (for future PBB grabber):
     2032    //
     2033    //     EP0012345.png
     2034    //
     2035    // Then, as a final fallback, match just title
     2036    //
     2037    //     Pushing Daisies.png (or Pushing_Daisies.png, etc.)
     2038    //
     2039    // All this allows for grabber to grab an image with format:
     2040    //
     2041    //     Title SeasonNumber.ext or Title SeasonNum # Epnum #.ext
     2042    //     or SeriesID.ext or Title.ext (without caring about cases,
     2043    //     spaces, dashes, periods, or underscores)
     2044
     2045    QDir dir(testDirectory);
     2046    dir.setSorting(QDir::Name | QDir::Reversed | QDir::IgnoreCase);
     2047
     2048    QStringList entries = dir.entryList();
     2049
     2050    int regIndex = 0;
     2051    titleIn.replace(" ", "(?:\\s|-|_|\\.)?");
     2052    QString regs[] = {
     2053        QString("%1" // title
     2054            "(?:\\s|-|_|\\.)?" // optional separator
     2055            "(?:" // begin optional Season portion
     2056            "S(?:eason)?" // optional "S" or "Season"
     2057            "(?:\\s|-|_|\\.)?" // optional separator
     2058            ")?" // end optional Season portion
     2059            "[0-9]{1,3}" // number
     2060            "(?:" // begin optional Episode portion
     2061            "(?:\\s|-|_|\\.)?" // optional separator
     2062            "(?:x?" // optional "x"
     2063            "(?:\\s|-|_|\\.)?" // optional separator
     2064            "(?:E(?:pisode)?)?" // optional "E" or "Episode"
     2065            "(?:\\s|-|_|\\.)?)?" // optional separator
     2066            "[0-9]{1,3}" // number portion of optional Episode portion
     2067            ")?" // end optional Episode portion
     2068            "\\.(?:png|gif|jpg)" // file extension
     2069            ).arg(titleIn),
     2070        QString("%1\\.(?:png|jpg|gif)").arg(seriesID),
     2071        QString("%1\\.(?:png|jpg|gif)").arg(titleIn),
     2072        "" };  // This blank entry must exist, do not remove.
     2073 
     2074    QString reg = regs[regIndex];
     2075    while ((!reg.isEmpty()) && (foundFile.isEmpty()))
     2076    {
     2077        QRegExp re(reg, Qt::CaseInsensitive);
     2078        for (QStringList::const_iterator it = entries.begin();
     2079            it != entries.end(); ++it)
     2080        {
     2081            if (re.exactMatch(*it))
     2082            {
     2083                foundFile = *it;
     2084                break;
     2085            }
     2086        }
     2087        reg = regs[++regIndex];
     2088    }
     2089
     2090    return QString("%1/%2").arg(testDirectory).arg(foundFile);
     2091}
     2092
     2093QString PlaybackBox::replaceExportVariables(ProgramInfo *rec, QString &repString)
     2094{
     2095    if (!repString.isEmpty())
     2096    {
     2097         repString.replace(QRegExp("%FILE%"), rec->GetRecordBasename(true));
     2098         repString.replace(QRegExp("%TITLE%"), rec->title);
     2099         repString.replace(QRegExp("%SUBTITLE%"), rec->subtitle);
     2100         repString.replace(QRegExp("%DESCRIPTION%"), rec->description);
     2101         repString.replace(QRegExp("%HOSTNAME%"), rec->hostname);
     2102         repString.replace(QRegExp("%CATEGORY%"), rec->category);
     2103         repString.replace(QRegExp("%RECGROUP%"), rec->recgroup);
     2104         repString.replace(QRegExp("%PLAYGROUP%"), rec->playgroup);
     2105         repString.replace(QRegExp("%ORIGAIRYEAR%"),
     2106                         rec->originalAirDate.toString("yyyy"));
     2107         repString.replace(QRegExp("%ORIGAIRDATE%"),
     2108                         rec->originalAirDate.toString("yyyyMMdd"));
     2109         repString.replace(QRegExp("%CALLSIGN%"), rec->chansign);
     2110         repString.replace(QRegExp("%CHANNAME%"), rec->channame);
     2111         repString.replace(QRegExp("%CHANID%"), rec->chanid);
     2112         repString.replace(QRegExp("%STARTTIME%"),
     2113                         rec->recstartts.toString("yyyyMMddhhmmss"));
     2114         repString.replace(QRegExp("%ENDTIME%"),
     2115                         rec->recendts.toString("yyyyMMddhhmmss"));
     2116         repString.replace(QRegExp("%STARTTIMEISO%"),
     2117                         rec->recstartts.toString(Qt::ISODate));
     2118         repString.replace(QRegExp("%ENDTIMEISO%"),
     2119                         rec->recendts.toString(Qt::ISODate));
     2120         repString.replace(QRegExp("%PROGSTART%"),
     2121                         rec->startts.toString("yyyyMMddhhmmss"));
     2122         repString.replace(QRegExp("%PROGEND%"),
     2123                         rec->endts.toString("yyyyMMddhhmmss"));
     2124         repString.replace(QRegExp("%PROGSTARTISO%"),
     2125                         rec->startts.toString(Qt::ISODate));
     2126         repString.replace(QRegExp("%PROGENDISO%"),
     2127                         rec->endts.toString(Qt::ISODate));
     2128    }
     2129    return repString;
     2130}
     2131
    18182132bool PlaybackBox::doRemove(ProgramInfo *rec, bool forgetHistory,
    18192133                           bool forceMetadataDelete)
    18202134{
     
    18692183        showActionPopup(pginfo);
    18702184}
    18712185
     2186void PlaybackBox::showExportPopup(ProgramInfo *program)
     2187{
     2188    if (m_popupMenu)
     2189        return;
     2190
     2191    QString label = tr("Are you sure you want to export:");
     2192
     2193    m_expItem = CurrentItem();
     2194    popupString(m_expItem, label);
     2195
     2196    m_popupMenu = new MythDialogBox(label, m_popupStack, "pbbmainmenupopup");
     2197
     2198    connect(m_popupMenu, SIGNAL(Exiting()), SLOT(popupClosed()));
     2199
     2200    if (m_popupMenu->Create())
     2201        m_popupStack->AddScreen(m_popupMenu);
     2202    else
     2203    {
     2204        delete m_popupMenu;
     2205        m_popupMenu = NULL;
     2206    }
     2207
     2208    m_popupMenu->SetReturnEvent(this, "slotmenu");
     2209
     2210    m_freeSpaceNeedsUpdate = true;
     2211    QString tmpmessage;
     2212    const char *tmpslot = NULL;
     2213
     2214    if (program->IsSameProgram(*program))
     2215        {
     2216        tmpmessage = tr("Yes, Export to MythVideo");
     2217        tmpslot = SLOT(doMVExport());
     2218        m_popupMenu->AddButton(tmpmessage, tmpslot);
     2219
     2220        tmpmessage = tr("Export with custom name/location");
     2221        tmpslot = SLOT(showCustomExportEditor());
     2222        m_popupMenu->AddButton(tmpmessage, tmpslot);
     2223
     2224        tmpmessage = tr("No, I don't want to Export");
     2225        tmpslot = SLOT(noExport());
     2226        m_popupMenu->AddButton(tmpmessage, tmpslot);
     2227        }
     2228}
     2229
     2230
    18722231void PlaybackBox::doPIPPlay(void)
    18732232{
    18742233    doPIPPlay(kPIPonTV);
     
    22932652        else
    22942653            m_popupMenu->AddButton(tr("Preserve this episode"),
    22952654                                            SLOT(togglePreserveEpisode()));
     2655
     2656        QString MVlocation = FindPluginName("mythvideo");
     2657        if (QFile(MVlocation).exists())
     2658            m_popupMenu->AddButton(tr("Export to MythVideo"), SLOT(askMVExport()));
    22962659    }
    22972660}
    22982661
     
    26493012    stop(pginfo);
    26503013}
    26513014
     3015void PlaybackBox::doMVExport()
     3016{
     3017    ProgramInfo *pginfo = CurrentItem();
     3018    mvexport(pginfo);
     3019}
     3020
    26523021void PlaybackBox::showProgramDetails()
    26533022{
    26543023   ProgramInfo *pginfo = CurrentItem();
     
    27873156    }
    27883157}
    27893158
     3159void PlaybackBox::askMVExport(ProgramInfo *pginfo)
     3160{
     3161    if (!pginfo)
     3162        pginfo = CurrentItem();
     3163    showExportPopup(pginfo);
     3164}
     3165
    27903166void PlaybackBox::askDelete(ProgramInfo *pginfo)
    27913167{
    27923168    if (!pginfo)
     
    40214397        m_recordingList->RemoveItem(item);
    40224398}
    40234399
     4400void PlaybackBox::showCustomExportEditor()
     4401{
     4402
     4403    MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
     4404
     4405    CustomExportEdit *editExport = new CustomExportEdit(mainStack);
     4406
     4407    if (editExport->Create())
     4408    {
     4409        connect(editExport, SIGNAL(result(const QString &, const QString &)),
     4410                SLOT(startCustomExport(const QString &, const QString &)));
     4411        mainStack->AddScreen(editExport);
     4412    }
     4413    else
     4414        delete editExport;
     4415}
     4416
     4417void PlaybackBox::startCustomExport(const QString &newFile,
     4418                                    const QString &newDir)
     4419{
     4420    MythUIButtonListItem *item = m_recordingList->GetItemCurrent();
     4421
     4422    if (!item)
     4423        return;
     4424
     4425    ProgramInfo *pginfo = CurrentItem();
     4426
     4427    if (!pginfo)
     4428        return;
     4429
     4430    customExportFile = newFile;
     4431    customExportDir = newDir;
     4432
     4433    mvexport(pginfo);
     4434}
     4435
    40244436void PlaybackBox::setRecGroup(QString newRecGroup)
    40254437{
    40264438    ProgramInfo *tmpItem = CurrentItem();
     
    44114823    Close();
    44124824}
    44134825
     4826////////////////////////////////////////////////////////
     4827
     4828CustomExportEdit::CustomExportEdit(MythScreenStack *lparent)
     4829                : MythScreenType(lparent, "customexportedit")
     4830{
     4831    m_dirEdit = m_fileEdit = NULL;
     4832}
     4833
     4834bool CustomExportEdit::Create()
     4835{
     4836    if (!LoadWindowFromXML("recordings-ui.xml", "customexport", this))
     4837        return false;
     4838       
     4839    m_dirEdit = dynamic_cast<MythUITextEdit*>(GetChild("dir"));
     4840    m_fileEdit = dynamic_cast<MythUITextEdit*>(GetChild("file"));
     4841    MythUIButton *okButton = dynamic_cast<MythUIButton*>(GetChild("ok"));
     4842 
     4843    if (!m_dirEdit || !m_fileEdit || !okButton)
     4844    {
     4845        VERBOSE(VB_IMPORTANT, "Window 'customexport' is missing required "
     4846                              "elements.");
     4847        return false;
     4848    }
     4849   
     4850    m_dirEdit->SetText(gContext->GetSetting("TVExportDirFormat"));
     4851    m_fileEdit->SetText(gContext->GetSetting("TVExportFileFormat"));
     4852
     4853    connect(okButton, SIGNAL(Clicked()), SLOT(ReturnExport()));
     4854     
     4855    if (!BuildFocusList())
     4856        VERBOSE(VB_IMPORTANT, "Failed to build a focuslist.");
     4857 
     4858    return true;
     4859}
     4860
     4861void CustomExportEdit::ReturnExport()
     4862{
     4863    QString newExportDir = m_dirEdit->GetText();
     4864    QString newExportFile = m_fileEdit->GetText();
     4865
     4866    emit result(newExportFile, newExportDir);
     4867    Close();
     4868}
     4869
    44144870//////////////////////////////////////////
    44154871
    44164872HelpPopup::HelpPopup(MythScreenStack *lparent)
  • mythtv/programs/mythfrontend/playbackbox.h

     
    142142    void showRecGroupChanger();
    143143    void showPlayGroupChanger();
    144144    void showMetadataEditor();
     145    void showCustomExportEditor();
    145146    void showGroupFilter();
    146147    void showRecGroupPasswordChanger();
    147148    void showPlayFromPopup();
     
    173174
    174175    void askStop();
    175176    void doStop();
     177    void askMVExport(ProgramInfo *pginfo = NULL);
     178    void doMVExport();
    176179
    177180    void doEditScheduled();
    178181    void doAllowRerecord();
     
    203206    void setPlayGroup(QString newPlayGroup);
    204207
    205208    void saveRecMetadata(const QString &newTitle, const QString &newSubtitle);
     209    void startCustomExport(const QString &newFile, const QString &newDir);
    206210
    207211    void SetRecGroupPassword(const QString &newPasswd);
    208212
     
    263267
    264268    bool play(ProgramInfo *rec, bool inPlaylist = false);
    265269    void stop(ProgramInfo *);
     270    void mvexport(ProgramInfo *);
     271    QString testImageFiles(QString &testDirectory,
     272                           QString &seriesID, QString &titleIn);
     273    QString replaceExportVariables(ProgramInfo *rec, QString &repString);
    266274    void remove(ProgramInfo *);
    267275    void showActions(ProgramInfo *);
    268276    ProgramInfo *CurrentItem(void);
     
    282290
    283291    bool doRemove(ProgramInfo *, bool forgetHistory, bool forceMetadataDelete);
    284292    void showDeletePopup(ProgramInfo *, deletePopupType);
     293    void showExportPopup(ProgramInfo *);
    285294    void showActionPopup(ProgramInfo *program);
    286295    void showFileNotFoundActionPopup(ProgramInfo *program);
    287296    void popupString(ProgramInfo *program, QString &message);
     
    379388    // Other state
    380389    /// Program currently selected for deletion
    381390    ProgramInfo *m_delItem;
     391    /// Program currently selected for export
     392    ProgramInfo *m_expItem;
    382393    /// Program currently selected during an update
    383394    ProgramInfo *m_currentItem;
    384395    /// Group currently selected
     
    519530    ProgramInfo *m_progInfo;
    520531};
    521532
     533class CustomExportEdit : public MythScreenType
     534{
     535    Q_OBJECT
     536
     537  public:
     538    CustomExportEdit(MythScreenStack *lparent);
     539
     540    bool Create(void);
     541
     542  signals:
     543    void result(const QString &, const QString &);
     544
     545  protected slots:   
     546    void ReturnExport(void);
     547 
     548  private:
     549    MythUITextEdit     *m_dirEdit;
     550    MythUITextEdit     *m_fileEdit;
     551   
     552};
     553
    522554class HelpPopup : public MythScreenType
    523555{
    524556    Q_OBJECT
  • mythplugins/mythvideo/mythvideo/globalsettings.cpp

     
    236246    return gc;
    237247}
    238248
     249HostLineEdit *TVExportDirectoryFormat()
     250{
     251    HostLineEdit *gc = new HostLineEdit("TVExportDirFormat");
     252    gc->setLabel(QObject::tr("TV Export Directory Format"));
     253    gc->setValue(DEFAULT_TVEXPORTDIRFORMAT);
     254    gc->setHelpText(QObject::tr("Directory format for recording export "
     255                    "to MythVideo, using user job style variables. Directory "
     256                    "is off of base MythVideo directory. Example: "
     257                    "Television/%CATEGORY%/%TITLE%"));
     258    return gc;
     259}
     260
     261HostLineEdit *TVExportFileFormat()
     262{
     263    HostLineEdit *gc = new HostLineEdit("TVExportFileFormat");
     264    gc->setLabel(QObject::tr("TV Export File Format"));
     265    gc->setValue(DEFAULT_TVEXPORTFILEFORMAT);
     266    gc->setHelpText(QObject::tr("File format for recording export "
     267                    "to MythVideo, using user job style variables. Example: "
     268                    "%TITLE% - %SUBTITLE% (%STARTTIMEISO%)"));
     269    return gc;
     270}
     271
    239272HostLineEdit *VideoArtworkDirectory()
    240273{
    241274    HostLineEdit *gc = new HostLineEdit("VideoArtworkDir");
     
    709777    vman->addChild(SearchListingsCommand());
    710778    vman->addChild(GetPostersCommand());
    711779    vman->addChild(GetDataCommand());
     780    vman->setLabel(QObject::tr("Video Export"));
     781    vman->addChild(TVExportDirectoryFormat());   
     782    vman->addChild(TVExportFileFormat()); 
    712783
    713784    VConfigPage page4(pages, false);
    714785    page4->addChild(vman);
  • mythplugins/mythvideo/mythvideo/globals.cpp

  • mythplugins/mythvideo/mythvideo/globals.h

     const QString JUMP_VIDEO_TREE = "Video Listings";
     const QString JUMP_VIDEO_GALLERY = "Video Gallery";
     const QString JUMP_VIDEO_DEFAULT = "MythVideo";
    +const QString DEFAULT_TVEXPORTDIRFORMAT = "Television/%TITLE%";
    +const QString DEFAULT_TVEXPORTFILEFORMAT = "%TITLE% - %SUBTITLE%";
     
     #ifdef Q_WS_MACX
     const QString DEFAULT_VIDEOSTARTUP_DIR = QDir::homePath() + "/Movies";
     
    2528extern const QString JUMP_VIDEO_DEFAULT;
    2629
    2730extern const QString DEFAULT_VIDEOSTARTUP_DIR;
     31extern const QString DEFAULT_TVEXPORTDIRFORMAT;
     32extern const QString DEFAULT_TVEXPORTFILEFORMAT;
    2833
    2934#endif // GLOBALS_H_