public virtual async Task <OperationResult> ConvertWithSubtitles([FromBody] RecordingActionRequestDto input) { try { string licenseKey = LmsCompany.GetSetting <string>(LmsLicenseSettingNames.Mp4ServiceWithSubtitlesLicenseKey); if (string.IsNullOrWhiteSpace(licenseKey)) { throw new WarningMessageException("Can't find your MP4Service license. Contact administrator."); } Guid license; if (!Guid.TryParse(licenseKey, out license)) { throw new WarningMessageException("Invalid MP4Service license. Contact administrator."); } return(await Mp4ApiUtility.DoConvert(Mp4Client, license, MP4Service.Contract.Client.LicenseType.MP4WithSubtitles, input.RecordingId, null, Logger).ConfigureAwait(false)); } catch (Exception ex) { string errorMessage = GetOutputErrorMessage("ConvertWithSubtitles", ex); return(OperationResult.Error(errorMessage)); } }
public virtual async Task <OperationResultWithData <Mp4TaskStatusDto> > GetRecordingStatus([FromBody] RecordingActionRequestDto input) { try { Guid mp4; if (!Guid.TryParse(LmsCompany.GetSetting <string>(LmsLicenseSettingNames.Mp4ServiceLicenseKey), out mp4)) { mp4 = Guid.Empty; } Guid mp4Subtitles; if (!Guid.TryParse(LmsCompany.GetSetting <string>(LmsLicenseSettingNames.Mp4ServiceWithSubtitlesLicenseKey), out mp4Subtitles)) { mp4Subtitles = Guid.Empty; } if ((mp4 != Guid.Empty) || (mp4Subtitles != Guid.Empty)) { var mp4Client = IoC.Resolve <TaskClient>(); return(await Mp4ApiUtility.GetRecordingStatus(mp4Client, input.RecordingId, mp4, mp4Subtitles, _mp4LinkBuilder, _vttLinkBuilder, Logger)); } return(OperationResultWithData <Mp4TaskStatusDto> .Error("No MP4 license found")); } catch (Exception ex) { string errorMessage = GetOutputErrorMessage("MP4-GetRecordings", ex); return(OperationResultWithData <Mp4TaskStatusDto> .Error(errorMessage)); } }
public virtual async Task <OperationResultWithData <PagedResult <IMp4StatusContainer> > > GetAllMeetingRecordings([FromBody] RecordingsRequestDto input) { try { var param = Session.LtiSession.LtiParam; var ac = GetAdminProvider(); Func <IRoomTypeFactory> getRoomTypeFactory = () => new RoomTypeFactory(ac, (LmsMeetingType)input.LmsMeetingType, IoC.Resolve <API.AdobeConnect.ISeminarService>()); var publishOnly = !LmsCompany.AutoPublishRecordings && !new LmsRoleService(Settings).IsTeacher(param, LmsCompany) && LmsCompany.GetSetting <bool>(LmsLicenseSettingNames.HidePrivateRecordingsForStudents); var rawRecordings = RecordingsService.GetRecordings( LmsCompany, ac, Session.LmsCourseId, input.MeetingId, getRoomTypeFactory, input.SortBy, input.SortOder, input.Search, input.DateFrom, input.DateTo, (records) => { // TRICK: for API UNIR uses AutoPublishRecordings==true; So no access to Session for them. if (publishOnly) { return(records.Where(x => x.Published)); } return(records); }, input.Skip, input.Take); var smap = seminarMapConfig.CreateMapper(); var map = mapConfig.CreateMapper(); IEnumerable <RecordingWithMp4Dto> recordings = ((LmsMeetingType)input.LmsMeetingType == LmsMeetingType.Seminar) ? rawRecordings.Data.Select(x => smap.Map <SeminarRecordingWithMp4Dto>(x)) : rawRecordings.Data.Select(x => map.Map <RecordingWithMp4Dto>(x)); Guid mp4; if (!Guid.TryParse(LmsCompany.GetSetting <string>(LmsLicenseSettingNames.Mp4ServiceLicenseKey), out mp4)) { mp4 = Guid.Empty; } Guid mp4Subtitles; if (!Guid.TryParse(LmsCompany.GetSetting <string>(LmsLicenseSettingNames.Mp4ServiceWithSubtitlesLicenseKey), out mp4Subtitles)) { mp4Subtitles = Guid.Empty; } IEnumerable <IMp4StatusContainer> result = await Mp4ApiUtility.ProcessMp4(recordings.Cast <IMp4StatusContainer>().ToList(), mp4, mp4Subtitles, _mp4LinkBuilder, _vttLinkBuilder, Logger); var pagedResult = new PagedResult <IMp4StatusContainer> { Data = result, Skip = rawRecordings.Skip, Take = rawRecordings.Take, Total = rawRecordings.Total }; return(pagedResult.ToSuccessResult()); } catch (Exception ex) { string errorMessage = GetOutputErrorMessage("MP4-GetAllMeetingRecordings", ex); return(OperationResultWithData <PagedResult <IMp4StatusContainer> > .Error(errorMessage)); } }