Ticket #3585: mythvideo-cast-new.2.diff

File mythvideo-cast-new.2.diff, 42.1 KB (added by maverik044 <level42@…>, 18 years ago)

Updated for SVN 14755

  • mythvideo/mythvideo/dbaccess.cpp

    diff -Nur --exclude='*.o' --exclude='moc_*' --exclude='Makefil*' ../mythplugins-orig/mythvideo/mythvideo/dbaccess.cpp ./mythvideo/mythvideo/dbaccess.cpp
    old new  
    548548
    549549////////////////////////////////////////////
    550550
     551VideoCast::VideoCast() :
     552    SingleValue(new SingleValueImp("videocast", "intid", "cast"))
     553{
     554}
     555
     556VideoCast::~VideoCast()
     557{
     558}
     559
     560VideoCast &VideoCast::getCast()
     561{
     562    static VideoCast vc;
     563    vc.load_data();
     564    return vc;
     565}
     566
     567////////////////////////////////////////////
     568
    551569VideoGenreMap::VideoGenreMap() :
    552570    MultiValue(new MultiValueImp("videometadatagenre", "idvideo", "idgenre"))
    553571{
     
    585603
    586604////////////////////////////////////////////
    587605
     606VideoCastMap::VideoCastMap() :
     607    MultiValue(new MultiValueImp("videometadatacast", "idvideo",
     608                                 "idcast"))
     609{
     610}
     611
     612VideoCastMap::~VideoCastMap()
     613{
     614}
     615
     616VideoCastMap &VideoCastMap::getCastMap()
     617{
     618    static VideoCastMap vcm;
     619    vcm.load_data();
     620    return vcm;
     621}
     622
     623////////////////////////////////////////////
     624
    588625class FileAssociationsImp
    589626{
    590627  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  
    106106    VideoCountryMap();
    107107    ~VideoCountryMap();
    108108};
     109
     110class VideoCast : public SingleValue
     111{
     112  public:
     113    static VideoCast &getCast();
     114
     115  private:
     116    VideoCast();
     117    ~VideoCast();
     118};
     119
     120class VideoCastMap : public MultiValue
     121{
     122  public:
     123    static VideoCastMap &getCastMap();
     124
     125  private:
     126    VideoCastMap();
     127    ~VideoCastMap();
     128};
    109129
    110130class FileAssociations
    111131{
  • .

    diff -Nur --exclude='*.o' --exclude='moc_*' --exclude='Makefil*' ../mythplugins-orig/mythvideo/mythvideo/dbcheck.cpp ./mythvideo/mythvideo/dbcheck.cpp
    old new namespace  
    1313    const QString lastMythDVDDBVersion = "1002";
    1414    const QString lastMythVideoVersion = "1010";
    1515
    16     const QString currentDatabaseVersion = "1014";
     16    const QString currentDatabaseVersion = "1015";
    1717
    1818    const QString OldMythVideoVersionName = "VideoDBSchemaVer";
    1919    const QString OldMythDVDVersionName = "DVDDBSchemaVer";
    namespace  
    622622            updates += "ALTER TABLE filemarkup ADD INDEX (filename(255));";
    623623            performActualUpdate(updates, "1014", dbver, MythVideoVersionName);
    624624        }
     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         }
    625637    }
    626638}
    627639
  • mythvideo/mythvideo/globals.cpp

    diff -Nur --exclude='*.o' --exclude='moc_*' --exclude='Makefil*' ../mythplugins-orig/mythvideo/mythvideo/globals.cpp ./mythvideo/mythvideo/globals.cpp
    old new  
    99const QString VIDEO_COUNTRY_UNKNOWN = QObject::tr("Unknown");
    1010const QString VIDEO_YEAR_UNKNOWN = QObject::tr("Unknown");
    1111const QString VIDEO_RUNTIME_UNKNOWN = QObject::tr("Unknown");
     12const QString VIDEO_CAST_UNKNOWN = QObject::tr("Unknown");
    1213
    1314const QString VIDEO_CATEGORY_DEFAULT = VIDEO_CATEGORY_UNKNOWN;
    1415const QString VIDEO_DIRECTOR_DEFAULT = VIDEO_DIRECTOR_UNKNOWN;
     
    1617const QString VIDEO_COVERFILE_DEFAULT = QObject::tr("No Cover");
    1718const QString VIDEO_RATING_DEFAULT = QObject::tr("NR");
    1819const QString VIDEO_PLOT_DEFAULT = QObject::tr("None");
     20const QString VIDEO_CAST_DEFAULT = VIDEO_CAST_UNKNOWN;
    1921
    2022const QString JUMP_VIDEO_MANAGER = "Video Manager";
    2123const 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  
    55extern const QString VIDEO_DIRECTOR_UNKNOWN;
    66extern const QString VIDEO_GENRE_UNKNOWN;
    77extern const QString VIDEO_COUNTRY_UNKNOWN;
     8extern const QString VIDEO_CAST_UNKNOWN;
    89extern const QString VIDEO_YEAR_UNKNOWN;
    910extern const QString VIDEO_RUNTIME_UNKNOWN;
    1011
     
    1415extern const QString VIDEO_COVERFILE_DEFAULT;
    1516extern const QString VIDEO_RATING_DEFAULT;
    1617extern const QString VIDEO_PLOT_DEFAULT;
     18extern const QString VIDEO_CAST_DEFAULT;
    1719
    1820extern const QString JUMP_VIDEO_MANAGER;
    1921extern 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  
    8686  public:
    8787    typedef Metadata::genre_list genre_list;
    8888    typedef Metadata::country_list country_list;
     89    typedef Metadata::cast_list cast_list;
    8990
    9091  public:
    9192    MetadataImp(const QString &filename, const QString &coverfile,
     
    9798             int childID, bool browse,
    9899             const QString &playcommand, const QString &category,
    99100             const genre_list &genres,
    100              const country_list &countries) :
     101             const country_list &countries,
     102             const cast_list &cast) :
    101103        m_title(title),
    102104        m_inetref(inetref), m_director(director), m_plot(plot),
    103105        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),
    105107        m_filename(filename), m_coverfile(coverfile),
    106108        m_categoryID(categoryID), m_childID(childID), m_year(year),
    107109        m_length(length), m_showlevel(showlevel), m_browse(browse), m_id(id),
     
    134136        m_category = rhs.m_category;
    135137        m_genres = rhs.m_genres;
    136138        m_countries = rhs.m_countries;
     139        m_cast = rhs.m_cast;
    137140        m_filename = rhs.m_filename;
    138141        m_coverfile = rhs.m_coverfile;
    139142
     
    202205    {
    203206        m_countries = countries;
    204207    }
     208   
     209    const cast_list &getCast() const { return m_cast; }
     210    void setCast(const cast_list &cast) { m_cast = cast; }
    205211
    206212    const QString &getFilename() const { return m_filename; }
    207213    void setFilename(const QString &filename) { m_filename = filename; }
     
    266272    void fillCountries();
    267273    void updateCountries();
    268274    void fillGenres();
     275    void fillCast();
    269276    void updateGenres();
     277    void updateCast();
    270278    bool removeDir(const QString &dirName);
    271279    void fromDBRow(MSqlQuery &query);
    272280    void saveToDatabase();
     
    281289    QString m_category;
    282290    genre_list m_genres;
    283291    country_list m_countries;
     292    cast_list m_cast;
    284293    QString m_filename;
    285294    QString m_coverfile;
    286295
     
    365374{
    366375    VideoGenreMap::getGenreMap().remove(m_id);
    367376    VideoCountryMap::getCountryMap().remove(m_id);
     377    VideoCastMap::getCastMap().remove(m_id);
    368378
    369379    MSqlQuery query(MSqlQuery::InitCon());
    370380    query.prepare("DELETE FROM videometadata WHERE intid = :ID");
     
    422432    }
    423433}
    424434
     435void 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
    425454/// Sets metadata from a DB row
    426455void MetadataImp::fromDBRow(MSqlQuery &query)
    427456{
     
    453482
    454483    //Countries
    455484    fillCountries();
     485
     486    // Cast
     487    fillCast();
    456488}
    457489
    458490void MetadataImp::saveToDatabase()
     
    552584
    553585    updateGenres();
    554586    updateCountries();
     587    updateCast();
    555588}
    556589
    557590void MetadataImp::dumpToDatabase()
     
    631664    }
    632665}
    633666
     667void 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
    634688////////////////////////////////////////
    635689//// Metadata
    636690////////////////////////////////////////
     
    836890             int childID, bool browse,
    837891             const QString &playcommand, const QString &category,
    838892             const genre_list &genres,
    839              const country_list &countries)
     893             const country_list &countries,
     894             const cast_list &cast)
    840895{
    841896    m_imp = new MetadataImp(filename, coverfile, title, year, inetref, director,
    842897                            plot, userrating, rating, length, id, showlevel,
    843898                            categoryID, childID, browse, playcommand, category,
    844                             genres, countries);
     899                            genres, countries, cast);
    845900}
    846901
    847902Metadata::~Metadata()
     
    10801135    m_imp->setGenres(genres);
    10811136}
    10821137
     1138const Metadata::cast_list &Metadata::Cast() const
     1139{
     1140    return m_imp->getCast();
     1141}
     1142
     1143QString 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
     1165void Metadata::setCast(const cast_list &cast)
     1166{
     1167    m_imp->setCast(cast);
     1168}
     1169
    10831170const Metadata::country_list &Metadata::Countries() const
    10841171{
    10851172    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  
    2020  public:
    2121    typedef std::pair<int, QString> genre_entry;
    2222    typedef std::pair<int, QString> country_entry;
     23    typedef std::pair<int, QString> cast_entry;
    2324    typedef std::vector<genre_entry> genre_list;
    2425    typedef std::vector<country_entry> country_list;
     26    typedef std::vector<cast_entry> cast_list;
    2527
    2628  public:
    2729    class SortKey
     
    6264             int childID = -1, bool browse = true,
    6365             const QString &playcommand = "", const QString &category = "",
    6466             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());
    6669    ~Metadata();
    6770    Metadata(MSqlQuery &query);
    6871    Metadata(const Metadata &rhs);
     
    133136    const genre_list &Genres() const;
    134137    void setGenres(const genre_list &genres);
    135138
     139    const cast_list &Cast() const;
     140    QString CastLine() const;
     141    void setCast(const cast_list &cast);
     142
    136143    const country_list &Countries() const;
    137144    void setCountries(const country_list &countries);
    138145
  • 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"""
     4This Python script is intended to fill the cast in the database
     5This script is intended to be used by people that have an existing
     6big video collection already in the database and want to fill
     7in the cast field. Perform movie data lookups using the
     8imdbpy.py script.
     9
     10Written by William Stewart 2007
     11Based on find_meta.py by Pekka JÀÀskelÀinen
     12
     13"""
     14
     15import sys
     16import optparse
     17import re
     18import os
     19import glob
     20import fileinput
     21import shlex
     22import socket
     23import urllib
     24import distutils.file_util
     25import imdbpy
     26
     27try:
     28        import imdb
     29except ImportError:
     30        print "You need to install the IMDbPy library "\
     31                "from (http://imdbpy.sourceforge.net/?page=download)"
     32        sys.exit(1)
     33
     34try:
     35        from MythTV import MythDB, MythVideo
     36        mythdb = MythDB()
     37        mythvideo = MythVideo()
     38except:
     39        mythdb = None
     40        mythvideo = None
     41
     42from stat import *
     43
     44verbose=False
     45
     46def print_verbose(string):
     47        global verbose
     48        if verbose:
     49                print string
     50        return
     51
     52def 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
     103if __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  
    217217                               "/table>");
    218218   if ($data) {
    219219      $cast = join(',', ($data =~ m/$name_link_pat/g));
     220      $cast = trim($cast);
    220221   }
    221222   
    222223   
     
    243244   print "MovieRating:$movierating\n";
    244245   print "Runtime:$runtime\n";
    245246   print "Writers: $writer\n";
    246    print "Cast: $cast\n";
     247   print "Cast:$cast\n";
    247248   print "Genres: $lgenres\n";
    248249   print "Countries: $lcountries\n";
    249250}
  • 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  
    198198        year = None
    199199        directors = None
    200200        plot = None
     201        cast = None
    201202        rating = None
    202203        mpaa_rating = None
    203204        genres = None
     
    236237                if self.directors is not None and len(self.directors) > 0:
    237238                        metadata += createMetadataLine("Director", unicode(self.directors[0]))
    238239                metadata += createMetadataLine("Plot", self.plot)
     240                metadata += createMetadataLine("Cast", unicode(self.cast))
    239241                metadata += createMetadataLine('UserRating', self.rating)
    240242                metadata += createMetadataLine('MovieRating', self.mpaa_rating)
    241243                metadata += createMetadataLine('Genres', self.genres)
     
    256260
    257261        imdb_access = imdb.IMDb()
    258262        movie = imdb_access.get_movie(imdb_id)
     263               
    259264        imdb_access.update(movie)
    260265
    261266        def metadataFromField(key, default=None, m=movie):
     
    329332                        if shortest_found == None or len(text) < len(shortest_found):
    330333                                shortest_found = text
    331334                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
    332344
     345                cast_str = cast_str[0:-1]
     346
     347        metadata.cast = cast_str
    333348        metadata.rating = metadataFromField('rating', metadata.rating)
    334349        metadata.mpaa_rating = metadataFromField('mpaa', metadata.mpaa_rating)
    335350        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  
    7979                                if token == "DBHostName":
    8080                                        if config.get_token() == "=":
    8181                                                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()
    8288                                elif token == "DBUserName":
    8389                                        if config.get_token() == "=":
    8490                                                db_user = config.get_token()
     
    9399                        log.debug('Using config %s' % config_file)
    94100                        found_config = True
    95101                        break
    96        
    97102                if not found_config:
    98103                        raise "Unable to find MythTV configuration file"
    99104                self.db = MySQLdb.connect(user=db_user, host=db_host, passwd=db_password, db=db_name)
     
    345350               
    346351                return newid
    347352
     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
    348403        def getMetadataId(self, videopath):
    349404                """
    350405                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  
    122122            focusButton = popup->addButton(tr("Watch This Video"), this,
    123123                                           SLOT(slotWatchVideo()));
    124124            popup->addButton(tr("View Full Plot"), this, SLOT(slotViewPlot()));
     125            popup->addButton(tr("View Cast"), this, SLOT(slotViewCast()));
    125126        }
    126127        else
    127128        {
     
    307308                          curitem->Director());
    308309           checkedSetText((UITextType *)container->GetType("plot"),
    309310                          curitem->Plot());
     311           checkedSetText((UITextType *)container->GetType("cast"),
     312                          curitem->CastLine());
    310313           checkedSetText((UITextType *)container->GetType("rating"),
    311314                          getDisplayRating(curitem->Rating()));
    312315           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  
    170170    }
    171171}
    172172
     173void 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}
    173224
    174225void VideoDialog::slotWatchVideo()
    175226{
  • mythvideo/mythvideo/videodlg.h

    diff -Nur --exclude='*.o' --exclude='moc_*' --exclude='Makefil*' ../mythplugins-orig/mythvideo/mythvideo/videodlg.h ./mythvideo/mythvideo/videodlg.h
    old new  
    4242    void slotVideoGallery();
    4343    void slotVideoBrowser();
    4444    void slotViewPlot();
     45    void slotViewCast();
    4546    void slotDoFilter();
    4647    void exitWin();
    4748    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 {  
    2727    kCountryFilterUnknown = 0
    2828};
    2929
     30enum CastFilter {
     31    kCastFilterAll = -1,
     32    kCastFilterUnknown = 0
     33};
     34
    3035enum CategoryFilter {
    3136    kCategoryFilterAll = -1,
    3237    kCategoryFilterUnknown = 0
    const unsigned int VideoFilterSettings::  
    6671VideoFilterSettings::VideoFilterSettings(bool loaddefaultsettings,
    6772                                         const QString& _prefix) :
    6873    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)
    7480{
    7581    if (!_prefix)
    7682        prefix = "VideoDefault";
    VideoFilterSettings::VideoFilterSettings  
    8692                                        kGenreFilterAll);
    8793        country = gContext->GetNumSetting(QString("%1Country").arg(prefix),
    8894                                          kCountryFilterAll);
     95        cast = gContext->GetNumSetting(QString("%1Cast").arg(prefix),
     96                                        kCastFilterAll);
    8997        year = gContext->GetNumSetting(QString("%1Year").arg(prefix),
    9098                                       kYearFilterAll);
    9199        runtime = gContext->GetNumSetting(QString("%1Runtime").arg(prefix),
    VideoFilterSettings::operator=(const Vid  
    134142        country = rhs.country;
    135143    }
    136144
     145    if (cast != rhs.cast)
     146    {
     147        m_changed_state |= kFilterCastChanged;
     148        cast = rhs.cast;
     149    }
     150
    137151    if (year != rhs.year)
    138152    {
    139153        m_changed_state |= kFilterYearChanged;
    void VideoFilterSettings::saveAsDefault(  
    189203{
    190204    gContext->SaveSetting(QString("%1Category").arg(prefix), category);
    191205    gContext->SaveSetting(QString("%1Genre").arg(prefix), genre);
     206    gContext->SaveSetting(QString("%1Cast").arg(prefix), cast);
    192207    gContext->SaveSetting(QString("%1Country").arg(prefix), country);
    193208    gContext->SaveSetting(QString("%1Year").arg(prefix), year);
    194209    gContext->SaveSetting(QString("%1Runtime").arg(prefix), runtime);
    bool VideoFilterSettings::matches_filter  
    233248        }
    234249    }
    235250
     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
    236266    if (matches && category != kCategoryFilterAll)
    237267    {
    238268        matches = category == mdata.getCategoryID();
    VideoFilterDialog::VideoFilterDialog(Fil  
    369399                                 const char *name_) :
    370400    MythThemedDialog(parent_, window_name, theme_filename, name_),
    371401    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)
    375406{
    376407    //
    377408    //  The only thing this screen does is let the
    void VideoFilterDialog::fillWidgets()  
    469500        genre_select->setToItem(m_settings.getGenre());
    470501    }
    471502
     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
    472518    if (country_select)
    473519    {
    474520        country_select->addItem(kCountryFilterAll, QObject::tr("All"));
    void VideoFilterDialog::keyPressEvent(QK  
    616662            widget_testset(currentSelector, focued, category_select);
    617663            widget_testset(currentSelector, focued, genre_select);
    618664            widget_testset(currentSelector, focued, country_select);
     665            widget_testset(currentSelector, focued, cast_select);
    619666            widget_testset(currentSelector, focued, year_select);
    620667            widget_testset(currentSelector, focued, runtime_select);
    621668            widget_testset(currentSelector, focued, userrating_select);
    void VideoFilterDialog::setGenre(int new  
    704751        update_numvideo();
    705752}
    706753
     754void VideoFilterDialog::setCast(int new_cast)
     755{
     756        m_settings.setCast(new_cast);
     757        update_numvideo();
     758}
     759
    707760void VideoFilterDialog::setRunTime(int new_runtime)
    708761{
    709762        m_settings.setRuntime(new_runtime);
    void VideoFilterDialog::wireUpTheme()  
    762815        connect(genre_select,SIGNAL(pushed(int)),
    763816                this, SLOT(setGenre(int)));
    764817
     818    cast_select = getUISelectorType("cast_select");
     819    if (cast_select)
     820        connect(cast_select,SIGNAL(pushed(int)),
     821                this, SLOT(setCast(int)));
     822
    765823    runtime_select = getUISelectorType("runtime_select");
    766824    if (runtime_select)
    767825        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  
    3434        kFilterBrowseChanged = (1 << 7),
    3535        kFilterInetRefChanged = (1 << 8),
    3636        kFilterCoverFileChanged = (1 << 9),
    37         kFilterParentalLevelChanged = (1 << 8)
     37        kFilterParentalLevelChanged = (1 << 0xa),
     38        kFilterCastChanged = (1 << 0xb)
    3839    };
    3940
    4041  public:
     
    7576        genre = lgenre;
    7677    }
    7778
     79    int getCast() const { return cast; }
     80    void setCast(int lcast)
     81    {
     82        m_changed_state |= kFilterCastChanged;
     83        cast = lcast;
     84    }
     85
    7886    int getCountry() const { return country; }
    7987    void setCountry(int lcountry)
    8088    {
     
    149157    int category;
    150158    int genre;
    151159    int country;
     160    int cast;
    152161    int year;
    153162    int runtime;
    154163    int userrating;
     
    221230    void setCategory(int new_category);
    222231    void setCountry(int new_country);
    223232    void setGenre(int new_genre);
     233    void setCast(int new_cast);
    224234    void setRunTime(int new_runtime);
    225235    void setBrowse(int new_browse);
    226236    void setInetRef(int new_inetref);
     
    240250    UISelectorType  *category_select;
    241251    UISelectorType  *country_select;
    242252    UISelectorType  *genre_select;
     253    UISelectorType  *cast_select;
    243254    UISelectorType  *runtime_select;
    244255    UITextButtonType    *save_button;
    245256    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  
    498498            focusButton = popup->addButton(tr("Watch This Video"), this,
    499499                                           SLOT(slotWatchVideo()));
    500500            popup->addButton(tr("View Full Plot"), this, SLOT(slotViewPlot()));
     501            popup->addButton(tr("View Cast"), this, SLOT(slotViewCast()));
    501502            popup->addButton(tr("View Details"), this,
    502503                             SLOT(handleVideoSelect()));
    503504
  • mythvideo/mythvideo/videomanager.cpp

    diff -Nur --exclude='*.o' --exclude='moc_*' --exclude='Makefil*' ../mythplugins-orig/mythvideo/mythvideo/videomanager.cpp ./mythvideo/mythvideo/videomanager.cpp
    old new  
    675675
    676676        curitem->setCountries(movie_countries);
    677677
     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
    678694        curitem->setInetRef(movieNumber);
    679695        QString movieCoverFile = GetMoviePoster(movieNumber);
    680696        curitem->setCoverFile(movieCoverFile);
     
    13351351    curitem->setShowLevel(ParentalLevel::plLowest);
    13361352    curitem->setGenres(Metadata::genre_list());
    13371353    curitem->setCountries(Metadata::country_list());
     1354    curitem->setCast(Metadata::cast_list());
    13381355    curitem->updateDatabase();
    13391356
    13401357    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  
    263263                          m_item->Director());
    264264           checkedSetText((UITextType *)container->GetType("plot"),
    265265                          m_item->Plot());
     266           checkedSetText((UITextType *)container->GetType("cast"),
     267                          m_item->CastLine());
    266268           checkedSetText((UITextType *)container->GetType("rating"),
    267269                          getDisplayRating(m_item->Rating()));
    268270           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  
    2121    UITextType *video_title;
    2222    UITextType *video_file;
    2323    UITextType *video_plot;
     24    UITextType *video_cast;
    2425    UITextType *video_player;
    2526    UITextType *pl_value;
    2627    UIImageType *video_poster;
     
    4344  public:
    4445    VideoTreeImp() :
    4546        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),
    4748        pl_value(NULL), video_poster(NULL), m_director(NULL), m_rating(NULL),
    4849        m_inetref(NULL), m_year(NULL), m_userrating(NULL), m_length(NULL),
    4950        m_coverfile(NULL), m_child_id(NULL), m_browseable(NULL),
     
    8889        // Optional
    8990        assign(vt, m_director, "director", false);
    9091        assign(vt, video_plot, "plot", false);
     92        assign(vt, video_cast, "cast", false);
    9193        assign(vt, m_rating, "rating", false);
    9294        assign(vt, m_inetref, "inetref", false);
    9395        assign(vt, m_year, "year", false);
     
    112114
    113115        checkedSetText(m_director, "");
    114116        checkedSetText(video_plot, "");
     117        checkedSetText(video_cast, "");
    115118        checkedSetText(m_rating, "");
    116119        checkedSetText(m_inetref, "");
    117120        checkedSetText(m_year, "");
     
    129132        checkedSetText(video_title, item->Title());
    130133        checkedSetText(video_file, item->Filename().section("/", -1));
    131134        checkedSetText(video_plot, item->Plot());
     135        checkedSetText(video_cast, item->CastLine());
    132136        checkedSetText(video_player, Metadata::getPlayer(item));
    133137
    134138        if (!isDefaultCoverFile(item->CoverFile()))
     
    454458            focusButton = popup->addButton(tr("Watch This Video"), this,
    455459                                           SLOT(slotWatchVideo()));
    456460            popup->addButton(tr("View Full Plot"), this, SLOT(slotViewPlot()));
     461            popup->addButton(tr("View Cast"), this, SLOT(slotViewCast()));
    457462        }
    458463        else
    459464        {
     
    535540    }
    536541}
    537542
     543void 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
    538595void VideoTree::slotWatchVideo()
    539596{
    540597    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  
    3030    void slotVideoGallery();
    3131    void slotVideoBrowser();
    3232    void slotViewPlot();
     33    void slotViewCast();
    3334    void slotDoFilter();
    3435    void slotWatchVideo();
    3536
  • 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  
    12881288                        <font>display</font>
    12891289                        <value>Country :</value>
    12901290                </textarea>
    1291                 <textarea name="year_text" draworder="0" align="right">
     1291                <textarea name="cast_text" draworder="0" align="right">
    12921292                        <area>50,174,320,34</area>
    12931293                        <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>
    12941299                        <value>Year :</value>
    12951300                </textarea>
    12961301                <textarea name="runtime_text" draworder="0" align="right">
    1297                         <area>50,208,320,34</area>
     1302                        <area>50,242,320,34</area>
    12981303                        <font>display</font>
    12991304                        <value>Runtime :</value>
    13001305                </textarea>
    13011306                <textarea name="userrating_text" draworder="0" align="right">
    1302                         <area>50,242,320,34</area>
     1307                        <area>50,276,320,34</area>
    13031308                        <font>display</font>
    13041309                        <value>User Rating :</value>
    13051310                </textarea>
    13061311                <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">
    13121312                        <area>50,310,320,34</area>
    13131313                        <font>display</font>
    1314                         <value>InetRef :</value>
     1314                        <value>Browse :</value>
    13151315                </textarea>
    13161316                <textarea name="coverfile_text" draworder="0" align="right">
    13171317                        <area>50,344,320,34</area>
     
    13231323                        <font>display</font>
    13241324                        <value>Sort by :</value>
    13251325                </textarea>
    1326 
    13271326                <!-- Widgets -->
    13281327                <selector name="category_select" draworder="0">
    13291328                        <area>380,70,300,34</area>
     
    13471346                        <image function="off" filename="leftright_off.png"></image>
    13481347                        <image function="pushed" filename="leftright_pushed.png"></image>
    13491348                </selector>
    1350                 <selector name="year_select" draworder="0">
     1349                <selector name="cast_select" draworder="0">
    13511350                        <area>380,172,300,34</area>
    13521351                        <font>display</font>
    13531352                        <image function="on" filename="leftright_on.png"></image>
    13541353                        <image function="off" filename="leftright_off.png"></image>
    13551354                        <image function="pushed" filename="leftright_pushed.png"></image>
    13561355                </selector>
    1357                 <selector name="runtime_select" draworder="0">
     1356                <selector name="year_select" draworder="0">
    13581357                        <area>380,206,300,34</area>
    13591358                        <font>display</font>
    13601359                        <image function="on" filename="leftright_on.png"></image>
    13611360                        <image function="off" filename="leftright_off.png"></image>
    13621361                        <image function="pushed" filename="leftright_pushed.png"></image>
    13631362                </selector>
    1364                 <selector name="userrating_select" draworder="0">
     1363                <selector name="runtime_select" draworder="0">
    13651364                        <area>380,240,300,34</area>
    13661365                        <font>display</font>
    13671366                        <image function="on" filename="leftright_on.png"></image>
    13681367                        <image function="off" filename="leftright_off.png"></image>
    13691368                        <image function="pushed" filename="leftright_pushed.png"></image>
    13701369                </selector>
    1371                 <selector name="browse_select" draworder="0">
     1370                <selector name="userrating_select" draworder="0">
    13721371                        <area>380,274,300,34</area>
    13731372                        <font>display</font>
    13741373                        <image function="on" filename="leftright_on.png"></image>
    13751374                        <image function="off" filename="leftright_off.png"></image>
    13761375                        <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">
    13791378                        <area>380,308,300,34</area>
    13801379                        <font>display</font>
    13811380                        <image function="on" filename="leftright_on.png"></image>
    13821381                        <image function="off" filename="leftright_off.png"></image>
    13831382                        <image function="pushed" filename="leftright_pushed.png"></image>
    1384                 </selector>
     1383                </selector>
    13851384                <selector name="coverfile_select" draworder="0">
    13861385                        <area>380,342,300,34</area>
    13871386                        <font>display</font>