pull/702/head
Luke Pulverenti 10 years ago
parent 7e312e75bb
commit 5e07bdf93c

@ -86,14 +86,14 @@ namespace MediaBrowser.Api.Playback
var authInfo = AuthorizationContext.GetAuthorizationInfo(Request);
var profile = request.DeviceProfile;
//if (profile == null)
//{
// var caps = _deviceManager.GetCapabilities(authInfo.DeviceId);
// if (caps != null)
// {
// profile = caps.DeviceProfile;
// }
//}
if (profile == null)
{
var caps = _deviceManager.GetCapabilities(authInfo.DeviceId);
if (caps != null)
{
profile = caps.DeviceProfile;
}
}
if (profile != null)
{

@ -1,6 +1,5 @@
using MediaBrowser.Model.MediaInfo;
using MediaBrowser.Model.Session;
using System;
using System.Collections.Generic;
using System.Linq;
@ -11,17 +10,25 @@ namespace MediaBrowser.Model.Dlna
public static List<StreamInfo> SortMediaSources(List<StreamInfo> streams)
{
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)
{
// Let's assume direct streaming a file is just as desirable as direct playing a remote url
case PlayMethod.DirectStream:
case PlayMethod.DirectPlay:
return 0;
case PlayMethod.DirectStream:
return 1;
case PlayMethod.Transcode:
return 2;
default:
throw new ArgumentException("Unrecognized PlayMethod");
return 2;
}
}).ThenBy(i =>

@ -1713,11 +1713,15 @@ namespace MediaBrowser.Server.Implementations.Library
isNew = true;
}
var refresh = isNew || (DateTime.UtcNow - item.DateLastSaved).TotalHours >= 6;
var refresh = isNew || (DateTime.UtcNow - item.DateLastSaved).TotalHours >= 12;
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;

@ -125,7 +125,7 @@ namespace MediaBrowser.Server.Implementations.Photos
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)
{
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)
{
// Rotate the images once every 7 days
var random = DateTime.Now.DayOfYear % 7;
// Rotate the images once every x days
var random = DateTime.Now.DayOfYear % 4;
return items
.OrderBy(i => (random + "" + items.IndexOf(i)).GetMD5())

@ -176,6 +176,8 @@ namespace MediaBrowser.Server.Implementations.Sync
mediaSource.Path = sendFileResult.Path;
mediaSource.Protocol = sendFileResult.Protocol;
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)
{
var failedSubtitles = new List<MediaStream>();
var requiresSave = false;
foreach (var mediaStream in mediaSource.MediaStreams
.Where(i => i.Type == MediaStreamType.Subtitle && i.IsExternal)
.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);
}
}
}
private async Task RemoveItem(IServerSyncProvider provider,
@ -374,7 +397,7 @@ namespace MediaBrowser.Server.Implementations.Sync
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
{

@ -162,7 +162,7 @@ namespace MediaBrowser.Server.Implementations.UserViews
wandList.AddImage(mwr);
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…
Cancel
Save