Ticket #6346: seasonEpisodeSubtitle.diff

File seasonEpisodeSubtitle.diff, 17.2 KB (added by robert.mcnamara@…, 12 years ago)

aforementioned patch

  • mythvideo/mythvideo/metadatalistmanager.cpp

     
    112112    MSqlQuery query(MSqlQuery::InitCon());
    113113    query.setForwardOnly(true);
    114114    const QString BaseMetadataQuery(
    115         "SELECT title, director, plot, rating, year, userrating,"
    116         "length, filename, showlevel, coverfile, inetref, childid,"
    117         "browse, playcommand, category, intid, trailer, screenshot,"
    118         "banner, fanart, host FROM videometadata");
     115        "SELECT title, director, plot, rating, year, "
     116        "userrating, length, filename, showlevel, "
     117        "coverfile, inetref, childid, browse, playcommand, category, "
     118        "intid, trailer, screenshot, banner, fanart, "
     119        "subtitle, season, episode, host FROM videometadata");
    119120
    120121    query.prepare(BaseMetadataQuery);
    121122
  • mythvideo/mythvideo/metadata.cpp

     
    8989  public:
    9090    MetadataImp(const QString &filename, const QString &trailer, const QString &coverfile,
    9191             const QString &screenshot, const QString &banner, const QString &fanart,
    92              const QString &title, int year,
     92             const QString &title, const QString &subtitle, int year,
    9393             const QString &inetref, const QString &director,
    9494             const QString &plot, float userrating,
    9595             const QString &rating, int length,
     96             int season, int episode,
    9697             int id, ParentalLevel::Level showlevel, int categoryID,
    9798             int childID, bool browse,
    9899             const QString &playcommand, const QString &category,
     
    100101             const country_list &countries,
    101102             const cast_list &cast,
    102103             const QString &host = "") :
    103         m_title(title),
     104        m_title(title), m_subtitle(subtitle),
    104105        m_inetref(inetref), m_director(director), m_plot(plot),
    105106        m_rating(rating), m_playcommand(playcommand), m_category(category),
    106107        m_genres(genres), m_countries(countries), m_cast(cast),
    107108        m_filename(filename), m_trailer(trailer), m_coverfile(coverfile),
    108109        m_screenshot(screenshot), m_banner(banner), m_fanart(fanart),
    109110        m_host(host), m_categoryID(categoryID), m_childID(childID),
    110         m_year(year), m_length(length), m_showlevel(showlevel),
     111        m_year(year), m_length(length), m_season(season),
     112        m_episode(episode), m_showlevel(showlevel),
    111113        m_browse(browse), m_id(id), m_userrating(userrating)
    112114    {
    113115        VideoCategory::GetCategory().get(m_categoryID, m_category);
     
    128130        if (this != &rhs)
    129131        {
    130132            m_title = rhs.m_title;
     133            m_subtitle = rhs.m_subtitle;
    131134            m_inetref = rhs.m_inetref;
    132135            m_director = rhs.m_director;
    133136            m_plot = rhs.m_plot;
     
    148151            m_childID = rhs.m_childID;
    149152            m_year = rhs.m_year;
    150153            m_length = rhs.m_length;
     154            m_season = rhs.m_season;
     155            m_episode = rhs.m_episode;
    151156            m_showlevel = rhs.m_showlevel;
    152157            m_browse = rhs.m_browse;
    153158            m_id = rhs.m_id;
     
    180185        m_title = title;
    181186    }
    182187
     188    const QString &getSubtitle() const { return m_subtitle; }
     189    void SetSubtitle(const QString &subtitle) { m_subtitle = subtitle; }
     190
    183191    const QString &GetInetRef() const { return m_inetref; }
    184192    void SetInetRef(const QString &inetRef) { m_inetref = inetRef; }
    185193
     
    249257    int GetLength() const { return m_length; }
    250258    void SetLength(int length) { m_length = length; }
    251259
     260    int GetSeason() const { return m_season; }
     261    void SetSeason(int season) { m_season = season; }
     262
     263    int GetEpisode() const { return m_episode; }
     264    void SetEpisode(int episode) { m_episode = episode; }
     265
    252266    ParentalLevel::Level GetShowLevel() const { return m_showlevel; }
    253267    void SetShowLevel(ParentalLevel::Level showLevel)
    254268    {
     
    289303
    290304  private:
    291305    QString m_title;
     306    QString m_subtitle;
    292307    QString m_inetref;
    293308    QString m_director;
    294309    QString m_plot;
     
    310325    int m_childID;
    311326    int m_year;
    312327    int m_length;
     328    int m_season;
     329    int m_episode;
    313330    ParentalLevel::Level m_showlevel;
    314331    bool m_browse;
    315332    unsigned int m_id;  // videometadata.intid
     
    384401    MetadataImp tmp(m_filename, VIDEO_TRAILER_DEFAULT, VIDEO_COVERFILE_DEFAULT,
    385402                    VIDEO_SCREENSHOT_DEFAULT, VIDEO_BANNER_DEFAULT,
    386403                    VIDEO_FANART_DEFAULT, Metadata::FilenameToTitle(m_filename),
    387                     VIDEO_YEAR_DEFAULT, VIDEO_INETREF_DEFAULT,
     404                    VIDEO_SUBTITLE_DEFAULT, VIDEO_YEAR_DEFAULT, VIDEO_INETREF_DEFAULT,
    388405                    VIDEO_DIRECTOR_DEFAULT, VIDEO_PLOT_DEFAULT, 0.0,
    389                     VIDEO_RATING_DEFAULT, 0, m_id,
     406                    VIDEO_RATING_DEFAULT, 0, 0, 0, m_id,
    390407                    ParentalLevel::plLowest, 0, -1, true, "", "",
    391408                    Metadata::genre_list(), Metadata::country_list(),
    392409                    Metadata::cast_list(), m_host);
     
    484501    m_screenshot = query.value(17).toString();
    485502    m_banner = query.value(18).toString();
    486503    m_fanart = query.value(19).toString();
    487     m_host = query.value(20).toString();
     504    m_subtitle = query.value(20).toString();
     505    m_season = query.value(21).toInt();
     506    m_episode = query.value(22).toInt();
     507    m_host = query.value(23).toString();
    488508
    489509    VideoCategory::GetCategory().get(m_categoryID, m_category);
    490510
     
    502522{
    503523    if (m_title.isEmpty())
    504524        m_title = Metadata::FilenameToTitle(m_filename);
     525    if (m_subtitle.isEmpty())
     526        m_subtitle = VIDEO_SUBTITLE_DEFAULT;
    505527    if (m_director.isEmpty())
    506528        m_director = VIDEO_DIRECTOR_UNKNOWN;
    507529    if (m_plot.isEmpty())
     
    533555    {
    534556        m_browse = gContext->GetNumSetting("VideoNewBrowsable", 1);
    535557
    536         query.prepare("INSERT INTO videometadata (title,director,plot,"
    537                       "rating,year,userrating,length,filename,showlevel,"
    538                       "coverfile,inetref,browse,trailer,screenshot,banner,"
    539                       "fanart,host) VALUES (:TITLE, :DIRECTOR, :PLOT, :RATING, "
    540                       ":YEAR, :USERRATING, :LENGTH, :FILENAME, :SHOWLEVEL, "
    541                       ":COVERFILE, :INETREF, :BROWSE, :TRAILER, :SCREENSHOT, "
    542                       ":BANNER, :FANART, :HOST)");
     558        query.prepare("INSERT INTO videometadata (title,subtitle,director,plot,"
     559                      "rating,year,userrating,length,season,episode,filename,"
     560                      "showlevel,coverfile,inetref,browse,trailer,screenshot,banner,"
     561                      "fanart,host) VALUES (:TITLE, :SUBTITLE, :DIRECTOR, :PLOT, "
     562                      ":RATING, :YEAR, :USERRATING, :LENGTH, :SEASON, :EPISODE, "
     563                      ":FILENAME, :SHOWLEVEL, :COVERFILE, :INETREF, :BROWSE, "
     564                      ":TRAILER, :SCREENSHOT, :BANNER, :FANART, :HOST)");
    543565    }
    544566    else
    545567    {
    546         query.prepare("UPDATE videometadata SET title = :TITLE, "
     568        query.prepare("UPDATE videometadata SET title = :TITLE, subtitle = :SUBTITLE, "
    547569                      "director = :DIRECTOR, plot = :PLOT, rating= :RATING, "
    548570                      "year = :YEAR, userrating = :USERRATING, "
    549                       "length = :LENGTH, filename = :FILENAME, trailer = :TRAILER, "
     571                      "length = :LENGTH, season = :SEASON, episode = :EPISODE, "
     572                      "filename = :FILENAME, trailer = :TRAILER, "
    550573                      "showlevel = :SHOWLEVEL, coverfile = :COVERFILE, "
    551574                      "screenshot = :SCREENSHOT, banner = :BANNER, fanart = :FANART, "
    552575                      "inetref = :INETREF, browse = :BROWSE, host = :HOST, "
     
    560583    }
    561584
    562585    query.bindValue(":TITLE", m_title);
     586    query.bindValue(":SUBTITLE", m_subtitle);
    563587    query.bindValue(":DIRECTOR", m_director);
    564588    query.bindValue(":PLOT", m_plot);
    565589    query.bindValue(":RATING", m_rating);
    566590    query.bindValue(":YEAR", m_year);
    567591    query.bindValue(":USERRATING", m_userrating);
    568592    query.bindValue(":LENGTH", m_length);
     593    query.bindValue(":SEASON", m_season);
     594    query.bindValue(":EPISODE", m_episode);
    569595    query.bindValue(":FILENAME", m_filename);
    570596    query.bindValue(":TRAILER", m_trailer);
    571597    query.bindValue(":SHOWLEVEL", m_showlevel);
     
    829855    return ret;
    830856}
    831857
    832 Metadata::Metadata(const QString &filename, const QString &trailer,
    833              const QString &coverfile, const QString &screenshot,
    834              const QString &banner, const QString &fanart,
    835              const QString &title, int year,
     858Metadata::Metadata(const QString &filename, const QString &trailer, 
     859             const QString &coverfile, const QString &screenshot, 
     860             const QString &banner, const QString &fanart, 
     861             const QString &title, const QString &subtitle, int year,
    836862             const QString &inetref, const QString &director,
    837863             const QString &plot, float userrating,
    838864             const QString &rating, int length,
     865             int season, int episode,
    839866             int id, ParentalLevel::Level showlevel, int categoryID,
    840867             int childID, bool browse,
    841868             const QString &playcommand, const QString &category,
     
    845872             const QString &host)
    846873{
    847874    m_imp = new MetadataImp(filename, trailer, coverfile, screenshot, banner,
    848                             fanart, title, year, inetref, director, plot,
    849                             userrating, rating, length, id, showlevel,
    850                             categoryID, childID, browse, playcommand, category,
    851                             genres, countries, cast, host);
     875                            fanart, title, subtitle, year, inetref, director, plot,
     876                            userrating, rating, length, season, episode, id,
     877                            showlevel, categoryID, childID, browse, playcommand,
     878                            category, genres, countries, cast, host);
    852879}
    853880
    854881Metadata::~Metadata()
     
    911938    m_imp->SetTitle(title);
    912939}
    913940
     941const QString &Metadata::GetSubtitle() const
     942{
     943    return m_imp->getSubtitle();
     944}
     945 
     946void Metadata::SetSubtitle(const QString &subtitle)
     947{
     948    m_imp->SetSubtitle(subtitle);
     949}
     950
    914951int Metadata::GetYear() const
    915952{
    916953    return m_imp->getYear();
     
    9811018    m_imp->SetLength(length);
    9821019}
    9831020
     1021int Metadata::GetSeason() const
     1022{
     1023    return m_imp->GetSeason();
     1024}
     1025
     1026void Metadata::SetSeason(int season)
     1027{
     1028    m_imp->SetSeason(season);
     1029}
     1030
     1031int Metadata::GetEpisode() const
     1032{
     1033    return m_imp->GetEpisode();
     1034}
     1035
     1036void Metadata::SetEpisode(int episode)
     1037{
     1038    m_imp->SetEpisode(episode);
     1039}
     1040
    9841041unsigned int Metadata::GetID() const
    9851042{
    9861043    return m_imp->GetID();
  • mythvideo/mythvideo/dbcheck.cpp

     
    3838    const QString lastMythDVDDBVersion = "1002";
    3939    const QString lastMythVideoVersion = "1010";
    4040
    41     const QString currentDatabaseVersion = "1023";
     41    const QString currentDatabaseVersion = "1024";
    4242
    4343    const QString OldMythVideoVersionName = "VideoDBSchemaVer";
    4444    const QString OldMythDVDVersionName = "DVDDBSchemaVer";
     
    834834            performActualUpdate(updates, "1023", dbver, MythVideoVersionName);
    835835        }
    836836
     837        if (dbver == "1023")
     838        {
     839            QStringList updates;
     840            updates += "ALTER TABLE videometadata ADD `subtitle` TEXT "
     841                       "NOT NULL AFTER `title`;";
     842            updates += "ALTER TABLE videometadata ADD `season` SMALLINT "
     843                       "UNSIGNED NOT NULL DEFAULT '0' AFTER `length`;";
     844            updates += "ALTER TABLE videometadata ADD `episode` SMALLINT "
     845                       "UNSIGNED NOT NULL AFTER `season`;";
     846            performActualUpdate(updates, "1024", dbver, MythVideoVersionName);
     847        }
    837848
    838849    }
    839850}
  • mythvideo/mythvideo/videoutils.cpp

     
    139142    return QString("%1 minutes").arg(length);
    140143}
    141144
     145QString GetDisplaySeason(int season)
     146{
     147    return QString::number(season);
     148}
     149
     150QString GetDisplayEpisode(int episode)
     151{
     152    return QString::number(episode);
     153}
     154
    142155QString GetDisplayBrowse(bool browse)
    143156{
    144157    return browse ? QObject::tr("Yes") : QObject::tr("No");
  • mythvideo/mythvideo/videodlg.cpp

     
    10141014
    10151015            tmp["filename"] = metadata->GetFilename();
    10161016            tmp["title"] = metadata->GetTitle();
     1017            tmp["subtitle"] = metadata->GetSubtitle();
    10171018            tmp["director"] = metadata->GetDirector();
    10181019            tmp["plot"] = metadata->GetPlot();
    10191020            tmp["genres"] = GetDisplayGenres(*metadata);
     
    10231024            tmp["length"] = GetDisplayLength(metadata->GetLength());
    10241025            tmp["year"] = GetDisplayYear(metadata->GetYear());
    10251026            tmp["userrating"] = GetDisplayUserRating(metadata->GetUserRating());
     1027            tmp["season"] = GetDisplaySeason(metadata->GetSeason());
     1028            tmp["episode"] = GetDisplayEpisode(metadata->GetEpisode());
    10261029
    10271030            tmp["userratingstate"] =
    10281031                    QString::number((int)(metadata->GetUserRating()));
     
    10731076        h.handleText("player");
    10741077        h.handleText("filename");
    10751078        h.handleText("title");
     1079        h.handleText("subtitle");
    10761080        h.handleText("director");
    10771081        h.handleText("plot");
    10781082        h.handleText("genres");
     
    10801084        h.handleText("cast");
    10811085        h.handleText("rating");
    10821086        h.handleText("length");
     1087        h.handleText("season");
     1088        h.handleText("episode");
    10831089        h.handleText("year");
    10841090        h.handleText("userrating");
    10851091
  • mythvideo/mythvideo/videoscan.cpp

     
    268268                                 VIDEO_BANNER_DEFAULT,
    269269                                 VIDEO_FANART_DEFAULT,
    270270                                 Metadata::FilenameToTitle(p->first),
     271                                 VIDEO_SUBTITLE_DEFAULT,
    271272                                 VIDEO_YEAR_DEFAULT,
    272273                                 VIDEO_INETREF_DEFAULT, VIDEO_DIRECTOR_DEFAULT,
    273274                                 VIDEO_PLOT_DEFAULT, 0.0, VIDEO_RATING_DEFAULT,
    274                                  0, 0, ParentalLevel::plLowest);
     275                                 0, 0, 0, 0, ParentalLevel::plLowest);
    275276
    276277                VERBOSE(VB_GENERAL, QString("Adding : %1 : %2")
    277278                        .arg(newFile.GetHost()).arg(newFile.GetFilename()));
  • mythvideo/mythvideo/metadata.h

     
    1313
    1414enum { VIDEO_YEAR_DEFAULT = 1895 };
    1515
     16const QString VIDEO_SUBTITLE_DEFAULT = "";
     17
    1618struct SortData;
    1719
    1820class Metadata
     
    5557             const QString &banner = QString(),
    5658             const QString &fanart = QString(),
    5759             const QString &title = QString(),
     60             const QString &subtitle = QString(),
    5861             int year = VIDEO_YEAR_DEFAULT,
    5962             const QString &inetref = QString(),
    6063             const QString &director = QString(),
     
    6265             float userrating = 0.0,
    6366             const QString &rating = QString(),
    6467             int length = 0,
     68             int season = 0,
     69             int episode = 0,
    6570             int id = 0,
    6671             ParentalLevel::Level showlevel = ParentalLevel::plLowest,
    6772             int categoryID = 0,
     
    8994    const QString &GetTitle() const;
    9095    void SetTitle(const QString& title);
    9196
     97    const QString &GetSubtitle() const;
     98    void SetSubtitle(const QString &subtitle);
     99
    92100    int GetYear() const;
    93101    void SetYear(int year);
    94102
     
    110118    int GetLength() const;
    111119    void SetLength(int length);
    112120
     121    int GetSeason() const;
     122    void SetSeason(int season);
     123
     124    int GetEpisode() const;
     125    void SetEpisode(int episode);
     126
    113127    unsigned int GetID() const;
    114128    void SetID(int id);
    115129
  • mythvideo/mythvideo/videoutils.h

     
    3333
    3434QString GetDisplayUserRating(float userrating);
    3535QString GetDisplayLength(int length);
     36QString GetDisplaySeason(int season);
     37QString GetDisplayEpisode(int episode);
    3638QString GetDisplayBrowse(bool browse);
    3739QString GetDisplayYear(int year);
    3840QString GetDisplayRating(const QString &rating);