Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3dda25412c | |||
| 0183ef8e89 | |||
| 75f39f0f2a | |||
| 966217e6a9 | |||
| 328bcadabf | |||
| 0f38b2ffb2 | |||
| 40f4780825 | |||
| 546ffbe4f7 | |||
| d00218c370 | |||
| 679d3f5873 | |||
| 787ad44323 | |||
| 2ce6b347f5 | |||
| 318c1f7f0c | |||
| ed15cb1571 | |||
| c171bac71a | |||
| be5f511fc7 | |||
| a65c97c8f7 | |||
| 3fbe10364b | |||
| 88ab008112 | |||
| 1518f6d325 | |||
| 53576fe1b8 | |||
| da3b7bb684 |
@@ -160,7 +160,6 @@ jobs:
|
|||||||
dependsOn:
|
dependsOn:
|
||||||
- BuildPackage
|
- BuildPackage
|
||||||
- BuildDocker
|
- BuildDocker
|
||||||
condition: and(succeeded('BuildPackage'), succeeded('BuildDocker'))
|
|
||||||
|
|
||||||
pool:
|
pool:
|
||||||
vmImage: 'ubuntu-latest'
|
vmImage: 'ubuntu-latest'
|
||||||
@@ -186,9 +185,6 @@ jobs:
|
|||||||
|
|
||||||
- job: PublishNuget
|
- job: PublishNuget
|
||||||
displayName: 'Publish NuGet packages'
|
displayName: 'Publish NuGet packages'
|
||||||
dependsOn:
|
|
||||||
- BuildPackage
|
|
||||||
condition: succeeded('BuildPackage')
|
|
||||||
|
|
||||||
pool:
|
pool:
|
||||||
vmImage: 'ubuntu-latest'
|
vmImage: 'ubuntu-latest'
|
||||||
|
|||||||
@@ -333,7 +333,12 @@ namespace Emby.Dlna
|
|||||||
throw new ArgumentNullException(nameof(id));
|
throw new ArgumentNullException(nameof(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
var info = GetProfileInfosInternal().First(i => string.Equals(i.Info.Id, id, StringComparison.OrdinalIgnoreCase));
|
var info = GetProfileInfosInternal().FirstOrDefault(i => string.Equals(i.Info.Id, id, StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
||||||
|
if (info == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return ParseProfileFile(info.Path, info.Info.Type);
|
return ParseProfileFile(info.Path, info.Info.Type);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -128,7 +128,8 @@ namespace Emby.Dlna.Main
|
|||||||
|
|
||||||
_netConfig = config.GetConfiguration<NetworkConfiguration>("network");
|
_netConfig = config.GetConfiguration<NetworkConfiguration>("network");
|
||||||
_disabled = appHost.ListenWithHttps && _netConfig.RequireHttps;
|
_disabled = appHost.ListenWithHttps && _netConfig.RequireHttps;
|
||||||
if (_disabled)
|
|
||||||
|
if (_disabled && _config.GetDlnaConfiguration().EnableServer)
|
||||||
{
|
{
|
||||||
_logger.LogError("The DLNA specification does not support HTTPS.");
|
_logger.LogError("The DLNA specification does not support HTTPS.");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
#pragma warning disable CS1591
|
#pragma warning disable CS1591
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using MediaBrowser.Model.Dlna;
|
using MediaBrowser.Model.Dlna;
|
||||||
|
|
||||||
@@ -10,6 +12,7 @@ namespace Emby.Dlna.Profiles
|
|||||||
{
|
{
|
||||||
public DefaultProfile()
|
public DefaultProfile()
|
||||||
{
|
{
|
||||||
|
Id = Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture);
|
||||||
Name = "Generic Device";
|
Name = "Generic Device";
|
||||||
|
|
||||||
ProtocolInfo = "http-get:*:video/mpeg:*,http-get:*:video/mp4:*,http-get:*:video/vnd.dlna.mpeg-tts:*,http-get:*:video/avi:*,http-get:*:video/x-matroska:*,http-get:*:video/x-ms-wmv:*,http-get:*:video/wtv:*,http-get:*:audio/mpeg:*,http-get:*:audio/mp3:*,http-get:*:audio/mp4:*,http-get:*:audio/x-ms-wma:*,http-get:*:audio/wav:*,http-get:*:audio/L16:*,http-get:*:image/jpeg:*,http-get:*:image/png:*,http-get:*:image/gif:*,http-get:*:image/tiff:*";
|
ProtocolInfo = "http-get:*:video/mpeg:*,http-get:*:video/mp4:*,http-get:*:video/vnd.dlna.mpeg-tts:*,http-get:*:video/avi:*,http-get:*:video/x-matroska:*,http-get:*:video/x-ms-wmv:*,http-get:*:video/wtv:*,http-get:*:audio/mpeg:*,http-get:*:audio/mp3:*,http-get:*:audio/mp4:*,http-get:*:audio/x-ms-wma:*,http-get:*:audio/wav:*,http-get:*:audio/L16:*,http-get:*:image/jpeg:*,http-get:*:image/png:*,http-get:*:image/gif:*,http-get:*:image/tiff:*";
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ namespace Emby.Dlna.Ssdp
|
|||||||
{
|
{
|
||||||
lock (_syncLock)
|
lock (_syncLock)
|
||||||
{
|
{
|
||||||
if (_listenerCount > 0 && _deviceLocator == null)
|
if (_listenerCount > 0 && _deviceLocator == null && _commsServer != null)
|
||||||
{
|
{
|
||||||
_deviceLocator = new SsdpDeviceLocator(_commsServer);
|
_deviceLocator = new SsdpDeviceLocator(_commsServer);
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Authors>Jellyfin Contributors</Authors>
|
<Authors>Jellyfin Contributors</Authors>
|
||||||
<PackageId>Jellyfin.Naming</PackageId>
|
<PackageId>Jellyfin.Naming</PackageId>
|
||||||
<VersionPrefix>10.7.0</VersionPrefix>
|
<VersionPrefix>10.7.1</VersionPrefix>
|
||||||
<RepositoryUrl>https://github.com/jellyfin/jellyfin</RepositoryUrl>
|
<RepositoryUrl>https://github.com/jellyfin/jellyfin</RepositoryUrl>
|
||||||
<PackageLicenseExpression>GPL-3.0-only</PackageLicenseExpression>
|
<PackageLicenseExpression>GPL-3.0-only</PackageLicenseExpression>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
@@ -222,20 +222,21 @@ namespace Emby.Naming.Video
|
|||||||
|
|
||||||
if (testFilename.StartsWith(folderName, StringComparison.OrdinalIgnoreCase))
|
if (testFilename.StartsWith(folderName, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
if (CleanStringParser.TryClean(testFilename, _options.CleanStringRegexes, out var cleanName))
|
// Remove the folder name before cleaning as we don't care about cleaning that part
|
||||||
{
|
|
||||||
testFilename = cleanName.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (folderName.Length <= testFilename.Length)
|
if (folderName.Length <= testFilename.Length)
|
||||||
{
|
{
|
||||||
testFilename = testFilename.Substring(folderName.Length).Trim();
|
testFilename = testFilename.Substring(folderName.Length).Trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (CleanStringParser.TryClean(testFilename, _options.CleanStringRegexes, out var cleanName))
|
||||||
|
{
|
||||||
|
testFilename = cleanName.Trim().ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
// The CleanStringParser should have removed common keywords etc.
|
||||||
return string.IsNullOrEmpty(testFilename)
|
return string.IsNullOrEmpty(testFilename)
|
||||||
|| testFilename[0].Equals('-')
|
|| testFilename[0] == '-'
|
||||||
|| testFilename[0].Equals('_')
|
|| Regex.IsMatch(testFilename, @"^\[([^]]*)\]");
|
||||||
|| string.IsNullOrWhiteSpace(Regex.Replace(testFilename, @"\[([^]]*)\]", string.Empty));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -344,7 +344,20 @@ namespace Emby.Server.Implementations.Collections
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
results[item.Id] = item;
|
var alreadyInResults = false;
|
||||||
|
foreach (var child in item.GetMediaSources(true))
|
||||||
|
{
|
||||||
|
if (Guid.TryParse(child.Id, out var id) && results.ContainsKey(id))
|
||||||
|
{
|
||||||
|
alreadyInResults = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!alreadyInResults)
|
||||||
|
{
|
||||||
|
results[item.Id] = item;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="args">The args.</param>
|
/// <param name="args">The args.</param>
|
||||||
/// <returns>`0.</returns>
|
/// <returns>`0.</returns>
|
||||||
protected override T Resolve(ItemResolveArgs args)
|
public override T Resolve(ItemResolveArgs args)
|
||||||
{
|
{
|
||||||
return ResolveVideo<T>(args, false);
|
return ResolveVideo<T>(args, false);
|
||||||
}
|
}
|
||||||
@@ -42,7 +42,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
|||||||
/// <param name="args">The args.</param>
|
/// <param name="args">The args.</param>
|
||||||
/// <param name="parseName">if set to <c>true</c> [parse name].</param>
|
/// <param name="parseName">if set to <c>true</c> [parse name].</param>
|
||||||
/// <returns>``0.</returns>
|
/// <returns>``0.</returns>
|
||||||
protected TVideoType ResolveVideo<TVideoType>(ItemResolveArgs args, bool parseName)
|
protected virtual TVideoType ResolveVideo<TVideoType>(ItemResolveArgs args, bool parseName)
|
||||||
where TVideoType : Video, new()
|
where TVideoType : Video, new()
|
||||||
{
|
{
|
||||||
var namingOptions = ((LibraryManager)LibraryManager).GetNamingOptions();
|
var namingOptions = ((LibraryManager)LibraryManager).GetNamingOptions();
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Books
|
|||||||
{
|
{
|
||||||
private readonly string[] _validExtensions = { ".azw", ".azw3", ".cb7", ".cbr", ".cbt", ".cbz", ".epub", ".mobi", ".pdf" };
|
private readonly string[] _validExtensions = { ".azw", ".azw3", ".cb7", ".cbr", ".cbt", ".cbz", ".epub", ".mobi", ".pdf" };
|
||||||
|
|
||||||
protected override Book Resolve(ItemResolveArgs args)
|
public override Book Resolve(ItemResolveArgs args)
|
||||||
{
|
{
|
||||||
var collectionType = args.GetCollectionType();
|
var collectionType = args.GetCollectionType();
|
||||||
|
|
||||||
|
|||||||
@@ -69,6 +69,110 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Resolves the specified args.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="args">The args.</param>
|
||||||
|
/// <returns>Video.</returns>
|
||||||
|
public override Video Resolve(ItemResolveArgs args)
|
||||||
|
{
|
||||||
|
var collectionType = args.GetCollectionType();
|
||||||
|
|
||||||
|
// Find movies with their own folders
|
||||||
|
if (args.IsDirectory)
|
||||||
|
{
|
||||||
|
if (IsInvalid(args.Parent, collectionType))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
var files = args.FileSystemChildren
|
||||||
|
.Where(i => !LibraryManager.IgnoreFile(i, args.Parent))
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
if (string.Equals(collectionType, CollectionType.MusicVideos, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return FindMovie<MusicVideo>(args, args.Path, args.Parent, files, args.DirectoryService, collectionType, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.Equals(collectionType, CollectionType.HomeVideos, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return FindMovie<Video>(args, args.Path, args.Parent, files, args.DirectoryService, collectionType, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(collectionType))
|
||||||
|
{
|
||||||
|
// Owned items will be caught by the plain video resolver
|
||||||
|
if (args.Parent == null)
|
||||||
|
{
|
||||||
|
// return FindMovie<Video>(args.Path, args.Parent, files, args.DirectoryService, collectionType);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.HasParent<Series>())
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
return FindMovie<Movie>(args, args.Path, args.Parent, files, args.DirectoryService, collectionType, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.Equals(collectionType, CollectionType.Movies, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return FindMovie<Movie>(args, args.Path, args.Parent, files, args.DirectoryService, collectionType, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle owned items
|
||||||
|
if (args.Parent == null)
|
||||||
|
{
|
||||||
|
return base.Resolve(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsInvalid(args.Parent, collectionType))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Video item = null;
|
||||||
|
|
||||||
|
if (string.Equals(collectionType, CollectionType.MusicVideos, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
item = ResolveVideo<MusicVideo>(args, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// To find a movie file, the collection type must be movies or boxsets
|
||||||
|
else if (string.Equals(collectionType, CollectionType.Movies, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
item = ResolveVideo<Movie>(args, true);
|
||||||
|
}
|
||||||
|
else if (string.Equals(collectionType, CollectionType.HomeVideos, StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
string.Equals(collectionType, CollectionType.Photos, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
item = ResolveVideo<Video>(args, false);
|
||||||
|
}
|
||||||
|
else if (string.IsNullOrEmpty(collectionType))
|
||||||
|
{
|
||||||
|
if (args.HasParent<Series>())
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
item = ResolveVideo<Video>(args, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item != null)
|
||||||
|
{
|
||||||
|
item.IsInMixedFolder = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
private MultiItemResolverResult ResolveMultipleInternal(
|
private MultiItemResolverResult ResolveMultipleInternal(
|
||||||
Folder parent,
|
Folder parent,
|
||||||
List<FileSystemMetadata> files,
|
List<FileSystemMetadata> files,
|
||||||
@@ -216,110 +320,6 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
|
|||||||
return string.Equals(result.Path, file.FullName, StringComparison.OrdinalIgnoreCase);
|
return string.Equals(result.Path, file.FullName, StringComparison.OrdinalIgnoreCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Resolves the specified args.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="args">The args.</param>
|
|
||||||
/// <returns>Video.</returns>
|
|
||||||
protected override Video Resolve(ItemResolveArgs args)
|
|
||||||
{
|
|
||||||
var collectionType = args.GetCollectionType();
|
|
||||||
|
|
||||||
// Find movies with their own folders
|
|
||||||
if (args.IsDirectory)
|
|
||||||
{
|
|
||||||
if (IsInvalid(args.Parent, collectionType))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
var files = args.FileSystemChildren
|
|
||||||
.Where(i => !LibraryManager.IgnoreFile(i, args.Parent))
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
if (string.Equals(collectionType, CollectionType.MusicVideos, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return FindMovie<MusicVideo>(args, args.Path, args.Parent, files, args.DirectoryService, collectionType, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.Equals(collectionType, CollectionType.HomeVideos, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return FindMovie<Video>(args, args.Path, args.Parent, files, args.DirectoryService, collectionType, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(collectionType))
|
|
||||||
{
|
|
||||||
// Owned items will be caught by the plain video resolver
|
|
||||||
if (args.Parent == null)
|
|
||||||
{
|
|
||||||
// return FindMovie<Video>(args.Path, args.Parent, files, args.DirectoryService, collectionType);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args.HasParent<Series>())
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
return FindMovie<Movie>(args, args.Path, args.Parent, files, args.DirectoryService, collectionType, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.Equals(collectionType, CollectionType.Movies, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return FindMovie<Movie>(args, args.Path, args.Parent, files, args.DirectoryService, collectionType, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle owned items
|
|
||||||
if (args.Parent == null)
|
|
||||||
{
|
|
||||||
return base.Resolve(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (IsInvalid(args.Parent, collectionType))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
Video item = null;
|
|
||||||
|
|
||||||
if (string.Equals(collectionType, CollectionType.MusicVideos, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
item = ResolveVideo<MusicVideo>(args, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// To find a movie file, the collection type must be movies or boxsets
|
|
||||||
else if (string.Equals(collectionType, CollectionType.Movies, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
item = ResolveVideo<Movie>(args, true);
|
|
||||||
}
|
|
||||||
else if (string.Equals(collectionType, CollectionType.HomeVideos, StringComparison.OrdinalIgnoreCase) ||
|
|
||||||
string.Equals(collectionType, CollectionType.Photos, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
item = ResolveVideo<Video>(args, false);
|
|
||||||
}
|
|
||||||
else if (string.IsNullOrEmpty(collectionType))
|
|
||||||
{
|
|
||||||
if (args.HasParent<Series>())
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
item = ResolveVideo<Video>(args, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item != null)
|
|
||||||
{
|
|
||||||
item.IsInMixedFolder = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets the initial item values.
|
/// Sets the initial item values.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Entities.TV;
|
using MediaBrowser.Controller.Entities.TV;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
@@ -11,12 +12,21 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class EpisodeResolver : BaseVideoResolver<Episode>
|
public class EpisodeResolver : BaseVideoResolver<Episode>
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="EpisodeResolver"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="libraryManager">The library manager.</param>
|
||||||
|
public EpisodeResolver(ILibraryManager libraryManager)
|
||||||
|
: base(libraryManager)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Resolves the specified args.
|
/// Resolves the specified args.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="args">The args.</param>
|
/// <param name="args">The args.</param>
|
||||||
/// <returns>Episode.</returns>
|
/// <returns>Episode.</returns>
|
||||||
protected override Episode Resolve(ItemResolveArgs args)
|
public override Episode Resolve(ItemResolveArgs args)
|
||||||
{
|
{
|
||||||
var parent = args.Parent;
|
var parent = args.Parent;
|
||||||
|
|
||||||
@@ -34,11 +44,12 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
|||||||
season = parent.GetParents().OfType<Season>().FirstOrDefault();
|
season = parent.GetParents().OfType<Season>().FirstOrDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the parent is a Season or Series, then this is an Episode if the VideoResolver returns something
|
// If the parent is a Season or Series and the parent is not an extras folder, then this is an Episode if the VideoResolver returns something
|
||||||
// Also handle flat tv folders
|
// Also handle flat tv folders
|
||||||
if (season != null ||
|
if ((season != null ||
|
||||||
string.Equals(args.GetCollectionType(), CollectionType.TvShows, StringComparison.OrdinalIgnoreCase) ||
|
string.Equals(args.GetCollectionType(), CollectionType.TvShows, StringComparison.OrdinalIgnoreCase) ||
|
||||||
args.HasParent<Series>())
|
args.HasParent<Series>())
|
||||||
|
&& (parent is Series || !BaseItem.AllExtrasTypesFolderNames.Contains(parent.Name, StringComparer.OrdinalIgnoreCase)))
|
||||||
{
|
{
|
||||||
var episode = ResolveVideo<Episode>(args, false);
|
var episode = ResolveVideo<Episode>(args, false);
|
||||||
|
|
||||||
@@ -74,14 +85,5 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="EpisodeResolver"/> class.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="libraryManager">The library manager.</param>
|
|
||||||
public EpisodeResolver(ILibraryManager libraryManager)
|
|
||||||
: base(libraryManager)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,8 +93,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||||||
Directory.CreateDirectory(Path.GetDirectoryName(logFilePath));
|
Directory.CreateDirectory(Path.GetDirectoryName(logFilePath));
|
||||||
|
|
||||||
// FFMpeg writes debug/error info to stderr. This is useful when debugging so let's put it in the log directory.
|
// FFMpeg writes debug/error info to stderr. This is useful when debugging so let's put it in the log directory.
|
||||||
// use FileShare.None as this bypasses dotnet bug dotnet/runtime#42790 .
|
_logFileStream = new FileStream(logFilePath, FileMode.Create, FileAccess.Write, FileShare.Read, IODefaults.FileStreamBufferSize, true);
|
||||||
_logFileStream = new FileStream(logFilePath, FileMode.Create, FileAccess.Write, FileShare.None, IODefaults.FileStreamBufferSize, true);
|
|
||||||
|
|
||||||
var commandLineLogMessageBytes = Encoding.UTF8.GetBytes(_json.SerializeToString(mediaSource) + Environment.NewLine + Environment.NewLine + commandLineLogMessage + Environment.NewLine + Environment.NewLine);
|
var commandLineLogMessageBytes = Encoding.UTF8.GetBytes(_json.SerializeToString(mediaSource) + Environment.NewLine + Environment.NewLine + commandLineLogMessage + Environment.NewLine + Environment.NewLine);
|
||||||
_logFileStream.Write(commandLineLogMessageBytes, 0, commandLineLogMessageBytes.Length);
|
_logFileStream.Write(commandLineLogMessageBytes, 0, commandLineLogMessageBytes.Length);
|
||||||
|
|||||||
@@ -193,8 +193,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
|||||||
{
|
{
|
||||||
var resolved = false;
|
var resolved = false;
|
||||||
|
|
||||||
// use FileShare.None as this bypasses dotnet bug dotnet/runtime#42790 .
|
using (var fileStream = new FileStream(file, FileMode.Create, FileAccess.Write, FileShare.Read))
|
||||||
using (var fileStream = new FileStream(file, FileMode.Create, FileAccess.Write, FileShare.None))
|
|
||||||
{
|
{
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -136,8 +136,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
|||||||
Logger.LogInformation("Beginning {0} stream to {1}", GetType().Name, TempFilePath);
|
Logger.LogInformation("Beginning {0} stream to {1}", GetType().Name, TempFilePath);
|
||||||
using var message = response;
|
using var message = response;
|
||||||
await using var stream = await response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
|
await using var stream = await response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
|
||||||
// use FileShare.None as this bypasses dotnet bug dotnet/runtime#42790 .
|
await using var fileStream = new FileStream(TempFilePath, FileMode.Create, FileAccess.Write, FileShare.Read);
|
||||||
await using var fileStream = new FileStream(TempFilePath, FileMode.Create, FileAccess.Write, FileShare.None);
|
|
||||||
await StreamHelper.CopyToAsync(
|
await StreamHelper.CopyToAsync(
|
||||||
stream,
|
stream,
|
||||||
fileStream,
|
fileStream,
|
||||||
|
|||||||
@@ -63,7 +63,13 @@ namespace Jellyfin.Api.Controllers
|
|||||||
{
|
{
|
||||||
// TODO: Deprecate with new iOS app
|
// TODO: Deprecate with new iOS app
|
||||||
var file = segmentId + Path.GetExtension(Request.Path);
|
var file = segmentId + Path.GetExtension(Request.Path);
|
||||||
file = Path.Combine(_serverConfigurationManager.GetTranscodePath(), file);
|
var transcodePath = _serverConfigurationManager.GetTranscodePath();
|
||||||
|
file = Path.GetFullPath(Path.Combine(transcodePath, file));
|
||||||
|
var fileDir = Path.GetDirectoryName(file);
|
||||||
|
if (string.IsNullOrEmpty(fileDir) || !fileDir.StartsWith(transcodePath))
|
||||||
|
{
|
||||||
|
return BadRequest("Invalid segment.");
|
||||||
|
}
|
||||||
|
|
||||||
return FileStreamResponseHelpers.GetStaticFileResult(file, MimeTypes.GetMimeType(file)!, false, HttpContext);
|
return FileStreamResponseHelpers.GetStaticFileResult(file, MimeTypes.GetMimeType(file)!, false, HttpContext);
|
||||||
}
|
}
|
||||||
@@ -83,7 +89,13 @@ namespace Jellyfin.Api.Controllers
|
|||||||
public ActionResult GetHlsPlaylistLegacy([FromRoute, Required] string itemId, [FromRoute, Required] string playlistId)
|
public ActionResult GetHlsPlaylistLegacy([FromRoute, Required] string itemId, [FromRoute, Required] string playlistId)
|
||||||
{
|
{
|
||||||
var file = playlistId + Path.GetExtension(Request.Path);
|
var file = playlistId + Path.GetExtension(Request.Path);
|
||||||
file = Path.Combine(_serverConfigurationManager.GetTranscodePath(), file);
|
var transcodePath = _serverConfigurationManager.GetTranscodePath();
|
||||||
|
file = Path.GetFullPath(Path.Combine(transcodePath, file));
|
||||||
|
var fileDir = Path.GetDirectoryName(file);
|
||||||
|
if (string.IsNullOrEmpty(fileDir) || !fileDir.StartsWith(transcodePath) || Path.GetExtension(file) != ".m3u8")
|
||||||
|
{
|
||||||
|
return BadRequest("Invalid segment.");
|
||||||
|
}
|
||||||
|
|
||||||
return GetFileResult(file, file);
|
return GetFileResult(file, file);
|
||||||
}
|
}
|
||||||
@@ -132,7 +144,12 @@ namespace Jellyfin.Api.Controllers
|
|||||||
var file = segmentId + Path.GetExtension(Request.Path);
|
var file = segmentId + Path.GetExtension(Request.Path);
|
||||||
var transcodeFolderPath = _serverConfigurationManager.GetTranscodePath();
|
var transcodeFolderPath = _serverConfigurationManager.GetTranscodePath();
|
||||||
|
|
||||||
file = Path.Combine(transcodeFolderPath, file);
|
file = Path.GetFullPath(Path.Combine(transcodeFolderPath, file));
|
||||||
|
var fileDir = Path.GetDirectoryName(file);
|
||||||
|
if (string.IsNullOrEmpty(fileDir) || !fileDir.StartsWith(transcodeFolderPath))
|
||||||
|
{
|
||||||
|
return BadRequest("Invalid segment.");
|
||||||
|
}
|
||||||
|
|
||||||
var normalizedPlaylistId = playlistId;
|
var normalizedPlaylistId = playlistId;
|
||||||
|
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
: type;
|
: type;
|
||||||
|
|
||||||
var path = BaseItem.SupportedImageExtensions
|
var path = BaseItem.SupportedImageExtensions
|
||||||
.Select(i => Path.Combine(_applicationPaths.GeneralPath, name, filename + i))
|
.Select(i => Path.GetFullPath(Path.Combine(_applicationPaths.GeneralPath, name, filename + i)))
|
||||||
.FirstOrDefault(System.IO.File.Exists);
|
.FirstOrDefault(System.IO.File.Exists);
|
||||||
|
|
||||||
if (path == null)
|
if (path == null)
|
||||||
@@ -82,6 +82,11 @@ namespace Jellyfin.Api.Controllers
|
|||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!path.StartsWith(_applicationPaths.GeneralPath))
|
||||||
|
{
|
||||||
|
return BadRequest("Invalid image path.");
|
||||||
|
}
|
||||||
|
|
||||||
var contentType = MimeTypes.GetMimeType(path);
|
var contentType = MimeTypes.GetMimeType(path);
|
||||||
return File(System.IO.File.OpenRead(path), contentType);
|
return File(System.IO.File.OpenRead(path), contentType);
|
||||||
}
|
}
|
||||||
@@ -163,7 +168,8 @@ namespace Jellyfin.Api.Controllers
|
|||||||
/// <returns>A <see cref="FileStreamResult"/> containing the image contents on success, or a <see cref="NotFoundResult"/> if the image could not be found.</returns>
|
/// <returns>A <see cref="FileStreamResult"/> containing the image contents on success, or a <see cref="NotFoundResult"/> if the image could not be found.</returns>
|
||||||
private ActionResult GetImageFile(string basePath, string theme, string? name)
|
private ActionResult GetImageFile(string basePath, string theme, string? name)
|
||||||
{
|
{
|
||||||
var themeFolder = Path.Combine(basePath, theme);
|
var themeFolder = Path.GetFullPath(Path.Combine(basePath, theme));
|
||||||
|
|
||||||
if (Directory.Exists(themeFolder))
|
if (Directory.Exists(themeFolder))
|
||||||
{
|
{
|
||||||
var path = BaseItem.SupportedImageExtensions.Select(i => Path.Combine(themeFolder, name + i))
|
var path = BaseItem.SupportedImageExtensions.Select(i => Path.Combine(themeFolder, name + i))
|
||||||
@@ -171,12 +177,18 @@ namespace Jellyfin.Api.Controllers
|
|||||||
|
|
||||||
if (!string.IsNullOrEmpty(path) && System.IO.File.Exists(path))
|
if (!string.IsNullOrEmpty(path) && System.IO.File.Exists(path))
|
||||||
{
|
{
|
||||||
|
if (!path.StartsWith(basePath))
|
||||||
|
{
|
||||||
|
return BadRequest("Invalid image path.");
|
||||||
|
}
|
||||||
|
|
||||||
var contentType = MimeTypes.GetMimeType(path);
|
var contentType = MimeTypes.GetMimeType(path);
|
||||||
|
|
||||||
return PhysicalFile(path, contentType);
|
return PhysicalFile(path, contentType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var allFolder = Path.Combine(basePath, "all");
|
var allFolder = Path.GetFullPath(Path.Combine(basePath, "all"));
|
||||||
if (Directory.Exists(allFolder))
|
if (Directory.Exists(allFolder))
|
||||||
{
|
{
|
||||||
var path = BaseItem.SupportedImageExtensions.Select(i => Path.Combine(allFolder, name + i))
|
var path = BaseItem.SupportedImageExtensions.Select(i => Path.Combine(allFolder, name + i))
|
||||||
@@ -184,6 +196,11 @@ namespace Jellyfin.Api.Controllers
|
|||||||
|
|
||||||
if (!string.IsNullOrEmpty(path) && System.IO.File.Exists(path))
|
if (!string.IsNullOrEmpty(path) && System.IO.File.Exists(path))
|
||||||
{
|
{
|
||||||
|
if (!path.StartsWith(basePath))
|
||||||
|
{
|
||||||
|
return BadRequest("Invalid image path.");
|
||||||
|
}
|
||||||
|
|
||||||
var contentType = MimeTypes.GetMimeType(path);
|
var contentType = MimeTypes.GetMimeType(path);
|
||||||
return PhysicalFile(path, contentType);
|
return PhysicalFile(path, contentType);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates an instant playlist based on a given song.
|
/// Creates an instant playlist based on a given album.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id">The item id.</param>
|
/// <param name="id">The item id.</param>
|
||||||
/// <param name="userId">Optional. Filter by user id, and attach user data.</param>
|
/// <param name="userId">Optional. Filter by user id, and attach user data.</param>
|
||||||
@@ -123,7 +123,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates an instant playlist based on a given song.
|
/// Creates an instant playlist based on a given playlist.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id">The item id.</param>
|
/// <param name="id">The item id.</param>
|
||||||
/// <param name="userId">Optional. Filter by user id, and attach user data.</param>
|
/// <param name="userId">Optional. Filter by user id, and attach user data.</param>
|
||||||
@@ -159,7 +159,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates an instant playlist based on a given song.
|
/// Creates an instant playlist based on a given genre.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="name">The genre name.</param>
|
/// <param name="name">The genre name.</param>
|
||||||
/// <param name="userId">Optional. Filter by user id, and attach user data.</param>
|
/// <param name="userId">Optional. Filter by user id, and attach user data.</param>
|
||||||
@@ -173,7 +173,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
/// <returns>A <see cref="QueryResult{BaseItemDto}"/> with the playlist items.</returns>
|
/// <returns>A <see cref="QueryResult{BaseItemDto}"/> with the playlist items.</returns>
|
||||||
[HttpGet("MusicGenres/{name}/InstantMix")]
|
[HttpGet("MusicGenres/{name}/InstantMix")]
|
||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
public ActionResult<QueryResult<BaseItemDto>> GetInstantMixFromMusicGenre(
|
public ActionResult<QueryResult<BaseItemDto>> GetInstantMixFromMusicGenreByName(
|
||||||
[FromRoute, Required] string name,
|
[FromRoute, Required] string name,
|
||||||
[FromQuery] Guid? userId,
|
[FromQuery] Guid? userId,
|
||||||
[FromQuery] int? limit,
|
[FromQuery] int? limit,
|
||||||
@@ -194,7 +194,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates an instant playlist based on a given song.
|
/// Creates an instant playlist based on a given artist.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id">The item id.</param>
|
/// <param name="id">The item id.</param>
|
||||||
/// <param name="userId">Optional. Filter by user id, and attach user data.</param>
|
/// <param name="userId">Optional. Filter by user id, and attach user data.</param>
|
||||||
@@ -230,7 +230,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates an instant playlist based on a given song.
|
/// Creates an instant playlist based on a given genre.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id">The item id.</param>
|
/// <param name="id">The item id.</param>
|
||||||
/// <param name="userId">Optional. Filter by user id, and attach user data.</param>
|
/// <param name="userId">Optional. Filter by user id, and attach user data.</param>
|
||||||
@@ -244,7 +244,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
/// <returns>A <see cref="QueryResult{BaseItemDto}"/> with the playlist items.</returns>
|
/// <returns>A <see cref="QueryResult{BaseItemDto}"/> with the playlist items.</returns>
|
||||||
[HttpGet("MusicGenres/{id}/InstantMix")]
|
[HttpGet("MusicGenres/{id}/InstantMix")]
|
||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
public ActionResult<QueryResult<BaseItemDto>> GetInstantMixFromMusicGenres(
|
public ActionResult<QueryResult<BaseItemDto>> GetInstantMixFromMusicGenreById(
|
||||||
[FromRoute, Required] Guid id,
|
[FromRoute, Required] Guid id,
|
||||||
[FromQuery] Guid? userId,
|
[FromQuery] Guid? userId,
|
||||||
[FromQuery] int? limit,
|
[FromQuery] int? limit,
|
||||||
@@ -266,7 +266,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates an instant playlist based on a given song.
|
/// Creates an instant playlist based on a given item.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id">The item id.</param>
|
/// <param name="id">The item id.</param>
|
||||||
/// <param name="userId">Optional. Filter by user id, and attach user data.</param>
|
/// <param name="userId">Optional. Filter by user id, and attach user data.</param>
|
||||||
@@ -301,6 +301,80 @@ namespace Jellyfin.Api.Controllers
|
|||||||
return GetResult(items, user, limit, dtoOptions);
|
return GetResult(items, user, limit, dtoOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates an instant playlist based on a given artist.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The item id.</param>
|
||||||
|
/// <param name="userId">Optional. Filter by user id, and attach user data.</param>
|
||||||
|
/// <param name="limit">Optional. The maximum number of records to return.</param>
|
||||||
|
/// <param name="fields">Optional. Specify additional fields of information to return in the output.</param>
|
||||||
|
/// <param name="enableImages">Optional. Include image information in output.</param>
|
||||||
|
/// <param name="enableUserData">Optional. Include user data.</param>
|
||||||
|
/// <param name="imageTypeLimit">Optional. The max number of images to return, per image type.</param>
|
||||||
|
/// <param name="enableImageTypes">Optional. The image types to include in the output.</param>
|
||||||
|
/// <response code="200">Instant playlist returned.</response>
|
||||||
|
/// <returns>A <see cref="QueryResult{BaseItemDto}"/> with the playlist items.</returns>
|
||||||
|
[HttpGet("Artists/InstantMix")]
|
||||||
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
[Obsolete("Use GetInstantMixFromArtists")]
|
||||||
|
public ActionResult<QueryResult<BaseItemDto>> GetInstantMixFromArtists2(
|
||||||
|
[FromQuery, Required] Guid id,
|
||||||
|
[FromQuery] Guid? userId,
|
||||||
|
[FromQuery] int? limit,
|
||||||
|
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ItemFields[] fields,
|
||||||
|
[FromQuery] bool? enableImages,
|
||||||
|
[FromQuery] bool? enableUserData,
|
||||||
|
[FromQuery] int? imageTypeLimit,
|
||||||
|
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ImageType[] enableImageTypes)
|
||||||
|
{
|
||||||
|
return GetInstantMixFromArtists(
|
||||||
|
id,
|
||||||
|
userId,
|
||||||
|
limit,
|
||||||
|
fields,
|
||||||
|
enableImages,
|
||||||
|
enableUserData,
|
||||||
|
imageTypeLimit,
|
||||||
|
enableImageTypes);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates an instant playlist based on a given genre.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The item id.</param>
|
||||||
|
/// <param name="userId">Optional. Filter by user id, and attach user data.</param>
|
||||||
|
/// <param name="limit">Optional. The maximum number of records to return.</param>
|
||||||
|
/// <param name="fields">Optional. Specify additional fields of information to return in the output.</param>
|
||||||
|
/// <param name="enableImages">Optional. Include image information in output.</param>
|
||||||
|
/// <param name="enableUserData">Optional. Include user data.</param>
|
||||||
|
/// <param name="imageTypeLimit">Optional. The max number of images to return, per image type.</param>
|
||||||
|
/// <param name="enableImageTypes">Optional. The image types to include in the output.</param>
|
||||||
|
/// <response code="200">Instant playlist returned.</response>
|
||||||
|
/// <returns>A <see cref="QueryResult{BaseItemDto}"/> with the playlist items.</returns>
|
||||||
|
[HttpGet("MusicGenres/InstantMix")]
|
||||||
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
[Obsolete("Use GetInstantMixFromMusicGenres instead")]
|
||||||
|
public ActionResult<QueryResult<BaseItemDto>> GetInstantMixFromMusicGenreById2(
|
||||||
|
[FromQuery, Required] Guid id,
|
||||||
|
[FromQuery] Guid? userId,
|
||||||
|
[FromQuery] int? limit,
|
||||||
|
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ItemFields[] fields,
|
||||||
|
[FromQuery] bool? enableImages,
|
||||||
|
[FromQuery] bool? enableUserData,
|
||||||
|
[FromQuery] int? imageTypeLimit,
|
||||||
|
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ImageType[] enableImageTypes)
|
||||||
|
{
|
||||||
|
return GetInstantMixFromMusicGenreById(
|
||||||
|
id,
|
||||||
|
userId,
|
||||||
|
limit,
|
||||||
|
fields,
|
||||||
|
enableImages,
|
||||||
|
enableUserData,
|
||||||
|
imageTypeLimit,
|
||||||
|
enableImageTypes);
|
||||||
|
}
|
||||||
|
|
||||||
private QueryResult<BaseItemDto> GetResult(List<BaseItem> items, User? user, int? limit, DtoOptions dtoOptions)
|
private QueryResult<BaseItemDto> GetResult(List<BaseItem> items, User? user, int? limit, DtoOptions dtoOptions)
|
||||||
{
|
{
|
||||||
var list = items;
|
var list = items;
|
||||||
|
|||||||
@@ -304,7 +304,7 @@ namespace Jellyfin.Api.Controllers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <response code="204">Library scan started.</response>
|
/// <response code="204">Library scan started.</response>
|
||||||
/// <returns>A <see cref="NoContentResult"/>.</returns>
|
/// <returns>A <see cref="NoContentResult"/>.</returns>
|
||||||
[HttpGet("Library/Refresh")]
|
[HttpPost("Library/Refresh")]
|
||||||
[Authorize(Policy = Policies.RequiresElevation)]
|
[Authorize(Policy = Policies.RequiresElevation)]
|
||||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||||
public async Task<ActionResult> RefreshLibrary()
|
public async Task<ActionResult> RefreshLibrary()
|
||||||
@@ -591,15 +591,15 @@ namespace Jellyfin.Api.Controllers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reports that new movies have been added by an external source.
|
/// Reports that new movies have been added by an external source.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="updates">A list of updated media paths.</param>
|
/// <param name="dto">The update paths.</param>
|
||||||
/// <response code="204">Report success.</response>
|
/// <response code="204">Report success.</response>
|
||||||
/// <returns>A <see cref="NoContentResult"/>.</returns>
|
/// <returns>A <see cref="NoContentResult"/>.</returns>
|
||||||
[HttpPost("Library/Media/Updated")]
|
[HttpPost("Library/Media/Updated")]
|
||||||
[Authorize(Policy = Policies.DefaultAuthorization)]
|
[Authorize(Policy = Policies.DefaultAuthorization)]
|
||||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||||
public ActionResult PostUpdatedMedia([FromBody, Required] MediaUpdateInfoDto[] updates)
|
public ActionResult PostUpdatedMedia([FromBody, Required] MediaUpdateInfoDto dto)
|
||||||
{
|
{
|
||||||
foreach (var item in updates)
|
foreach (var item in dto.Updates)
|
||||||
{
|
{
|
||||||
_libraryMonitor.ReportFileSystemChanged(item.Path);
|
_libraryMonitor.ReportFileSystemChanged(item.Path);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Jellyfin.Api.Constants;
|
using Jellyfin.Api.Constants;
|
||||||
@@ -86,26 +87,19 @@ namespace Jellyfin.Api.Controllers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sends a notification to all admins.
|
/// Sends a notification to all admins.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="url">The URL of the notification.</param>
|
/// <param name="notificationDto">The notification request.</param>
|
||||||
/// <param name="level">The level of the notification.</param>
|
|
||||||
/// <param name="name">The name of the notification.</param>
|
|
||||||
/// <param name="description">The description of the notification.</param>
|
|
||||||
/// <response code="204">Notification sent.</response>
|
/// <response code="204">Notification sent.</response>
|
||||||
/// <returns>A <cref see="NoContentResult"/>.</returns>
|
/// <returns>A <cref see="NoContentResult"/>.</returns>
|
||||||
[HttpPost("Admin")]
|
[HttpPost("Admin")]
|
||||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||||
public ActionResult CreateAdminNotification(
|
public ActionResult CreateAdminNotification([FromBody, Required] AdminNotificationDto notificationDto)
|
||||||
[FromQuery] string? url,
|
|
||||||
[FromQuery] NotificationLevel? level,
|
|
||||||
[FromQuery] string name = "",
|
|
||||||
[FromQuery] string description = "")
|
|
||||||
{
|
{
|
||||||
var notification = new NotificationRequest
|
var notification = new NotificationRequest
|
||||||
{
|
{
|
||||||
Name = name,
|
Name = notificationDto.Name,
|
||||||
Description = description,
|
Description = notificationDto.Description,
|
||||||
Url = url,
|
Url = notificationDto.Url,
|
||||||
Level = level ?? NotificationLevel.Normal,
|
Level = notificationDto.NotificationLevel ?? NotificationLevel.Normal,
|
||||||
UserIds = _userManager.Users
|
UserIds = _userManager.Users
|
||||||
.Where(user => user.HasPermission(PermissionKind.IsAdministrator))
|
.Where(user => user.HasPermission(PermissionKind.IsAdministrator))
|
||||||
.Select(user => user.Id)
|
.Select(user => user.Id)
|
||||||
@@ -114,7 +108,6 @@ namespace Jellyfin.Api.Controllers
|
|||||||
};
|
};
|
||||||
|
|
||||||
_notificationManager.SendNotification(notification, CancellationToken.None);
|
_notificationManager.SendNotification(notification, CancellationToken.None);
|
||||||
|
|
||||||
return NoContent();
|
return NoContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -508,17 +508,15 @@ namespace Jellyfin.Api.Helpers
|
|||||||
|
|
||||||
private static void ApplyDeviceProfileSettings(StreamState state, IDlnaManager dlnaManager, IDeviceManager deviceManager, HttpRequest request, string? deviceProfileId, bool? @static)
|
private static void ApplyDeviceProfileSettings(StreamState state, IDlnaManager dlnaManager, IDeviceManager deviceManager, HttpRequest request, string? deviceProfileId, bool? @static)
|
||||||
{
|
{
|
||||||
var headers = request.Headers;
|
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(deviceProfileId))
|
if (!string.IsNullOrWhiteSpace(deviceProfileId))
|
||||||
{
|
{
|
||||||
state.DeviceProfile = dlnaManager.GetProfile(deviceProfileId);
|
state.DeviceProfile = dlnaManager.GetProfile(deviceProfileId);
|
||||||
}
|
|
||||||
else if (!string.IsNullOrWhiteSpace(deviceProfileId))
|
|
||||||
{
|
|
||||||
var caps = deviceManager.GetCapabilities(deviceProfileId);
|
|
||||||
|
|
||||||
state.DeviceProfile = caps == null ? dlnaManager.GetProfile(headers) : caps.DeviceProfile;
|
if (state.DeviceProfile == null)
|
||||||
|
{
|
||||||
|
var caps = deviceManager.GetCapabilities(deviceProfileId);
|
||||||
|
state.DeviceProfile = caps == null ? dlnaManager.GetProfile(request.Headers) : caps.DeviceProfile;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var profile = state.DeviceProfile;
|
var profile = state.DeviceProfile;
|
||||||
|
|||||||
@@ -553,8 +553,7 @@ namespace Jellyfin.Api.Helpers
|
|||||||
$"{logFilePrefix}{DateTime.Now:yyyy-MM-dd_HH-mm-ss}_{state.Request.MediaSourceId}_{Guid.NewGuid().ToString()[..8]}.log");
|
$"{logFilePrefix}{DateTime.Now:yyyy-MM-dd_HH-mm-ss}_{state.Request.MediaSourceId}_{Guid.NewGuid().ToString()[..8]}.log");
|
||||||
|
|
||||||
// FFmpeg writes debug/error info to stderr. This is useful when debugging so let's put it in the log directory.
|
// FFmpeg writes debug/error info to stderr. This is useful when debugging so let's put it in the log directory.
|
||||||
// use FileShare.None as this bypasses dotnet bug dotnet/runtime#42790 .
|
Stream logStream = new FileStream(logFilePath, FileMode.Create, FileAccess.Write, FileShare.Read, IODefaults.FileStreamBufferSize, true);
|
||||||
Stream logStream = new FileStream(logFilePath, FileMode.Create, FileAccess.Write, FileShare.None, IODefaults.FileStreamBufferSize, true);
|
|
||||||
|
|
||||||
var commandLineLogMessageBytes = Encoding.UTF8.GetBytes(request.Path + Environment.NewLine + Environment.NewLine + JsonSerializer.Serialize(state.MediaSource) + Environment.NewLine + Environment.NewLine + commandLineLogMessage + Environment.NewLine + Environment.NewLine);
|
var commandLineLogMessageBytes = Encoding.UTF8.GetBytes(request.Path + Environment.NewLine + Environment.NewLine + JsonSerializer.Serialize(state.MediaSource) + Environment.NewLine + Environment.NewLine + commandLineLogMessage + Environment.NewLine + Environment.NewLine);
|
||||||
await logStream.WriteAsync(commandLineLogMessageBytes, 0, commandLineLogMessageBytes.Length, cancellationTokenSource.Token).ConfigureAwait(false);
|
await logStream.WriteAsync(commandLineLogMessageBytes, 0, commandLineLogMessageBytes.Length, cancellationTokenSource.Token).ConfigureAwait(false);
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
namespace Jellyfin.Api.Models.LibraryDtos
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Jellyfin.Api.Models.LibraryDtos
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Media Update Info Dto.
|
/// Media Update Info Dto.
|
||||||
@@ -6,14 +9,8 @@
|
|||||||
public class MediaUpdateInfoDto
|
public class MediaUpdateInfoDto
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets media path.
|
/// Gets or sets the list of updates.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? Path { get; set; }
|
public IReadOnlyList<MediaUpdateInfoPathDto> Updates { get; set; } = Array.Empty<MediaUpdateInfoPathDto>();
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets media update type.
|
|
||||||
/// Created, Modified, Deleted.
|
|
||||||
/// </summary>
|
|
||||||
public string? UpdateType { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
namespace Jellyfin.Api.Models.LibraryDtos
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The media update info path.
|
||||||
|
/// </summary>
|
||||||
|
public class MediaUpdateInfoPathDto
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets media path.
|
||||||
|
/// </summary>
|
||||||
|
public string? Path { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets media update type.
|
||||||
|
/// Created, Modified, Deleted.
|
||||||
|
/// </summary>
|
||||||
|
public string? UpdateType { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
using MediaBrowser.Model.Notifications;
|
||||||
|
|
||||||
|
namespace Jellyfin.Api.Models.NotificationDtos
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The admin notification dto.
|
||||||
|
/// </summary>
|
||||||
|
public class AdminNotificationDto
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the notification name.
|
||||||
|
/// </summary>
|
||||||
|
public string? Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the notification description.
|
||||||
|
/// </summary>
|
||||||
|
public string? Description { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the notification level.
|
||||||
|
/// </summary>
|
||||||
|
public NotificationLevel? NotificationLevel { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the notification url.
|
||||||
|
/// </summary>
|
||||||
|
public string? Url { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Authors>Jellyfin Contributors</Authors>
|
<Authors>Jellyfin Contributors</Authors>
|
||||||
<PackageId>Jellyfin.Data</PackageId>
|
<PackageId>Jellyfin.Data</PackageId>
|
||||||
<VersionPrefix>10.7.0</VersionPrefix>
|
<VersionPrefix>10.7.1</VersionPrefix>
|
||||||
<RepositoryUrl>https://github.com/jellyfin/jellyfin</RepositoryUrl>
|
<RepositoryUrl>https://github.com/jellyfin/jellyfin</RepositoryUrl>
|
||||||
<PackageLicenseExpression>GPL-3.0-only</PackageLicenseExpression>
|
<PackageLicenseExpression>GPL-3.0-only</PackageLicenseExpression>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
@@ -261,15 +261,16 @@ namespace Jellyfin.Server.Extensions
|
|||||||
{
|
{
|
||||||
return serviceCollection.AddSwaggerGen(c =>
|
return serviceCollection.AddSwaggerGen(c =>
|
||||||
{
|
{
|
||||||
|
var version = typeof(ApplicationHost).Assembly.GetName().Version?.ToString() ?? "0.0.0.1";
|
||||||
c.SwaggerDoc("api-docs", new OpenApiInfo
|
c.SwaggerDoc("api-docs", new OpenApiInfo
|
||||||
{
|
{
|
||||||
Title = "Jellyfin API",
|
Title = "Jellyfin API",
|
||||||
Version = "v1",
|
Version = version,
|
||||||
Extensions = new Dictionary<string, IOpenApiExtension>
|
Extensions = new Dictionary<string, IOpenApiExtension>
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
"x-jellyfin-version",
|
"x-jellyfin-version",
|
||||||
new OpenApiString(typeof(ApplicationHost).Assembly.GetName().Version?.ToString())
|
new OpenApiString(version)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ namespace Jellyfin.Server.Filters
|
|||||||
context.SchemaGenerator.GenerateSchema(typeof(GeneralCommandType), context.SchemaRepository);
|
context.SchemaGenerator.GenerateSchema(typeof(GeneralCommandType), context.SchemaRepository);
|
||||||
|
|
||||||
context.SchemaGenerator.GenerateSchema(typeof(GroupUpdate<object>), context.SchemaRepository);
|
context.SchemaGenerator.GenerateSchema(typeof(GroupUpdate<object>), context.SchemaRepository);
|
||||||
|
|
||||||
|
context.SchemaGenerator.GenerateSchema(typeof(SessionMessageType), context.SchemaRepository);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
using System;
|
||||||
|
using System.Buffers;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.Json;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace MediaBrowser.Common.Json.Converters
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Converter to allow the serializer to read strings.
|
||||||
|
/// </summary>
|
||||||
|
public class JsonStringConverter : JsonConverter<string>
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override string Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||||
|
{
|
||||||
|
return reader.TokenType switch
|
||||||
|
{
|
||||||
|
JsonTokenType.Null => null,
|
||||||
|
JsonTokenType.String => reader.GetString(),
|
||||||
|
_ => GetRawValue(reader)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override void Write(Utf8JsonWriter writer, string value, JsonSerializerOptions options)
|
||||||
|
{
|
||||||
|
writer.WriteStringValue(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string GetRawValue(Utf8JsonReader reader)
|
||||||
|
{
|
||||||
|
var utf8Bytes = reader.HasValueSequence
|
||||||
|
? reader.ValueSequence.ToArray()
|
||||||
|
: reader.ValueSpan;
|
||||||
|
return Encoding.UTF8.GetString(utf8Bytes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -40,7 +40,8 @@ namespace MediaBrowser.Common.Json
|
|||||||
new JsonStringEnumConverter(),
|
new JsonStringEnumConverter(),
|
||||||
new JsonNullableStructConverterFactory(),
|
new JsonNullableStructConverterFactory(),
|
||||||
new JsonBoolNumberConverter(),
|
new JsonBoolNumberConverter(),
|
||||||
new JsonDateTimeConverter()
|
new JsonDateTimeConverter(),
|
||||||
|
new JsonStringConverter()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Authors>Jellyfin Contributors</Authors>
|
<Authors>Jellyfin Contributors</Authors>
|
||||||
<PackageId>Jellyfin.Common</PackageId>
|
<PackageId>Jellyfin.Common</PackageId>
|
||||||
<VersionPrefix>10.7.0</VersionPrefix>
|
<VersionPrefix>10.7.1</VersionPrefix>
|
||||||
<RepositoryUrl>https://github.com/jellyfin/jellyfin</RepositoryUrl>
|
<RepositoryUrl>https://github.com/jellyfin/jellyfin</RepositoryUrl>
|
||||||
<PackageLicenseExpression>GPL-3.0-only</PackageLicenseExpression>
|
<PackageLicenseExpression>GPL-3.0-only</PackageLicenseExpression>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
#pragma warning disable CS1591
|
#pragma warning disable CS1591
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using MediaBrowser.Controller.Library;
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.Entities.Audio
|
namespace MediaBrowser.Controller.Entities.Audio
|
||||||
{
|
{
|
||||||
@@ -23,15 +25,7 @@ namespace MediaBrowser.Controller.Entities.Audio
|
|||||||
public static IEnumerable<string> GetAllArtists<T>(this T item)
|
public static IEnumerable<string> GetAllArtists<T>(this T item)
|
||||||
where T : IHasArtist, IHasAlbumArtist
|
where T : IHasArtist, IHasAlbumArtist
|
||||||
{
|
{
|
||||||
foreach (var i in item.AlbumArtists)
|
return item.AlbumArtists.Concat(item.Artists).DistinctNames();
|
||||||
{
|
|
||||||
yield return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var i in item.Artists)
|
|
||||||
{
|
|
||||||
yield return i;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,10 @@ namespace MediaBrowser.Controller.Library
|
|||||||
{
|
{
|
||||||
public static class NameExtensions
|
public static class NameExtensions
|
||||||
{
|
{
|
||||||
|
public static IEnumerable<string> DistinctNames(this IEnumerable<string> names)
|
||||||
|
=> names.GroupBy(RemoveDiacritics, StringComparer.OrdinalIgnoreCase)
|
||||||
|
.Select(x => x.First());
|
||||||
|
|
||||||
private static string RemoveDiacritics(string? name)
|
private static string RemoveDiacritics(string? name)
|
||||||
{
|
{
|
||||||
if (name == null)
|
if (name == null)
|
||||||
@@ -19,9 +23,5 @@ namespace MediaBrowser.Controller.Library
|
|||||||
|
|
||||||
return name.RemoveDiacritics();
|
return name.RemoveDiacritics();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IEnumerable<string> DistinctNames(this IEnumerable<string> names)
|
|
||||||
=> names.GroupBy(RemoveDiacritics, StringComparer.OrdinalIgnoreCase)
|
|
||||||
.Select(x => x.First());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Authors>Jellyfin Contributors</Authors>
|
<Authors>Jellyfin Contributors</Authors>
|
||||||
<PackageId>Jellyfin.Controller</PackageId>
|
<PackageId>Jellyfin.Controller</PackageId>
|
||||||
<VersionPrefix>10.7.0</VersionPrefix>
|
<VersionPrefix>10.7.1</VersionPrefix>
|
||||||
<RepositoryUrl>https://github.com/jellyfin/jellyfin</RepositoryUrl>
|
<RepositoryUrl>https://github.com/jellyfin/jellyfin</RepositoryUrl>
|
||||||
<PackageLicenseExpression>GPL-3.0-only</PackageLicenseExpression>
|
<PackageLicenseExpression>GPL-3.0-only</PackageLicenseExpression>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ namespace MediaBrowser.Controller.Resolvers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="args">The args.</param>
|
/// <param name="args">The args.</param>
|
||||||
/// <returns>`0.</returns>
|
/// <returns>`0.</returns>
|
||||||
protected virtual T Resolve(ItemResolveArgs args)
|
public virtual T Resolve(ItemResolveArgs args)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Authors>Jellyfin Contributors</Authors>
|
<Authors>Jellyfin Contributors</Authors>
|
||||||
<PackageId>Jellyfin.Model</PackageId>
|
<PackageId>Jellyfin.Model</PackageId>
|
||||||
<VersionPrefix>10.7.0</VersionPrefix>
|
<VersionPrefix>10.7.1</VersionPrefix>
|
||||||
<RepositoryUrl>https://github.com/jellyfin/jellyfin</RepositoryUrl>
|
<RepositoryUrl>https://github.com/jellyfin/jellyfin</RepositoryUrl>
|
||||||
<PackageLicenseExpression>GPL-3.0-only</PackageLicenseExpression>
|
<PackageLicenseExpression>GPL-3.0-only</PackageLicenseExpression>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ using System.Threading;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using MediaBrowser.Common.Net;
|
using MediaBrowser.Common.Net;
|
||||||
using MediaBrowser.Controller.Entities.Movies;
|
using MediaBrowser.Controller.Entities.Movies;
|
||||||
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Controller.Providers;
|
using MediaBrowser.Controller.Providers;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.Providers;
|
using MediaBrowser.Model.Providers;
|
||||||
@@ -19,11 +20,13 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.BoxSets
|
|||||||
{
|
{
|
||||||
private readonly IHttpClientFactory _httpClientFactory;
|
private readonly IHttpClientFactory _httpClientFactory;
|
||||||
private readonly TmdbClientManager _tmdbClientManager;
|
private readonly TmdbClientManager _tmdbClientManager;
|
||||||
|
private readonly ILibraryManager _libraryManager;
|
||||||
|
|
||||||
public TmdbBoxSetProvider(IHttpClientFactory httpClientFactory, TmdbClientManager tmdbClientManager)
|
public TmdbBoxSetProvider(IHttpClientFactory httpClientFactory, TmdbClientManager tmdbClientManager, ILibraryManager libraryManager)
|
||||||
{
|
{
|
||||||
_httpClientFactory = httpClientFactory;
|
_httpClientFactory = httpClientFactory;
|
||||||
_tmdbClientManager = tmdbClientManager;
|
_tmdbClientManager = tmdbClientManager;
|
||||||
|
_libraryManager = libraryManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Name => TmdbUtils.ProviderName;
|
public string Name => TmdbUtils.ProviderName;
|
||||||
@@ -83,7 +86,11 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.BoxSets
|
|||||||
// We don't already have an Id, need to fetch it
|
// We don't already have an Id, need to fetch it
|
||||||
if (tmdbId <= 0)
|
if (tmdbId <= 0)
|
||||||
{
|
{
|
||||||
var searchResults = await _tmdbClientManager.SearchCollectionAsync(id.Name, language, cancellationToken).ConfigureAwait(false);
|
// ParseName is required here.
|
||||||
|
// Caller provides the filename with extension stripped and NOT the parsed filename
|
||||||
|
var parsedName = _libraryManager.ParseName(id.Name);
|
||||||
|
var cleanedName = TmdbUtils.CleanName(parsedName.Name);
|
||||||
|
var searchResults = await _tmdbClientManager.SearchCollectionAsync(cleanedName, language, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
if (searchResults != null && searchResults.Count > 0)
|
if (searchResults != null && searchResults.Count > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -140,7 +140,8 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.Movies
|
|||||||
// ParseName is required here.
|
// ParseName is required here.
|
||||||
// Caller provides the filename with extension stripped and NOT the parsed filename
|
// Caller provides the filename with extension stripped and NOT the parsed filename
|
||||||
var parsedName = _libraryManager.ParseName(info.Name);
|
var parsedName = _libraryManager.ParseName(info.Name);
|
||||||
var searchResults = await _tmdbClientManager.SearchMovieAsync(parsedName.Name, parsedName.Year ?? 0, info.MetadataLanguage, cancellationToken).ConfigureAwait(false);
|
var cleanedName = TmdbUtils.CleanName(parsedName.Name);
|
||||||
|
var searchResults = await _tmdbClientManager.SearchMovieAsync(cleanedName, info.Year ?? parsedName.Year ?? 0, info.MetadataLanguage, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
if (searchResults.Count > 0)
|
if (searchResults.Count > 0)
|
||||||
{
|
{
|
||||||
@@ -148,6 +149,15 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.Movies
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(tmdbId) && !string.IsNullOrEmpty(imdbId))
|
||||||
|
{
|
||||||
|
var movieResultFromImdbId = await _tmdbClientManager.FindByExternalIdAsync(imdbId, FindExternalSource.Imdb, info.MetadataLanguage, cancellationToken).ConfigureAwait(false);
|
||||||
|
if (movieResultFromImdbId?.MovieResults.Count > 0)
|
||||||
|
{
|
||||||
|
tmdbId = movieResultFromImdbId.MovieResults[0].Id.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(tmdbId))
|
if (string.IsNullOrEmpty(tmdbId))
|
||||||
{
|
{
|
||||||
return new MetadataResult<Movie>();
|
return new MetadataResult<Movie>();
|
||||||
|
|||||||
@@ -43,9 +43,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV
|
|||||||
|
|
||||||
public async Task<IEnumerable<RemoteSearchResult>> GetSearchResults(SeriesInfo searchInfo, CancellationToken cancellationToken)
|
public async Task<IEnumerable<RemoteSearchResult>> GetSearchResults(SeriesInfo searchInfo, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var tmdbId = searchInfo.GetProviderId(MetadataProvider.Tmdb);
|
if (searchInfo.TryGetProviderId(MetadataProvider.Tmdb, out var tmdbId))
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(tmdbId))
|
|
||||||
{
|
{
|
||||||
var series = await _tmdbClientManager
|
var series = await _tmdbClientManager
|
||||||
.GetSeriesAsync(Convert.ToInt32(tmdbId, CultureInfo.InvariantCulture), searchInfo.MetadataLanguage, searchInfo.MetadataLanguage, cancellationToken)
|
.GetSeriesAsync(Convert.ToInt32(tmdbId, CultureInfo.InvariantCulture), searchInfo.MetadataLanguage, searchInfo.MetadataLanguage, cancellationToken)
|
||||||
@@ -59,9 +57,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var imdbId = searchInfo.GetProviderId(MetadataProvider.Imdb);
|
if (searchInfo.TryGetProviderId(MetadataProvider.Imdb, out var imdbId))
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(imdbId))
|
|
||||||
{
|
{
|
||||||
var findResult = await _tmdbClientManager
|
var findResult = await _tmdbClientManager
|
||||||
.FindByExternalIdAsync(imdbId, FindExternalSource.Imdb, searchInfo.MetadataLanguage, cancellationToken)
|
.FindByExternalIdAsync(imdbId, FindExternalSource.Imdb, searchInfo.MetadataLanguage, cancellationToken)
|
||||||
@@ -82,9 +78,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var tvdbId = searchInfo.GetProviderId(MetadataProvider.Tvdb);
|
if (searchInfo.TryGetProviderId(MetadataProvider.Tvdb, out var tvdbId))
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(tvdbId))
|
|
||||||
{
|
{
|
||||||
var findResult = await _tmdbClientManager
|
var findResult = await _tmdbClientManager
|
||||||
.FindByExternalIdAsync(tvdbId, FindExternalSource.TvDb, searchInfo.MetadataLanguage, cancellationToken)
|
.FindByExternalIdAsync(tvdbId, FindExternalSource.TvDb, searchInfo.MetadataLanguage, cancellationToken)
|
||||||
@@ -171,33 +165,21 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV
|
|||||||
|
|
||||||
var tmdbId = info.GetProviderId(MetadataProvider.Tmdb);
|
var tmdbId = info.GetProviderId(MetadataProvider.Tmdb);
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(tmdbId))
|
if (string.IsNullOrEmpty(tmdbId) && info.TryGetProviderId(MetadataProvider.Imdb, out var imdbId))
|
||||||
{
|
{
|
||||||
var imdbId = info.GetProviderId(MetadataProvider.Imdb);
|
var searchResult = await _tmdbClientManager.FindByExternalIdAsync(imdbId, FindExternalSource.Imdb, info.MetadataLanguage, cancellationToken).ConfigureAwait(false);
|
||||||
|
if (searchResult?.TvResults.Count > 0)
|
||||||
if (!string.IsNullOrEmpty(imdbId))
|
|
||||||
{
|
{
|
||||||
var searchResult = await _tmdbClientManager.FindByExternalIdAsync(imdbId, FindExternalSource.Imdb, info.MetadataLanguage, cancellationToken).ConfigureAwait(false);
|
tmdbId = searchResult.TvResults[0].Id.ToString(CultureInfo.InvariantCulture);
|
||||||
|
|
||||||
if (searchResult != null)
|
|
||||||
{
|
|
||||||
tmdbId = searchResult.TvResults.FirstOrDefault()?.Id.ToString(CultureInfo.InvariantCulture);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(tmdbId))
|
if (string.IsNullOrEmpty(tmdbId) && info.TryGetProviderId(MetadataProvider.Tvdb, out var tvdbId))
|
||||||
{
|
{
|
||||||
var tvdbId = info.GetProviderId(MetadataProvider.Tvdb);
|
var searchResult = await _tmdbClientManager.FindByExternalIdAsync(tvdbId, FindExternalSource.TvDb, info.MetadataLanguage, cancellationToken).ConfigureAwait(false);
|
||||||
|
if (searchResult?.TvResults.Count > 0)
|
||||||
if (!string.IsNullOrEmpty(tvdbId))
|
|
||||||
{
|
{
|
||||||
var searchResult = await _tmdbClientManager.FindByExternalIdAsync(tvdbId, FindExternalSource.TvDb, info.MetadataLanguage, cancellationToken).ConfigureAwait(false);
|
tmdbId = searchResult.TvResults[0].Id.ToString(CultureInfo.InvariantCulture);
|
||||||
|
|
||||||
if (searchResult != null)
|
|
||||||
{
|
|
||||||
tmdbId = searchResult.TvResults.FirstOrDefault()?.Id.ToString(CultureInfo.InvariantCulture);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -207,7 +189,8 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV
|
|||||||
// ParseName is required here.
|
// ParseName is required here.
|
||||||
// Caller provides the filename with extension stripped and NOT the parsed filename
|
// Caller provides the filename with extension stripped and NOT the parsed filename
|
||||||
var parsedName = _libraryManager.ParseName(info.Name);
|
var parsedName = _libraryManager.ParseName(info.Name);
|
||||||
var searchResults = await _tmdbClientManager.SearchSeriesAsync(parsedName.Name, info.MetadataLanguage, info.Year ?? 0, cancellationToken).ConfigureAwait(false);
|
var cleanedName = TmdbUtils.CleanName(parsedName.Name);
|
||||||
|
var searchResults = await _tmdbClientManager.SearchSeriesAsync(cleanedName, info.MetadataLanguage, info.Year ?? parsedName.Year ?? 0, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
if (searchResults.Count > 0)
|
if (searchResults.Count > 0)
|
||||||
{
|
{
|
||||||
@@ -215,32 +198,34 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(tmdbId))
|
if (string.IsNullOrEmpty(tmdbId))
|
||||||
{
|
{
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
return result;
|
||||||
|
|
||||||
var tvShow = await _tmdbClientManager
|
|
||||||
.GetSeriesAsync(Convert.ToInt32(tmdbId, CultureInfo.InvariantCulture), info.MetadataLanguage, TmdbUtils.GetImageLanguagesParam(info.MetadataLanguage), cancellationToken)
|
|
||||||
.ConfigureAwait(false);
|
|
||||||
|
|
||||||
result = new MetadataResult<Series>
|
|
||||||
{
|
|
||||||
Item = MapTvShowToSeries(tvShow, info.MetadataCountryCode),
|
|
||||||
ResultLanguage = info.MetadataLanguage ?? tvShow.OriginalLanguage
|
|
||||||
};
|
|
||||||
|
|
||||||
foreach (var person in GetPersons(tvShow))
|
|
||||||
{
|
|
||||||
result.AddPerson(person);
|
|
||||||
}
|
|
||||||
|
|
||||||
result.HasMetadata = result.Item != null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
|
var tvShow = await _tmdbClientManager
|
||||||
|
.GetSeriesAsync(Convert.ToInt32(tmdbId, CultureInfo.InvariantCulture), info.MetadataLanguage, TmdbUtils.GetImageLanguagesParam(info.MetadataLanguage), cancellationToken)
|
||||||
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
|
result = new MetadataResult<Series>
|
||||||
|
{
|
||||||
|
Item = MapTvShowToSeries(tvShow, info.MetadataCountryCode),
|
||||||
|
ResultLanguage = info.MetadataLanguage ?? tvShow.OriginalLanguage
|
||||||
|
};
|
||||||
|
|
||||||
|
foreach (var person in GetPersons(tvShow))
|
||||||
|
{
|
||||||
|
result.AddPerson(person);
|
||||||
|
}
|
||||||
|
|
||||||
|
result.HasMetadata = result.Item != null;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Series MapTvShowToSeries(TvShow seriesResult, string preferredCountryCode)
|
private static Series MapTvShowToSeries(TvShow seriesResult, string preferredCountryCode)
|
||||||
{
|
{
|
||||||
var series = new Series
|
var series = new Series
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using TMDbLib.Objects.General;
|
using TMDbLib.Objects.General;
|
||||||
|
|
||||||
@@ -12,6 +13,8 @@ namespace MediaBrowser.Providers.Plugins.Tmdb
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static class TmdbUtils
|
public static class TmdbUtils
|
||||||
{
|
{
|
||||||
|
private static readonly Regex _nonWords = new (@"[\W_]+", RegexOptions.Compiled);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// URL of the TMDB instance to use.
|
/// URL of the TMDB instance to use.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -42,6 +45,17 @@ namespace MediaBrowser.Providers.Plugins.Tmdb
|
|||||||
PersonType.Producer
|
PersonType.Producer
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cleans the name according to TMDb requirements.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name">The name of the entity.</param>
|
||||||
|
/// <returns>The cleaned name.</returns>
|
||||||
|
public static string CleanName(string name)
|
||||||
|
{
|
||||||
|
// TMDb expects a space separated list of words make sure that is the case
|
||||||
|
return _nonWords.Replace(name, " ");
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Maps the TMDB provided roles for crew members to Jellyfin roles.
|
/// Maps the TMDB provided roles for crew members to Jellyfin roles.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -205,12 +205,30 @@ namespace MediaBrowser.Providers.Subtitles
|
|||||||
|
|
||||||
if (saveInMediaFolder)
|
if (saveInMediaFolder)
|
||||||
{
|
{
|
||||||
savePaths.Add(Path.Combine(video.ContainingFolderPath, saveFileName));
|
var mediaFolderPath = Path.GetFullPath(Path.Combine(video.ContainingFolderPath, saveFileName));
|
||||||
|
// TODO: Add some error handling to the API user: return BadRequest("Could not save subtitle, bad path.");
|
||||||
|
if (mediaFolderPath.StartsWith(video.ContainingFolderPath))
|
||||||
|
{
|
||||||
|
savePaths.Add(mediaFolderPath);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
savePaths.Add(Path.Combine(video.GetInternalMetadataPath(), saveFileName));
|
var internalPath = Path.GetFullPath(Path.Combine(video.GetInternalMetadataPath(), saveFileName));
|
||||||
|
|
||||||
await TrySaveToFiles(memoryStream, savePaths).ConfigureAwait(false);
|
// TODO: Add some error to the user: return BadRequest("Could not save subtitle, bad path.");
|
||||||
|
if (internalPath.StartsWith(video.GetInternalMetadataPath()))
|
||||||
|
{
|
||||||
|
savePaths.Add(internalPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (savePaths.Count > 0)
|
||||||
|
{
|
||||||
|
await TrySaveToFiles(memoryStream, savePaths).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_logger.LogError("An uploaded subtitle could not be saved because the resulting paths were invalid.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
[assembly: AssemblyVersion("10.7.0")]
|
[assembly: AssemblyVersion("10.7.1")]
|
||||||
[assembly: AssemblyFileVersion("10.7.0")]
|
[assembly: AssemblyFileVersion("10.7.1")]
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
# We just wrap `build` so this is really it
|
# We just wrap `build` so this is really it
|
||||||
name: "jellyfin"
|
name: "jellyfin"
|
||||||
version: "10.7.0"
|
version: "10.7.1"
|
||||||
packages:
|
packages:
|
||||||
- debian.amd64
|
- debian.amd64
|
||||||
- debian.arm64
|
- debian.arm64
|
||||||
|
|||||||
Vendored
+6
@@ -1,3 +1,9 @@
|
|||||||
|
jellyfin-server (10.7.1-1) unstable; urgency=medium
|
||||||
|
|
||||||
|
* New upstream version 10.7.1; release changelog at https://github.com/jellyfin/jellyfin/releases/tag/v10.7.1
|
||||||
|
|
||||||
|
-- Jellyfin Packaging Team <packaging@jellyfin.org> Sun, 21 Mar 2021 19:14:11 -0400
|
||||||
|
|
||||||
jellyfin-server (10.7.0-1) unstable; urgency=medium
|
jellyfin-server (10.7.0-1) unstable; urgency=medium
|
||||||
|
|
||||||
* New upstream version 10.7.0; release changelog at https://github.com/jellyfin/jellyfin/releases/tag/v10.7.0
|
* New upstream version 10.7.0; release changelog at https://github.com/jellyfin/jellyfin/releases/tag/v10.7.0
|
||||||
|
|||||||
Vendored
+1
-1
@@ -5,7 +5,7 @@ Homepage: https://jellyfin.org
|
|||||||
Standards-Version: 3.9.2
|
Standards-Version: 3.9.2
|
||||||
|
|
||||||
Package: jellyfin
|
Package: jellyfin
|
||||||
Version: 10.7.0~rc1
|
Version: 10.7.1
|
||||||
Maintainer: Jellyfin Packaging Team <packaging@jellyfin.org>
|
Maintainer: Jellyfin Packaging Team <packaging@jellyfin.org>
|
||||||
Depends: jellyfin-server, jellyfin-web
|
Depends: jellyfin-server, jellyfin-web
|
||||||
Description: Provides the Jellyfin Free Software Media System
|
Description: Provides the Jellyfin Free Software Media System
|
||||||
|
|||||||
@@ -13,9 +13,7 @@ RUN dnf update -y \
|
|||||||
&& dnf install -y @buildsys-build rpmdevtools git dnf-plugins-core libcurl-devel fontconfig-devel freetype-devel openssl-devel glibc-devel libicu-devel systemd
|
&& dnf install -y @buildsys-build rpmdevtools git dnf-plugins-core libcurl-devel fontconfig-devel freetype-devel openssl-devel glibc-devel libicu-devel systemd
|
||||||
|
|
||||||
# Install DotNET SDK
|
# Install DotNET SDK
|
||||||
RUN rpm --import https://packages.microsoft.com/keys/microsoft.asc \
|
RUN dnf install -y dotnet-sdk-${SDK_VERSION} dotnet-runtime-${SDK_VERSION}
|
||||||
&& curl -o /etc/yum.repos.d/microsoft-prod.repo https://packages.microsoft.com/config/fedora/$(rpm -E %fedora)/prod.repo \
|
|
||||||
&& dnf install -y dotnet-sdk-${SDK_VERSION} dotnet-runtime-${SDK_VERSION}
|
|
||||||
|
|
||||||
# Create symlinks and directories
|
# Create symlinks and directories
|
||||||
RUN ln -sf ${SOURCE_DIR}/deployment/build.fedora.amd64 /build.sh \
|
RUN ln -sf ${SOURCE_DIR}/deployment/build.fedora.amd64 /build.sh \
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
Name: jellyfin
|
Name: jellyfin
|
||||||
Version: 10.7.0
|
Version: 10.7.1
|
||||||
Release: 1%{?dist}
|
Release: 1%{?dist}
|
||||||
Summary: The Free Software Media System
|
Summary: The Free Software Media System
|
||||||
License: GPLv3
|
License: GPLv3
|
||||||
@@ -137,5 +137,7 @@ fi
|
|||||||
%systemd_postun_with_restart jellyfin.service
|
%systemd_postun_with_restart jellyfin.service
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Sun Mar 21 2021 Jellyfin Packaging Team <packaging@jellyfin.org>
|
||||||
|
- New upstream version 10.7.1; release changelog at https://github.com/jellyfin/jellyfin/releases/tag/v10.7.1
|
||||||
* Mon Mar 08 2021 Jellyfin Packaging Team <packaging@jellyfin.org>
|
* Mon Mar 08 2021 Jellyfin Packaging Team <packaging@jellyfin.org>
|
||||||
- New upstream version 10.7.0; release changelog at https://github.com/jellyfin/jellyfin/releases/tag/v10.7.0
|
- New upstream version 10.7.0; release changelog at https://github.com/jellyfin/jellyfin/releases/tag/v10.7.0
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
using System.Text.Json;
|
||||||
|
using MediaBrowser.Common.Json.Converters;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace Jellyfin.Common.Tests.Json
|
||||||
|
{
|
||||||
|
public class JsonStringConverterTests
|
||||||
|
{
|
||||||
|
private readonly JsonSerializerOptions _jsonSerializerOptions
|
||||||
|
= new ()
|
||||||
|
{
|
||||||
|
Converters =
|
||||||
|
{
|
||||||
|
new JsonStringConverter()
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData("\"test\"", "test")]
|
||||||
|
[InlineData("123", "123")]
|
||||||
|
[InlineData("123.45", "123.45")]
|
||||||
|
[InlineData("true", "true")]
|
||||||
|
[InlineData("false", "false")]
|
||||||
|
public void Deserialize_String_Valid_Success(string input, string output)
|
||||||
|
{
|
||||||
|
var deserialized = JsonSerializer.Deserialize<string>(input, _jsonSerializerOptions);
|
||||||
|
Assert.Equal(deserialized, output);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Deserialize_Int32asInt32_Valid_Success()
|
||||||
|
{
|
||||||
|
const string? input = "123";
|
||||||
|
const int output = 123;
|
||||||
|
var deserialized = JsonSerializer.Deserialize<int>(input, _jsonSerializerOptions);
|
||||||
|
Assert.Equal(deserialized, output);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -327,12 +327,9 @@ namespace Jellyfin.Naming.Tests.Video
|
|||||||
FullName = i
|
FullName = i
|
||||||
}).ToList()).ToList();
|
}).ToList()).ToList();
|
||||||
|
|
||||||
Assert.Single(result);
|
Assert.Equal(7, result.Count);
|
||||||
Assert.Empty(result[0].Extras);
|
Assert.Empty(result[0].Extras);
|
||||||
Assert.Equal(6, result[0].AlternateVersions.Count);
|
Assert.Empty(result[0].AlternateVersions);
|
||||||
Assert.False(result[0].AlternateVersions[2].Is3D);
|
|
||||||
Assert.True(result[0].AlternateVersions[3].Is3D);
|
|
||||||
Assert.True(result[0].AlternateVersions[4].Is3D);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
@@ -406,6 +403,44 @@ namespace Jellyfin.Naming.Tests.Video
|
|||||||
Assert.Single(result[0].AlternateVersions);
|
Assert.Single(result[0].AlternateVersions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Resolve_GivenFolderNameWithBracketsAndHyphens_GroupsBasedOnFolderName()
|
||||||
|
{
|
||||||
|
var files = new[]
|
||||||
|
{
|
||||||
|
@"/movies/John Wick - Kapitel 3 (2019) [imdbid=tt6146586]/John Wick - Kapitel 3 (2019) [imdbid=tt6146586] - Version 1.mkv",
|
||||||
|
@"/movies/John Wick - Kapitel 3 (2019) [imdbid=tt6146586]/John Wick - Kapitel 3 (2019) [imdbid=tt6146586] - Version 2.mkv"
|
||||||
|
};
|
||||||
|
|
||||||
|
var result = _videoListResolver.Resolve(files.Select(i => new FileSystemMetadata
|
||||||
|
{
|
||||||
|
IsDirectory = false,
|
||||||
|
FullName = i
|
||||||
|
}).ToList()).ToList();
|
||||||
|
|
||||||
|
Assert.Single(result);
|
||||||
|
Assert.Empty(result[0].Extras);
|
||||||
|
Assert.Single(result[0].AlternateVersions);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Resolve_GivenUnclosedBrackets_DoesNotGroup()
|
||||||
|
{
|
||||||
|
var files = new[]
|
||||||
|
{
|
||||||
|
@"/movies/John Wick - Chapter 3 (2019)/John Wick - Chapter 3 (2019) [Version 1].mkv",
|
||||||
|
@"/movies/John Wick - Chapter 3 (2019)/John Wick - Chapter 3 (2019) [Version 2.mkv"
|
||||||
|
};
|
||||||
|
|
||||||
|
var result = _videoListResolver.Resolve(files.Select(i => new FileSystemMetadata
|
||||||
|
{
|
||||||
|
IsDirectory = false,
|
||||||
|
FullName = i
|
||||||
|
}).ToList()).ToList();
|
||||||
|
|
||||||
|
Assert.Equal(2, result.Count);
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void TestEmptyList()
|
public void TestEmptyList()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,65 @@
|
|||||||
|
using System;
|
||||||
|
using Emby.Server.Implementations.Library.Resolvers.TV;
|
||||||
|
using MediaBrowser.Controller;
|
||||||
|
using MediaBrowser.Controller.Entities;
|
||||||
|
using MediaBrowser.Controller.Entities.TV;
|
||||||
|
using MediaBrowser.Controller.Library;
|
||||||
|
using MediaBrowser.Controller.Providers;
|
||||||
|
using MediaBrowser.Model.Entities;
|
||||||
|
using Moq;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace Jellyfin.Server.Implementations.Tests.Library
|
||||||
|
{
|
||||||
|
public class EpisodeResolverTest
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void Resolve_GivenVideoInExtrasFolder_DoesNotResolveToEpisode()
|
||||||
|
{
|
||||||
|
var season = new Season { Name = "Season 1" };
|
||||||
|
var parent = new Folder { Name = "extras" };
|
||||||
|
var libraryManagerMock = new Mock<ILibraryManager>();
|
||||||
|
libraryManagerMock.Setup(x => x.GetItemById(It.IsAny<Guid>())).Returns(season);
|
||||||
|
|
||||||
|
var episodeResolver = new EpisodeResolver(libraryManagerMock.Object);
|
||||||
|
var itemResolveArgs = new ItemResolveArgs(
|
||||||
|
Mock.Of<IServerApplicationPaths>(),
|
||||||
|
Mock.Of<IDirectoryService>())
|
||||||
|
{
|
||||||
|
Parent = parent,
|
||||||
|
CollectionType = CollectionType.TvShows,
|
||||||
|
Path = "All My Children/Season 01/Extras/All My Children S01E01 - Behind The Scenes.mkv"
|
||||||
|
};
|
||||||
|
|
||||||
|
Assert.Null(episodeResolver.Resolve(itemResolveArgs));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Resolve_GivenVideoInExtrasSeriesFolder_ResolvesToEpisode()
|
||||||
|
{
|
||||||
|
var series = new Series { Name = "Extras" };
|
||||||
|
|
||||||
|
// Have to create a mock because of moq proxies not being castable to a concrete implementation
|
||||||
|
// https://github.com/jellyfin/jellyfin/blob/ab0cff8556403e123642dc9717ba778329554634/Emby.Server.Implementations/Library/Resolvers/BaseVideoResolver.cs#L48
|
||||||
|
var episodeResolver = new EpisodeResolverMock(Mock.Of<ILibraryManager>());
|
||||||
|
var itemResolveArgs = new ItemResolveArgs(
|
||||||
|
Mock.Of<IServerApplicationPaths>(),
|
||||||
|
Mock.Of<IDirectoryService>())
|
||||||
|
{
|
||||||
|
Parent = series,
|
||||||
|
CollectionType = CollectionType.TvShows,
|
||||||
|
Path = "Extras/Extras S01E01.mkv"
|
||||||
|
};
|
||||||
|
Assert.NotNull(episodeResolver.Resolve(itemResolveArgs));
|
||||||
|
}
|
||||||
|
|
||||||
|
private class EpisodeResolverMock : EpisodeResolver
|
||||||
|
{
|
||||||
|
public EpisodeResolverMock(ILibraryManager libraryManager) : base(libraryManager)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override TVideoType ResolveVideo<TVideoType>(ItemResolveArgs args, bool parseName) => new ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user