mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-03-19 00:26:25 +00:00
Replace BDInfo plugin with nupkg and UHD/Atmos/DTS:X support
This commit is contained in:
74
MediaBrowser.MediaEncoding/BdInfo/BdInfoDirectoryInfo.cs
Normal file
74
MediaBrowser.MediaEncoding/BdInfo/BdInfoDirectoryInfo.cs
Normal file
@@ -0,0 +1,74 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BDInfo.IO;
|
||||
using MediaBrowser.Model.IO;
|
||||
|
||||
namespace MediaBrowser.MediaEncoding.BdInfo
|
||||
{
|
||||
class BdInfoDirectoryInfo : BDInfo.IO.IDirectoryInfo
|
||||
{
|
||||
IFileSystem _fileSystem = null;
|
||||
|
||||
FileSystemMetadata _impl = null;
|
||||
|
||||
public string Name => _impl.Name;
|
||||
|
||||
public string FullName => _impl.FullName;
|
||||
|
||||
public IDirectoryInfo Parent
|
||||
{
|
||||
get
|
||||
{
|
||||
var parentFolder = System.IO.Path.GetDirectoryName(_impl.FullName);
|
||||
if (parentFolder != null)
|
||||
{
|
||||
return new BdInfoDirectoryInfo(_fileSystem, parentFolder);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public BdInfoDirectoryInfo(IFileSystem fileSystem, string path)
|
||||
{
|
||||
_fileSystem = fileSystem;
|
||||
_impl = _fileSystem.GetDirectoryInfo(path);
|
||||
}
|
||||
|
||||
private BdInfoDirectoryInfo(IFileSystem fileSystem, FileSystemMetadata impl)
|
||||
{
|
||||
_fileSystem = fileSystem;
|
||||
_impl = impl;
|
||||
}
|
||||
|
||||
public IDirectoryInfo[] GetDirectories()
|
||||
{
|
||||
return Array.ConvertAll(_fileSystem.GetDirectories(_impl.FullName).ToArray(),
|
||||
x => new BdInfoDirectoryInfo(_fileSystem, x));
|
||||
}
|
||||
|
||||
public IFileInfo[] GetFiles()
|
||||
{
|
||||
return Array.ConvertAll(_fileSystem.GetFiles(_impl.FullName).ToArray(),
|
||||
x => new BdInfoFileInfo(_fileSystem, x));
|
||||
}
|
||||
|
||||
public IFileInfo[] GetFiles(string searchPattern)
|
||||
{
|
||||
return Array.ConvertAll(_fileSystem.GetFiles(_impl.FullName, new[] { searchPattern }, false, false).ToArray(),
|
||||
x => new BdInfoFileInfo(_fileSystem, x));
|
||||
}
|
||||
|
||||
public IFileInfo[] GetFiles(string searchPattern, System.IO.SearchOption searchOption)
|
||||
{
|
||||
return Array.ConvertAll(_fileSystem.GetFiles(_impl.FullName, new[] { searchPattern }, false,
|
||||
searchOption.HasFlag(System.IO.SearchOption.AllDirectories)).ToArray(),
|
||||
x => new BdInfoFileInfo(_fileSystem, x));
|
||||
}
|
||||
|
||||
public static IDirectoryInfo FromFileSystemPath(Model.IO.IFileSystem fs, string path)
|
||||
{
|
||||
return new BdInfoDirectoryInfo(fs, path);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BDInfo;
|
||||
@@ -32,7 +32,7 @@ namespace MediaBrowser.MediaEncoding.BdInfo
|
||||
throw new ArgumentNullException(nameof(path));
|
||||
}
|
||||
|
||||
var bdrom = new BDROM(path, _fileSystem);
|
||||
var bdrom = new BDROM(BdInfoDirectoryInfo.FromFileSystemPath(_fileSystem, path));
|
||||
|
||||
bdrom.Scan();
|
||||
|
||||
|
||||
40
MediaBrowser.MediaEncoding/BdInfo/BdInfoFileInfo.cs
Normal file
40
MediaBrowser.MediaEncoding/BdInfo/BdInfoFileInfo.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using MediaBrowser.Model.IO;
|
||||
|
||||
namespace MediaBrowser.MediaEncoding.BdInfo
|
||||
{
|
||||
class BdInfoFileInfo : BDInfo.IO.IFileInfo
|
||||
{
|
||||
IFileSystem _fileSystem = null;
|
||||
|
||||
FileSystemMetadata _impl = null;
|
||||
|
||||
public string Name => _impl.Name;
|
||||
|
||||
public string FullName => _impl.FullName;
|
||||
|
||||
public string Extension => _impl.Extension;
|
||||
|
||||
public long Length => _impl.Length;
|
||||
|
||||
public bool IsDir => _impl.IsDirectory;
|
||||
|
||||
public BdInfoFileInfo(IFileSystem fileSystem, FileSystemMetadata impl)
|
||||
{
|
||||
_fileSystem = fileSystem;
|
||||
_impl = impl;
|
||||
}
|
||||
|
||||
public System.IO.Stream OpenRead()
|
||||
{
|
||||
return _fileSystem.GetFileStream(FullName,
|
||||
FileOpenMode.Open,
|
||||
FileAccessMode.Read,
|
||||
FileShareMode.Read);
|
||||
}
|
||||
|
||||
public System.IO.StreamReader OpenText()
|
||||
{
|
||||
return new System.IO.StreamReader(OpenRead());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,13 +11,13 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\BDInfo\BDInfo.csproj" />
|
||||
<ProjectReference Include="..\MediaBrowser.Common\MediaBrowser.Common.csproj" />
|
||||
<ProjectReference Include="..\MediaBrowser.Controller\MediaBrowser.Controller.csproj" />
|
||||
<ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BDInfo" Version="0.7.6.1" />
|
||||
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.6.0" />
|
||||
<PackageReference Include="UTF.Unknown" Version="2.1.0" />
|
||||
</ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user