Ticket #6346: MythVideo.SubSeasEp.31609-2.diff
File MythVideo.SubSeasEp.31609-2.diff, 42.4 KB (added by , 12 years ago) |
---|
-
mythplugins/mythvideo/theme/default/video-ui.xml
867 867 <!-- Labels --> 868 868 869 869 <textarea name="title_text" from="basetextarea"> 870 <area>50, 90,250,40</area>871 <value> Name:</value>870 <area>50,80,250,40</area> 871 <value>Title:</value> 872 872 <align>right,top</align> 873 873 </textarea> 874 874 875 <textarea name="subtitle_text" from="basetextarea"> 876 <area>50,138,250,40</area> 877 <value>Subtitle:</value> 878 <align>right,top</align> 879 </textarea> 880 881 <textarea name="season_text" from="basetextarea"> 882 <area>50,185,250,40</area> 883 <value>Season:</value> 884 <align>right,top</align> 885 </textarea> 886 887 <textarea name="episode_text" from="basetextarea"> 888 <area>370,185,150,40</area> 889 <value>Episode:</value> 890 <align>right,top</align> 891 </textarea> 892 875 893 <textarea name="category_text" from="title_text"> 876 <position>50,152</position> 894 <area>370,232,150,40</area> 895 <align>right</align> 877 896 <value>Category:</value> 878 897 </textarea> 879 898 880 899 <textarea name="level_text" from="title_text"> 881 <position>50,202</position> 900 <area>20,232,200,40</area> 901 <align>right</align> 882 902 <value>Parental Control:</value> 883 903 </textarea> 884 904 885 905 <textarea name="child_text" from="title_text"> 886 <position>50,247</position> 906 <area>20,277,200,40</area> 907 <align>right</align> 887 908 <value>File to Always Play Next:</value> 888 909 </textarea> 889 910 890 911 <textarea name="browse_text" from="title_text"> 891 <position>50,292</position> 912 <area>500,277,200,40</area> 913 <align>left</align> 892 914 <value>Include while Browsing:</value> 893 915 </textarea> 894 916 … … 925 947 <!-- Widgets --> 926 948 927 949 <textedit name="title_edit" from="basetextedit"> 928 <position>310, 80</position>950 <position>310,70</position> 929 951 </textedit> 930 952 931 < buttonlist name="category_select" from="baseselector">932 <position>310,1 45</position>933 </ buttonlist>953 <textedit name="subtitle_edit" from="basetextedit"> 954 <position>310,126</position> 955 </textedit> 934 956 957 <spinbox name="season" from="basespinbox"> 958 <position>310,181</position> 959 </spinbox> 960 961 <spinbox name="episode" from="basespinbox"> 962 <position>530,181</position> 963 </spinbox> 964 935 965 <buttonlist name="level_select" from="baseselector"> 936 <position> 310,195</position>966 <position>230,225</position> 937 967 </buttonlist> 938 968 969 <buttonlist name="category_select" from="baseselector"> 970 <position>530,225</position> 971 </buttonlist> 972 939 973 <buttonlist name="child_select" from="baseselector"> 940 <position> 310,240</position>974 <position>230,270</position> 941 975 </buttonlist> 942 976 943 977 <checkbox name="browse_check" from="basecheckbox"> 944 <position> 310,290</position>978 <position>680,275</position> 945 979 </checkbox> 946 980 947 981 <button name="coverart_button" from="basesearchbutton"> -
mythplugins/mythvideo/theme/default-wide/video-ui.xml
843 843 <window name="edit_metadata"> 844 844 845 845 <textarea name="title" from="basetextarea"> 846 <area>10, 50,1260,50</area>846 <area>10,30,760,50</area> 847 847 <value>Edit Video Information</value> 848 848 <align>hcenter,vcenter</align> 849 849 <font>baselarge</font> … … 852 852 <!-- Labels --> 853 853 854 854 <textarea name="title_text" from="basetextarea"> 855 <area> 250,110,250,40</area>856 <value> Name:</value>855 <area>50,80,250,40</area> 856 <value>Title:</value> 857 857 <align>right,top</align> 858 858 </textarea> 859 859 860 <textarea name="subtitle_text" from="basetextarea"> 861 <area>50,138,250,40</area> 862 <value>Subtitle:</value> 863 <align>right,top</align> 864 </textarea> 865 866 <textarea name="season_text" from="basetextarea"> 867 <area>50,185,250,40</area> 868 <value>Season:</value> 869 <align>right,top</align> 870 </textarea> 871 872 <textarea name="episode_text" from="basetextarea"> 873 <area>370,185,150,40</area> 874 <value>Episode:</value> 875 <align>right,top</align> 876 </textarea> 877 860 878 <textarea name="category_text" from="title_text"> 861 <position>250,172</position> 879 <area>420,232,150,40</area> 880 <align>right</align> 862 881 <value>Category:</value> 863 882 </textarea> 864 883 865 884 <textarea name="level_text" from="title_text"> 866 <position>250,222</position> 885 <area>20,232,200,40</area> 886 <align>right</align> 867 887 <value>Parental Control:</value> 868 888 </textarea> 869 889 870 890 <textarea name="child_text" from="title_text"> 871 <position>250,267</position> 891 <area>20,277,200,40</area> 892 <align>right</align> 872 893 <value>File to Always Play Next:</value> 873 894 </textarea> 874 895 875 896 <textarea name="browse_text" from="title_text"> 876 <position>250,312</position> 897 <area>470,277,280,40</area> 898 <align>left</align> 877 899 <value>Include while Browsing:</value> 878 900 </textarea> 879 901 880 902 <textarea name="coverart_text_label" from="title_text"> 881 <position> 250,348</position>903 <position>50,328</position> 882 904 <value>Cover Art:</value> 883 905 </textarea> 884 906 885 907 <textarea name="screenshot_text_label" from="title_text"> 886 <position> 250,377</position>908 <position>50,357</position> 887 909 <value>Screenshot:</value> 888 910 </textarea> 889 911 890 912 <textarea name="banner_text_label" from="title_text"> 891 <position> 250,406</position>913 <position>50,386</position> 892 914 <value>Banner:</value> 893 915 </textarea> 894 916 895 917 <textarea name="fanart_text_label" from="title_text"> 896 <position> 250,435</position>918 <position>50,415</position> 897 919 <value>Fanart:</value> 898 920 </textarea> 899 921 900 922 <textarea name="trailer_text_label" from="title_text"> 901 <position> 250,464</position>923 <position>50,447</position> 902 924 <value>Trailer:</value> 903 925 </textarea> 904 926 905 927 <textarea name="player_text" from="title_text"> 906 <position> 250,510</position>928 <position>50,487</position> 907 929 <value>Unique Player Command:</value> 908 930 </textarea> 909 931 910 932 <!-- Widgets --> 911 933 912 934 <textedit name="title_edit" from="basetextedit"> 913 <position> 510,100</position>935 <position>310,70</position> 914 936 </textedit> 915 937 916 < buttonlist name="category_select" from="baseselector">917 <position> 510,165</position>918 </ buttonlist>938 <textedit name="subtitle_edit" from="basetextedit"> 939 <position>310,126</position> 940 </textedit> 919 941 942 <spinbox name="season" from="basespinbox"> 943 <position>310,181</position> 944 </spinbox> 945 946 <spinbox name="episode" from="basespinbox"> 947 <position>530,181</position> 948 </spinbox> 949 920 950 <buttonlist name="level_select" from="baseselector"> 921 <position> 510,215</position>951 <position>230,225</position> 922 952 </buttonlist> 923 953 954 <buttonlist name="category_select" from="baseselector"> 955 <position>580,225</position> 956 </buttonlist> 957 924 958 <buttonlist name="child_select" from="baseselector"> 925 <position> 510,260</position>959 <position>230,270</position> 926 960 </buttonlist> 927 961 928 962 <checkbox name="browse_check" from="basecheckbox"> 929 <position> 510,310</position>963 <position>735,275</position> 930 964 </checkbox> 931 965 932 <button name="coverart_button" from="basesearchbutton"> 933 <position>510,343</position> 966 <button name="coverart_button"> 967 <area>310,323,32,32</area> 968 <statetype name="buttonstate"> 969 <state name="active"> 970 <imagetype name="background"> 971 <filename>blankbutton_off.png</filename> 972 </imagetype> 973 </state> 974 <state name="selected" from="active"> 975 <imagetype name="background"> 976 <filename>blankbutton_on.png</filename> 977 </imagetype> 978 </state> 979 <state name="disabled" from="active" /> 980 <state name="pushed" from="active"> 981 <imagetype name="background"> 982 <filename>blankbutton_pushed.png</filename> 983 </imagetype> 984 </state> 985 </statetype> 934 986 </button> 935 987 936 988 <textarea name="coverart_text" from="basetextarea"> 937 <area> 550,348,250,40</area>989 <area>350,328,250,40</area> 938 990 <value>/path/to/the/thing.jpg</value> 939 991 </textarea> 940 992 941 <button name="screenshot_button" from="basesearchbutton"> 942 <position>510,372</position> 993 <button name="screenshot_button"> 994 <area>310,352,32,32</area> 995 <statetype name="buttonstate"> 996 <state name="active"> 997 <imagetype name="background"> 998 <filename>blankbutton_off.png</filename> 999 </imagetype> 1000 </state> 1001 <state name="selected" from="active"> 1002 <imagetype name="background"> 1003 <filename>blankbutton_on.png</filename> 1004 </imagetype> 1005 </state> 1006 <state name="disabled" from="active" /> 1007 <state name="pushed" from="active"> 1008 <imagetype name="background"> 1009 <filename>blankbutton_pushed.png</filename> 1010 </imagetype> 1011 </state> 1012 </statetype> 943 1013 </button> 944 1014 945 1015 <textarea name="screenshot_text" from="basetextarea"> 946 <area> 550,377,250,40</area>1016 <area>350,357,250,40</area> 947 1017 <value>/path/to/the/thing.jpg</value> 948 1018 </textarea> 949 1019 950 <button name="banner_button" from="basesearchbutton"> 951 <position>510,401</position> 1020 <button name="banner_button"> 1021 <area>310,381,32,32</area> 1022 <statetype name="buttonstate"> 1023 <state name="active"> 1024 <imagetype name="background"> 1025 <filename>blankbutton_off.png</filename> 1026 </imagetype> 1027 </state> 1028 <state name="selected" from="active"> 1029 <imagetype name="background"> 1030 <filename>blankbutton_on.png</filename> 1031 </imagetype> 1032 </state> 1033 <state name="disabled" from="active" /> 1034 <state name="pushed" from="active"> 1035 <imagetype name="background"> 1036 <filename>blankbutton_pushed.png</filename> 1037 </imagetype> 1038 </state> 1039 </statetype> 952 1040 </button> 953 1041 954 1042 <textarea name="banner_text" from="basetextarea"> 955 <area> 550,406,250,40</area>1043 <area>350,386,250,40</area> 956 1044 <value>/path/to/the/thing.jpg</value> 957 1045 </textarea> 958 1046 959 <button name="fanart_button" from="basesearchbutton"> 960 <position>510,430</position> 1047 <button name="fanart_button"> 1048 <area>310,412,32,32</area> 1049 <statetype name="buttonstate"> 1050 <state name="active"> 1051 <imagetype name="background"> 1052 <filename>blankbutton_off.png</filename> 1053 </imagetype> 1054 </state> 1055 <state name="selected" from="active"> 1056 <imagetype name="background"> 1057 <filename>blankbutton_on.png</filename> 1058 </imagetype> 1059 </state> 1060 <state name="disabled" from="active" /> 1061 <state name="pushed" from="active"> 1062 <imagetype name="background"> 1063 <filename>blankbutton_pushed.png</filename> 1064 </imagetype> 1065 </state> 1066 </statetype> 961 1067 </button> 962 1068 963 1069 <textarea name="fanart_text" from="basetextarea"> 964 <area> 550,435,250,40</area>1070 <area>350,415,250,40</area> 965 1071 <value>/path/to/the/thing.jpg</value> 966 1072 </textarea> 967 1073 968 <button name="trailer_button" from="basesearchbutton"> 969 <position>510,460</position> 1074 <button name="trailer_button"> 1075 <area>310,442,32,32</area> 1076 <statetype name="buttonstate"> 1077 <state name="active"> 1078 <imagetype name="background"> 1079 <filename>blankbutton_off.png</filename> 1080 </imagetype> 1081 </state> 1082 <state name="selected" from="active"> 1083 <imagetype name="background"> 1084 <filename>blankbutton_on.png</filename> 1085 </imagetype> 1086 </state> 1087 <state name="disabled" from="active" /> 1088 <state name="pushed" from="active"> 1089 <imagetype name="background"> 1090 <filename>blankbutton_pushed.png</filename> 1091 </imagetype> 1092 </state> 1093 </statetype> 970 1094 </button> 971 1095 972 1096 <textarea name="trailer_text" from="basetextarea"> 973 <area> 550,465,250,40</area>1097 <area>350,447,250,40</area> 974 1098 <value>/path/to/the/thing.jpg</value> 975 1099 </textarea> 976 1100 1101 977 1102 <textedit name="player_edit" from="basetextedit"> 978 <position> 510,495</position>1103 <position>310,477</position> 979 1104 </textedit> 980 1105 981 1106 <button name="done_button" from="basebutton"> 982 <position> 510,565</position>1107 <position>310,537</position> 983 1108 <value>Done</value> 984 1109 </button> 985 1110 -
mythplugins/mythvideo/mythvideo/metadatalistmanager.cpp
112 112 MSqlQuery query(MSqlQuery::InitCon()); 113 113 query.setForwardOnly(true); 114 114 const QString BaseMetadataQuery( 115 "SELECT title, director, plot, rating, year, userrating," 116 "length, filename, showlevel, coverfile, inetref, childid," 117 "browse, playcommand, category, intid, trailer, screenshot," 118 "banner, fanart, host FROM videometadata"); 115 "SELECT title, director, plot, rating, year, " 116 "userrating, length, filename, showlevel, " 117 "coverfile, inetref, childid, browse, playcommand, category, " 118 "intid, trailer, screenshot, banner, fanart, " 119 "subtitle, season, episode, host FROM videometadata"); 119 120 120 121 query.prepare(BaseMetadataQuery); 121 122 -
mythplugins/mythvideo/mythvideo/metadata.cpp
89 89 public: 90 90 MetadataImp(const QString &filename, const QString &trailer, const QString &coverfile, 91 91 const QString &screenshot, const QString &banner, const QString &fanart, 92 const QString &title, int year,92 const QString &title, const QString &subtitle, int year, 93 93 const QString &inetref, const QString &director, 94 94 const QString &plot, float userrating, 95 95 const QString &rating, int length, 96 unsigned int season, unsigned int episode, 96 97 int id, ParentalLevel::Level showlevel, int categoryID, 97 98 int childID, bool browse, 98 99 const QString &playcommand, const QString &category, … … 100 101 const country_list &countries, 101 102 const cast_list &cast, 102 103 const QString &host = "") : 103 m_title(title), 104 m_title(title), m_subtitle(subtitle), 104 105 m_inetref(inetref), m_director(director), m_plot(plot), 105 106 m_rating(rating), m_playcommand(playcommand), m_category(category), 106 107 m_genres(genres), m_countries(countries), m_cast(cast), 107 108 m_filename(filename), m_trailer(trailer), m_coverfile(coverfile), 108 109 m_screenshot(screenshot), m_banner(banner), m_fanart(fanart), 109 110 m_host(host), m_categoryID(categoryID), m_childID(childID), 110 m_year(year), m_length(length), m_showlevel(showlevel), 111 m_year(year), m_length(length), m_season(season), 112 m_episode(episode), m_showlevel(showlevel), 111 113 m_browse(browse), m_id(id), m_userrating(userrating) 112 114 { 113 115 VideoCategory::GetCategory().get(m_categoryID, m_category); … … 128 130 if (this != &rhs) 129 131 { 130 132 m_title = rhs.m_title; 133 m_subtitle = rhs.m_subtitle; 131 134 m_inetref = rhs.m_inetref; 132 135 m_director = rhs.m_director; 133 136 m_plot = rhs.m_plot; … … 148 151 m_childID = rhs.m_childID; 149 152 m_year = rhs.m_year; 150 153 m_length = rhs.m_length; 154 m_season = rhs.m_season; 155 m_episode = rhs.m_episode; 151 156 m_showlevel = rhs.m_showlevel; 152 157 m_browse = rhs.m_browse; 153 158 m_id = rhs.m_id; … … 180 185 m_title = title; 181 186 } 182 187 188 const QString &getSubtitle() const { return m_subtitle; } 189 void SetSubtitle(const QString &subtitle) { m_subtitle = subtitle; } 190 183 191 const QString &GetInetRef() const { return m_inetref; } 184 192 void SetInetRef(const QString &inetRef) { m_inetref = inetRef; } 185 193 … … 249 257 int GetLength() const { return m_length; } 250 258 void SetLength(int length) { m_length = length; } 251 259 260 int GetSeason() const { return m_season; } 261 void SetSeason(int season) { m_season = season; } 262 263 int GetEpisode() const { return m_episode; } 264 void SetEpisode(int episode) { m_episode = episode; } 265 252 266 ParentalLevel::Level GetShowLevel() const { return m_showlevel; } 253 267 void SetShowLevel(ParentalLevel::Level showLevel) 254 268 { … … 289 303 290 304 private: 291 305 QString m_title; 306 QString m_subtitle; 292 307 QString m_inetref; 293 308 QString m_director; 294 309 QString m_plot; … … 310 325 int m_childID; 311 326 int m_year; 312 327 int m_length; 328 int m_season; 329 int m_episode; 313 330 ParentalLevel::Level m_showlevel; 314 331 bool m_browse; 315 332 unsigned int m_id; // videometadata.intid … … 384 401 MetadataImp tmp(m_filename, VIDEO_TRAILER_DEFAULT, VIDEO_COVERFILE_DEFAULT, 385 402 VIDEO_SCREENSHOT_DEFAULT, VIDEO_BANNER_DEFAULT, 386 403 VIDEO_FANART_DEFAULT, Metadata::FilenameToTitle(m_filename), 387 VIDEO_ YEAR_DEFAULT, VIDEO_INETREF_DEFAULT,404 VIDEO_SUBTITLE_DEFAULT, VIDEO_YEAR_DEFAULT, VIDEO_INETREF_DEFAULT, 388 405 VIDEO_DIRECTOR_DEFAULT, VIDEO_PLOT_DEFAULT, 0.0, 389 VIDEO_RATING_DEFAULT, 0, m_id, 406 VIDEO_RATING_DEFAULT, 0, 407 Metadata::FilenameToSeasonEpisode(m_filename, 1), 408 Metadata::FilenameToSeasonEpisode(m_filename, 2), m_id, 390 409 ParentalLevel::plLowest, 0, -1, true, "", "", 391 410 Metadata::genre_list(), Metadata::country_list(), 392 411 Metadata::cast_list(), m_host); … … 484 503 m_screenshot = query.value(17).toString(); 485 504 m_banner = query.value(18).toString(); 486 505 m_fanart = query.value(19).toString(); 487 m_host = query.value(20).toString(); 506 m_subtitle = query.value(20).toString(); 507 m_season = query.value(21).toInt(); 508 m_episode = query.value(22).toInt(); 509 m_host = query.value(23).toString(); 488 510 489 511 VideoCategory::GetCategory().get(m_categoryID, m_category); 490 512 … … 502 524 { 503 525 if (m_title.isEmpty()) 504 526 m_title = Metadata::FilenameToTitle(m_filename); 527 if (m_subtitle.isEmpty()) 528 m_subtitle = VIDEO_SUBTITLE_DEFAULT; 505 529 if (m_director.isEmpty()) 506 530 m_director = VIDEO_DIRECTOR_UNKNOWN; 507 531 if (m_plot.isEmpty()) 508 532 m_plot = VIDEO_PLOT_DEFAULT; 509 533 if (m_rating.isEmpty()) 510 534 m_rating = VIDEO_RATING_DEFAULT; 535 if (m_season == 0) 536 m_season = Metadata::FilenameToSeasonEpisode(m_filename, 1); 537 if (m_episode == 0) 538 m_episode = Metadata::FilenameToSeasonEpisode(m_filename, 2); 511 539 if (m_coverfile.isEmpty()) 512 540 m_coverfile = VIDEO_COVERFILE_DEFAULT; 513 541 if (m_screenshot.isEmpty()) … … 533 561 { 534 562 m_browse = gContext->GetNumSetting("VideoNewBrowsable", 1); 535 563 536 query.prepare("INSERT INTO videometadata (title, director,plot,"537 "rating,year,userrating,length, filename,showlevel,"538 " coverfile,inetref,browse,trailer,screenshot,banner,"539 "fanart,host) VALUES (:TITLE, : DIRECTOR, :PLOT, :RATING, "540 ": YEAR, :USERRATING, :LENGTH, :FILENAME, :SHOWLEVEL, "541 ": COVERFILE, :INETREF, :BROWSE, :TRAILER, :SCREENSHOT, "542 ": BANNER, :FANART, :HOST)");564 query.prepare("INSERT INTO videometadata (title,subtitle,director,plot," 565 "rating,year,userrating,length,season,episode,filename," 566 "showlevel,coverfile,inetref,browse,trailer,screenshot,banner," 567 "fanart,host) VALUES (:TITLE, :SUBTITLE, :DIRECTOR, :PLOT, " 568 ":RATING, :YEAR, :USERRATING, :LENGTH, :SEASON, :EPISODE, " 569 ":FILENAME, :SHOWLEVEL, :COVERFILE, :INETREF, :BROWSE, " 570 ":TRAILER, :SCREENSHOT, :BANNER, :FANART, :HOST)"); 543 571 } 544 572 else 545 573 { 546 query.prepare("UPDATE videometadata SET title = :TITLE, "574 query.prepare("UPDATE videometadata SET title = :TITLE, subtitle = :SUBTITLE, " 547 575 "director = :DIRECTOR, plot = :PLOT, rating= :RATING, " 548 576 "year = :YEAR, userrating = :USERRATING, " 549 "length = :LENGTH, filename = :FILENAME, trailer = :TRAILER, " 577 "length = :LENGTH, season = :SEASON, episode = :EPISODE, " 578 "filename = :FILENAME, trailer = :TRAILER, " 550 579 "showlevel = :SHOWLEVEL, coverfile = :COVERFILE, " 551 580 "screenshot = :SCREENSHOT, banner = :BANNER, fanart = :FANART, " 552 581 "inetref = :INETREF, browse = :BROWSE, host = :HOST, " … … 560 589 } 561 590 562 591 query.bindValue(":TITLE", m_title); 592 query.bindValue(":SUBTITLE", m_subtitle); 563 593 query.bindValue(":DIRECTOR", m_director); 564 594 query.bindValue(":PLOT", m_plot); 565 595 query.bindValue(":RATING", m_rating); 566 596 query.bindValue(":YEAR", m_year); 567 597 query.bindValue(":USERRATING", m_userrating); 568 598 query.bindValue(":LENGTH", m_length); 599 query.bindValue(":SEASON", m_season); 600 query.bindValue(":EPISODE", m_episode); 569 601 query.bindValue(":FILENAME", m_filename); 570 602 query.bindValue(":TRAILER", m_trailer); 571 603 query.bindValue(":SHOWLEVEL", m_showlevel); … … 811 843 return title.trimmed(); 812 844 } 813 845 846 unsigned int Metadata::FilenameToSeasonEpisode(const QString &file_name, 847 int position) 848 { 849 // position 1 returns season, 2 returns episode 850 851 QString title = file_name.right(file_name.length() - 852 file_name.lastIndexOf('/') - 1); 853 QRegExp group("(\\d{1,3})(?:\\s|-|_|\\.)?(?:[ex])" //Season 854 "(?:\\s|-|_|\\.)?(\\d{1,3})", // Episode 855 Qt::CaseInsensitive); 856 int pos = group.indexIn(title); 857 if (pos > -1) 858 { 859 QString groupResult = group.cap(0); 860 QString season = group.cap(1); 861 QString episode = group.cap(2); 862 if (position == 1) 863 return season.toInt(); 864 else if (position == 2) 865 return episode.toInt(); 866 } 867 return 0; 868 } 869 814 870 namespace 815 871 { 816 872 const QRegExp &getTitleTrim(bool ignore_case) … … 829 885 return ret; 830 886 } 831 887 832 Metadata::Metadata(const QString &filename, const QString &trailer, 833 const QString &coverfile, const QString &screenshot, 834 const QString &banner, const QString &fanart, 835 const QString &title, int year,888 Metadata::Metadata(const QString &filename, const QString &trailer, 889 const QString &coverfile, const QString &screenshot, 890 const QString &banner, const QString &fanart, 891 const QString &title, const QString &subtitle, int year, 836 892 const QString &inetref, const QString &director, 837 893 const QString &plot, float userrating, 838 894 const QString &rating, int length, 895 int season, int episode, 839 896 int id, ParentalLevel::Level showlevel, int categoryID, 840 897 int childID, bool browse, 841 898 const QString &playcommand, const QString &category, … … 845 902 const QString &host) 846 903 { 847 904 m_imp = new MetadataImp(filename, trailer, coverfile, screenshot, banner, 848 fanart, title, year, inetref, director, plot,849 userrating, rating, length, id, showlevel,850 categoryID, childID, browse, playcommand, category,851 genres, countries, cast, host);905 fanart, title, subtitle, year, inetref, director, plot, 906 userrating, rating, length, season, episode, id, 907 showlevel, categoryID, childID, browse, playcommand, 908 category, genres, countries, cast, host); 852 909 } 853 910 854 911 Metadata::~Metadata() … … 911 968 m_imp->SetTitle(title); 912 969 } 913 970 971 const QString &Metadata::GetSubtitle() const 972 { 973 return m_imp->getSubtitle(); 974 } 975 976 void Metadata::SetSubtitle(const QString &subtitle) 977 { 978 m_imp->SetSubtitle(subtitle); 979 } 980 914 981 int Metadata::GetYear() const 915 982 { 916 983 return m_imp->getYear(); … … 981 1048 m_imp->SetLength(length); 982 1049 } 983 1050 1051 int Metadata::GetSeason() const 1052 { 1053 return m_imp->GetSeason(); 1054 } 1055 1056 void Metadata::SetSeason(int season) 1057 { 1058 m_imp->SetSeason(season); 1059 } 1060 1061 int Metadata::GetEpisode() const 1062 { 1063 return m_imp->GetEpisode(); 1064 } 1065 1066 void Metadata::SetEpisode(int episode) 1067 { 1068 m_imp->SetEpisode(episode); 1069 } 1070 984 1071 unsigned int Metadata::GetID() const 985 1072 { 986 1073 return m_imp->GetID(); -
mythplugins/mythvideo/mythvideo/videofilter.h
54 54 kOrderByUserRatingDescending = 2, 55 55 kOrderByLength = 3, 56 56 kOrderByFilename = 4, 57 kOrderByID = 5 57 kOrderByID = 5, 58 kOrderBySeasonEp = 6 58 59 }; 59 60 60 61 int GetCategory() const { return category; } -
mythplugins/mythvideo/mythvideo/dbcheck.cpp
38 38 const QString lastMythDVDDBVersion = "1002"; 39 39 const QString lastMythVideoVersion = "1010"; 40 40 41 const QString currentDatabaseVersion = "102 3";41 const QString currentDatabaseVersion = "1024"; 42 42 43 43 const QString OldMythVideoVersionName = "VideoDBSchemaVer"; 44 44 const QString OldMythDVDVersionName = "DVDDBSchemaVer"; … … 834 834 performActualUpdate(updates, "1023", dbver, MythVideoVersionName); 835 835 } 836 836 837 if (dbver == "1023") 838 { 839 QStringList updates; 840 updates += "ALTER TABLE videometadata ADD `subtitle` TEXT " 841 "NOT NULL AFTER `title`;"; 842 updates += "ALTER TABLE videometadata ADD `season` SMALLINT " 843 "UNSIGNED NOT NULL DEFAULT '0' AFTER `length`;"; 844 updates += "ALTER TABLE videometadata ADD `episode` SMALLINT " 845 "UNSIGNED NOT NULL DEFAULT '0' AFTER `season`;"; 846 performActualUpdate(updates, "1024", dbver, MythVideoVersionName); 847 } 837 848 838 849 } 839 850 } -
mythplugins/mythvideo/mythvideo/videoutils.cpp
139 139 return QString("%1 minutes").arg(length); 140 140 } 141 141 142 QString GetDisplaySeason(int season, int digits) 143 { 144 QString seasNum = QString::number(season); 145 146 if (digits == 2 && seasNum.size() < 2) 147 seasNum.prepend("0"); 148 149 return seasNum; 150 } 151 152 QString GetDisplayEpisode(int episode, int digits) 153 { 154 QString epNum = QString::number(episode); 155 156 if (digits == 2 && epNum.size() < 2) 157 epNum.prepend("0"); 158 159 return epNum; 160 } 161 142 162 QString GetDisplayBrowse(bool browse) 143 163 { 144 164 return browse ? QObject::tr("Yes") : QObject::tr("No"); -
mythplugins/mythvideo/mythvideo/editmetadata.h
10 10 class MythUIText; 11 11 class MythUITextEdit; 12 12 class MythUIButton; 13 class MythUISpinBox; 13 14 class MythUICheckBox; 14 15 15 16 class EditMetadataDialog : public MythScreenType … … 34 35 public slots: 35 36 void SaveAndExit(); 36 37 void SetTitle(); 38 void SetSubtitle(); 37 39 void SetCategory(MythUIButtonListItem*); 38 40 void SetPlayer(); 41 void SetSeason(); 42 void SetEpisode(); 39 43 void SetLevel(MythUIButtonListItem*); 40 44 void SetChild(MythUIButtonListItem*); 41 45 void ToggleBrowse(); … … 60 64 // 61 65 62 66 MythUITextEdit *m_titleEdit; 67 MythUITextEdit *m_subtitleEdit; 63 68 MythUITextEdit *m_playerEdit; 69 MythUISpinBox *m_seasonSpin; 70 MythUISpinBox *m_episodeSpin; 64 71 MythUIButtonList *m_categoryList; 65 72 MythUIButtonList *m_levelList; 66 73 MythUIButtonList *m_childList; -
mythplugins/mythvideo/mythvideo/videodlg.cpp
1016 1016 1017 1017 tmp["filename"] = metadata->GetFilename(); 1018 1018 tmp["title"] = metadata->GetTitle(); 1019 tmp["subtitle"] = metadata->GetSubtitle(); 1019 1020 tmp["director"] = metadata->GetDirector(); 1020 1021 tmp["plot"] = metadata->GetPlot(); 1021 1022 tmp["genres"] = GetDisplayGenres(*metadata); … … 1025 1026 tmp["length"] = GetDisplayLength(metadata->GetLength()); 1026 1027 tmp["year"] = GetDisplayYear(metadata->GetYear()); 1027 1028 tmp["userrating"] = GetDisplayUserRating(metadata->GetUserRating()); 1029 tmp["season"] = GetDisplaySeason(metadata->GetSeason(), 1); 1030 tmp["episode"] = GetDisplayEpisode(metadata->GetEpisode(), 1); 1028 1031 1032 if (metadata->GetSeason() >= 0 && metadata->GetEpisode() > 0) 1033 { 1034 tmp["s##e##"] = QString("s%1e%2").arg(GetDisplaySeason(metadata->GetSeason(), 2)) 1035 .arg(GetDisplayEpisode(metadata->GetEpisode(), 2)); 1036 tmp["##x##"] = QString("%1x%2").arg(GetDisplaySeason(metadata->GetSeason(), 1)) 1037 .arg(GetDisplayEpisode(metadata->GetEpisode(), 2)); 1038 } 1039 else 1040 tmp["s##e##"] = tmp["##x##"] = ""; 1041 1029 1042 tmp["userratingstate"] = 1030 1043 QString::number((int)(metadata->GetUserRating())); 1031 1044 tmp["videolevel"] = ParentalLevelToState(metadata->GetShowLevel()); … … 1075 1088 h.handleText("player"); 1076 1089 h.handleText("filename"); 1077 1090 h.handleText("title"); 1091 h.handleText("subtitle"); 1078 1092 h.handleText("director"); 1079 1093 h.handleText("plot"); 1080 1094 h.handleText("genres"); … … 1082 1096 h.handleText("cast"); 1083 1097 h.handleText("rating"); 1084 1098 h.handleText("length"); 1099 h.handleText("season"); 1100 h.handleText("s##e##"); 1101 h.handleText("##x##"); 1102 h.handleText("episode"); 1085 1103 h.handleText("year"); 1086 1104 h.handleText("userrating"); 1087 1105 … … 3023 3041 } 3024 3042 // set known values 3025 3043 metadata->SetTitle(data["Title"]); 3044 metadata->SetSubtitle(data["Subtitle"]); 3026 3045 metadata->SetYear(data["Year"].toInt()); 3027 3046 metadata->SetDirector(data["Director"]); 3028 3047 metadata->SetPlot(data["Plot"]); 3029 3048 metadata->SetUserRating(data["UserRating"].toFloat()); 3030 3049 metadata->SetRating(data["MovieRating"]); 3031 3050 metadata->SetLength(data["Runtime"].toInt()); 3051 metadata->SetSeason(data["Season"].toInt()); 3052 metadata->SetEpisode(data["Episode"].toInt()); 3032 3053 3033 3054 m_d->AutomaticParentalAdjustment(metadata); 3034 3055 -
mythplugins/mythvideo/mythvideo/videoscan.cpp
268 268 VIDEO_BANNER_DEFAULT, 269 269 VIDEO_FANART_DEFAULT, 270 270 Metadata::FilenameToTitle(p->first), 271 VIDEO_SUBTITLE_DEFAULT, 271 272 VIDEO_YEAR_DEFAULT, 272 273 VIDEO_INETREF_DEFAULT, VIDEO_DIRECTOR_DEFAULT, 273 VIDEO_PLOT_DEFAULT, 0.0, VIDEO_RATING_DEFAULT, 274 0, 0, ParentalLevel::plLowest); 274 VIDEO_PLOT_DEFAULT, 0.0, VIDEO_RATING_DEFAULT, 0, 275 Metadata::FilenameToSeasonEpisode(p->first, 1), 276 Metadata::FilenameToSeasonEpisode(p->first, 2), 277 0, ParentalLevel::plLowest); 275 278 276 279 VERBOSE(VB_GENERAL, QString("Adding : %1 : %2") 277 280 .arg(newFile.GetHost()).arg(newFile.GetFilename())); -
mythplugins/mythvideo/mythvideo/videofilter.cpp
353 353 ret = lhs_key < rhs_key; 354 354 break; 355 355 } 356 case kOrderBySeasonEp: 357 { 358 if (lhs.GetSeason() == rhs.GetSeason()) 359 ret = lhs.GetEpisode() < rhs.GetEpisode(); 360 else 361 ret = lhs.GetSeason() < rhs.GetSeason(); 362 break; 363 } 356 364 case kOrderByYearDescending: 357 365 { 358 366 ret = lhs.GetYear() > rhs.GetYear(); … … 649 657 // Order by 650 658 new MythUIButtonListItem(m_orderbyList, QObject::tr("Title"), 651 659 VideoFilterSettings::kOrderByTitle); 660 new MythUIButtonListItem(m_orderbyList, QObject::tr("Season/Episode"), 661 VideoFilterSettings::kOrderBySeasonEp); 652 662 new MythUIButtonListItem(m_orderbyList, QObject::tr("Year"), 653 663 VideoFilterSettings::kOrderByYearDescending); 654 664 new MythUIButtonListItem(m_orderbyList, QObject::tr("User Rating"), -
mythplugins/mythvideo/mythvideo/metadata.h
13 13 14 14 enum { VIDEO_YEAR_DEFAULT = 1895 }; 15 15 16 const QString VIDEO_SUBTITLE_DEFAULT = ""; 17 16 18 struct SortData; 17 19 18 20 class Metadata … … 45 47 public: 46 48 static SortKey GenerateDefaultSortKey(const Metadata &m, bool ignore_case); 47 49 static QString FilenameToTitle(const QString &file_name); 50 static unsigned int FilenameToSeasonEpisode(const QString &file_name, 51 int position); 48 52 static QString TrimTitle(const QString &title, bool ignore_case); 49 53 50 54 public: … … 55 59 const QString &banner = QString(), 56 60 const QString &fanart = QString(), 57 61 const QString &title = QString(), 62 const QString &subtitle = QString(), 58 63 int year = VIDEO_YEAR_DEFAULT, 59 64 const QString &inetref = QString(), 60 65 const QString &director = QString(), … … 62 67 float userrating = 0.0, 63 68 const QString &rating = QString(), 64 69 int length = 0, 70 int season = 0, 71 int episode = 0, 65 72 int id = 0, 66 73 ParentalLevel::Level showlevel = ParentalLevel::plLowest, 67 74 int categoryID = 0, … … 89 96 const QString &GetTitle() const; 90 97 void SetTitle(const QString& title); 91 98 99 const QString &GetSubtitle() const; 100 void SetSubtitle(const QString &subtitle); 101 92 102 int GetYear() const; 93 103 void SetYear(int year); 94 104 … … 110 120 int GetLength() const; 111 121 void SetLength(int length); 112 122 123 int GetSeason() const; 124 void SetSeason(int season); 125 126 int GetEpisode() const; 127 void SetEpisode(int episode); 128 113 129 unsigned int GetID() const; 114 130 void SetID(int id); 115 131 -
mythplugins/mythvideo/mythvideo/editmetadata.cpp
12 12 #include <mythtv/libmythui/mythuitextedit.h> 13 13 #include <mythtv/libmythui/mythuibutton.h> 14 14 #include <mythtv/libmythui/mythuicheckbox.h> 15 #include <mythtv/libmythui/mythuispinbox.h> 15 16 16 17 #include "globals.h" 17 18 #include "dbaccess.h" … … 22 23 EditMetadataDialog::EditMetadataDialog(MythScreenStack *lparent, 23 24 QString lname, Metadata *source_metadata, 24 25 const MetadataListManager &cache) : MythScreenType(lparent, lname), 25 m_origMetadata(source_metadata), m_titleEdit(0), m_playerEdit(0), 26 m_categoryList(0), m_levelList(0), m_childList(0), m_browseCheck(0), 27 m_coverartButton(0), m_coverartText(0), 26 m_origMetadata(source_metadata), m_titleEdit(0), m_subtitleEdit(0), 27 m_playerEdit(0), m_seasonSpin(0), m_episodeSpin(0), 28 m_categoryList(0), m_levelList(0), m_childList(0), 29 m_browseCheck(0), m_coverartButton(0), m_coverartText(0), 28 30 m_screenshotButton(0), m_screenshotText(0), 29 31 m_bannerButton(0), m_bannerText(0), 30 32 m_fanartButton(0), m_fanartText(0), … … 47 49 48 50 bool err = false; 49 51 UIUtilE::Assign(this, m_titleEdit, "title_edit", &err); 52 UIUtilE::Assign(this, m_subtitleEdit, "subtitle_edit", &err); 50 53 UIUtilE::Assign(this, m_playerEdit, "player_edit", &err); 51 54 55 UIUtilE::Assign(this, m_seasonSpin, "season", &err); 56 UIUtilE::Assign(this, m_episodeSpin, "episode", &err); 57 52 58 UIUtilE::Assign(this, m_coverartText, "coverart_text", &err); 53 59 UIUtilE::Assign(this, m_screenshotText, "screenshot_text", &err); 54 60 UIUtilE::Assign(this, m_bannerText, "banner_text", &err); … … 79 85 VERBOSE(VB_IMPORTANT, "Failed to build a focuslist."); 80 86 81 87 connect(m_titleEdit, SIGNAL(valueChanged()), SLOT(SetTitle())); 88 connect(m_subtitleEdit, SIGNAL(valueChanged()), SLOT(SetSubtitle())); 82 89 connect(m_playerEdit, SIGNAL(valueChanged()), SLOT(SetPlayer())); 83 90 91 connect(m_seasonSpin, SIGNAL(valueChanged()), SLOT(SetSeason())); 92 connect(m_episodeSpin, SIGNAL(valueChanged()), SLOT(SetEpisode())); 93 84 94 connect(m_doneButton, SIGNAL(Clicked()), SLOT(SaveAndExit())); 85 95 connect(m_coverartButton, SIGNAL(Clicked()), SLOT(FindCoverArt())); 86 96 connect(m_bannerButton, SIGNAL(Clicked()), SLOT(FindBanner())); … … 154 164 void EditMetadataDialog::fillWidgets() 155 165 { 156 166 m_titleEdit->SetText(m_workingMetadata->GetTitle()); 167 m_subtitleEdit->SetText(m_workingMetadata->GetSubtitle()); 157 168 169 m_seasonSpin->SetRange(0,100,1); 170 m_seasonSpin->SetValue(m_workingMetadata->GetSeason()); 171 m_episodeSpin->SetRange(0,999,1); 172 m_episodeSpin->SetValue(m_workingMetadata->GetEpisode()); 173 158 174 MythUIButtonListItem *button = 159 175 new MythUIButtonListItem(m_categoryList, VIDEO_CATEGORY_UNKNOWN); 160 176 const VideoCategory::entry_list &vcl = … … 312 328 m_workingMetadata->SetTitle(m_titleEdit->GetText()); 313 329 } 314 330 331 void EditMetadataDialog::SetSubtitle() 332 { 333 m_workingMetadata->SetSubtitle(m_subtitleEdit->GetText()); 334 } 335 315 336 void EditMetadataDialog::SetCategory(MythUIButtonListItem *item) 316 337 { 317 338 m_workingMetadata->SetCategoryID(item->GetData().toInt()); 318 339 } 319 340 341 void EditMetadataDialog::SetSeason() 342 { 343 m_workingMetadata->SetSeason(m_seasonSpin->GetIntValue()); 344 } 345 346 void EditMetadataDialog::SetEpisode() 347 { 348 m_workingMetadata->SetEpisode(m_episodeSpin->GetIntValue()); 349 } 350 320 351 void EditMetadataDialog::SetPlayer() 321 352 { 322 353 m_workingMetadata->SetPlayCommand(m_playerEdit->GetText()); -
mythplugins/mythvideo/mythvideo/videoutils.h
33 33 34 34 QString GetDisplayUserRating(float userrating); 35 35 QString GetDisplayLength(int length); 36 QString GetDisplaySeason(int season, int digits); 37 QString GetDisplayEpisode(int episode, int digits); 36 38 QString GetDisplayBrowse(bool browse); 37 39 QString GetDisplayYear(int year); 38 40 QString GetDisplayRating(const QString &rating);