Ticket #11495: mythtv-0.27-serviceapi-dvr-editschedule.4.patch
File mythtv-0.27-serviceapi-dvr-editschedule.4.patch, 35.6 KB (added by , 11 years ago) |
---|
-
mythtv/libs/libmythbase/mythversion.h
diff --git a/mythtv/libs/libmythbase/mythversion.h b/mythtv/libs/libmythbase/mythversion.h index 9ce25c3..498b870 100644
a b 12 12 /// Update this whenever the plug-in ABI changes. 13 13 /// Including changes in the libmythbase, libmyth, libmythtv, libmythav* and 14 14 /// libmythui class methods in exported headers. 15 #define MYTH_BINARY_VERSION "0.27.201304 26-1"15 #define MYTH_BINARY_VERSION "0.27.20130430-1" 16 16 17 17 /** \brief Increment this whenever the MythTV network protocol changes. 18 18 * -
mythtv/libs/libmythservicecontracts/datacontracts/recRule.h
diff --git a/mythtv/libs/libmythservicecontracts/datacontracts/recRule.h b/mythtv/libs/libmythservicecontracts/datacontracts/recRule.h index 7626607..820cfc8 100644
a b namespace DTC 15 15 class SERVICE_PUBLIC RecRule : public QObject 16 16 { 17 17 Q_OBJECT 18 Q_CLASSINFO( "version" , "1.1 0" );18 Q_CLASSINFO( "version" , "1.11" ); 19 19 20 20 Q_PROPERTY( int Id READ Id WRITE setId ) 21 21 Q_PROPERTY( int ParentId READ ParentId WRITE setParentId ) … … class SERVICE_PUBLIC RecRule : public QObject 36 36 37 37 Q_PROPERTY( int ChanId READ ChanId WRITE setChanId ) 38 38 Q_PROPERTY( QString CallSign READ CallSign WRITE setCallSign ) 39 Q_PROPERTY( int Day READ Day WRITE setDay ) 40 Q_PROPERTY( QTime Time READ Time WRITE setTime ) 41 Q_PROPERTY( int FindId READ FindId WRITE setFindId ) 42 39 Q_PROPERTY( int FindDay READ FindDay WRITE setFindDay ) 40 Q_PROPERTY( QTime FindTime READ FindTime WRITE setFindTime ) 43 41 Q_PROPERTY( QString Type READ Type WRITE setType ) 44 42 Q_PROPERTY( QString SearchType READ SearchType WRITE setSearchType ) 45 43 Q_PROPERTY( int RecPriority READ RecPriority WRITE setRecPriority ) … … class SERVICE_PUBLIC RecRule : public QObject 89 87 PROPERTYIMP ( QString , Inetref ) 90 88 PROPERTYIMP ( int , ChanId ) 91 89 PROPERTYIMP ( QString , CallSign ) 92 PROPERTYIMP ( int , Day ) 93 PROPERTYIMP ( QTime , Time ) 94 PROPERTYIMP ( int , FindId ) 90 PROPERTYIMP ( int , FindDay ) 91 PROPERTYIMP ( QTime , FindTime ) 95 92 PROPERTYIMP ( QString , Type ) 96 93 PROPERTYIMP ( QString , SearchType ) 97 94 PROPERTYIMP ( int , RecPriority ) … … class SERVICE_PUBLIC RecRule : public QObject 135 132 m_Season ( 0 ), 136 133 m_Episode ( 0 ), 137 134 m_ChanId ( 0 ), 138 m_Day ( 0 ), 139 m_FindId ( 0 ), 135 m_FindDay ( 0 ), 140 136 m_RecPriority ( 0 ), 141 137 m_PreferredInput( 0 ), 142 138 m_StartOffset ( 0 ), … … class SERVICE_PUBLIC RecRule : public QObject 180 176 m_Inetref = src.m_Inetref ; 181 177 m_ChanId = src.m_ChanId ; 182 178 m_CallSign = src.m_CallSign ; 183 m_Day = src.m_Day ; 184 m_Time = src.m_Time ; 185 m_FindId = src.m_FindId ; 179 m_FindDay = src.m_FindDay ; 180 m_FindTime = src.m_FindTime ; 186 181 m_Type = src.m_Type ; 187 182 m_SearchType = src.m_SearchType ; 188 183 m_RecPriority = src.m_RecPriority ; -
mythtv/libs/libmythservicecontracts/services/dvrServices.h
diff --git a/mythtv/libs/libmythservicecontracts/services/dvrServices.h b/mythtv/libs/libmythservicecontracts/services/dvrServices.h index d680375..e97cb88 100644
a b 38 38 class SERVICE_PUBLIC DvrServices : public Service //, public QScriptable ??? 39 39 { 40 40 Q_OBJECT 41 Q_CLASSINFO( "version" , "1. 6" );41 Q_CLASSINFO( "version" , "1.7" ); 42 42 Q_CLASSINFO( "RemoveRecordedItem_Method", "POST" ) 43 43 Q_CLASSINFO( "AddRecordSchedule_Method", "POST" ) 44 44 Q_CLASSINFO( "RemoveRecordSchedule_Method", "POST" ) 45 45 Q_CLASSINFO( "EnableRecordSchedule_Method", "POST" ) 46 46 Q_CLASSINFO( "DisableRecordSchedule_Method", "POST" ) 47 Q_CLASSINFO( "UpdateRecordSchedule_Method", "POST" ) 47 48 48 49 public: 49 50 … … class SERVICE_PUBLIC DvrServices : public Service //, public QScriptable ??? 94 95 95 96 // Recording Rules 96 97 97 virtual int AddRecordSchedule ( int ChanId, 98 virtual int AddRecordSchedule ( QString Title, 99 QString Subtitle, 100 QString Description, 101 QString Category, 98 102 QDateTime StartTime, 103 QDateTime EndTime, 104 QString SeriesId, 105 QString ProgramId, 106 int ChanId, 107 QString Station, 108 int FindDay, 109 QTime FindTime, 99 110 int ParentId, 100 111 bool Inactive, 101 112 uint Season, 102 113 uint Episode, 103 114 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, 105 157 QString Type, 106 158 QString SearchType, 107 159 int RecPriority, … … class SERVICE_PUBLIC DvrServices : public Service //, public QScriptable ??? 132 184 virtual DTC::RecRuleList* GetRecordScheduleList ( int StartIndex, 133 185 int Count ) = 0; 134 186 135 virtual DTC::RecRule* GetRecordSchedule ( uint RecordId ) = 0; 187 virtual DTC::RecRule* GetRecordSchedule ( uint RecordId, 188 QString Template, 189 int ChanId, 190 QDateTime StartTime, 191 bool MakeOverride ) = 0; 136 192 137 193 virtual bool EnableRecordSchedule ( uint RecordId ) = 0; 138 194 -
mythtv/libs/libmythtv/recordingrule.cpp
diff --git a/mythtv/libs/libmythtv/recordingrule.cpp b/mythtv/libs/libmythtv/recordingrule.cpp index 3bb1163..ead947e 100644
a b QStringList RecordingRule::GetTemplateNames(void) 812 812 813 813 return result; 814 814 } 815 816 bool RecordingRule::IsValid(QString &msg) 817 { 818 bool isOverride = false; 819 switch (m_type) 820 { 821 case kSingleRecord: 822 case kDailyRecord: 823 case kAllRecord: 824 case kWeeklyRecord: 825 case kOneRecord: 826 case kTemplateRecord: 827 break; 828 case kOverrideRecord: 829 case kDontRecord: 830 isOverride = true; 831 case kNotRecording: 832 default: 833 msg = QString("Invalid recording type."); 834 return false; 835 } 836 837 bool isNormal = false; 838 bool isSearch = false; 839 bool isManual = false; 840 switch (m_searchType) 841 { 842 case kNoSearch: 843 isNormal = true; 844 break; 845 case kPowerSearch: 846 case kTitleSearch: 847 case kKeywordSearch: 848 case kPeopleSearch: 849 isSearch = true; 850 break; 851 case kManualSearch: 852 isManual = true; 853 break; 854 default: 855 msg = QString("Invalid search type."); 856 return false; 857 } 858 859 if ((isNormal && (m_type == kDailyRecord || m_type == kWeeklyRecord)) || 860 (isSearch && (m_type != kDailyRecord && m_type != kWeeklyRecord && 861 m_type != kOneRecord && m_type != kAllRecord)) || 862 (isManual && (m_type != kDailyRecord && m_type != kWeeklyRecord && 863 m_type != kSingleRecord && m_type != kAllRecord))) 864 { 865 msg = QString("Invalid recording type/search type."); 866 return false; 867 } 868 869 if ((m_parentRecID && !isOverride) || 870 (!m_parentRecID && isOverride)) 871 { 872 msg = QString("Invalid parentID/override."); 873 return false; 874 } 875 876 if (m_title.isEmpty()) 877 { 878 msg = QString("Invalid title."); 879 return false; 880 } 881 882 if (m_searchType == kPowerSearch) 883 { 884 MSqlQuery query(MSqlQuery::InitCon()); 885 query.prepare(QString("SELECT NULL FROM (program, channel) " 886 "%1 WHERE %2") 887 .arg(m_subtitle).arg(m_description)); 888 if (m_description.contains(';') || !query.exec()) 889 { 890 msg = QString("Invalid custom search values."); 891 return false; 892 } 893 } 894 else if (isSearch) 895 { 896 if (m_description.isEmpty()) 897 { 898 msg = QString("Invalid search value."); 899 return false; 900 } 901 } 902 903 if (!isSearch) 904 { 905 if (!m_startdate.isValid() || !m_starttime.isValid() || 906 !m_enddate.isValid() || !m_endtime.isValid()) 907 { 908 msg = QString("Invalid start/end date/time."); 909 return false; 910 } 911 int secsto = QDateTime(m_startdate, m_starttime) 912 .secsTo(QDateTime(m_enddate, m_endtime)); 913 if (secsto <= 0 || secsto > (8 * 3600)) 914 { 915 msg = QString("Invalid duration."); 916 return false; 917 } 918 919 if (!m_channelid || m_station.isEmpty()) 920 { 921 msg = QString("Invalid channel."); 922 return false; 923 } 924 } 925 926 if (m_findday < 0 || m_findday > 6 || !m_findtime.isValid()) 927 { 928 msg = QString("Invalid find values."); 929 return false; 930 } 931 932 if (m_recPriority < -99 || m_recPriority > 99) 933 { 934 msg = QString("Invalid priority."); 935 return false; 936 } 937 938 if (m_startOffset < -480 || m_startOffset > 480 || 939 m_endOffset < -480 || m_endOffset > 480) 940 { 941 msg = QString("Invalid start/end offset."); 942 return false; 943 } 944 945 if (m_prefInput < 0) 946 { 947 msg = QString("Invalid preferred input."); 948 return false; 949 } 950 951 if (m_filter & (~0 << kNumFilters)) 952 { 953 msg = QString("Invalid filter value."); 954 return false; 955 } 956 957 if (m_recProfile.isEmpty() || m_recGroup.isEmpty() || 958 m_storageGroup.isEmpty() || m_playGroup.isEmpty()) 959 { 960 msg = QString("Invalid group value."); 961 return false; 962 } 963 964 if (m_maxEpisodes < 0) 965 { 966 msg = QString("Invalid max episodes value."); 967 return false; 968 } 969 970 if (m_dupIn & ~(kDupsInAll | kDupsNewEpi)) 971 { 972 msg = QString("Invalid duplicate scope."); 973 return false; 974 } 975 976 if (m_dupMethod & ~(kDupCheckNone | kDupCheckSub | 977 kDupCheckDesc | kDupCheckSubThenDesc)) 978 { 979 msg = QString("Invalid duplicate method."); 980 return false; 981 } 982 983 if (m_transcoder < 0) 984 { 985 msg = QString("Invalid transcoder value."); 986 return false; 987 } 988 989 return true; 990 } -
mythtv/libs/libmythtv/recordingrule.h
diff --git a/mythtv/libs/libmythtv/recordingrule.h b/mythtv/libs/libmythtv/recordingrule.h index 176b172..b45e3c6 100644
a b class MTV_PUBLIC RecordingRule 59 59 AutoExpireType GetAutoExpire(void) const 60 60 { return m_autoExpire ? kNormalAutoExpire : kDisableAutoExpire; } 61 61 62 bool IsValid(QString &text); 63 62 64 static QString SearchTypeToString(const RecSearchType searchType); 63 65 static QStringList GetTemplateNames(void); 64 66 -
mythtv/programs/mythbackend/services/dvr.cpp
diff --git a/mythtv/programs/mythbackend/services/dvr.cpp b/mythtv/programs/mythbackend/services/dvr.cpp index 25df8b1..8d0bc5d 100644
a b DTC::ProgramList* Dvr::GetConflictList( int nStartIndex, 492 492 return pPrograms; 493 493 } 494 494 495 int Dvr::AddRecordSchedule ( int chanid, 495 int Dvr::AddRecordSchedule ( 496 QString sTitle, 497 QString sSubtitle, 498 QString sDescription, 499 QString sCategory, 496 500 QDateTime recstarttsRaw, 501 QDateTime recendtsRaw, 502 QString sSeriesId, 503 QString sProgramId, 504 int nChanId, 505 QString sStation, 506 int nFindDay, 507 QTime tFindTime, 497 508 int nParentId, 498 509 bool bInactive, 499 510 uint nSeason, 500 511 uint nEpisode, 501 512 QString sInetref, 502 int nFindId,503 513 QString sType, 504 514 QString sSearchType, 505 515 int nRecPriority, … … int Dvr::AddRecordSchedule ( int chanid, 526 536 int nTranscoder) 527 537 { 528 538 QDateTime recstartts = recstarttsRaw.toUTC(); 529 RecordingInfo info(chanid, recstartts, false);530 RecordingRule *rule = info.GetRecordingRule();531 // ^ rule is owned by info and deleted when it leaves scope539 QDateTime recendts = recendtsRaw.toUTC(); 540 RecordingRule rule; 541 rule.LoadTemplate("Default"); 532 542 533 543 if (sType.isEmpty()) 534 544 sType = "single"; … … int Dvr::AddRecordSchedule ( int chanid, 542 552 if (sDupIn.isEmpty()) 543 553 sDupIn = "all"; 544 554 545 rule->m_title = info.GetTitle(); 546 rule->m_type = recTypeFromString(sType); 547 rule->m_searchType = searchTypeFromString(sSearchType); 548 rule->m_dupMethod = dupMethodFromString(sDupMethod); 549 rule->m_dupIn = dupInFromString(sDupIn); 555 rule.m_title = sTitle; 556 rule.m_subtitle = sSubtitle; 557 rule.m_description = sDescription; 558 559 rule.m_type = recTypeFromString(sType); 560 rule.m_searchType = searchTypeFromString(sSearchType); 561 rule.m_dupMethod = dupMethodFromString(sDupMethod); 562 rule.m_dupIn = dupInFromString(sDupIn); 550 563 551 564 if (sRecProfile.isEmpty()) 552 565 sRecProfile = "Default"; … … int Dvr::AddRecordSchedule ( int chanid, 560 573 if (sPlayGroup.isEmpty()) 561 574 sPlayGroup = "Default"; 562 575 563 rule->m_recProfile = sRecProfile; 564 rule->m_recGroup = sRecGroup; 565 rule->m_storageGroup = sStorageGroup; 566 rule->m_playGroup = sPlayGroup; 576 rule.m_category = sCategory; 577 rule.m_seriesid = sSeriesId; 578 rule.m_programid = sProgramId; 579 580 rule.m_station = sStation; 581 582 rule.m_findday = nFindDay; 583 rule.m_findtime = tFindTime; 584 585 rule.m_recProfile = sRecProfile; 586 rule.m_recGroup = sRecGroup; 587 rule.m_storageGroup = sStorageGroup; 588 rule.m_playGroup = sPlayGroup; 567 589 568 rule ->m_parentRecID = nParentId;569 rule ->m_isInactive = bInactive;590 rule.m_parentRecID = nParentId; 591 rule.m_isInactive = bInactive; 570 592 571 rule->m_season = nSeason; 572 rule->m_episode = nEpisode; 573 rule->m_inetref = sInetref; 574 rule->m_findid = nFindId; 593 rule.m_season = nSeason; 594 rule.m_episode = nEpisode; 595 rule.m_inetref = sInetref; 575 596 576 rule ->m_recPriority = nRecPriority;577 rule ->m_prefInput = nPreferredInput;578 rule ->m_startOffset = nStartOffset;579 rule ->m_endOffset = nEndOffset;580 rule ->m_filter = nFilter;597 rule.m_recPriority = nRecPriority; 598 rule.m_prefInput = nPreferredInput; 599 rule.m_startOffset = nStartOffset; 600 rule.m_endOffset = nEndOffset; 601 rule.m_filter = nFilter; 581 602 582 rule ->m_autoExpire = bAutoExpire;583 rule ->m_maxEpisodes = nMaxEpisodes;584 rule ->m_maxNewest = bMaxNewest;603 rule.m_autoExpire = bAutoExpire; 604 rule.m_maxEpisodes = nMaxEpisodes; 605 rule.m_maxNewest = bMaxNewest; 585 606 586 rule ->m_autoCommFlag = bAutoCommflag;587 rule ->m_autoTranscode = bAutoTranscode;588 rule ->m_autoMetadataLookup = bAutoMetaLookup;607 rule.m_autoCommFlag = bAutoCommflag; 608 rule.m_autoTranscode = bAutoTranscode; 609 rule.m_autoMetadataLookup = bAutoMetaLookup; 589 610 590 rule ->m_autoUserJob1 = bAutoUserJob1;591 rule ->m_autoUserJob2 = bAutoUserJob2;592 rule ->m_autoUserJob3 = bAutoUserJob3;593 rule ->m_autoUserJob4 = bAutoUserJob4;611 rule.m_autoUserJob1 = bAutoUserJob1; 612 rule.m_autoUserJob2 = bAutoUserJob2; 613 rule.m_autoUserJob3 = bAutoUserJob3; 614 rule.m_autoUserJob4 = bAutoUserJob4; 594 615 595 rule ->m_transcoder = nTranscoder;616 rule.m_transcoder = nTranscoder; 596 617 597 rule->Save(); 618 QString msg; 619 if (!rule.IsValid(msg)) 620 throw msg; 598 621 599 int recid = rule->m_recordID; 622 rule.Save(); 623 624 int recid = rule.m_recordID; 600 625 601 626 return recid; 602 627 } 603 628 629 bool Dvr::UpdateRecordSchedule ( int nRecordId, 630 QString sTitle, 631 QString sSubtitle, 632 QString sDescription, 633 QString sCategory, 634 QDateTime dStartTimeRaw, 635 QDateTime dEndTimeRaw, 636 QString sSeriesId, 637 QString sProgramId, 638 int nChanId, 639 QString sStation, 640 int nFindDay, 641 QTime tFindTime, 642 bool bInactive, 643 uint nSeason, 644 uint nEpisode, 645 QString sInetref, 646 QString sType, 647 QString sSearchType, 648 int nRecPriority, 649 uint nPreferredInput, 650 int nStartOffset, 651 int nEndOffset, 652 QString sDupMethod, 653 QString sDupIn, 654 uint nFilter, 655 QString sRecProfile, 656 QString sRecGroup, 657 QString sStorageGroup, 658 QString sPlayGroup, 659 bool bAutoExpire, 660 int nMaxEpisodes, 661 bool bMaxNewest, 662 bool bAutoCommflag, 663 bool bAutoTranscode, 664 bool bAutoMetaLookup, 665 bool bAutoUserJob1, 666 bool bAutoUserJob2, 667 bool bAutoUserJob3, 668 bool bAutoUserJob4, 669 int nTranscoder) 670 { 671 if (nRecordId <= 0 ) 672 throw QString("Record ID is invalid."); 673 674 RecordingRule pRule; 675 pRule.m_recordID = nRecordId; 676 pRule.Load(); 677 678 if (!pRule.IsLoaded()) 679 throw QString("Record ID does not exist."); 680 681 QDateTime recstartts = dStartTimeRaw.toUTC(); 682 QDateTime recendts = dEndTimeRaw.toUTC(); 683 684 pRule.m_isInactive = bInactive; 685 if (sType.isEmpty()) 686 sType = "single"; 687 688 if (sSearchType.isEmpty()) 689 sSearchType = "none"; 690 691 if (sDupMethod.isEmpty()) 692 sDupMethod = "subtitleanddescription"; 693 694 if (sDupIn.isEmpty()) 695 sDupIn = "all"; 696 697 pRule.m_type = recTypeFromString(sType); 698 pRule.m_searchType = searchTypeFromString(sSearchType); 699 pRule.m_dupMethod = dupMethodFromString(sDupMethod); 700 pRule.m_dupIn = dupInFromString(sDupIn); 701 702 if (sRecProfile.isEmpty()) 703 sRecProfile = "Default"; 704 705 if (sRecGroup.isEmpty()) 706 sRecGroup = "Default"; 707 708 if (sStorageGroup.isEmpty()) 709 sStorageGroup = "Default"; 710 711 if (sPlayGroup.isEmpty()) 712 sPlayGroup = "Default"; 713 714 if (!sTitle.isEmpty()) 715 pRule.m_title = sTitle; 716 717 if (!sSubtitle.isEmpty()) 718 pRule.m_subtitle = sSubtitle; 719 720 if(!sDescription.isEmpty()) 721 pRule.m_description = sDescription; 722 723 if (!sCategory.isEmpty()) 724 pRule.m_category = sCategory; 725 726 if (!sSeriesId.isEmpty()) 727 pRule.m_seriesid = sSeriesId; 728 729 if (!sProgramId.isEmpty()) 730 pRule.m_programid = sProgramId; 731 732 if (!sStation.isEmpty()) 733 pRule.m_station = sStation; 734 735 pRule.m_startdate = recstartts.date(); 736 pRule.m_starttime = recstartts.time(); 737 738 pRule.m_enddate = recendts.date(); 739 pRule.m_endtime = recendts.time(); 740 741 pRule.m_findday = nFindDay; 742 pRule.m_findtime = tFindTime; 743 744 pRule.m_recProfile = sRecProfile; 745 pRule.m_recGroup = sRecGroup; 746 pRule.m_storageGroup = sStorageGroup; 747 pRule.m_playGroup = sPlayGroup; 748 749 pRule.m_isInactive = bInactive; 750 751 pRule.m_season = nSeason; 752 pRule.m_episode = nEpisode; 753 pRule.m_inetref = sInetref; 754 755 pRule.m_recPriority = nRecPriority; 756 pRule.m_prefInput = nPreferredInput; 757 pRule.m_startOffset = nStartOffset; 758 pRule.m_endOffset = nEndOffset; 759 pRule.m_filter = nFilter; 760 761 pRule.m_autoExpire = bAutoExpire; 762 pRule.m_maxEpisodes = nMaxEpisodes; 763 pRule.m_maxNewest = bMaxNewest; 764 765 pRule.m_autoCommFlag = bAutoCommflag; 766 pRule.m_autoTranscode = bAutoTranscode; 767 pRule.m_autoMetadataLookup = bAutoMetaLookup; 768 769 pRule.m_autoUserJob1 = bAutoUserJob1; 770 pRule.m_autoUserJob2 = bAutoUserJob2; 771 pRule.m_autoUserJob3 = bAutoUserJob3; 772 pRule.m_autoUserJob4 = bAutoUserJob4; 773 774 pRule.m_transcoder = nTranscoder; 775 776 QString msg; 777 if (!pRule.IsValid(msg)) 778 throw msg; 779 780 pRule.Save(); 781 782 return true; 783 } 784 604 785 bool Dvr::RemoveRecordSchedule ( uint nRecordId ) 605 786 { 606 787 bool bResult = false; 607 788 608 789 if (nRecordId <= 0 ) 609 throw ( QString("Record ID appears invalid."));790 throw QString("Record ID does not exist."); 610 791 611 792 RecordingRule pRule; 612 793 pRule.m_recordID = nRecordId; … … DTC::RecRuleList* Dvr::GetRecordScheduleList( int nStartIndex, 662 843 return pRecRules; 663 844 } 664 845 665 DTC::RecRule* Dvr::GetRecordSchedule( uint nRecordId ) 846 DTC::RecRule* Dvr::GetRecordSchedule( uint nRecordId, 847 QString sTemplate, 848 int nChanId, 849 QDateTime dStartTimeRaw, 850 bool bMakeOverride ) 666 851 { 667 if (nRecordId < =0 )668 throw ( QString("Record ID appears invalid."));852 if (nRecordId < 0 ) 853 throw QString("Record ID is invalid."); 669 854 670 855 RecordingRule rule; 671 rule.m_recordID = nRecordId; 672 rule.Load(); 856 857 if (nRecordId > 0) 858 { 859 rule.m_recordID = nRecordId; 860 if (!rule.Load()) 861 throw QString("Record ID does not exist."); 862 } 863 else if (!sTemplate.isEmpty()) 864 { 865 if (!rule.LoadTemplate(sTemplate)) 866 throw QString("Template does not exist."); 867 } 868 else if (nChanId > 0 && dStartTimeRaw.isValid()) 869 { 870 RecordingInfo::LoadStatus status; 871 RecordingInfo info(nChanId, dStartTimeRaw, false, 0, &status); 872 if (status != RecordingInfo::kFoundProgram) 873 throw QString("Program does not exist."); 874 RecordingRule *pRule = info.GetRecordingRule(); 875 if (bMakeOverride && rule.m_type != kSingleRecord && 876 rule.m_type != kOverrideRecord && rule.m_type != kDontRecord) 877 pRule->MakeOverride(); 878 rule = *pRule; 879 } 880 else 881 { 882 throw QString("Invalid request."); 883 } 673 884 674 885 DTC::RecRule *pRecRule = new DTC::RecRule(); 675 886 FillRecRuleInfo( pRecRule, &rule ); … … bool Dvr::EnableRecordSchedule ( uint nRecordId ) 682 893 bool bResult = false; 683 894 684 895 if (nRecordId <= 0 ) 685 throw ( QString("Record ID appears invalid."));896 throw QString("Record ID appears invalid."); 686 897 687 898 RecordingRule pRule; 688 899 pRule.m_recordID = nRecordId; … … bool Dvr::DisableRecordSchedule( uint nRecordId ) 703 914 bool bResult = false; 704 915 705 916 if (nRecordId <= 0 ) 706 throw ( QString("Record ID appears invalid."));917 throw QString("Record ID appears invalid."); 707 918 708 919 RecordingRule pRule; 709 920 pRule.m_recordID = nRecordId; -
mythtv/programs/mythbackend/services/dvr.h
diff --git a/mythtv/programs/mythbackend/services/dvr.h b/mythtv/programs/mythbackend/services/dvr.h index 9e23e75..42a172b 100644
a b class Dvr : public DvrServices 76 76 77 77 // Recording Rules 78 78 79 int AddRecordSchedule ( int ChanId, 79 int AddRecordSchedule ( QString Title, 80 QString Subtitle, 81 QString Description, 82 QString Category, 80 83 QDateTime StartTime, 84 QDateTime EndTime, 85 QString SeriesId, 86 QString ProgramId, 87 int ChanId, 88 QString Station, 89 int FindDay, 90 QTime FindTime, 81 91 int ParentId, 82 92 bool Inactive, 83 93 uint Season, 84 94 uint Episode, 85 95 QString Inetref, 86 int FindId,87 96 QString Type, 88 97 QString SearchType, 89 98 int RecPriority, … … class Dvr : public DvrServices 109 118 bool AutoUserJob4, 110 119 int Transcoder); 111 120 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 112 163 bool RemoveRecordSchedule ( uint RecordId ); 113 164 114 165 DTC::RecRuleList* GetRecordScheduleList( int StartIndex, 115 166 int Count ); 116 167 117 DTC::RecRule* GetRecordSchedule ( uint RecordId ); 168 DTC::RecRule* GetRecordSchedule ( uint RecordId, 169 QString Template, 170 int ChanId, 171 QDateTime StartTime, 172 bool MakeOverride ); 118 173 119 174 bool EnableRecordSchedule ( uint RecordId ); 120 175 -
mythtv/programs/mythbackend/services/serviceUtil.cpp
diff --git a/mythtv/programs/mythbackend/services/serviceUtil.cpp b/mythtv/programs/mythbackend/services/serviceUtil.cpp index 9a2a799..0941e46 100644
a b void FillRecRuleInfo( DTC::RecRule *pRecRule, 191 191 pRecRule->setInetref ( pRule->m_inetref ); 192 192 pRecRule->setChanId ( pRule->m_channelid ); 193 193 pRecRule->setCallSign ( pRule->m_station ); 194 pRecRule->setDay ( pRule->m_findday ); 195 pRecRule->setTime ( pRule->m_findtime ); 196 pRecRule->setFindId ( pRule->m_findid ); 194 pRecRule->setFindDay ( pRule->m_findday ); 195 pRecRule->setFindTime ( pRule->m_findtime ); 197 196 pRecRule->setType ( toRawString(pRule->m_type) ); 198 197 pRecRule->setSearchType ( toRawString(pRule->m_searchType)); 199 198 pRecRule->setRecPriority ( pRule->m_recPriority );