Merge pull request #4891 from Artiume/patch-1
This commit is contained in:
commit
eb084f9021
|
@ -14,6 +14,7 @@ using MediaBrowser.Controller.Persistence;
|
||||||
using MediaBrowser.Model.Dto;
|
using MediaBrowser.Model.Dto;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using Book = MediaBrowser.Controller.Entities.Book;
|
using Book = MediaBrowser.Controller.Entities.Book;
|
||||||
|
using AudioBook = MediaBrowser.Controller.Entities.AudioBook;
|
||||||
|
|
||||||
namespace Emby.Server.Implementations.Library
|
namespace Emby.Server.Implementations.Library
|
||||||
{
|
{
|
||||||
|
@ -219,7 +220,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
var hasRuntime = runtimeTicks > 0;
|
var hasRuntime = runtimeTicks > 0;
|
||||||
|
|
||||||
// If a position has been reported, and if we know the duration
|
// If a position has been reported, and if we know the duration
|
||||||
if (positionTicks > 0 && hasRuntime)
|
if (positionTicks > 0 && hasRuntime && !(item is AudioBook))
|
||||||
{
|
{
|
||||||
var pctIn = decimal.Divide(positionTicks, runtimeTicks) * 100;
|
var pctIn = decimal.Divide(positionTicks, runtimeTicks) * 100;
|
||||||
|
|
||||||
|
@ -245,6 +246,23 @@ namespace Emby.Server.Implementations.Library
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (positionTicks > 0 && hasRuntime && item is AudioBook)
|
||||||
|
{
|
||||||
|
var minIn = TimeSpan.FromTicks(positionTicks).TotalMinutes;
|
||||||
|
var minOut = TimeSpan.FromTicks(runtimeTicks - positionTicks).TotalMinutes;
|
||||||
|
|
||||||
|
if (minIn > _config.Configuration.MinAudiobookResume)
|
||||||
|
{
|
||||||
|
// ignore progress during the beginning
|
||||||
|
positionTicks = 0;
|
||||||
|
}
|
||||||
|
else if (minOut < _config.Configuration.MaxAudiobookResume || positionTicks >= runtimeTicks)
|
||||||
|
{
|
||||||
|
// mark as completed close to the end
|
||||||
|
positionTicks = 0;
|
||||||
|
data.Played = playedToCompletion = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (!hasRuntime)
|
else if (!hasRuntime)
|
||||||
{
|
{
|
||||||
// If we don't know the runtime we'll just have to assume it was fully played
|
// If we don't know the runtime we'll just have to assume it was fully played
|
||||||
|
|
|
@ -298,6 +298,18 @@ namespace MediaBrowser.Model.Configuration
|
||||||
/// <value>The min resume duration seconds.</value>
|
/// <value>The min resume duration seconds.</value>
|
||||||
public int MinResumeDurationSeconds { get; set; } = 300;
|
public int MinResumeDurationSeconds { get; set; } = 300;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the minimum minutes of a book that must be played in order for playstate to be updated.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The min resume in minutes.</value>
|
||||||
|
public int MinAudiobookResume { get; set; } = 5;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the remaining minutes of a book that can be played while still saving playstate. If this percentage is crossed playstate will be reset to the beginning and the item will be marked watched.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The remaining time in minutes.</value>
|
||||||
|
public int MaxAudiobookResume { get; set; } = 5;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the delay in seconds that we will wait after a file system change to try and discover what has been added/removed
|
/// Gets or sets the delay in seconds that we will wait after a file system change to try and discover what has been added/removed
|
||||||
/// Some delay is necessary with some items because their creation is not atomic. It involves the creation of several
|
/// Some delay is necessary with some items because their creation is not atomic. It involves the creation of several
|
||||||
|
|
Loading…
Reference in New Issue
Block a user