Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TemplateId as an option for scheduling recordings #29

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -359,4 +359,5 @@ MigrationBackup/
.ionide/

# Fody - auto-generated XML schema
FodyWeavers.xsd
FodyWeavers.xsd
.idea
17 changes: 12 additions & 5 deletions PanoptoScheduleUploader.Core/RecorderScheduleCSVParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ public class RecorderScheduleCSVParser
private int endTimeIndex = 4;
private int presenterIndex = 5;
private int folderIndex = 6;
private int webcast = 7;
private int webcastIndex = 7;
private int templateIdIndex = 8;

/// <summary>
/// Initializes a new instance of the RecorderScheduleCSVParser class.
Expand Down Expand Up @@ -71,18 +72,23 @@ public IEnumerable<Recording> ExtractRecordings()
var startTime = DateTime.Parse(string.Format("{0} {1}", elements[dateIndex], elements[startTimeIndex]));
var endTime = DateTime.Parse(string.Format("{0} {1}", elements[dateIndex], elements[endTimeIndex]));
bool b = false;
if (elements[webcast] == "1")
if (elements[webcastIndex] == "1")
{
b = true;
}
else if (elements[webcast] == "0")
else if (elements[webcastIndex] == "0")
{
b = false;
}
else
{
bool.TryParse(elements[webcast], out b);
bool.TryParse(elements[webcastIndex], out b);
}

var templateId = elements.Length <= templateIdIndex
? (Guid?)null
: Guid.Parse(elements[templateIdIndex]);

recorderSchedules.Add(new Recording
{
Title = elements[titleIndex],
Expand All @@ -93,7 +99,8 @@ public IEnumerable<Recording> ExtractRecordings()
EndTime = endTime,
Presenter = elements[presenterIndex],
CourseTitle = elements[folderIndex],
RecordingDate = elements[dateIndex]
RecordingDate = elements[dateIndex],
TemplateId = templateId
});
}
}
Expand Down
2 changes: 2 additions & 0 deletions PanoptoScheduleUploader.Core/RecorderScheduleXmlElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public RecorderScheduleXmlElement(XmlNode recorderScheduleNode)
this.RecordingEndTime = recorderScheduleNode.SelectSingleNode("RecordingEndTime") != null ? recorderScheduleNode.SelectSingleNode("RecordingEndTime").InnerText : "";
this.Presenter = recorderScheduleNode.SelectSingleNode("Presenter") != null ? recorderScheduleNode.SelectSingleNode("Presenter").InnerText : "";
this.CourseTitle = recorderScheduleNode.SelectSingleNode("CourseTitle") != null ? recorderScheduleNode.SelectSingleNode("CourseTitle").InnerText : "";
this.TemplateId = recorderScheduleNode.SelectSingleNode("TemplateId") != null ? recorderScheduleNode.SelectSingleNode("TemplateId").InnerText : "";

