commit
9a0618552b
@ -1 +1,29 @@
|
||||
{}
|
||||
{
|
||||
"TasksApplicationCategory": "Ukusetshenziswa",
|
||||
"TasksLibraryCategory": "Umtapo",
|
||||
"TasksMaintenanceCategory": "Ukunakekela",
|
||||
"User": "Umsebenzisi",
|
||||
"Undefined": "Akuchaziwe",
|
||||
"System": "Isistimu",
|
||||
"Sync": "Vumelanisa",
|
||||
"Songs": "Amaculo",
|
||||
"Shows": "Izinhlelo",
|
||||
"Plugin": "Isijobelelo",
|
||||
"Playlists": "Izinhla Zokudlalayo",
|
||||
"Photos": "Izithombe",
|
||||
"Music": "Umculo",
|
||||
"Movies": "Amamuvi",
|
||||
"Latest": "lwakamuva",
|
||||
"Inherit": "Ngefa",
|
||||
"Forced": "Kuphoqiwe",
|
||||
"Application": "Ukusetshenziswa",
|
||||
"Genres": "Izinhlobo",
|
||||
"Folders": "Izikhwama",
|
||||
"Favorites": "Izintandokazi",
|
||||
"Default": "Okumisiwe",
|
||||
"Collections": "Amaqoqo",
|
||||
"Channels": "Amashaneli",
|
||||
"Books": "Izincwadi",
|
||||
"Artists": "Abadlali",
|
||||
"Albums": "Ama-albhamu"
|
||||
}
|
||||
|
@ -1,71 +0,0 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Jellyfin.Api.Helpers
|
||||
{
|
||||
/// <summary>
|
||||
/// A static class for copying matching properties from one object to another.
|
||||
/// TODO: remove at the point when a fixed migration path has been decided upon.
|
||||
/// </summary>
|
||||
public static class ClassMigrationHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// Extension for 'Object' that copies the properties to a destination object.
|
||||
/// </summary>
|
||||
/// <param name="source">The source.</param>
|
||||
/// <param name="destination">The destination.</param>
|
||||
public static void CopyProperties(this object source, object destination)
|
||||
{
|
||||
// If any this null throw an exception.
|
||||
if (source == null || destination == null)
|
||||
{
|
||||
throw new ArgumentException("Source or/and Destination Objects are null");
|
||||
}
|
||||
|
||||
// Getting the Types of the objects.
|
||||
Type typeDest = destination.GetType();
|
||||
Type typeSrc = source.GetType();
|
||||
|
||||
// Iterate the Properties of the source instance and populate them from their destination counterparts.
|
||||
PropertyInfo[] srcProps = typeSrc.GetProperties();
|
||||
foreach (PropertyInfo srcProp in srcProps)
|
||||
{
|
||||
if (!srcProp.CanRead)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var targetProperty = typeDest.GetProperty(srcProp.Name);
|
||||
if (targetProperty == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!targetProperty.CanWrite)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var obj = targetProperty.GetSetMethod(true);
|
||||
if (obj != null && obj.IsPrivate)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var target = targetProperty.GetSetMethod();
|
||||
if (target != null && (target.Attributes & MethodAttributes.Static) != 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!targetProperty.PropertyType.IsAssignableFrom(srcProp.PropertyType))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Passed all tests, lets set the value.
|
||||
targetProperty.SetValue(destination, srcProp.GetValue(source, null), null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
using MediaBrowser.Common.Configuration;
|
||||
|
||||
namespace Jellyfin.Networking.Configuration
|
||||
{
|
||||
/// <summary>
|
||||
/// A configuration that stores network related settings.
|
||||
/// </summary>
|
||||
public class NetworkConfigurationStore : ConfigurationStore
|
||||
{
|
||||
/// <summary>
|
||||
/// The name of the configuration in the storage.
|
||||
/// </summary>
|
||||
public const string StoreKey = "network";
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="NetworkConfigurationStore"/> class.
|
||||
/// </summary>
|
||||
public NetworkConfigurationStore()
|
||||
{
|
||||
ConfigurationType = typeof(NetworkConfiguration);
|
||||
Key = StoreKey;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,176 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Emby.Naming.Audio;
|
||||
using Emby.Naming.Common;
|
||||
using Jellyfin.Extensions;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.MediaEncoding;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Dlna;
|
||||
using MediaBrowser.Model.Dto;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Globalization;
|
||||
using MediaBrowser.Model.MediaInfo;
|
||||
|
||||
namespace MediaBrowser.Providers.MediaInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Resolves external audios for videos.
|
||||
/// </summary>
|
||||
public class AudioResolver
|
||||
{
|
||||
private readonly ILocalizationManager _localizationManager;
|
||||
private readonly IMediaEncoder _mediaEncoder;
|
||||
private readonly NamingOptions _namingOptions;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="AudioResolver"/> class.
|
||||
/// </summary>
|
||||
/// <param name="localizationManager">The localization manager.</param>
|
||||
/// <param name="mediaEncoder">The media encoder.</param>
|
||||
/// <param name="namingOptions">The naming options.</param>
|
||||
public AudioResolver(
|
||||
ILocalizationManager localizationManager,
|
||||
IMediaEncoder mediaEncoder,
|
||||
NamingOptions namingOptions)
|
||||
{
|
||||
_localizationManager = localizationManager;
|
||||
_mediaEncoder = mediaEncoder;
|
||||
_namingOptions = namingOptions;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the audio streams found in the external audio files for the given video.
|
||||
/// </summary>
|
||||
/// <param name="video">The video to get the external audio streams from.</param>
|
||||
/// <param name="startIndex">The stream index to start adding audio streams at.</param>
|
||||
/// <param name="directoryService">The directory service to search for files.</param>
|
||||
/// <param name="clearCache">True if the directory service cache should be cleared before searching.</param>
|
||||
/// <param name="cancellationToken">The cancellation token to cancel operation.</param>
|
||||
/// <returns>A list of external audio streams.</returns>
|
||||
public async IAsyncEnumerable<MediaStream> GetExternalAudioStreams(
|
||||
Video video,
|
||||
int startIndex,
|
||||
IDirectoryService directoryService,
|
||||
bool clearCache,
|
||||
[EnumeratorCancellation] CancellationToken cancellationToken)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
if (!video.IsFileProtocol)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
|
||||
IEnumerable<string> paths = GetExternalAudioFiles(video, directoryService, clearCache);
|
||||
foreach (string path in paths)
|
||||
{
|
||||
string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(path);
|
||||
Model.MediaInfo.MediaInfo mediaInfo = await GetMediaInfo(path, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
foreach (MediaStream mediaStream in mediaInfo.MediaStreams)
|
||||
{
|
||||
mediaStream.Index = startIndex++;
|
||||
mediaStream.Type = MediaStreamType.Audio;
|
||||
mediaStream.IsExternal = true;
|
||||
mediaStream.Path = path;
|
||||
mediaStream.IsDefault = false;
|
||||
mediaStream.Title = null;
|
||||
|
||||
if (string.IsNullOrEmpty(mediaStream.Language))
|
||||
{
|
||||
// Try to translate to three character code
|
||||
// Be flexible and check against both the full and three character versions
|
||||
var language = StringExtensions.RightPart(fileNameWithoutExtension, '.').ToString();
|
||||
|
||||
if (language != fileNameWithoutExtension)
|
||||
{
|
||||
var culture = _localizationManager.FindLanguageInfo(language);
|
||||
|
||||
language = culture == null ? language : culture.ThreeLetterISOLanguageName;
|
||||
mediaStream.Language = language;
|
||||
}
|
||||
}
|
||||
|
||||
yield return mediaStream;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the external audio file paths for the given video.
|
||||
/// </summary>
|
||||
/// <param name="video">The video to get the external audio file paths from.</param>
|
||||
/// <param name="directoryService">The directory service to search for files.</param>
|
||||
/// <param name="clearCache">True if the directory service cache should be cleared before searching.</param>
|
||||
/// <returns>A list of external audio file paths.</returns>
|
||||
public IEnumerable<string> GetExternalAudioFiles(
|
||||
Video video,
|
||||
IDirectoryService directoryService,
|
||||
bool clearCache)
|
||||
{
|
||||
if (!video.IsFileProtocol)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
|
||||
// Check if video folder exists
|
||||
string folder = video.ContainingFolderPath;
|
||||
if (!Directory.Exists(folder))
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
|
||||
string videoFileNameWithoutExtension = Path.GetFileNameWithoutExtension(video.Path);
|
||||
|
||||
var files = directoryService.GetFilePaths(folder, clearCache, true);
|
||||
for (int i = 0; i < files.Count; i++)
|
||||
{
|
||||
string file = files[i];
|
||||
if (string.Equals(video.Path, file, StringComparison.OrdinalIgnoreCase)
|
||||
|| !AudioFileParser.IsAudioFile(file, _namingOptions)
|
||||
|| Path.GetExtension(file.AsSpan()).Equals(".strm", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(file);
|
||||
// The audio filename must either be equal to the video filename or start with the video filename followed by a dot
|
||||
if (videoFileNameWithoutExtension.Equals(fileNameWithoutExtension, StringComparison.OrdinalIgnoreCase)
|
||||
|| (fileNameWithoutExtension.Length > videoFileNameWithoutExtension.Length
|
||||
&& fileNameWithoutExtension[videoFileNameWithoutExtension.Length] == '.'
|
||||
&& fileNameWithoutExtension.StartsWith(videoFileNameWithoutExtension, StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
yield return file;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the media info of the given audio file.
|
||||
/// </summary>
|
||||
/// <param name="path">The path to the audio file.</param>
|
||||
/// <param name="cancellationToken">The cancellation token to cancel operation.</param>
|
||||
/// <returns>The media info for the given audio file.</returns>
|
||||
private Task<Model.MediaInfo.MediaInfo> GetMediaInfo(string path, CancellationToken cancellationToken)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
return _mediaEncoder.GetMediaInfo(
|
||||
new MediaInfoRequest
|
||||
{
|
||||
MediaType = DlnaProfileType.Audio,
|
||||
MediaSource = new MediaSourceInfo
|
||||
{
|
||||
Path = path,
|
||||
Protocol = MediaProtocol.File
|
||||
}
|
||||
},
|
||||
cancellationToken);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,26 +1,41 @@
|
||||
VERSION := $(shell sed -ne '/^Version:/s/.* *//p' fedora/jellyfin.spec)
|
||||
outdir ?= fedora/
|
||||
TARGET ?= fedora-35-x86_64
|
||||
|
||||
srpm:
|
||||
cd fedora/; \
|
||||
SOURCE_DIR=.. \
|
||||
WORKDIR="$${PWD}"; \
|
||||
tar \
|
||||
--transform "s,^\.,jellyfin-server-$(VERSION)," \
|
||||
--exclude='.git*' \
|
||||
--exclude='**/.git' \
|
||||
--exclude='**/.hg' \
|
||||
--exclude='**/.vs' \
|
||||
--exclude='**/.vscode' \
|
||||
--exclude='deployment' \
|
||||
--exclude='**/bin' \
|
||||
--exclude='**/obj' \
|
||||
--exclude='**/.nuget' \
|
||||
--exclude='*.deb' \
|
||||
--exclude='*.rpm' \
|
||||
--exclude='jellyfin-server-$(VERSION).tar.gz' \
|
||||
-czf "jellyfin-server-$(VERSION).tar.gz" \
|
||||
-C $${SOURCE_DIR} ./
|
||||
cd fedora/; \
|
||||
rpmbuild -bs jellyfin.spec \
|
||||
--define "_sourcedir $$PWD/" \
|
||||
pushd fedora/; \
|
||||
if [ "$$(id -u)" = "0" ]; then \
|
||||
dnf -y install git; \
|
||||
fi; \
|
||||
version=$$(git describe --tags | sed -e 's/^v//' \
|
||||
-e 's/-[0-9]*-g.*$$//' \
|
||||
-e 's/-/~/'); \
|
||||
SOURCE_DIR=.. \
|
||||
WORKDIR="$${PWD}"; \
|
||||
tar \
|
||||
--transform "s,^\.,jellyfin-server-$$version," \
|
||||
--exclude='.git*' \
|
||||
--exclude='**/.git' \
|
||||
--exclude='**/.hg' \
|
||||
--exclude='**/.vs' \
|
||||
--exclude='**/.vscode' \
|
||||
--exclude=deployment \
|
||||
--exclude='**/bin' \
|
||||
--exclude='**/obj' \
|
||||
--exclude='**/.nuget' \
|
||||
--exclude='*.deb' \
|
||||
--exclude='*.rpm' \
|
||||
--exclude=jellyfin-server-$$version.tar.gz \
|
||||
-czf "jellyfin-server-$$version.tar.gz" \
|
||||
-C $${SOURCE_DIR} ./; \
|
||||
popd; \
|
||||
./bump_version $$version
|
||||
cd fedora/; \
|
||||
rpmbuild -bs jellyfin.spec \
|
||||
--define "_sourcedir $$PWD/" \
|
||||
--define "_srcrpmdir $(outdir)"
|
||||
|
||||
rpms: fedora/jellyfin-$(shell git describe --tags | sed -e 's/^v//' -e 's/-[0-9]*-g.*$$//' -e 's/-/~/')-1$(shell rpm --eval %dist).src.rpm
|
||||
mock --addrepo=https://download.copr.fedorainfracloud.org/results/@dotnet-sig/dotnet-preview/$(TARGET)/ \
|
||||
--enable-network \
|
||||
-r $(TARGET) $<
|
||||
|
@ -0,0 +1,4 @@
|
||||
# This allows Jellyfin to bind to low ports such as 80 and/or 443
|
||||
|
||||
[Service]
|
||||
AmbientCapabilities=CAP_NET_BIND_SERVICE
|
Loading…
Reference in new issue