Ticket #3585: mythvideo-cast-new.2.diff
| File mythvideo-cast-new.2.diff, 42.1 KB (added by , 18 years ago) |
|---|
-
mythvideo/mythvideo/dbaccess.cpp
diff -Nur --exclude='*.o' --exclude='moc_*' --exclude='Makefil*' ../mythplugins-orig/mythvideo/mythvideo/dbaccess.cpp ./mythvideo/mythvideo/dbaccess.cpp
old new 548 548 549 549 //////////////////////////////////////////// 550 550 551 VideoCast::VideoCast() : 552 SingleValue(new SingleValueImp("videocast", "intid", "cast")) 553 { 554 } 555 556 VideoCast::~VideoCast() 557 { 558 } 559 560 VideoCast &VideoCast::getCast() 561 { 562 static VideoCast vc; 563 vc.load_data(); 564 return vc; 565 } 566 567 //////////////////////////////////////////// 568 551 569 VideoGenreMap::VideoGenreMap() : 552 570 MultiValue(new MultiValueImp("videometadatagenre", "idvideo", "idgenre")) 553 571 { … … 585 603 586 604 //////////////////////////////////////////// 587 605 606 VideoCastMap::VideoCastMap() : 607 MultiValue(new MultiValueImp("videometadatacast", "idvideo", 608 "idcast")) 609 { 610 } 611 612 VideoCastMap::~VideoCastMap() 613 { 614 } 615 616 VideoCastMap &VideoCastMap::getCastMap() 617 { 618 static VideoCastMap vcm; 619 vcm.load_data(); 620 return vcm; 621 } 622 623 //////////////////////////////////////////// 624 588 625 class FileAssociationsImp 589 626 { 590 627 public: -
mythvideo/mythvideo/dbaccess.h
diff -Nur --exclude='*.o' --exclude='moc_*' --exclude='Makefil*' ../mythplugins-orig/mythvideo/mythvideo/dbaccess.h ./mythvideo/mythvideo/dbaccess.h
old new 106 106 VideoCountryMap(); 107 107 ~VideoCountryMap(); 108 108 }; 109 110 class VideoCast : public SingleValue 111 { 112 public: 113 static VideoCast &getCast(); 114 115 private: 116 VideoCast(); 117 ~VideoCast(); 118 }; 119 120 class VideoCastMap : public MultiValue 121 { 122 public: 123 static VideoCastMap &getCastMap(); 124 125 private: 126 VideoCastMap(); 127 ~VideoCastMap(); 128 }; 109 129 110 130 class FileAssociations 111 131 { -
.
diff -Nur --exclude='*.o' --exclude='moc_*' --exclude='Makefil*' ../mythplugins-orig/mythvideo/mythvideo/dbcheck.cpp ./mythvideo/mythvideo/dbcheck.cpp
old new namespace 13 13 const QString lastMythDVDDBVersion = "1002"; 14 14 const QString lastMythVideoVersion = "1010"; 15 15 16 const QString currentDatabaseVersion = "101 4";16 const QString currentDatabaseVersion = "1015"; 17 17 18 18 const QString OldMythVideoVersionName = "VideoDBSchemaVer"; 19 19 const QString OldMythDVDVersionName = "DVDDBSchemaVer"; … … namespace 622 622 updates += "ALTER TABLE filemarkup ADD INDEX (filename(255));"; 623 623 performActualUpdate(updates, "1014", dbver, MythVideoVersionName); 624 624 } 625 626 if (dbver == "1014") 627 { 628 // Add Cast tables 629 const QString updates[] = { 630 "CREATE TABLE IF NOT EXISTS videocast ( intid INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, cast VARCHAR(128) NOT NULL);", 631 "CREATE TABLE IF NOT EXISTS videometadatacast ( idvideo INT UNSIGNED NOT NULL,idcast INT UNSIGNED NOT NULL );", 632 "" 633 }; 634 635 performActualUpdate(updates, "1015", dbver, MythVideoVersionName); 636 } 625 637 } 626 638 } 627 639 -
mythvideo/mythvideo/globals.cpp
diff -Nur --exclude='*.o' --exclude='moc_*' --exclude='Makefil*' ../mythplugins-orig/mythvideo/mythvideo/globals.cpp ./mythvideo/mythvideo/globals.cpp
old new 9 9 const QString VIDEO_COUNTRY_UNKNOWN = QObject::tr("Unknown"); 10 10 const QString VIDEO_YEAR_UNKNOWN = QObject::tr("Unknown"); 11 11 const QString VIDEO_RUNTIME_UNKNOWN = QObject::tr("Unknown"); 12 const QString VIDEO_CAST_UNKNOWN = QObject::tr("Unknown"); 12 13 13 14 const QString VIDEO_CATEGORY_DEFAULT = VIDEO_CATEGORY_UNKNOWN; 14 15 const QString VIDEO_DIRECTOR_DEFAULT = VIDEO_DIRECTOR_UNKNOWN; … … 16 17 const QString VIDEO_COVERFILE_DEFAULT = QObject::tr("No Cover"); 17 18 const QString VIDEO_RATING_DEFAULT = QObject::tr("NR"); 18 19 const QString VIDEO_PLOT_DEFAULT = QObject::tr("None"); 20 const QString VIDEO_CAST_DEFAULT = VIDEO_CAST_UNKNOWN; 19 21 20 22 const QString JUMP_VIDEO_MANAGER = "Video Manager"; 21 23 const QString JUMP_VIDEO_BROWSER = "Video Browser"; -
mythvideo/mythvideo/globals.h
diff -Nur --exclude='*.o' --exclude='moc_*' --exclude='Makefil*' ../mythplugins-orig/mythvideo/mythvideo/globals.h ./mythvideo/mythvideo/globals.h
old new 5 5 extern const QString VIDEO_DIRECTOR_UNKNOWN; 6 6 extern const QString VIDEO_GENRE_UNKNOWN; 7 7 extern const QString VIDEO_COUNTRY_UNKNOWN; 8 extern const QString VIDEO_CAST_UNKNOWN; 8 9 extern const QString VIDEO_YEAR_UNKNOWN; 9 10 extern const QString VIDEO_RUNTIME_UNKNOWN; 10 11 … … 14 15 extern const QString VIDEO_COVERFILE_DEFAULT; 15 16 extern const QString VIDEO_RATING_DEFAULT; 16 17 extern const QString VIDEO_PLOT_DEFAULT; 18 extern const QString VIDEO_CAST_DEFAULT; 17 19 18 20 extern const QString JUMP_VIDEO_MANAGER; 19 21 extern const QString JUMP_VIDEO_BROWSER; -
mythvideo/mythvideo/metadata.cpp
diff -Nur --exclude='*.o' --exclude='moc_*' --exclude='Makefil*' ../mythplugins-orig/mythvideo/mythvideo/metadata.cpp ./mythvideo/mythvideo/metadata.cpp
old new 86 86 public: 87 87 typedef Metadata::genre_list genre_list; 88 88 typedef Metadata::country_list country_list; 89 typedef Metadata::cast_list cast_list; 89 90 90 91 public: 91 92 MetadataImp(const QString &filename, const QString &coverfile, … … 97 98 int childID, bool browse, 98 99 const QString &playcommand, const QString &category, 99 100 const genre_list &genres, 100 const country_list &countries) : 101 const country_list &countries, 102 const cast_list &cast) : 101 103 m_title(title), 102 104 m_inetref(inetref), m_director(director), m_plot(plot), 103 105 m_rating(rating), m_playcommand(playcommand), m_category(category), 104 m_genres(genres), m_countries(countries), 106 m_genres(genres), m_countries(countries), m_cast(cast), 105 107 m_filename(filename), m_coverfile(coverfile), 106 108 m_categoryID(categoryID), m_childID(childID), m_year(year), 107 109 m_length(length), m_showlevel(showlevel), m_browse(browse), m_id(id), … … 134 136 m_category = rhs.m_category; 135 137 m_genres = rhs.m_genres; 136 138 m_countries = rhs.m_countries; 139 m_cast = rhs.m_cast; 137 140 m_filename = rhs.m_filename; 138 141 m_coverfile = rhs.m_coverfile; 139 142 … … 202 205 { 203 206 m_countries = countries; 204 207 } 208 209 const cast_list &getCast() const { return m_cast; } 210 void setCast(const cast_list &cast) { m_cast = cast; } 205 211 206 212 const QString &getFilename() const { return m_filename; } 207 213 void setFilename(const QString &filename) { m_filename = filename; } … … 266 272 void fillCountries(); 267 273 void updateCountries(); 268 274 void fillGenres(); 275 void fillCast(); 269 276 void updateGenres(); 277 void updateCast(); 270 278 bool removeDir(const QString &dirName); 271 279 void fromDBRow(MSqlQuery &query); 272 280 void saveToDatabase(); … … 281 289 QString m_category; 282 290 genre_list m_genres; 283 291 country_list m_countries; 292 cast_list m_cast; 284 293 QString m_filename; 285 294 QString m_coverfile; 286 295 … … 365 374 { 366 375 VideoGenreMap::getGenreMap().remove(m_id); 367 376 VideoCountryMap::getCountryMap().remove(m_id); 377 VideoCastMap::getCastMap().remove(m_id); 368 378 369 379 MSqlQuery query(MSqlQuery::InitCon()); 370 380 query.prepare("DELETE FROM videometadata WHERE intid = :ID"); … … 422 432 } 423 433 } 424 434 435 void MetadataImp::fillCast() 436 { 437 m_cast.clear(); 438 VideoCastMap &vcm = VideoCastMap::getCastMap(); 439 VideoCastMap::entry cast; 440 if (vcm.get(m_id, cast)) 441 { 442 VideoCast &vc = VideoCast::getCast(); 443 for (VideoCastMap::entry::values_type::iterator p = 444 cast.values.begin(); p != cast.values.end(); ++p) 445 { 446 // Just add empty string for no-name cast 447 QString name; 448 vc.get(*p, name); 449 m_cast.push_back(cast_list::value_type(*p, name)); 450 } 451 } 452 } 453 425 454 /// Sets metadata from a DB row 426 455 void MetadataImp::fromDBRow(MSqlQuery &query) 427 456 { … … 453 482 454 483 //Countries 455 484 fillCountries(); 485 486 // Cast 487 fillCast(); 456 488 } 457 489 458 490 void MetadataImp::saveToDatabase() … … 552 584 553 585 updateGenres(); 554 586 updateCountries(); 587 updateCast(); 555 588 } 556 589 557 590 void MetadataImp::dumpToDatabase() … … 631 664 } 632 665 } 633 666 667 void MetadataImp::updateCast() 668 { 669 VideoCastMap::getCastMap().remove(m_id); 670 671 // ensure that all cast we have are in the DB 672 cast_list::iterator cast = m_cast.begin(); 673 while (cast != m_cast.end()) 674 { 675 if (cast->second.stripWhiteSpace().length()) 676 { 677 cast->first = VideoCast::getCast().add(cast->second); 678 VideoCastMap::getCastMap().add(m_id, cast->first); 679 ++cast; 680 } 681 else 682 { 683 cast = m_cast.erase(cast); 684 } 685 } 686 } 687 634 688 //////////////////////////////////////// 635 689 //// Metadata 636 690 //////////////////////////////////////// … … 836 890 int childID, bool browse, 837 891 const QString &playcommand, const QString &category, 838 892 const genre_list &genres, 839 const country_list &countries) 893 const country_list &countries, 894 const cast_list &cast) 840 895 { 841 896 m_imp = new MetadataImp(filename, coverfile, title, year, inetref, director, 842 897 plot, userrating, rating, length, id, showlevel, 843 898 categoryID, childID, browse, playcommand, category, 844 genres, countries );899 genres, countries, cast); 845 900 } 846 901 847 902 Metadata::~Metadata() … … 1080 1135 m_imp->setGenres(genres); 1081 1136 } 1082 1137 1138 const Metadata::cast_list &Metadata::Cast() const 1139 { 1140 return m_imp->getCast(); 1141 } 1142 1143 QString Metadata::CastLine() const 1144 { 1145 cast_list cast = m_imp->getCast(); 1146 QString actors = ""; 1147 1148 if (cast.size() > 0) 1149 { 1150 cast_list::const_iterator it = cast.begin(); 1151 1152 int num = cast.size(); 1153 1154 for (int i = 0; i < (num - 1); i++) 1155 { 1156 actors+=it->second + ","; 1157 ++it; 1158 } 1159 actors+=it->second; 1160 } 1161 1162 return actors; 1163 } 1164 1165 void Metadata::setCast(const cast_list &cast) 1166 { 1167 m_imp->setCast(cast); 1168 } 1169 1083 1170 const Metadata::country_list &Metadata::Countries() const 1084 1171 { 1085 1172 return m_imp->getCountries(); -
mythvideo/mythvideo/metadata.h
diff -Nur --exclude='*.o' --exclude='moc_*' --exclude='Makefil*' ../mythplugins-orig/mythvideo/mythvideo/metadata.h ./mythvideo/mythvideo/metadata.h
old new 20 20 public: 21 21 typedef std::pair<int, QString> genre_entry; 22 22 typedef std::pair<int, QString> country_entry; 23 typedef std::pair<int, QString> cast_entry; 23 24 typedef std::vector<genre_entry> genre_list; 24 25 typedef std::vector<country_entry> country_list; 26 typedef std::vector<cast_entry> cast_list; 25 27 26 28 public: 27 29 class SortKey … … 62 64 int childID = -1, bool browse = true, 63 65 const QString &playcommand = "", const QString &category = "", 64 66 const genre_list &genres = genre_list(), 65 const country_list &countries = country_list()); 67 const country_list &countries = country_list(), 68 const cast_list &cast = cast_list()); 66 69 ~Metadata(); 67 70 Metadata(MSqlQuery &query); 68 71 Metadata(const Metadata &rhs); … … 133 136 const genre_list &Genres() const; 134 137 void setGenres(const genre_list &genres); 135 138 139 const cast_list &Cast() const; 140 QString CastLine() const; 141 void setCast(const cast_list &cast); 142 136 143 const country_list &Countries() const; 137 144 void setCountries(const country_list &countries); 138 145 -
mythvideo/mythvideo/scripts/get_cast.py
diff -Nur --exclude='*.o' --exclude='moc_*' --exclude='Makefil*' ../mythplugins-orig/mythvideo/mythvideo/scripts/get_cast.py ./mythvideo/mythvideo/scripts/get_cast.py
old new 1 #!/usr/bin/python 2 # -*- coding: utf8 -*- 3 """ 4 This Python script is intended to fill the cast in the database 5 This script is intended to be used by people that have an existing 6 big video collection already in the database and want to fill 7 in the cast field. Perform movie data lookups using the 8 imdbpy.py script. 9 10 Written by William Stewart 2007 11 Based on find_meta.py by Pekka JÀÀskelÀinen 12 13 """ 14 15 import sys 16 import optparse 17 import re 18 import os 19 import glob 20 import fileinput 21 import shlex 22 import socket 23 import urllib 24 import distutils.file_util 25 import imdbpy 26 27 try: 28 import imdb 29 except ImportError: 30 print "You need to install the IMDbPy library "\ 31 "from (http://imdbpy.sourceforge.net/?page=download)" 32 sys.exit(1) 33 34 try: 35 from MythTV import MythDB, MythVideo 36 mythdb = MythDB() 37 mythvideo = MythVideo() 38 except: 39 mythdb = None 40 mythvideo = None 41 42 from stat import * 43 44 verbose=False 45 46 def print_verbose(string): 47 global verbose 48 if verbose: 49 print string 50 return 51 52 def main(): 53 global verbose 54 55 usage = "usage: %prog [options]" 56 57 p = optparse.OptionParser(usage=usage) 58 p.add_option('--version', '-v', action="store_true", default=False, 59 help="Display 1-line describing name, version, author etc.") 60 61 options, arguments = p.parse_args() 62 63 if options.version: 64 print "MythVideo Cast Metadata Finder - William Stewart 2007" 65 sys.exit(0) 66 67 if not mythdb: 68 print "Error can not access the mythtv database" 69 sys.exit(1) 70 71 c = mythdb.cursor() 72 c.execute(""" 73 SELECT intid, filename, inetref 74 FROM videometadata""") 75 76 row = c.fetchone() 77 while row is not None: 78 intid = row[0] 79 filename = row[1] 80 imdb_id = row[2] 81 if imdb_id != '00000000': 82 """ 83 Fetches metadata for the given IMDb id. 84 """ 85 imdb_access = imdb.IMDb() 86 movie = imdb_access.get_movie(imdb_id) 87 imdb_access.update(movie) 88 89 castlist = movie.get('cast') 90 if castlist is not None: 91 print "Found cast data for %s (%s)" % (filename, imdb_id) 92 i = 0 93 for name in castlist: 94 cast=unicode(name['name']) 95 if i < 12: 96 mythvideo.setCast(cast, intid) 97 i+=1 98 row = c.fetchone() 99 c.close() 100 101 sys.exit(0) 102 103 if __name__ == '__main__': 104 main() -
mythvideo/mythvideo/scripts/imdb.pl
diff -Nur --exclude='*.o' --exclude='moc_*' --exclude='Makefil*' ../mythplugins-orig/mythvideo/mythvideo/scripts/imdb.pl ./mythvideo/mythvideo/scripts/imdb.pl
old new 217 217 "/table>"); 218 218 if ($data) { 219 219 $cast = join(',', ($data =~ m/$name_link_pat/g)); 220 $cast = trim($cast); 220 221 } 221 222 222 223 … … 243 244 print "MovieRating:$movierating\n"; 244 245 print "Runtime:$runtime\n"; 245 246 print "Writers: $writer\n"; 246 print "Cast: $cast\n";247 print "Cast:$cast\n"; 247 248 print "Genres: $lgenres\n"; 248 249 print "Countries: $lcountries\n"; 249 250 } -
mythvideo/mythvideo/scripts/imdbpy.py
diff -Nur --exclude='*.o' --exclude='moc_*' --exclude='Makefil*' ../mythplugins-orig/mythvideo/mythvideo/scripts/imdbpy.py ./mythvideo/mythvideo/scripts/imdbpy.py
old new 198 198 year = None 199 199 directors = None 200 200 plot = None 201 cast = None 201 202 rating = None 202 203 mpaa_rating = None 203 204 genres = None … … 236 237 if self.directors is not None and len(self.directors) > 0: 237 238 metadata += createMetadataLine("Director", unicode(self.directors[0])) 238 239 metadata += createMetadataLine("Plot", self.plot) 240 metadata += createMetadataLine("Cast", unicode(self.cast)) 239 241 metadata += createMetadataLine('UserRating', self.rating) 240 242 metadata += createMetadataLine('MovieRating', self.mpaa_rating) 241 243 metadata += createMetadataLine('Genres', self.genres) … … 256 260 257 261 imdb_access = imdb.IMDb() 258 262 movie = imdb_access.get_movie(imdb_id) 263 259 264 imdb_access.update(movie) 260 265 261 266 def metadataFromField(key, default=None, m=movie): … … 329 332 if shortest_found == None or len(text) < len(shortest_found): 330 333 shortest_found = text 331 334 metadata.plot = shortest_found 335 336 cast = movie.get('cast') 337 cast_str = "" 338 if cast is not None: 339 i = 0 340 for name in cast: 341 if i is not 10: 342 cast_str+=name['name']+"," 343 i+=1 332 344 345 cast_str = cast_str[0:-1] 346 347 metadata.cast = cast_str 333 348 metadata.rating = metadataFromField('rating', metadata.rating) 334 349 metadata.mpaa_rating = metadataFromField('mpaa', metadata.mpaa_rating) 335 350 metadata.runtime = metadataFromFirst('runtimes', metadata.runtime) -
mythvideo/mythvideo/scripts/MythTV.py
diff -Nur --exclude='*.o' --exclude='moc_*' --exclude='Makefil*' ../mythplugins-orig/mythvideo/mythvideo/scripts/MythTV.py ./mythvideo/mythvideo/scripts/MythTV.py
old new 79 79 if token == "DBHostName": 80 80 if config.get_token() == "=": 81 81 db_host = config.get_token() 82 if config.get_token() == '.': 83 db_host += '.' + config.get_token() 84 if config.get_token() == '.': 85 db_host += '.' + config.get_token() 86 if config.get_token() == '.': 87 db_host += '.' + config.get_token() 82 88 elif token == "DBUserName": 83 89 if config.get_token() == "=": 84 90 db_user = config.get_token() … … 93 99 log.debug('Using config %s' % config_file) 94 100 found_config = True 95 101 break 96 97 102 if not found_config: 98 103 raise "Unable to find MythTV configuration file" 99 104 self.db = MySQLdb.connect(user=db_user, host=db_host, passwd=db_password, db=db_name) … … 345 350 346 351 return newid 347 352 353 def getCastId(self, cast_name): 354 """ 355 Find the id of the given cast from MythDB. 356 357 If the cast does not exist, insert it and return its id. 358 """ 359 c = self.db.cursor() 360 # print "SELECT intid FROM videocast WHERE lower(cast) = '%s'" % (cast_name,) 361 c.execute("SELECT intid FROM videocast WHERE lower(cast) = %s", (cast_name,)) 362 row = c.fetchone() 363 c.close() 364 365 if row is not None: 366 # print "getCastId %s %s" % (cast_name, row[0]) 367 return row[0] 368 369 # Insert a new cast. 370 c = self.db.cursor() 371 c.execute("INSERT INTO videocast(cast) VALUES (%s)", (cast_name,)) 372 #print "INSERT INTO videocast(cast) VALUES ('%s')" % (cast_name,) 373 c.close() 374 375 c = self.db.cursor() 376 c.execute("SELECT intid FROM videocast WHERE lower(cast) = %s", (cast_name,)) 377 row = c.fetchone() 378 c.close() 379 380 return row[0] 381 382 def setCast(self, cast_name, idvideo): 383 """ 384 Insert the cast_name into videometadatacast if it does already exist. 385 386 If the cast does not exist, insert it and return its id. 387 """ 388 389 idcast = self.getCastId(cast_name); 390 391 c = self.db.cursor() 392 c.execute("SELECT * FROM videometadatacast WHERE idvideo = %s AND idcast = %s", (idvideo,idcast)) 393 row = c.fetchone() 394 c.close() 395 396 if row is None: 397 # Insert a new cast. 398 c = self.db.cursor() 399 c.execute("INSERT INTO videometadatacast VALUES (%s,%s)", (idvideo,idcast)) 400 #print "INSERT INTO videometadatacast VALUES (%s,%s)" % (idvideo,idcast) 401 c.close() 402 348 403 def getMetadataId(self, videopath): 349 404 """ 350 405 Finds the MythVideo metadata id for the given video path from the MythDB, if any. -
mythvideo/mythvideo/videobrowser.cpp
diff -Nur --exclude='*.o' --exclude='moc_*' --exclude='Makefil*' ../mythplugins-orig/mythvideo/mythvideo/videobrowser.cpp ./mythvideo/mythvideo/videobrowser.cpp
old new 122 122 focusButton = popup->addButton(tr("Watch This Video"), this, 123 123 SLOT(slotWatchVideo())); 124 124 popup->addButton(tr("View Full Plot"), this, SLOT(slotViewPlot())); 125 popup->addButton(tr("View Cast"), this, SLOT(slotViewCast())); 125 126 } 126 127 else 127 128 { … … 307 308 curitem->Director()); 308 309 checkedSetText((UITextType *)container->GetType("plot"), 309 310 curitem->Plot()); 311 checkedSetText((UITextType *)container->GetType("cast"), 312 curitem->CastLine()); 310 313 checkedSetText((UITextType *)container->GetType("rating"), 311 314 getDisplayRating(curitem->Rating())); 312 315 checkedSetText((UITextType *)container->GetType("inetref"), -
mythvideo/mythvideo/videodlg.cpp
diff -Nur --exclude='*.o' --exclude='moc_*' --exclude='Makefil*' ../mythplugins-orig/mythvideo/mythvideo/videodlg.cpp ./mythvideo/mythvideo/videodlg.cpp
old new 170 170 } 171 171 } 172 172 173 void VideoDialog::slotViewCast() 174 { 175 cancelPopup(); 176 177 if (curitem) 178 { 179 QString actors = ""; 180 const Metadata::cast_list &cast = curitem->Cast(); 181 182 if (cast.size() > 0) 183 { 184 Metadata::cast_list::const_iterator it = cast.begin(); 185 186 int num = cast.size(); 187 188 if (num > 10) 189 num = 10; 190 191 for (int i = 0; i < (num - 1); i++) 192 { 193 actors+=it->second + "\n"; 194 ++it; 195 } 196 actors+=it->second; 197 } 198 else 199 { 200 actors = "None defined"; 201 } 202 203 allowPaint = false; 204 MythPopupBox * castbox = new MythPopupBox(gContext->GetMainWindow()); 205 206 QLabel *castLabel = castbox->addLabel(actors, 207 MythPopupBox::Small,true); 208 castLabel->setAlignment(Qt::AlignJustify | Qt::WordBreak); 209 210 QButton * okButton = castbox->addButton(tr("Ok")); 211 okButton->setFocus(); 212 213 castbox->ExecPopup(); 214 delete castbox; 215 allowPaint = true; 216 217 } 218 else 219 { 220 VERBOSE(VB_IMPORTANT, QString("no Item to view")); 221 slotDoCancel(); 222 } 223 } 173 224 174 225 void VideoDialog::slotWatchVideo() 175 226 { -
mythvideo/mythvideo/videodlg.h
diff -Nur --exclude='*.o' --exclude='moc_*' --exclude='Makefil*' ../mythplugins-orig/mythvideo/mythvideo/videodlg.h ./mythvideo/mythvideo/videodlg.h
old new 42 42 void slotVideoGallery(); 43 43 void slotVideoBrowser(); 44 44 void slotViewPlot(); 45 void slotViewCast(); 45 46 void slotDoFilter(); 46 47 void exitWin(); 47 48 virtual void slotParentalLevelChanged(); -
.
diff -Nur --exclude='*.o' --exclude='moc_*' --exclude='Makefil*' ../mythplugins-orig/mythvideo/mythvideo/videofilter.cpp ./mythvideo/mythvideo/videofilter.cpp
old new enum CountryFilter { 27 27 kCountryFilterUnknown = 0 28 28 }; 29 29 30 enum CastFilter { 31 kCastFilterAll = -1, 32 kCastFilterUnknown = 0 33 }; 34 30 35 enum CategoryFilter { 31 36 kCategoryFilterAll = -1, 32 37 kCategoryFilterUnknown = 0 … … const unsigned int VideoFilterSettings:: 66 71 VideoFilterSettings::VideoFilterSettings(bool loaddefaultsettings, 67 72 const QString& _prefix) : 68 73 category(kCategoryFilterAll), genre(kGenreFilterAll), 69 country(kCountryFilterAll), year(kYearFilterAll), 70 runtime(kRuntimeFilterAll), userrating(kUserRatingFilterAll), 71 browse(kBrowseFilterAll), m_inetref(kInetRefFilterAll), 72 m_coverfile(kCoverFileFilterAll), orderby(kOrderByTitle), 73 m_parental_level(ParentalLevel::plNone), m_changed_state(0) 74 country(kCountryFilterAll), cast(kCastFilterAll), 75 year(kYearFilterAll), runtime(kRuntimeFilterAll), 76 userrating(kUserRatingFilterAll), browse(kBrowseFilterAll), 77 m_inetref(kInetRefFilterAll), m_coverfile(kCoverFileFilterAll), 78 orderby(kOrderByTitle), m_parental_level(ParentalLevel::plNone), 79 m_changed_state(0) 74 80 { 75 81 if (!_prefix) 76 82 prefix = "VideoDefault"; … … VideoFilterSettings::VideoFilterSettings 86 92 kGenreFilterAll); 87 93 country = gContext->GetNumSetting(QString("%1Country").arg(prefix), 88 94 kCountryFilterAll); 95 cast = gContext->GetNumSetting(QString("%1Cast").arg(prefix), 96 kCastFilterAll); 89 97 year = gContext->GetNumSetting(QString("%1Year").arg(prefix), 90 98 kYearFilterAll); 91 99 runtime = gContext->GetNumSetting(QString("%1Runtime").arg(prefix), … … VideoFilterSettings::operator=(const Vid 134 142 country = rhs.country; 135 143 } 136 144 145 if (cast != rhs.cast) 146 { 147 m_changed_state |= kFilterCastChanged; 148 cast = rhs.cast; 149 } 150 137 151 if (year != rhs.year) 138 152 { 139 153 m_changed_state |= kFilterYearChanged; … … void VideoFilterSettings::saveAsDefault( 189 203 { 190 204 gContext->SaveSetting(QString("%1Category").arg(prefix), category); 191 205 gContext->SaveSetting(QString("%1Genre").arg(prefix), genre); 206 gContext->SaveSetting(QString("%1Cast").arg(prefix), cast); 192 207 gContext->SaveSetting(QString("%1Country").arg(prefix), country); 193 208 gContext->SaveSetting(QString("%1Year").arg(prefix), year); 194 209 gContext->SaveSetting(QString("%1Runtime").arg(prefix), runtime); … … bool VideoFilterSettings::matches_filter 233 248 } 234 249 } 235 250 251 if (matches && cast != kCastFilterAll) 252 { 253 matches = false; 254 255 const Metadata::cast_list &cl = mdata.Cast(); 256 for (Metadata::cast_list::const_iterator p = cl.begin(); 257 p != cl.end(); ++p) 258 { 259 if ((matches = p->first == cast)) 260 { 261 break; 262 } 263 } 264 } 265 236 266 if (matches && category != kCategoryFilterAll) 237 267 { 238 268 matches = category == mdata.getCategoryID(); … … VideoFilterDialog::VideoFilterDialog(Fil 369 399 const char *name_) : 370 400 MythThemedDialog(parent_, window_name, theme_filename, name_), 371 401 browse_select(0), orderby_select(0), year_select(0), userrating_select(0), 372 category_select(0), country_select(0), genre_select(0), runtime_select(0), 373 save_button(0), done_button(0), numvideos_text(0), m_intetref_select(0), 374 m_coverfile_select(0), m_fsp(fsp), m_video_list(video_list) 402 category_select(0), country_select(0), genre_select(0), cast_select(0), 403 runtime_select(0), save_button(0), done_button(0), numvideos_text(0), 404 m_intetref_select(0), m_coverfile_select(0), m_fsp(fsp), 405 m_video_list(video_list) 375 406 { 376 407 // 377 408 // The only thing this screen does is let the … … void VideoFilterDialog::fillWidgets() 469 500 genre_select->setToItem(m_settings.getGenre()); 470 501 } 471 502 503 if (cast_select) 504 { 505 cast_select->addItem(kCastFilterAll, QObject::tr("All")); 506 507 const VideoCast::entry_list &cl = VideoCast::getCast().getList(); 508 for (VideoCast::entry_list::const_iterator p = cl.begin(); 509 p != cl.end(); ++p) 510 { 511 cast_select->addItem(p->first, p->second); 512 } 513 514 cast_select->addItem(kCastFilterUnknown, VIDEO_CAST_UNKNOWN); 515 cast_select->setToItem(m_settings.getCast()); 516 } 517 472 518 if (country_select) 473 519 { 474 520 country_select->addItem(kCountryFilterAll, QObject::tr("All")); … … void VideoFilterDialog::keyPressEvent(QK 616 662 widget_testset(currentSelector, focued, category_select); 617 663 widget_testset(currentSelector, focued, genre_select); 618 664 widget_testset(currentSelector, focued, country_select); 665 widget_testset(currentSelector, focued, cast_select); 619 666 widget_testset(currentSelector, focued, year_select); 620 667 widget_testset(currentSelector, focued, runtime_select); 621 668 widget_testset(currentSelector, focued, userrating_select); … … void VideoFilterDialog::setGenre(int new 704 751 update_numvideo(); 705 752 } 706 753 754 void VideoFilterDialog::setCast(int new_cast) 755 { 756 m_settings.setCast(new_cast); 757 update_numvideo(); 758 } 759 707 760 void VideoFilterDialog::setRunTime(int new_runtime) 708 761 { 709 762 m_settings.setRuntime(new_runtime); … … void VideoFilterDialog::wireUpTheme() 762 815 connect(genre_select,SIGNAL(pushed(int)), 763 816 this, SLOT(setGenre(int))); 764 817 818 cast_select = getUISelectorType("cast_select"); 819 if (cast_select) 820 connect(cast_select,SIGNAL(pushed(int)), 821 this, SLOT(setCast(int))); 822 765 823 runtime_select = getUISelectorType("runtime_select"); 766 824 if (runtime_select) 767 825 connect(runtime_select, SIGNAL(pushed(int)), -
mythvideo/mythvideo/videofilter.h
diff -Nur --exclude='*.o' --exclude='moc_*' --exclude='Makefil*' ../mythplugins-orig/mythvideo/mythvideo/videofilter.h ./mythvideo/mythvideo/videofilter.h
old new 34 34 kFilterBrowseChanged = (1 << 7), 35 35 kFilterInetRefChanged = (1 << 8), 36 36 kFilterCoverFileChanged = (1 << 9), 37 kFilterParentalLevelChanged = (1 << 8) 37 kFilterParentalLevelChanged = (1 << 0xa), 38 kFilterCastChanged = (1 << 0xb) 38 39 }; 39 40 40 41 public: … … 75 76 genre = lgenre; 76 77 } 77 78 79 int getCast() const { return cast; } 80 void setCast(int lcast) 81 { 82 m_changed_state |= kFilterCastChanged; 83 cast = lcast; 84 } 85 78 86 int getCountry() const { return country; } 79 87 void setCountry(int lcountry) 80 88 { … … 149 157 int category; 150 158 int genre; 151 159 int country; 160 int cast; 152 161 int year; 153 162 int runtime; 154 163 int userrating; … … 221 230 void setCategory(int new_category); 222 231 void setCountry(int new_country); 223 232 void setGenre(int new_genre); 233 void setCast(int new_cast); 224 234 void setRunTime(int new_runtime); 225 235 void setBrowse(int new_browse); 226 236 void setInetRef(int new_inetref); … … 240 250 UISelectorType *category_select; 241 251 UISelectorType *country_select; 242 252 UISelectorType *genre_select; 253 UISelectorType *cast_select; 243 254 UISelectorType *runtime_select; 244 255 UITextButtonType *save_button; 245 256 UITextButtonType *done_button; -
mythvideo/mythvideo/videogallery.cpp
diff -Nur --exclude='*.o' --exclude='moc_*' --exclude='Makefil*' ../mythplugins-orig/mythvideo/mythvideo/videogallery.cpp ./mythvideo/mythvideo/videogallery.cpp
old new 498 498 focusButton = popup->addButton(tr("Watch This Video"), this, 499 499 SLOT(slotWatchVideo())); 500 500 popup->addButton(tr("View Full Plot"), this, SLOT(slotViewPlot())); 501 popup->addButton(tr("View Cast"), this, SLOT(slotViewCast())); 501 502 popup->addButton(tr("View Details"), this, 502 503 SLOT(handleVideoSelect())); 503 504 -
mythvideo/mythvideo/videomanager.cpp
diff -Nur --exclude='*.o' --exclude='moc_*' --exclude='Makefil*' ../mythplugins-orig/mythvideo/mythvideo/videomanager.cpp ./mythvideo/mythvideo/videomanager.cpp
old new 675 675 676 676 curitem->setCountries(movie_countries); 677 677 678 //movie Cast 679 Metadata::cast_list movie_cast; 680 QStringList cast = QStringList::split(",", data["Cast"]); 681 682 for (QStringList::iterator p = cast.begin(); p != cast.end(); ++p) 683 { 684 QString cast_name = (*p).stripWhiteSpace(); 685 if (cast_name.length()) 686 { 687 movie_cast.push_back( 688 Metadata::cast_list::value_type(-1, cast_name)); 689 } 690 } 691 692 curitem->setCast(movie_cast); 693 678 694 curitem->setInetRef(movieNumber); 679 695 QString movieCoverFile = GetMoviePoster(movieNumber); 680 696 curitem->setCoverFile(movieCoverFile); … … 1335 1351 curitem->setShowLevel(ParentalLevel::plLowest); 1336 1352 curitem->setGenres(Metadata::genre_list()); 1337 1353 curitem->setCountries(Metadata::country_list()); 1354 curitem->setCast(Metadata::cast_list()); 1338 1355 curitem->updateDatabase(); 1339 1356 1340 1357 RefreshMovieList(false); -
mythvideo/mythvideo/videoselected.cpp
diff -Nur --exclude='*.o' --exclude='moc_*' --exclude='Makefil*' ../mythplugins-orig/mythvideo/mythvideo/videoselected.cpp ./mythvideo/mythvideo/videoselected.cpp
old new 263 263 m_item->Director()); 264 264 checkedSetText((UITextType *)container->GetType("plot"), 265 265 m_item->Plot()); 266 checkedSetText((UITextType *)container->GetType("cast"), 267 m_item->CastLine()); 266 268 checkedSetText((UITextType *)container->GetType("rating"), 267 269 getDisplayRating(m_item->Rating())); 268 270 checkedSetText((UITextType *)container->GetType("inetref"), -
mythvideo/mythvideo/videotree.cpp
diff -Nur --exclude='*.o' --exclude='moc_*' --exclude='Makefil*' ../mythplugins-orig/mythvideo/mythvideo/videotree.cpp ./mythvideo/mythvideo/videotree.cpp
old new 21 21 UITextType *video_title; 22 22 UITextType *video_file; 23 23 UITextType *video_plot; 24 UITextType *video_cast; 24 25 UITextType *video_player; 25 26 UITextType *pl_value; 26 27 UIImageType *video_poster; … … 43 44 public: 44 45 VideoTreeImp() : 45 46 video_tree_list(NULL), video_title(NULL), 46 video_file(NULL), video_plot(NULL), video_ player(NULL),47 video_file(NULL), video_plot(NULL), video_cast(NULL), video_player(NULL), 47 48 pl_value(NULL), video_poster(NULL), m_director(NULL), m_rating(NULL), 48 49 m_inetref(NULL), m_year(NULL), m_userrating(NULL), m_length(NULL), 49 50 m_coverfile(NULL), m_child_id(NULL), m_browseable(NULL), … … 88 89 // Optional 89 90 assign(vt, m_director, "director", false); 90 91 assign(vt, video_plot, "plot", false); 92 assign(vt, video_cast, "cast", false); 91 93 assign(vt, m_rating, "rating", false); 92 94 assign(vt, m_inetref, "inetref", false); 93 95 assign(vt, m_year, "year", false); … … 112 114 113 115 checkedSetText(m_director, ""); 114 116 checkedSetText(video_plot, ""); 117 checkedSetText(video_cast, ""); 115 118 checkedSetText(m_rating, ""); 116 119 checkedSetText(m_inetref, ""); 117 120 checkedSetText(m_year, ""); … … 129 132 checkedSetText(video_title, item->Title()); 130 133 checkedSetText(video_file, item->Filename().section("/", -1)); 131 134 checkedSetText(video_plot, item->Plot()); 135 checkedSetText(video_cast, item->CastLine()); 132 136 checkedSetText(video_player, Metadata::getPlayer(item)); 133 137 134 138 if (!isDefaultCoverFile(item->CoverFile())) … … 454 458 focusButton = popup->addButton(tr("Watch This Video"), this, 455 459 SLOT(slotWatchVideo())); 456 460 popup->addButton(tr("View Full Plot"), this, SLOT(slotViewPlot())); 461 popup->addButton(tr("View Cast"), this, SLOT(slotViewCast())); 457 462 } 458 463 else 459 464 { … … 535 540 } 536 541 } 537 542 543 void VideoTree::slotViewCast() 544 { 545 cancelPopup(); 546 547 if (curitem) 548 { 549 QString actors = ""; 550 const Metadata::cast_list &cast = curitem->Cast(); 551 552 if (cast.size() > 0) 553 { 554 Metadata::cast_list::const_iterator it = cast.begin(); 555 556 int num = cast.size(); 557 558 if (num > 10) 559 num = 10; 560 561 for (int i = 0; i < (num - 1); i++) 562 { 563 actors+=it->second + "\n"; 564 ++it; 565 } 566 actors+=it->second; 567 } 568 else 569 { 570 actors = "None defined"; 571 } 572 573 // allowPaint = false; 574 MythPopupBox * castbox = new MythPopupBox(gContext->GetMainWindow()); 575 576 QLabel *castLabel = castbox->addLabel(actors, 577 MythPopupBox::Small,true); 578 castLabel->setAlignment(Qt::AlignJustify | Qt::WordBreak); 579 580 QButton * okButton = castbox->addButton(tr("Ok")); 581 okButton->setFocus(); 582 583 castbox->ExecPopup(); 584 delete castbox; 585 // allowPaint = true; 586 587 } 588 else 589 { 590 VERBOSE(VB_IMPORTANT, QString("no Item to view")); 591 slotDoCancel(); 592 } 593 } 594 538 595 void VideoTree::slotWatchVideo() 539 596 { 540 597 cancelPopup(); -
mythvideo/mythvideo/videotree.h
diff -Nur --exclude='*.o' --exclude='moc_*' --exclude='Makefil*' ../mythplugins-orig/mythvideo/mythvideo/videotree.h ./mythvideo/mythvideo/videotree.h
old new 30 30 void slotVideoGallery(); 31 31 void slotVideoBrowser(); 32 32 void slotViewPlot(); 33 void slotViewCast(); 33 34 void slotDoFilter(); 34 35 void slotWatchVideo(); 35 36 -
mythvideo/mythvideo/video-ui.xml
diff -Nur --exclude='*.o' --exclude='moc_*' --exclude='Makefil*' ../mythplugins-orig/mythvideo/mythvideo/video-ui.xml ./mythvideo/mythvideo/video-ui.xml
old new 1288 1288 <font>display</font> 1289 1289 <value>Country :</value> 1290 1290 </textarea> 1291 <textarea name=" year_text" draworder="0" align="right">1291 <textarea name="cast_text" draworder="0" align="right"> 1292 1292 <area>50,174,320,34</area> 1293 1293 <font>display</font> 1294 <value>Actor/Actress :</value> 1295 </textarea> 1296 <textarea name="year_text" draworder="0" align="right"> 1297 <area>50,208,320,34</area> 1298 <font>display</font> 1294 1299 <value>Year :</value> 1295 1300 </textarea> 1296 1301 <textarea name="runtime_text" draworder="0" align="right"> 1297 <area>50,2 08,320,34</area>1302 <area>50,242,320,34</area> 1298 1303 <font>display</font> 1299 1304 <value>Runtime :</value> 1300 1305 </textarea> 1301 1306 <textarea name="userrating_text" draworder="0" align="right"> 1302 <area>50,2 42,320,34</area>1307 <area>50,276,320,34</area> 1303 1308 <font>display</font> 1304 1309 <value>User Rating :</value> 1305 1310 </textarea> 1306 1311 <textarea name="browse_text" draworder="0" align="right"> 1307 <area>50,276,320,34</area>1308 <font>display</font>1309 <value>Browse :</value>1310 </textarea>1311 <textarea name="inetref_text" draworder="0" align="right">1312 1312 <area>50,310,320,34</area> 1313 1313 <font>display</font> 1314 <value> InetRef:</value>1314 <value>Browse :</value> 1315 1315 </textarea> 1316 1316 <textarea name="coverfile_text" draworder="0" align="right"> 1317 1317 <area>50,344,320,34</area> … … 1323 1323 <font>display</font> 1324 1324 <value>Sort by :</value> 1325 1325 </textarea> 1326 1327 1326 <!-- Widgets --> 1328 1327 <selector name="category_select" draworder="0"> 1329 1328 <area>380,70,300,34</area> … … 1347 1346 <image function="off" filename="leftright_off.png"></image> 1348 1347 <image function="pushed" filename="leftright_pushed.png"></image> 1349 1348 </selector> 1350 <selector name=" year_select" draworder="0">1349 <selector name="cast_select" draworder="0"> 1351 1350 <area>380,172,300,34</area> 1352 1351 <font>display</font> 1353 1352 <image function="on" filename="leftright_on.png"></image> 1354 1353 <image function="off" filename="leftright_off.png"></image> 1355 1354 <image function="pushed" filename="leftright_pushed.png"></image> 1356 1355 </selector> 1357 <selector name=" runtime_select" draworder="0">1356 <selector name="year_select" draworder="0"> 1358 1357 <area>380,206,300,34</area> 1359 1358 <font>display</font> 1360 1359 <image function="on" filename="leftright_on.png"></image> 1361 1360 <image function="off" filename="leftright_off.png"></image> 1362 1361 <image function="pushed" filename="leftright_pushed.png"></image> 1363 1362 </selector> 1364 <selector name=" userrating_select" draworder="0">1363 <selector name="runtime_select" draworder="0"> 1365 1364 <area>380,240,300,34</area> 1366 1365 <font>display</font> 1367 1366 <image function="on" filename="leftright_on.png"></image> 1368 1367 <image function="off" filename="leftright_off.png"></image> 1369 1368 <image function="pushed" filename="leftright_pushed.png"></image> 1370 1369 </selector> 1371 <selector name=" browse_select" draworder="0">1370 <selector name="userrating_select" draworder="0"> 1372 1371 <area>380,274,300,34</area> 1373 1372 <font>display</font> 1374 1373 <image function="on" filename="leftright_on.png"></image> 1375 1374 <image function="off" filename="leftright_off.png"></image> 1376 1375 <image function="pushed" filename="leftright_pushed.png"></image> 1377 </selector>1378 <selector name=" inetref_select" draworder="0">1376 </selector> 1377 <selector name="browse_select" draworder="0"> 1379 1378 <area>380,308,300,34</area> 1380 1379 <font>display</font> 1381 1380 <image function="on" filename="leftright_on.png"></image> 1382 1381 <image function="off" filename="leftright_off.png"></image> 1383 1382 <image function="pushed" filename="leftright_pushed.png"></image> 1384 </selector>1383 </selector> 1385 1384 <selector name="coverfile_select" draworder="0"> 1386 1385 <area>380,342,300,34</area> 1387 1386 <font>display</font>