if (!this.HasAllValues)
{
Expand All @@ -43,6 +44,7 @@ public RecorderScheduleXmlElement(XmlNode recorderScheduleNode)
public string RecordingEndTime { get; set; }
public string Presenter { get; set; }
public string CourseTitle { get; set; }
public string TemplateId { get; set; }

/// <summary>
/// Gets a value indicating whether the node contains values for all the expected properties on a RecorderSchedule node.
Expand Down
7 changes: 6 additions & 1 deletion PanoptoScheduleUploader.Core/RecorderScheduleXmlParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ public IEnumerable<Recording> ExtractRecordings()

var startTime = DateTime.Parse(string.Format("{0} {1}", recorderScheduleXmlElement.RecordingDate, recorderScheduleXmlElement.RecordingStartTime));
var endTime = DateTime.Parse(string.Format("{0} {1}", recorderScheduleXmlElement.RecordingDate, recorderScheduleXmlElement.RecordingEndTime));
var templateId = string.IsNullOrWhiteSpace(recorderScheduleXmlElement.TemplateId)
? (Guid?)null
: Guid.Parse(recorderScheduleXmlElement.TemplateId);

recorderSchedules.Add(new Recording
{
Title = recorderScheduleXmlElement.Class,
Expand All @@ -64,7 +68,8 @@ public IEnumerable<Recording> ExtractRecordings()
EndTime = endTime,
Presenter = recorderScheduleXmlElement.Presenter,
CourseTitle = recorderScheduleXmlElement.CourseTitle,
RecordingDate = recorderScheduleXmlElement.RecordingDate
RecordingDate = recorderScheduleXmlElement.RecordingDate,
TemplateId = templateId
});
}
}
Expand Down
1 change: 1 addition & 0 deletions PanoptoScheduleUploader.Core/Recording.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ public class Recording
public string Presenter { get; set; }
public string CourseTitle { get; set; }
public string RecordingDate { get; set; }
public Guid? TemplateId { get; set; }
}
}
6 changes: 3 additions & 3 deletions PanoptoScheduleUploader.Core/SetRecordingSchedules.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ public static IEnumerable<SchedulingResult> Execute(string username, string pass
count++;
Trace.WriteLine($"{count}: {recording.Title}");

RecorderSettings settings;
RecorderTemplatesWithSettings settings;
try
{
settings = remoteRecorderService.GetSettingsByRecorderName(recording.RecorderName);
settings = remoteRecorderService.GetSettingsByRecorderName(recording.RecorderName, recording.TemplateId);
}
catch (Exception)
{
Expand Down Expand Up @@ -102,7 +102,7 @@ public static IEnumerable<SchedulingResult> Execute(string username, string pass
throw new Exception(string.Format("The folder named '{0}' does not exist. This folder must exist as the default location for recordings.", defaultFolderName));
}
}
var result = remoteRecorderService.ScheduleRecording(recording.Title, folderId, recording.IsBroadCast, recording.StartTime, recording.EndTime, new List<RecorderSettings> { settings }, overwritten);
var result = remoteRecorderService.ScheduleRecording(recording.Title, folderId, recording.IsBroadCast, recording.StartTime, recording.EndTime, new List<RecorderTemplatesWithSettings> { settings }, overwritten);
if (result.SessionId != Guid.Empty)
{
sessionManager.UpdateSessionDescription(result.SessionId, "Presented by " + recording.Presenter);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public RemoteRecorderManagementWrapper(string user, string password)
this.dateTimeFormat = ConfigurationManager.AppSettings["dateTimeFormat"] ?? "dd-MMM-yyyy hh:mm tt";
}

public RecorderSettings GetSettingsByRecorderName(string name)
public RecorderTemplatesWithSettings GetSettingsByRecorderName(string name, Guid? templateId)
{
try
{
Expand All @@ -52,7 +52,11 @@ public RecorderSettings GetSettingsByRecorderName(string name)
return null;
}

return new RecorderSettings { RecorderId = recorder.Id };
return new RecorderTemplatesWithSettings
{
TemplateId = templateId,
RecorderSettings = new RecorderSettings { RecorderId = recorder.Id }
};
}
catch (Exception)
{
Expand Down Expand Up @@ -130,7 +134,7 @@ private void EnsureRecorders()
}
}

public SchedulingResult ScheduleRecording(string name, Guid folderId, bool isBroadcast, DateTime startTime, DateTime endTime, List<RecorderSettings> settings, bool overwritten)
public SchedulingResult ScheduleRecording(string name, Guid folderId, bool isBroadcast, DateTime startTime, DateTime endTime, List<RecorderTemplatesWithSettings> settings, bool overwritten)
{
if (!folderId.Equals(Guid.Empty))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,67 @@ protected void RaisePropertyChanged(string propertyName) {
}
}
}


