Fix more warnings

This commit is contained in:
Bond_009 2019-09-01 18:39:23 +02:00
parent 160718efe2
commit 1616f24cee
9 changed files with 500 additions and 381 deletions

View File

@ -170,8 +170,8 @@ namespace Emby.Photos
} }
} }
const ItemUpdateType result = ItemUpdateType.ImageUpdate | ItemUpdateType.MetadataImport; const ItemUpdateType Result = ItemUpdateType.ImageUpdate | ItemUpdateType.MetadataImport;
return Task.FromResult(result); return Task.FromResult(Result);
} }
} }
} }

View File

@ -139,7 +139,7 @@ namespace Emby.Server.Implementations.MediaEncoder
var protocol = MediaProtocol.File; var protocol = MediaProtocol.File;
var inputPath = MediaEncoderHelpers.GetInputArgument(_fileSystem, video.Path, protocol, null, Array.Empty<string>()); var inputPath = MediaEncoderHelpers.GetInputArgument(_fileSystem, video.Path, null, Array.Empty<string>());
Directory.CreateDirectory(Path.GetDirectoryName(path)); Directory.CreateDirectory(Path.GetDirectoryName(path));

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,8 @@
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using MediaBrowser.Model.IO; using MediaBrowser.Model.IO;
using MediaBrowser.Model.MediaInfo;
namespace MediaBrowser.Controller.MediaEncoding namespace MediaBrowser.Controller.MediaEncoding
{ {
@ -16,31 +16,26 @@ namespace MediaBrowser.Controller.MediaEncoding
/// </summary> /// </summary>
/// <param name="fileSystem">The file system.</param> /// <param name="fileSystem">The file system.</param>
/// <param name="videoPath">The video path.</param> /// <param name="videoPath">The video path.</param>
/// <param name="protocol">The protocol.</param>
/// <param name="isoMount">The iso mount.</param> /// <param name="isoMount">The iso mount.</param>
/// <param name="playableStreamFileNames">The playable stream file names.</param> /// <param name="playableStreamFileNames">The playable stream file names.</param>
/// <returns>System.String[][].</returns> /// <returns>string[].</returns>
public static string[] GetInputArgument(IFileSystem fileSystem, string videoPath, MediaProtocol protocol, IIsoMount isoMount, string[] playableStreamFileNames) public static string[] GetInputArgument(IFileSystem fileSystem, string videoPath, IIsoMount isoMount, IReadOnlyCollection<string> playableStreamFileNames)
{ {
if (playableStreamFileNames.Length > 0) if (playableStreamFileNames.Count > 0)
{ {
if (isoMount == null) if (isoMount == null)
{ {
return GetPlayableStreamFiles(fileSystem, videoPath, playableStreamFileNames); return GetPlayableStreamFiles(fileSystem, videoPath, playableStreamFileNames);
} }
return GetPlayableStreamFiles(fileSystem, isoMount.MountedPath, playableStreamFileNames); return GetPlayableStreamFiles(fileSystem, isoMount.MountedPath, playableStreamFileNames);
} }
return new[] { videoPath }; return new[] { videoPath };
} }
private static string[] GetPlayableStreamFiles(IFileSystem fileSystem, string rootPath, string[] filenames) private static string[] GetPlayableStreamFiles(IFileSystem fileSystem, string rootPath, IEnumerable<string> filenames)
{ {
if (filenames.Length == 0)
{
return new string[] { };
}
var allFiles = fileSystem var allFiles = fileSystem
.GetFilePaths(rootPath, true) .GetFilePaths(rootPath, true)
.ToArray(); .ToArray();

View File

@ -303,7 +303,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
{ {
var extractChapters = request.MediaType == DlnaProfileType.Video && request.ExtractChapters; var extractChapters = request.MediaType == DlnaProfileType.Video && request.ExtractChapters;
var inputFiles = MediaEncoderHelpers.GetInputArgument(FileSystem, request.MediaSource.Path, request.MediaSource.Protocol, request.MountedIso, request.PlayableStreamFileNames); var inputFiles = MediaEncoderHelpers.GetInputArgument(FileSystem, request.MediaSource.Path, request.MountedIso, request.PlayableStreamFileNames);
var probeSize = EncodingHelper.GetProbeSizeArgument(inputFiles.Length); var probeSize = EncodingHelper.GetProbeSizeArgument(inputFiles.Length);
string analyzeDuration; string analyzeDuration;

View File

@ -62,7 +62,7 @@ namespace MediaBrowser.Providers.MediaInfo
{ {
var protocol = item.PathProtocol ?? MediaProtocol.File; var protocol = item.PathProtocol ?? MediaProtocol.File;
var inputPath = MediaEncoderHelpers.GetInputArgument(_fileSystem, item.Path, protocol, null, item.GetPlayableStreamFileNames(_mediaEncoder)); var inputPath = MediaEncoderHelpers.GetInputArgument(_fileSystem, item.Path, null, item.GetPlayableStreamFileNames(_mediaEncoder));
var mediaStreams = var mediaStreams =
item.GetMediaStreams(); item.GetMediaStreams();

View File

@ -16,27 +16,30 @@ namespace MediaBrowser.XbmcMetadata
{ {
private readonly IUserDataManager _userDataManager; private readonly IUserDataManager _userDataManager;
private readonly ILogger _logger; private readonly ILogger _logger;
private readonly ILibraryManager _libraryManager;
private readonly IProviderManager _providerManager; private readonly IProviderManager _providerManager;
private readonly IConfigurationManager _config; private readonly IConfigurationManager _config;
public EntryPoint(IUserDataManager userDataManager, ILibraryManager libraryManager, ILogger logger, IProviderManager providerManager, IConfigurationManager config) public EntryPoint(
IUserDataManager userDataManager,
ILogger logger,
IProviderManager providerManager,
IConfigurationManager config)
{ {
_userDataManager = userDataManager; _userDataManager = userDataManager;
_libraryManager = libraryManager;
_logger = logger; _logger = logger;
_providerManager = providerManager; _providerManager = providerManager;
_config = config; _config = config;
} }
/// <inheritdoc />
public Task RunAsync() public Task RunAsync()
{ {
_userDataManager.UserDataSaved += _userDataManager_UserDataSaved; _userDataManager.UserDataSaved += OnUserDataSaved;
return Task.CompletedTask; return Task.CompletedTask;
} }
void _userDataManager_UserDataSaved(object sender, UserDataSaveEventArgs e) private void OnUserDataSaved(object sender, UserDataSaveEventArgs e)
{ {
if (e.SaveReason == UserDataSaveReason.PlaybackFinished || e.SaveReason == UserDataSaveReason.TogglePlayed || e.SaveReason == UserDataSaveReason.UpdateUserRating) if (e.SaveReason == UserDataSaveReason.PlaybackFinished || e.SaveReason == UserDataSaveReason.TogglePlayed || e.SaveReason == UserDataSaveReason.UpdateUserRating)
{ {
@ -47,9 +50,10 @@ namespace MediaBrowser.XbmcMetadata
} }
} }
/// <inheritdoc />
public void Dispose() public void Dispose()
{ {
_userDataManager.UserDataSaved -= _userDataManager_UserDataSaved; _userDataManager.UserDataSaved -= OnUserDataSaved;
} }
private void SaveMetadataForItem(BaseItem item, ItemUpdateType updateReason) private void SaveMetadataForItem(BaseItem item, ItemUpdateType updateReason)

View File

@ -15,16 +15,30 @@ namespace MediaBrowser.XbmcMetadata.Savers
{ {
public class AlbumNfoSaver : BaseNfoSaver public class AlbumNfoSaver : BaseNfoSaver
{ {
public AlbumNfoSaver(
IFileSystem fileSystem,
IServerConfigurationManager configurationManager,
ILibraryManager libraryManager,
IUserManager userManager,
IUserDataManager userDataManager,
ILogger logger)
: base(fileSystem, configurationManager, libraryManager, userManager, userDataManager, logger)
{
}
/// <inheritdoc />
protected override string GetLocalSavePath(BaseItem item) protected override string GetLocalSavePath(BaseItem item)
{ {
return Path.Combine(item.Path, "album.nfo"); return Path.Combine(item.Path, "album.nfo");
} }
/// <inheritdoc />
protected override string GetRootElementName(BaseItem item) protected override string GetRootElementName(BaseItem item)
{ {
return "album"; return "album";
} }
/// <inheritdoc />
public override bool IsEnabledFor(BaseItem item, ItemUpdateType updateType) public override bool IsEnabledFor(BaseItem item, ItemUpdateType updateType)
{ {
if (!item.SupportsLocalMetadata) if (!item.SupportsLocalMetadata)
@ -35,6 +49,7 @@ namespace MediaBrowser.XbmcMetadata.Savers
return item is MusicAlbum && updateType >= MinimumUpdateType; return item is MusicAlbum && updateType >= MinimumUpdateType;
} }
/// <inheritdoc />
protected override void WriteCustomElements(BaseItem item, XmlWriter writer) protected override void WriteCustomElements(BaseItem item, XmlWriter writer)
{ {
var album = (MusicAlbum)item; var album = (MusicAlbum)item;
@ -52,8 +67,6 @@ namespace MediaBrowser.XbmcMetadata.Savers
AddTracks(album.Tracks, writer); AddTracks(album.Tracks, writer);
} }
private readonly CultureInfo UsCulture = new CultureInfo("en-US");
private void AddTracks(IEnumerable<BaseItem> tracks, XmlWriter writer) private void AddTracks(IEnumerable<BaseItem> tracks, XmlWriter writer)
{ {
foreach (var track in tracks.OrderBy(i => i.ParentIndexNumber ?? 0).ThenBy(i => i.IndexNumber ?? 0)) foreach (var track in tracks.OrderBy(i => i.ParentIndexNumber ?? 0).ThenBy(i => i.IndexNumber ?? 0))
@ -62,7 +75,7 @@ namespace MediaBrowser.XbmcMetadata.Savers
if (track.IndexNumber.HasValue) if (track.IndexNumber.HasValue)
{ {
writer.WriteElementString("position", track.IndexNumber.Value.ToString(UsCulture)); writer.WriteElementString("position", track.IndexNumber.Value.ToString(CultureInfo.InvariantCulture));
} }
if (!string.IsNullOrEmpty(track.Name)) if (!string.IsNullOrEmpty(track.Name))
@ -81,21 +94,19 @@ namespace MediaBrowser.XbmcMetadata.Savers
} }
} }
/// <inheritdoc />
protected override List<string> GetTagsUsed(BaseItem item) protected override List<string> GetTagsUsed(BaseItem item)
{ {
var list = base.GetTagsUsed(item); var list = base.GetTagsUsed(item);
list.AddRange(new string[] list.AddRange(
{ new string[]
"track", {
"artist", "track",
"albumartist" "artist",
}); "albumartist"
return list; });
}
public AlbumNfoSaver(IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILibraryManager libraryManager, IUserManager userManager, IUserDataManager userDataManager, ILogger logger) return list;
: base(fileSystem, configurationManager, libraryManager, userManager, userDataManager, logger)
{
} }
} }
} }

View File

@ -1,4 +1,4 @@

Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15 # Visual Studio 15
VisualStudioVersion = 15.0.26730.3 VisualStudioVersion = 15.0.26730.3
@ -41,8 +41,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Emby.Naming", "Emby.Naming\
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Emby.XmlTv", "Emby.XmlTv\Emby.XmlTv\Emby.XmlTv.csproj", "{6EAFA7F0-8A82-49E6-B2FA-086C5CAEA95B}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Emby.XmlTv", "Emby.XmlTv\Emby.XmlTv\Emby.XmlTv.csproj", "{6EAFA7F0-8A82-49E6-B2FA-086C5CAEA95B}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IsoMounter", "Emby.IsoMounting\IsoMounter\IsoMounter.csproj", "{9BA471D2-6DB9-4DBF-B3A0-9FB3171F94A6}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MediaBrowser.MediaEncoding", "MediaBrowser.MediaEncoding\MediaBrowser.MediaEncoding.csproj", "{960295EE-4AF4-4440-A525-B4C295B01A61}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MediaBrowser.MediaEncoding", "MediaBrowser.MediaEncoding\MediaBrowser.MediaEncoding.csproj", "{960295EE-4AF4-4440-A525-B4C295B01A61}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Jellyfin.Server", "Jellyfin.Server\Jellyfin.Server.csproj", "{07E39F42-A2C6-4B32-AF8C-725F957A73FF}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Jellyfin.Server", "Jellyfin.Server\Jellyfin.Server.csproj", "{07E39F42-A2C6-4B32-AF8C-725F957A73FF}"
@ -141,10 +139,6 @@ Global
{6EAFA7F0-8A82-49E6-B2FA-086C5CAEA95B}.Debug|Any CPU.Build.0 = Debug|Any CPU {6EAFA7F0-8A82-49E6-B2FA-086C5CAEA95B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6EAFA7F0-8A82-49E6-B2FA-086C5CAEA95B}.Release|Any CPU.ActiveCfg = Release|Any CPU {6EAFA7F0-8A82-49E6-B2FA-086C5CAEA95B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6EAFA7F0-8A82-49E6-B2FA-086C5CAEA95B}.Release|Any CPU.Build.0 = Release|Any CPU {6EAFA7F0-8A82-49E6-B2FA-086C5CAEA95B}.Release|Any CPU.Build.0 = Release|Any CPU
{9BA471D2-6DB9-4DBF-B3A0-9FB3171F94A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9BA471D2-6DB9-4DBF-B3A0-9FB3171F94A6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9BA471D2-6DB9-4DBF-B3A0-9FB3171F94A6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9BA471D2-6DB9-4DBF-B3A0-9FB3171F94A6}.Release|Any CPU.Build.0 = Release|Any CPU
{960295EE-4AF4-4440-A525-B4C295B01A61}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {960295EE-4AF4-4440-A525-B4C295B01A61}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{960295EE-4AF4-4440-A525-B4C295B01A61}.Debug|Any CPU.Build.0 = Debug|Any CPU {960295EE-4AF4-4440-A525-B4C295B01A61}.Debug|Any CPU.Build.0 = Debug|Any CPU
{960295EE-4AF4-4440-A525-B4C295B01A61}.Release|Any CPU.ActiveCfg = Release|Any CPU {960295EE-4AF4-4440-A525-B4C295B01A61}.Release|Any CPU.ActiveCfg = Release|Any CPU