mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-11-16 10:29:01 -07:00
update handling of deleted recording files
This commit is contained in:
parent
0a721915a7
commit
3c4b64f653
@ -529,6 +529,11 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||
"subs" :
|
||||
null;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(subtitleGroup))
|
||||
{
|
||||
AddSubtitles(state, subtitleStreams, builder);
|
||||
}
|
||||
|
||||
AppendPlaylist(builder, state, playlistUrl, totalBitrate, subtitleGroup);
|
||||
|
||||
if (EnableAdaptiveBitrateStreaming(state, isLiveStream))
|
||||
@ -548,11 +553,6 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||
AppendPlaylist(builder, state, variantUrl, newBitrate, subtitleGroup);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(subtitleGroup))
|
||||
{
|
||||
AddSubtitles(state, subtitleStreams, builder);
|
||||
}
|
||||
|
||||
return builder.ToString();
|
||||
}
|
||||
|
||||
@ -570,7 +570,7 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||
|
||||
foreach (var stream in subtitles)
|
||||
{
|
||||
const string format = "#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID=\"subs\",NAME=\"{0}\",DEFAULT={1},FORCED={2},URI=\"{3}\",LANGUAGE=\"{4}\"";
|
||||
const string format = "#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID=\"subs\",NAME=\"{0}\",DEFAULT={1},FORCED={2},AUTOSELECT=YES,URI=\"{3}\",LANGUAGE=\"{4}\"";
|
||||
|
||||
var name = stream.Language;
|
||||
|
||||
|
@ -1985,5 +1985,14 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
return LibraryManager.DeleteItem(this, options);
|
||||
}
|
||||
|
||||
public virtual Task OnFileDeleted()
|
||||
{
|
||||
// Remove from database
|
||||
return Delete(new DeleteOptions
|
||||
{
|
||||
DeleteFileLocation = false
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -390,5 +390,12 @@ namespace MediaBrowser.Controller.LiveTv
|
||||
/// <param name="options">The options.</param>
|
||||
/// <param name="user">The user.</param>
|
||||
void AddChannelInfo(BaseItemDto dto, LiveTvChannel channel, DtoOptions options, User user);
|
||||
|
||||
/// <summary>
|
||||
/// Called when [recording file deleted].
|
||||
/// </summary>
|
||||
/// <param name="recording">The recording.</param>
|
||||
/// <returns>Task.</returns>
|
||||
Task OnRecordingFileDeleted(ILiveTvRecording recording);
|
||||
}
|
||||
}
|
||||
|
@ -151,5 +151,10 @@ namespace MediaBrowser.Controller.LiveTv
|
||||
{
|
||||
return LiveTvManager.DeleteRecording(this);
|
||||
}
|
||||
|
||||
public override Task OnFileDeleted()
|
||||
{
|
||||
return LiveTvManager.OnRecordingFileDeleted(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -166,5 +166,10 @@ namespace MediaBrowser.Controller.LiveTv
|
||||
{
|
||||
return LiveTvManager.DeleteRecording(this);
|
||||
}
|
||||
|
||||
public override Task OnFileDeleted()
|
||||
{
|
||||
return LiveTvManager.OnRecordingFileDeleted(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -926,16 +926,11 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
||||
|
||||
var queryResult = _libraryManager.QueryItems(internalQuery);
|
||||
|
||||
var returnArray = queryResult.Items
|
||||
.Cast<LiveTvProgram>()
|
||||
.Select(i => new Tuple<BaseItemDto, string, string>(_dtoService.GetBaseItemDto(i, options, user), i.ServiceName, i.ExternalId))
|
||||
.ToArray();
|
||||
|
||||
await AddRecordingInfo(returnArray, cancellationToken).ConfigureAwait(false);
|
||||
var returnArray = _dtoService.GetBaseItemDtos(queryResult.Items, options, user).ToArray();
|
||||
|
||||
var result = new QueryResult<BaseItemDto>
|
||||
{
|
||||
Items = returnArray.Select(i => i.Item1).ToArray(),
|
||||
Items = returnArray,
|
||||
TotalRecordCount = queryResult.TotalRecordCount
|
||||
};
|
||||
|
||||
@ -1006,15 +1001,11 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
||||
|
||||
var user = _userManager.GetUserById(query.UserId);
|
||||
|
||||
var returnArray = internalResult.Items
|
||||
.Select(i => new Tuple<BaseItemDto, string, string>(_dtoService.GetBaseItemDto(i, options, user), i.ServiceName, i.ExternalId))
|
||||
.ToArray();
|
||||
|
||||
await AddRecordingInfo(returnArray, cancellationToken).ConfigureAwait(false);
|
||||
var returnArray = _dtoService.GetBaseItemDtos(internalResult.Items, options, user).ToArray();
|
||||
|
||||
var result = new QueryResult<BaseItemDto>
|
||||
{
|
||||
Items = returnArray.Select(i => i.Item1).ToArray(),
|
||||
Items = returnArray,
|
||||
TotalRecordCount = internalResult.TotalRecordCount
|
||||
};
|
||||
|
||||
@ -1635,18 +1626,11 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
||||
|
||||
var internalResult = await GetInternalRecordings(query, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
var tuples = internalResult.Items
|
||||
.Select(i => new Tuple<BaseItem, BaseItemDto>(i, _dtoService.GetBaseItemDto(i, options, user)))
|
||||
.ToArray();
|
||||
|
||||
if (user != null)
|
||||
{
|
||||
_dtoService.FillSyncInfo(tuples, new DtoOptions(), user);
|
||||
}
|
||||
var returnArray = _dtoService.GetBaseItemDtos(internalResult.Items, options, user).ToArray();
|
||||
|
||||
return new QueryResult<BaseItemDto>
|
||||
{
|
||||
Items = tuples.Select(i => i.Item2).ToArray(),
|
||||
Items = returnArray,
|
||||
TotalRecordCount = internalResult.TotalRecordCount
|
||||
};
|
||||
}
|
||||
@ -1707,6 +1691,19 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
||||
};
|
||||
}
|
||||
|
||||
public Task OnRecordingFileDeleted(ILiveTvRecording recording)
|
||||
{
|
||||
var service = GetService(recording);
|
||||
|
||||
if (service is EmbyTV.EmbyTV)
|
||||
{
|
||||
// We can't trust that we'll be able to direct stream it through emby server, no matter what the provider says
|
||||
return service.DeleteRecordingAsync(recording.ExternalId, CancellationToken.None);
|
||||
}
|
||||
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
|
||||
public async Task DeleteRecording(string recordingId)
|
||||
{
|
||||
var recording = await GetInternalRecording(recordingId, CancellationToken.None).ConfigureAwait(false);
|
||||
|
@ -239,11 +239,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||
typeof(Year).Name,
|
||||
typeof(Channel).Name,
|
||||
typeof(AggregateFolder).Name,
|
||||
typeof(CollectionFolder).Name,
|
||||
|
||||
// LiveTVManager handles recordings
|
||||
typeof(LiveTvAudioRecording).Name,
|
||||
typeof(LiveTvVideoRecording).Name
|
||||
typeof(CollectionFolder).Name
|
||||
}
|
||||
});
|
||||
|
||||
@ -279,11 +275,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||
|
||||
_logger.Info("Deleting item from database {0} because path no longer exists. type: {1} path: {2}", libraryItem.Name, libraryItem.GetType().Name, libraryItem.Path ?? string.Empty);
|
||||
|
||||
await libraryItem.Delete(new DeleteOptions
|
||||
{
|
||||
DeleteFileLocation = false
|
||||
|
||||
}).ConfigureAwait(false);
|
||||
await libraryItem.OnFileDeleted().ConfigureAwait(false);
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user