[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
[System.Runtime.Serialization.DataContractAttribute(Name="RecorderTemplatesWithSettings", Namespace="http://schemas.datacontract.org/2004/07/Panopto.Server.Services.PublicAPI.V40")]
[System.SerializableAttribute()]
public partial class RecorderTemplatesWithSettings : object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged {
[System.NonSerializedAttribute()]
private System.Runtime.Serialization.ExtensionDataObject extensionDataField;

[global::System.ComponentModel.BrowsableAttribute(false)]
public System.Runtime.Serialization.ExtensionDataObject ExtensionData {
get {
return this.extensionDataField;
}
set {
this.extensionDataField = value;
}
}

[System.Runtime.Serialization.OptionalFieldAttribute()]
private System.Nullable<Guid> TemplateIdField;

[System.Runtime.Serialization.DataMemberAttribute()]
public System.Nullable<Guid> TemplateId {
get {
return this.TemplateIdField;
}
set {
if ((object.ReferenceEquals(this.TemplateIdField, value) != true)) {
this.TemplateIdField = value;
this.RaisePropertyChanged("TemplateId");
}
}
}

[System.Runtime.Serialization.OptionalFieldAttribute()]
private PanoptoScheduleUploader.Services.RemoteRecorderManagement.RecorderSettings RecorderSettingsField;

[System.Runtime.Serialization.DataMemberAttribute()]
public PanoptoScheduleUploader.Services.RemoteRecorderManagement.RecorderSettings RecorderSettings {
get {
return this.RecorderSettingsField;
}
set {
if ((object.ReferenceEquals(this.RecorderSettingsField, value) != true)) {
this.RecorderSettingsField = value;
this.RaisePropertyChanged("RecorderSettings");
}
}
}

public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

protected void RaisePropertyChanged(string propertyName) {
System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
if ((propertyChanged != null)) {
propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
}
}
}

[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
[System.Runtime.Serialization.DataContractAttribute(Name="ScheduledRecordingResult", Namespace="http://schemas.datacontract.org/2004/07/Panopto.Server.Services.PublicAPI.V42.Soa" +
Expand Down Expand Up @@ -797,6 +857,9 @@ public interface IRemoteRecorderManagement {
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IRemoteRecorderManagement/ScheduleRecording", ReplyAction="http://tempuri.org/IRemoteRecorderManagement/ScheduleRecordingResponse")]
PanoptoScheduleUploader.Services.RemoteRecorderManagement.ScheduledRecordingResult ScheduleRecording(PanoptoScheduleUploader.Services.RemoteRecorderManagement.AuthenticationInfo auth, string name, System.Guid folderId, bool isBroadcast, System.DateTime start, System.DateTime end, System.Collections.Generic.List<PanoptoScheduleUploader.Services.RemoteRecorderManagement.RecorderSettings> recorderSettings);


[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IRemoteRecorderManagement/ScheduleRecording", ReplyAction="http://tempuri.org/IRemoteRecorderManagement/ScheduleRecordingResponse")]
PanoptoScheduleUploader.Services.RemoteRecorderManagement.ScheduledRecordingResult ScheduleRecording(PanoptoScheduleUploader.Services.RemoteRecorderManagement.AuthenticationInfo auth, string name, System.Guid folderId, bool isBroadcast, System.DateTime start, System.DateTime end, System.Collections.Generic.List<PanoptoScheduleUploader.Services.RemoteRecorderManagement.RecorderTemplatesWithSettings> recorderTemplatesWithSettings);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IRemoteRecorderManagement/ScheduleRecurringRecording", ReplyAction="http://tempuri.org/IRemoteRecorderManagement/ScheduleRecurringRecordingResponse")]
PanoptoScheduleUploader.Services.RemoteRecorderManagement.ScheduledRecordingResult ScheduleRecurringRecording(PanoptoScheduleUploader.Services.RemoteRecorderManagement.AuthenticationInfo auth, System.Guid scheduledSessionId, System.Collections.Generic.List<System.DayOfWeek> daysOfWeek, System.DateTime end);

Expand All @@ -806,11 +869,17 @@ public interface IRemoteRecorderManagement {
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IRemoteRecorderManagement/UpdateRecordingSettings", ReplyAction="http://tempuri.org/IRemoteRecorderManagement/UpdateRecordingSettingsResponse")]
PanoptoScheduleUploader.Services.RemoteRecorderManagement.ScheduledRecordingResult UpdateRecordingSettings(PanoptoScheduleUploader.Services.RemoteRecorderManagement.AuthenticationInfo auth, System.Guid sessionId, System.Collections.Generic.List<PanoptoScheduleUploader.Services.RemoteRecorderManagement.RecorderSettings> recorderSettings);


[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IRemoteRecorderManagement/UpdateRecordingSettings", ReplyAction="http://tempuri.org/IRemoteRecorderManagement/UpdateRecordingSettingsResponse")]
PanoptoScheduleUploader.Services.RemoteRecorderManagement.ScheduledRecordingResult UpdateRecordingSettings(PanoptoScheduleUploader.Services.RemoteRecorderManagement.AuthenticationInfo auth, System.Guid sessionId, System.Collections.Generic.List<PanoptoScheduleUploader.Services.RemoteRecorderManagement.RecorderTemplatesWithSettings> recorderTemplatesWithSettings);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IRemoteRecorderManagement/GetDefaultFolderForRecorder", ReplyAction="http://tempuri.org/IRemoteRecorderManagement/GetDefaultFolderForRecorderResponse")]
System.Guid GetDefaultFolderForRecorder(PanoptoScheduleUploader.Services.RemoteRecorderManagement.AuthenticationInfo auth, System.Guid remoteRecorderId);

[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IRemoteRecorderManagement/GetMachineSidForRecorder", ReplyAction="http://tempuri.org/IRemoteRecorderManagement/GetMachineSidForRecorderResponse")]
string GetMachineSidForRecorder(PanoptoScheduleUploader.Services.RemoteRecorderManagement.AuthenticationInfo auth, System.Guid remoteRecorderId);

[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IRemoteRecorderManagement/GetRemoteRecorderTemplateIds", ReplyAction="http://tempuri.org/IRemoteRecorderManagement/GetRemoteRecorderTemplateIds")]
string GetRemoteRecorderTemplateIds(PanoptoScheduleUploader.Services.RemoteRecorderManagement.AuthenticationInfo auth, System.Guid remoteRecorderId);
}

[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
Expand Down Expand Up @@ -860,6 +929,11 @@ public PanoptoScheduleUploader.Services.RemoteRecorderManagement.ScheduledRecord
return base.Channel.ScheduleRecording(auth, name, folderId, isBroadcast, start, end, recorderSettings);
}


public PanoptoScheduleUploader.Services.RemoteRecorderManagement.ScheduledRecordingResult ScheduleRecording(PanoptoScheduleUploader.Services.RemoteRecorderManagement.AuthenticationInfo auth, string name, System.Guid folderId, bool isBroadcast, System.DateTime start, System.DateTime end, System.Collections.Generic.List<PanoptoScheduleUploader.Services.RemoteRecorderManagement.RecorderTemplatesWithSettings> recorderTemplatesWithSettings) {
return base.Channel.ScheduleRecording(auth, name, folderId, isBroadcast, start, end, recorderTemplatesWithSettings);
}

public PanoptoScheduleUploader.Services.RemoteRecorderManagement.ScheduledRecordingResult ScheduleRecurringRecording(PanoptoScheduleUploader.Services.RemoteRecorderManagement.AuthenticationInfo auth, System.Guid scheduledSessionId, System.Collections.Generic.List<System.DayOfWeek> daysOfWeek, System.DateTime end) {
return base.Channel.ScheduleRecurringRecording(auth, scheduledSessionId, daysOfWeek, end);
}
Expand All @@ -871,13 +945,21 @@ public PanoptoScheduleUploader.Services.RemoteRecorderManagement.ScheduledRecord
public PanoptoScheduleUploader.Services.RemoteRecorderManagement.ScheduledRecordingResult UpdateRecordingSettings(PanoptoScheduleUploader.Services.RemoteRecorderManagement.AuthenticationInfo auth, System.Guid sessionId, System.Collections.Generic.List<PanoptoScheduleUploader.Services.RemoteRecorderManagement.RecorderSettings> recorderSettings) {
return base.Channel.UpdateRecordingSettings(auth, sessionId, recorderSettings);
}


public PanoptoScheduleUploader.Services.RemoteRecorderManagement.ScheduledRecordingResult UpdateRecordingSettings(PanoptoScheduleUploader.Services.RemoteRecorderManagement.AuthenticationInfo auth, System.Guid sessionId, System.Collections.Generic.List<PanoptoScheduleUploader.Services.RemoteRecorderManagement.RecorderTemplatesWithSettings> recorderTemplatesWithSettings) {
return base.Channel.UpdateRecordingSettings(auth, sessionId, recorderTemplatesWithSettings);
}

public System.Guid GetDefaultFolderForRecorder(PanoptoScheduleUploader.Services.RemoteRecorderManagement.AuthenticationInfo auth, System.Guid remoteRecorderId) {
return base.Channel.GetDefaultFolderForRecorder(auth, remoteRecorderId);
}

public string GetMachineSidForRecorder(PanoptoScheduleUploader.Services.RemoteRecorderManagement.AuthenticationInfo auth, System.Guid remoteRecorderId) {
return base.Channel.GetMachineSidForRecorder(auth, remoteRecorderId);
}

public string GetRemoteRecorderTemplateIds(PanoptoScheduleUploader.Services.RemoteRecorderManagement.AuthenticationInfo auth, System.Guid remoteRecorderId) {
return base.Channel.GetRemoteRecorderTemplateIds(auth, remoteRecorderId);
}
}
}
Loading