fix image randomization
This commit is contained in:
parent
41610ce9bd
commit
e46c40faf2
|
@ -128,7 +128,10 @@ namespace MediaBrowser.Server.Implementations.Photos
|
||||||
private const string Version = "3";
|
private const string Version = "3";
|
||||||
protected string GetConfigurationCacheKey(List<BaseItem> items, string itemName)
|
protected string GetConfigurationCacheKey(List<BaseItem> items, string itemName)
|
||||||
{
|
{
|
||||||
return (Version + "_" + (itemName ?? string.Empty) + "_" + string.Join(",", items.Select(i => i.Id.ToString("N")).ToArray())).GetMD5().ToString("N");
|
var parts = Version + "_" + (itemName ?? string.Empty) + "_" +
|
||||||
|
string.Join(",", items.Select(i => i.Id.ToString("N")).ToArray());
|
||||||
|
|
||||||
|
return parts.GetMD5().ToString("N");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Task<Stream> GetThumbCollage(List<BaseItem> items)
|
protected Task<Stream> GetThumbCollage(List<BaseItem> items)
|
||||||
|
@ -224,7 +227,7 @@ namespace MediaBrowser.Server.Implementations.Photos
|
||||||
var random = new Random(GetWeekOfYear()).Next();
|
var random = new Random(GetWeekOfYear()).Next();
|
||||||
|
|
||||||
return items
|
return items
|
||||||
.OrderBy(i => random - items.IndexOf(i))
|
.OrderBy(i => (random + "" + items.IndexOf(i)).GetMD5())
|
||||||
.Take(limit)
|
.Take(limit)
|
||||||
.OrderBy(i => i.Name)
|
.OrderBy(i => i.Name)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
@ -232,6 +235,7 @@ namespace MediaBrowser.Server.Implementations.Photos
|
||||||
|
|
||||||
private int GetWeekOfYear()
|
private int GetWeekOfYear()
|
||||||
{
|
{
|
||||||
|
return DateTime.Now.Second;
|
||||||
var usCulture = new CultureInfo("en-US");
|
var usCulture = new CultureInfo("en-US");
|
||||||
var weekNo = usCulture.Calendar.GetWeekOfYear(
|
var weekNo = usCulture.Calendar.GetWeekOfYear(
|
||||||
DateTime.Now,
|
DateTime.Now,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user