public static async Task <WebStringResult> ProcessAsync(IOwinContext context, string userName, string channelId) { if (!ServiceRegistration.IsRegistered <ITvProvider>()) { throw new BadRequestException("SwitchTVServerToChannelAndGetTimeshiftFilename: ITvProvider not found"); } if (userName == null) { throw new BadRequestException("SwitchTVServerToChannelAndGetTimeshiftFilename: userName is null"); } var item = await TVAccess.StartTimeshiftAsync(context, int.Parse(channelId), userName); if (item == null) { throw new BadRequestException("SwitchTVServerToChannelAndGetTimeshiftFilename: Couldn't start timeshifting"); } string resourcePathStr = item.PrimaryProviderResourcePath(); var resourcePath = ResourcePath.Deserialize(resourcePathStr); var stra = SlimTvResourceProvider.GetResourceAccessor(resourcePath.BasePathSegment.Path); string url = ""; if (stra is ILocalFsResourceAccessor) { url = ((ILocalFsResourceAccessor)stra).LocalFileSystemPath; } else { await TVAccess.StopTimeshiftAsync(context, int.Parse(channelId), userName); } return(new WebStringResult { Result = url }); }