Ticket #11495: mythtv-0.27-serviceapi-dvr-editschedule.3.patch

File mythtv-0.27-serviceapi-dvr-editschedule.3.patch, 19.6 KB (added by dev-team@…, 11 years ago)

updated Add / Update method definitions for a more complete set

  • mythtv/libs/libmythservicecontracts/services/dvrServices.h

    diff --git a/mythtv/libs/libmythservicecontracts/services/dvrServices.h b/mythtv/libs/libmythservicecontracts/services/dvrServices.h
    index d680375..5a8f4b7 100644
    a b  
    3838class SERVICE_PUBLIC DvrServices : public Service  //, public QScriptable ???
    3939{
    4040    Q_OBJECT
    41     Q_CLASSINFO( "version"    , "1.6" );
     41    Q_CLASSINFO( "version"    , "1.7" );
    4242    Q_CLASSINFO( "RemoveRecordedItem_Method",                   "POST" )
    4343    Q_CLASSINFO( "AddRecordSchedule_Method",                    "POST" )
    4444    Q_CLASSINFO( "RemoveRecordSchedule_Method",                 "POST" )
    4545    Q_CLASSINFO( "EnableRecordSchedule_Method",                 "POST" )
    4646    Q_CLASSINFO( "DisableRecordSchedule_Method",                "POST" )
     47    Q_CLASSINFO( "UpdateRecordSchedule_Method",                 "POST" )
    4748
    4849    public:
    4950
     
    9495
    9596        // Recording Rules
    9697
    97         virtual int                AddRecordSchedule     ( int       ChanId,
     98        virtual int                AddRecordSchedule     ( QString   Title,
     99                                                           QString   Subtitle,
     100                                                           QString   Description,
     101                                                           QString   Category,
    98102                                                           QDateTime StartTime,
     103                                                           QDateTime EndTime,
     104                                                           QString   SeriesId,
     105                                                           QString   ProgramId,
     106                                                           int       ChanId,
     107                                                           QString   Station,
     108                                                           int       FindDay,
     109                                                           QTime     FindTime,
    99110                                                           int       ParentId,
    100111                                                           bool      Inactive,
    101112                                                           uint      Season,
    102113                                                           uint      Episode,
    103114                                                           QString   Inetref,
    104                                                            int       FindId,
     115                                                           QString   Type,
     116                                                           QString   SearchType,
     117                                                           int       RecPriority,
     118                                                           uint      PreferredInput,
     119                                                           int       StartOffset,
     120                                                           int       EndOffset,
     121                                                           QString   DupMethod,
     122                                                           QString   DupIn,
     123                                                           uint      Filter,
     124                                                           QString   RecProfile,
     125                                                           QString   RecGroup,
     126                                                           QString   StorageGroup,
     127                                                           QString   PlayGroup,
     128                                                           bool      AutoExpire,
     129                                                           int       MaxEpisodes,
     130                                                           bool      MaxNewest,
     131                                                           bool      AutoCommflag,
     132                                                           bool      AutoTranscode,
     133                                                           bool      AutoMetaLookup,
     134                                                           bool      AutoUserJob1,
     135                                                           bool      AutoUserJob2,
     136                                                           bool      AutoUserJob3,
     137                                                           bool      AutoUserJob4,
     138                                                           int       Transcoder        ) = 0;
     139
     140        virtual bool               UpdateRecordSchedule  ( int       RecordId,
     141                                                           QString   Title,
     142                                                           QString   Subtitle,
     143                                                           QString   Description,
     144                                                           QString   Category,
     145                                                           QDateTime StartTime,
     146                                                           QDateTime EndTime,
     147                                                           QString   SeriesId,
     148                                                           QString   ProgramId,
     149                                                           int       ChanId,
     150                                                           QString   Station,
     151                                                           int       FindDay,
     152                                                           QTime     FindTime,
     153                                                           bool      Inactive,
     154                                                           uint      Season,
     155                                                           uint      Episode,
     156                                                           QString   Inetref,
    105157                                                           QString   Type,
    106158                                                           QString   SearchType,
    107159                                                           int       RecPriority,
  • mythtv/programs/mythbackend/services/dvr.cpp

    diff --git a/mythtv/programs/mythbackend/services/dvr.cpp b/mythtv/programs/mythbackend/services/dvr.cpp
    index 25df8b1..77ad332 100644
    a b  
    492492    return pPrograms;
    493493}
    494494
    495 int Dvr::AddRecordSchedule   ( int       chanid,
     495int Dvr::AddRecordSchedule   (
     496                               QString   sTitle,
     497                               QString   sSubtitle,
     498                               QString   sDescription,
     499                               QString   sCategory,
    496500                               QDateTime recstarttsRaw,
     501                               QDateTime recendtsRaw,
     502                               QString   sSeriesId,
     503                               QString   sProgramId,
     504                               int       nChanId,
     505                               QString   sStation,
     506                               int       nFindDay,
     507                               QTime     tFindTime,
    497508                               int       nParentId,
    498509                               bool      bInactive,
    499510                               uint      nSeason,
    500511                               uint      nEpisode,
    501512                               QString   sInetref,
    502                                int       nFindId,
    503513                               QString   sType,
    504514                               QString   sSearchType,
    505515                               int       nRecPriority,
     
    526536                               int       nTranscoder)
    527537{
    528538    QDateTime recstartts = recstarttsRaw.toUTC();
    529     RecordingInfo info(chanid, recstartts, false);
     539    QDateTime recendts = recendtsRaw.toUTC();
     540    RecordingInfo info(nChanId, recstartts, false);
    530541    RecordingRule *rule = info.GetRecordingRule();
    531542    // ^ rule is owned by info and deleted when it leaves scope
    532543
     
    542553    if (sDupIn.isEmpty())
    543554        sDupIn = "all";
    544555
    545     rule->m_title = info.GetTitle();
     556    if (sTitle.isEmpty())
     557        rule->m_title = info.GetTitle();
     558    else
     559        rule->m_title = sTitle;
     560
     561    if (sSubtitle.isEmpty())
     562        rule->m_subtitle = info.GetSubtitle();
     563    else
     564        rule->m_subtitle = sSubtitle;
     565
     566    if(sDescription.isEmpty())
     567        rule->m_description = info.GetDescription();
     568    else
     569        rule->m_description = sDescription;
     570
    546571    rule->m_type = recTypeFromString(sType);
    547572    rule->m_searchType = searchTypeFromString(sSearchType);
    548573    rule->m_dupMethod = dupMethodFromString(sDupMethod);
     
    560585    if (sPlayGroup.isEmpty())
    561586        sPlayGroup = "Default";
    562587
     588    if (sCategory.isEmpty())
     589        rule->m_category = info.GetCategory();
     590    else
     591        rule->m_category = sCategory;
     592
     593    if (sSeriesId.isEmpty())
     594        rule->m_seriesid = info.GetSeriesID();
     595    else
     596        rule->m_seriesid = sSeriesId;
     597
     598    if (sProgramId.isEmpty())
     599        rule->m_programid = info.GetProgramID();
     600    else
     601        rule->m_programid = sProgramId;
     602
     603    if (!sStation.isEmpty())
     604        rule->m_station = sStation;
     605
     606    rule->m_findday = nFindDay;
     607    rule->m_findtime = tFindTime;
     608
    563609    rule->m_recProfile = sRecProfile;
    564610    rule->m_recGroup = sRecGroup;
    565611    rule->m_storageGroup = sStorageGroup;
     
    571617    rule->m_season = nSeason;
    572618    rule->m_episode = nEpisode;
    573619    rule->m_inetref = sInetref;
    574     rule->m_findid = nFindId;
    575620
    576621    rule->m_recPriority = nRecPriority;
    577622    rule->m_prefInput = nPreferredInput;
     
    601646    return recid;
    602647}
    603648
     649bool Dvr::UpdateRecordSchedule ( int       nRecordId,
     650                                 QString   sTitle,
     651                                 QString   sSubtitle,
     652                                 QString   sDescription,
     653                                 QString   sCategory,
     654                                 QDateTime dStartTimeRaw,
     655                                 QDateTime dEndTimeRaw,
     656                                 QString   sSeriesId,
     657                                 QString   sProgramId,
     658                                 int       nChanId,
     659                                 QString   sStation,
     660                                 int       nFindDay,
     661                                 QTime     tFindTime,
     662                                 bool      bInactive,
     663                                 uint      nSeason,
     664                                 uint      nEpisode,
     665                                 QString   sInetref,
     666                                 QString   sType,
     667                                 QString   sSearchType,
     668                                 int       nRecPriority,
     669                                 uint      nPreferredInput,
     670                                 int       nStartOffset,
     671                                 int       nEndOffset,
     672                                 QString   sDupMethod,
     673                                 QString   sDupIn,
     674                                 uint      nFilter,
     675                                 QString   sRecProfile,
     676                                 QString   sRecGroup,
     677                                 QString   sStorageGroup,
     678                                 QString   sPlayGroup,
     679                                 bool      bAutoExpire,
     680                                 int       nMaxEpisodes,
     681                                 bool      bMaxNewest,
     682                                 bool      bAutoCommflag,
     683                                 bool      bAutoTranscode,
     684                                 bool      bAutoMetaLookup,
     685                                 bool      bAutoUserJob1,
     686                                 bool      bAutoUserJob2,
     687                                 bool      bAutoUserJob3,
     688                                 bool      bAutoUserJob4,
     689                                 int       nTranscoder)
     690{
     691    bool bResult = false;
     692
     693    if (nRecordId <= 0 )
     694        throw( QString("Record ID appears invalid."));
     695
     696    RecordingRule pRule;
     697    pRule.m_recordID = nRecordId;
     698    pRule.Load();
     699
     700    if (pRule.IsLoaded())
     701    {
     702        QDateTime recstartts = dStartTimeRaw.toUTC();
     703        QDateTime recendts = dEndTimeRaw.toUTC();
     704
     705        pRule.m_isInactive = bInactive;
     706        if (sType.isEmpty())
     707            sType = "single";
     708
     709        if (sSearchType.isEmpty())
     710            sSearchType = "none";
     711
     712        if (sDupMethod.isEmpty())
     713            sDupMethod = "subtitleanddescription";
     714
     715        if (sDupIn.isEmpty())
     716            sDupIn = "all";
     717
     718        pRule.m_type = recTypeFromString(sType);
     719        pRule.m_searchType = searchTypeFromString(sSearchType);
     720        pRule.m_dupMethod = dupMethodFromString(sDupMethod);
     721        pRule.m_dupIn = dupInFromString(sDupIn);
     722
     723        if (sRecProfile.isEmpty())
     724            sRecProfile = "Default";
     725
     726        if (sRecGroup.isEmpty())
     727            sRecGroup = "Default";
     728
     729        if (sStorageGroup.isEmpty())
     730            sStorageGroup = "Default";
     731
     732        if (sPlayGroup.isEmpty())
     733            sPlayGroup = "Default";
     734
     735
     736        if (!sTitle.isEmpty())
     737            pRule.m_title = sTitle;
     738
     739        if (!sSubtitle.isEmpty())
     740            pRule.m_subtitle = sSubtitle;
     741
     742        if(!sDescription.isEmpty())
     743            pRule.m_description = sDescription;
     744
     745
     746        if (!sCategory.isEmpty())
     747            pRule.m_category = sCategory;
     748
     749        if (!sSeriesId.isEmpty())
     750            pRule.m_seriesid = sSeriesId;
     751
     752        if (!sProgramId.isEmpty())
     753            pRule.m_programid = sProgramId;
     754
     755        if (!sStation.isEmpty())
     756            pRule.m_station = sStation;
     757
     758        pRule.m_startdate = recstartts.date();
     759        pRule.m_starttime = recstartts.time();
     760
     761        pRule.m_enddate = recendts.date();
     762        pRule.m_endtime = recendts.time();
     763
     764        pRule.m_findday = nFindDay;
     765        pRule.m_findtime = tFindTime;
     766
     767        pRule.m_recProfile = sRecProfile;
     768        pRule.m_recGroup = sRecGroup;
     769        pRule.m_storageGroup = sStorageGroup;
     770        pRule.m_playGroup = sPlayGroup;
     771
     772        pRule.m_isInactive = bInactive;
     773
     774        pRule.m_season = nSeason;
     775        pRule.m_episode = nEpisode;
     776        pRule.m_inetref = sInetref;
     777
     778        pRule.m_recPriority = nRecPriority;
     779        pRule.m_prefInput = nPreferredInput;
     780        pRule.m_startOffset = nStartOffset;
     781        pRule.m_endOffset = nEndOffset;
     782        pRule.m_filter = nFilter;
     783
     784        pRule.m_autoExpire = bAutoExpire;
     785        pRule.m_maxEpisodes = nMaxEpisodes;
     786        pRule.m_maxNewest = bMaxNewest;
     787
     788        pRule.m_autoCommFlag = bAutoCommflag;
     789        pRule.m_autoTranscode = bAutoTranscode;
     790        pRule.m_autoMetadataLookup = bAutoMetaLookup;
     791
     792        pRule.m_autoUserJob1 = bAutoUserJob1;
     793        pRule.m_autoUserJob2 = bAutoUserJob2;
     794        pRule.m_autoUserJob3 = bAutoUserJob3;
     795        pRule.m_autoUserJob4 = bAutoUserJob4;
     796
     797        pRule.m_transcoder = nTranscoder;
     798
     799        pRule.Save();
     800        bResult = true;
     801    }
     802    return bResult;
     803}
     804
    604805bool Dvr::RemoveRecordSchedule ( uint nRecordId )
    605806{
    606807    bool bResult = false;
  • mythtv/programs/mythbackend/services/dvr.h

    diff --git a/mythtv/programs/mythbackend/services/dvr.h b/mythtv/programs/mythbackend/services/dvr.h
    index 9e23e75..600e5bc 100644
    a b  
    7676
    7777        // Recording Rules
    7878
    79         int               AddRecordSchedule   ( int       ChanId,
     79        int               AddRecordSchedule   ( QString   Title,
     80                                                QString   Subtitle,
     81                                                QString   Description,
     82                                                QString   Category,
    8083                                                QDateTime StartTime,
     84                                                QDateTime EndTime,
     85                                                QString   SeriesId,
     86                                                QString   ProgramId,
     87                                                int       ChanId,
     88                                                QString   Station,
     89                                                int       FindDay,
     90                                                QTime     FindTime,
    8191                                                int       ParentId,
    8292                                                bool      Inactive,
    8393                                                uint      Season,
    8494                                                uint      Episode,
    8595                                                QString   Inetref,
    86                                                 int       FindId,
    8796                                                QString   Type,
    8897                                                QString   SearchType,
    8998                                                int       RecPriority,
     
    109118                                                bool      AutoUserJob4,
    110119                                                int       Transcoder);
    111120
     121        bool               UpdateRecordSchedule ( int       RecordId,
     122                                                          QString   Title,
     123                                                  QString   Subtitle,
     124                                                          QString   Description,
     125                                                          QString   Category,
     126                                                          QDateTime StartTime,
     127                                                          QDateTime EndTime,
     128                                                          QString   SeriesId,
     129                                                          QString   ProgramId,
     130                                                          int       ChanId,
     131                                                          QString   Station,
     132                                                          int       FindDay,
     133                                                          QTime     FindTime,
     134                                                          bool      Inactive,
     135                                                          uint      Season,
     136                                                          uint      Episode,
     137                                                          QString   Inetref,
     138                                                          QString   Type,
     139                                                          QString   SearchType,
     140                                                          int       RecPriority,
     141                                                          uint      PreferredInput,
     142                                                          int       StartOffset,
     143                                                          int       EndOffset,
     144                                                          QString   DupMethod,
     145                                                          QString   DupIn,
     146                                                          uint      Filter,
     147                                                          QString   RecProfile,
     148                                                          QString   RecGroup,
     149                                                          QString   StorageGroup,
     150                                                          QString   PlayGroup,
     151                                                          bool      AutoExpire,
     152                                                          int       MaxEpisodes,
     153                                                          bool      MaxNewest,
     154                                                          bool      AutoCommflag,
     155                                                          bool      AutoTranscode,
     156                                                          bool      AutoMetaLookup,
     157                                                          bool      AutoUserJob1,
     158                                                          bool      AutoUserJob2,
     159                                                          bool      AutoUserJob3,
     160                                                          bool      AutoUserJob4,
     161                                                          int       Transcoder);
     162
    112163        bool              RemoveRecordSchedule ( uint             RecordId   );
    113164
    114165        DTC::RecRuleList* GetRecordScheduleList( int              StartIndex,