diff --git a/mythtv/libs/libmyth/programinfo.cpp b/mythtv/libs/libmyth/programinfo.cpp index bbc37cbb111..5b99fc7ebcd 100644 --- a/mythtv/libs/libmyth/programinfo.cpp +++ b/mythtv/libs/libmyth/programinfo.cpp @@ -81,6 +81,29 @@ static void set_flag(uint32_t &flags, int flag_to_set, bool is_set) flags |= flag_to_set; } +QString myth_category_type_to_string(ProgramInfo::CategoryType category_type) +{ + static const char *cattype[] = + { "", "movie", "series", "sports", "tvshow", }; + + if ((category_type > ProgramInfo::kCategoryNone) && + (category_type < sizeof(cattype))) + return QString(cattype[category_type]); + + return ""; +} + +ProgramInfo::CategoryType string_to_myth_category_type(const QString &category_type) +{ + static const char *cattype[] = + { "", "movie", "series", "sports", "tvshow", }; + + for (uint i = 1; i < 5; i++) + if (category_type == cattype[i]) + return (ProgramInfo::CategoryType) i; + return ProgramInfo::kCategoryNone; +} + /** \fn ProgramInfo::ProgramInfo(void) * \brief Null constructor. */ @@ -112,7 +135,7 @@ ProgramInfo::ProgramInfo(void) : seriesid(), programid(), inetref(), - catType(), + catType(kCategoryNone), filesize(0ULL), @@ -340,7 +363,7 @@ ProgramInfo::ProgramInfo( seriesid(_seriesid), programid(_programid), inetref(_inetref), - catType(), + catType(kCategoryNone), filesize(_filesize), @@ -456,7 +479,7 @@ ProgramInfo::ProgramInfo( seriesid(_seriesid), programid(_programid), inetref(_inetref), - catType(), + catType(kCategoryNone), filesize(0ULL), @@ -529,7 +552,7 @@ ProgramInfo::ProgramInfo( const QString &_seriesid, const QString &_programid, - const QString &_catType, + const CategoryType _catType, float _stars, uint _year, @@ -729,7 +752,7 @@ ProgramInfo::ProgramInfo( seriesid(_seriesid), programid(_programid), inetref(_inetref), - catType(), + catType(kCategoryNone), filesize(0ULL), @@ -1049,7 +1072,6 @@ void ProgramInfo::clone(const ProgramInfo &other, seriesid.detach(); programid.detach(); inetref.detach(); - catType.detach(); sortTitle.detach(); inUseForWhat.detach(); @@ -1086,7 +1108,7 @@ void ProgramInfo::clear(void) seriesid.clear(); programid.clear(); inetref.clear(); - catType.clear(); + catType = kCategoryNone; sortTitle.clear(); @@ -1630,7 +1652,7 @@ void ProgramInfo::ToMap(InfoMap &progMap, progMap["seriesid"] = seriesid; progMap["programid"] = programid; progMap["inetref"] = inetref; - progMap["catType"] = catType; + progMap["catType"] = myth_category_type_to_string(catType); progMap["year"] = year ? QString::number(year) : ""; @@ -1710,6 +1732,12 @@ uint ProgramInfo::GetSecondsInRecording(void) const return (uint) ((recsecs>0) ? recsecs : max(duration,int64_t(0))); } +/// \brief Returns catType as a string +QString ProgramInfo::GetCategoryTypeString(void) const +{ + return myth_category_type_to_string(catType); +} + /// \brief Returns last frame in position map or 0 uint64_t ProgramInfo::QueryLastFrameInPosMap(void) const { @@ -1737,7 +1765,7 @@ bool ProgramInfo::IsGeneric(void) const (programid.isEmpty() && subtitle.isEmpty() && description.isEmpty()) || (!programid.isEmpty() && programid.endsWith("0000") - && catType == "series"); + && catType == kCategorySeries); } QString ProgramInfo::toString(const Verbosity v, QString sep, QString grp) @@ -1826,7 +1854,7 @@ bool ProgramInfo::LoadProgramFromRecorded( { // These items are not initialized below so they need to be cleared // if we're loading in a different program into this ProgramInfo - catType.clear(); + catType = kCategoryNone; lastInUseTime = MythDate::current().addSecs(-4 * 60 * 60); rectype = kNotRecording; oldrecstatus = rsUnknown; @@ -1999,7 +2027,7 @@ bool ProgramInfo::IsSameProgram(const ProgramInfo& other) const if (title.compare(other.title, Qt::CaseInsensitive) != 0) return false; - if (catType == "series") + if (catType == kCategorySeries) { if (programid.endsWith("0000")) return false; @@ -2606,9 +2634,9 @@ void ProgramInfo::SaveDVDBookmark(const QStringList &fields) const * * \return string category_type */ -QString ProgramInfo::QueryCategoryType(void) const +ProgramInfo::CategoryType ProgramInfo::QueryCategoryType(void) const { - QString ret; + CategoryType ret; MSqlQuery query(MSqlQuery::InitCon()); @@ -2622,7 +2650,7 @@ QString ProgramInfo::QueryCategoryType(void) const if (query.exec() && query.next()) { - ret = query.value(0).toString(); + ret = string_to_myth_category_type(query.value(0).toString()); } return ret; @@ -4678,7 +4706,7 @@ bool LoadFromProgram( query.value(13).toString(), // seriesid query.value(14).toString(), // programid - query.value(18).toString(), // catType + string_to_myth_category_type(query.value(18).toString()), // catType query.value(16).toDouble(), // stars query.value(15).toUInt(), // year diff --git a/mythtv/libs/libmyth/programinfo.h b/mythtv/libs/libmyth/programinfo.h index 8875831925c..f81c21d524b 100644 --- a/mythtv/libs/libmyth/programinfo.h +++ b/mythtv/libs/libmyth/programinfo.h @@ -73,6 +73,9 @@ class MPUBLIC ProgramInfo { friend int pginfo_init_statics(void); public: + enum CategoryType { kCategoryNone, kCategoryMovie, kCategorySeries, + kCategorySports, kCategoryTVShow }; + /// Null constructor ProgramInfo(void); /// Copy constructor @@ -190,7 +193,7 @@ class MPUBLIC ProgramInfo const QString &seriesid, const QString &programid, - const QString &catType, + const CategoryType catType, float stars, uint year, @@ -401,7 +404,8 @@ class MPUBLIC ProgramInfo QString GetSeriesID(void) const { return seriesid; } QString GetProgramID(void) const { return programid; } QString GetInetRef(void) const { return inetref; } - QString GetCategoryType(void) const { return catType; } + CategoryType GetCategoryType(void) const { return catType; } + QString GetCategoryTypeString(void) const; int GetRecordingPriority(void) const { return recpriority; } int GetRecordingPriority2(void) const { return recpriority2; } float GetStars(void) const { return stars; } @@ -486,7 +490,7 @@ class MPUBLIC ProgramInfo void SetSeriesID( const QString &id) { seriesid = id; } void SetProgramID( const QString &id) { programid = id; } void SetCategory( const QString &cat) { category = cat; } - void SetCategoryType( const QString &type) { catType = type; } + void SetCategoryType( const CategoryType type) { catType = type; } void SetRecordingPriority(int priority) { recpriority = priority; } void SetRecordingPriority2(int priority) { recpriority2 = priority; } void SetRecordingRuleID(uint id) { recordid = id; } @@ -526,7 +530,7 @@ class MPUBLIC ProgramInfo uint QueryMplexID(void) const; QDateTime QueryBookmarkTimeStamp(void) const; uint64_t QueryBookmark(void) const; - QString QueryCategoryType(void) const; + CategoryType QueryCategoryType(void) const; QStringList QueryDVDBookmark(const QString &serialid) const; bool QueryIsEditing(void) const; bool QueryIsInUse(QStringList &byWho) const; @@ -673,7 +677,7 @@ class MPUBLIC ProgramInfo QString seriesid; QString programid; QString inetref; - QString catType; + CategoryType catType; uint64_t filesize; @@ -813,6 +817,9 @@ class MPUBLIC PMapDBReplacement MPUBLIC QString format_season_and_episode(int seasEp, int digits = -1); +MPUBLIC QString myth_category_type_to_string(ProgramInfo::CategoryType category_type); +MPUBLIC ProgramInfo::CategoryType string_to_myth_category_type(const QString &type); + Q_DECLARE_METATYPE(ProgramInfo*) #endif // MYTHPROGRAM_H_ diff --git a/mythtv/libs/libmythbase/mythversion.h b/mythtv/libs/libmythbase/mythversion.h index 46b932f3571..f50d2464641 100644 --- a/mythtv/libs/libmythbase/mythversion.h +++ b/mythtv/libs/libmythbase/mythversion.h @@ -12,7 +12,7 @@ /// Update this whenever the plug-in ABI changes. /// Including changes in the libmythbase, libmyth, libmythtv, libmythav* and /// libmythui class methods in exported headers. -#define MYTH_BINARY_VERSION "0.27.20130404-1" +#define MYTH_BINARY_VERSION "0.27.20130413-1" /** \brief Increment this whenever the MythTV network protocol changes. * diff --git a/mythtv/libs/libmythmetadata/metadatafactory.cpp b/mythtv/libs/libmythmetadata/metadatafactory.cpp index 12e2e536604..bbec801606e 100644 --- a/mythtv/libs/libmythmetadata/metadatafactory.cpp +++ b/mythtv/libs/libmythmetadata/metadatafactory.cpp @@ -611,15 +611,15 @@ LookupType GuessLookupType(ProgramInfo *pginfo) { LookupType ret = kUnknownVideo; - QString catType = pginfo->GetCategoryType(); - if (catType.isEmpty()) + ProgramInfo::CategoryType catType = pginfo->GetCategoryType(); + if (catType == ProgramInfo::kCategoryNone) catType = pginfo->QueryCategoryType(); if ((!pginfo->GetSubtitle().isEmpty() || pginfo->GetEpisode() > 0) && - (catType == "series" || catType == "tvshow" || - catType == "show")) + (catType == ProgramInfo::kCategorySeries || + catType == ProgramInfo::kCategoryTVShow)) ret = kProbableTelevision; - else if (catType == "movie" || catType == "film") + else if (catType == ProgramInfo::kCategoryMovie) ret = kProbableMovie; else if (pginfo->GetSeason() > 0 || pginfo->GetEpisode() > 0 || !pginfo->GetSubtitle().isEmpty()) diff --git a/mythtv/libs/libmythtv/eitfixup.cpp b/mythtv/libs/libmythtv/eitfixup.cpp index 7395124804c..5720da219a7 100644 --- a/mythtv/libs/libmythtv/eitfixup.cpp +++ b/mythtv/libs/libmythtv/eitfixup.cpp @@ -3,7 +3,7 @@ // MythTV headers #include "eitfixup.h" -#include "dvbdescriptors.h" // for MythCategoryType +#include "programinfo.h" // for CategoryType #include "channelutil.h" // for GetDefaultAuthority() #include "programinfo.h" // for subtitle types and audio and video properties @@ -781,7 +781,7 @@ void EITFixUp::FixUK(DBEventEIT &event) const } } if (series) - event.categoryType = kCategorySeries; + event.categoryType = ProgramInfo::kCategorySeries; QRegExp tmpStarring = m_ukStarring; if (tmpStarring.indexIn(event.description) != -1) @@ -1069,7 +1069,7 @@ void EITFixUp::FixComHem(DBEventEIT &event, bool process_subtitle) const } if (isSeries) - event.categoryType = kCategorySeries; + event.categoryType = ProgramInfo::kCategorySeries; // Look for additional persons in the description QRegExp tmpPersons = m_comHemPersons; @@ -1245,7 +1245,7 @@ void EITFixUp::FixAUNine(DBEventEIT &event) const if (event.subtitle == "Movie") { event.subtitle = QString::null; - event.categoryType = kCategoryMovie; + event.categoryType = ProgramInfo::kCategoryMovie; } if (event.description.startsWith(event.title)) event.description.remove(0,event.title.length()+1); @@ -1385,7 +1385,7 @@ void EITFixUp::FixMCA(DBEventEIT &event) const event.subtitle = tmpExp1.cap(3).trimmed(); event.syndicatedepisodenumber = QString("E%1S%2").arg(episode).arg(season); - event.categoryType = kCategorySeries; + event.categoryType = ProgramInfo::kCategorySeries; } // Close captioned? @@ -1450,7 +1450,7 @@ void EITFixUp::FixMCA(DBEventEIT &event) const event.AddPerson(DBPerson::kActor, (*it).trimmed()); event.description = tmpExp1.cap(1).trimmed(); } - event.categoryType = kCategoryMovie; + event.categoryType = ProgramInfo::kCategoryMovie; } } @@ -1544,7 +1544,7 @@ void EITFixUp::FixRTL(DBEventEIT &event) const /* got an episode title now? (we did not have one at the start of this function) */ if (!event.subtitle.isEmpty()) { - event.categoryType = kCategorySeries; + event.categoryType = ProgramInfo::kCategorySeries; } /* if we do not have an episode title by now try some guessing as last resort */ @@ -1648,88 +1648,88 @@ void EITFixUp::FixNL(DBEventEIT &event) const if (event.category == "Documentary") { event.category = "Documentaire"; - event.categoryType = kCategoryNone; + event.categoryType = ProgramInfo::kCategoryNone; } if (event.category == "News") { event.category = "Nieuws/actualiteiten"; - event.categoryType = kCategoryNone; + event.categoryType = ProgramInfo::kCategoryNone; } if (event.category == "Kids") { event.category = "Jeugd"; - event.categoryType = kCategoryNone; + event.categoryType = ProgramInfo::kCategoryNone; } if (event.category == "Show/game Show") { event.category = "Amusement"; - event.categoryType = kCategoryTVShow; + event.categoryType = ProgramInfo::kCategoryTVShow; } if (event.category == "Music/Ballet/Dance") { event.category = "Muziek"; - event.categoryType = kCategoryNone; + event.categoryType = ProgramInfo::kCategoryNone; } if (event.category == "News magazine") { event.category = "Informatief"; - event.categoryType = kCategoryNone; + event.categoryType = ProgramInfo::kCategoryNone; } if (event.category == "Movie") { event.category = "Film"; - event.categoryType = kCategoryMovie; + event.categoryType = ProgramInfo::kCategoryMovie; } if (event.category == "Nature/animals/Environment") { event.category = "Natuur"; - event.categoryType = kCategoryNone; + event.categoryType = ProgramInfo::kCategoryNone; } if (event.category == "Movie - Adult") { event.category = "Erotiek"; - event.categoryType = kCategoryNone; + event.categoryType = ProgramInfo::kCategoryNone; } if (event.category == "Movie - Soap/melodrama/folkloric") { event.category = "Serie/soap"; - event.categoryType = kCategorySeries; + event.categoryType = ProgramInfo::kCategorySeries; } if (event.category == "Arts/Culture") { event.category = "Kunst/Cultuur"; - event.categoryType = kCategoryNone; + event.categoryType = ProgramInfo::kCategoryNone; } if (event.category == "Sports") { event.category = "Sport"; - event.categoryType = kCategorySports; + event.categoryType = ProgramInfo::kCategorySports; } if (event.category == "Cartoons/Puppets") { event.category = "Animatie"; - event.categoryType = kCategoryNone; + event.categoryType = ProgramInfo::kCategoryNone; } if (event.category == "Movie - Comedy") { event.category = "Comedy"; - event.categoryType = kCategorySeries; + event.categoryType = ProgramInfo::kCategorySeries; } if (event.category == "Movie - Detective/Thriller") { event.category = "Misdaad"; - event.categoryType = kCategoryNone; + event.categoryType = ProgramInfo::kCategoryNone; } if (event.category == "Social/Spiritual Sciences") { event.category = "Religieus"; - event.categoryType = kCategoryNone; + event.categoryType = ProgramInfo::kCategoryNone; } // Film - categories are usually not Films if (event.category.startsWith("Film -")) { - event.categoryType = kCategorySeries; + event.categoryType = ProgramInfo:: kCategorySeries; } // Get stereo info @@ -1888,11 +1888,11 @@ void EITFixUp::FixNL(DBEventEIT &event) const void EITFixUp::FixCategory(DBEventEIT &event) const { // remove category movie from short events - if (event.categoryType == kCategoryMovie && + if (event.categoryType == ProgramInfo::kCategoryMovie && event.starttime.secsTo(event.endtime) < kMinMovieDuration) { /* default taken from ContentDescriptor::GetMythCategory */ - event.categoryType = kCategoryTVShow; + event.categoryType = ProgramInfo::kCategoryTVShow; } } diff --git a/mythtv/libs/libmythtv/eithelper.cpp b/mythtv/libs/libmythtv/eithelper.cpp index 99246d535f2..5bd37e800a1 100644 --- a/mythtv/libs/libmythtv/eithelper.cpp +++ b/mythtv/libs/libmythtv/eithelper.cpp @@ -352,7 +352,7 @@ void EITHelper::AddEIT(const DVBEventInformationTable *eit) QString subtitle = QString(""); QString description = QString(""); QString category = QString(""); - uint category_type = kCategoryNone; + ProgramInfo::CategoryType category_type = ProgramInfo::kCategoryNone; unsigned char subtitle_type=0, audio_props=0, video_props=0; // Parse descriptors @@ -467,7 +467,20 @@ void EITHelper::AddEIT(const DVBEventInformationTable *eit) if ((EITFixUp::kFixDish & fix) || (EITFixUp::kFixBell & fix)) { DishContentDescriptor content(content_data); - category_type = content.GetTheme(); + switch (content.GetTheme()) + { + case kThemeMovie : + category_type = ProgramInfo::kCategoryMovie; + break; + case kThemeSeries : + category_type = ProgramInfo::kCategorySeries; + break; + case kThemeSports : + category_type = ProgramInfo::kCategorySports; + break; + default : + category_type = ProgramInfo::kCategoryNone; + } if (EITFixUp::kFixDish & fix) category = content.GetCategory(); } @@ -547,7 +560,7 @@ void EITHelper::AddEIT(const DVBEventInformationTable *eit) else if (desc.ContentType() == 0x02 || desc.ContentType() == 0x32) { seriesId = desc.ContentId(); - category_type = kCategorySeries; + category_type = ProgramInfo::kCategorySeries; } } } @@ -584,7 +597,7 @@ void EITHelper::AddEIT(const PremiereContentInformationTable *cit) QString subtitle = QString(""); QString description = QString(""); QString category = QString(""); - MythCategoryType category_type = kCategoryNone; + ProgramInfo::CategoryType category_type = ProgramInfo::kCategoryNone; unsigned char subtitle_type=0, audio_props=0, video_props=0; // Parse descriptors @@ -607,11 +620,11 @@ void EITHelper::AddEIT(const PremiereContentInformationTable *cit) { if(content.UserNibble(0)==0x1) { - category_type = kCategoryMovie; + category_type = ProgramInfo::kCategoryMovie; } else if(content.UserNibble(0)==0x0) { - category_type = kCategorySports; + category_type = ProgramInfo::kCategorySports; category = QObject::tr("Sports"); } } diff --git a/mythtv/libs/libmythtv/mpeg/dvbdescriptors.cpp b/mythtv/libs/libmythtv/mpeg/dvbdescriptors.cpp index 7ce76458bc4..59dd4984079 100644 --- a/mythtv/libs/libmythtv/mpeg/dvbdescriptors.cpp +++ b/mythtv/libs/libmythtv/mpeg/dvbdescriptors.cpp @@ -10,6 +10,7 @@ #include "iso6937tables.h" #include "freesat_huffman.h" #include "mythlogging.h" +#include "programinfo.h" static QString decode_iso6937(const unsigned char *buf, uint length) @@ -205,35 +206,13 @@ QMutex ContentDescriptor::categoryLock; QMap ContentDescriptor::categoryDesc; volatile bool ContentDescriptor::categoryDescExists = false; -QString myth_category_type_to_string(uint category_type) -{ - static const char *cattype[] = - { "", "movie", "series", "sports", "tvshow", }; - - if ((category_type > kCategoryNone) && (category_type < kCategoryLast)) - return QString(cattype[category_type]); - - return ""; -} - -MythCategoryType string_to_myth_category_type(const QString &category_type) -{ - static const char *cattype[] = - { "", "movie", "series", "sports", "tvshow", }; - - for (uint i = 1; i < 5; i++) - if (category_type == cattype[i]) - return (MythCategoryType) i; - return kCategoryNone; -} - -MythCategoryType ContentDescriptor::GetMythCategory(uint i) const +ProgramInfo::CategoryType ContentDescriptor::GetMythCategory(uint i) const { if (0x1 == Nibble1(i)) - return kCategoryMovie; + return ProgramInfo::kCategoryMovie; if (0x4 == Nibble1(i)) - return kCategorySports; - return kCategoryTVShow; + return ProgramInfo::kCategorySports; + return ProgramInfo::kCategoryTVShow; } const char *linkage_types[] = diff --git a/mythtv/libs/libmythtv/mpeg/dvbdescriptors.h b/mythtv/libs/libmythtv/mpeg/dvbdescriptors.h index bd8bfa8b224..543ce946662 100644 --- a/mythtv/libs/libmythtv/mpeg/dvbdescriptors.h +++ b/mythtv/libs/libmythtv/mpeg/dvbdescriptors.h @@ -558,19 +558,6 @@ class ComponentDescriptor : public MPEGDescriptor } }; -typedef enum -{ - kCategoryNone = 0, - kCategoryMovie, - kCategorySeries, - kCategorySports, - kCategoryTVShow, - kCategoryLast, -} MythCategoryType; - -MTV_PUBLIC QString myth_category_type_to_string(uint category_type); -MTV_PUBLIC MythCategoryType string_to_myth_category_type(const QString &type); - // DVB Bluebook A038 (Sept 2011) p 46 class ContentDescriptor : public MPEGDescriptor { @@ -598,7 +585,7 @@ class ContentDescriptor : public MPEGDescriptor uint UserNibble(uint i) const { return _data[3 + (i<<1)]; } // } 2.0 - MythCategoryType GetMythCategory(uint i) const; + ProgramInfo::CategoryType GetMythCategory(uint i) const; QString GetDescription(uint i) const; QString toString(void) const; diff --git a/mythtv/libs/libmythtv/programdata.cpp b/mythtv/libs/libmythtv/programdata.cpp index 72a66f11c7c..b182d1e0b48 100644 --- a/mythtv/libs/libmythtv/programdata.cpp +++ b/mythtv/libs/libmythtv/programdata.cpp @@ -7,11 +7,10 @@ using namespace std; // MythTV headers +#include "programdata.h" #include "channelutil.h" #include "mythdb.h" #include "mythlogging.h" -#include "programinfo.h" -#include "programdata.h" #include "dvbdescriptors.h" #define LOC QString("ProgramData: ") @@ -274,7 +273,7 @@ uint DBEvent::GetOverlappingPrograms( while (query.next()) { - MythCategoryType category_type = + ProgramInfo::CategoryType category_type = string_to_myth_category_type(query.value(4).toString()); DBEvent prog( @@ -502,7 +501,7 @@ uint DBEvent::UpdateDB( if (lseriesId.isEmpty() && !match.seriesId.isEmpty()) lseriesId = match.seriesId; - uint tmp = categoryType; + ProgramInfo::CategoryType tmp = categoryType; if (!categoryType && match.categoryType) tmp = match.categoryType; diff --git a/mythtv/libs/libmythtv/programdata.h b/mythtv/libs/libmythtv/programdata.h index 9c484e69615..ea05d30c3fe 100644 --- a/mythtv/libs/libmythtv/programdata.h +++ b/mythtv/libs/libmythtv/programdata.h @@ -17,6 +17,7 @@ using namespace std; // MythTV headers #include "mythtvexp.h" #include "listingsources.h" +#include "programinfo.h" class MSqlQuery; @@ -85,7 +86,7 @@ class MTV_PUBLIC DBEvent audioProps(0), videoProps(0), stars(0.0), - categoryType(0/*kCategoryNone*/), + categoryType(ProgramInfo::kCategoryNone), seriesId(), programId(), previouslyshown(false), @@ -93,7 +94,7 @@ class MTV_PUBLIC DBEvent DBEvent(const QString &_title, const QString &_subtitle, const QString &_desc, - const QString &_category, uint _category_type, + const QString &_category, ProgramInfo::CategoryType _category_type, const QDateTime &_start, const QDateTime &_end, unsigned char _subtitleType, unsigned char _audioProps, @@ -163,7 +164,7 @@ class MTV_PUBLIC DBEvent unsigned char audioProps; unsigned char videoProps; float stars; - unsigned char categoryType; + ProgramInfo::CategoryType categoryType; QString seriesId; QString programId; bool previouslyshown; @@ -177,7 +178,7 @@ class MTV_PUBLIC DBEventEIT : public DBEvent DBEventEIT(uint _chanid, const QString &_title, const QString &_subtitle, const QString &_desc, - const QString &_category, uint _category_type, + const QString &_category, ProgramInfo::CategoryType _category_type, const QDateTime &_start, const QDateTime &_end, uint _fixup, unsigned char _subtitleType, @@ -199,7 +200,7 @@ class MTV_PUBLIC DBEventEIT : public DBEvent unsigned char _subtitleType, unsigned char _audioProps, unsigned char _videoProps) : - DBEvent(_title, QString(), _desc, QString(), 0/*kCategoryNone*/, + DBEvent(_title, QString(), _desc, QString(), ProgramInfo::kCategoryNone, _start, _end, _subtitleType, _audioProps, _videoProps, 0.0, QString(), QString(), kListingSourceEIT), chanid(_chanid), fixup(_fixup) diff --git a/mythtv/libs/libmythtv/recordinginfo.cpp b/mythtv/libs/libmythtv/recordinginfo.cpp index ccab50b613b..1a35c1f746c 100644 --- a/mythtv/libs/libmythtv/recordinginfo.cpp +++ b/mythtv/libs/libmythtv/recordinginfo.cpp @@ -70,7 +70,7 @@ RecordingInfo::RecordingInfo( const QString &_seriesid, const QString &_programid, const QString &_inetref, - const QString &_catType, + const CategoryType _catType, int _recpriority, diff --git a/mythtv/libs/libmythtv/recordinginfo.h b/mythtv/libs/libmythtv/recordinginfo.h index 9844266abf2..672bd2e6687 100644 --- a/mythtv/libs/libmythtv/recordinginfo.h +++ b/mythtv/libs/libmythtv/recordinginfo.h @@ -100,13 +100,13 @@ class MTV_PUBLIC RecordingInfo : public ProgramInfo const QString &storagegroup, uint year, - uint partnumber, - uint parttotal, + uint partnumber, + uint parttotal, const QString &seriesid, const QString &programid, const QString &inetref, - const QString &catType, + const CategoryType catType, int recpriority, diff --git a/mythtv/libs/libmythtv/recordingrule.cpp b/mythtv/libs/libmythtv/recordingrule.cpp index 39183c81932..3bb1163c4df 100644 --- a/mythtv/libs/libmythtv/recordingrule.cpp +++ b/mythtv/libs/libmythtv/recordingrule.cpp @@ -208,7 +208,7 @@ bool RecordingRule::LoadByProgram(const ProgramInfo* proginfo) if (m_recordID) Load(); else - LoadTemplate(proginfo->GetCategory(), proginfo->GetCategoryType()); + LoadTemplate(proginfo->GetCategory(), proginfo->GetCategoryTypeString()); if (m_type != kTemplateRecord && (m_searchType == kNoSearch || m_searchType == kManualSearch)) diff --git a/mythtv/programs/mythbackend/httpstatus.cpp b/mythtv/programs/mythbackend/httpstatus.cpp index 684104ad2b4..8571a58fcde 100644 --- a/mythtv/programs/mythbackend/httpstatus.cpp +++ b/mythtv/programs/mythbackend/httpstatus.cpp @@ -1515,7 +1515,7 @@ void HttpStatus::FillProgramInfo(QDomDocument *pDoc, program.setAttribute( "title" , pInfo->GetTitle() ); program.setAttribute( "subTitle" , pInfo->GetSubtitle()); program.setAttribute( "category" , pInfo->GetCategory()); - program.setAttribute( "catType" , pInfo->GetCategoryType()); + program.setAttribute( "catType" , pInfo->GetCategoryTypeString()); program.setAttribute( "repeat" , pInfo->IsRepeat() ); if (bDetails) diff --git a/mythtv/programs/mythbackend/scheduler.cpp b/mythtv/programs/mythbackend/scheduler.cpp index 26fdc0901b1..66286fe4fed 100644 --- a/mythtv/programs/mythbackend/scheduler.cpp +++ b/mythtv/programs/mythbackend/scheduler.cpp @@ -4086,7 +4086,7 @@ void Scheduler::AddNewRecords(void) result.value(26).toString(),//seriesid result.value(27).toString(),//programid result.value(28).toString(),//inetref - result.value(29).toString(),//catType + string_to_myth_category_type(result.value(29).toString()),//catType result.value(12).toInt(),//recpriority diff --git a/mythtv/programs/mythbackend/services/serviceUtil.cpp b/mythtv/programs/mythbackend/services/serviceUtil.cpp index 3b266218ba7..9a2a79942a0 100644 --- a/mythtv/programs/mythbackend/services/serviceUtil.cpp +++ b/mythtv/programs/mythbackend/services/serviceUtil.cpp @@ -51,7 +51,7 @@ void FillProgramInfo( DTC::Program *pProgram, pProgram->setTitle ( pInfo->GetTitle() ); pProgram->setSubTitle ( pInfo->GetSubtitle() ); pProgram->setCategory ( pInfo->GetCategory() ); - pProgram->setCatType ( pInfo->GetCategoryType() ); + pProgram->setCatType ( pInfo->GetCategoryTypeString()); pProgram->setRepeat ( pInfo->IsRepeat() ); pProgram->setVideoProps( pInfo->GetVideoProperties() ); pProgram->setAudioProps( pInfo->GetAudioProperties() ); diff --git a/mythtv/programs/mythfilldatabase/xmltvparser.cpp b/mythtv/programs/mythfilldatabase/xmltvparser.cpp index b7c11c72bba..f7830106732 100644 --- a/mythtv/programs/mythfilldatabase/xmltvparser.cpp +++ b/mythtv/programs/mythfilldatabase/xmltvparser.cpp @@ -329,8 +329,8 @@ ProgInfo *XMLTVParser::parseProgram(QDomElement &element) { const QString cat = getFirstText(info).toLower(); - if (kCategoryNone == pginfo->categoryType && - string_to_myth_category_type(cat) != kCategoryNone) + if (ProgramInfo::kCategoryNone == pginfo->categoryType && + string_to_myth_category_type(cat) != ProgramInfo::kCategoryNone) { pginfo->categoryType = string_to_myth_category_type(cat); } @@ -339,10 +339,10 @@ ProgInfo *XMLTVParser::parseProgram(QDomElement &element) pginfo->category = cat; } - if (cat == "film") + if (cat == QObject::tr("movie") || cat == QObject::tr("film")) { // Hack for tv_grab_uk_rt - pginfo->categoryType = kCategoryMovie; + pginfo->categoryType = ProgramInfo::kCategoryMovie; } } else if (info.tagName() == "date" && !pginfo->airdate) @@ -448,7 +448,7 @@ ProgInfo *XMLTVParser::parseProgram(QDomElement &element) QString partnumber(part.section('/',0,0).trimmed()); QString parttotal(part.section('/',1,1).trimmed()); - pginfo->categoryType = kCategorySeries; + pginfo->categoryType = ProgramInfo::kCategorySeries; if (!episode.isEmpty()) { @@ -486,14 +486,15 @@ ProgInfo *XMLTVParser::parseProgram(QDomElement &element) else if (info.attribute("system") == "onscreen" && pginfo->subtitle.isEmpty()) { - pginfo->categoryType = kCategorySeries; + pginfo->categoryType = ProgramInfo::kCategorySeries; pginfo->subtitle = getFirstText(info); } } } } - if (pginfo->category.isEmpty() && pginfo->categoryType != kCategoryNone) + if (pginfo->category.isEmpty() && + pginfo->categoryType != ProgramInfo::kCategoryNone) pginfo->category = myth_category_type_to_string(pginfo->categoryType); if (!pginfo->airdate) @@ -502,11 +503,11 @@ ProgInfo *XMLTVParser::parseProgram(QDomElement &element) /* Let's build ourself a programid */ QString programid; - if (kCategoryMovie == pginfo->categoryType) + if (ProgramInfo::kCategoryMovie == pginfo->categoryType) programid = "MV"; - else if (kCategorySeries == pginfo->categoryType) + else if (ProgramInfo::kCategorySeries == pginfo->categoryType) programid = "EP"; - else if (kCategorySports == pginfo->categoryType) + else if (ProgramInfo::kCategorySports == pginfo->categoryType) programid = "SP"; else programid = "SH"; @@ -530,7 +531,7 @@ ProgInfo *XMLTVParser::parseProgram(QDomElement &element) { // Cannot represent season as a single base-36 character, so // remove the programid and fall back to normal dup matching. - if (kCategoryMovie != pginfo->categoryType) + if (ProgramInfo::kCategoryMovie != pginfo->categoryType) programid.clear(); } else @@ -548,7 +549,7 @@ ProgInfo *XMLTVParser::parseProgram(QDomElement &element) { /* No ep/season info? Well then remove the programid and rely on normal dupchecking methods instead. */ - if (kCategoryMovie != pginfo->categoryType) + if (ProgramInfo::kCategoryMovie != pginfo->categoryType) programid.clear(); } } diff --git a/mythtv/programs/mythfrontend/playbackbox.cpp b/mythtv/programs/mythfrontend/playbackbox.cpp index 9191d8f7b0f..ff618ce2635 100644 --- a/mythtv/programs/mythfrontend/playbackbox.cpp +++ b/mythtv/programs/mythfrontend/playbackbox.cpp @@ -968,7 +968,7 @@ void PlaybackBox::ItemLoaded(MythUIButtonListItem *item) item->DisplayState(sit.value(), "subtitletypes"); } - item->DisplayState(pginfo->GetCategoryType(), "categorytype"); + item->DisplayState(pginfo->GetCategoryTypeString(), "categorytype"); // Mark this button list item as initialized. item->SetText("yes", "is_item_initialized"); @@ -1236,7 +1236,7 @@ void PlaybackBox::updateIcons(const ProgramInfo *pginfo) iconState = dynamic_cast(GetChild("categorytype")); if (iconState) { - if (!(pginfo && iconState->DisplayState(pginfo->GetCategoryType()))) + if (!(pginfo && iconState->DisplayState(pginfo->GetCategoryTypeString()))) iconState->Reset(); } } diff --git a/mythtv/programs/mythfrontend/schedulecommon.cpp b/mythtv/programs/mythfrontend/schedulecommon.cpp index edf1939c30e..72fa3d255df 100644 --- a/mythtv/programs/mythfrontend/schedulecommon.cpp +++ b/mythtv/programs/mythfrontend/schedulecommon.cpp @@ -261,7 +261,7 @@ void ScheduleCommon::EditRecording(ProgramInfo *pginfo) qVariantFromValue(recinfo)); if (!recinfo.IsGeneric()) { - if (recinfo.GetCategoryType() == "movie") + if (recinfo.GetCategoryType() == ProgramInfo::kCategoryMovie) menuPopup->AddButton(tr("Record one showing"), qVariantFromValue(recinfo)); else @@ -340,7 +340,7 @@ void ScheduleCommon::EditRecording(ProgramInfo *pginfo) if (recinfo.GetRecordingRuleType() != kOverrideRecord && !((recinfo.GetFindID() == 0 || !IsFindApplicable(recinfo)) && - recinfo.GetCategoryType() == "series" && + recinfo.GetCategoryType() == ProgramInfo::kCategorySeries && recinfo.GetProgramID().contains(QRegExp("0000$"))) && ((!(dupmethod & kDupCheckNone) && !recinfo.GetProgramID().isEmpty() &&