Ticket #3585: mythvideo-cast.3.diff
File mythvideo-cast.3.diff, 44.1 KB (added by , 16 years ago) |
---|
-
mythvideo/mythvideo/dbaccess.cpp
diff -Naur --exclude='*.orig' --exclude='*.qm' mythplugins-orig/mythvideo/mythvideo/dbaccess.cpp mythplugins/mythvideo/mythvideo/dbaccess.cpp
old new 549 549 550 550 //////////////////////////////////////////// 551 551 552 VideoCast::VideoCast() : 553 SingleValue(new SingleValueImp("videocast", "intid", "cast")) 554 { 555 } 556 557 VideoCast::~VideoCast() 558 { 559 } 560 561 VideoCast &VideoCast::getCast() 562 { 563 static VideoCast vc; 564 vc.load_data(); 565 return vc; 566 } 567 568 //////////////////////////////////////////// 569 552 570 VideoGenreMap::VideoGenreMap() : 553 571 MultiValue(new MultiValueImp("videometadatagenre", "idvideo", "idgenre")) 554 572 { … … 586 604 587 605 //////////////////////////////////////////// 588 606 607 VideoCastMap::VideoCastMap() : 608 MultiValue(new MultiValueImp("videometadatacast", "idvideo", 609 "idcast")) 610 { 611 } 612 613 VideoCastMap::~VideoCastMap() 614 { 615 } 616 617 VideoCastMap &VideoCastMap::getCastMap() 618 { 619 static VideoCastMap vcm; 620 vcm.load_data(); 621 return vcm; 622 } 623 624 //////////////////////////////////////////// 625 589 626 class FileAssociationsImp 590 627 { 591 628 public: -
mythvideo/mythvideo/dbaccess.h
diff -Naur --exclude='*.orig' --exclude='*.qm' mythplugins-orig/mythvideo/mythvideo/dbaccess.h mythplugins/mythvideo/mythvideo/dbaccess.h
old new 107 107 ~VideoCountryMap(); 108 108 }; 109 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 }; 129 110 130 class FileAssociations 111 131 { 112 132 public: -
mythvideo/mythvideo/dbcheck.cpp
diff -Naur --exclude='*.orig' --exclude='*.qm' mythplugins-orig/mythvideo/mythvideo/dbcheck.cpp mythplugins/mythvideo/mythvideo/dbcheck.cpp
old new 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"; … … 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 -Naur --exclude='*.orig' --exclude='*.qm' mythplugins-orig/mythvideo/mythvideo/globals.cpp mythplugins/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 -Naur --exclude='*.orig' --exclude='*.qm' mythplugins-orig/mythvideo/mythvideo/globals.h mythplugins/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 -Naur --exclude='*.orig' --exclude='*.qm' mythplugins-orig/mythvideo/mythvideo/metadata.cpp mythplugins/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 … … 204 207 { 205 208 m_countries = countries; 206 209 } 210 211 const cast_list &getCast() const { return m_cast; } 212 void setCast(const cast_list &cast) { m_cast = cast; } 207 213 208 214 const QString &getFilename() const { return m_filename; } 209 215 void setFilename(const QString &filename) { m_filename = filename; } … … 270 276 void fillCountries(); 271 277 void updateCountries(); 272 278 void fillGenres(); 279 void fillCast(); 273 280 void updateGenres(); 281 void updateCast(); 274 282 bool removeDir(const QString &dirName); 275 283 void fromDBRow(MSqlQuery &query); 276 284 void saveToDatabase(); … … 285 293 QString m_category; 286 294 genre_list m_genres; 287 295 country_list m_countries; 296 cast_list m_cast; 288 297 QString m_filename; 289 298 QString m_coverfile; 290 299 … … 369 378 { 370 379 VideoGenreMap::getGenreMap().remove(m_id); 371 380 VideoCountryMap::getCountryMap().remove(m_id); 381 VideoCastMap::getCastMap().remove(m_id); 372 382 373 383 MSqlQuery query(MSqlQuery::InitCon()); 374 384 query.prepare("DELETE FROM videometadata WHERE intid = :ID"); … … 395 405 VIDEO_INETREF_DEFAULT, VIDEO_DIRECTOR_DEFAULT, 396 406 VIDEO_PLOT_DEFAULT, 0.0, VIDEO_RATING_DEFAULT, 0, m_id, 397 407 ParentalLevel::plLowest, 0, -1, true, "", "", 398 Metadata::genre_list(), Metadata::country_list() );408 Metadata::genre_list(), Metadata::country_list(), Metadata::cast_list()); 399 409 tmp.m_prefix = m_prefix; 400 410 tmp.m_flat_index = m_flat_index; 401 411 … … 440 450 } 441 451 } 442 452 453 void MetadataImp::fillCast() 454 { 455 m_cast.clear(); 456 VideoCastMap &vcm = VideoCastMap::getCastMap(); 457 VideoCastMap::entry cast; 458 if (vcm.get(m_id, cast)) 459 { 460 VideoCast &vc = VideoCast::getCast(); 461 for (VideoCastMap::entry::values_type::iterator p = 462 cast.values.begin(); p != cast.values.end(); ++p) 463 { 464 // Just add empty string for no-name cast 465 QString name; 466 vc.get(*p, name); 467 m_cast.push_back(cast_list::value_type(*p, name)); 468 } 469 } 470 } 471 443 472 /// Sets metadata from a DB row 444 473 void MetadataImp::fromDBRow(MSqlQuery &query) 445 474 { … … 471 500 472 501 //Countries 473 502 fillCountries(); 503 504 // Cast 505 fillCast(); 474 506 } 475 507 476 508 void MetadataImp::saveToDatabase() … … 570 602 571 603 updateGenres(); 572 604 updateCountries(); 605 updateCast(); 573 606 } 574 607 575 608 void MetadataImp::dumpToDatabase() … … 649 682 } 650 683 } 651 684 685 void MetadataImp::updateCast() 686 { 687 VideoCastMap::getCastMap().remove(m_id); 688 689 // ensure that all cast we have are in the DB 690 cast_list::iterator cast = m_cast.begin(); 691 while (cast != m_cast.end()) 692 { 693 if (cast->second.stripWhiteSpace().length()) 694 { 695 cast->first = VideoCast::getCast().add(cast->second); 696 VideoCastMap::getCastMap().add(m_id, cast->first); 697 ++cast; 698 } 699 else 700 { 701 cast = m_cast.erase(cast); 702 } 703 } 704 } 705 652 706 //////////////////////////////////////// 653 707 //// Metadata 654 708 //////////////////////////////////////// … … 854 908 int childID, bool browse, 855 909 const QString &playcommand, const QString &category, 856 910 const genre_list &genres, 857 const country_list &countries) 911 const country_list &countries, 912 const cast_list &cast) 858 913 { 859 914 m_imp = new MetadataImp(filename, coverfile, title, year, inetref, director, 860 915 plot, userrating, rating, length, id, showlevel, 861 916 categoryID, childID, browse, playcommand, category, 862 genres, countries );917 genres, countries, cast); 863 918 } 864 919 865 920 Metadata::~Metadata() … … 1098 1153 m_imp->setGenres(genres); 1099 1154 } 1100 1155 1156 const Metadata::cast_list &Metadata::Cast() const 1157 { 1158 return m_imp->getCast(); 1159 } 1160 1161 QString Metadata::CastLine() const 1162 { 1163 cast_list cast = m_imp->getCast(); 1164 QString actors = ""; 1165 1166 if (cast.size() > 0) 1167 { 1168 cast_list::const_iterator it = cast.begin(); 1169 1170 int num = cast.size(); 1171 1172 for (int i = 0; i < (num - 1); i++) 1173 { 1174 actors+=it->second + ","; 1175 ++it; 1176 } 1177 actors+=it->second; 1178 } 1179 1180 return actors; 1181 } 1182 1183 void Metadata::setCast(const cast_list &cast) 1184 { 1185 m_imp->setCast(cast); 1186 } 1187 1101 1188 const Metadata::country_list &Metadata::Countries() const 1102 1189 { 1103 1190 return m_imp->getCountries(); -
mythvideo/mythvideo/metadata.h
diff -Naur --exclude='*.orig' --exclude='*.qm' mythplugins-orig/mythvideo/mythvideo/metadata.h mythplugins/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 -Naur --exclude='*.orig' --exclude='*.qm' mythplugins-orig/mythvideo/mythvideo/scripts/get_cast.py mythplugins/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 -Naur --exclude='*.orig' --exclude='*.qm' mythplugins-orig/mythvideo/mythvideo/scripts/imdb.pl mythplugins/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: 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 -Naur --exclude='*.orig' --exclude='*.qm' mythplugins-orig/mythvideo/mythvideo/scripts/imdbpy.py mythplugins/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 258 257 259 imdb_access = imdb.IMDb() 258 260 movie = imdb_access.get_movie(imdb_id) 261 259 262 imdb_access.update(movie) 260 263 261 264 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 -Naur --exclude='*.orig' --exclude='*.qm' mythplugins-orig/mythvideo/mythvideo/scripts/MythTV.py mythplugins/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 -Naur --exclude='*.orig' --exclude='*.qm' mythplugins-orig/mythvideo/mythvideo/videobrowser.cpp mythplugins/mythvideo/mythvideo/videobrowser.cpp
old new 131 131 focusButton = popup->addButton(tr("Watch This Video"), this, 132 132 SLOT(slotWatchVideo())); 133 133 popup->addButton(tr("View Full Plot"), this, SLOT(slotViewPlot())); 134 popup->addButton(tr("View Cast"), this, SLOT(slotViewCast())); 134 135 } 135 136 else 136 137 { … … 311 312 curitem->Director()); 312 313 checkedSetText((UITextType *)container->GetType("plot"), 313 314 curitem->Plot()); 315 checkedSetText((UITextType *)container->GetType("cast"), 316 curitem->CastLine()); 314 317 checkedSetText((UITextType *)container->GetType("rating"), 315 318 getDisplayRating(curitem->Rating())); 316 319 checkedSetText((UITextType *)container->GetType("inetref"), -
mythvideo/mythvideo/videodlg.cpp
diff -Naur --exclude='*.orig' --exclude='*.qm' mythplugins-orig/mythvideo/mythvideo/videodlg.cpp mythplugins/mythvideo/mythvideo/videodlg.cpp
old new 171 171 } 172 172 } 173 173 174 void VideoDialog::slotViewCast() 175 { 176 cancelPopup(); 177 178 if (curitem) 179 { 180 QString actors = ""; 181 const Metadata::cast_list &cast = curitem->Cast(); 182 183 if (cast.size() > 0) 184 { 185 Metadata::cast_list::const_iterator it = cast.begin(); 186 187 int num = cast.size(); 188 189 if (num > 10) 190 num = 10; 191 192 for (int i = 0; i < (num - 1); i++) 193 { 194 actors+=it->second + "\n"; 195 ++it; 196 } 197 actors+=it->second; 198 } 199 else 200 { 201 actors = "None defined"; 202 } 203 204 allowPaint = false; 205 MythPopupBox * castbox = new MythPopupBox(gContext->GetMainWindow()); 206 207 QLabel *castLabel = castbox->addLabel(actors, 208 MythPopupBox::Small,true); 209 castLabel->setAlignment(Qt::AlignJustify | Qt::WordBreak); 210 211 QButton * okButton = castbox->addButton(tr("Ok")); 212 okButton->setFocus(); 213 214 castbox->ExecPopup(); 215 castbox->deleteLater(); 216 allowPaint = true; 217 218 } 219 else 220 { 221 VERBOSE(VB_IMPORTANT, QString("no Item to view")); 222 slotDoCancel(); 223 } 224 } 174 225 175 226 void VideoDialog::slotWatchVideo() 176 227 { -
mythvideo/mythvideo/videodlg.h
diff -Naur --exclude='*.orig' --exclude='*.qm' mythplugins-orig/mythvideo/mythvideo/videodlg.h mythplugins/mythvideo/mythvideo/videodlg.h
old new 40 40 void slotVideoGallery(); 41 41 void slotVideoBrowser(); 42 42 void slotViewPlot(); 43 void slotViewCast(); 43 44 void slotDoFilter(); 44 45 void exitWin(); 45 46 virtual void slotParentalLevelChanged(); -
mythvideo/mythvideo/videofilter.cpp
diff -Naur --exclude='*.orig' --exclude='*.qm' mythplugins-orig/mythvideo/mythvideo/videofilter.cpp mythplugins/mythvideo/mythvideo/videofilter.cpp
old new 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 … … 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"; … … 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), … … 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; … … 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); … … 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(); … … 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 … … 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")); … … 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); … … 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); … … 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 -Naur --exclude='*.orig' --exclude='*.qm' mythplugins-orig/mythvideo/mythvideo/videofilter.h mythplugins/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 -Naur --exclude='*.orig' --exclude='*.qm' mythplugins-orig/mythvideo/mythvideo/videogallery.cpp mythplugins/mythvideo/mythvideo/videogallery.cpp
old new 500 500 focusButton = popup->addButton(tr("Watch This Video"), this, 501 501 SLOT(slotWatchVideo())); 502 502 popup->addButton(tr("View Full Plot"), this, SLOT(slotViewPlot())); 503 popup->addButton(tr("View Cast"), this, SLOT(slotViewCast())); 503 504 popup->addButton(tr("View Details"), this, 504 505 SLOT(handleVideoSelect())); 505 506 -
mythvideo/mythvideo/videomanager.cpp
diff -Naur --exclude='*.orig' --exclude='*.qm' mythplugins-orig/mythvideo/mythvideo/videomanager.cpp mythplugins/mythvideo/mythvideo/videomanager.cpp
old new 1205 1205 checkedSetText(m_container, "video_player", 1206 1206 Metadata::getPlayer(item)); 1207 1207 checkedSetText(m_container, "director", item->Director()); 1208 checkedSetText(m_container, "cast", item->CastLine()); 1208 1209 checkedSetText(m_container, "plot", item->Plot()); 1209 1210 checkedSetText(m_container, "rating", item->Rating()); 1210 1211 checkedSetText(m_container, "inetref", item->InetRef()); … … 2591 2592 2592 2593 AutomaticParentalAdjustment(item); 2593 2594 2595 // Cast 2596 Metadata::cast_list movie_cast; 2597 QStringList cast = QStringList::split(",", data["Cast"]); 2598 2599 for (QStringList::iterator p = cast.begin(); p != cast.end(); ++p) 2600 { 2601 QString cast_name = (*p).stripWhiteSpace(); 2602 if (cast_name.length()) 2603 { 2604 movie_cast.push_back(Metadata::cast_list::value_type(-1, cast_name)); 2605 } 2606 } 2607 2608 item->setCast(movie_cast); 2609 2594 2610 // Genres 2595 2611 Metadata::genre_list video_genres; 2596 2612 QStringList genres = QStringList::split(",", data["Genres"]); -
mythvideo/mythvideo/videoselected.cpp
diff -Naur --exclude='*.orig' --exclude='*.qm' mythplugins-orig/mythvideo/mythvideo/videoselected.cpp mythplugins/mythvideo/mythvideo/videoselected.cpp
old new 261 261 m_item->Director()); 262 262 checkedSetText((UITextType *)container->GetType("plot"), 263 263 m_item->Plot()); 264 checkedSetText((UITextType *)container->GetType("cast"), 265 m_item->CastLine()); 264 266 checkedSetText((UITextType *)container->GetType("rating"), 265 267 getDisplayRating(m_item->Rating())); 266 268 checkedSetText((UITextType *)container->GetType("inetref"), -
mythvideo/mythvideo/videotree.cpp
diff -Naur --exclude='*.orig' --exclude='*.qm' mythplugins-orig/mythvideo/mythvideo/videotree.cpp mythplugins/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 castbox->deleteLater(); 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 -Naur --exclude='*.orig' --exclude='*.qm' mythplugins-orig/mythvideo/mythvideo/videotree.h mythplugins/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/theme/default/video-ui.xml
diff -Naur --exclude='*.orig' --exclude='*.qm' mythplugins-orig/mythvideo/theme/default/video-ui.xml mythplugins/mythvideo/theme/default/video-ui.xml
old new 1350 1350 <value>Country :</value> 1351 1351 </textarea> 1352 1352 1353 <textarea name="year_text" draworder="0" align="right">1353 <textarea name="cast_text" draworder="0" align="right"> 1354 1354 <area>50,174,320,34</area> 1355 1355 <font>display</font> 1356 <value>Actor/Actress :</value> 1357 </textarea> 1358 1359 <textarea name="year_text" draworder="0" align="right"> 1360 <area>50,208,320,34</area> 1361 <font>display</font> 1356 1362 <value>Year :</value> 1357 1363 </textarea> 1358 1364 1359 1365 <textarea name="runtime_text" draworder="0" align="right"> 1360 <area>50,2 08,320,34</area>1366 <area>50,242,320,34</area> 1361 1367 <font>display</font> 1362 1368 <value>Runtime :</value> 1363 1369 </textarea> 1364 1370 1365 1371 <textarea name="userrating_text" draworder="0" align="right"> 1366 <area>50,2 42,320,34</area>1372 <area>50,276,320,34</area> 1367 1373 <font>display</font> 1368 1374 <value>User Rating :</value> 1369 1375 </textarea> 1370 1376 1371 1377 <textarea name="browse_text" draworder="0" align="right"> 1372 <area>50,276,320,34</area>1373 <font>display</font>1374 <value>Browse :</value>1375 </textarea>1376 1377 <textarea name="inetref_text" draworder="0" align="right">1378 1378 <area>50,310,320,34</area> 1379 1379 <font>display</font> 1380 <value> InetRef:</value>1380 <value>Browse :</value> 1381 1381 </textarea> 1382 1382 1383 1383 <textarea name="coverfile_text" draworder="0" align="right"> … … 1418 1418 <image function="pushed" filename="leftright_pushed.png"></image> 1419 1419 </selector> 1420 1420 1421 <selector name=" year_select" draworder="0">1421 <selector name="cast_select" draworder="0"> 1422 1422 <area>380,172,300,34</area> 1423 1423 <font>display</font> 1424 1424 <image function="on" filename="leftright_on.png"></image> … … 1426 1426 <image function="pushed" filename="leftright_pushed.png"></image> 1427 1427 </selector> 1428 1428 1429 <selector name=" runtime_select" draworder="0">1429 <selector name="year_select" draworder="0"> 1430 1430 <area>380,206,300,34</area> 1431 1431 <font>display</font> 1432 1432 <image function="on" filename="leftright_on.png"></image> … … 1434 1434 <image function="pushed" filename="leftright_pushed.png"></image> 1435 1435 </selector> 1436 1436 1437 <selector name=" userrating_select" draworder="0">1437 <selector name="runtime_select" draworder="0"> 1438 1438 <area>380,240,300,34</area> 1439 1439 <font>display</font> 1440 1440 <image function="on" filename="leftright_on.png"></image> … … 1442 1442 <image function="pushed" filename="leftright_pushed.png"></image> 1443 1443 </selector> 1444 1444 1445 <selector name=" browse_select" draworder="0">1445 <selector name="userrating_select" draworder="0"> 1446 1446 <area>380,274,300,34</area> 1447 1447 <font>display</font> 1448 1448 <image function="on" filename="leftright_on.png"></image> … … 1450 1450 <image function="pushed" filename="leftright_pushed.png"></image> 1451 1451 </selector> 1452 1452 1453 <selector name=" inetref_select" draworder="0">1453 <selector name="browse_select" draworder="0"> 1454 1454 <area>380,308,300,34</area> 1455 1455 <font>display</font> 1456 1456 <image function="on" filename="leftright_on.png"></image> -
mythvideo/theme/default-wide/video-ui.xml
diff -Naur --exclude='*.orig' --exclude='*.qm' mythplugins-orig/mythvideo/theme/default-wide/video-ui.xml mythplugins/mythvideo/theme/default-wide/video-ui.xml
old new 1350 1350 <value>Country :</value> 1351 1351 </textarea> 1352 1352 1353 <textarea name=" year_text" draworder="0" align="right">1353 <textarea name="cast_text" draworder="0" align="right"> 1354 1354 <area>0,220,572,40</area> 1355 1355 <font>display</font> 1356 <value> Year:</value>1356 <value>Actor/Actress :</value> 1357 1357 </textarea> 1358 1358 1359 <textarea name=" runtime_text" draworder="0" align="right">1359 <textarea name="year_text" draworder="0" align="right"> 1360 1360 <area>0,260,572,40</area> 1361 1361 <font>display</font> 1362 <value> Runtime:</value>1362 <value>Year :</value> 1363 1363 </textarea> 1364 1364 1365 <textarea name=" userrating_text" draworder="0" align="right">1365 <textarea name="runtime_text" draworder="0" align="right"> 1366 1366 <area>0,300,572,40</area> 1367 1367 <font>display</font> 1368 <value> User Rating:</value>1368 <value>Runtime :</value> 1369 1369 </textarea> 1370 1370 1371 <textarea name=" browse_text" draworder="0" align="right">1371 <textarea name="userrating_text" draworder="0" align="right"> 1372 1372 <area>0,340,572,40</area> 1373 1373 <font>display</font> 1374 <value> Browse:</value>1374 <value>User Rating :</value> 1375 1375 </textarea> 1376 1376 1377 <textarea name=" inetref_text" draworder="0" align="right">1377 <textarea name="browse_text" draworder="0" align="right"> 1378 1378 <area>0,380,572,40</area> 1379 1379 <font>display</font> 1380 <value> InetRef:</value>1380 <value>Browse :</value> 1381 1381 </textarea> 1382 1382 1383 1383 <textarea name="coverfile_text" draworder="0" align="right">