Ticket #11495: mythtv-0.26-serviceapi-dvr-editschedule.2.patch

File mythtv-0.26-serviceapi-dvr-editschedule.2.patch, 13.1 KB (added by dev-team@…, 11 years ago)

renamed Edit -> Update

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

    diff --git a/mythtv/libs/libmythservicecontracts/services/dvrServices.h b/mythtv/libs/libmythservicecontracts/services/dvrServices.h
    index 2362940..e623ef6 100644
    a b  
    3838class SERVICE_PUBLIC DvrServices : public Service  //, public QScriptable ???
    3939{
    4040    Q_OBJECT
    41     Q_CLASSINFO( "version"    , "1.5" );
     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
     
    8889
    8990        virtual DTC::EncoderList*  GetEncoderList        ( ) = 0;
    9091
     92        virtual QStringList        GetRecGroupList       ( ) = 0;
     93
     94        virtual QStringList        GetTitleList          ( ) = 0;
     95
    9196        // Recording Rules
    9297
    9398        virtual int                AddRecordSchedule     ( int       ChanId,
     
    123128                                                           bool      AutoUserJob4,
    124129                                                           int       Transcoder        ) = 0;
    125130
     131        virtual bool               UpdateRecordSchedule  ( int       RecordId,
     132                                                           bool      Inactive,
     133                                                           uint      Season,
     134                                                           uint      Episode,
     135                                                           QString   Inetref,
     136                                                           int       FindId,
     137                                                           QString   Type,
     138                                                           QString   SearchType,
     139                                                           int       RecPriority,
     140                                                           uint      PreferredInput,
     141                                                           int       StartOffset,
     142                                                           int       EndOffset,
     143                                                           QString   DupMethod,
     144                                                           QString   DupIn,
     145                                                           uint      Filter,
     146                                                           QString   RecProfile,
     147                                                           QString   RecGroup,
     148                                                           QString   StorageGroup,
     149                                                           QString   PlayGroup,
     150                                                           bool      AutoExpire,
     151                                                           int       MaxEpisodes,
     152                                                           bool      MaxNewest,
     153                                                           bool      AutoCommflag,
     154                                                           bool      AutoTranscode,
     155                                                           bool      AutoMetaLookup,
     156                                                           bool      AutoUserJob1,
     157                                                           bool      AutoUserJob2,
     158                                                           bool      AutoUserJob3,
     159                                                           bool      AutoUserJob4,
     160                                                           int       Transcoder        ) = 0;
     161
    126162        virtual bool               RemoveRecordSchedule  ( uint             RecordId   ) = 0;
    127163
    128164        virtual DTC::RecRuleList*  GetRecordScheduleList ( int              StartIndex,
  • mythtv/programs/mythbackend/services/dvr.cpp

    diff --git a/mythtv/programs/mythbackend/services/dvr.cpp b/mythtv/programs/mythbackend/services/dvr.cpp
    index fd36f2f..a507c9c 100644
    a b  
    310310//
    311311/////////////////////////////////////////////////////////////////////////////
    312312
     313QStringList Dvr::GetRecGroupList()
     314{
     315    MSqlQuery query(MSqlQuery::InitCon());
     316
     317    QString querystr = QString("SELECT DISTINCT recgroup FROM record");
     318
     319    query.prepare(querystr);
     320
     321    QStringList result;
     322    if (!query.exec())
     323    {
     324        MythDB::DBError("GetRecGroupList record", query);
     325        return result;
     326    }
     327
     328    while (query.next())
     329        result << query.value(0).toString();
     330
     331    querystr = QString("SELECT DISTINCT recgroup FROM recorded");
     332
     333    query.prepare(querystr);
     334
     335    if (!query.exec())
     336    {
     337        MythDB::DBError("GetRecGroupList recorded", query);
     338        return result;
     339    }
     340
     341    while (query.next())
     342    {
     343        QString value = query.value(0).toString();
     344
     345        if (!result.contains(value))
     346            result << value;
     347    }
     348
     349    result.sort();
     350
     351    return result;
     352}
     353
     354/////////////////////////////////////////////////////////////////////////////
     355//
     356/////////////////////////////////////////////////////////////////////////////
     357
     358QStringList Dvr::GetTitleList()
     359{
     360    MSqlQuery query(MSqlQuery::InitCon());
     361
     362    QString querystr = QString("SELECT DISTINCT title FROM recorded");
     363
     364    query.prepare(querystr);
     365
     366    QStringList result;
     367    if (!query.exec())
     368    {
     369        MythDB::DBError("GetTitleList recorded", query);
     370        return result;
     371    }
     372
     373    while (query.next())
     374        result << query.value(0).toString();
     375
     376    result.sort();
     377
     378    return result;
     379}
     380
     381/////////////////////////////////////////////////////////////////////////////
     382//
     383/////////////////////////////////////////////////////////////////////////////
     384
    313385DTC::ProgramList* Dvr::GetUpcomingList( int  nStartIndex,
    314386                                        int  nCount,
    315387                                        bool bShowAll )
     
    529601    return recid;
    530602}
    531603
     604bool Dvr::UpdateRecordSchedule ( int       nRecordId,
     605                                 bool      bInactive,
     606                                 uint      nSeason,
     607                                 uint      nEpisode,
     608                                 QString   sInetref,
     609                                 int       nFindId,
     610                                 QString   sType,
     611                                 QString   sSearchType,
     612                                 int       nRecPriority,
     613                                 uint      nPreferredInput,
     614                                 int       nStartOffset,
     615                                 int       nEndOffset,
     616                                 QString   sDupMethod,
     617                                 QString   sDupIn,
     618                                 uint      nFilter,
     619                                 QString   sRecProfile,
     620                                 QString   sRecGroup,
     621                                 QString   sStorageGroup,
     622                                 QString   sPlayGroup,
     623                                 bool      bAutoExpire,
     624                                 int       nMaxEpisodes,
     625                                 bool      bMaxNewest,
     626                                 bool      bAutoCommflag,
     627                                 bool      bAutoTranscode,
     628                                 bool      bAutoMetaLookup,
     629                                 bool      bAutoUserJob1,
     630                                 bool      bAutoUserJob2,
     631                                 bool      bAutoUserJob3,
     632                                 bool      bAutoUserJob4,
     633                                 int       nTranscoder)
     634{
     635    bool bResult = false;
     636
     637    if (nRecordId <= 0 )
     638        throw( QString("Record ID appears invalid."));
     639
     640    RecordingRule pRule;
     641    pRule.m_recordID = nRecordId;
     642    pRule.Load();
     643
     644    if (pRule.IsLoaded())
     645    {
     646        pRule.m_isInactive = bInactive;
     647        if (sType.isEmpty())
     648            sType = "single";
     649
     650        if (sSearchType.isEmpty())
     651            sSearchType = "none";
     652
     653        if (sDupMethod.isEmpty())
     654            sDupMethod = "subtitleanddescription";
     655
     656        if (sDupIn.isEmpty())
     657            sDupIn = "all";
     658
     659        pRule.m_type = recTypeFromString(sType);
     660        pRule.m_searchType = searchTypeFromString(sSearchType);
     661        pRule.m_dupMethod = dupMethodFromString(sDupMethod);
     662        pRule.m_dupIn = dupInFromString(sDupIn);
     663
     664        if (sRecProfile.isEmpty())
     665            sRecProfile = "Default";
     666
     667        if (sRecGroup.isEmpty())
     668            sRecGroup = "Default";
     669
     670        if (sStorageGroup.isEmpty())
     671            sStorageGroup = "Default";
     672
     673        if (sPlayGroup.isEmpty())
     674            sPlayGroup = "Default";
     675
     676        pRule.m_recProfile = sRecProfile;
     677        pRule.m_recGroup = sRecGroup;
     678        pRule.m_storageGroup = sStorageGroup;
     679        pRule.m_playGroup = sPlayGroup;
     680
     681        pRule.m_isInactive = bInactive;
     682
     683        pRule.m_season = nSeason;
     684        pRule.m_episode = nEpisode;
     685        pRule.m_inetref = sInetref;
     686        pRule.m_findid = nFindId;
     687
     688        pRule.m_recPriority = nRecPriority;
     689        pRule.m_prefInput = nPreferredInput;
     690        pRule.m_startOffset = nStartOffset;
     691        pRule.m_endOffset = nEndOffset;
     692        pRule.m_filter = nFilter;
     693
     694        pRule.m_autoExpire = bAutoExpire;
     695        pRule.m_maxEpisodes = nMaxEpisodes;
     696        pRule.m_maxNewest = bMaxNewest;
     697
     698        pRule.m_autoCommFlag = bAutoCommflag;
     699        pRule.m_autoTranscode = bAutoTranscode;
     700        pRule.m_autoMetadataLookup = bAutoMetaLookup;
     701
     702        pRule.m_autoUserJob1 = bAutoUserJob1;
     703        pRule.m_autoUserJob2 = bAutoUserJob2;
     704        pRule.m_autoUserJob3 = bAutoUserJob3;
     705        pRule.m_autoUserJob4 = bAutoUserJob4;
     706
     707        pRule.m_transcoder = nTranscoder;
     708
     709        pRule.Save();
     710        bResult = true;
     711    }
     712    return bResult;
     713}
     714
    532715bool Dvr::RemoveRecordSchedule ( uint nRecordId )
    533716{
    534717    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 9f63fea..b04bd69 100644
    a b  
    6969
    7070        DTC::EncoderList* GetEncoderList      ( );
    7171
     72        QStringList       GetRecGroupList     ( );
     73
     74        QStringList       GetTitleList        ( );
     75
    7276        // Recording Rules
    7377
    7478        int               AddRecordSchedule   ( int       ChanId,
     
    104108                                                bool      AutoUserJob4,
    105109                                                int       Transcoder);
    106110
     111        bool               UpdateRecordSchedule ( int       RecordId,
     112                                                  bool      Inactive,
     113                                                  uint      Season,
     114                                                  uint      Episode,
     115                                                  QString   Inetref,
     116                                                  int       FindId,
     117                                                  QString   Type,
     118                                                  QString   SearchType,
     119                                                  int       RecPriority,
     120                                                  uint      PreferredInput,
     121                                                  int       StartOffset,
     122                                                  int       EndOffset,
     123                                                  QString   DupMethod,
     124                                                  QString   DupIn,
     125                                                  uint      Filter,
     126                                                  QString   RecProfile,
     127                                                  QString   RecGroup,
     128                                                  QString   StorageGroup,
     129                                                  QString   PlayGroup,
     130                                                  bool      AutoExpire,
     131                                                  int       MaxEpisodes,
     132                                                  bool      MaxNewest,
     133                                                  bool      AutoCommflag,
     134                                                  bool      AutoTranscode,
     135                                                  bool      AutoMetaLookup,
     136                                                  bool      AutoUserJob1,
     137                                                  bool      AutoUserJob2,
     138                                                  bool      AutoUserJob3,
     139                                                  bool      AutoUserJob4,
     140                                                  int       Transcoder);
     141
    107142        bool              RemoveRecordSchedule ( uint             RecordId   );
    108143
    109144        DTC::RecRuleList* GetRecordScheduleList( int              StartIndex,