Ticket #5920: trailerpatch.2.diff
File trailerpatch.2.diff, 23.4 KB (added by , 15 years ago) |
---|
-
mythvideo/theme/default/video-ui.xml
788 788 </textarea> 789 789 790 790 <textarea name="browse_text" from="title_text"> 791 <position>50,3 40</position>791 <position>50,337</position> 792 792 <value>Include while Browsing:</value> 793 793 </textarea> 794 794 795 795 <textarea name="coverart_text_label" from="title_text"> 796 <position>50,3 90</position>796 <position>50,375</position> 797 797 <value>Cover Art:</value> 798 798 </textarea> 799 799 800 <textarea name="trailer_text_label" from="title_text"> 801 <position>50,405</position> 802 <value>Trailer:</value> 803 </textarea> 804 800 805 <textarea name="player_text" from="title_text"> 801 806 <position>50,445</position> 802 807 <value>Unique Player Command:</value> … … 825 830 </checkbox> 826 831 827 832 <button name="coverart_button"> 828 <area>310,3 85,32,32</area>833 <area>310,370,32,32</area> 829 834 <statetype name="buttonstate"> 830 835 <state name="active"> 831 836 <imagetype name="background"> … … 847 852 </button> 848 853 849 854 <textarea name="coverart_text" from="basetextarea"> 850 <area>350,3 90,250,40</area>855 <area>350,375,250,40</area> 851 856 <value>/path/to/the/thing.jpg</value> 852 857 </textarea> 853 858 859 <button name="trailer_button"> 860 <area>310,400,32,32</area> 861 <statetype name="buttonstate"> 862 <state name="active"> 863 <imagetype name="background"> 864 <filename>blankbutton_off.png</filename> 865 </imagetype> 866 </state> 867 <state name="selected" from="active"> 868 <imagetype name="background"> 869 <filename>blankbutton_on.png</filename> 870 </imagetype> 871 </state> 872 <state name="disabled" from="active" /> 873 <state name="pushed" from="active"> 874 <imagetype name="background"> 875 <filename>blankbutton_pushed.png</filename> 876 </imagetype> 877 </state> 878 </statetype> 879 </button> 880 881 <textarea name="trailer_text" from="basetextarea"> 882 <area>350,405,250,40</area> 883 <value>/path/to/the/thing.jpg</value> 884 </textarea> 885 886 854 887 <textedit name="player_edit" from="basetextedit"> 855 888 <position>310,435</position> 856 889 </textedit> -
mythvideo/theme/default-wide/video-ui.xml
780 780 </textarea> 781 781 782 782 <textarea name="browse_text" from="title_text"> 783 <position>50,3 40</position>783 <position>50,337</position> 784 784 <value>Include while Browsing:</value> 785 785 </textarea> 786 786 787 787 <textarea name="coverart_text_label" from="title_text"> 788 <position>50,3 90</position>788 <position>50,375</position> 789 789 <value>Cover Art:</value> 790 790 </textarea> 791 791 792 <textarea name="trailer_text_label" from="title_text"> 793 <position>50,405</position> 794 <value>Trailer:</value> 795 </textarea> 796 792 797 <textarea name="player_text" from="title_text"> 793 798 <position>50,445</position> 794 799 <value>Unique Player Command:</value> … … 817 822 </checkbox> 818 823 819 824 <button name="coverart_button"> 820 <area>310,3 85,32,32</area>825 <area>310,370,32,32</area> 821 826 <statetype name="buttonstate"> 822 827 <state name="active"> 823 828 <imagetype name="background"> … … 839 844 </button> 840 845 841 846 <textarea name="coverart_text" from="basetextarea"> 842 <area>350,3 90,250,40</area>847 <area>350,375,250,40</area> 843 848 <value>/path/to/the/thing.jpg</value> 844 849 </textarea> 845 850 851 <button name="trailer_button"> 852 <area>310,400,32,32</area> 853 <statetype name="buttonstate"> 854 <state name="active"> 855 <imagetype name="background"> 856 <filename>blankbutton_off.png</filename> 857 </imagetype> 858 </state> 859 <state name="selected" from="active"> 860 <imagetype name="background"> 861 <filename>blankbutton_on.png</filename> 862 </imagetype> 863 </state> 864 <state name="disabled" from="active" /> 865 <state name="pushed" from="active"> 866 <imagetype name="background"> 867 <filename>blankbutton_pushed.png</filename> 868 </imagetype> 869 </state> 870 </statetype> 871 </button> 872 873 <textarea name="trailer_text" from="basetextarea"> 874 <area>350,405,250,40</area> 875 <value>/path/to/the/thing.jpg</value> 876 </textarea> 877 846 878 <textedit name="player_edit" from="basetextedit"> 847 879 <position>310,435</position> 848 880 </textedit> -
mythvideo/mythvideo/videodlg.h
58 58 void SetCurrentNode(MythGenericTree *); 59 59 60 60 void playVideo(); 61 void playVideoWithTrailers(); 62 void playTrailer(); 61 63 62 64 void SwitchTree(); 63 65 void SwitchGallery(); -
mythvideo/mythvideo/metadatalistmanager.cpp
113 113 const QString BaseMetadataQuery( 114 114 "SELECT title, director, plot, rating, year, userrating," 115 115 "length, filename, showlevel, coverfile, inetref, childid," 116 "browse, playcommand, category, intid FROM videometadata");116 "browse, playcommand, category, intid, trailer FROM videometadata"); 117 117 118 118 query.prepare(BaseMetadataQuery); 119 119 -
mythvideo/mythvideo/metadata.cpp
87 87 typedef Metadata::cast_list cast_list; 88 88 89 89 public: 90 MetadataImp(const QString &filename, const QString & coverfile,90 MetadataImp(const QString &filename, const QString &trailer, const QString &coverfile, 91 91 const QString &title, int year, 92 92 const QString &inetref, const QString &director, 93 93 const QString &plot, float userrating, … … 102 102 m_inetref(inetref), m_director(director), m_plot(plot), 103 103 m_rating(rating), m_playcommand(playcommand), m_category(category), 104 104 m_genres(genres), m_countries(countries), m_cast(cast), 105 m_filename(filename), m_ coverfile(coverfile),105 m_filename(filename), m_trailer(trailer), m_coverfile(coverfile), 106 106 m_categoryID(categoryID), m_childID(childID), m_year(year), 107 107 m_length(length), m_showlevel(showlevel), m_browse(browse), m_id(id), 108 108 m_userrating(userrating) … … 135 135 m_countries = rhs.m_countries; 136 136 m_cast = rhs.m_cast; 137 137 m_filename = rhs.m_filename; 138 m_trailer = rhs.m_trailer; 138 139 m_coverfile = rhs.m_coverfile; 139 140 140 141 m_categoryID = rhs.m_categoryID; … … 212 213 const QString &getFilename() const { return m_filename; } 213 214 void setFilename(const QString &filename) { m_filename = filename; } 214 215 216 const QString &getTrailer() const { return m_trailer; } 217 void setTrailer(const QString &trailer) { m_trailer = trailer; } 218 215 219 QString getFilenameNoPrefix() const 216 220 { 217 221 QString ret(m_filename); … … 293 297 country_list m_countries; 294 298 cast_list m_cast; 295 299 QString m_filename; 300 QString m_trailer; 296 301 QString m_coverfile; 297 302 298 303 int m_categoryID; … … 393 398 394 399 void MetadataImp::Reset() 395 400 { 396 MetadataImp tmp(m_filename, VIDEO_ COVERFILE_DEFAULT,401 MetadataImp tmp(m_filename, VIDEO_TRAILER_DEFAULT, VIDEO_COVERFILE_DEFAULT, 397 402 Metadata::FilenameToTitle(m_filename), VIDEO_YEAR_DEFAULT, 398 403 VIDEO_INETREF_DEFAULT, VIDEO_DIRECTOR_DEFAULT, 399 404 VIDEO_PLOT_DEFAULT, 0.0, VIDEO_RATING_DEFAULT, 0, m_id, … … 485 490 m_playcommand = query.value(13).toString(); 486 491 m_categoryID = query.value(14).toInt(); 487 492 m_id = query.value(15).toInt(); 493 m_trailer = query.value(16).toString(); 488 494 489 495 VideoCategory::getCategory().get(m_categoryID, m_category); 490 496 … … 510 516 m_rating = VIDEO_RATING_DEFAULT; 511 517 if (m_coverfile.isEmpty()) 512 518 m_coverfile = VIDEO_COVERFILE_DEFAULT; 519 if (m_trailer.isEmpty()) 520 m_trailer = VIDEO_TRAILER_DEFAULT; 513 521 if (m_inetref.isEmpty()) 514 522 m_inetref = VIDEO_INETREF_DEFAULT; 515 523 if (isnan(m_userrating)) … … 527 535 528 536 query.prepare("INSERT INTO videometadata (title,director,plot," 529 537 "rating,year,userrating,length,filename,showlevel," 530 "coverfile,inetref,browse ) VALUES (:TITLE, :DIRECTOR, "538 "coverfile,inetref,browse,trailer) VALUES (:TITLE, :DIRECTOR, " 531 539 ":PLOT, :RATING, :YEAR, :USERRATING, :LENGTH, " 532 ":FILENAME, :SHOWLEVEL, :COVERFILE, :INETREF, :BROWSE )");540 ":FILENAME, :SHOWLEVEL, :COVERFILE, :INETREF, :BROWSE, :TRAILER)"); 533 541 534 542 } 535 543 else … … 537 545 query.prepare("UPDATE videometadata SET title = :TITLE, " 538 546 "director = :DIRECTOR, plot = :PLOT, rating= :RATING, " 539 547 "year = :YEAR, userrating = :USERRATING, " 540 "length = :LENGTH, filename = :FILENAME, "548 "length = :LENGTH, filename = :FILENAME, trailer = :TRAILER, " 541 549 "showlevel = :SHOWLEVEL, coverfile = :COVERFILE, " 542 550 "inetref = :INETREF, browse = :BROWSE, " 543 551 "playcommand = :PLAYCOMMAND, childid = :CHILDID, " … … 557 565 query.bindValue(":USERRATING", m_userrating); 558 566 query.bindValue(":LENGTH", m_length); 559 567 query.bindValue(":FILENAME", m_filename); 568 query.bindValue(":TRAILER", m_trailer); 560 569 query.bindValue(":SHOWLEVEL", m_showlevel); 561 570 query.bindValue(":COVERFILE", m_coverfile); 562 571 query.bindValue(":INETREF", m_inetref); … … 892 901 return false; 893 902 } 894 903 895 Metadata::Metadata(const QString &filename, const QString & coverfile,904 Metadata::Metadata(const QString &filename, const QString &trailer, const QString &coverfile, 896 905 const QString &title, int year, 897 906 const QString &inetref, const QString &director, 898 907 const QString &plot, float userrating, … … 904 913 const country_list &countries, 905 914 const cast_list &cast) 906 915 { 907 m_imp = new MetadataImp(filename, coverfile, title, year, inetref, director,916 m_imp = new MetadataImp(filename, trailer, coverfile, title, year, inetref, director, 908 917 plot, userrating, rating, length, id, showlevel, 909 918 categoryID, childID, browse, playcommand, category, 910 919 genres, countries, cast); … … 1116 1125 return m_imp->getFilenameNoPrefix(); 1117 1126 } 1118 1127 1128 const QString &Metadata::Trailer() const 1129 { 1130 return m_imp->getTrailer(); 1131 } 1132 1133 void Metadata::setTrailer(const QString &trailer) 1134 { 1135 m_imp->setTrailer(trailer); 1136 } 1137 1119 1138 const QString &Metadata::CoverFile() const 1120 1139 { 1121 1140 return m_imp->getCoverFile(); -
mythvideo/mythvideo/globalsettings.cpp
247 247 return gc; 248 248 } 249 249 250 HostLineEdit *TrailerDirectory() 251 { 252 HostLineEdit *gc = new HostLineEdit("MythVideo.TrailerDir"); 253 gc->setLabel(QObject::tr("Directory that holds movie trailers")); 254 gc->setValue(GetConfDir() + "/mnt/store/trailers"); 255 gc->setHelpText(QObject::tr("This directory must exist, and the user " 256 "running MythVideo needs to have read/write permission " 257 "to the directory.")); 258 return gc; 259 } 260 261 HostCheckBox *TrailersBeforeVideo() 262 { 263 HostCheckBox *gc = new HostCheckBox("MythVideo.EnableTrailers"); 264 gc->setLabel(QObject::tr("Enable random trailers before videos")); 265 gc->setValue(false); 266 gc->setHelpText(QObject::tr("If set, this will enable a button " 267 "called \"Watch With Trailers\" which will " 268 "play a user-specified number of trailers " 269 "before the movie.")); 270 return gc; 271 } 272 273 HostSpinBox *TrailerNumber() 274 { 275 HostSpinBox *gc = new HostSpinBox("MythVideo.TrailerNumber", 0, 10, 1); 276 gc->setLabel(QObject::tr("Number of trailers to play")); 277 gc->setValue(3); 278 gc->setHelpText(QObject::tr("The number of trailers to play " 279 "before playing the film itself ")); 280 return gc; 281 } 282 283 250 284 //Player Settings 251 285 252 286 HostLineEdit *VideoDefaultPlayer() … … 686 720 VConfigPage page6(pages, false); 687 721 page6->addChild(new RatingsToPL()); 688 722 723 // page 7 724 VerticalConfigurationGroup *trlr = 725 new VerticalConfigurationGroup(true, false); 726 trlr->addChild(TrailerDirectory()); 727 trlr->addChild(TrailersBeforeVideo()); 728 trlr->addChild(TrailerNumber()); 729 VConfigPage page7(pages, false); 730 page7->addChild(trlr); 731 732 689 733 int page_num = 1; 690 734 for (ConfigPage::PageList::const_iterator p = pages.begin(); 691 735 p != pages.end(); ++p, ++page_num) -
mythvideo/mythvideo/globals.cpp
15 15 const QString VIDEO_DIRECTOR_DEFAULT = VIDEO_DIRECTOR_UNKNOWN; 16 16 const QString VIDEO_INETREF_DEFAULT = "00000000"; 17 17 const QString VIDEO_COVERFILE_DEFAULT = QObject::tr("No Cover"); 18 const QString VIDEO_TRAILER_DEFAULT = QObject::tr("No Trailer"); 18 19 const QString VIDEO_RATING_DEFAULT = QObject::tr("NR"); 19 20 const QString VIDEO_PLOT_DEFAULT = QObject::tr("None"); 20 21 const QString VIDEO_CAST_DEFAULT = VIDEO_CAST_UNKNOWN; -
mythvideo/mythvideo/dbcheck.cpp
14 14 const QString lastMythDVDDBVersion = "1002"; 15 15 const QString lastMythVideoVersion = "1010"; 16 16 17 const QString currentDatabaseVersion = "10 19";17 const QString currentDatabaseVersion = "1020"; 18 18 19 19 const QString OldMythVideoVersionName = "VideoDBSchemaVer"; 20 20 const QString OldMythDVDVersionName = "DVDDBSchemaVer"; … … 763 763 performActualUpdate(updates, "1019", dbver, MythVideoVersionName); 764 764 } 765 765 766 if (dbver == "1019") 767 { 768 const QString updates[] = { 769 "ALTER TABLE `videometadata` ADD `trailer` TEXT NOT NULL ;", 770 "" 771 }; 772 773 performActualUpdate(updates, "1020", dbver, MythVideoVersionName); 774 } 775 766 776 } 767 777 } 768 778 -
mythvideo/mythvideo/editmetadata.h
60 60 MythUICheckBox *m_browseCheck; 61 61 MythUIButton *m_coverartButton; 62 62 MythUIText *m_coverartText; 63 MythUIButton *m_trailerButton; 64 MythUIText *m_trailerText; 63 65 MythUIButton *m_doneButton; 64 66 65 67 // -
mythvideo/mythvideo/videodlg.cpp
23 23 #include <mythtv/libmythui/mythuistatetype.h> 24 24 #include <mythtv/libmythui/mythdialogbox.h> 25 25 #include <mythtv/libmythui/mythgenerictree.h> 26 #include "mythtv/libmythui/mythmainwindow.h" 26 27 27 28 #include "videodlg.h" 28 29 #include "videoscan.h" … … 1366 1367 if (node && node->getInt() >= 0) 1367 1368 { 1368 1369 m_menuPopup->AddButton(tr("Watch This Video"), SLOT(playVideo())); 1370 1371 int randTrailers = gContext->GetNumSetting("MythVideo.EnableTrailers",0); 1372 if (randTrailers != 0) 1373 { 1374 m_menuPopup->AddButton(tr("Watch With Trailers"), 1375 SLOT(playVideoWithTrailers())); 1376 } 1377 1378 Metadata *metadata = GetMetadata(GetItemCurrent()); 1379 QString trailerFile = QString("%1").arg(metadata->Trailer()); 1380 if (QFile::exists(trailerFile)) 1381 { 1382 m_menuPopup->AddButton(tr("Watch Trailer"), SLOT(playTrailer())); 1383 } 1384 1369 1385 m_menuPopup->AddButton(tr("Video Info"), SLOT(InfoMenu())); 1370 1386 m_menuPopup->AddButton(tr("Manage Video"), SLOT(ManageMenu())); 1371 1387 } … … 1563 1579 gContext->GetMainWindow()->currentWidget()->setFocus(); 1564 1580 } 1565 1581 1582 void VideoDialog::playVideoWithTrailers() 1583 { 1584 Metadata *metadata = GetMetadata(GetItemCurrent()); 1585 1586 QString trailerFile; 1587 QString trailerFolder = gContext->GetSetting("Mythvideo.TrailerDir", 1588 "/MythMedia/trailers"); 1589 QString command_string = "Internal"; 1590 int trailersPlayed = 0; 1591 int trailersToPlay = gContext->GetNumSetting("MythVideo.TrailerNumber", 3); 1592 1593 QDir trailerDir(trailerFolder); 1594 QStringList trailerTypes; 1595 1596 trailerTypes.append("*"); 1597 trailerDir.setNameFilters(trailerTypes); 1598 1599 QStringList trailerAvailList = trailerDir.entryList(); 1600 1601 QString printTrailers = trailerAvailList.join( ", " ); 1602 VERBOSE(VB_IMPORTANT, QString("Trailers are: %1") 1603 .arg(printTrailers)); 1604 1605 srand ( time(NULL) ); 1606 1607 if (trailerAvailList.size() < 1) return; 1608 1609 while (trailersPlayed < trailersToPlay) 1610 { 1611 trailerFile = QString("%1/%2").arg(trailerFolder) 1612 .arg(trailerAvailList.takeAt(rand() % trailerAvailList.size())); 1613 1614 VERBOSE(VB_IMPORTANT, QString("Random trailer to play will be: %1") 1615 .arg(trailerFile)); 1616 1617 gContext->GetMainWindow()->HandleMedia(command_string, trailerFile); 1618 gContext->GetMainWindow()->raise(); 1619 gContext->GetMainWindow()->activateWindow(); 1620 if (gContext->GetMainWindow()->currentWidget()) 1621 gContext->GetMainWindow()->currentWidget()->setFocus(); 1622 trailersPlayed++; 1623 } 1624 1625 // Finish by playing the Video itself 1626 1627 PlayVideo(metadata->Filename(), m_videoList->getListCache()); 1628 1629 gContext->GetMainWindow()->raise(); 1630 gContext->GetMainWindow()->activateWindow(); 1631 if (gContext->GetMainWindow()->currentWidget()) 1632 gContext->GetMainWindow()->currentWidget()->setFocus(); 1633 } 1634 1635 void VideoDialog::playTrailer() 1636 { 1637 Metadata *metadata = GetMetadata(GetItemCurrent()); 1638 QString trailerFile = QString("%1").arg(metadata->Trailer()); 1639 QString command_string = "Internal"; 1640 1641 gContext->GetMainWindow()->HandleMedia(command_string, trailerFile); 1642 gContext->GetMainWindow()->raise(); 1643 gContext->GetMainWindow()->activateWindow(); 1644 if (gContext->GetMainWindow()->currentWidget()) 1645 gContext->GetMainWindow()->currentWidget()->setFocus(); 1646 } 1647 1566 1648 void VideoDialog::setParentalLevel(const ParentalLevel::Level &level) 1567 1649 { 1568 1650 m_private->m_parentalLevel.SetLevel(level); -
mythvideo/mythvideo/videoscan.cpp
181 181 // add files not already in the DB 182 182 if (!p->second) 183 183 { 184 Metadata newFile(p->first, VIDEO_ COVERFILE_DEFAULT,184 Metadata newFile(p->first, VIDEO_TRAILER_DEFAULT, VIDEO_COVERFILE_DEFAULT, 185 185 Metadata::FilenameToTitle(p->first), 186 186 VIDEO_YEAR_DEFAULT, 187 187 VIDEO_INETREF_DEFAULT, VIDEO_DIRECTOR_DEFAULT, -
mythvideo/mythvideo/metadata.h
53 53 bool &use_default); 54 54 55 55 public: 56 Metadata(const QString &filename = "", const QString & coverfile = "",56 Metadata(const QString &filename = "", const QString &trailer = "", const QString &coverfile = "", 57 57 const QString &title = "", int year = VIDEO_YEAR_DEFAULT, 58 58 const QString &inetref = "", const QString &director = "", 59 59 const QString &plot = "", float userrating = 0.0, … … 125 125 const QString& Filename() const; 126 126 void setFilename(const QString &filename); 127 127 128 const QString& Trailer() const; 129 void setTrailer(const QString &trailer); 130 128 131 QString getFilenameNoPrefix() const; 129 132 130 133 const QString &CoverFile() const; -
mythvideo/mythvideo/editmetadata.cpp
22 22 const MetadataListManager &cache) : MythScreenType(lparent, lname), 23 23 m_origMetadata(source_metadata), m_titleEdit(0), m_playerEdit(0), 24 24 m_categoryList(0), m_levelList(0), m_childList(0), m_browseCheck(0), 25 m_coverartButton(0), m_coverartText(0), m_doneButton(0), 25 m_coverartButton(0), m_coverartText(0), 26 m_trailerButton(0), m_trailerText(0), m_doneButton(0), 26 27 cachedChildSelection(0), m_metaCache(cache) 27 28 { 28 29 m_workingMetadata = new Metadata(*m_origMetadata); … … 43 44 UIUtilE::Assign(this, m_playerEdit, "player_edit", &err); 44 45 45 46 UIUtilE::Assign(this, m_coverartText, "coverart_text", &err); 47 UIUtilE::Assign(this, m_trailerText, "trailer_text", &err); 46 48 47 49 UIUtilE::Assign(this, m_categoryList, "category_select", &err); 48 50 UIUtilE::Assign(this, m_levelList, "level_select", &err); … … 213 215 if (m_workingMetadata->Browse()) 214 216 m_browseCheck->SetCheckState(MythUIStateType::Full); 215 217 m_coverartText->SetText(m_workingMetadata->CoverFile()); 218 m_trailerText->SetText(m_workingMetadata->Trailer()); 216 219 m_playerEdit->SetText(m_workingMetadata->PlayCommand()); 217 220 } 218 221 -
mythvideo/mythvideo/globals.h
13 13 extern const QString VIDEO_DIRECTOR_DEFAULT; 14 14 extern const QString VIDEO_INETREF_DEFAULT; 15 15 extern const QString VIDEO_COVERFILE_DEFAULT; 16 extern const QString VIDEO_TRAILER_DEFAULT; 16 17 extern const QString VIDEO_RATING_DEFAULT; 17 18 extern const QString VIDEO_PLOT_DEFAULT; 18 19 extern const QString VIDEO_CAST_DEFAULT;