Ticket #3585: mythvideo-cast.3.diff

File mythvideo-cast.3.diff, 44.1 KB (added by Bill <level42@…>, 16 years ago)

Updated for SVN15419

  • mythvideo/mythvideo/dbaccess.cpp

    diff -Naur --exclude='*.orig' --exclude='*.qm' mythplugins-orig/mythvideo/mythvideo/dbaccess.cpp mythplugins/mythvideo/mythvideo/dbaccess.cpp
    old new  
    549549
    550550////////////////////////////////////////////
    551551
     552VideoCast::VideoCast() :
     553    SingleValue(new SingleValueImp("videocast", "intid", "cast"))
     554{
     555}
     556
     557VideoCast::~VideoCast()
     558{
     559}
     560
     561VideoCast &VideoCast::getCast()
     562{
     563    static VideoCast vc;
     564    vc.load_data();
     565    return vc;
     566}
     567
     568////////////////////////////////////////////
     569
    552570VideoGenreMap::VideoGenreMap() :
    553571    MultiValue(new MultiValueImp("videometadatagenre", "idvideo", "idgenre"))
    554572{
     
    586604
    587605////////////////////////////////////////////
    588606
     607VideoCastMap::VideoCastMap() :
     608    MultiValue(new MultiValueImp("videometadatacast", "idvideo",
     609                                 "idcast"))
     610{
     611}
     612
     613VideoCastMap::~VideoCastMap()
     614{
     615}
     616
     617VideoCastMap &VideoCastMap::getCastMap()
     618{
     619    static VideoCastMap vcm;
     620    vcm.load_data();
     621    return vcm;
     622}
     623
     624////////////////////////////////////////////
     625
    589626class FileAssociationsImp
    590627{
    591628  public:
  • mythvideo/mythvideo/dbaccess.h

    diff -Naur --exclude='*.orig' --exclude='*.qm' mythplugins-orig/mythvideo/mythvideo/dbaccess.h mythplugins/mythvideo/mythvideo/dbaccess.h
    old new  
    107107    ~VideoCountryMap();
    108108};
    109109
     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};
     129
    110130class FileAssociations
    111131{
    112132  public:
  • mythvideo/mythvideo/dbcheck.cpp

    diff -Naur --exclude='*.orig' --exclude='*.qm' mythplugins-orig/mythvideo/mythvideo/dbcheck.cpp mythplugins/mythvideo/mythvideo/dbcheck.cpp
    old new  
    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";
     
    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 -Naur --exclude='*.orig' --exclude='*.qm' mythplugins-orig/mythvideo/mythvideo/globals.cpp mythplugins/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 -Naur --exclude='*.orig' --exclude='*.qm' mythplugins-orig/mythvideo/mythvideo/globals.h mythplugins/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 -Naur --exclude='*.orig' --exclude='*.qm' mythplugins-orig/mythvideo/mythvideo/metadata.cpp mythplugins/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
     
    204207    {
    205208        m_countries = countries;
    206209    }
     210   
     211    const cast_list &getCast() const { return m_cast; }
     212    void setCast(const cast_list &cast) { m_cast = cast; }
    207213
    208214    const QString &getFilename() const { return m_filename; }
    209215    void setFilename(const QString &filename) { m_filename = filename; }
     
    270276    void fillCountries();
    271277    void updateCountries();
    272278    void fillGenres();
     279    void fillCast();
    273280    void updateGenres();
     281    void updateCast();
    274282    bool removeDir(const QString &dirName);
    275283    void fromDBRow(MSqlQuery &query);
    276284    void saveToDatabase();
     
    285293    QString m_category;
    286294    genre_list m_genres;
    287295    country_list m_countries;
     296    cast_list m_cast;
    288297    QString m_filename;
    289298    QString m_coverfile;
    290299
     
    369378{
    370379    VideoGenreMap::getGenreMap().remove(m_id);
    371380    VideoCountryMap::getCountryMap().remove(m_id);
     381    VideoCastMap::getCastMap().remove(m_id);
    372382
    373383    MSqlQuery query(MSqlQuery::InitCon());
    374384    query.prepare("DELETE FROM videometadata WHERE intid = :ID");
     
    395405                    VIDEO_INETREF_DEFAULT, VIDEO_DIRECTOR_DEFAULT,
    396406                    VIDEO_PLOT_DEFAULT, 0.0, VIDEO_RATING_DEFAULT, 0, m_id,
    397407                    ParentalLevel::plLowest, 0, -1, true, "", "",
    398                     Metadata::genre_list(), Metadata::country_list());
     408                    Metadata::genre_list(), Metadata::country_list(), Metadata::cast_list());
    399409    tmp.m_prefix = m_prefix;
    400410    tmp.m_flat_index = m_flat_index;
    401411
     
    440450    }
    441451}
    442452
     453void 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
    443472/// Sets metadata from a DB row
    444473void MetadataImp::fromDBRow(MSqlQuery &query)
    445474{
     
    471500
    472501    //Countries
    473502    fillCountries();
     503
     504    // Cast
     505    fillCast();
    474506}
    475507
    476508void MetadataImp::saveToDatabase()
     
    570602
    571603    updateGenres();
    572604    updateCountries();
     605    updateCast();
    573606}
    574607
    575608void MetadataImp::dumpToDatabase()
     
    649682    }
    650683}
    651684
     685void 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
    652706////////////////////////////////////////
    653707//// Metadata
    654708////////////////////////////////////////
     
    854908             int childID, bool browse,
    855909             const QString &playcommand, const QString &category,
    856910             const genre_list &genres,
    857              const country_list &countries)
     911             const country_list &countries,
     912             const cast_list &cast)
    858913{
    859914    m_imp = new MetadataImp(filename, coverfile, title, year, inetref, director,
    860915                            plot, userrating, rating, length, id, showlevel,
    861916                            categoryID, childID, browse, playcommand, category,
    862                             genres, countries);
     917                            genres, countries, cast);
    863918}
    864919
    865920Metadata::~Metadata()
     
    10981153    m_imp->setGenres(genres);
    10991154}
    11001155
     1156const Metadata::cast_list &Metadata::Cast() const
     1157{
     1158    return m_imp->getCast();
     1159}
     1160
     1161QString 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
     1183void Metadata::setCast(const cast_list &cast)
     1184{
     1185    m_imp->setCast(cast);
     1186}
     1187
    11011188const Metadata::country_list &Metadata::Countries() const
    11021189{
    11031190    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  
    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 -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"""
     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 -Naur --exclude='*.orig' --exclude='*.qm' mythplugins-orig/mythvideo/mythvideo/scripts/imdb.pl mythplugins/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 -Naur --exclude='*.orig' --exclude='*.qm' mythplugins-orig/mythvideo/mythvideo/scripts/imdbpy.py mythplugins/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)
     
    256258
    257259        imdb_access = imdb.IMDb()
    258260        movie = imdb_access.get_movie(imdb_id)
     261               
    259262        imdb_access.update(movie)
    260263
    261264        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 -Naur --exclude='*.orig' --exclude='*.qm' mythplugins-orig/mythvideo/mythvideo/scripts/MythTV.py mythplugins/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 -Naur --exclude='*.orig' --exclude='*.qm' mythplugins-orig/mythvideo/mythvideo/videobrowser.cpp mythplugins/mythvideo/mythvideo/videobrowser.cpp
    old new  
    131131            focusButton = popup->addButton(tr("Watch This Video"), this,
    132132                                           SLOT(slotWatchVideo()));
    133133            popup->addButton(tr("View Full Plot"), this, SLOT(slotViewPlot()));
     134            popup->addButton(tr("View Cast"), this, SLOT(slotViewCast()));
    134135        }
    135136        else
    136137        {
     
    311312                            curitem->Director());
    312313            checkedSetText((UITextType *)container->GetType("plot"),
    313314                            curitem->Plot());
     315            checkedSetText((UITextType *)container->GetType("cast"),
     316                            curitem->CastLine());
    314317            checkedSetText((UITextType *)container->GetType("rating"),
    315318                            getDisplayRating(curitem->Rating()));
    316319            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  
    171171    }
    172172}
    173173
     174void 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}
    174225
    175226void VideoDialog::slotWatchVideo()
    176227{
  • mythvideo/mythvideo/videodlg.h

    diff -Naur --exclude='*.orig' --exclude='*.qm' mythplugins-orig/mythvideo/mythvideo/videodlg.h mythplugins/mythvideo/mythvideo/videodlg.h
    old new  
    4040    void slotVideoGallery();
    4141    void slotVideoBrowser();
    4242    void slotViewPlot();
     43    void slotViewCast();
    4344    void slotDoFilter();
    4445    void exitWin();
    4546    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  
    2727    kCountryFilterUnknown = 0
    2828};
    2929
     30enum CastFilter {
     31    kCastFilterAll = -1,
     32    kCastFilterUnknown = 0
     33};
     34
    3035enum CategoryFilter {
    3136    kCategoryFilterAll = -1,
    3237    kCategoryFilterUnknown = 0
     
    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";
     
    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),
     
    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;
     
    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);
     
    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();
     
    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
     
    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"));
     
    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);
     
    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);
     
    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 -Naur --exclude='*.orig' --exclude='*.qm' mythplugins-orig/mythvideo/mythvideo/videofilter.h mythplugins/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 -Naur --exclude='*.orig' --exclude='*.qm' mythplugins-orig/mythvideo/mythvideo/videogallery.cpp mythplugins/mythvideo/mythvideo/videogallery.cpp
    old new  
    500500            focusButton = popup->addButton(tr("Watch This Video"), this,
    501501                                           SLOT(slotWatchVideo()));
    502502            popup->addButton(tr("View Full Plot"), this, SLOT(slotViewPlot()));
     503            popup->addButton(tr("View Cast"), this, SLOT(slotViewCast()));
    503504            popup->addButton(tr("View Details"), this,
    504505                             SLOT(handleVideoSelect()));
    505506
  • mythvideo/mythvideo/videomanager.cpp

    diff -Naur --exclude='*.orig' --exclude='*.qm' mythplugins-orig/mythvideo/mythvideo/videomanager.cpp mythplugins/mythvideo/mythvideo/videomanager.cpp
    old new  
    12051205                checkedSetText(m_container, "video_player",
    12061206                               Metadata::getPlayer(item));
    12071207                checkedSetText(m_container, "director", item->Director());
     1208                checkedSetText(m_container, "cast", item->CastLine());
    12081209                checkedSetText(m_container, "plot", item->Plot());
    12091210                checkedSetText(m_container, "rating", item->Rating());
    12101211                checkedSetText(m_container, "inetref", item->InetRef());
     
    25912592
    25922593            AutomaticParentalAdjustment(item);
    25932594
     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           
    25942610            // Genres
    25952611            Metadata::genre_list video_genres;
    25962612            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  
    261261                          m_item->Director());
    262262           checkedSetText((UITextType *)container->GetType("plot"),
    263263                          m_item->Plot());
     264           checkedSetText((UITextType *)container->GetType("cast"),
     265                          m_item->CastLine());
    264266           checkedSetText((UITextType *)container->GetType("rating"),
    265267                          getDisplayRating(m_item->Rating()));
    266268           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  
    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        castbox->deleteLater();
     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 -Naur --exclude='*.orig' --exclude='*.qm' mythplugins-orig/mythvideo/mythvideo/videotree.h mythplugins/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/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  
    13501350            <value>Country :</value>
    13511351         </textarea>
    13521352
    1353          <textarea name="year_text" draworder="0" align="right">
     1353        <textarea name="cast_text" draworder="0" align="right">
    13541354            <area>50,174,320,34</area>
    13551355            <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>
    13561362            <value>Year :</value>
    13571363         </textarea>
    13581364
    13591365         <textarea name="runtime_text" draworder="0" align="right">
    1360             <area>50,208,320,34</area>
     1366            <area>50,242,320,34</area>
    13611367            <font>display</font>
    13621368            <value>Runtime :</value>
    13631369         </textarea>
    13641370
    13651371         <textarea name="userrating_text" draworder="0" align="right">
    1366             <area>50,242,320,34</area>
     1372            <area>50,276,320,34</area>
    13671373            <font>display</font>
    13681374            <value>User Rating :</value>
    13691375         </textarea>
    13701376
    13711377         <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">
    13781378            <area>50,310,320,34</area>
    13791379            <font>display</font>
    1380             <value>InetRef :</value>
     1380            <value>Browse :</value>
    13811381         </textarea>
    13821382
    13831383         <textarea name="coverfile_text" draworder="0" align="right">
     
    14181418            <image function="pushed" filename="leftright_pushed.png"></image>
    14191419         </selector>
    14201420
    1421          <selector name="year_select" draworder="0">
     1421         <selector name="cast_select" draworder="0">
    14221422            <area>380,172,300,34</area>
    14231423            <font>display</font>
    14241424            <image function="on" filename="leftright_on.png"></image>
     
    14261426            <image function="pushed" filename="leftright_pushed.png"></image>
    14271427         </selector>
    14281428
    1429          <selector name="runtime_select" draworder="0">
     1429         <selector name="year_select" draworder="0">
    14301430            <area>380,206,300,34</area>
    14311431            <font>display</font>
    14321432            <image function="on" filename="leftright_on.png"></image>
     
    14341434            <image function="pushed" filename="leftright_pushed.png"></image>
    14351435         </selector>
    14361436
    1437          <selector name="userrating_select" draworder="0">
     1437         <selector name="runtime_select" draworder="0">
    14381438            <area>380,240,300,34</area>
    14391439            <font>display</font>
    14401440            <image function="on" filename="leftright_on.png"></image>
     
    14421442            <image function="pushed" filename="leftright_pushed.png"></image>
    14431443         </selector>
    14441444
    1445          <selector name="browse_select" draworder="0">
     1445         <selector name="userrating_select" draworder="0">
    14461446            <area>380,274,300,34</area>
    14471447            <font>display</font>
    14481448            <image function="on" filename="leftright_on.png"></image>
     
    14501450            <image function="pushed" filename="leftright_pushed.png"></image>
    14511451         </selector>
    14521452
    1453          <selector name="inetref_select" draworder="0">
     1453         <selector name="browse_select" draworder="0">
    14541454            <area>380,308,300,34</area>
    14551455            <font>display</font>
    14561456            <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  
    13501350            <value>Country :</value>
    13511351         </textarea>
    13521352
    1353          <textarea name="year_text" draworder="0" align="right">
     1353         <textarea name="cast_text" draworder="0" align="right">
    13541354            <area>0,220,572,40</area>
    13551355            <font>display</font>
    1356             <value>Year :</value>
     1356            <value>Actor/Actress :</value>
    13571357         </textarea>
    13581358
    1359          <textarea name="runtime_text" draworder="0" align="right">
     1359         <textarea name="year_text" draworder="0" align="right">
    13601360            <area>0,260,572,40</area>
    13611361            <font>display</font>
    1362             <value>Runtime :</value>
     1362            <value>Year :</value>
    13631363         </textarea>
    13641364
    1365          <textarea name="userrating_text" draworder="0" align="right">
     1365         <textarea name="runtime_text" draworder="0" align="right">
    13661366            <area>0,300,572,40</area>
    13671367            <font>display</font>
    1368             <value>User Rating :</value>
     1368            <value>Runtime :</value>
    13691369         </textarea>
    13701370
    1371          <textarea name="browse_text" draworder="0" align="right">
     1371         <textarea name="userrating_text" draworder="0" align="right">
    13721372            <area>0,340,572,40</area>
    13731373            <font>display</font>
    1374             <value>Browse :</value>
     1374            <value>User Rating :</value>
    13751375         </textarea>
    13761376
    1377          <textarea name="inetref_text" draworder="0" align="right">
     1377         <textarea name="browse_text" draworder="0" align="right">
    13781378            <area>0,380,572,40</area>
    13791379            <font>display</font>
    1380             <value>InetRef :</value>
     1380            <value>Browse :</value>
    13811381         </textarea>
    13821382
    13831383         <textarea name="coverfile_text" draworder="0" align="right">