mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 13:57:14 -04:00
sync updates
This commit is contained in:
parent
381aa7adc5
commit
36577ac42e
@ -729,7 +729,8 @@ namespace MediaBrowser.Api.Playback
|
|||||||
return Math.Min(request.MaxAudioChannels.Value, audioStream.Channels.Value);
|
return Math.Min(request.MaxAudioChannels.Value, audioStream.Channels.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
return request.MaxAudioChannels.Value;
|
// If we don't have any media info then limit it to 5 to prevent encoding errors due to asking for too many channels
|
||||||
|
return Math.Min(request.MaxAudioChannels.Value, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
return request.AudioChannels;
|
return request.AudioChannels;
|
||||||
|
@ -66,6 +66,22 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
return CreateResolveArgs(directoryService).FileSystemChildren;
|
return CreateResolveArgs(directoryService).FileSystemChildren;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal override bool IsValidFromResolver(BaseItem newItem)
|
||||||
|
{
|
||||||
|
var newCollectionFolder = newItem as CollectionFolder;
|
||||||
|
|
||||||
|
if (newCollectionFolder != null)
|
||||||
|
{
|
||||||
|
if (!string.Equals(CollectionType, newCollectionFolder.CollectionType, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return base.IsValidFromResolver(newItem);
|
||||||
|
}
|
||||||
|
|
||||||
private ItemResolveArgs CreateResolveArgs(IDirectoryService directoryService)
|
private ItemResolveArgs CreateResolveArgs(IDirectoryService directoryService)
|
||||||
{
|
{
|
||||||
var path = ContainingFolderPath;
|
var path = ContainingFolderPath;
|
||||||
|
@ -25,4 +25,9 @@ namespace MediaBrowser.Controller.Sync
|
|||||||
/// <returns>DeviceProfile.</returns>
|
/// <returns>DeviceProfile.</returns>
|
||||||
DeviceProfile GetDeviceProfile(SyncTarget target);
|
DeviceProfile GetDeviceProfile(SyncTarget target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public interface IHasUniqueTargetIds
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
using MediaBrowser.Common.IO;
|
using MediaBrowser.Common.IO;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Entities.Audio;
|
using MediaBrowser.Controller.Entities.Audio;
|
||||||
using MediaBrowser.Controller.Entities.Movies;
|
|
||||||
using MediaBrowser.Controller.Entities.TV;
|
using MediaBrowser.Controller.Entities.TV;
|
||||||
using MediaBrowser.Controller.Providers;
|
using MediaBrowser.Controller.Providers;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
|
@ -649,7 +649,7 @@ namespace MediaBrowser.LocalMetadata.Savers
|
|||||||
var hasShares = item as IHasShares;
|
var hasShares = item as IHasShares;
|
||||||
if (hasShares != null)
|
if (hasShares != null)
|
||||||
{
|
{
|
||||||
|
AddShares(hasShares, builder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1043,6 +1043,9 @@
|
|||||||
<Compile Include="..\MediaBrowser.Model\Sync\SyncDialogOptions.cs">
|
<Compile Include="..\MediaBrowser.Model\Sync\SyncDialogOptions.cs">
|
||||||
<Link>Sync\SyncDialogOptions.cs</Link>
|
<Link>Sync\SyncDialogOptions.cs</Link>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="..\MediaBrowser.Model\Sync\SyncHelper.cs">
|
||||||
|
<Link>Sync\SyncHelper.cs</Link>
|
||||||
|
</Compile>
|
||||||
<Compile Include="..\MediaBrowser.Model\Sync\SyncItem.cs">
|
<Compile Include="..\MediaBrowser.Model\Sync\SyncItem.cs">
|
||||||
<Link>Sync\SyncItem.cs</Link>
|
<Link>Sync\SyncItem.cs</Link>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
@ -1002,6 +1002,9 @@
|
|||||||
<Compile Include="..\MediaBrowser.Model\Sync\SyncDialogOptions.cs">
|
<Compile Include="..\MediaBrowser.Model\Sync\SyncDialogOptions.cs">
|
||||||
<Link>Sync\SyncDialogOptions.cs</Link>
|
<Link>Sync\SyncDialogOptions.cs</Link>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="..\MediaBrowser.Model\Sync\SyncHelper.cs">
|
||||||
|
<Link>Sync\SyncHelper.cs</Link>
|
||||||
|
</Compile>
|
||||||
<Compile Include="..\MediaBrowser.Model\Sync\SyncItem.cs">
|
<Compile Include="..\MediaBrowser.Model\Sync\SyncItem.cs">
|
||||||
<Link>Sync\SyncItem.cs</Link>
|
<Link>Sync\SyncItem.cs</Link>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
@ -374,9 +374,17 @@ namespace MediaBrowser.Model.Dlna
|
|||||||
MediaStream stream = TargetAudioStream;
|
MediaStream stream = TargetAudioStream;
|
||||||
int? streamChannels = stream == null ? null : stream.Channels;
|
int? streamChannels = stream == null ? null : stream.Channels;
|
||||||
|
|
||||||
return MaxAudioChannels.HasValue && !IsDirectStream
|
if (MaxAudioChannels.HasValue && !IsDirectStream)
|
||||||
? (streamChannels.HasValue ? Math.Min(MaxAudioChannels.Value, streamChannels.Value) : MaxAudioChannels.Value)
|
{
|
||||||
: streamChannels;
|
if (streamChannels.HasValue)
|
||||||
|
{
|
||||||
|
return Math.Min(MaxAudioChannels.Value, streamChannels.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return MaxAudioChannels.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return streamChannels;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,17 +1,15 @@
|
|||||||
using MediaBrowser.Common.IO;
|
using MediaBrowser.Common.IO;
|
||||||
using MediaBrowser.Controller.Entities.Audio;
|
|
||||||
using MediaBrowser.Controller.Entities.TV;
|
using MediaBrowser.Controller.Entities.TV;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Controller.Providers;
|
using MediaBrowser.Controller.Providers;
|
||||||
using MediaBrowser.Controller.Resolvers;
|
using MediaBrowser.Controller.Resolvers;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
|
using MediaBrowser.Naming.Common;
|
||||||
|
using MediaBrowser.Naming.TV;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using MediaBrowser.Naming.Common;
|
|
||||||
using MediaBrowser.Naming.IO;
|
|
||||||
using MediaBrowser.Naming.TV;
|
|
||||||
|
|
||||||
namespace MediaBrowser.Server.Implementations.Library.Resolvers.TV
|
namespace MediaBrowser.Server.Implementations.Library.Resolvers.TV
|
||||||
{
|
{
|
||||||
@ -60,10 +58,8 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.TV
|
|||||||
|
|
||||||
var collectionType = args.GetCollectionType();
|
var collectionType = args.GetCollectionType();
|
||||||
|
|
||||||
var isTvShowsFolder = string.Equals(collectionType, CollectionType.TvShows, StringComparison.OrdinalIgnoreCase);
|
|
||||||
|
|
||||||
// If there's a collection type and it's not tv, it can't be a series
|
// If there's a collection type and it's not tv, it can't be a series
|
||||||
if (!isTvShowsFolder)
|
if (!string.Equals(collectionType, CollectionType.TvShows, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -73,7 +69,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.TV
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsSeriesFolder(args.Path, collectionType, args.FileSystemChildren, args.DirectoryService, _fileSystem, _logger, _libraryManager))
|
if (IsSeriesFolder(args.Path, args.FileSystemChildren, args.DirectoryService, _fileSystem, _logger, _libraryManager))
|
||||||
{
|
{
|
||||||
return new Series
|
return new Series
|
||||||
{
|
{
|
||||||
@ -90,14 +86,13 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.TV
|
|||||||
/// Determines whether [is series folder] [the specified path].
|
/// Determines whether [is series folder] [the specified path].
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="path">The path.</param>
|
/// <param name="path">The path.</param>
|
||||||
/// <param name="collectionType">Type of the collection.</param>
|
|
||||||
/// <param name="fileSystemChildren">The file system children.</param>
|
/// <param name="fileSystemChildren">The file system children.</param>
|
||||||
/// <param name="directoryService">The directory service.</param>
|
/// <param name="directoryService">The directory service.</param>
|
||||||
/// <param name="fileSystem">The file system.</param>
|
/// <param name="fileSystem">The file system.</param>
|
||||||
/// <param name="logger">The logger.</param>
|
/// <param name="logger">The logger.</param>
|
||||||
/// <param name="libraryManager">The library manager.</param>
|
/// <param name="libraryManager">The library manager.</param>
|
||||||
/// <returns><c>true</c> if [is series folder] [the specified path]; otherwise, <c>false</c>.</returns>
|
/// <returns><c>true</c> if [is series folder] [the specified path]; otherwise, <c>false</c>.</returns>
|
||||||
public static bool IsSeriesFolder(string path, string collectionType, IEnumerable<FileSystemInfo> fileSystemChildren, IDirectoryService directoryService, IFileSystem fileSystem, ILogger logger, ILibraryManager libraryManager)
|
public static bool IsSeriesFolder(string path, IEnumerable<FileSystemInfo> fileSystemChildren, IDirectoryService directoryService, IFileSystem fileSystem, ILogger logger, ILibraryManager libraryManager)
|
||||||
{
|
{
|
||||||
foreach (var child in fileSystemChildren)
|
foreach (var child in fileSystemChildren)
|
||||||
{
|
{
|
||||||
@ -118,7 +113,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.TV
|
|||||||
|
|
||||||
if ((attributes & FileAttributes.Directory) == FileAttributes.Directory)
|
if ((attributes & FileAttributes.Directory) == FileAttributes.Directory)
|
||||||
{
|
{
|
||||||
if (IsSeasonFolder(child.FullName, collectionType))
|
if (IsSeasonFolder(child.FullName))
|
||||||
{
|
{
|
||||||
//logger.Debug("{0} is a series because of season folder {1}.", path, child.FullName);
|
//logger.Debug("{0} is a series because of season folder {1}.", path, child.FullName);
|
||||||
return true;
|
return true;
|
||||||
@ -129,24 +124,9 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.TV
|
|||||||
var fullName = child.FullName;
|
var fullName = child.FullName;
|
||||||
|
|
||||||
if (libraryManager.IsVideoFile(fullName) || IsVideoPlaceHolder(fullName))
|
if (libraryManager.IsVideoFile(fullName) || IsVideoPlaceHolder(fullName))
|
||||||
{
|
|
||||||
var isTvShowsFolder = string.Equals(collectionType, CollectionType.TvShows, StringComparison.OrdinalIgnoreCase);
|
|
||||||
|
|
||||||
// We can fast track this for known tv folders
|
|
||||||
if (isTvShowsFolder)
|
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
var resolver = new Naming.TV.EpisodeResolver(new ExtendedNamingOptions(), new Naming.Logging.NullLogger());
|
|
||||||
|
|
||||||
var episodeInfo = resolver.Resolve(fullName, FileInfoType.File, isTvShowsFolder, false);
|
|
||||||
|
|
||||||
if (episodeInfo != null && (episodeInfo.EpisodeNumber.HasValue || episodeInfo.IsByDate))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,12 +156,10 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.TV
|
|||||||
/// Determines whether [is season folder] [the specified path].
|
/// Determines whether [is season folder] [the specified path].
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="path">The path.</param>
|
/// <param name="path">The path.</param>
|
||||||
/// <param name="collectionType">Type of the collection.</param>
|
|
||||||
/// <returns><c>true</c> if [is season folder] [the specified path]; otherwise, <c>false</c>.</returns>
|
/// <returns><c>true</c> if [is season folder] [the specified path]; otherwise, <c>false</c>.</returns>
|
||||||
private static bool IsSeasonFolder(string path, string collectionType)
|
private static bool IsSeasonFolder(string path)
|
||||||
{
|
{
|
||||||
var isTvFolder = string.Equals(collectionType, CollectionType.TvShows, StringComparison.OrdinalIgnoreCase);
|
var seasonNumber = new SeasonPathParser(new ExtendedNamingOptions(), new RegexProvider()).Parse(path, true).SeasonNumber;
|
||||||
var seasonNumber = new SeasonPathParser(new ExtendedNamingOptions(), new RegexProvider()).Parse(path, isTvFolder).SeasonNumber;
|
|
||||||
|
|
||||||
return seasonNumber.HasValue;
|
return seasonNumber.HasValue;
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ using System.Linq;
|
|||||||
|
|
||||||
namespace MediaBrowser.Server.Implementations.Sync
|
namespace MediaBrowser.Server.Implementations.Sync
|
||||||
{
|
{
|
||||||
public class AppSyncProvider : ISyncProvider
|
public class AppSyncProvider : ISyncProvider, IHasUniqueTargetIds
|
||||||
{
|
{
|
||||||
private readonly IDeviceManager _deviceManager;
|
private readonly IDeviceManager _deviceManager;
|
||||||
|
|
||||||
|
@ -69,7 +69,12 @@ namespace MediaBrowser.Server.Implementations.Sync
|
|||||||
}
|
}
|
||||||
|
|
||||||
var target = GetSyncTargets(request.UserId)
|
var target = GetSyncTargets(request.UserId)
|
||||||
.First(i => string.Equals(request.TargetId, i.Id));
|
.FirstOrDefault(i => string.Equals(request.TargetId, i.Id));
|
||||||
|
|
||||||
|
if (target == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentException("Sync target not found.");
|
||||||
|
}
|
||||||
|
|
||||||
var jobId = Guid.NewGuid().ToString("N");
|
var jobId = Guid.NewGuid().ToString("N");
|
||||||
|
|
||||||
@ -173,17 +178,23 @@ namespace MediaBrowser.Server.Implementations.Sync
|
|||||||
|
|
||||||
private IEnumerable<SyncTarget> GetSyncTargets(ISyncProvider provider, string userId)
|
private IEnumerable<SyncTarget> GetSyncTargets(ISyncProvider provider, string userId)
|
||||||
{
|
{
|
||||||
var providerId = GetSyncProviderId(provider);
|
|
||||||
|
|
||||||
return provider.GetSyncTargets().Select(i => new SyncTarget
|
return provider.GetSyncTargets().Select(i => new SyncTarget
|
||||||
{
|
{
|
||||||
Name = i.Name,
|
Name = i.Name,
|
||||||
Id = GetSyncTargetId(providerId, i)
|
Id = GetSyncTargetId(provider, i)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetSyncTargetId(string providerId, SyncTarget target)
|
private string GetSyncTargetId(ISyncProvider provider, SyncTarget target)
|
||||||
{
|
{
|
||||||
|
var hasUniqueId = provider as IHasUniqueTargetIds;
|
||||||
|
|
||||||
|
if (hasUniqueId != null)
|
||||||
|
{
|
||||||
|
return target.Id;
|
||||||
|
}
|
||||||
|
|
||||||
|
var providerId = GetSyncProviderId(provider);
|
||||||
return (providerId + "-" + target.Id).GetMD5().ToString("N");
|
return (providerId + "-" + target.Id).GetMD5().ToString("N");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>MediaBrowser.Common.Internal</id>
|
<id>MediaBrowser.Common.Internal</id>
|
||||||
<version>3.0.522</version>
|
<version>3.0.523</version>
|
||||||
<title>MediaBrowser.Common.Internal</title>
|
<title>MediaBrowser.Common.Internal</title>
|
||||||
<authors>Luke</authors>
|
<authors>Luke</authors>
|
||||||
<owners>ebr,Luke,scottisafool</owners>
|
<owners>ebr,Luke,scottisafool</owners>
|
||||||
@ -12,7 +12,7 @@
|
|||||||
<description>Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption.</description>
|
<description>Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption.</description>
|
||||||
<copyright>Copyright © Media Browser 2013</copyright>
|
<copyright>Copyright © Media Browser 2013</copyright>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency id="MediaBrowser.Common" version="3.0.522" />
|
<dependency id="MediaBrowser.Common" version="3.0.523" />
|
||||||
<dependency id="NLog" version="3.1.0.0" />
|
<dependency id="NLog" version="3.1.0.0" />
|
||||||
<dependency id="SimpleInjector" version="2.6.1" />
|
<dependency id="SimpleInjector" version="2.6.1" />
|
||||||
<dependency id="sharpcompress" version="0.10.2" />
|
<dependency id="sharpcompress" version="0.10.2" />
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>MediaBrowser.Common</id>
|
<id>MediaBrowser.Common</id>
|
||||||
<version>3.0.522</version>
|
<version>3.0.523</version>
|
||||||
<title>MediaBrowser.Common</title>
|
<title>MediaBrowser.Common</title>
|
||||||
<authors>Media Browser Team</authors>
|
<authors>Media Browser Team</authors>
|
||||||
<owners>ebr,Luke,scottisafool</owners>
|
<owners>ebr,Luke,scottisafool</owners>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>MediaBrowser.Model.Signed</id>
|
<id>MediaBrowser.Model.Signed</id>
|
||||||
<version>3.0.522</version>
|
<version>3.0.523</version>
|
||||||
<title>MediaBrowser.Model - Signed Edition</title>
|
<title>MediaBrowser.Model - Signed Edition</title>
|
||||||
<authors>Media Browser Team</authors>
|
<authors>Media Browser Team</authors>
|
||||||
<owners>ebr,Luke,scottisafool</owners>
|
<owners>ebr,Luke,scottisafool</owners>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>MediaBrowser.Server.Core</id>
|
<id>MediaBrowser.Server.Core</id>
|
||||||
<version>3.0.522</version>
|
<version>3.0.523</version>
|
||||||
<title>Media Browser.Server.Core</title>
|
<title>Media Browser.Server.Core</title>
|
||||||
<authors>Media Browser Team</authors>
|
<authors>Media Browser Team</authors>
|
||||||
<owners>ebr,Luke,scottisafool</owners>
|
<owners>ebr,Luke,scottisafool</owners>
|
||||||
@ -12,7 +12,7 @@
|
|||||||
<description>Contains core components required to build plugins for Media Browser Server.</description>
|
<description>Contains core components required to build plugins for Media Browser Server.</description>
|
||||||
<copyright>Copyright © Media Browser 2013</copyright>
|
<copyright>Copyright © Media Browser 2013</copyright>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency id="MediaBrowser.Common" version="3.0.522" />
|
<dependency id="MediaBrowser.Common" version="3.0.523" />
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</metadata>
|
</metadata>
|
||||||
<files>
|
<files>
|
||||||
|
Loading…
Reference in New Issue
Block a user