mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
sync fixes
This commit is contained in:
parent
7e312e75bb
commit
5e07bdf93c
@ -86,14 +86,14 @@ namespace MediaBrowser.Api.Playback
|
|||||||
var authInfo = AuthorizationContext.GetAuthorizationInfo(Request);
|
var authInfo = AuthorizationContext.GetAuthorizationInfo(Request);
|
||||||
|
|
||||||
var profile = request.DeviceProfile;
|
var profile = request.DeviceProfile;
|
||||||
//if (profile == null)
|
if (profile == null)
|
||||||
//{
|
{
|
||||||
// var caps = _deviceManager.GetCapabilities(authInfo.DeviceId);
|
var caps = _deviceManager.GetCapabilities(authInfo.DeviceId);
|
||||||
// if (caps != null)
|
if (caps != null)
|
||||||
// {
|
{
|
||||||
// profile = caps.DeviceProfile;
|
profile = caps.DeviceProfile;
|
||||||
// }
|
}
|
||||||
//}
|
}
|
||||||
|
|
||||||
if (profile != null)
|
if (profile != null)
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
using MediaBrowser.Model.MediaInfo;
|
using MediaBrowser.Model.MediaInfo;
|
||||||
using MediaBrowser.Model.Session;
|
using MediaBrowser.Model.Session;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
@ -11,17 +10,25 @@ namespace MediaBrowser.Model.Dlna
|
|||||||
public static List<StreamInfo> SortMediaSources(List<StreamInfo> streams)
|
public static List<StreamInfo> SortMediaSources(List<StreamInfo> streams)
|
||||||
{
|
{
|
||||||
return streams.OrderBy(i =>
|
return streams.OrderBy(i =>
|
||||||
|
{
|
||||||
|
// Nothing beats direct playing a file
|
||||||
|
if (i.PlayMethod == PlayMethod.DirectPlay && i.MediaSource.Protocol == MediaProtocol.File)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
}).ThenBy(i =>
|
||||||
{
|
{
|
||||||
switch (i.PlayMethod)
|
switch (i.PlayMethod)
|
||||||
{
|
{
|
||||||
|
// Let's assume direct streaming a file is just as desirable as direct playing a remote url
|
||||||
|
case PlayMethod.DirectStream:
|
||||||
case PlayMethod.DirectPlay:
|
case PlayMethod.DirectPlay:
|
||||||
return 0;
|
return 0;
|
||||||
case PlayMethod.DirectStream:
|
|
||||||
return 1;
|
|
||||||
case PlayMethod.Transcode:
|
|
||||||
return 2;
|
|
||||||
default:
|
default:
|
||||||
throw new ArgumentException("Unrecognized PlayMethod");
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
}).ThenBy(i =>
|
}).ThenBy(i =>
|
||||||
|
@ -1713,11 +1713,15 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||||||
isNew = true;
|
isNew = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
var refresh = isNew || (DateTime.UtcNow - item.DateLastSaved).TotalHours >= 6;
|
var refresh = isNew || (DateTime.UtcNow - item.DateLastSaved).TotalHours >= 12;
|
||||||
|
|
||||||
if (refresh)
|
if (refresh)
|
||||||
{
|
{
|
||||||
_providerManagerFactory().QueueRefresh(item.Id, new MetadataRefreshOptions());
|
_providerManagerFactory().QueueRefresh(item.Id, new MetadataRefreshOptions
|
||||||
|
{
|
||||||
|
// Need to force save to increment DateLastSaved
|
||||||
|
ForceSave = true
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
|
@ -125,7 +125,7 @@ namespace MediaBrowser.Server.Implementations.Photos
|
|||||||
|
|
||||||
protected abstract Task<List<BaseItem>> GetItemsWithImages(IHasImages item);
|
protected abstract Task<List<BaseItem>> GetItemsWithImages(IHasImages item);
|
||||||
|
|
||||||
private const string Version = "4";
|
private const string Version = "5";
|
||||||
protected string GetConfigurationCacheKey(List<BaseItem> items, string itemName)
|
protected string GetConfigurationCacheKey(List<BaseItem> items, string itemName)
|
||||||
{
|
{
|
||||||
var parts = Version + "_" + (itemName ?? string.Empty) + "_" +
|
var parts = Version + "_" + (itemName ?? string.Empty) + "_" +
|
||||||
@ -223,8 +223,8 @@ namespace MediaBrowser.Server.Implementations.Photos
|
|||||||
|
|
||||||
protected virtual List<BaseItem> GetFinalItems(List<BaseItem> items, int limit)
|
protected virtual List<BaseItem> GetFinalItems(List<BaseItem> items, int limit)
|
||||||
{
|
{
|
||||||
// Rotate the images once every 7 days
|
// Rotate the images once every x days
|
||||||
var random = DateTime.Now.DayOfYear % 7;
|
var random = DateTime.Now.DayOfYear % 4;
|
||||||
|
|
||||||
return items
|
return items
|
||||||
.OrderBy(i => (random + "" + items.IndexOf(i)).GetMD5())
|
.OrderBy(i => (random + "" + items.IndexOf(i)).GetMD5())
|
||||||
|
@ -176,6 +176,8 @@ namespace MediaBrowser.Server.Implementations.Sync
|
|||||||
mediaSource.Path = sendFileResult.Path;
|
mediaSource.Path = sendFileResult.Path;
|
||||||
mediaSource.Protocol = sendFileResult.Protocol;
|
mediaSource.Protocol = sendFileResult.Protocol;
|
||||||
mediaSource.SupportsTranscoding = false;
|
mediaSource.SupportsTranscoding = false;
|
||||||
|
|
||||||
|
await SendSubtitles(localItem, mediaSource, provider, dataProvider, target, cancellationToken).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,16 +207,37 @@ namespace MediaBrowser.Server.Implementations.Sync
|
|||||||
|
|
||||||
private async Task SendSubtitles(LocalItem localItem, MediaSourceInfo mediaSource, IServerSyncProvider provider, ISyncDataProvider dataProvider, SyncTarget target, CancellationToken cancellationToken)
|
private async Task SendSubtitles(LocalItem localItem, MediaSourceInfo mediaSource, IServerSyncProvider provider, ISyncDataProvider dataProvider, SyncTarget target, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
|
var failedSubtitles = new List<MediaStream>();
|
||||||
|
var requiresSave = false;
|
||||||
|
|
||||||
foreach (var mediaStream in mediaSource.MediaStreams
|
foreach (var mediaStream in mediaSource.MediaStreams
|
||||||
.Where(i => i.Type == MediaStreamType.Subtitle && i.IsExternal)
|
.Where(i => i.Type == MediaStreamType.Subtitle && i.IsExternal)
|
||||||
.ToList())
|
.ToList())
|
||||||
{
|
{
|
||||||
var sendFileResult = await SendFile(provider, mediaStream.Path, localItem, target, cancellationToken).ConfigureAwait(false);
|
try
|
||||||
|
{
|
||||||
|
var sendFileResult = await SendFile(provider, mediaStream.Path, localItem, target, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
mediaStream.Path = sendFileResult.Path;
|
mediaStream.Path = sendFileResult.Path;
|
||||||
|
requiresSave = true;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.ErrorException("Error sending subtitle stream", ex);
|
||||||
|
failedSubtitles.Add(mediaStream);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (failedSubtitles.Count > 0)
|
||||||
|
{
|
||||||
|
mediaSource.MediaStreams = mediaSource.MediaStreams.Except(failedSubtitles).ToList();
|
||||||
|
requiresSave = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (requiresSave)
|
||||||
|
{
|
||||||
await dataProvider.AddOrUpdate(target, localItem).ConfigureAwait(false);
|
await dataProvider.AddOrUpdate(target, localItem).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task RemoveItem(IServerSyncProvider provider,
|
private async Task RemoveItem(IServerSyncProvider provider,
|
||||||
@ -374,7 +397,7 @@ namespace MediaBrowser.Server.Implementations.Sync
|
|||||||
|
|
||||||
var name = Path.GetFileNameWithoutExtension(item.LocalPath);
|
var name = Path.GetFileNameWithoutExtension(item.LocalPath);
|
||||||
|
|
||||||
foreach (var file in list.Where(f => f.Name.Contains(name)))
|
foreach (var file in list.Where(f => f.Name.IndexOf(name, StringComparison.OrdinalIgnoreCase) != -1))
|
||||||
{
|
{
|
||||||
var itemFile = new ItemFileInfo
|
var itemFile = new ItemFileInfo
|
||||||
{
|
{
|
||||||
|
@ -162,7 +162,7 @@ namespace MediaBrowser.Server.Implementations.UserViews
|
|||||||
|
|
||||||
wandList.AddImage(mwr);
|
wandList.AddImage(mwr);
|
||||||
int ex = (int)(wand.CurrentImage.Width - mwg.CurrentImage.Width) / 2;
|
int ex = (int)(wand.CurrentImage.Width - mwg.CurrentImage.Width) / 2;
|
||||||
wand.CurrentImage.CompositeImage(wandList.AppendImages(true), CompositeOperator.AtopCompositeOp, ex, Convert.ToInt32(height * .08));
|
wand.CurrentImage.CompositeImage(wandList.AppendImages(true), CompositeOperator.AtopCompositeOp, ex, Convert.ToInt32(height * .085));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user