update xmltv downloading
This commit is contained in:
parent
c20674a299
commit
6118e5f966
|
@ -1413,59 +1413,33 @@ namespace MediaBrowser.Controller.Entities
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var recursiveItemCount = 0;
|
var playedQueryResult = GetItems(new InternalItemsQuery(user)
|
||||||
var unplayed = 0;
|
|
||||||
|
|
||||||
double totalPercentPlayed = 0;
|
|
||||||
|
|
||||||
var itemsResult = GetItems(new InternalItemsQuery(user)
|
|
||||||
{
|
{
|
||||||
Recursive = true,
|
Recursive = true,
|
||||||
IsFolder = false,
|
IsFolder = false,
|
||||||
ExcludeLocationTypes = new[] { LocationType.Virtual },
|
IsVirtualItem = false,
|
||||||
EnableTotalRecordCount = false
|
EnableTotalRecordCount = true,
|
||||||
|
Limit = 0,
|
||||||
|
IsPlayed = true
|
||||||
|
|
||||||
}).Result;
|
}).Result;
|
||||||
|
|
||||||
var children = itemsResult.Items;
|
var allItemsQueryResult = GetItems(new InternalItemsQuery(user)
|
||||||
|
|
||||||
// Loop through each recursive child
|
|
||||||
foreach (var child in children)
|
|
||||||
{
|
{
|
||||||
recursiveItemCount++;
|
Recursive = true,
|
||||||
|
IsFolder = false,
|
||||||
|
IsVirtualItem = false,
|
||||||
|
EnableTotalRecordCount = true,
|
||||||
|
Limit = 0
|
||||||
|
|
||||||
var isUnplayed = true;
|
}).Result;
|
||||||
|
|
||||||
var itemUserData = UserDataManager.GetUserData(user, child);
|
double recursiveItemCount = allItemsQueryResult.TotalRecordCount;
|
||||||
|
double playedCount = playedQueryResult.TotalRecordCount;
|
||||||
// Incrememt totalPercentPlayed
|
|
||||||
if (itemUserData != null)
|
|
||||||
{
|
|
||||||
if (itemUserData.Played)
|
|
||||||
{
|
|
||||||
totalPercentPlayed += 100;
|
|
||||||
|
|
||||||
isUnplayed = false;
|
|
||||||
}
|
|
||||||
else if (itemUserData.PlaybackPositionTicks > 0 && child.RunTimeTicks.HasValue && child.RunTimeTicks.Value > 0)
|
|
||||||
{
|
|
||||||
double itemPercent = itemUserData.PlaybackPositionTicks;
|
|
||||||
itemPercent /= child.RunTimeTicks.Value;
|
|
||||||
totalPercentPlayed += itemPercent;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isUnplayed)
|
|
||||||
{
|
|
||||||
unplayed++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dto.UnplayedItemCount = unplayed;
|
|
||||||
|
|
||||||
if (recursiveItemCount > 0)
|
if (recursiveItemCount > 0)
|
||||||
{
|
{
|
||||||
dto.PlayedPercentage = totalPercentPlayed / recursiveItemCount;
|
dto.PlayedPercentage = (playedCount / recursiveItemCount) * 100;
|
||||||
dto.Played = dto.PlayedPercentage.Value >= 100;
|
dto.Played = dto.PlayedPercentage.Value >= 100;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -208,7 +208,6 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||||
var dto = GetUserItemDataDto(userData);
|
var dto = GetUserItemDataDto(userData);
|
||||||
|
|
||||||
item.FillUserDataDtoValues(dto, userData, user);
|
item.FillUserDataDtoValues(dto, userData, user);
|
||||||
|
|
||||||
return dto;
|
return dto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
|
||||||
{
|
{
|
||||||
CancellationToken = cancellationToken,
|
CancellationToken = cancellationToken,
|
||||||
Url = path,
|
Url = path,
|
||||||
Progress = new Progress<Double>()
|
Progress = new Progress<Double>(),
|
||||||
|
EnableHttpCompression = false
|
||||||
|
|
||||||
}).ConfigureAwait(false);
|
}).ConfigureAwait(false);
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
<HintPath>..\packages\CommonIO.1.0.0.9\lib\net45\CommonIO.dll</HintPath>
|
<HintPath>..\packages\CommonIO.1.0.0.9\lib\net45\CommonIO.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Emby.XmlTv, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="Emby.XmlTv, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Emby.XmlTv.1.0.0.51\lib\net45\Emby.XmlTv.dll</HintPath>
|
<HintPath>..\packages\Emby.XmlTv.1.0.0.53\lib\net45\Emby.XmlTv.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="INIFileParser, Version=2.3.0.0, Culture=neutral, PublicKeyToken=79af7b307b65cf3c, processorArchitecture=MSIL">
|
<Reference Include="INIFileParser, Version=2.3.0.0, Culture=neutral, PublicKeyToken=79af7b307b65cf3c, processorArchitecture=MSIL">
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="CommonIO" version="1.0.0.9" targetFramework="net45" />
|
<package id="CommonIO" version="1.0.0.9" targetFramework="net45" />
|
||||||
<package id="Emby.XmlTv" version="1.0.0.51" targetFramework="net45" />
|
<package id="Emby.XmlTv" version="1.0.0.53" targetFramework="net45" />
|
||||||
<package id="ini-parser" version="2.3.0" targetFramework="net45" />
|
<package id="ini-parser" version="2.3.0" targetFramework="net45" />
|
||||||
<package id="Interfaces.IO" version="1.0.0.5" targetFramework="net45" />
|
<package id="Interfaces.IO" version="1.0.0.5" targetFramework="net45" />
|
||||||
<package id="MediaBrowser.Naming" version="1.0.0.51" targetFramework="net45" />
|
<package id="MediaBrowser.Naming" version="1.0.0.51" targetFramework="net45" />
|
||||||
|
|
Loading…
Reference in New Issue
Block a user