Ticket #6158: PBB-MV-export-3.19.09.diff
File PBB-MV-export-3.19.09.diff, 26.6 KB (added by , 15 years ago) |
---|
-
mythtv/programs/mythfrontend/playbackbox.cpp
20 20 #include "mythdirs.h" 21 21 #include "mythcontext.h" 22 22 #include "mythdbcon.h" 23 #include "mythdb.h" 23 24 #include "mythverbose.h" 24 25 #include "programinfo.h" 25 26 #include "scheduledrecording.h" … … 35 36 #include "mythuibutton.h" 36 37 #include "mythuibuttonlist.h" 37 38 #include "mythuistatetype.h" 39 #include "mythuispinbox.h" 38 40 #include "mythdialogbox.h" 39 41 #include "mythuitextedit.h" 40 42 #include "mythuiimage.h" … … 1812 1814 RemoteStopRecording(rec); 1813 1815 } 1814 1816 1817 void PlaybackBox::mvexport(ProgramInfo *rec) 1818 { 1819 1820 // User Rating Adjustment 1821 QString exportRating = QString::number((int)((rec->stars * 10.0) + 0.5)); 1822 1823 // Stuff necessary to perform the copy command 1824 1825 QString copyFrom = rec->GetPlaybackURL(false, true); 1826 QString baseMVDir = gContext->GetSetting("VideoStartupDir"); 1827 QString MVFileFormat; 1828 QString MVDirFormat; 1829 QString copyToDir; 1830 QString copyToFile; 1831 QString extension; 1832 1833 // Check the original extension 1834 1835 QRegExp rx(".*\\.(\\w+)$"); 1836 int pos = rx.indexIn(copyFrom); 1837 if (pos > -1) 1838 { 1839 extension = rx.cap(1); 1840 } 1841 else 1842 { 1843 extension = ""; 1844 } 1845 1846 // If a custom export string is used, use it. 1847 // Also replace %VARIABLES% with actual values. 1848 1849 if (customExportFile.isEmpty() && customExportDir.isEmpty() 1850 && customExportSeason == 0 && customExportEpisode == 0) 1851 { 1852 // Season-Episode must come first for replace to work right. 1853 QString recType = rec->catType; 1854 if (recType == "movie") 1855 { 1856 seasonValue = 0; 1857 episodeValue = 0; 1858 } 1859 else 1860 { 1861 seasonValue = getLastSeason(rec->title); 1862 episodeValue = (getLastEpisode(rec->title, seasonValue) + 1); 1863 } 1864 1865 QString defaultDir = gContext->GetSetting("mythvideo.TVExportDirFormat", 1866 "Television/%TITLE%/"); 1867 QString defaultFile = gContext->GetSetting("mythvideo.TVExportFileFormat", 1868 "%TITLE% %##X##% - %SUBTITLE%"); 1869 MVDirFormat = replaceExportVariables(rec, defaultDir); 1870 MVFileFormat = replaceExportVariables(rec, defaultFile); 1871 } 1872 else 1873 { 1874 seasonValue = customExportSeason; 1875 episodeValue = customExportEpisode; 1876 MVDirFormat = replaceExportVariables(rec, customExportDir); 1877 MVFileFormat = replaceExportVariables(rec, customExportFile); 1878 } 1879 1880 copyToDir = QString("%1/%2").arg(baseMVDir).arg(MVDirFormat); 1881 copyToFile = QString("%1/%2.%3").arg(copyToDir) 1882 .arg(MVFileFormat).arg(extension); 1883 1884 // replace double slash with single 1885 1886 copyToFile.replace("//", "/"); 1887 1888 // File and Directory Definitions 1889 1890 QFile fromFile(copyFrom); 1891 QDir toDir(copyToDir); 1892 QFile toFile(copyToFile); 1893 1894 if (!toDir.exists()) 1895 { 1896 // Attempt to create path to export point. 1897 toDir.mkpath(copyToDir); 1898 toDir.mkdir(copyToDir); 1899 if (!toDir.exists()) 1900 { 1901 VERBOSE(VB_IMPORTANT, QString("Unable to create directory %1! " 1902 "Please ensure the preceding path " 1903 "exists and is writeable.").arg(copyToDir)); 1904 return; 1905 } 1906 } 1907 1908 // Perform the actual copy. 1909 1910 long long int bytesCopied = copy(toFile,fromFile); 1911 1912 if (bytesCopied != -1) 1913 { 1914 // Add File into videometadata 1915 1916 MSqlQuery query(MSqlQuery::InitCon()); 1917 1918 query.prepare("INSERT INTO videometadata (title,subtitle,director," 1919 "plot,rating,year,userrating,length,season," 1920 "episode,filename,showlevel,coverfile,inetref," 1921 "browse, trailer, screenshot, banner, fanart) VALUES " 1922 "(:TITLE, :SUBTITLE, :DIRECTOR, :PLOT, :RATING, :YEAR, " 1923 ":USERRATING, :LENGTH, :SEASON, :EPISODE, :FILENAME, " 1924 ":SHOWLEVEL, :COVERFILE, :INETREF, :BROWSE, :TRAILER, " 1925 ":SCREENSHOT, :BANNER, :FANART)"); 1926 1927 query.bindValue(":TITLE", rec->title); 1928 query.bindValue(":SUBTITLE", rec->subtitle); 1929 query.bindValue(":DIRECTOR", "Unknown"); 1930 query.bindValue(":PLOT", rec->description); 1931 query.bindValue(":RATING", "NR"); 1932 query.bindValue(":YEAR", rec->originalAirDate.toString("yyyy")); 1933 query.bindValue(":USERRATING", exportRating); 1934 query.bindValue(":LENGTH", (rec->startts.secsTo(rec->endts) / 60)); 1935 query.bindValue(":SEASON", seasonValue); 1936 query.bindValue(":EPISODE", episodeValue); 1937 query.bindValue(":FILENAME", copyToFile); 1938 query.bindValue(":SHOWLEVEL", 1); 1939 query.bindValue(":COVERFILE", "No Cover"); 1940 query.bindValue(":INETREF", 0); 1941 query.bindValue(":BROWSE", 1); 1942 query.bindValue(":TRAILER", ""); 1943 query.bindValue(":SCREENSHOT", ""); 1944 query.bindValue(":BANNER", ""); 1945 query.bindValue(":FANART", ""); 1946 1947 if (!query.exec() || !query.isActive()) 1948 { 1949 MythDB::DBError("video metadata update", query); 1950 return; 1951 } 1952 1953 // Move recordedmarkup for file into videometadata 1954 1955 MSqlQuery markup(MSqlQuery::InitCon()); 1956 1957 markup.prepare("INSERT INTO filemarkup (filename,mark,offset,type) " 1958 "SELECT :FILENAME, mark, data, type from " 1959 "recordedmarkup where chanid=:CHANID and starttime=:STARTTIME"); 1960 1961 markup.bindValue(":FILENAME", copyToFile); 1962 markup.bindValue(":CHANID", rec->chanid); 1963 markup.bindValue(":STARTTIME", rec->recstartts); 1964 1965 if (!markup.exec() || !markup.isActive()) 1966 { 1967 MythDB::DBError("video metadata update", markup); 1968 return; 1969 } 1970 1971 // Copy and set preview image as screenshot 1972 // If Banners, cover files, or fanart exist with 1973 // seriesID as the name, use them automatically. 1974 1975 QString screenshotFile = getPreviewImage(rec); 1976 QString MVScreenshotDir = gContext->GetSetting("mythvideo.screenshotDir"); 1977 QString MVScreenshotFile = QString("%1/%2.png").arg(MVScreenshotDir).arg(MVFileFormat); 1978 1979 QString MVBannerDir = gContext->GetSetting("mythvideo.bannerDir"); 1980 QString bannerFile = testImageFiles(MVBannerDir, rec->seriesid, rec->title); 1981 if (!bannerFile.isNull()) 1982 VERBOSE(VB_IMPORTANT, QString("Found Banner File Match: %1").arg(bannerFile)); 1983 1984 QString MVFanartDir = gContext->GetSetting("mythvideo.fanartDir"); 1985 QString fanartFile = testImageFiles(MVFanartDir, rec->seriesid, rec->title); 1986 if (!fanartFile.isNull()) 1987 VERBOSE(VB_IMPORTANT, QString("Found Fanart File Match: %1").arg(fanartFile)); 1988 1989 QString MVCoverDir = gContext->GetSetting("VideoArtworkDir"); 1990 QString coverFile = testImageFiles(MVCoverDir, rec->seriesid, rec->title); 1991 if (!coverFile.isNull()) 1992 VERBOSE(VB_IMPORTANT, QString("Found Cover File Match: %1").arg(coverFile)); 1993 1994 VERBOSE(VB_IMPORTANT, QString("Copying %1 to %2").arg(screenshotFile).arg(MVScreenshotFile)); 1995 1996 QFile fromScreenshot(screenshotFile); 1997 QFile toScreenshot(MVScreenshotFile); 1998 long long int screenshotBytesCopied; 1999 2000 if (!screenshotFile.isNull()) 2001 screenshotBytesCopied = copy(toScreenshot,fromScreenshot); 2002 2003 if (!bannerFile.isNull() || !fanartFile.isNull() 2004 || !coverFile.isNull() || !screenshotFile.isNull()) 2005 { 2006 MSqlQuery images(MSqlQuery::InitCon()); 2007 2008 images.prepare("UPDATE videometadata set screenshot=:SCREENSHOTFILE, " 2009 "banner=:BANNERFILE, fanart=:FANARTFILE, coverfile=:COVERFILE " 2010 "where filename=:FILENAME"); 2011 2012 images.bindValue(":SCREENSHOTFILE", MVScreenshotFile); 2013 images.bindValue(":BANNERFILE", bannerFile); 2014 images.bindValue(":FANARTFILE", fanartFile); 2015 images.bindValue(":COVERFILE", coverFile); 2016 images.bindValue(":FILENAME", copyToFile); 2017 2018 if (!images.exec() || !images.isActive()) 2019 { 2020 MythDB::DBError("video metadata update", images); 2021 return; 2022 } 2023 } 2024 else 2025 { 2026 VERBOSE(VB_IMPORTANT, QString("Copy succeeded, but no images " 2027 "were copied or found.")); 2028 return; 2029 } 2030 VERBOSE(VB_IMPORTANT, QString("Copy succeeded, %1 bytes copied.").arg(bytesCopied)); 2031 } 2032 else 2033 { 2034 VERBOSE(VB_IMPORTANT, QString("Copy unsuccessful, check all permissions.")); 2035 } 2036 2037 customExportDir.clear(); 2038 customExportFile.clear(); 2039 customExportSeason = 0; 2040 customExportEpisode = 0; 2041 seasonValue = 0; 2042 episodeValue = 0; 2043 } 2044 2045 unsigned int PlaybackBox::getLastSeason(QString title) 2046 { 2047 unsigned int retSeason; 2048 2049 if (!title.isEmpty()) 2050 { 2051 MSqlQuery season(MSqlQuery::InitCon()); 2052 2053 season.prepare("SELECT season from videometadata where " 2054 "title = :TITLE ORDER BY season DESC LIMIT 1"); 2055 2056 season.bindValue(":TITLE", title); 2057 2058 if (season.exec() && season.next()) 2059 { 2060 retSeason = season.value(0).toInt(); 2061 } 2062 else 2063 retSeason = 1; 2064 } 2065 2066 return retSeason; 2067 } 2068 2069 unsigned int PlaybackBox::getLastEpisode(QString title, unsigned int season) 2070 { 2071 unsigned int retEpisode; 2072 2073 if (!title.isEmpty()) 2074 { 2075 MSqlQuery episode(MSqlQuery::InitCon()); 2076 2077 episode.prepare("SELECT episode from videometadata where " 2078 "title = :TITLE AND season = :SEASON ORDER BY " 2079 "episode DESC LIMIT 1"); 2080 2081 episode.bindValue(":TITLE", title); 2082 episode.bindValue(":SEASON", season); 2083 2084 if (episode.exec() && episode.next()) 2085 { 2086 retEpisode = episode.value(0).toInt(); 2087 } 2088 else 2089 retEpisode = 0; 2090 } 2091 2092 return retEpisode; 2093 } 2094 2095 QString PlaybackBox::replaceExportVariables(ProgramInfo *rec, QString &repString) 2096 { 2097 if (!repString.isEmpty()) 2098 { 2099 QString seasonOneDigit, seasonTwoDigit, episode; 2100 episode = QString::number(episodeValue); 2101 2102 if (episode.length() == 1) 2103 episode.prepend("0"); 2104 2105 seasonOneDigit = seasonTwoDigit = QString::number(seasonValue); 2106 if (seasonTwoDigit.length() == 1) 2107 seasonTwoDigit.prepend("0"); 2108 2109 repString.replace(QRegExp("%FILE%"), rec->GetRecordBasename(true)); 2110 repString.replace(QRegExp("%TITLE%"), rec->title); 2111 repString.replace(QRegExp("%SUBTITLE%"), rec->subtitle); 2112 repString.replace(QRegExp("%DESCRIPTION%"), rec->description); 2113 repString.replace(QRegExp("%HOSTNAME%"), rec->hostname); 2114 repString.replace(QRegExp("%CATEGORY%"), rec->category); 2115 repString.replace(QRegExp("%RECGROUP%"), rec->recgroup); 2116 repString.replace(QRegExp("%PLAYGROUP%"), rec->playgroup); 2117 repString.replace(QRegExp("%ORIGAIRYEAR%"), 2118 rec->originalAirDate.toString("yyyy")); 2119 repString.replace(QRegExp("%ORIGAIRDATE%"), 2120 rec->originalAirDate.toString("yyyyMMdd")); 2121 repString.replace(QRegExp("%CALLSIGN%"), rec->chansign); 2122 repString.replace(QRegExp("%CHANNAME%"), rec->channame); 2123 repString.replace(QRegExp("%CHANID%"), rec->chanid); 2124 repString.replace(QRegExp("%STARTTIME%"), 2125 rec->recstartts.toString("yyyyMMddhhmmss")); 2126 repString.replace(QRegExp("%ENDTIME%"), 2127 rec->recendts.toString("yyyyMMddhhmmss")); 2128 repString.replace(QRegExp("%STARTTIMEISO%"), 2129 rec->recstartts.toString(Qt::ISODate)); 2130 repString.replace(QRegExp("%ENDTIMEISO%"), 2131 rec->recendts.toString(Qt::ISODate)); 2132 repString.replace(QRegExp("%PROGSTART%"), 2133 rec->startts.toString("yyyyMMddhhmmss")); 2134 repString.replace(QRegExp("%PROGEND%"), 2135 rec->endts.toString("yyyyMMddhhmmss")); 2136 repString.replace(QRegExp("%PROGSTARTISO%"), 2137 rec->startts.toString(Qt::ISODate)); 2138 repString.replace(QRegExp("%PROGENDISO%"), 2139 rec->endts.toString(Qt::ISODate)); 2140 if (seasonValue == 0 && episodeValue == 0) 2141 { 2142 // We don't want these to show up with movies. 2143 repString.replace(QRegExp("%SEASON%"), ""); 2144 repString.replace(QRegExp("%EPISODE%"), ""); 2145 repString.replace(QRegExp("%S##E##%"), ""); 2146 repString.replace(QRegExp("%##X##%"), ""); 2147 // This replace is just to remove extra junk 2148 // from the filename if exporting a movie 2149 // with the default export. 2150 repString.replace(QRegExp(" - "), ""); 2151 } 2152 else 2153 { 2154 repString.replace(QRegExp("%SEASON%"), 2155 QString::number(seasonValue)); 2156 repString.replace(QRegExp("%EPISODE%"), 2157 QString::number(episodeValue)); 2158 repString.replace(QRegExp("%S##E##%"), 2159 QString("s%1e%2").arg(seasonTwoDigit).arg(episode)); 2160 repString.replace(QRegExp("%##X##%"), 2161 QString("%1x%2").arg(seasonOneDigit).arg(episode)); 2162 } 2163 } 2164 return repString; 2165 } 2166 1815 2167 bool PlaybackBox::doRemove(ProgramInfo *rec, bool forgetHistory, 1816 2168 bool forceMetadataDelete) 1817 2169 { … … 1926 2278 foundFile = *it; 1927 2279 break; 1928 2280 } 1929 } 2281 } 1930 2282 reg = regs[++regIndex]; 1931 2283 } 1932 2284 1933 return QString("%1/%2").arg(testDirectory).arg(foundFile);1934 } 2285 if (!foundFile.isEmpty()); 2286 return QString("%1/%2").arg(testDirectory).arg(foundFile); 1935 2287 2288 return NULL; 2289 } 2290 1936 2291 void PlaybackBox::showActions(ProgramInfo *pginfo) 1937 2292 { 1938 2293 if (!pginfo) … … 1952 2307 showActionPopup(pginfo); 1953 2308 } 1954 2309 2310 void PlaybackBox::showExportPopup(ProgramInfo *program) 2311 { 2312 if (m_popupMenu) 2313 return; 2314 2315 QString label = tr("Are you sure you want to export:"); 2316 2317 m_expItem = CurrentItem(); 2318 popupString(m_expItem, label); 2319 2320 m_popupMenu = new MythDialogBox(label, m_popupStack, "pbbmainmenupopup"); 2321 2322 connect(m_popupMenu, SIGNAL(Exiting()), SLOT(popupClosed())); 2323 2324 if (m_popupMenu->Create()) 2325 m_popupStack->AddScreen(m_popupMenu); 2326 else 2327 { 2328 delete m_popupMenu; 2329 m_popupMenu = NULL; 2330 } 2331 2332 m_popupMenu->SetReturnEvent(this, "slotmenu"); 2333 2334 m_freeSpaceNeedsUpdate = true; 2335 QString tmpmessage; 2336 const char *tmpslot = NULL; 2337 2338 if (program->IsSameProgram(*program)) 2339 { 2340 tmpmessage = tr("Yes, Export to MythVideo"); 2341 tmpslot = SLOT(doMVExport()); 2342 m_popupMenu->AddButton(tmpmessage, tmpslot); 2343 2344 tmpmessage = tr("Export (Start New Season)"); 2345 tmpslot = SLOT(doNewSeasonExport()); 2346 m_popupMenu->AddButton(tmpmessage, tmpslot); 2347 2348 tmpmessage = tr("Export with custom name/location"); 2349 tmpslot = SLOT(showCustomExportEditor()); 2350 m_popupMenu->AddButton(tmpmessage, tmpslot); 2351 2352 tmpmessage = tr("No, I don't want to Export"); 2353 tmpslot = SLOT(noExport()); 2354 m_popupMenu->AddButton(tmpmessage, tmpslot); 2355 } 2356 } 2357 2358 1955 2359 void PlaybackBox::doPIPPlay(void) 1956 2360 { 1957 2361 doPIPPlay(kPIPonTV); … … 2378 2782 else 2379 2783 m_popupMenu->AddButton(tr("Preserve this episode"), 2380 2784 SLOT(togglePreserveEpisode())); 2785 2786 QString MVlocation = FindPluginName("mythvideo"); 2787 if (QFile(MVlocation).exists()) 2788 m_popupMenu->AddButton(tr("Export to MythVideo"), SLOT(askMVExport())); 2381 2789 } 2382 2790 } 2383 2791 … … 2754 3148 stop(pginfo); 2755 3149 } 2756 3150 3151 void PlaybackBox::doMVExport() 3152 { 3153 ProgramInfo *pginfo = CurrentItem(); 3154 mvexport(pginfo); 3155 } 3156 2757 3157 void PlaybackBox::showProgramDetails() 2758 3158 { 2759 3159 ProgramInfo *pginfo = CurrentItem(); … … 2892 3292 } 2893 3293 } 2894 3294 3295 void PlaybackBox::askMVExport(ProgramInfo *pginfo) 3296 { 3297 if (!pginfo) 3298 pginfo = CurrentItem(); 3299 showExportPopup(pginfo); 3300 } 3301 2895 3302 void PlaybackBox::askDelete() 2896 3303 { 2897 3304 if (m_delItem) … … 4130 4536 m_recordingList->RemoveItem(item); 4131 4537 } 4132 4538 4539 void PlaybackBox::showCustomExportEditor() 4540 { 4541 4542 MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); 4543 4544 CustomExportEdit *editExport = new CustomExportEdit(mainStack); 4545 4546 if (editExport->Create()) 4547 { 4548 connect(editExport, SIGNAL(result(const QString &, const QString &, 4549 unsigned int, unsigned int)), 4550 SLOT(startCustomExport(const QString &, const QString &, 4551 unsigned int, unsigned int))); 4552 mainStack->AddScreen(editExport); 4553 } 4554 else 4555 delete editExport; 4556 } 4557 4558 void PlaybackBox::doNewSeasonExport() 4559 { 4560 MythUIButtonListItem *item = m_recordingList->GetItemCurrent(); 4561 4562 if (!item) 4563 return; 4564 4565 ProgramInfo *pginfo = CurrentItem(); 4566 4567 if (!pginfo) 4568 return; 4569 4570 customExportFile = gContext->GetSetting("mythvideo.TVExportFileFormat", 4571 "%TITLE% %##X##% - %SUBTITLE%"); 4572 customExportDir = gContext->GetSetting("mythvideo.TVExportDirFormat", 4573 "Television/%TITLE%/"); 4574 customExportSeason = (getLastSeason(pginfo->title) + 1); 4575 customExportEpisode = 1; 4576 4577 mvexport(pginfo); 4578 } 4579 4580 void PlaybackBox::startCustomExport(const QString &newFile, const QString &newDir, 4581 unsigned int newSeason, unsigned int newEpisode) 4582 { 4583 MythUIButtonListItem *item = m_recordingList->GetItemCurrent(); 4584 4585 if (!item) 4586 return; 4587 4588 ProgramInfo *pginfo = CurrentItem(); 4589 4590 if (!pginfo) 4591 return; 4592 4593 customExportFile = newFile; 4594 customExportDir = newDir; 4595 customExportSeason = newSeason; 4596 customExportEpisode = newEpisode; 4597 4598 mvexport(pginfo); 4599 } 4600 4133 4601 void PlaybackBox::setRecGroup(QString newRecGroup) 4134 4602 { 4135 4603 ProgramInfo *tmpItem = CurrentItem(); … … 4515 4985 Close(); 4516 4986 } 4517 4987 4988 //////////////////////////////////////////////////////// 4989 4990 CustomExportEdit::CustomExportEdit(MythScreenStack *lparent) 4991 : MythScreenType(lparent, "customexportedit") 4992 { 4993 m_dirEdit = m_fileEdit = NULL; 4994 } 4995 4996 bool CustomExportEdit::Create() 4997 { 4998 if (!LoadWindowFromXML("recordings-ui.xml", "customexport", this)) 4999 return false; 5000 5001 m_dirEdit = dynamic_cast<MythUITextEdit*>(GetChild("dir")); 5002 m_fileEdit = dynamic_cast<MythUITextEdit*>(GetChild("file")); 5003 m_seasonSpin = dynamic_cast<MythUISpinBox *>(GetChild("season")); 5004 m_episodeSpin = dynamic_cast<MythUISpinBox *>(GetChild("episode")); 5005 5006 MythUIButton *okButton = dynamic_cast<MythUIButton*>(GetChild("ok")); 5007 5008 if (!m_dirEdit || !m_fileEdit || !m_seasonSpin || 5009 !m_episodeSpin || !okButton) 5010 { 5011 VERBOSE(VB_IMPORTANT, "Window 'customexport' is missing required " 5012 "elements."); 5013 return false; 5014 } 5015 5016 m_dirEdit->SetText(gContext->GetSetting("mythvideo.TVExportDirFormat"), 5017 "Television/%TITLE%/"); 5018 m_fileEdit->SetText(gContext->GetSetting("mythvideo.TVExportFileFormat"), 5019 "%TITLE% %##X##% - %SUBTITLE%"); 5020 m_seasonSpin->SetRange(0,100,1); 5021 m_seasonSpin->SetValue(1); 5022 m_episodeSpin->SetRange(0,999,1); 5023 m_episodeSpin->SetValue(1); 5024 5025 connect(okButton, SIGNAL(Clicked()), SLOT(ReturnExport())); 5026 5027 if (!BuildFocusList()) 5028 VERBOSE(VB_IMPORTANT, "Failed to build a focuslist."); 5029 5030 return true; 5031 } 5032 5033 void CustomExportEdit::ReturnExport() 5034 { 5035 QString newExportDir = m_dirEdit->GetText(); 5036 QString newExportFile = m_fileEdit->GetText(); 5037 unsigned int newSeason = m_seasonSpin->GetIntValue(); 5038 unsigned int newEpisode = m_episodeSpin->GetIntValue(); 5039 5040 emit result(newExportFile, newExportDir, newSeason, newEpisode); 5041 Close(); 5042 } 5043 4518 5044 ////////////////////////////////////////// 4519 5045 4520 5046 HelpPopup::HelpPopup(MythScreenStack *lparent) -
mythtv/programs/mythfrontend/playbackbox.h
142 142 void showRecGroupChanger(); 143 143 void showPlayGroupChanger(); 144 144 void showMetadataEditor(); 145 void showCustomExportEditor(); 145 146 void showGroupFilter(); 146 147 void showRecGroupPasswordChanger(); 147 148 void showPlayFromPopup(); … … 173 174 174 175 void askStop(); 175 176 void doStop(); 177 void askMVExport(ProgramInfo *pginfo = NULL); 178 void doMVExport(); 176 179 177 180 void doEditScheduled(); 178 181 void doAllowRerecord(); … … 203 206 void setPlayGroup(QString newPlayGroup); 204 207 205 208 void saveRecMetadata(const QString &newTitle, const QString &newSubtitle); 209 void startCustomExport(const QString &newFile, const QString &newDir, 210 unsigned int newSeason, unsigned int newEpisode); 211 void doNewSeasonExport(); 206 212 207 213 void SetRecGroupPassword(const QString &newPasswd); 208 214 … … 263 269 264 270 bool play(ProgramInfo *rec, bool inPlaylist = false); 265 271 void stop(ProgramInfo *); 272 void mvexport(ProgramInfo *); 273 unsigned int getLastSeason(QString title); 274 unsigned int getLastEpisode(QString title, unsigned int season); 275 QString replaceExportVariables(ProgramInfo *rec, QString &repString); 266 276 void remove(ProgramInfo *); 267 277 void showActions(ProgramInfo *); 268 278 ProgramInfo *CurrentItem(void); … … 282 292 283 293 bool doRemove(ProgramInfo *, bool forgetHistory, bool forceMetadataDelete); 284 294 void showDeletePopup(deletePopupType); 295 void showExportPopup(ProgramInfo *); 285 296 void showActionPopup(ProgramInfo *program); 286 297 void showFileNotFoundActionPopup(ProgramInfo *program); 287 298 void popupString(ProgramInfo *program, QString &message); … … 382 393 // Other state 383 394 /// Program currently selected for deletion 384 395 ProgramInfo *m_delItem; 396 /// Program currently selected for export 397 ProgramInfo *m_expItem; 385 398 /// Program currently selected during an update 386 399 ProgramInfo *m_currentItem; 387 400 /// Group currently selected 388 401 QString m_currentGroup; 389 402 403 // Custom Export and Season/Episode 404 QString customExportFile; 405 QString customExportDir; 406 unsigned int seasonValue; 407 unsigned int episodeValue; 408 unsigned int customExportSeason; 409 unsigned int customExportEpisode; 410 390 411 // Play List support 391 412 QStringList m_playList; ///< list of selected items "play list" 392 413 … … 518 539 private: 519 540 MythUITextEdit *m_titleEdit; 520 541 MythUITextEdit *m_subtitleEdit; 542 MythUITextEdit *m_descriptionEdit; 521 543 522 544 ProgramInfo *m_progInfo; 523 545 }; 524 546 547 class CustomExportEdit : public MythScreenType 548 { 549 Q_OBJECT 550 551 public: 552 CustomExportEdit(MythScreenStack *lparent); 553 554 bool Create(void); 555 556 signals: 557 void result(const QString &, const QString &, unsigned int, unsigned int); 558 559 protected slots: 560 void ReturnExport(void); 561 562 private: 563 MythUITextEdit *m_dirEdit; 564 MythUITextEdit *m_fileEdit; 565 MythUISpinBox *m_seasonSpin; 566 MythUISpinBox *m_episodeSpin; 567 568 }; 569 525 570 class HelpPopup : public MythScreenType 526 571 { 527 572 Q_OBJECT -
mythplugins/mythvideo/mythvideo/globalsettings.cpp
246 296 return gc; 247 297 } 248 298 299 HostLineEdit *TVExportDirectoryFormat() 300 { 301 HostLineEdit *gc = new HostLineEdit("mythvideo.TVExportDirFormat"); 302 gc->setLabel(QObject::tr("TV Export Directory Format")); 303 gc->setValue(DEFAULT_TVEXPORTDIRFORMAT); 304 gc->setHelpText(QObject::tr("Directory format for recording export " 305 "to MythVideo, using user job style variables. Directory " 306 "is off of base MythVideo directory. Example: " 307 "Television/%CATEGORY%/%TITLE%")); 308 return gc; 309 } 310 311 HostLineEdit *TVExportFileFormat() 312 { 313 HostLineEdit *gc = new HostLineEdit("mythvideo.TVExportFileFormat"); 314 gc->setLabel(QObject::tr("TV Export File Format")); 315 gc->setValue(DEFAULT_TVEXPORTFILEFORMAT); 316 gc->setHelpText(QObject::tr("File format for recording export " 317 "to MythVideo, using user job style variables. Example: " 318 "%TITLE% %S##E##% - %SUBTITLE% (%STARTTIMEISO%)")); 319 return gc; 320 } 321 249 322 HostLineEdit *VideoArtworkDirectory() 250 323 { 251 324 HostLineEdit *gc = new HostLineEdit("VideoArtworkDir"); … … 729 801 page1->addChild(VideoBannerDirectory()); 730 802 page1->addChild(VideoFanartDirectory()); 731 803 page1->addChild(VideoDefaultView()); 804 page1->addChild(TVExportDirectoryFormat()); 805 page1->addChild(TVExportFileFormat()); 732 806 733 807 VConfigPage page2(pages, false); 734 808 page2->addChild(VideoListUnknownFiletypes()); -
mythplugins/mythvideo/mythvideo/globals.cpp
28 28 const QString JUMP_VIDEO_TREE = "Video Listings"; 29 29 const QString JUMP_VIDEO_GALLERY = "Video Gallery"; 30 30 const QString JUMP_VIDEO_DEFAULT = "MythVideo"; 31 const QString DEFAULT_TVEXPORTDIRFORMAT = "Television/%TITLE%"; 32 const QString DEFAULT_TVEXPORTFILEFORMAT = "%TITLE% %##X##% - %SUBTITLE%"; 31 33 32 34 #ifdef Q_WS_MACX 33 35 const QString DEFAULT_VIDEOSTARTUP_DIR = QDir::homePath() + "/Movies"; -
mythplugins/mythvideo/mythvideo/globals.h
28 28 extern const QString JUMP_VIDEO_DEFAULT; 29 29 30 30 extern const QString DEFAULT_VIDEOSTARTUP_DIR; 31 extern const QString DEFAULT_TVEXPORTDIRFORMAT; 32 extern const QString DEFAULT_TVEXPORTFILEFORMAT; 31 33 32 34 #endif // GLOBALS_H_