Ticket #6346: MythVideo.SubSeasEp.31709.diff
File MythVideo.SubSeasEp.31709.diff, 41.8 KB (added by , 12 years ago) |
---|
-
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"> -
mythvideo/theme/default-wide/video-ui.xml
843 853 <window name="edit_metadata"> 844 854 845 855 <textarea name="title" from="basetextarea"> 846 <area>10, 50,1260,50</area>856 <area>10,30,760,50</area> 847 857 <value>Edit Video Information</value> 848 858 <align>hcenter,vcenter</align> 849 859 <font>baselarge</font> … … 852 862 <!-- Labels --> 853 863 854 864 <textarea name="title_text" from="basetextarea"> 855 <area> 250,110,250,40</area>856 <value> Name:</value>865 <area>50,80,250,40</area> 866 <value>Title:</value> 857 867 <align>right,top</align> 858 868 </textarea> 859 869 870 <textarea name="subtitle_text" from="basetextarea"> 871 <area>50,138,250,40</area> 872 <value>Subtitle:</value> 873 <align>right,top</align> 874 </textarea> 875 876 <textarea name="season_text" from="basetextarea"> 877 <area>50,185,250,40</area> 878 <value>Season:</value> 879 <align>right,top</align> 880 </textarea> 881 882 <textarea name="episode_text" from="basetextarea"> 883 <area>370,185,150,40</area> 884 <value>Episode:</value> 885 <align>right,top</align> 886 </textarea> 887 860 888 <textarea name="category_text" from="title_text"> 861 <position>250,172</position> 889 <area>420,232,150,40</area> 890 <align>right</align> 862 891 <value>Category:</value> 863 892 </textarea> 864 893 865 894 <textarea name="level_text" from="title_text"> 866 <position>250,222</position> 895 <area>20,232,200,40</area> 896 <align>right</align> 867 897 <value>Parental Control:</value> 868 898 </textarea> 869 899 870 900 <textarea name="child_text" from="title_text"> 871 <position>250,267</position> 901 <area>20,277,200,40</area> 902 <align>right</align> 872 903 <value>File to Always Play Next:</value> 873 904 </textarea> 874 905 875 906 <textarea name="browse_text" from="title_text"> 876 <position>250,312</position> 907 <area>470,277,280,40</area> 908 <align>left</align> 877 909 <value>Include while Browsing:</value> 878 910 </textarea> 879 911 880 912 <textarea name="coverart_text_label" from="title_text"> 881 <position> 250,348</position>913 <position>50,328</position> 882 914 <value>Cover Art:</value> 883 915 </textarea> 884 916 885 917 <textarea name="screenshot_text_label" from="title_text"> 886 <position> 250,377</position>918 <position>50,357</position> 887 919 <value>Screenshot:</value> 888 920 </textarea> 889 921 890 922 <textarea name="banner_text_label" from="title_text"> 891 <position> 250,406</position>923 <position>50,386</position> 892 924 <value>Banner:</value> 893 925 </textarea> 894 926 895 927 <textarea name="fanart_text_label" from="title_text"> 896 <position> 250,435</position>928 <position>50,415</position> 897 929 <value>Fanart:</value> 898 930 </textarea> 899 931 900 932 <textarea name="trailer_text_label" from="title_text"> 901 <position> 250,464</position>933 <position>50,447</position> 902 934 <value>Trailer:</value> 903 935 </textarea> 904 936 905 937 <textarea name="player_text" from="title_text"> 906 <position> 250,510</position>938 <position>50,487</position> 907 939 <value>Unique Player Command:</value> 908 940 </textarea> 909 941 910 942 <!-- Widgets --> 911 943 912 944 <textedit name="title_edit" from="basetextedit"> 913 <position> 510,100</position>945 <position>310,70</position> 914 946 </textedit> 915 947 916 < buttonlist name="category_select" from="baseselector">917 <position> 510,165</position>918 </ buttonlist>948 <textedit name="subtitle_edit" from="basetextedit"> 949 <position>310,126</position> 950 </textedit> 919 951 952 <spinbox name="season" from="basespinbox"> 953 <position>310,181</position> 954 </spinbox> 955 956 <spinbox name="episode" from="basespinbox"> 957 <position>530,181</position> 958 </spinbox> 959 920 960 <buttonlist name="level_select" from="baseselector"> 921 <position> 510,215</position>961 <position>230,225</position> 922 962 </buttonlist> 923 963 964 <buttonlist name="category_select" from="baseselector"> 965 <position>580,225</position> 966 </buttonlist> 967 924 968 <buttonlist name="child_select" from="baseselector"> 925 <position> 510,260</position>969 <position>230,270</position> 926 970 </buttonlist> 927 971 928 972 <checkbox name="browse_check" from="basecheckbox"> 929 <position> 510,310</position>973 <position>735,275</position> 930 974 </checkbox> 931 975 932 <button name="coverart_button" from="basesearchbutton"> 933 <position>510,343</position> 976 <button name="coverart_button"> 977 <area>310,323,32,32</area> 978 <statetype name="buttonstate"> 979 <state name="active"> 980 <imagetype name="background"> 981 <filename>blankbutton_off.png</filename> 982 </imagetype> 983 </state> 984 <state name="selected" from="active"> 985 <imagetype name="background"> 986 <filename>blankbutton_on.png</filename> 987 </imagetype> 988 </state> 989 <state name="disabled" from="active" /> 990 <state name="pushed" from="active"> 991 <imagetype name="background"> 992 <filename>blankbutton_pushed.png</filename> 993 </imagetype> 994 </state> 995 </statetype> 934 996 </button> 935 997 936 998 <textarea name="coverart_text" from="basetextarea"> 937 <area> 550,348,250,40</area>999 <area>350,328,250,40</area> 938 1000 <value>/path/to/the/thing.jpg</value> 939 1001 </textarea> 940 1002 941 <button name="screenshot_button" from="basesearchbutton"> 942 <position>510,372</position> 1003 <button name="screenshot_button"> 1004 <area>310,352,32,32</area> 1005 <statetype name="buttonstate"> 1006 <state name="active"> 1007 <imagetype name="background"> 1008 <filename>blankbutton_off.png</filename> 1009 </imagetype> 1010 </state> 1011 <state name="selected" from="active"> 1012 <imagetype name="background"> 1013 <filename>blankbutton_on.png</filename> 1014 </imagetype> 1015 </state> 1016 <state name="disabled" from="active" /> 1017 <state name="pushed" from="active"> 1018 <imagetype name="background"> 1019 <filename>blankbutton_pushed.png</filename> 1020 </imagetype> 1021 </state> 1022 </statetype> 943 1023 </button> 944 1024 945 1025 <textarea name="screenshot_text" from="basetextarea"> 946 <area> 550,377,250,40</area>1026 <area>350,357,250,40</area> 947 1027 <value>/path/to/the/thing.jpg</value> 948 1028 </textarea> 949 1029 950 <button name="banner_button" from="basesearchbutton"> 951 <position>510,401</position> 1030 <button name="banner_button"> 1031 <area>310,381,32,32</area> 1032 <statetype name="buttonstate"> 1033 <state name="active"> 1034 <imagetype name="background"> 1035 <filename>blankbutton_off.png</filename> 1036 </imagetype> 1037 </state> 1038 <state name="selected" from="active"> 1039 <imagetype name="background"> 1040 <filename>blankbutton_on.png</filename> 1041 </imagetype> 1042 </state> 1043 <state name="disabled" from="active" /> 1044 <state name="pushed" from="active"> 1045 <imagetype name="background"> 1046 <filename>blankbutton_pushed.png</filename> 1047 </imagetype> 1048 </state> 1049 </statetype> 952 1050 </button> 953 1051 954 1052 <textarea name="banner_text" from="basetextarea"> 955 <area> 550,406,250,40</area>1053 <area>350,386,250,40</area> 956 1054 <value>/path/to/the/thing.jpg</value> 957 1055 </textarea> 958 1056 959 <button name="fanart_button" from="basesearchbutton"> 960 <position>510,430</position> 1057 <button name="fanart_button"> 1058 <area>310,412,32,32</area> 1059 <statetype name="buttonstate"> 1060 <state name="active"> 1061 <imagetype name="background"> 1062 <filename>blankbutton_off.png</filename> 1063 </imagetype> 1064 </state> 1065 <state name="selected" from="active"> 1066 <imagetype name="background"> 1067 <filename>blankbutton_on.png</filename> 1068 </imagetype> 1069 </state> 1070 <state name="disabled" from="active" /> 1071 <state name="pushed" from="active"> 1072 <imagetype name="background"> 1073 <filename>blankbutton_pushed.png</filename> 1074 </imagetype> 1075 </state> 1076 </statetype> 961 1077 </button> 962 1078 963 1079 <textarea name="fanart_text" from="basetextarea"> 964 <area> 550,435,250,40</area>1080 <area>350,415,250,40</area> 965 1081 <value>/path/to/the/thing.jpg</value> 966 1082 </textarea> 967 1083 968 <button name="trailer_button" from="basesearchbutton"> 969 <position>510,460</position> 1084 <button name="trailer_button"> 1085 <area>310,442,32,32</area> 1086 <statetype name="buttonstate"> 1087 <state name="active"> 1088 <imagetype name="background"> 1089 <filename>blankbutton_off.png</filename> 1090 </imagetype> 1091 </state> 1092 <state name="selected" from="active"> 1093 <imagetype name="background"> 1094 <filename>blankbutton_on.png</filename> 1095 </imagetype> 1096 </state> 1097 <state name="disabled" from="active" /> 1098 <state name="pushed" from="active"> 1099 <imagetype name="background"> 1100 <filename>blankbutton_pushed.png</filename> 1101 </imagetype> 1102 </state> 1103 </statetype> 970 1104 </button> 971 1105 972 1106 <textarea name="trailer_text" from="basetextarea"> 973 <area> 550,465,250,40</area>1107 <area>350,447,250,40</area> 974 1108 <value>/path/to/the/thing.jpg</value> 975 1109 </textarea> 976 1110 1111 977 1112 <textedit name="player_edit" from="basetextedit"> 978 <position> 510,495</position>1113 <position>310,477</position> 979 1114 </textedit> 980 1115 981 1116 <button name="done_button" from="basebutton"> 982 <position> 510,565</position>1117 <position>310,537</position> 983 1118 <value>Done</value> 984 1119 </button> 985 1120 -
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 -
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(); -
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; } -
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 } -
mythvideo/mythvideo/videoutils.cpp
139 142 return QString("%1 minutes").arg(length); 140 143 } 141 144 145 QString GetDisplaySeasonEpisode(int seasEp, int digits) 146 { 147 QString seasEpNum = QString::number(seasEp); 148 149 if (digits == 2 && seasEpNum.size() < 2) 150 seasEpNum.prepend("0"); 151 152 return seasEpNum; 153 } 154 142 155 QString GetDisplayBrowse(bool browse) 143 156 { 144 157 return browse ? QObject::tr("Yes") : QObject::tr("No"); -
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; -
mythvideo/mythvideo/videodlg.cpp
1016 1084 1017 1085 tmp["filename"] = metadata->GetFilename(); 1018 1086 tmp["title"] = metadata->GetTitle(); 1087 tmp["subtitle"] = metadata->GetSubtitle(); 1019 1088 tmp["director"] = metadata->GetDirector(); 1020 1089 tmp["plot"] = metadata->GetPlot(); 1021 1090 tmp["genres"] = GetDisplayGenres(*metadata); … … 1025 1094 tmp["length"] = GetDisplayLength(metadata->GetLength()); 1026 1095 tmp["year"] = GetDisplayYear(metadata->GetYear()); 1027 1096 tmp["userrating"] = GetDisplayUserRating(metadata->GetUserRating()); 1097 tmp["season"] = GetDisplaySeasonEpisode(metadata->GetSeason(), 1); 1098 tmp["episode"] = GetDisplaySeasonEpisode(metadata->GetEpisode(), 1); 1028 1099 1100 if (metadata->GetSeason() > 0 && metadata->GetEpisode() >= 0) 1101 { 1102 tmp["s##e##"] = QString("s%1e%2").arg(GetDisplaySeasonEpisode 1103 (metadata->GetSeason(), 2)) 1104 .arg(GetDisplaySeasonEpisode(metadata->GetEpisode(), 2)); 1105 tmp["##x##"] = QString("%1x%2").arg(GetDisplaySeasonEpisode 1106 (metadata->GetSeason(), 1)) 1107 .arg(GetDisplaySeasonEpisode(metadata->GetEpisode(), 2)); 1108 } 1109 else 1110 tmp["s##e##"] = tmp["##x##"] = ""; 1111 1029 1112 tmp["userratingstate"] = 1030 1113 QString::number((int)(metadata->GetUserRating())); 1031 1114 tmp["videolevel"] = ParentalLevelToState(metadata->GetShowLevel()); … … 1075 1158 h.handleText("player"); 1076 1159 h.handleText("filename"); 1077 1160 h.handleText("title"); 1161 h.handleText("subtitle"); 1078 1162 h.handleText("director"); 1079 1163 h.handleText("plot"); 1080 1164 h.handleText("genres"); … … 1082 1166 h.handleText("cast"); 1083 1167 h.handleText("rating"); 1084 1168 h.handleText("length"); 1169 h.handleText("season"); 1170 h.handleText("s##e##"); 1171 h.handleText("##x##"); 1172 h.handleText("episode"); 1085 1173 h.handleText("year"); 1086 1174 h.handleText("userrating"); 1087 1175 … … 3023 3130 } 3024 3131 // set known values 3025 3132 metadata->SetTitle(data["Title"]); 3133 metadata->SetSubtitle(data["Subtitle"]); 3026 3134 metadata->SetYear(data["Year"].toInt()); 3027 3135 metadata->SetDirector(data["Director"]); 3028 3136 metadata->SetPlot(data["Plot"]); 3029 3137 metadata->SetUserRating(data["UserRating"].toFloat()); 3030 3138 metadata->SetRating(data["MovieRating"]); 3031 3139 metadata->SetLength(data["Runtime"].toInt()); 3140 metadata->SetSeason(data["Season"].toInt()); 3141 metadata->SetEpisode(data["Episode"].toInt()); 3032 3142 3033 3143 m_d->AutomaticParentalAdjustment(metadata); 3034 3144 -
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())); -
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"), -
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 -
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(LosingFocus()), SLOT(SetSeason())); 92 connect(m_episodeSpin, SIGNAL(LosingFocus()), 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()); -
mythvideo/mythvideo/videoutils.h
33 33 34 34 QString GetDisplayUserRating(float userrating); 35 35 QString GetDisplayLength(int length); 36 QString GetDisplaySeasonEpisode(int seasEp, int digits); 36 37 QString GetDisplayBrowse(bool browse); 37 38 QString GetDisplayYear(int year); 38 39 QString GetDisplayRating(const QString &rating);