mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-04-24 22:17:25 -04:00
Merge pull request #458 from EraYaN/code-cleanup
Clean up several minor issues and add TODOs
This commit is contained in:
commit
9dcaafe700
335 changed files with 1680 additions and 2648 deletions
|
@ -9,4 +9,4 @@ steps:
|
||||||
- name: build
|
- name: build
|
||||||
image: microsoft/dotnet:2-sdk
|
image: microsoft/dotnet:2-sdk
|
||||||
commands:
|
commands:
|
||||||
- dotnet publish --configuration release --output /release
|
- dotnet publish --configuration release --output /release Jellyfin.Server
|
||||||
|
|
|
@ -4,10 +4,10 @@
|
||||||
###############################
|
###############################
|
||||||
# Core EditorConfig Options #
|
# Core EditorConfig Options #
|
||||||
###############################
|
###############################
|
||||||
|
root = true
|
||||||
# All files
|
# All files
|
||||||
[*]
|
[*]
|
||||||
indent_style = space
|
indent_style = space
|
||||||
root = true
|
|
||||||
indent_size = 4
|
indent_size = 4
|
||||||
charset = utf-8
|
charset = utf-8
|
||||||
trim_trailing_whitespace = true
|
trim_trailing_whitespace = true
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="..\SharedVersion.cs" Link="SharedVersion.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj" />
|
<ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
@ -77,7 +77,7 @@ namespace BDInfo
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(path))
|
if (string.IsNullOrEmpty(path))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("path");
|
throw new ArgumentNullException(nameof(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
_fileSystem = fileSystem;
|
_fileSystem = fileSystem;
|
||||||
|
@ -235,7 +235,7 @@ namespace BDInfo
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else throw ex;
|
else throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -273,7 +273,7 @@ namespace BDInfo
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else throw ex;
|
else throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -310,7 +310,7 @@ namespace BDInfo
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else throw ex;
|
else throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -336,7 +336,7 @@ namespace BDInfo
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(path))
|
if (string.IsNullOrEmpty(path))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("path");
|
throw new ArgumentNullException(nameof(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
FileSystemMetadata dir = _fileSystem.GetDirectoryInfo(path);
|
FileSystemMetadata dir = _fileSystem.GetDirectoryInfo(path);
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
using System.Resources;
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Resources;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
// General Information about an assembly is controlled through the following
|
||||||
|
@ -9,21 +8,14 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: AssemblyTitle("BDInfo")]
|
[assembly: AssemblyTitle("BDInfo")]
|
||||||
[assembly: AssemblyDescription("")]
|
[assembly: AssemblyDescription("")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("")]
|
[assembly: AssemblyCompany("Jellyfin Project")]
|
||||||
[assembly: AssemblyProduct("BDInfo")]
|
[assembly: AssemblyProduct("Jellyfin: The Free Software Media System")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2016")]
|
[assembly: AssemblyCopyright("Copyright © 2016 CinemaSquid. Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License Version 2")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: NeutralResourcesLanguage("en")]
|
[assembly: NeutralResourcesLanguage("en")]
|
||||||
|
|
||||||
// Version information for an assembly consists of the following four values:
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
//
|
// to COM components. If you need to access a type in this assembly from
|
||||||
// Major Version
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
// Minor Version
|
[assembly: ComVisible(false)]
|
||||||
// Build Number
|
|
||||||
// Revision
|
|
||||||
//
|
|
||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
|
||||||
// by using the '*' as shown below:
|
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
|
||||||
[assembly: AssemblyVersion("1.0.1")]
|
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="..\SharedVersion.cs" Link="SharedVersion.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj" />
|
<ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
@ -81,7 +81,7 @@ namespace DvdLib.Ifo
|
||||||
|
|
||||||
private void ReadVTS(ushort vtsNum, List<FileSystemMetadata> allFiles)
|
private void ReadVTS(ushort vtsNum, List<FileSystemMetadata> allFiles)
|
||||||
{
|
{
|
||||||
var filename = String.Format("VTS_{0:00}_0.IFO", vtsNum);
|
var filename = string.Format("VTS_{0:00}_0.IFO", vtsNum);
|
||||||
|
|
||||||
var vtsPath = allFiles.FirstOrDefault(i => string.Equals(i.Name, filename, StringComparison.OrdinalIgnoreCase)) ??
|
var vtsPath = allFiles.FirstOrDefault(i => string.Equals(i.Name, filename, StringComparison.OrdinalIgnoreCase)) ??
|
||||||
allFiles.FirstOrDefault(i => string.Equals(i.Name, Path.ChangeExtension(filename, ".bup"), StringComparison.OrdinalIgnoreCase));
|
allFiles.FirstOrDefault(i => string.Equals(i.Name, Path.ChangeExtension(filename, ".bup"), StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
@ -20,7 +20,7 @@ namespace DvdLib.Ifo
|
||||||
else if ((data[3] & 0x40) != 0) FrameRate = 25;
|
else if ((data[3] & 0x40) != 0) FrameRate = 25;
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte GetBCDValue(byte data)
|
private static byte GetBCDValue(byte data)
|
||||||
{
|
{
|
||||||
return (byte)((((data & 0xF0) >> 4) * 10) + (data & 0x0F));
|
return (byte)((((data & 0xF0) >> 4) * 10) + (data & 0x0F));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
using System.Resources;
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Resources;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
// General Information about an assembly is controlled through the following
|
||||||
|
@ -9,21 +8,14 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: AssemblyTitle("DvdLib")]
|
[assembly: AssemblyTitle("DvdLib")]
|
||||||
[assembly: AssemblyDescription("")]
|
[assembly: AssemblyDescription("")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("")]
|
[assembly: AssemblyCompany("Jellyfin Project")]
|
||||||
[assembly: AssemblyProduct("DvdLib")]
|
[assembly: AssemblyProduct("Jellyfin: The Free Software Media System")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2016")]
|
[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License Version 2")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: NeutralResourcesLanguage("en")]
|
[assembly: NeutralResourcesLanguage("en")]
|
||||||
|
|
||||||
// Version information for an assembly consists of the following four values:
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
//
|
// to COM components. If you need to access a type in this assembly from
|
||||||
// Major Version
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
// Minor Version
|
[assembly: ComVisible(false)]
|
||||||
// Build Number
|
|
||||||
// Revision
|
|
||||||
//
|
|
||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
|
||||||
// by using the '*' as shown below:
|
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
|
||||||
[assembly: AssemblyVersion("1.0.1")]
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using Emby.Dlna.Common;
|
using Emby.Dlna.Common;
|
||||||
using Emby.Dlna.Service;
|
using Emby.Dlna.Service;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ namespace Emby.Dlna.ConnectionManager
|
||||||
return new ServiceXmlBuilder().GetXml(new ServiceActionListBuilder().GetActions(), GetStateVariables());
|
return new ServiceXmlBuilder().GetXml(new ServiceActionListBuilder().GetActions(), GetStateVariables());
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<StateVariable> GetStateVariables()
|
private static IEnumerable<StateVariable> GetStateVariables()
|
||||||
{
|
{
|
||||||
var list = new List<StateVariable>();
|
var list = new List<StateVariable>();
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using Emby.Dlna.Common;
|
using Emby.Dlna.Common;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Emby.Dlna.ConnectionManager
|
namespace Emby.Dlna.ConnectionManager
|
||||||
|
@ -19,7 +19,7 @@ namespace Emby.Dlna.ConnectionManager
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ServiceAction PrepareForConnection()
|
private static ServiceAction PrepareForConnection()
|
||||||
{
|
{
|
||||||
var action = new ServiceAction
|
var action = new ServiceAction
|
||||||
{
|
{
|
||||||
|
@ -78,7 +78,7 @@ namespace Emby.Dlna.ConnectionManager
|
||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ServiceAction GetCurrentConnectionInfo()
|
private static ServiceAction GetCurrentConnectionInfo()
|
||||||
{
|
{
|
||||||
var action = new ServiceAction
|
var action = new ServiceAction
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using Emby.Dlna.Common;
|
using Emby.Dlna.Common;
|
||||||
using Emby.Dlna.Service;
|
using Emby.Dlna.Service;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ namespace Emby.Dlna.ContentDirectory
|
||||||
GetStateVariables());
|
GetStateVariables());
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<StateVariable> GetStateVariables()
|
private static IEnumerable<StateVariable> GetStateVariables()
|
||||||
{
|
{
|
||||||
var list = new List<StateVariable>();
|
var list = new List<StateVariable>();
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using Emby.Dlna.Common;
|
using Emby.Dlna.Common;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Emby.Dlna.ContentDirectory
|
namespace Emby.Dlna.ContentDirectory
|
||||||
|
@ -20,7 +20,7 @@ namespace Emby.Dlna.ContentDirectory
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private ServiceAction GetGetSystemUpdateIDAction()
|
private static ServiceAction GetGetSystemUpdateIDAction()
|
||||||
{
|
{
|
||||||
var action = new ServiceAction
|
var action = new ServiceAction
|
||||||
{
|
{
|
||||||
|
@ -37,7 +37,7 @@ namespace Emby.Dlna.ContentDirectory
|
||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ServiceAction GetSearchCapabilitiesAction()
|
private static ServiceAction GetSearchCapabilitiesAction()
|
||||||
{
|
{
|
||||||
var action = new ServiceAction
|
var action = new ServiceAction
|
||||||
{
|
{
|
||||||
|
@ -54,7 +54,7 @@ namespace Emby.Dlna.ContentDirectory
|
||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ServiceAction GetSortCapabilitiesAction()
|
private static ServiceAction GetSortCapabilitiesAction()
|
||||||
{
|
{
|
||||||
var action = new ServiceAction
|
var action = new ServiceAction
|
||||||
{
|
{
|
||||||
|
@ -71,7 +71,7 @@ namespace Emby.Dlna.ContentDirectory
|
||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ServiceAction GetX_GetFeatureListAction()
|
private static ServiceAction GetX_GetFeatureListAction()
|
||||||
{
|
{
|
||||||
var action = new ServiceAction
|
var action = new ServiceAction
|
||||||
{
|
{
|
||||||
|
@ -88,7 +88,7 @@ namespace Emby.Dlna.ContentDirectory
|
||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ServiceAction GetSearchAction()
|
private static ServiceAction GetSearchAction()
|
||||||
{
|
{
|
||||||
var action = new ServiceAction
|
var action = new ServiceAction
|
||||||
{
|
{
|
||||||
|
|
|
@ -375,7 +375,7 @@ namespace Emby.Dlna.Didl
|
||||||
? GetMimeType(filename)
|
? GetMimeType(filename)
|
||||||
: mediaProfile.MimeType;
|
: mediaProfile.MimeType;
|
||||||
|
|
||||||
writer.WriteAttributeString("protocolInfo", String.Format(
|
writer.WriteAttributeString("protocolInfo", string.Format(
|
||||||
"http-get:*:{0}:{1}",
|
"http-get:*:{0}:{1}",
|
||||||
mimeType,
|
mimeType,
|
||||||
contentFeatures
|
contentFeatures
|
||||||
|
@ -573,7 +573,7 @@ namespace Emby.Dlna.Didl
|
||||||
streamInfo.RunTimeTicks ?? 0,
|
streamInfo.RunTimeTicks ?? 0,
|
||||||
streamInfo.TranscodeSeekInfo);
|
streamInfo.TranscodeSeekInfo);
|
||||||
|
|
||||||
writer.WriteAttributeString("protocolInfo", String.Format(
|
writer.WriteAttributeString("protocolInfo", string.Format(
|
||||||
"http-get:*:{0}:{1}",
|
"http-get:*:{0}:{1}",
|
||||||
mimeType,
|
mimeType,
|
||||||
contentFeatures
|
contentFeatures
|
||||||
|
@ -1017,7 +1017,7 @@ namespace Emby.Dlna.Didl
|
||||||
var contentFeatures = new ContentFeatureBuilder(_profile)
|
var contentFeatures = new ContentFeatureBuilder(_profile)
|
||||||
.BuildImageHeader(format, width, height, imageInfo.IsDirectStream, org_Pn);
|
.BuildImageHeader(format, width, height, imageInfo.IsDirectStream, org_Pn);
|
||||||
|
|
||||||
writer.WriteAttributeString("protocolInfo", String.Format(
|
writer.WriteAttributeString("protocolInfo", string.Format(
|
||||||
"http-get:*:{0}:{1}",
|
"http-get:*:{0}:{1}",
|
||||||
GetMimeType("file." + format),
|
GetMimeType("file." + format),
|
||||||
contentFeatures
|
contentFeatures
|
||||||
|
|
|
@ -95,7 +95,7 @@ namespace Emby.Dlna
|
||||||
{
|
{
|
||||||
if (deviceInfo == null)
|
if (deviceInfo == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("deviceInfo");
|
throw new ArgumentNullException(nameof(deviceInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
var profile = GetProfiles()
|
var profile = GetProfiles()
|
||||||
|
@ -207,7 +207,7 @@ namespace Emby.Dlna
|
||||||
{
|
{
|
||||||
if (headers == null)
|
if (headers == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("headers");
|
throw new ArgumentNullException(nameof(headers));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert to case insensitive
|
// Convert to case insensitive
|
||||||
|
@ -335,7 +335,7 @@ namespace Emby.Dlna
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(id))
|
if (string.IsNullOrEmpty(id))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("id");
|
throw new ArgumentNullException(nameof(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
var info = GetProfileInfosInternal().First(i => string.Equals(i.Info.Id, id, StringComparison.OrdinalIgnoreCase));
|
var info = GetProfileInfosInternal().First(i => string.Equals(i.Info.Id, id, StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="..\SharedVersion.cs" Link="SharedVersion.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj" />
|
<ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj" />
|
||||||
<ProjectReference Include="..\MediaBrowser.Controller\MediaBrowser.Controller.csproj" />
|
<ProjectReference Include="..\MediaBrowser.Controller\MediaBrowser.Controller.csproj" />
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using MediaBrowser.Common.Extensions;
|
using MediaBrowser.Common.Extensions;
|
||||||
using MediaBrowser.Controller.Configuration;
|
using MediaBrowser.Controller.Configuration;
|
||||||
using Emby.Dlna.Server;
|
using Emby.Dlna.Server;
|
||||||
using Emby.Dlna.Service;
|
using Emby.Dlna.Service;
|
||||||
|
@ -21,7 +21,7 @@ namespace Emby.Dlna.MediaReceiverRegistrar
|
||||||
throw new ResourceNotFoundException("Unexpected control request name: " + methodName);
|
throw new ResourceNotFoundException("Unexpected control request name: " + methodName);
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<KeyValuePair<string, string>> HandleIsAuthorized()
|
private static IEnumerable<KeyValuePair<string, string>> HandleIsAuthorized()
|
||||||
{
|
{
|
||||||
return new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
|
return new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
|
||||||
{
|
{
|
||||||
|
@ -29,7 +29,7 @@ namespace Emby.Dlna.MediaReceiverRegistrar
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<KeyValuePair<string, string>> HandleIsValidated()
|
private static IEnumerable<KeyValuePair<string, string>> HandleIsValidated()
|
||||||
{
|
{
|
||||||
return new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
|
return new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using Emby.Dlna.Common;
|
using Emby.Dlna.Common;
|
||||||
using Emby.Dlna.Service;
|
using Emby.Dlna.Service;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ namespace Emby.Dlna.MediaReceiverRegistrar
|
||||||
GetStateVariables());
|
GetStateVariables());
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<StateVariable> GetStateVariables()
|
private static IEnumerable<StateVariable> GetStateVariables()
|
||||||
{
|
{
|
||||||
var list = new List<StateVariable>();
|
var list = new List<StateVariable>();
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using Emby.Dlna.Common;
|
using Emby.Dlna.Common;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Emby.Dlna.MediaReceiverRegistrar
|
namespace Emby.Dlna.MediaReceiverRegistrar
|
||||||
|
@ -19,7 +19,7 @@ namespace Emby.Dlna.MediaReceiverRegistrar
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private ServiceAction GetIsValidated()
|
private static ServiceAction GetIsValidated()
|
||||||
{
|
{
|
||||||
var action = new ServiceAction
|
var action = new ServiceAction
|
||||||
{
|
{
|
||||||
|
@ -41,7 +41,7 @@ namespace Emby.Dlna.MediaReceiverRegistrar
|
||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ServiceAction GetIsAuthorized()
|
private static ServiceAction GetIsAuthorized()
|
||||||
{
|
{
|
||||||
var action = new ServiceAction
|
var action = new ServiceAction
|
||||||
{
|
{
|
||||||
|
@ -63,7 +63,7 @@ namespace Emby.Dlna.MediaReceiverRegistrar
|
||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ServiceAction GetRegisterDevice()
|
private static ServiceAction GetRegisterDevice()
|
||||||
{
|
{
|
||||||
var action = new ServiceAction
|
var action = new ServiceAction
|
||||||
{
|
{
|
||||||
|
@ -85,7 +85,7 @@ namespace Emby.Dlna.MediaReceiverRegistrar
|
||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ServiceAction GetGetValidationSucceededUpdateID()
|
private static ServiceAction GetGetValidationSucceededUpdateID()
|
||||||
{
|
{
|
||||||
var action = new ServiceAction
|
var action = new ServiceAction
|
||||||
{
|
{
|
||||||
|
|
|
@ -311,7 +311,7 @@ namespace Emby.Dlna.PlayTo
|
||||||
throw new InvalidOperationException("Unable to find service");
|
throw new InvalidOperationException("Unable to find service");
|
||||||
}
|
}
|
||||||
|
|
||||||
await new SsdpHttpClient(_httpClient, _config).SendCommandAsync(Properties.BaseUrl, service, command.Name, avCommands.BuildPost(command, service.ServiceType, String.Format("{0:hh}:{0:mm}:{0:ss}", value), "REL_TIME"))
|
await new SsdpHttpClient(_httpClient, _config).SendCommandAsync(Properties.BaseUrl, service, command.Name, avCommands.BuildPost(command, service.ServiceType, string.Format("{0:hh}:{0:mm}:{0:ss}", value), "REL_TIME"))
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
RestartTimer(true);
|
RestartTimer(true);
|
||||||
|
@ -364,7 +364,7 @@ namespace Emby.Dlna.PlayTo
|
||||||
private string CreateDidlMeta(string value)
|
private string CreateDidlMeta(string value)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(value))
|
if (string.IsNullOrEmpty(value))
|
||||||
return String.Empty;
|
return string.Empty;
|
||||||
|
|
||||||
return DescriptionXmlBuilder.Escape(value);
|
return DescriptionXmlBuilder.Escape(value);
|
||||||
}
|
}
|
||||||
|
@ -783,7 +783,7 @@ namespace Emby.Dlna.PlayTo
|
||||||
{
|
{
|
||||||
if (container == null)
|
if (container == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("container");
|
throw new ArgumentNullException(nameof(container));
|
||||||
}
|
}
|
||||||
|
|
||||||
var url = container.GetValue(uPnpNamespaces.Res);
|
var url = container.GetValue(uPnpNamespaces.Res);
|
||||||
|
@ -810,7 +810,7 @@ namespace Emby.Dlna.PlayTo
|
||||||
{
|
{
|
||||||
if (container == null)
|
if (container == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("container");
|
throw new ArgumentNullException(nameof(container));
|
||||||
}
|
}
|
||||||
|
|
||||||
var resElement = container.Element(uPnpNamespaces.Res);
|
var resElement = container.Element(uPnpNamespaces.Res);
|
||||||
|
@ -979,7 +979,7 @@ namespace Emby.Dlna.PlayTo
|
||||||
if (modelDescription != null)
|
if (modelDescription != null)
|
||||||
deviceProperties.ModelDescription = modelDescription.Value;
|
deviceProperties.ModelDescription = modelDescription.Value;
|
||||||
|
|
||||||
deviceProperties.BaseUrl = String.Format("http://{0}:{1}", url.Host, url.Port);
|
deviceProperties.BaseUrl = string.Format("http://{0}:{1}", url.Host, url.Port);
|
||||||
|
|
||||||
var icon = document.Descendants(uPnpNamespaces.ud.GetName("icon")).FirstOrDefault();
|
var icon = document.Descendants(uPnpNamespaces.ud.GetName("icon")).FirstOrDefault();
|
||||||
|
|
||||||
|
@ -1021,7 +1021,7 @@ namespace Emby.Dlna.PlayTo
|
||||||
{
|
{
|
||||||
if (element == null)
|
if (element == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("element");
|
throw new ArgumentNullException(nameof(element));
|
||||||
}
|
}
|
||||||
|
|
||||||
var mimeType = element.GetDescendantValue(uPnpNamespaces.ud.GetName("mimetype"));
|
var mimeType = element.GetDescendantValue(uPnpNamespaces.ud.GetName("mimetype"));
|
||||||
|
@ -1173,7 +1173,7 @@ namespace Emby.Dlna.PlayTo
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return String.Format("{0} - {1}", Properties.Name, Properties.BaseUrl);
|
return string.Format("{0} - {1}", Properties.Name, Properties.BaseUrl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,10 +114,10 @@ namespace Emby.Dlna.PlayTo
|
||||||
info.Headers.TryGetValue("NTS", out nts);
|
info.Headers.TryGetValue("NTS", out nts);
|
||||||
|
|
||||||
string usn;
|
string usn;
|
||||||
if (!info.Headers.TryGetValue("USN", out usn)) usn = String.Empty;
|
if (!info.Headers.TryGetValue("USN", out usn)) usn = string.Empty;
|
||||||
|
|
||||||
string nt;
|
string nt;
|
||||||
if (!info.Headers.TryGetValue("NT", out nt)) nt = String.Empty;
|
if (!info.Headers.TryGetValue("NT", out nt)) nt = string.Empty;
|
||||||
|
|
||||||
if (usn.IndexOf(_device.Properties.UUID, StringComparison.OrdinalIgnoreCase) != -1 &&
|
if (usn.IndexOf(_device.Properties.UUID, StringComparison.OrdinalIgnoreCase) != -1 &&
|
||||||
!_disposed)
|
!_disposed)
|
||||||
|
@ -829,7 +829,7 @@ namespace Emby.Dlna.PlayTo
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(url))
|
if (string.IsNullOrEmpty(url))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("url");
|
throw new ArgumentNullException(nameof(url));
|
||||||
}
|
}
|
||||||
|
|
||||||
var parts = url.Split('/');
|
var parts = url.Split('/');
|
||||||
|
@ -855,7 +855,7 @@ namespace Emby.Dlna.PlayTo
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(url))
|
if (string.IsNullOrEmpty(url))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("url");
|
throw new ArgumentNullException(nameof(url));
|
||||||
}
|
}
|
||||||
|
|
||||||
var request = new StreamParams
|
var request = new StreamParams
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Model.Dlna;
|
using MediaBrowser.Model.Dlna;
|
||||||
using MediaBrowser.Model.Session;
|
using MediaBrowser.Model.Session;
|
||||||
using System;
|
using System;
|
||||||
|
@ -49,7 +49,7 @@ namespace Emby.Dlna.PlayTo
|
||||||
return playlistItem;
|
return playlistItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool IsSupported(DirectPlayProfile profile, Photo item)
|
private static bool IsSupported(DirectPlayProfile profile, Photo item)
|
||||||
{
|
{
|
||||||
var mediaPath = item.Path;
|
var mediaPath = item.Path;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using MediaBrowser.Common.Net;
|
using MediaBrowser.Common.Net;
|
||||||
using MediaBrowser.Controller.Configuration;
|
using MediaBrowser.Controller.Configuration;
|
||||||
using Emby.Dlna.Common;
|
using Emby.Dlna.Common;
|
||||||
using System;
|
using System;
|
||||||
|
@ -47,7 +47,7 @@ namespace Emby.Dlna.PlayTo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private string NormalizeServiceUrl(string baseUrl, string serviceUrl)
|
private static string NormalizeServiceUrl(string baseUrl, string serviceUrl)
|
||||||
{
|
{
|
||||||
// If it's already a complete url, don't stick anything onto the front of it
|
// If it's already a complete url, don't stick anything onto the front of it
|
||||||
if (serviceUrl.StartsWith("http", StringComparison.OrdinalIgnoreCase))
|
if (serviceUrl.StartsWith("http", StringComparison.OrdinalIgnoreCase))
|
||||||
|
|
|
@ -80,7 +80,7 @@ namespace Emby.Dlna.PlayTo
|
||||||
{
|
{
|
||||||
if (container == null)
|
if (container == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("container");
|
throw new ArgumentNullException(nameof(container));
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Argument
|
return new Argument
|
||||||
|
|
|
@ -10,7 +10,7 @@ namespace Emby.Dlna.PlayTo
|
||||||
{
|
{
|
||||||
if (container == null)
|
if (container == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("container");
|
throw new ArgumentNullException(nameof(container));
|
||||||
}
|
}
|
||||||
|
|
||||||
return new uBaseObject
|
return new uBaseObject
|
||||||
|
|
|
@ -26,7 +26,7 @@ namespace Emby.Dlna.PlayTo
|
||||||
{
|
{
|
||||||
if (obj == null)
|
if (obj == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("obj");
|
throw new ArgumentNullException(nameof(obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
return string.Equals(Id, obj.Id);
|
return string.Equals(Id, obj.Id);
|
||||||
|
|
|
@ -26,7 +26,7 @@ namespace Emby.Dlna.PlayTo
|
||||||
if (item == null)
|
if (item == null)
|
||||||
return list;
|
return list;
|
||||||
|
|
||||||
var uPnpResponse = XElement.Parse((String)item);
|
var uPnpResponse = XElement.Parse((string)item);
|
||||||
|
|
||||||
var uObjects = from container in uPnpResponse.Elements(uPnpNamespaces.containers)
|
var uObjects = from container in uPnpResponse.Elements(uPnpNamespaces.containers)
|
||||||
select new uParserObject { Element = container };
|
select new uParserObject { Element = container };
|
||||||
|
|
|
@ -1,17 +1,16 @@
|
||||||
using System.Resources;
|
using System.Resources;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
// General Information about an assembly is controlled through the following
|
||||||
// set of attributes. Change these attribute values to modify the information
|
// set of attributes. Change these attribute values to modify the information
|
||||||
// associated with an assembly.
|
// associated with an assembly.
|
||||||
[assembly: AssemblyTitle("Emby.Dlna2")]
|
[assembly: AssemblyTitle("Emby.Dlna")]
|
||||||
[assembly: AssemblyDescription("")]
|
[assembly: AssemblyDescription("")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("")]
|
[assembly: AssemblyCompany("Jellyfin Project")]
|
||||||
[assembly: AssemblyProduct("Emby.Dlna2")]
|
[assembly: AssemblyProduct("Jellyfin: The Free Software Media System")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2016")]
|
[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License Version 2")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: NeutralResourcesLanguage("en")]
|
[assembly: NeutralResourcesLanguage("en")]
|
||||||
|
@ -26,5 +25,3 @@ using System.Runtime.InteropServices;
|
||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("1.0.0.0")]
|
|
||||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using Emby.Dlna.Common;
|
using Emby.Dlna.Common;
|
||||||
using MediaBrowser.Model.Dlna;
|
using MediaBrowser.Model.Dlna;
|
||||||
using MediaBrowser.Model.Extensions;
|
using MediaBrowser.Model.Extensions;
|
||||||
using System;
|
using System;
|
||||||
|
@ -24,12 +24,12 @@ namespace Emby.Dlna.Server
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(serverUdn))
|
if (string.IsNullOrEmpty(serverUdn))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("serverUdn");
|
throw new ArgumentNullException(nameof(serverUdn));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(serverAddress))
|
if (string.IsNullOrEmpty(serverAddress))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("serverAddress");
|
throw new ArgumentNullException(nameof(serverAddress));
|
||||||
}
|
}
|
||||||
|
|
||||||
_profile = profile;
|
_profile = profile;
|
||||||
|
@ -39,10 +39,7 @@ namespace Emby.Dlna.Server
|
||||||
_serverId = serverId;
|
_serverId = serverId;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool EnableAbsoluteUrls
|
private static bool EnableAbsoluteUrls => false;
|
||||||
{
|
|
||||||
get { return false; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public string GetXml()
|
public string GetXml()
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using Emby.Dlna.Common;
|
using Emby.Dlna.Common;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Security;
|
using System.Security;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
@ -28,7 +28,7 @@ namespace Emby.Dlna.Service
|
||||||
return builder.ToString();
|
return builder.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AppendActionList(StringBuilder builder, IEnumerable<ServiceAction> actions)
|
private static void AppendActionList(StringBuilder builder, IEnumerable<ServiceAction> actions)
|
||||||
{
|
{
|
||||||
builder.Append("<actionList>");
|
builder.Append("<actionList>");
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ namespace Emby.Dlna.Service
|
||||||
builder.Append("</actionList>");
|
builder.Append("</actionList>");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AppendServiceStateTable(StringBuilder builder, IEnumerable<StateVariable> stateVariables)
|
private static void AppendServiceStateTable(StringBuilder builder, IEnumerable<StateVariable> stateVariables)
|
||||||
{
|
{
|
||||||
builder.Append("<serviceStateTable>");
|
builder.Append("<serviceStateTable>");
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
using System.Resources;
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Resources;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
// General Information about an assembly is controlled through the following
|
||||||
|
@ -9,17 +8,14 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: AssemblyTitle("Emby.Drawing.Skia")]
|
[assembly: AssemblyTitle("Emby.Drawing.Skia")]
|
||||||
[assembly: AssemblyDescription("")]
|
[assembly: AssemblyDescription("")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("")]
|
[assembly: AssemblyCompany("Jellyfin Project")]
|
||||||
[assembly: AssemblyProduct("Emby.Drawing.Skia")]
|
[assembly: AssemblyProduct("Jellyfin: The Free Software Media System")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2017")]
|
[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License Version 2")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: NeutralResourcesLanguage("en")]
|
[assembly: NeutralResourcesLanguage("en")]
|
||||||
|
|
||||||
// Version information for an assembly consists of the following four values:
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
//
|
// to COM components. If you need to access a type in this assembly from
|
||||||
// Major Version
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
// Minor Version
|
[assembly: ComVisible(false)]
|
||||||
// Build Number
|
|
||||||
// Revision
|
|
||||||
//
|
|
||||||
|
|
|
@ -197,7 +197,7 @@ namespace Emby.Drawing.Skia
|
||||||
|
|
||||||
private static bool HasDiacritics(string text)
|
private static bool HasDiacritics(string text)
|
||||||
{
|
{
|
||||||
return !String.Equals(text, text.RemoveDiacritics(), StringComparison.Ordinal);
|
return !string.Equals(text, text.RemoveDiacritics(), StringComparison.Ordinal);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool RequiresSpecialCharacterHack(string path)
|
private static bool RequiresSpecialCharacterHack(string path)
|
||||||
|
@ -509,11 +509,11 @@ namespace Emby.Drawing.Skia
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(inputPath))
|
if (string.IsNullOrWhiteSpace(inputPath))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("inputPath");
|
throw new ArgumentNullException(nameof(inputPath));
|
||||||
}
|
}
|
||||||
if (string.IsNullOrWhiteSpace(inputPath))
|
if (string.IsNullOrWhiteSpace(inputPath))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("outputPath");
|
throw new ArgumentNullException(nameof(outputPath));
|
||||||
}
|
}
|
||||||
|
|
||||||
var skiaOutputFormat = GetImageFormat(selectedOutputFormat);
|
var skiaOutputFormat = GetImageFormat(selectedOutputFormat);
|
||||||
|
@ -594,12 +594,12 @@ namespace Emby.Drawing.Skia
|
||||||
// If foreground layer present then draw
|
// If foreground layer present then draw
|
||||||
if (hasForegroundColor)
|
if (hasForegroundColor)
|
||||||
{
|
{
|
||||||
if (!Double.TryParse(options.ForegroundLayer, out double opacity))
|
if (!double.TryParse(options.ForegroundLayer, out double opacity))
|
||||||
{
|
{
|
||||||
opacity = .4;
|
opacity = .4;
|
||||||
}
|
}
|
||||||
|
|
||||||
canvas.DrawColor(new SKColor(0, 0, 0, (Byte)((1 - opacity) * 0xFF)), SKBlendMode.SrcOver);
|
canvas.DrawColor(new SKColor(0, 0, 0, (byte)((1 - opacity) * 0xFF)), SKBlendMode.SrcOver);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasIndicator)
|
if (hasIndicator)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using SkiaSharp;
|
using SkiaSharp;
|
||||||
using MediaBrowser.Common.Configuration;
|
using MediaBrowser.Common.Configuration;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
@ -20,6 +20,11 @@ namespace Emby.Drawing.Skia
|
||||||
|
|
||||||
public static SKEncodedImageFormat GetEncodedFormat(string outputPath)
|
public static SKEncodedImageFormat GetEncodedFormat(string outputPath)
|
||||||
{
|
{
|
||||||
|
if (outputPath == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(outputPath));
|
||||||
|
}
|
||||||
|
|
||||||
var ext = Path.GetExtension(outputPath).ToLower();
|
var ext = Path.GetExtension(outputPath).ToLower();
|
||||||
|
|
||||||
if (ext == ".jpg" || ext == ".jpeg")
|
if (ext == ".jpg" || ext == ".jpeg")
|
||||||
|
|
|
@ -94,7 +94,7 @@ namespace Emby.Drawing.Common
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new ArgumentException(ErrorMessage, "binaryReader");
|
throw new ArgumentException(ErrorMessage, nameof(binaryReader));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -80,7 +80,7 @@ namespace Emby.Drawing
|
||||||
{
|
{
|
||||||
if (value == null)
|
if (value == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("value");
|
throw new ArgumentNullException(nameof(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
_imageEncoder = value;
|
_imageEncoder = value;
|
||||||
|
@ -179,7 +179,7 @@ namespace Emby.Drawing
|
||||||
{
|
{
|
||||||
if (options == null)
|
if (options == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("options");
|
throw new ArgumentNullException(nameof(options));
|
||||||
}
|
}
|
||||||
|
|
||||||
var originalImage = options.Image;
|
var originalImage = options.Image;
|
||||||
|
@ -491,7 +491,7 @@ namespace Emby.Drawing
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(path))
|
if (string.IsNullOrEmpty(path))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("path");
|
throw new ArgumentNullException(nameof(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -691,12 +691,12 @@ namespace Emby.Drawing
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(originalImagePath))
|
if (string.IsNullOrEmpty(originalImagePath))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("originalImagePath");
|
throw new ArgumentNullException(nameof(originalImagePath));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item == null)
|
if (item == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("item");
|
throw new ArgumentNullException(nameof(item));
|
||||||
}
|
}
|
||||||
|
|
||||||
var treatmentRequiresTransparency = false;
|
var treatmentRequiresTransparency = false;
|
||||||
|
@ -779,16 +779,16 @@ namespace Emby.Drawing
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(path))
|
if (string.IsNullOrEmpty(path))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("path");
|
throw new ArgumentNullException(nameof(path));
|
||||||
}
|
}
|
||||||
if (string.IsNullOrEmpty(uniqueName))
|
if (string.IsNullOrEmpty(uniqueName))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("uniqueName");
|
throw new ArgumentNullException(nameof(uniqueName));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(fileExtension))
|
if (string.IsNullOrEmpty(fileExtension))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("fileExtension");
|
throw new ArgumentNullException(nameof(fileExtension));
|
||||||
}
|
}
|
||||||
|
|
||||||
var filename = uniqueName.GetMD5() + fileExtension;
|
var filename = uniqueName.GetMD5() + fileExtension;
|
||||||
|
@ -811,11 +811,11 @@ namespace Emby.Drawing
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(path))
|
if (string.IsNullOrEmpty(path))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("path");
|
throw new ArgumentNullException(nameof(path));
|
||||||
}
|
}
|
||||||
if (string.IsNullOrEmpty(filename))
|
if (string.IsNullOrEmpty(filename))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("filename");
|
throw new ArgumentNullException(nameof(filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
var prefix = filename.Substring(0, 1);
|
var prefix = filename.Substring(0, 1);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
// General Information about an assembly is controlled through the following
|
||||||
|
@ -7,9 +7,9 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: AssemblyTitle("Emby.Drawing")]
|
[assembly: AssemblyTitle("Emby.Drawing")]
|
||||||
[assembly: AssemblyDescription("")]
|
[assembly: AssemblyDescription("")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("")]
|
[assembly: AssemblyCompany("Jellyfin Project")]
|
||||||
[assembly: AssemblyProduct("Emby.Drawing")]
|
[assembly: AssemblyProduct("Jellyfin: The Free Software Media System")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2015")]
|
[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License Version 2")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="..\..\SharedVersion.cs" Link="SharedVersion.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\MediaBrowser.Model\MediaBrowser.Model.csproj" />
|
<ProjectReference Include="..\..\MediaBrowser.Model\MediaBrowser.Model.csproj" />
|
||||||
<ProjectReference Include="..\..\MediaBrowser.Common\MediaBrowser.Common.csproj" />
|
<ProjectReference Include="..\..\MediaBrowser.Common\MediaBrowser.Common.csproj" />
|
||||||
|
|
|
@ -87,7 +87,7 @@ namespace IsoMounter
|
||||||
UmountCommand
|
UmountCommand
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!String.IsNullOrEmpty(SudoCommand) && !String.IsNullOrEmpty(MountCommand) && !String.IsNullOrEmpty(UmountCommand)) {
|
if (!string.IsNullOrEmpty(SudoCommand) && !string.IsNullOrEmpty(MountCommand) && !string.IsNullOrEmpty(UmountCommand)) {
|
||||||
ExecutablesAvailable = true;
|
ExecutablesAvailable = true;
|
||||||
} else {
|
} else {
|
||||||
ExecutablesAvailable = false;
|
ExecutablesAvailable = false;
|
||||||
|
@ -152,7 +152,7 @@ namespace IsoMounter
|
||||||
return Task.FromResult<IIsoMount>(mountedISO);
|
return Task.FromResult<IIsoMount>(mountedISO);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw new IOException(String.Format(
|
throw new IOException(string.Format(
|
||||||
"An error occurred trying to mount image [$0].",
|
"An error occurred trying to mount image [$0].",
|
||||||
isoPath
|
isoPath
|
||||||
));
|
));
|
||||||
|
@ -217,7 +217,7 @@ namespace IsoMounter
|
||||||
{
|
{
|
||||||
string path = test.Trim();
|
string path = test.Trim();
|
||||||
|
|
||||||
if (!String.IsNullOrEmpty(path) && FileSystem.FileExists(path = Path.Combine(path, name))) {
|
if (!string.IsNullOrEmpty(path) && FileSystem.FileExists(path = Path.Combine(path, name))) {
|
||||||
return FileSystem.GetFullPath(path);
|
return FileSystem.GetFullPath(path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
21
Emby.IsoMounting/IsoMounter/Properties/AssemblyInfo.cs
Normal file
21
Emby.IsoMounting/IsoMounter/Properties/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Resources;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("IsoMounter")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("Jellyfin Project")]
|
||||||
|
[assembly: AssemblyProduct("Jellyfin: The Free Software Media System")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License Version 2")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
[assembly: NeutralResourcesLanguage("en")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
|
@ -30,7 +30,7 @@ namespace Emby.Naming.AudioBook
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(path))
|
if (string.IsNullOrEmpty(path))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("path");
|
throw new ArgumentNullException(nameof(path));
|
||||||
}
|
}
|
||||||
if (IsDirectory)
|
if (IsDirectory)
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -5,6 +5,10 @@
|
||||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="..\SharedVersion.cs" Link="SharedVersion.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\MediaBrowser.Common\MediaBrowser.Common.csproj" />
|
<ProjectReference Include="..\MediaBrowser.Common\MediaBrowser.Common.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
21
Emby.Naming/Properties/AssemblyInfo.cs
Normal file
21
Emby.Naming/Properties/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Resources;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("Emby.Naming")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("Jellyfin Project")]
|
||||||
|
[assembly: AssemblyProduct("Jellyfin: The Free Software Media System")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License Version 2")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
[assembly: NeutralResourcesLanguage("en")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
|
@ -18,7 +18,7 @@ namespace Emby.Naming.Subtitles
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(path))
|
if (string.IsNullOrEmpty(path))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("path");
|
throw new ArgumentNullException(nameof(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
var extension = Path.GetExtension(path);
|
var extension = Path.GetExtension(path);
|
||||||
|
@ -52,7 +52,7 @@ namespace Emby.Naming.Subtitles
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(path))
|
if (string.IsNullOrEmpty(path))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("path");
|
throw new ArgumentNullException(nameof(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note: the tags need be be surrounded be either a space ( ), hyphen -, dot . or underscore _.
|
// Note: the tags need be be surrounded be either a space ( ), hyphen -, dot . or underscore _.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using Emby.Naming.Common;
|
using Emby.Naming.Common;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
@ -74,7 +74,7 @@ namespace Emby.Naming.TV
|
||||||
return result ?? new EpisodePathParserResult();
|
return result ?? new EpisodePathParserResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
private EpisodePathParserResult Parse(string name, EpisodeExpression expression)
|
private static EpisodePathParserResult Parse(string name, EpisodeExpression expression)
|
||||||
{
|
{
|
||||||
var result = new EpisodePathParserResult();
|
var result = new EpisodePathParserResult();
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ namespace Emby.Naming.TV
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(path))
|
if (string.IsNullOrEmpty(path))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("path");
|
throw new ArgumentNullException(nameof(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
var isStub = false;
|
var isStub = false;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using Emby.Naming.Common;
|
using Emby.Naming.Common;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
@ -63,7 +63,7 @@ namespace Emby.Naming.Video
|
||||||
result;
|
result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private CleanDateTimeResult Clean(string name, Regex expression)
|
private static CleanDateTimeResult Clean(string name, Regex expression)
|
||||||
{
|
{
|
||||||
var result = new CleanDateTimeResult();
|
var result = new CleanDateTimeResult();
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
namespace Emby.Naming.Video
|
namespace Emby.Naming.Video
|
||||||
|
@ -30,7 +30,7 @@ namespace Emby.Naming.Video
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private CleanStringResult Clean(string name, Regex expression)
|
private static CleanStringResult Clean(string name, Regex expression)
|
||||||
{
|
{
|
||||||
var result = new CleanStringResult();
|
var result = new CleanStringResult();
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ namespace Emby.Naming.Video
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(path))
|
if (string.IsNullOrEmpty(path))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("path");
|
throw new ArgumentNullException(nameof(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note: the tags need be be surrounded be either a space ( ), hyphen -, dot . or underscore _.
|
// Note: the tags need be be surrounded be either a space ( ), hyphen -, dot . or underscore _.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using Emby.Naming.Common;
|
using Emby.Naming.Common;
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ namespace Emby.Naming.Video
|
||||||
return new Format3DResult();
|
return new Format3DResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Format3DResult Parse(string[] videoFlags, Format3DRule rule)
|
private static Format3DResult Parse(string[] videoFlags, Format3DRule rule)
|
||||||
{
|
{
|
||||||
var result = new Format3DResult();
|
var result = new Format3DResult();
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using Emby.Naming.Common;
|
using Emby.Naming.Common;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
@ -236,7 +236,7 @@ namespace Emby.Naming.Video
|
||||||
if (testFilename.StartsWith(folderName, StringComparison.OrdinalIgnoreCase))
|
if (testFilename.StartsWith(folderName, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
testFilename = testFilename.Substring(folderName.Length).Trim();
|
testFilename = testFilename.Substring(folderName.Length).Trim();
|
||||||
return testFilename.StartsWith("-", StringComparison.OrdinalIgnoreCase)||Regex.Replace(testFilename, @"\[([^]]*)\]", "").Trim() == String.Empty;
|
return testFilename.StartsWith("-", StringComparison.OrdinalIgnoreCase) || Regex.Replace(testFilename, @"\[([^]]*)\]", "").Trim() == string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -45,7 +45,7 @@ namespace Emby.Naming.Video
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(path))
|
if (string.IsNullOrEmpty(path))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("path");
|
throw new ArgumentNullException(nameof(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
var isStub = false;
|
var isStub = false;
|
||||||
|
|
|
@ -5,6 +5,10 @@
|
||||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="..\SharedVersion.cs" Link="SharedVersion.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj" />
|
<ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj" />
|
||||||
<ProjectReference Include="..\MediaBrowser.Controller\MediaBrowser.Controller.csproj" />
|
<ProjectReference Include="..\MediaBrowser.Controller\MediaBrowser.Controller.csproj" />
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Resources;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
// General Information about an assembly is controlled through the following
|
||||||
|
@ -8,29 +8,14 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: AssemblyTitle("Emby.Notifications")]
|
[assembly: AssemblyTitle("Emby.Notifications")]
|
||||||
[assembly: AssemblyDescription("")]
|
[assembly: AssemblyDescription("")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("")]
|
[assembly: AssemblyCompany("Jellyfin Project")]
|
||||||
[assembly: AssemblyProduct("Emby.Notifications")]
|
[assembly: AssemblyProduct("Jellyfin: The Free Software Media System")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2018")]
|
[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License Version 2")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
|
[assembly: NeutralResourcesLanguage("en")]
|
||||||
|
|
||||||
// Setting ComVisible to false makes the types in this assembly not visible
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
// to COM components. If you need to access a type in this assembly from
|
// to COM components. If you need to access a type in this assembly from
|
||||||
// COM, set the ComVisible attribute to true on that type.
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
|
||||||
[assembly: Guid("4d1d313b-60bb-4e11-acf9-cda6745266ef")]
|
|
||||||
|
|
||||||
// Version information for an assembly consists of the following four values:
|
|
||||||
//
|
|
||||||
// Major Version
|
|
||||||
// Minor Version
|
|
||||||
// Build Number
|
|
||||||
// Revision
|
|
||||||
//
|
|
||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
|
||||||
// by using the '*' as shown below:
|
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
|
||||||
[assembly: AssemblyVersion("1.0.0.0")]
|
|
||||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Resources;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
// General Information about an assembly is controlled through the following
|
||||||
|
@ -8,27 +8,14 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: AssemblyTitle("Emby.Photos")]
|
[assembly: AssemblyTitle("Emby.Photos")]
|
||||||
[assembly: AssemblyDescription("")]
|
[assembly: AssemblyDescription("")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("")]
|
[assembly: AssemblyCompany("Jellyfin Project")]
|
||||||
[assembly: AssemblyProduct("Emby.Photos")]
|
[assembly: AssemblyProduct("Jellyfin: The Free Software Media System")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2016")]
|
[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License Version 2")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
|
[assembly: NeutralResourcesLanguage("en")]
|
||||||
|
|
||||||
// Setting ComVisible to false makes the types in this assembly not visible
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
// to COM components. If you need to access a type in this assembly from
|
// to COM components. If you need to access a type in this assembly from
|
||||||
// COM, set the ComVisible attribute to true on that type.
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
|
||||||
[assembly: Guid("89ab4548-770d-41fd-a891-8daff44f452c")]
|
|
||||||
|
|
||||||
// Version information for an assembly consists of the following four values:
|
|
||||||
//
|
|
||||||
// Major Version
|
|
||||||
// Minor Version
|
|
||||||
// Build Number
|
|
||||||
// Revision
|
|
||||||
//
|
|
||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
|
||||||
// by using the '*' as shown below:
|
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
|
|
@ -202,7 +202,7 @@ namespace Emby.Server.Implementations.Activity
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetPlaybackNotificationType(string mediaType)
|
private static string GetPlaybackNotificationType(string mediaType)
|
||||||
{
|
{
|
||||||
if (string.Equals(mediaType, MediaType.Audio, StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(mediaType, MediaType.Audio, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
|
@ -220,7 +220,7 @@ namespace Emby.Server.Implementations.Activity
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetPlaybackStoppedNotificationType(string mediaType)
|
private static string GetPlaybackStoppedNotificationType(string mediaType)
|
||||||
{
|
{
|
||||||
if (string.Equals(mediaType, MediaType.Audio, StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(mediaType, MediaType.Audio, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
|
@ -577,8 +577,8 @@ namespace Emby.Server.Implementations.Activity
|
||||||
/// <param name="description">The name of this item (singular form)</param>
|
/// <param name="description">The name of this item (singular form)</param>
|
||||||
private static string CreateValueString(int value, string description)
|
private static string CreateValueString(int value, string description)
|
||||||
{
|
{
|
||||||
return String.Format("{0:#,##0} {1}",
|
return string.Format("{0:#,##0} {1}",
|
||||||
value, value == 1 ? description : String.Format("{0}s", description));
|
value, value == 1 ? description : string.Format("{0}s", description));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
@ -83,7 +83,7 @@ namespace Emby.Server.Implementations.Activity
|
||||||
{
|
{
|
||||||
if (entry == null)
|
if (entry == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("entry");
|
throw new ArgumentNullException(nameof(entry));
|
||||||
}
|
}
|
||||||
|
|
||||||
using (WriteLock.Write())
|
using (WriteLock.Write())
|
||||||
|
@ -122,7 +122,7 @@ namespace Emby.Server.Implementations.Activity
|
||||||
{
|
{
|
||||||
if (entry == null)
|
if (entry == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("entry");
|
throw new ArgumentNullException(nameof(entry));
|
||||||
}
|
}
|
||||||
|
|
||||||
using (WriteLock.Write())
|
using (WriteLock.Write())
|
||||||
|
@ -251,7 +251,7 @@ namespace Emby.Server.Implementations.Activity
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private ActivityLogEntry GetEntry(IReadOnlyList<IResultSetValue> reader)
|
private static ActivityLogEntry GetEntry(IReadOnlyList<IResultSetValue> reader)
|
||||||
{
|
{
|
||||||
var index = 0;
|
var index = 0;
|
||||||
|
|
||||||
|
|
|
@ -55,61 +55,31 @@ namespace Emby.Server.Implementations.AppBase
|
||||||
}
|
}
|
||||||
|
|
||||||
private const string _virtualDataPath = "%AppDataPath%";
|
private const string _virtualDataPath = "%AppDataPath%";
|
||||||
public string VirtualDataPath
|
public string VirtualDataPath => _virtualDataPath;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _virtualDataPath;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the image cache path.
|
/// Gets the image cache path.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The image cache path.</value>
|
/// <value>The image cache path.</value>
|
||||||
public string ImageCachePath
|
public string ImageCachePath => Path.Combine(CachePath, "images");
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return Path.Combine(CachePath, "images");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the path to the plugin directory
|
/// Gets the path to the plugin directory
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The plugins path.</value>
|
/// <value>The plugins path.</value>
|
||||||
public string PluginsPath
|
public string PluginsPath => Path.Combine(ProgramDataPath, "plugins");
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return Path.Combine(ProgramDataPath, "plugins");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the path to the plugin configurations directory
|
/// Gets the path to the plugin configurations directory
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The plugin configurations path.</value>
|
/// <value>The plugin configurations path.</value>
|
||||||
public string PluginConfigurationsPath
|
public string PluginConfigurationsPath => Path.Combine(PluginsPath, "configurations");
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return Path.Combine(PluginsPath, "configurations");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the path to where temporary update files will be stored
|
/// Gets the path to where temporary update files will be stored
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The plugin configurations path.</value>
|
/// <value>The plugin configurations path.</value>
|
||||||
public string TempUpdatePath
|
public string TempUpdatePath => Path.Combine(ProgramDataPath, "updates");
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return Path.Combine(ProgramDataPath, "updates");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The _log directory
|
/// The _log directory
|
||||||
|
@ -133,10 +103,7 @@ namespace Emby.Server.Implementations.AppBase
|
||||||
|
|
||||||
return _logDirectoryPath;
|
return _logDirectoryPath;
|
||||||
}
|
}
|
||||||
set
|
set => _logDirectoryPath = value;
|
||||||
{
|
|
||||||
_logDirectoryPath = value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -161,23 +128,14 @@ namespace Emby.Server.Implementations.AppBase
|
||||||
|
|
||||||
return _configurationDirectoryPath;
|
return _configurationDirectoryPath;
|
||||||
}
|
}
|
||||||
set
|
set => _configurationDirectoryPath = value;
|
||||||
{
|
|
||||||
_configurationDirectoryPath = value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the path to the system configuration file
|
/// Gets the path to the system configuration file
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The system configuration file path.</value>
|
/// <value>The system configuration file path.</value>
|
||||||
public string SystemConfigurationFilePath
|
public string SystemConfigurationFilePath => Path.Combine(ConfigurationDirectoryPath, "system.xml");
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return Path.Combine(ConfigurationDirectoryPath, "system.xml");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The _cache directory
|
/// The _cache directory
|
||||||
|
@ -200,22 +158,13 @@ namespace Emby.Server.Implementations.AppBase
|
||||||
|
|
||||||
return _cachePath;
|
return _cachePath;
|
||||||
}
|
}
|
||||||
set
|
set => _cachePath = value;
|
||||||
{
|
|
||||||
_cachePath = value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the folder path to the temp directory within the cache folder
|
/// Gets the folder path to the temp directory within the cache folder
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The temp directory.</value>
|
/// <value>The temp directory.</value>
|
||||||
public string TempDirectory
|
public string TempDirectory => Path.Combine(CachePath, "temp");
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return Path.Combine(CachePath, "temp");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
@ -99,6 +99,7 @@ namespace Emby.Server.Implementations.AppBase
|
||||||
/// <param name="applicationPaths">The application paths.</param>
|
/// <param name="applicationPaths">The application paths.</param>
|
||||||
/// <param name="loggerFactory">The logger factory.</param>
|
/// <param name="loggerFactory">The logger factory.</param>
|
||||||
/// <param name="xmlSerializer">The XML serializer.</param>
|
/// <param name="xmlSerializer">The XML serializer.</param>
|
||||||
|
/// <param name="fileSystem">The file system</param>
|
||||||
protected BaseConfigurationManager(IApplicationPaths applicationPaths, ILoggerFactory loggerFactory, IXmlSerializer xmlSerializer, IFileSystem fileSystem)
|
protected BaseConfigurationManager(IApplicationPaths applicationPaths, ILoggerFactory loggerFactory, IXmlSerializer xmlSerializer, IFileSystem fileSystem)
|
||||||
{
|
{
|
||||||
CommonApplicationPaths = applicationPaths;
|
CommonApplicationPaths = applicationPaths;
|
||||||
|
@ -155,7 +156,7 @@ namespace Emby.Server.Implementations.AppBase
|
||||||
{
|
{
|
||||||
if (newConfiguration == null)
|
if (newConfiguration == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("newConfiguration");
|
throw new ArgumentNullException(nameof(newConfiguration));
|
||||||
}
|
}
|
||||||
|
|
||||||
ValidateCachePath(newConfiguration);
|
ValidateCachePath(newConfiguration);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
|
@ -18,6 +18,7 @@ namespace Emby.Server.Implementations.AppBase
|
||||||
/// <param name="type">The type.</param>
|
/// <param name="type">The type.</param>
|
||||||
/// <param name="path">The path.</param>
|
/// <param name="path">The path.</param>
|
||||||
/// <param name="xmlSerializer">The XML serializer.</param>
|
/// <param name="xmlSerializer">The XML serializer.</param>
|
||||||
|
/// <param name="fileSystem">The file system</param>
|
||||||
/// <returns>System.Object.</returns>
|
/// <returns>System.Object.</returns>
|
||||||
public static object GetXmlConfiguration(Type type, string path, IXmlSerializer xmlSerializer, IFileSystem fileSystem)
|
public static object GetXmlConfiguration(Type type, string path, IXmlSerializer xmlSerializer, IFileSystem fileSystem)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using Emby.Common.Implementations.Serialization;
|
using Emby.Common.Implementations.Serialization;
|
||||||
using Emby.Drawing;
|
using Emby.Drawing;
|
||||||
using Emby.Photos;
|
using Emby.Photos;
|
||||||
using Emby.Dlna;
|
using Emby.Dlna;
|
||||||
|
@ -132,13 +132,7 @@ namespace Emby.Server.Implementations
|
||||||
/// Gets or sets a value indicating whether this instance can self update.
|
/// Gets or sets a value indicating whether this instance can self update.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value><c>true</c> if this instance can self update; otherwise, <c>false</c>.</value>
|
/// <value><c>true</c> if this instance can self update; otherwise, <c>false</c>.</value>
|
||||||
public virtual bool CanSelfUpdate
|
public virtual bool CanSelfUpdate => false;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual bool CanLaunchWebBrowser
|
public virtual bool CanLaunchWebBrowser
|
||||||
{
|
{
|
||||||
|
@ -245,10 +239,7 @@ namespace Emby.Server.Implementations
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual string OperatingSystemDisplayName
|
public virtual string OperatingSystemDisplayName => EnvironmentInfo.OperatingSystemName;
|
||||||
{
|
|
||||||
get { return EnvironmentInfo.OperatingSystemName; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The container
|
/// The container
|
||||||
|
@ -261,10 +252,7 @@ namespace Emby.Server.Implementations
|
||||||
/// Gets the server configuration manager.
|
/// Gets the server configuration manager.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The server configuration manager.</value>
|
/// <value>The server configuration manager.</value>
|
||||||
public IServerConfigurationManager ServerConfigurationManager
|
public IServerConfigurationManager ServerConfigurationManager => (IServerConfigurationManager)ConfigurationManager;
|
||||||
{
|
|
||||||
get { return (IServerConfigurationManager)ConfigurationManager; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the configuration manager.
|
/// Gets the configuration manager.
|
||||||
|
@ -453,13 +441,7 @@ namespace Emby.Server.Implementations
|
||||||
/// Gets the current application version
|
/// Gets the current application version
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The application version.</value>
|
/// <value>The application version.</value>
|
||||||
public Version ApplicationVersion
|
public Version ApplicationVersion => _version ?? (_version = typeof(ApplicationHost).Assembly.GetName().Version);
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _version ?? (_version = typeof(ApplicationHost).Assembly.GetName().Version);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private DeviceId _deviceId;
|
private DeviceId _deviceId;
|
||||||
public string SystemId
|
public string SystemId
|
||||||
|
@ -479,15 +461,9 @@ namespace Emby.Server.Implementations
|
||||||
/// Gets the name.
|
/// Gets the name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
public string Name
|
public string Name => "Emby Server";
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return "Emby Server";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private Tuple<Assembly, string> GetAssembly(Type type)
|
private static Tuple<Assembly, string> GetAssembly(Type type)
|
||||||
{
|
{
|
||||||
var assembly = type.GetTypeInfo().Assembly;
|
var assembly = type.GetTypeInfo().Assembly;
|
||||||
string path = null;
|
string path = null;
|
||||||
|
@ -513,7 +489,7 @@ namespace Emby.Server.Implementations
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates the instance safe.
|
/// Creates the instance safe.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="type">The type.</param>
|
/// <param name="typeInfo">The type information.</param>
|
||||||
/// <returns>System.Object.</returns>
|
/// <returns>System.Object.</returns>
|
||||||
protected object CreateInstanceSafe(Tuple<Type, string> typeInfo)
|
protected object CreateInstanceSafe(Tuple<Type, string> typeInfo)
|
||||||
{
|
{
|
||||||
|
@ -1004,13 +980,7 @@ namespace Emby.Server.Implementations
|
||||||
return s => JsvReader.GetParseFn(propertyType)(s);
|
return s => JsvReader.GetParseFn(propertyType)(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual string PackageRuntime
|
public virtual string PackageRuntime => "netcore";
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return "netcore";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void LogEnvironmentInfo(ILogger logger, IApplicationPaths appPaths, EnvironmentInfo.EnvironmentInfo environmentInfo)
|
public static void LogEnvironmentInfo(ILogger logger, IApplicationPaths appPaths, EnvironmentInfo.EnvironmentInfo environmentInfo)
|
||||||
{
|
{
|
||||||
|
@ -1049,7 +1019,7 @@ namespace Emby.Server.Implementations
|
||||||
return name + "/" + ApplicationVersion;
|
return name + "/" + ApplicationVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
private string FormatAttribute(string str)
|
private static string FormatAttribute(string str)
|
||||||
{
|
{
|
||||||
var arr = str.ToCharArray();
|
var arr = str.ToCharArray();
|
||||||
|
|
||||||
|
@ -1066,13 +1036,7 @@ namespace Emby.Server.Implementations
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual bool SupportsDualModeSockets
|
protected virtual bool SupportsDualModeSockets => true;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private X509Certificate GetCertificate(CertificateInfo info)
|
private X509Certificate GetCertificate(CertificateInfo info)
|
||||||
{
|
{
|
||||||
|
@ -1927,18 +1891,9 @@ namespace Emby.Server.Implementations
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool EnableHttps
|
public bool EnableHttps => SupportsHttps && ServerConfigurationManager.Configuration.EnableHttps;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return SupportsHttps && ServerConfigurationManager.Configuration.EnableHttps;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool SupportsHttps
|
public bool SupportsHttps => Certificate != null || ServerConfigurationManager.Configuration.IsBehindProxy;
|
||||||
{
|
|
||||||
get { return Certificate != null || ServerConfigurationManager.Configuration.IsBehindProxy; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<string> GetLocalApiUrl(CancellationToken cancellationToken)
|
public async Task<string> GetLocalApiUrl(CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
|
@ -2132,15 +2087,10 @@ namespace Emby.Server.Implementations
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string FriendlyName
|
public string FriendlyName =>
|
||||||
{
|
string.IsNullOrEmpty(ServerConfigurationManager.Configuration.ServerName)
|
||||||
get
|
|
||||||
{
|
|
||||||
return string.IsNullOrEmpty(ServerConfigurationManager.Configuration.ServerName)
|
|
||||||
? Environment.MachineName
|
? Environment.MachineName
|
||||||
: ServerConfigurationManager.Configuration.ServerName;
|
: ServerConfigurationManager.Configuration.ServerName;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public int HttpPort { get; private set; }
|
public int HttpPort { get; private set; }
|
||||||
|
|
||||||
|
@ -2177,7 +2127,7 @@ namespace Emby.Server.Implementations
|
||||||
private bool _hasUpdateAvailable;
|
private bool _hasUpdateAvailable;
|
||||||
public bool HasUpdateAvailable
|
public bool HasUpdateAvailable
|
||||||
{
|
{
|
||||||
get { return _hasUpdateAvailable; }
|
get => _hasUpdateAvailable;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
var fireEvent = value && !_hasUpdateAvailable;
|
var fireEvent = value && !_hasUpdateAvailable;
|
||||||
|
|
|
@ -30,10 +30,7 @@ namespace Emby.Server.Implementations.Channels
|
||||||
return channel.GetChannelImage(type, cancellationToken);
|
return channel.GetChannelImage(type, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Name
|
public string Name => "Channel Image Provider";
|
||||||
{
|
|
||||||
get { return "Channel Image Provider"; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Supports(BaseItem item)
|
public bool Supports(BaseItem item)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using MediaBrowser.Common.Extensions;
|
using MediaBrowser.Common.Extensions;
|
||||||
using MediaBrowser.Common.Net;
|
using MediaBrowser.Common.Net;
|
||||||
using MediaBrowser.Controller.Channels;
|
using MediaBrowser.Controller.Channels;
|
||||||
using MediaBrowser.Controller.Configuration;
|
using MediaBrowser.Controller.Configuration;
|
||||||
|
@ -67,13 +67,7 @@ namespace Emby.Server.Implementations.Channels
|
||||||
_providerManager = providerManager;
|
_providerManager = providerManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
private TimeSpan CacheLength
|
private static TimeSpan CacheLength => TimeSpan.FromHours(3);
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return TimeSpan.FromHours(3);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AddParts(IEnumerable<IChannel> channels)
|
public void AddParts(IEnumerable<IChannel> channels)
|
||||||
{
|
{
|
||||||
|
@ -269,6 +263,7 @@ namespace Emby.Server.Implementations.Channels
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//TODO Fix The co-variant conversion (internalResult.Items) between Folder[] and BaseItem[], this can generate runtime issues.
|
||||||
var returnItems = _dtoService.GetBaseItemDtos(internalResult.Items, dtoOptions, user);
|
var returnItems = _dtoService.GetBaseItemDtos(internalResult.Items, dtoOptions, user);
|
||||||
|
|
||||||
var result = new QueryResult<BaseItemDto>
|
var result = new QueryResult<BaseItemDto>
|
||||||
|
@ -419,7 +414,7 @@ namespace Emby.Server.Implementations.Channels
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
private MediaSourceInfo NormalizeMediaSource(BaseItem item, MediaSourceInfo info)
|
private static MediaSourceInfo NormalizeMediaSource(BaseItem item, MediaSourceInfo info)
|
||||||
{
|
{
|
||||||
info.RunTimeTicks = info.RunTimeTicks ?? item.RunTimeTicks;
|
info.RunTimeTicks = info.RunTimeTicks ?? item.RunTimeTicks;
|
||||||
|
|
||||||
|
@ -492,7 +487,7 @@ namespace Emby.Server.Implementations.Channels
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetOfficialRating(ChannelParentalRating rating)
|
private static string GetOfficialRating(ChannelParentalRating rating)
|
||||||
{
|
{
|
||||||
switch (rating)
|
switch (rating)
|
||||||
{
|
{
|
||||||
|
@ -533,7 +528,7 @@ namespace Emby.Server.Implementations.Channels
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(id))
|
if (string.IsNullOrEmpty(id))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("id");
|
throw new ArgumentNullException(nameof(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
var channel = GetChannel(id);
|
var channel = GetChannel(id);
|
||||||
|
@ -577,7 +572,7 @@ namespace Emby.Server.Implementations.Channels
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(name))
|
if (string.IsNullOrEmpty(name))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("name");
|
throw new ArgumentNullException(nameof(name));
|
||||||
}
|
}
|
||||||
return _libraryManager.GetNewItemId("Channel " + name, typeof(Channel));
|
return _libraryManager.GetNewItemId("Channel " + name, typeof(Channel));
|
||||||
}
|
}
|
||||||
|
@ -891,7 +886,7 @@ namespace Emby.Server.Implementations.Channels
|
||||||
filename + ".json");
|
filename + ".json");
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetIdToHash(string externalId, string channelName)
|
private static string GetIdToHash(string externalId, string channelName)
|
||||||
{
|
{
|
||||||
// Increment this as needed to force new downloads
|
// Increment this as needed to force new downloads
|
||||||
// Incorporate Name because it's being used to convert channel entity to provider
|
// Incorporate Name because it's being used to convert channel entity to provider
|
||||||
|
@ -1187,7 +1182,7 @@ namespace Emby.Server.Implementations.Channels
|
||||||
{
|
{
|
||||||
if (channel == null)
|
if (channel == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("channel");
|
throw new ArgumentNullException(nameof(channel));
|
||||||
}
|
}
|
||||||
|
|
||||||
var result = GetAllChannels()
|
var result = GetAllChannels()
|
||||||
|
|
|
@ -25,35 +25,17 @@ namespace Emby.Server.Implementations.Channels
|
||||||
_libraryManager = libraryManager;
|
_libraryManager = libraryManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Name
|
public string Name => "Refresh Channels";
|
||||||
{
|
|
||||||
get { return "Refresh Channels"; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public string Description
|
public string Description => "Refreshes internet channel information.";
|
||||||
{
|
|
||||||
get { return "Refreshes internet channel information."; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public string Category
|
public string Category => "Internet Channels";
|
||||||
{
|
|
||||||
get { return "Internet Channels"; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsHidden
|
public bool IsHidden => ((ChannelManager)_channelManager).Channels.Length == 0;
|
||||||
{
|
|
||||||
get { return ((ChannelManager)_channelManager).Channels.Length == 0; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsEnabled
|
public bool IsEnabled => true;
|
||||||
{
|
|
||||||
get { return true; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsLogged
|
public bool IsLogged => true;
|
||||||
{
|
|
||||||
get { return true; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task Execute(CancellationToken cancellationToken, IProgress<double> progress)
|
public async Task Execute(CancellationToken cancellationToken, IProgress<double> progress)
|
||||||
{
|
{
|
||||||
|
@ -77,9 +59,6 @@ namespace Emby.Server.Implementations.Channels
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Key
|
public string Key => "RefreshInternetChannels";
|
||||||
{
|
|
||||||
get { return "RefreshInternetChannels"; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,28 +38,19 @@ namespace Emby.Server.Implementations.Configuration
|
||||||
/// Gets the type of the configuration.
|
/// Gets the type of the configuration.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The type of the configuration.</value>
|
/// <value>The type of the configuration.</value>
|
||||||
protected override Type ConfigurationType
|
protected override Type ConfigurationType => typeof(ServerConfiguration);
|
||||||
{
|
|
||||||
get { return typeof(ServerConfiguration); }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the application paths.
|
/// Gets the application paths.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The application paths.</value>
|
/// <value>The application paths.</value>
|
||||||
public IServerApplicationPaths ApplicationPaths
|
public IServerApplicationPaths ApplicationPaths => (IServerApplicationPaths)CommonApplicationPaths;
|
||||||
{
|
|
||||||
get { return (IServerApplicationPaths)CommonApplicationPaths; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the configuration.
|
/// Gets the configuration.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The configuration.</value>
|
/// <value>The configuration.</value>
|
||||||
public ServerConfiguration Configuration
|
public ServerConfiguration Configuration => (ServerConfiguration)CommonConfiguration;
|
||||||
{
|
|
||||||
get { return (ServerConfiguration)CommonConfiguration; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called when [configuration updated].
|
/// Called when [configuration updated].
|
||||||
|
|
|
@ -24,15 +24,9 @@ namespace Emby.Server.Implementations.Data
|
||||||
WriteLock = new ReaderWriterLockSlim(LockRecursionPolicy.NoRecursion);
|
WriteLock = new ReaderWriterLockSlim(LockRecursionPolicy.NoRecursion);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected TransactionMode TransactionMode
|
protected TransactionMode TransactionMode => TransactionMode.Deferred;
|
||||||
{
|
|
||||||
get { return TransactionMode.Deferred; }
|
|
||||||
}
|
|
||||||
|
|
||||||
protected TransactionMode ReadTransactionMode
|
protected TransactionMode ReadTransactionMode => TransactionMode.Deferred;
|
||||||
{
|
|
||||||
get { return TransactionMode.Deferred; }
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static int ThreadSafeMode { get; set; }
|
internal static int ThreadSafeMode { get; set; }
|
||||||
|
|
||||||
|
@ -58,10 +52,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
private string _defaultWal;
|
private string _defaultWal;
|
||||||
protected ManagedConnection _connection;
|
protected ManagedConnection _connection;
|
||||||
|
|
||||||
protected virtual bool EnableSingleConnection
|
protected virtual bool EnableSingleConnection => true;
|
||||||
{
|
|
||||||
get { return true; }
|
|
||||||
}
|
|
||||||
|
|
||||||
protected ManagedConnection CreateConnection(bool isReadOnly = false)
|
protected ManagedConnection CreateConnection(bool isReadOnly = false)
|
||||||
{
|
{
|
||||||
|
@ -238,21 +229,9 @@ namespace Emby.Server.Implementations.Data
|
||||||
Logger.LogInformation("PRAGMA synchronous=" + db.Query("PRAGMA synchronous").SelectScalarString().First());
|
Logger.LogInformation("PRAGMA synchronous=" + db.Query("PRAGMA synchronous").SelectScalarString().First());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual bool EnableTempStoreMemory
|
protected virtual bool EnableTempStoreMemory => false;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual int? CacheSize
|
protected virtual int? CacheSize => null;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static void CheckOk(int rc)
|
internal static void CheckOk(int rc)
|
||||||
{
|
{
|
||||||
|
@ -276,7 +255,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
{
|
{
|
||||||
if (_disposed)
|
if (_disposed)
|
||||||
{
|
{
|
||||||
throw new ObjectDisposedException(GetType().Name + " has been disposed and cannot be accessed.");
|
throw new ObjectDisposedException(GetType().Name ,"Object has been disposed and cannot be accessed.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,13 +32,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
/// Gets the name of the repository
|
/// Gets the name of the repository
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
public string Name
|
public string Name => "SQLite";
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return "SQLite";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The _json serializer
|
/// The _json serializer
|
||||||
|
@ -94,11 +88,11 @@ namespace Emby.Server.Implementations.Data
|
||||||
{
|
{
|
||||||
if (displayPreferences == null)
|
if (displayPreferences == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("displayPreferences");
|
throw new ArgumentNullException(nameof(displayPreferences));
|
||||||
}
|
}
|
||||||
if (string.IsNullOrEmpty(displayPreferences.Id))
|
if (string.IsNullOrEmpty(displayPreferences.Id))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("displayPreferences.Id");
|
throw new ArgumentNullException(nameof(displayPreferences.Id));
|
||||||
}
|
}
|
||||||
|
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
@ -142,7 +136,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
{
|
{
|
||||||
if (displayPreferences == null)
|
if (displayPreferences == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("displayPreferences");
|
throw new ArgumentNullException(nameof(displayPreferences));
|
||||||
}
|
}
|
||||||
|
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
@ -174,7 +168,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(displayPreferencesId))
|
if (string.IsNullOrEmpty(displayPreferencesId))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("displayPreferencesId");
|
throw new ArgumentNullException(nameof(displayPreferencesId));
|
||||||
}
|
}
|
||||||
|
|
||||||
var guidId = displayPreferencesId.GetMD5();
|
var guidId = displayPreferencesId.GetMD5();
|
||||||
|
|
|
@ -14,7 +14,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
{
|
{
|
||||||
if (queries == null)
|
if (queries == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("queries");
|
throw new ArgumentNullException(nameof(queries));
|
||||||
}
|
}
|
||||||
|
|
||||||
connection.RunInTransaction(conn =>
|
connection.RunInTransaction(conn =>
|
||||||
|
@ -134,7 +134,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
{
|
{
|
||||||
if (obj == null)
|
if (obj == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("obj");
|
throw new ArgumentNullException(nameof(obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
using (var stream = new MemoryStream())
|
using (var stream = new MemoryStream())
|
||||||
|
|
|
@ -82,11 +82,11 @@ namespace Emby.Server.Implementations.Data
|
||||||
{
|
{
|
||||||
if (config == null)
|
if (config == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("config");
|
throw new ArgumentNullException(nameof(config));
|
||||||
}
|
}
|
||||||
if (jsonSerializer == null)
|
if (jsonSerializer == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("jsonSerializer");
|
throw new ArgumentNullException(nameof(jsonSerializer));
|
||||||
}
|
}
|
||||||
|
|
||||||
_appHost = appHost;
|
_appHost = appHost;
|
||||||
|
@ -455,7 +455,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
"ColorTransfer"
|
"ColorTransfer"
|
||||||
};
|
};
|
||||||
|
|
||||||
private string GetSaveItemCommandText()
|
private static string GetSaveItemCommandText()
|
||||||
{
|
{
|
||||||
var saveColumns = new List<string>
|
var saveColumns = new List<string>
|
||||||
{
|
{
|
||||||
|
@ -558,7 +558,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
{
|
{
|
||||||
if (item == null)
|
if (item == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("item");
|
throw new ArgumentNullException(nameof(item));
|
||||||
}
|
}
|
||||||
|
|
||||||
SaveItems(new List<BaseItem> { item }, cancellationToken);
|
SaveItems(new List<BaseItem> { item }, cancellationToken);
|
||||||
|
@ -568,7 +568,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
{
|
{
|
||||||
if (item == null)
|
if (item == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("item");
|
throw new ArgumentNullException(nameof(item));
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckDisposed();
|
CheckDisposed();
|
||||||
|
@ -605,7 +605,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
{
|
{
|
||||||
if (items == null)
|
if (items == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("items");
|
throw new ArgumentNullException(nameof(items));
|
||||||
}
|
}
|
||||||
|
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
@ -1070,7 +1070,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
saveItemStatement.MoveNext();
|
saveItemStatement.MoveNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
private string SerializeProviderIds(BaseItem item)
|
private static string SerializeProviderIds(BaseItem item)
|
||||||
{
|
{
|
||||||
// Ideally we shouldn't need this IsNullOrWhiteSpace check but we're seeing some cases of bad data slip through
|
// Ideally we shouldn't need this IsNullOrWhiteSpace check but we're seeing some cases of bad data slip through
|
||||||
var ids = item.ProviderIds
|
var ids = item.ProviderIds
|
||||||
|
@ -1085,7 +1085,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
return string.Join("|", ids.Select(i => i.Key + "=" + i.Value).ToArray());
|
return string.Join("|", ids.Select(i => i.Key + "=" + i.Value).ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DeserializeProviderIds(string value, BaseItem item)
|
private static void DeserializeProviderIds(string value, BaseItem item)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(value))
|
if (string.IsNullOrWhiteSpace(value))
|
||||||
{
|
{
|
||||||
|
@ -1226,7 +1226,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
{
|
{
|
||||||
if (id.Equals(Guid.Empty))
|
if (id.Equals(Guid.Empty))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("id");
|
throw new ArgumentNullException(nameof(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckDisposed();
|
CheckDisposed();
|
||||||
|
@ -1948,7 +1948,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Guid[] SplitToGuids(string value)
|
private static Guid[] SplitToGuids(string value)
|
||||||
{
|
{
|
||||||
var ids = value.Split('|');
|
var ids = value.Split('|');
|
||||||
|
|
||||||
|
@ -1965,7 +1965,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets chapters for an item
|
/// Gets chapters for an item
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id">The id.</param>
|
/// <param name="item">The item.</param>
|
||||||
/// <returns>IEnumerable{ChapterInfo}.</returns>
|
/// <returns>IEnumerable{ChapterInfo}.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">id</exception>
|
/// <exception cref="System.ArgumentNullException">id</exception>
|
||||||
public List<ChapterInfo> GetChapters(BaseItem item)
|
public List<ChapterInfo> GetChapters(BaseItem item)
|
||||||
|
@ -1996,7 +1996,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a single chapter for an item
|
/// Gets a single chapter for an item
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id">The id.</param>
|
/// <param name="item">The item.</param>
|
||||||
/// <param name="index">The index.</param>
|
/// <param name="index">The index.</param>
|
||||||
/// <returns>ChapterInfo.</returns>
|
/// <returns>ChapterInfo.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">id</exception>
|
/// <exception cref="System.ArgumentNullException">id</exception>
|
||||||
|
@ -2067,12 +2067,12 @@ namespace Emby.Server.Implementations.Data
|
||||||
|
|
||||||
if (id.Equals(Guid.Empty))
|
if (id.Equals(Guid.Empty))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("id");
|
throw new ArgumentNullException(nameof(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chapters == null)
|
if (chapters == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("chapters");
|
throw new ArgumentNullException(nameof(chapters));
|
||||||
}
|
}
|
||||||
|
|
||||||
using (WriteLock.Write())
|
using (WriteLock.Write())
|
||||||
|
@ -2144,7 +2144,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool EnableJoinUserData(InternalItemsQuery query)
|
private static bool EnableJoinUserData(InternalItemsQuery query)
|
||||||
{
|
{
|
||||||
if (query.User == null)
|
if (query.User == null)
|
||||||
{
|
{
|
||||||
|
@ -2681,7 +2681,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
{
|
{
|
||||||
if (query == null)
|
if (query == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("query");
|
throw new ArgumentNullException(nameof(query));
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckDisposed();
|
CheckDisposed();
|
||||||
|
@ -2739,7 +2739,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
{
|
{
|
||||||
if (query == null)
|
if (query == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("query");
|
throw new ArgumentNullException(nameof(query));
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckDisposed();
|
CheckDisposed();
|
||||||
|
@ -2928,7 +2928,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
{
|
{
|
||||||
if (query == null)
|
if (query == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("query");
|
throw new ArgumentNullException(nameof(query));
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckDisposed();
|
CheckDisposed();
|
||||||
|
@ -3212,7 +3212,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
{
|
{
|
||||||
if (query == null)
|
if (query == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("query");
|
throw new ArgumentNullException(nameof(query));
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckDisposed();
|
CheckDisposed();
|
||||||
|
@ -3286,7 +3286,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
{
|
{
|
||||||
if (query == null)
|
if (query == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("query");
|
throw new ArgumentNullException(nameof(query));
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckDisposed();
|
CheckDisposed();
|
||||||
|
@ -3362,7 +3362,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
{
|
{
|
||||||
if (query == null)
|
if (query == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("query");
|
throw new ArgumentNullException(nameof(query));
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckDisposed();
|
CheckDisposed();
|
||||||
|
@ -5184,7 +5184,7 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
|
||||||
{
|
{
|
||||||
if (id.Equals(Guid.Empty))
|
if (id.Equals(Guid.Empty))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("id");
|
throw new ArgumentNullException(nameof(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckDisposed();
|
CheckDisposed();
|
||||||
|
@ -5233,7 +5233,7 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
|
||||||
{
|
{
|
||||||
if (query == null)
|
if (query == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("query");
|
throw new ArgumentNullException(nameof(query));
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckDisposed();
|
CheckDisposed();
|
||||||
|
@ -5273,7 +5273,7 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
|
||||||
{
|
{
|
||||||
if (query == null)
|
if (query == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("query");
|
throw new ArgumentNullException(nameof(query));
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckDisposed();
|
CheckDisposed();
|
||||||
|
@ -5387,12 +5387,12 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
|
||||||
{
|
{
|
||||||
if (itemId.Equals(Guid.Empty))
|
if (itemId.Equals(Guid.Empty))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("itemId");
|
throw new ArgumentNullException(nameof(itemId));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ancestorIds == null)
|
if (ancestorIds == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("ancestorIds");
|
throw new ArgumentNullException(nameof(ancestorIds));
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckDisposed();
|
CheckDisposed();
|
||||||
|
@ -5556,7 +5556,7 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
|
||||||
{
|
{
|
||||||
if (query == null)
|
if (query == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("query");
|
throw new ArgumentNullException(nameof(query));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!query.Limit.HasValue)
|
if (!query.Limit.HasValue)
|
||||||
|
@ -5915,12 +5915,12 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
|
||||||
{
|
{
|
||||||
if (itemId.Equals(Guid.Empty))
|
if (itemId.Equals(Guid.Empty))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("itemId");
|
throw new ArgumentNullException(nameof(itemId));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (values == null)
|
if (values == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("keys");
|
throw new ArgumentNullException(nameof(values));
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckDisposed();
|
CheckDisposed();
|
||||||
|
@ -5991,12 +5991,12 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
|
||||||
{
|
{
|
||||||
if (itemId.Equals(Guid.Empty))
|
if (itemId.Equals(Guid.Empty))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("itemId");
|
throw new ArgumentNullException(nameof(itemId));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (people == null)
|
if (people == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("people");
|
throw new ArgumentNullException(nameof(people));
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckDisposed();
|
CheckDisposed();
|
||||||
|
@ -6102,7 +6102,7 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
|
||||||
|
|
||||||
if (query == null)
|
if (query == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("query");
|
throw new ArgumentNullException(nameof(query));
|
||||||
}
|
}
|
||||||
|
|
||||||
var cmdText = "select " + string.Join(",", _mediaStreamSaveColumns) + " from mediastreams where";
|
var cmdText = "select " + string.Join(",", _mediaStreamSaveColumns) + " from mediastreams where";
|
||||||
|
@ -6158,12 +6158,12 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
|
||||||
|
|
||||||
if (id.Equals(Guid.Empty))
|
if (id.Equals(Guid.Empty))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("id");
|
throw new ArgumentNullException(nameof(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (streams == null)
|
if (streams == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("streams");
|
throw new ArgumentNullException(nameof(streams));
|
||||||
}
|
}
|
||||||
|
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
@ -28,13 +28,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
/// Gets the name of the repository
|
/// Gets the name of the repository
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
public string Name
|
public string Name => "SQLite";
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return "SQLite";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Opens the connection to the database
|
/// Opens the connection to the database
|
||||||
|
@ -136,13 +130,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool EnableTempStoreMemory
|
protected override bool EnableTempStoreMemory => true;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Saves the user data.
|
/// Saves the user data.
|
||||||
|
@ -151,15 +139,15 @@ namespace Emby.Server.Implementations.Data
|
||||||
{
|
{
|
||||||
if (userData == null)
|
if (userData == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("userData");
|
throw new ArgumentNullException(nameof(userData));
|
||||||
}
|
}
|
||||||
if (internalUserId <= 0)
|
if (internalUserId <= 0)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("internalUserId");
|
throw new ArgumentNullException(nameof(internalUserId));
|
||||||
}
|
}
|
||||||
if (string.IsNullOrEmpty(key))
|
if (string.IsNullOrEmpty(key))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("key");
|
throw new ArgumentNullException(nameof(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
PersistUserData(internalUserId, key, userData, cancellationToken);
|
PersistUserData(internalUserId, key, userData, cancellationToken);
|
||||||
|
@ -169,11 +157,11 @@ namespace Emby.Server.Implementations.Data
|
||||||
{
|
{
|
||||||
if (userData == null)
|
if (userData == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("userData");
|
throw new ArgumentNullException(nameof(userData));
|
||||||
}
|
}
|
||||||
if (internalUserId <= 0)
|
if (internalUserId <= 0)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("internalUserId");
|
throw new ArgumentNullException(nameof(internalUserId));
|
||||||
}
|
}
|
||||||
|
|
||||||
PersistAllUserData(internalUserId, userData, cancellationToken);
|
PersistAllUserData(internalUserId, userData, cancellationToken);
|
||||||
|
@ -182,7 +170,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Persists the user data.
|
/// Persists the user data.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="userId">The user id.</param>
|
/// <param name="internalUserId">The user id.</param>
|
||||||
/// <param name="key">The key.</param>
|
/// <param name="key">The key.</param>
|
||||||
/// <param name="userData">The user data.</param>
|
/// <param name="userData">The user data.</param>
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
|
@ -203,7 +191,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SaveUserData(IDatabaseConnection db, long internalUserId, string key, UserItemData userData)
|
private static void SaveUserData(IDatabaseConnection db, long internalUserId, string key, UserItemData userData)
|
||||||
{
|
{
|
||||||
using (var statement = db.PrepareStatement("replace into UserDatas (key, userId, rating,played,playCount,isFavorite,playbackPositionTicks,lastPlayedDate,AudioStreamIndex,SubtitleStreamIndex) values (@key, @userId, @rating,@played,@playCount,@isFavorite,@playbackPositionTicks,@lastPlayedDate,@AudioStreamIndex,@SubtitleStreamIndex)"))
|
using (var statement = db.PrepareStatement("replace into UserDatas (key, userId, rating,played,playCount,isFavorite,playbackPositionTicks,lastPlayedDate,AudioStreamIndex,SubtitleStreamIndex) values (@key, @userId, @rating,@played,@playCount,@isFavorite,@playbackPositionTicks,@lastPlayedDate,@AudioStreamIndex,@SubtitleStreamIndex)"))
|
||||||
{
|
{
|
||||||
|
@ -280,7 +268,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the user data.
|
/// Gets the user data.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="userId">The user id.</param>
|
/// <param name="internalUserId">The user id.</param>
|
||||||
/// <param name="key">The key.</param>
|
/// <param name="key">The key.</param>
|
||||||
/// <returns>Task{UserItemData}.</returns>
|
/// <returns>Task{UserItemData}.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">
|
/// <exception cref="System.ArgumentNullException">
|
||||||
|
@ -292,11 +280,11 @@ namespace Emby.Server.Implementations.Data
|
||||||
{
|
{
|
||||||
if (internalUserId <= 0)
|
if (internalUserId <= 0)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("internalUserId");
|
throw new ArgumentNullException(nameof(internalUserId));
|
||||||
}
|
}
|
||||||
if (string.IsNullOrEmpty(key))
|
if (string.IsNullOrEmpty(key))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("key");
|
throw new ArgumentNullException(nameof(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
using (WriteLock.Read())
|
using (WriteLock.Read())
|
||||||
|
@ -323,7 +311,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
{
|
{
|
||||||
if (keys == null)
|
if (keys == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("keys");
|
throw new ArgumentNullException(nameof(keys));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (keys.Count == 0)
|
if (keys.Count == 0)
|
||||||
|
@ -337,13 +325,13 @@ namespace Emby.Server.Implementations.Data
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return all user-data associated with the given user
|
/// Return all user-data associated with the given user
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="userId"></param>
|
/// <param name="internalUserId"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public List<UserItemData> GetAllUserData(long internalUserId)
|
public List<UserItemData> GetAllUserData(long internalUserId)
|
||||||
{
|
{
|
||||||
if (internalUserId <= 0)
|
if (internalUserId <= 0)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("internalUserId");
|
throw new ArgumentNullException(nameof(internalUserId));
|
||||||
}
|
}
|
||||||
|
|
||||||
var list = new List<UserItemData>();
|
var list = new List<UserItemData>();
|
||||||
|
|
|
@ -31,13 +31,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
/// Gets the name of the repository
|
/// Gets the name of the repository
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
public string Name
|
public string Name => "SQLite";
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return "SQLite";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Opens the connection to the database
|
/// Opens the connection to the database
|
||||||
|
@ -85,7 +79,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
{
|
{
|
||||||
if (user == null)
|
if (user == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("user");
|
throw new ArgumentNullException(nameof(user));
|
||||||
}
|
}
|
||||||
|
|
||||||
var serialized = _jsonSerializer.SerializeToBytes(user);
|
var serialized = _jsonSerializer.SerializeToBytes(user);
|
||||||
|
@ -122,7 +116,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
{
|
{
|
||||||
if (user == null)
|
if (user == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("user");
|
throw new ArgumentNullException(nameof(user));
|
||||||
}
|
}
|
||||||
|
|
||||||
var serialized = _jsonSerializer.SerializeToBytes(user);
|
var serialized = _jsonSerializer.SerializeToBytes(user);
|
||||||
|
@ -207,14 +201,13 @@ namespace Emby.Server.Implementations.Data
|
||||||
/// Deletes the user.
|
/// Deletes the user.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="user">The user.</param>
|
/// <param name="user">The user.</param>
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
|
||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">user</exception>
|
/// <exception cref="System.ArgumentNullException">user</exception>
|
||||||
public void DeleteUser(User user)
|
public void DeleteUser(User user)
|
||||||
{
|
{
|
||||||
if (user == null)
|
if (user == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("user");
|
throw new ArgumentNullException(nameof(user));
|
||||||
}
|
}
|
||||||
|
|
||||||
using (WriteLock.Write())
|
using (WriteLock.Write())
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(typeName))
|
if (string.IsNullOrEmpty(typeName))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("typeName");
|
throw new ArgumentNullException(nameof(typeName));
|
||||||
}
|
}
|
||||||
|
|
||||||
return _typeMap.GetOrAdd(typeName, LookupType);
|
return _typeMap.GetOrAdd(typeName, LookupType);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using MediaBrowser.Common.Configuration;
|
using MediaBrowser.Common.Configuration;
|
||||||
|
@ -15,10 +15,7 @@ namespace Emby.Server.Implementations.Devices
|
||||||
|
|
||||||
private readonly object _syncLock = new object();
|
private readonly object _syncLock = new object();
|
||||||
|
|
||||||
private string CachePath
|
private string CachePath => Path.Combine(_appPaths.DataPath, "device.txt");
|
||||||
{
|
|
||||||
get { return Path.Combine(_appPaths.DataPath, "device.txt"); }
|
|
||||||
}
|
|
||||||
|
|
||||||
private string GetCachedId()
|
private string GetCachedId()
|
||||||
{
|
{
|
||||||
|
@ -70,7 +67,7 @@ namespace Emby.Server.Implementations.Devices
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetNewId()
|
private static string GetNewId()
|
||||||
{
|
{
|
||||||
return Guid.NewGuid().ToString("N");
|
return Guid.NewGuid().ToString("N");
|
||||||
}
|
}
|
||||||
|
@ -92,8 +89,9 @@ namespace Emby.Server.Implementations.Devices
|
||||||
|
|
||||||
public DeviceId(IApplicationPaths appPaths, ILogger logger, IFileSystem fileSystem)
|
public DeviceId(IApplicationPaths appPaths, ILogger logger, IFileSystem fileSystem)
|
||||||
{
|
{
|
||||||
if (fileSystem == null) {
|
if (fileSystem == null)
|
||||||
throw new ArgumentNullException ("fileSystem");
|
{
|
||||||
|
throw new ArgumentNullException(nameof(fileSystem));
|
||||||
}
|
}
|
||||||
|
|
||||||
_appPaths = appPaths;
|
_appPaths = appPaths;
|
||||||
|
@ -101,9 +99,6 @@ namespace Emby.Server.Implementations.Devices
|
||||||
_fileSystem = fileSystem;
|
_fileSystem = fileSystem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Value
|
public string Value => _id ?? (_id = GetDeviceId());
|
||||||
{
|
|
||||||
get { return _id ?? (_id = GetDeviceId()); }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using MediaBrowser.Common.Configuration;
|
using MediaBrowser.Common.Configuration;
|
||||||
using MediaBrowser.Common.Net;
|
using MediaBrowser.Common.Net;
|
||||||
using MediaBrowser.Controller.Devices;
|
using MediaBrowser.Controller.Devices;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
|
@ -360,10 +360,7 @@ namespace Emby.Server.Implementations.Devices
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
private string DefaultCameraUploadsPath
|
private string DefaultCameraUploadsPath => Path.Combine(_config.CommonApplicationPaths.DataPath, "camerauploads");
|
||||||
{
|
|
||||||
get { return Path.Combine(_config.CommonApplicationPaths.DataPath, "camerauploads"); }
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool CanAccessDevice(User user, string deviceId)
|
public bool CanAccessDevice(User user, string deviceId)
|
||||||
{
|
{
|
||||||
|
@ -373,7 +370,7 @@ namespace Emby.Server.Implementations.Devices
|
||||||
}
|
}
|
||||||
if (string.IsNullOrEmpty(deviceId))
|
if (string.IsNullOrEmpty(deviceId))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("deviceId");
|
throw new ArgumentNullException(nameof(deviceId));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!CanAccessDevice(user.Policy, deviceId))
|
if (!CanAccessDevice(user.Policy, deviceId))
|
||||||
|
@ -389,7 +386,7 @@ namespace Emby.Server.Implementations.Devices
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool CanAccessDevice(UserPolicy policy, string id)
|
private static bool CanAccessDevice(UserPolicy policy, string id)
|
||||||
{
|
{
|
||||||
if (policy.EnableAllDevices)
|
if (policy.EnableAllDevices)
|
||||||
{
|
{
|
||||||
|
|
|
@ -81,30 +81,15 @@ namespace Emby.Server.Implementations.Diagnostics
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProcessOptions StartInfo
|
public ProcessOptions StartInfo => _options;
|
||||||
{
|
|
||||||
get { return _options; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public StreamWriter StandardInput
|
public StreamWriter StandardInput => _process.StandardInput;
|
||||||
{
|
|
||||||
get { return _process.StandardInput; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public StreamReader StandardError
|
public StreamReader StandardError => _process.StandardError;
|
||||||
{
|
|
||||||
get { return _process.StandardError; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public StreamReader StandardOutput
|
public StreamReader StandardOutput => _process.StandardOutput;
|
||||||
{
|
|
||||||
get { return _process.StandardOutput; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public int ExitCode
|
public int ExitCode => _process.ExitCode;
|
||||||
{
|
|
||||||
get { return _process.ExitCode; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Start()
|
public void Start()
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using MediaBrowser.Common;
|
using MediaBrowser.Common;
|
||||||
using MediaBrowser.Controller.Channels;
|
using MediaBrowser.Controller.Channels;
|
||||||
using MediaBrowser.Controller.Configuration;
|
using MediaBrowser.Controller.Configuration;
|
||||||
using MediaBrowser.Controller.Devices;
|
using MediaBrowser.Controller.Devices;
|
||||||
|
@ -189,7 +189,7 @@ namespace Emby.Server.Implementations.Dto
|
||||||
return dto;
|
return dto;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IList<BaseItem> GetTaggedItems(IItemByName byName, User user, DtoOptions options)
|
private static IList<BaseItem> GetTaggedItems(IItemByName byName, User user, DtoOptions options)
|
||||||
{
|
{
|
||||||
return byName.GetTaggedItems(new InternalItemsQuery(user)
|
return byName.GetTaggedItems(new InternalItemsQuery(user)
|
||||||
{
|
{
|
||||||
|
@ -295,7 +295,7 @@ namespace Emby.Server.Implementations.Dto
|
||||||
return dto;
|
return dto;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void NormalizeMediaSourceContainers(BaseItemDto dto)
|
private static void NormalizeMediaSourceContainers(BaseItemDto dto)
|
||||||
{
|
{
|
||||||
foreach (var mediaSource in dto.MediaSources)
|
foreach (var mediaSource in dto.MediaSources)
|
||||||
{
|
{
|
||||||
|
@ -347,7 +347,7 @@ namespace Emby.Server.Implementations.Dto
|
||||||
return dto;
|
return dto;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetItemByNameInfo(BaseItem item, BaseItemDto dto, IList<BaseItem> taggedItems, User user = null)
|
private static void SetItemByNameInfo(BaseItem item, BaseItemDto dto, IList<BaseItem> taggedItems, User user = null)
|
||||||
{
|
{
|
||||||
if (item is MusicArtist)
|
if (item is MusicArtist)
|
||||||
{
|
{
|
||||||
|
@ -447,7 +447,7 @@ namespace Emby.Server.Implementations.Dto
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int GetChildCount(Folder folder, User user)
|
private static int GetChildCount(Folder folder, User user)
|
||||||
{
|
{
|
||||||
// Right now this is too slow to calculate for top level folders on a per-user basis
|
// Right now this is too slow to calculate for top level folders on a per-user basis
|
||||||
// Just return something so that apps that are expecting a value won't think the folders are empty
|
// Just return something so that apps that are expecting a value won't think the folders are empty
|
||||||
|
@ -470,11 +470,11 @@ namespace Emby.Server.Implementations.Dto
|
||||||
return item.Id.ToString("N");
|
return item.Id.ToString("N");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetBookProperties(BaseItemDto dto, Book item)
|
private static void SetBookProperties(BaseItemDto dto, Book item)
|
||||||
{
|
{
|
||||||
dto.SeriesName = item.SeriesName;
|
dto.SeriesName = item.SeriesName;
|
||||||
}
|
}
|
||||||
private void SetPhotoProperties(BaseItemDto dto, Photo item)
|
private static void SetPhotoProperties(BaseItemDto dto, Photo item)
|
||||||
{
|
{
|
||||||
dto.CameraMake = item.CameraMake;
|
dto.CameraMake = item.CameraMake;
|
||||||
dto.CameraModel = item.CameraModel;
|
dto.CameraModel = item.CameraModel;
|
||||||
|
@ -520,13 +520,13 @@ namespace Emby.Server.Implementations.Dto
|
||||||
dto.Album = item.Album;
|
dto.Album = item.Album;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetGameProperties(BaseItemDto dto, Game item)
|
private static void SetGameProperties(BaseItemDto dto, Game item)
|
||||||
{
|
{
|
||||||
dto.GameSystem = item.GameSystem;
|
dto.GameSystem = item.GameSystem;
|
||||||
dto.MultiPartGameFiles = item.MultiPartGameFiles;
|
dto.MultiPartGameFiles = item.MultiPartGameFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetGameSystemProperties(BaseItemDto dto, GameSystem item)
|
private static void SetGameSystemProperties(BaseItemDto dto, GameSystem item)
|
||||||
{
|
{
|
||||||
dto.GameSystem = item.GameSystemName;
|
dto.GameSystem = item.GameSystemName;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
@ -227,7 +227,7 @@ namespace Emby.Server.Implementations.EntryPoints
|
||||||
{
|
{
|
||||||
if (_disposed)
|
if (_disposed)
|
||||||
{
|
{
|
||||||
throw new ObjectDisposedException("PortMapper");
|
throw new ObjectDisposedException(GetType().Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
// On some systems the device discovered event seems to fire repeatedly
|
// On some systems the device discovered event seems to fire repeatedly
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Controller.Plugins;
|
using MediaBrowser.Controller.Plugins;
|
||||||
using MediaBrowser.Controller.Session;
|
using MediaBrowser.Controller.Session;
|
||||||
|
@ -142,7 +142,7 @@ namespace Emby.Server.Implementations.EntryPoints
|
||||||
_providerManager_RefreshProgress(sender, new GenericEventArgs<Tuple<BaseItem, double>>(new Tuple<BaseItem, double>(e.Argument, 100)));
|
_providerManager_RefreshProgress(sender, new GenericEventArgs<Tuple<BaseItem, double>>(new Tuple<BaseItem, double>(e.Argument, 100)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool EnableRefreshMessage(BaseItem item)
|
private static bool EnableRefreshMessage(BaseItem item)
|
||||||
{
|
{
|
||||||
var folder = item as Folder;
|
var folder = item as Folder;
|
||||||
|
|
||||||
|
@ -387,7 +387,7 @@ namespace Emby.Server.Implementations.EntryPoints
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool FilterItem(BaseItem item)
|
private static bool FilterItem(BaseItem item)
|
||||||
{
|
{
|
||||||
if (!item.IsFolder && !item.HasPathProtocol)
|
if (!item.IsFolder && !item.HasPathProtocol)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
|
@ -62,7 +62,7 @@ namespace Emby.Server.Implementations.EntryPoints
|
||||||
}
|
}
|
||||||
catch (ObjectDisposedException)
|
catch (ObjectDisposedException)
|
||||||
{
|
{
|
||||||
|
// TODO Log exception or Investigate and properly fix.
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,10 +30,7 @@ namespace Emby.Server.Implementations.EntryPoints
|
||||||
|
|
||||||
public string Description => "Refresh user infos";
|
public string Description => "Refresh user infos";
|
||||||
|
|
||||||
public string Category
|
public string Category => "Library";
|
||||||
{
|
|
||||||
get { return "Library"; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsHidden => true;
|
public bool IsHidden => true;
|
||||||
|
|
||||||
|
|
|
@ -29,14 +29,8 @@ namespace Emby.Server.Implementations.EnvironmentInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string OperatingSystemVersion
|
public string OperatingSystemVersion => Environment.OSVersion.Version.ToString() + " " + Environment.OSVersion.ServicePack.ToString();
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return Environment.OSVersion.Version.ToString() + " " + Environment.OSVersion.ServicePack.ToString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Architecture SystemArchitecture { get { return RuntimeInformation.OSArchitecture; } }
|
public Architecture SystemArchitecture => RuntimeInformation.OSArchitecture;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
@ -48,11 +48,11 @@ namespace Emby.Server.Implementations.HttpClientManager
|
||||||
{
|
{
|
||||||
if (appPaths == null)
|
if (appPaths == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("appPaths");
|
throw new ArgumentNullException(nameof(appPaths));
|
||||||
}
|
}
|
||||||
if (logger == null)
|
if (logger == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("logger");
|
throw new ArgumentNullException(nameof(logger));
|
||||||
}
|
}
|
||||||
|
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
|
@ -87,7 +87,7 @@ namespace Emby.Server.Implementations.HttpClientManager
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(host))
|
if (string.IsNullOrEmpty(host))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("host");
|
throw new ArgumentNullException(nameof(host));
|
||||||
}
|
}
|
||||||
|
|
||||||
HttpClientInfo client;
|
HttpClientInfo client;
|
||||||
|
@ -104,7 +104,7 @@ namespace Emby.Server.Implementations.HttpClientManager
|
||||||
return client;
|
return client;
|
||||||
}
|
}
|
||||||
|
|
||||||
private WebRequest CreateWebRequest(string url)
|
private static WebRequest CreateWebRequest(string url)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -185,7 +185,7 @@ namespace Emby.Server.Implementations.HttpClientManager
|
||||||
return request;
|
return request;
|
||||||
}
|
}
|
||||||
|
|
||||||
private CredentialCache GetCredential(string url, string username, string password)
|
private static CredentialCache GetCredential(string url, string username, string password)
|
||||||
{
|
{
|
||||||
//ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;
|
//ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;
|
||||||
CredentialCache credentialCache = new CredentialCache();
|
CredentialCache credentialCache = new CredentialCache();
|
||||||
|
@ -220,7 +220,7 @@ namespace Emby.Server.Implementations.HttpClientManager
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetUserAgent(HttpWebRequest request, string userAgent)
|
private static void SetUserAgent(HttpWebRequest request, string userAgent)
|
||||||
{
|
{
|
||||||
request.UserAgent = userAgent;
|
request.UserAgent = userAgent;
|
||||||
}
|
}
|
||||||
|
@ -491,7 +491,7 @@ namespace Emby.Server.Implementations.HttpClientManager
|
||||||
return responseInfo;
|
return responseInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetHeaders(WebHeaderCollection headers, HttpResponseInfo responseInfo)
|
private static void SetHeaders(WebHeaderCollection headers, HttpResponseInfo responseInfo)
|
||||||
{
|
{
|
||||||
foreach (var key in headers.AllKeys)
|
foreach (var key in headers.AllKeys)
|
||||||
{
|
{
|
||||||
|
@ -541,7 +541,7 @@ namespace Emby.Server.Implementations.HttpClientManager
|
||||||
|
|
||||||
if (options.Progress == null)
|
if (options.Progress == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("progress");
|
throw new ArgumentException("Options did not have a Progress value.",nameof(options));
|
||||||
}
|
}
|
||||||
|
|
||||||
options.CancellationToken.ThrowIfCancellationRequested();
|
options.CancellationToken.ThrowIfCancellationRequested();
|
||||||
|
@ -616,7 +616,7 @@ namespace Emby.Server.Implementations.HttpClientManager
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private long? GetContentLength(HttpWebResponse response)
|
private static long? GetContentLength(HttpWebResponse response)
|
||||||
{
|
{
|
||||||
var length = response.ContentLength;
|
var length = response.ContentLength;
|
||||||
|
|
||||||
|
@ -704,7 +704,7 @@ namespace Emby.Server.Implementations.HttpClientManager
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(options.Url))
|
if (string.IsNullOrEmpty(options.Url))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("options");
|
throw new ArgumentNullException(nameof(options));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -713,7 +713,7 @@ namespace Emby.Server.Implementations.HttpClientManager
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="url">The URL.</param>
|
/// <param name="url">The URL.</param>
|
||||||
/// <returns>System.String.</returns>
|
/// <returns>System.String.</returns>
|
||||||
private string GetHostFromUrl(string url)
|
private static string GetHostFromUrl(string url)
|
||||||
{
|
{
|
||||||
var index = url.IndexOf("://", StringComparison.OrdinalIgnoreCase);
|
var index = url.IndexOf("://", StringComparison.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
@ -803,7 +803,7 @@ namespace Emby.Server.Implementations.HttpClientManager
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private Task<WebResponse> GetResponseAsync(WebRequest request, TimeSpan timeout)
|
private static Task<WebResponse> GetResponseAsync(WebRequest request, TimeSpan timeout)
|
||||||
{
|
{
|
||||||
var taskCompletion = new TaskCompletionSource<WebResponse>();
|
var taskCompletion = new TaskCompletionSource<WebResponse>();
|
||||||
|
|
||||||
|
|
|
@ -38,10 +38,7 @@ namespace Emby.Server.Implementations.HttpServer
|
||||||
/// Gets the options.
|
/// Gets the options.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The options.</value>
|
/// <value>The options.</value>
|
||||||
public IDictionary<string, string> Headers
|
public IDictionary<string, string> Headers => _options;
|
||||||
{
|
|
||||||
get { return _options; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public string Path { get; set; }
|
public string Path { get; set; }
|
||||||
|
|
||||||
|
@ -49,7 +46,7 @@ namespace Emby.Server.Implementations.HttpServer
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(contentType))
|
if (string.IsNullOrEmpty(contentType))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("contentType");
|
throw new ArgumentNullException(nameof(contentType));
|
||||||
}
|
}
|
||||||
|
|
||||||
Path = path;
|
Path = path;
|
||||||
|
@ -203,8 +200,8 @@ namespace Emby.Server.Implementations.HttpServer
|
||||||
|
|
||||||
public HttpStatusCode StatusCode
|
public HttpStatusCode StatusCode
|
||||||
{
|
{
|
||||||
get { return (HttpStatusCode)Status; }
|
get => (HttpStatusCode)Status;
|
||||||
set { Status = (int)value; }
|
set => Status = (int)value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string StatusDescription { get; set; }
|
public string StatusDescription { get; set; }
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using MediaBrowser.Common.Extensions;
|
using MediaBrowser.Common.Extensions;
|
||||||
using MediaBrowser.Controller.Configuration;
|
using MediaBrowser.Controller.Configuration;
|
||||||
using MediaBrowser.Controller.Net;
|
using MediaBrowser.Controller.Net;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
@ -89,13 +89,7 @@ namespace Emby.Server.Implementations.HttpServer
|
||||||
{typeof (ArgumentException), 400}
|
{typeof (ArgumentException), 400}
|
||||||
};
|
};
|
||||||
|
|
||||||
protected ILogger Logger
|
protected ILogger Logger => _logger;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _logger;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public object CreateInstance(Type type)
|
public object CreateInstance(Type type)
|
||||||
{
|
{
|
||||||
|
@ -190,10 +184,9 @@ namespace Emby.Server.Implementations.HttpServer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Exception GetActualException(Exception ex)
|
private static Exception GetActualException(Exception ex)
|
||||||
{
|
{
|
||||||
var agg = ex as AggregateException;
|
if (ex is AggregateException agg)
|
||||||
if (agg != null)
|
|
||||||
{
|
{
|
||||||
var inner = agg.InnerException;
|
var inner = agg.InnerException;
|
||||||
if (inner != null)
|
if (inner != null)
|
||||||
|
@ -346,7 +339,7 @@ namespace Emby.Server.Implementations.HttpServer
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetExtension(string url)
|
private static string GetExtension(string url)
|
||||||
{
|
{
|
||||||
var parts = url.Split(new[] { '?' }, 2);
|
var parts = url.Split(new[] { '?' }, 2);
|
||||||
|
|
||||||
|
@ -379,18 +372,18 @@ namespace Emby.Server.Implementations.HttpServer
|
||||||
string pagePathWithoutQueryString = url.Split(new[] { '?' }, StringSplitOptions.RemoveEmptyEntries)[0];
|
string pagePathWithoutQueryString = url.Split(new[] { '?' }, StringSplitOptions.RemoveEmptyEntries)[0];
|
||||||
|
|
||||||
return newQueryString.Count > 0
|
return newQueryString.Count > 0
|
||||||
? String.Format("{0}?{1}", pagePathWithoutQueryString, newQueryString)
|
? string.Format("{0}?{1}", pagePathWithoutQueryString, newQueryString)
|
||||||
: pagePathWithoutQueryString;
|
: pagePathWithoutQueryString;
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetUrlToLog(string url)
|
private static string GetUrlToLog(string url)
|
||||||
{
|
{
|
||||||
url = RemoveQueryStringByKey(url, "api_key");
|
url = RemoveQueryStringByKey(url, "api_key");
|
||||||
|
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
private string NormalizeConfiguredLocalAddress(string address)
|
private static string NormalizeConfiguredLocalAddress(string address)
|
||||||
{
|
{
|
||||||
var index = address.Trim('/').IndexOf('/');
|
var index = address.Trim('/').IndexOf('/');
|
||||||
|
|
||||||
|
@ -727,7 +720,7 @@ namespace Emby.Server.Implementations.HttpServer
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Task Write(IResponse response, string text)
|
private static Task Write(IResponse response, string text)
|
||||||
{
|
{
|
||||||
var bOutput = Encoding.UTF8.GetBytes(text);
|
var bOutput = Encoding.UTF8.GetBytes(text);
|
||||||
response.SetContentLength(bOutput.Length);
|
response.SetContentLength(bOutput.Length);
|
||||||
|
@ -853,7 +846,9 @@ namespace Emby.Server.Implementations.HttpServer
|
||||||
return _jsonSerializer.DeserializeFromStreamAsync(stream, type);
|
return _jsonSerializer.DeserializeFromStreamAsync(stream, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
private string NormalizeEmbyRoutePath(string path)
|
//TODO Add Jellyfin Route Path Normalizer
|
||||||
|
|
||||||
|
private static string NormalizeEmbyRoutePath(string path)
|
||||||
{
|
{
|
||||||
if (path.StartsWith("/", StringComparison.OrdinalIgnoreCase))
|
if (path.StartsWith("/", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
|
@ -863,7 +858,7 @@ namespace Emby.Server.Implementations.HttpServer
|
||||||
return "emby/" + path;
|
return "emby/" + path;
|
||||||
}
|
}
|
||||||
|
|
||||||
private string NormalizeMediaBrowserRoutePath(string path)
|
private static string NormalizeMediaBrowserRoutePath(string path)
|
||||||
{
|
{
|
||||||
if (path.StartsWith("/", StringComparison.OrdinalIgnoreCase))
|
if (path.StartsWith("/", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
|
@ -873,7 +868,7 @@ namespace Emby.Server.Implementations.HttpServer
|
||||||
return "mediabrowser/" + path;
|
return "mediabrowser/" + path;
|
||||||
}
|
}
|
||||||
|
|
||||||
private string DoubleNormalizeEmbyRoutePath(string path)
|
private static string DoubleNormalizeEmbyRoutePath(string path)
|
||||||
{
|
{
|
||||||
if (path.StartsWith("/", StringComparison.OrdinalIgnoreCase))
|
if (path.StartsWith("/", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using MediaBrowser.Common.Extensions;
|
using MediaBrowser.Common.Extensions;
|
||||||
using MediaBrowser.Controller.Net;
|
using MediaBrowser.Controller.Net;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using MediaBrowser.Model.Serialization;
|
using MediaBrowser.Model.Serialization;
|
||||||
|
@ -207,7 +207,7 @@ namespace Emby.Server.Implementations.HttpServer
|
||||||
{
|
{
|
||||||
if (result == null)
|
if (result == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("result");
|
throw new ArgumentNullException(nameof(result));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (responseHeaders == null)
|
if (responseHeaders == null)
|
||||||
|
@ -245,7 +245,7 @@ namespace Emby.Server.Implementations.HttpServer
|
||||||
return GetCompressionType(request);
|
return GetCompressionType(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetCompressionType(IRequest request)
|
private static string GetCompressionType(IRequest request)
|
||||||
{
|
{
|
||||||
var acceptEncoding = request.Headers["Accept-Encoding"];
|
var acceptEncoding = request.Headers["Accept-Encoding"];
|
||||||
|
|
||||||
|
@ -365,7 +365,7 @@ namespace Emby.Server.Implementations.HttpServer
|
||||||
return _brotliCompressor.Compress(bytes);
|
return _brotliCompressor.Compress(bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte[] Deflate(byte[] bytes)
|
private static byte[] Deflate(byte[] bytes)
|
||||||
{
|
{
|
||||||
// In .NET FX incompat-ville, you can't access compressed bytes without closing DeflateStream
|
// In .NET FX incompat-ville, you can't access compressed bytes without closing DeflateStream
|
||||||
// Which means we must use MemoryStream since you have to use ToArray() on a closed Stream
|
// Which means we must use MemoryStream since you have to use ToArray() on a closed Stream
|
||||||
|
@ -379,7 +379,7 @@ namespace Emby.Server.Implementations.HttpServer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte[] GZip(byte[] buffer)
|
private static byte[] GZip(byte[] buffer)
|
||||||
{
|
{
|
||||||
using (var ms = new MemoryStream())
|
using (var ms = new MemoryStream())
|
||||||
using (var zipStream = new GZipStream(ms, CompressionMode.Compress))
|
using (var zipStream = new GZipStream(ms, CompressionMode.Compress))
|
||||||
|
@ -398,7 +398,7 @@ namespace Emby.Server.Implementations.HttpServer
|
||||||
: contentType.Split(';')[0].ToLower().Trim();
|
: contentType.Split(';')[0].ToLower().Trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
private string SerializeToXmlString(object from)
|
private static string SerializeToXmlString(object from)
|
||||||
{
|
{
|
||||||
using (var ms = new MemoryStream())
|
using (var ms = new MemoryStream())
|
||||||
{
|
{
|
||||||
|
@ -453,7 +453,7 @@ namespace Emby.Server.Implementations.HttpServer
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(path))
|
if (string.IsNullOrEmpty(path))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("path");
|
throw new ArgumentNullException(nameof(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
return GetStaticFileResult(requestContext, new StaticFileResultOptions
|
return GetStaticFileResult(requestContext, new StaticFileResultOptions
|
||||||
|
@ -471,7 +471,7 @@ namespace Emby.Server.Implementations.HttpServer
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(path))
|
if (string.IsNullOrEmpty(path))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("path");
|
throw new ArgumentNullException(nameof(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fileShare != FileShareMode.Read && fileShare != FileShareMode.ReadWrite)
|
if (fileShare != FileShareMode.Read && fileShare != FileShareMode.ReadWrite)
|
||||||
|
@ -661,7 +661,7 @@ namespace Emby.Server.Implementations.HttpServer
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds the expires header.
|
/// Adds the expires header.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void AddExpiresHeader(IDictionary<string, string> responseHeaders, string cacheKey, TimeSpan? cacheDuration)
|
private static void AddExpiresHeader(IDictionary<string, string> responseHeaders, string cacheKey, TimeSpan? cacheDuration)
|
||||||
{
|
{
|
||||||
if (cacheDuration.HasValue)
|
if (cacheDuration.HasValue)
|
||||||
{
|
{
|
||||||
|
@ -678,7 +678,7 @@ namespace Emby.Server.Implementations.HttpServer
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="responseHeaders">The responseHeaders.</param>
|
/// <param name="responseHeaders">The responseHeaders.</param>
|
||||||
/// <param name="lastDateModified">The last date modified.</param>
|
/// <param name="lastDateModified">The last date modified.</param>
|
||||||
private void AddAgeHeader(IDictionary<string, string> responseHeaders, DateTime? lastDateModified)
|
private static void AddAgeHeader(IDictionary<string, string> responseHeaders, DateTime? lastDateModified)
|
||||||
{
|
{
|
||||||
if (lastDateModified.HasValue)
|
if (lastDateModified.HasValue)
|
||||||
{
|
{
|
||||||
|
@ -771,7 +771,7 @@ namespace Emby.Server.Implementations.HttpServer
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="date">The date.</param>
|
/// <param name="date">The date.</param>
|
||||||
/// <returns>DateTime.</returns>
|
/// <returns>DateTime.</returns>
|
||||||
private DateTime NormalizeDateForComparison(DateTime date)
|
private static DateTime NormalizeDateForComparison(DateTime date)
|
||||||
{
|
{
|
||||||
return new DateTime(date.Year, date.Month, date.Day, date.Hour, date.Minute, date.Second, date.Kind);
|
return new DateTime(date.Year, date.Month, date.Day, date.Hour, date.Minute, date.Second, date.Kind);
|
||||||
}
|
}
|
||||||
|
@ -781,7 +781,7 @@ namespace Emby.Server.Implementations.HttpServer
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="hasHeaders">The has options.</param>
|
/// <param name="hasHeaders">The has options.</param>
|
||||||
/// <param name="responseHeaders">The response headers.</param>
|
/// <param name="responseHeaders">The response headers.</param>
|
||||||
private void AddResponseHeaders(IHasHeaders hasHeaders, IEnumerable<KeyValuePair<string, string>> responseHeaders)
|
private static void AddResponseHeaders(IHasHeaders hasHeaders, IEnumerable<KeyValuePair<string, string>> responseHeaders)
|
||||||
{
|
{
|
||||||
foreach (var item in responseHeaders)
|
foreach (var item in responseHeaders)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
@ -46,10 +46,7 @@ namespace Emby.Server.Implementations.HttpServer
|
||||||
/// Additional HTTP Headers
|
/// Additional HTTP Headers
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The headers.</value>
|
/// <value>The headers.</value>
|
||||||
public IDictionary<string, string> Headers
|
public IDictionary<string, string> Headers => _options;
|
||||||
{
|
|
||||||
get { return _options; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="StreamWriter" /> class.
|
/// Initializes a new instance of the <see cref="StreamWriter" /> class.
|
||||||
|
@ -62,7 +59,7 @@ namespace Emby.Server.Implementations.HttpServer
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(contentType))
|
if (string.IsNullOrEmpty(contentType))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("contentType");
|
throw new ArgumentNullException(nameof(contentType));
|
||||||
}
|
}
|
||||||
|
|
||||||
RangeHeader = rangeHeader;
|
RangeHeader = rangeHeader;
|
||||||
|
@ -186,7 +183,7 @@ namespace Emby.Server.Implementations.HttpServer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task CopyToInternalAsync(Stream source, Stream destination, long copyLength)
|
private static async Task CopyToInternalAsync(Stream source, Stream destination, long copyLength)
|
||||||
{
|
{
|
||||||
var array = new byte[BufferSize];
|
var array = new byte[BufferSize];
|
||||||
int bytesRead;
|
int bytesRead;
|
||||||
|
@ -220,8 +217,8 @@ namespace Emby.Server.Implementations.HttpServer
|
||||||
|
|
||||||
public HttpStatusCode StatusCode
|
public HttpStatusCode StatusCode
|
||||||
{
|
{
|
||||||
get { return (HttpStatusCode)Status; }
|
get => (HttpStatusCode)Status;
|
||||||
set { Status = (int)value; }
|
set => Status = (int)value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string StatusDescription { get; set; }
|
public string StatusDescription { get; set; }
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using MediaBrowser.Controller.Configuration;
|
using MediaBrowser.Controller.Configuration;
|
||||||
using MediaBrowser.Controller.Connect;
|
using MediaBrowser.Controller.Connect;
|
||||||
using MediaBrowser.Controller.Devices;
|
using MediaBrowser.Controller.Devices;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
|
@ -173,7 +173,7 @@ namespace Emby.Server.Implementations.HttpServer.Security
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ValidateRoles(string[] roles, User user)
|
private static void ValidateRoles(string[] roles, User user)
|
||||||
{
|
{
|
||||||
if (roles.Contains("admin", StringComparer.OrdinalIgnoreCase))
|
if (roles.Contains("admin", StringComparer.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
|
@ -207,7 +207,7 @@ namespace Emby.Server.Implementations.HttpServer.Security
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private AuthenticationInfo GetTokenInfo(IRequest request)
|
private static AuthenticationInfo GetTokenInfo(IRequest request)
|
||||||
{
|
{
|
||||||
object info;
|
object info;
|
||||||
request.Items.TryGetValue("OriginalAuthenticationInfo", out info);
|
request.Items.TryGetValue("OriginalAuthenticationInfo", out info);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using MediaBrowser.Controller.Connect;
|
using MediaBrowser.Controller.Connect;
|
||||||
using MediaBrowser.Controller.Net;
|
using MediaBrowser.Controller.Net;
|
||||||
using MediaBrowser.Controller.Security;
|
using MediaBrowser.Controller.Security;
|
||||||
using System;
|
using System;
|
||||||
|
@ -227,7 +227,7 @@ namespace Emby.Server.Implementations.HttpServer.Security
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private string NormalizeValue(string value)
|
private static string NormalizeValue(string value)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(value))
|
if (string.IsNullOrEmpty(value))
|
||||||
{
|
{
|
||||||
|
|
|
@ -35,10 +35,7 @@ namespace Emby.Server.Implementations.HttpServer
|
||||||
/// Gets the options.
|
/// Gets the options.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The options.</value>
|
/// <value>The options.</value>
|
||||||
public IDictionary<string, string> Headers
|
public IDictionary<string, string> Headers => _options;
|
||||||
{
|
|
||||||
get { return _options; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public Action OnComplete { get; set; }
|
public Action OnComplete { get; set; }
|
||||||
public Action OnError { get; set; }
|
public Action OnError { get; set; }
|
||||||
|
@ -53,7 +50,7 @@ namespace Emby.Server.Implementations.HttpServer
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(contentType))
|
if (string.IsNullOrEmpty(contentType))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("contentType");
|
throw new ArgumentNullException(nameof(contentType));
|
||||||
}
|
}
|
||||||
|
|
||||||
SourceStream = source;
|
SourceStream = source;
|
||||||
|
@ -77,7 +74,7 @@ namespace Emby.Server.Implementations.HttpServer
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(contentType))
|
if (string.IsNullOrEmpty(contentType))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("contentType");
|
throw new ArgumentNullException(nameof(contentType));
|
||||||
}
|
}
|
||||||
|
|
||||||
SourceBytes = source;
|
SourceBytes = source;
|
||||||
|
|
|
@ -82,19 +82,19 @@ namespace Emby.Server.Implementations.HttpServer
|
||||||
{
|
{
|
||||||
if (socket == null)
|
if (socket == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("socket");
|
throw new ArgumentNullException(nameof(socket));
|
||||||
}
|
}
|
||||||
if (string.IsNullOrEmpty(remoteEndPoint))
|
if (string.IsNullOrEmpty(remoteEndPoint))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("remoteEndPoint");
|
throw new ArgumentNullException(nameof(remoteEndPoint));
|
||||||
}
|
}
|
||||||
if (jsonSerializer == null)
|
if (jsonSerializer == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("jsonSerializer");
|
throw new ArgumentNullException(nameof(jsonSerializer));
|
||||||
}
|
}
|
||||||
if (logger == null)
|
if (logger == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("logger");
|
throw new ArgumentNullException(nameof(logger));
|
||||||
}
|
}
|
||||||
|
|
||||||
Id = Guid.NewGuid();
|
Id = Guid.NewGuid();
|
||||||
|
@ -148,7 +148,8 @@ namespace Emby.Server.Implementations.HttpServer
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called when [receive].
|
/// Called when [receive].
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="bytes">The bytes.</param>
|
/// <param name="memory">The memory block.</param>
|
||||||
|
/// <param name="length">The length of the memory block.</param>
|
||||||
private void OnReceiveInternal(Memory<byte> memory, int length)
|
private void OnReceiveInternal(Memory<byte> memory, int length)
|
||||||
{
|
{
|
||||||
LastActivityDate = DateTime.UtcNow;
|
LastActivityDate = DateTime.UtcNow;
|
||||||
|
@ -219,7 +220,7 @@ namespace Emby.Server.Implementations.HttpServer
|
||||||
{
|
{
|
||||||
if (message == null)
|
if (message == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("message");
|
throw new ArgumentNullException(nameof(message));
|
||||||
}
|
}
|
||||||
|
|
||||||
var json = _jsonSerializer.SerializeToString(message);
|
var json = _jsonSerializer.SerializeToString(message);
|
||||||
|
@ -237,7 +238,7 @@ namespace Emby.Server.Implementations.HttpServer
|
||||||
{
|
{
|
||||||
if (buffer == null)
|
if (buffer == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("buffer");
|
throw new ArgumentNullException(nameof(buffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
@ -249,7 +250,7 @@ namespace Emby.Server.Implementations.HttpServer
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(text))
|
if (string.IsNullOrEmpty(text))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("text");
|
throw new ArgumentNullException(nameof(text));
|
||||||
}
|
}
|
||||||
|
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
@ -261,10 +262,7 @@ namespace Emby.Server.Implementations.HttpServer
|
||||||
/// Gets the state.
|
/// Gets the state.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The state.</value>
|
/// <value>The state.</value>
|
||||||
public WebSocketState State
|
public WebSocketState State => _socket.State;
|
||||||
{
|
|
||||||
get { return _socket.State; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
|
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
|
||||||
|
|
|
@ -51,7 +51,7 @@ namespace Emby.Server.Implementations.IO
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(path))
|
if (string.IsNullOrEmpty(path))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("path");
|
throw new ArgumentNullException(nameof(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_affectedPaths.Contains(path, StringComparer.Ordinal))
|
if (!_affectedPaths.Contains(path, StringComparer.Ordinal))
|
||||||
|
@ -64,7 +64,7 @@ namespace Emby.Server.Implementations.IO
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(path))
|
if (string.IsNullOrEmpty(path))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("path");
|
throw new ArgumentNullException(nameof(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
lock (_timerLock)
|
lock (_timerLock)
|
||||||
|
|
|
@ -29,7 +29,7 @@ namespace Emby.Server.Implementations.IO
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(isoPath))
|
if (string.IsNullOrEmpty(isoPath))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("isoPath");
|
throw new ArgumentNullException(nameof(isoPath));
|
||||||
}
|
}
|
||||||
|
|
||||||
var mounter = _mounters.FirstOrDefault(i => i.CanMount(isoPath));
|
var mounter = _mounters.FirstOrDefault(i => i.CanMount(isoPath));
|
||||||
|
|
|
@ -77,7 +77,7 @@ namespace Emby.Server.Implementations.IO
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(path))
|
if (string.IsNullOrEmpty(path))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("path");
|
throw new ArgumentNullException(nameof(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
TemporarilyIgnore(path);
|
TemporarilyIgnore(path);
|
||||||
|
@ -95,7 +95,7 @@ namespace Emby.Server.Implementations.IO
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(path))
|
if (string.IsNullOrEmpty(path))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("path");
|
throw new ArgumentNullException(nameof(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is an arbitraty amount of time, but delay it because file system writes often trigger events long after the file was actually written to.
|
// This is an arbitraty amount of time, but delay it because file system writes often trigger events long after the file was actually written to.
|
||||||
|
@ -145,7 +145,7 @@ namespace Emby.Server.Implementations.IO
|
||||||
{
|
{
|
||||||
if (taskManager == null)
|
if (taskManager == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("taskManager");
|
throw new ArgumentNullException(nameof(taskManager));
|
||||||
}
|
}
|
||||||
|
|
||||||
LibraryManager = libraryManager;
|
LibraryManager = libraryManager;
|
||||||
|
@ -268,7 +268,7 @@ namespace Emby.Server.Implementations.IO
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(path))
|
if (string.IsNullOrEmpty(path))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("path");
|
throw new ArgumentNullException(nameof(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
path = path.TrimEnd(Path.DirectorySeparatorChar);
|
path = path.TrimEnd(Path.DirectorySeparatorChar);
|
||||||
|
@ -469,7 +469,7 @@ namespace Emby.Server.Implementations.IO
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(path))
|
if (string.IsNullOrEmpty(path))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("path");
|
throw new ArgumentNullException(nameof(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
var filename = Path.GetFileName(path);
|
var filename = Path.GetFileName(path);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
@ -85,17 +85,11 @@ namespace Emby.Server.Implementations.IO
|
||||||
{
|
{
|
||||||
// Be consistent across platforms because the windows server will fail to query network shares that don't follow windows conventions
|
// Be consistent across platforms because the windows server will fail to query network shares that don't follow windows conventions
|
||||||
// https://referencesource.microsoft.com/#mscorlib/system/io/path.cs
|
// https://referencesource.microsoft.com/#mscorlib/system/io/path.cs
|
||||||
_invalidFileNameChars = new char[] { '\"', '<', '>', '|', '\0', (Char)1, (Char)2, (Char)3, (Char)4, (Char)5, (Char)6, (Char)7, (Char)8, (Char)9, (Char)10, (Char)11, (Char)12, (Char)13, (Char)14, (Char)15, (Char)16, (Char)17, (Char)18, (Char)19, (Char)20, (Char)21, (Char)22, (Char)23, (Char)24, (Char)25, (Char)26, (Char)27, (Char)28, (Char)29, (Char)30, (Char)31, ':', '*', '?', '\\', '/' };
|
_invalidFileNameChars = new char[] { '\"', '<', '>', '|', '\0', (char)1, (char)2, (char)3, (char)4, (char)5, (char)6, (char)7, (char)8, (char)9, (char)10, (char)11, (char)12, (char)13, (char)14, (char)15, (char)16, (char)17, (char)18, (char)19, (char)20, (char)21, (char)22, (char)23, (char)24, (char)25, (char)26, (char)27, (char)28, (char)29, (char)30, (char)31, ':', '*', '?', '\\', '/' };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public char DirectorySeparatorChar
|
public char DirectorySeparatorChar => Path.DirectorySeparatorChar;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return Path.DirectorySeparatorChar;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string GetFullPath(string path)
|
public string GetFullPath(string path)
|
||||||
{
|
{
|
||||||
|
@ -112,7 +106,7 @@ namespace Emby.Server.Implementations.IO
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(filename))
|
if (string.IsNullOrEmpty(filename))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("filename");
|
throw new ArgumentNullException(nameof(filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
var extension = Path.GetExtension(filename);
|
var extension = Path.GetExtension(filename);
|
||||||
|
@ -129,7 +123,7 @@ namespace Emby.Server.Implementations.IO
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(filename))
|
if (string.IsNullOrEmpty(filename))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("filename");
|
throw new ArgumentNullException(nameof(filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
var extension = Path.GetExtension(filename);
|
var extension = Path.GetExtension(filename);
|
||||||
|
@ -145,7 +139,7 @@ namespace Emby.Server.Implementations.IO
|
||||||
|
|
||||||
public string MakeAbsolutePath(string folderPath, string filePath)
|
public string MakeAbsolutePath(string folderPath, string filePath)
|
||||||
{
|
{
|
||||||
if (String.IsNullOrWhiteSpace(filePath)) return filePath;
|
if (string.IsNullOrWhiteSpace(filePath)) return filePath;
|
||||||
|
|
||||||
if (filePath.Contains(@"://")) return filePath; //stream
|
if (filePath.Contains(@"://")) return filePath; //stream
|
||||||
if (filePath.Length > 3 && filePath[1] == ':' && filePath[2] == '/') return filePath; //absolute local path
|
if (filePath.Length > 3 && filePath[1] == ':' && filePath[2] == '/') return filePath; //absolute local path
|
||||||
|
@ -200,12 +194,12 @@ namespace Emby.Server.Implementations.IO
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(shortcutPath))
|
if (string.IsNullOrEmpty(shortcutPath))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("shortcutPath");
|
throw new ArgumentNullException(nameof(shortcutPath));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(target))
|
if (string.IsNullOrEmpty(target))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("target");
|
throw new ArgumentNullException(nameof(target));
|
||||||
}
|
}
|
||||||
|
|
||||||
var extension = Path.GetExtension(shortcutPath);
|
var extension = Path.GetExtension(shortcutPath);
|
||||||
|
@ -321,7 +315,7 @@ namespace Emby.Server.Implementations.IO
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ExtendedFileSystemInfo GetExtendedFileSystemInfo(string path)
|
private static ExtendedFileSystemInfo GetExtendedFileSystemInfo(string path)
|
||||||
{
|
{
|
||||||
var result = new ExtendedFileSystemInfo();
|
var result = new ExtendedFileSystemInfo();
|
||||||
|
|
||||||
|
@ -456,13 +450,13 @@ namespace Emby.Server.Implementations.IO
|
||||||
return new FileStream(path, GetFileMode(mode), GetFileAccess(access), GetFileShare(share), defaultBufferSize, GetFileOptions(fileOpenOptions));
|
return new FileStream(path, GetFileMode(mode), GetFileAccess(access), GetFileShare(share), defaultBufferSize, GetFileOptions(fileOpenOptions));
|
||||||
}
|
}
|
||||||
|
|
||||||
private FileOptions GetFileOptions(FileOpenOptions mode)
|
private static FileOptions GetFileOptions(FileOpenOptions mode)
|
||||||
{
|
{
|
||||||
var val = (int)mode;
|
var val = (int)mode;
|
||||||
return (FileOptions)val;
|
return (FileOptions)val;
|
||||||
}
|
}
|
||||||
|
|
||||||
private FileMode GetFileMode(FileOpenMode mode)
|
private static FileMode GetFileMode(FileOpenMode mode)
|
||||||
{
|
{
|
||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
|
@ -483,7 +477,7 @@ namespace Emby.Server.Implementations.IO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private FileAccess GetFileAccess(FileAccessMode mode)
|
private static FileAccess GetFileAccess(FileAccessMode mode)
|
||||||
{
|
{
|
||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
|
@ -498,7 +492,7 @@ namespace Emby.Server.Implementations.IO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private FileShare GetFileShare(FileShareMode mode)
|
private static FileShare GetFileShare(FileShareMode mode)
|
||||||
{
|
{
|
||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
|
@ -619,12 +613,12 @@ namespace Emby.Server.Implementations.IO
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(file1))
|
if (string.IsNullOrEmpty(file1))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("file1");
|
throw new ArgumentNullException(nameof(file1));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(file2))
|
if (string.IsNullOrEmpty(file2))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("file2");
|
throw new ArgumentNullException(nameof(file2));
|
||||||
}
|
}
|
||||||
|
|
||||||
var temp1 = Path.Combine(_tempPath, Guid.NewGuid().ToString("N"));
|
var temp1 = Path.Combine(_tempPath, Guid.NewGuid().ToString("N"));
|
||||||
|
@ -640,7 +634,7 @@ namespace Emby.Server.Implementations.IO
|
||||||
CopyFile(temp1, file2, true);
|
CopyFile(temp1, file2, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private char GetDirectorySeparatorChar(string path)
|
private static char GetDirectorySeparatorChar(string path)
|
||||||
{
|
{
|
||||||
return Path.DirectorySeparatorChar;
|
return Path.DirectorySeparatorChar;
|
||||||
}
|
}
|
||||||
|
@ -649,12 +643,12 @@ namespace Emby.Server.Implementations.IO
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(parentPath))
|
if (string.IsNullOrEmpty(parentPath))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("parentPath");
|
throw new ArgumentNullException(nameof(parentPath));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(path))
|
if (string.IsNullOrEmpty(path))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("path");
|
throw new ArgumentNullException(nameof(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
var separatorChar = GetDirectorySeparatorChar(parentPath);
|
var separatorChar = GetDirectorySeparatorChar(parentPath);
|
||||||
|
@ -666,7 +660,7 @@ namespace Emby.Server.Implementations.IO
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(path))
|
if (string.IsNullOrEmpty(path))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("path");
|
throw new ArgumentNullException(nameof(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
var parent = GetDirectoryName(path);
|
var parent = GetDirectoryName(path);
|
||||||
|
@ -688,7 +682,7 @@ namespace Emby.Server.Implementations.IO
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(path))
|
if (string.IsNullOrEmpty(path))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("path");
|
throw new ArgumentNullException(nameof(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (path.EndsWith(":\\", StringComparison.OrdinalIgnoreCase))
|
if (path.EndsWith(":\\", StringComparison.OrdinalIgnoreCase))
|
||||||
|
@ -772,7 +766,7 @@ namespace Emby.Server.Implementations.IO
|
||||||
}).ToList();
|
}).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetName(DriveInfo drive)
|
private static string GetName(DriveInfo drive)
|
||||||
{
|
{
|
||||||
return drive.Name;
|
return drive.Name;
|
||||||
}
|
}
|
||||||
|
@ -972,7 +966,7 @@ namespace Emby.Server.Implementations.IO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RunProcess(string path, string args, string workingDirectory)
|
private static void RunProcess(string path, string args, string workingDirectory)
|
||||||
{
|
{
|
||||||
using (var process = Process.Start(new ProcessStartInfo
|
using (var process = Process.Start(new ProcessStartInfo
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,16 +15,13 @@ namespace Emby.Server.Implementations.IO
|
||||||
_fileSystem = fileSystem;
|
_fileSystem = fileSystem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Extension
|
public string Extension => ".mblink";
|
||||||
{
|
|
||||||
get { return ".mblink"; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public string Resolve(string shortcutPath)
|
public string Resolve(string shortcutPath)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(shortcutPath))
|
if (string.IsNullOrEmpty(shortcutPath))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("filenshortcutPathame");
|
throw new ArgumentException("Shortcut path is empty or null.", nameof(shortcutPath));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.Equals(Path.GetExtension(shortcutPath), ".mblink", StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(Path.GetExtension(shortcutPath), ".mblink", StringComparison.OrdinalIgnoreCase))
|
||||||
|
@ -41,12 +38,12 @@ namespace Emby.Server.Implementations.IO
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(shortcutPath))
|
if (string.IsNullOrEmpty(shortcutPath))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("shortcutPath");
|
throw new ArgumentNullException(nameof(shortcutPath));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(targetPath))
|
if (string.IsNullOrEmpty(targetPath))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("targetPath");
|
throw new ArgumentNullException(nameof(targetPath));
|
||||||
}
|
}
|
||||||
|
|
||||||
_fileSystem.WriteAllText(shortcutPath, targetPath);
|
_fileSystem.WriteAllText(shortcutPath, targetPath);
|
||||||
|
|
|
@ -42,13 +42,7 @@ namespace Emby.Server.Implementations.IO
|
||||||
/// Gets the current milliseconds.
|
/// Gets the current milliseconds.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The current milliseconds.</value>
|
/// <value>The current milliseconds.</value>
|
||||||
protected long CurrentMilliseconds
|
protected long CurrentMilliseconds => Environment.TickCount;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return Environment.TickCount;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the maximum bytes per second that can be transferred through the base stream.
|
/// Gets or sets the maximum bytes per second that can be transferred through the base stream.
|
||||||
|
@ -56,10 +50,7 @@ namespace Emby.Server.Implementations.IO
|
||||||
/// <value>The maximum bytes per second.</value>
|
/// <value>The maximum bytes per second.</value>
|
||||||
public long MaximumBytesPerSecond
|
public long MaximumBytesPerSecond
|
||||||
{
|
{
|
||||||
get
|
get => _maximumBytesPerSecond;
|
||||||
{
|
|
||||||
return _maximumBytesPerSecond;
|
|
||||||
}
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (MaximumBytesPerSecond != value)
|
if (MaximumBytesPerSecond != value)
|
||||||
|
@ -74,39 +65,21 @@ namespace Emby.Server.Implementations.IO
|
||||||
/// Gets a value indicating whether the current stream supports reading.
|
/// Gets a value indicating whether the current stream supports reading.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>true if the stream supports reading; otherwise, false.</returns>
|
/// <returns>true if the stream supports reading; otherwise, false.</returns>
|
||||||
public override bool CanRead
|
public override bool CanRead => _baseStream.CanRead;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _baseStream.CanRead;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value indicating whether the current stream supports seeking.
|
/// Gets a value indicating whether the current stream supports seeking.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value></value>
|
/// <value></value>
|
||||||
/// <returns>true if the stream supports seeking; otherwise, false.</returns>
|
/// <returns>true if the stream supports seeking; otherwise, false.</returns>
|
||||||
public override bool CanSeek
|
public override bool CanSeek => _baseStream.CanSeek;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _baseStream.CanSeek;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value indicating whether the current stream supports writing.
|
/// Gets a value indicating whether the current stream supports writing.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value></value>
|
/// <value></value>
|
||||||
/// <returns>true if the stream supports writing; otherwise, false.</returns>
|
/// <returns>true if the stream supports writing; otherwise, false.</returns>
|
||||||
public override bool CanWrite
|
public override bool CanWrite => _baseStream.CanWrite;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _baseStream.CanWrite;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the length in bytes of the stream.
|
/// Gets the length in bytes of the stream.
|
||||||
|
@ -115,13 +88,7 @@ namespace Emby.Server.Implementations.IO
|
||||||
/// <returns>A long value representing the length of the stream in bytes.</returns>
|
/// <returns>A long value representing the length of the stream in bytes.</returns>
|
||||||
/// <exception cref="T:System.NotSupportedException">The base stream does not support seeking. </exception>
|
/// <exception cref="T:System.NotSupportedException">The base stream does not support seeking. </exception>
|
||||||
/// <exception cref="T:System.ObjectDisposedException">Methods were called after the stream was closed. </exception>
|
/// <exception cref="T:System.ObjectDisposedException">Methods were called after the stream was closed. </exception>
|
||||||
public override long Length
|
public override long Length => _baseStream.Length;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _baseStream.Length;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the position within the current stream.
|
/// Gets or sets the position within the current stream.
|
||||||
|
@ -133,14 +100,8 @@ namespace Emby.Server.Implementations.IO
|
||||||
/// <exception cref="T:System.ObjectDisposedException">Methods were called after the stream was closed. </exception>
|
/// <exception cref="T:System.ObjectDisposedException">Methods were called after the stream was closed. </exception>
|
||||||
public override long Position
|
public override long Position
|
||||||
{
|
{
|
||||||
get
|
get => _baseStream.Position;
|
||||||
{
|
set => _baseStream.Position = value;
|
||||||
return _baseStream.Position;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_baseStream.Position = value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -158,12 +119,12 @@ namespace Emby.Server.Implementations.IO
|
||||||
{
|
{
|
||||||
if (baseStream == null)
|
if (baseStream == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("baseStream");
|
throw new ArgumentNullException(nameof(baseStream));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (maximumBytesPerSecond < 0)
|
if (maximumBytesPerSecond < 0)
|
||||||
{
|
{
|
||||||
throw new ArgumentOutOfRangeException("maximumBytesPerSecond",
|
throw new ArgumentOutOfRangeException(nameof(maximumBytesPerSecond),
|
||||||
maximumBytesPerSecond, "The maximum number of bytes per second can't be negative.");
|
maximumBytesPerSecond, "The maximum number of bytes per second can't be negative.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -193,10 +193,7 @@ namespace Emby.Server.Implementations.Images
|
||||||
return outputPath;
|
return outputPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Name
|
public string Name => "Dynamic Image Provider";
|
||||||
{
|
|
||||||
get { return "Dynamic Image Provider"; }
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual string CreateImage(BaseItem item,
|
protected virtual string CreateImage(BaseItem item,
|
||||||
List<BaseItem> itemsWithImages,
|
List<BaseItem> itemsWithImages,
|
||||||
|
@ -232,10 +229,7 @@ namespace Emby.Server.Implementations.Images
|
||||||
throw new ArgumentException("Unexpected image type");
|
throw new ArgumentException("Unexpected image type");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual int MaxImageAgeDays
|
protected virtual int MaxImageAgeDays => 7;
|
||||||
{
|
|
||||||
get { return 7; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool HasChanged(BaseItem item, IDirectoryService directoryServicee)
|
public bool HasChanged(BaseItem item, IDirectoryService directoryServicee)
|
||||||
{
|
{
|
||||||
|
@ -293,14 +287,7 @@ namespace Emby.Server.Implementations.Images
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Order
|
public int Order => 0;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
// Run before the default image provider which will download placeholders
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected string CreateSingleImage(List<BaseItem> itemsWithImages, string outputPathWithoutExtension, ImageType imageType)
|
protected string CreateSingleImage(List<BaseItem> itemsWithImages, string outputPathWithoutExtension, ImageType imageType)
|
||||||
{
|
{
|
||||||
|
|
|
@ -67,7 +67,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(newPasswordHash))
|
if (string.IsNullOrWhiteSpace(newPasswordHash))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("newPasswordHash");
|
throw new ArgumentNullException(nameof(newPasswordHash));
|
||||||
}
|
}
|
||||||
|
|
||||||
user.Password = newPasswordHash;
|
user.Password = newPasswordHash;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using MediaBrowser.Common.Extensions;
|
using MediaBrowser.Common.Extensions;
|
||||||
using MediaBrowser.Common.Progress;
|
using MediaBrowser.Common.Progress;
|
||||||
using MediaBrowser.Controller.Configuration;
|
using MediaBrowser.Controller.Configuration;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
|
@ -147,13 +147,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
/// Gets the library items cache.
|
/// Gets the library items cache.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The library items cache.</value>
|
/// <value>The library items cache.</value>
|
||||||
private ConcurrentDictionary<Guid, BaseItem> LibraryItemsCache
|
private ConcurrentDictionary<Guid, BaseItem> LibraryItemsCache => _libraryItemsCache;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _libraryItemsCache;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly IFileSystem _fileSystem;
|
private readonly IFileSystem _fileSystem;
|
||||||
|
|
||||||
|
@ -188,7 +182,6 @@ namespace Emby.Server.Implementations.Library
|
||||||
/// Adds the parts.
|
/// Adds the parts.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="rules">The rules.</param>
|
/// <param name="rules">The rules.</param>
|
||||||
/// <param name="pluginFolders">The plugin folders.</param>
|
|
||||||
/// <param name="resolvers">The resolvers.</param>
|
/// <param name="resolvers">The resolvers.</param>
|
||||||
/// <param name="introProviders">The intro providers.</param>
|
/// <param name="introProviders">The intro providers.</param>
|
||||||
/// <param name="itemComparers">The item comparers.</param>
|
/// <param name="itemComparers">The item comparers.</param>
|
||||||
|
@ -277,7 +270,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
{
|
{
|
||||||
if (item == null)
|
if (item == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("item");
|
throw new ArgumentNullException(nameof(item));
|
||||||
}
|
}
|
||||||
if (item is IItemByName)
|
if (item is IItemByName)
|
||||||
{
|
{
|
||||||
|
@ -317,7 +310,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
{
|
{
|
||||||
if (item == null)
|
if (item == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("item");
|
throw new ArgumentNullException(nameof(item));
|
||||||
}
|
}
|
||||||
|
|
||||||
var parent = item.GetOwner() ?? item.GetParent();
|
var parent = item.GetOwner() ?? item.GetParent();
|
||||||
|
@ -329,7 +322,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
{
|
{
|
||||||
if (item == null)
|
if (item == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("item");
|
throw new ArgumentNullException(nameof(item));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.SourceType == SourceType.Channel)
|
if (item.SourceType == SourceType.Channel)
|
||||||
|
@ -449,7 +442,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
ReportItemRemoved(item, parent);
|
ReportItemRemoved(item, parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<string> GetMetadataPaths(BaseItem item, IEnumerable<BaseItem> children)
|
private static IEnumerable<string> GetMetadataPaths(BaseItem item, IEnumerable<BaseItem> children)
|
||||||
{
|
{
|
||||||
var list = new List<string>
|
var list = new List<string>
|
||||||
{
|
{
|
||||||
|
@ -502,11 +495,11 @@ namespace Emby.Server.Implementations.Library
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(key))
|
if (string.IsNullOrEmpty(key))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("key");
|
throw new ArgumentNullException(nameof(key));
|
||||||
}
|
}
|
||||||
if (type == null)
|
if (type == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("type");
|
throw new ArgumentNullException(nameof(type));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (key.StartsWith(ConfigurationManager.ApplicationPaths.ProgramDataPath))
|
if (key.StartsWith(ConfigurationManager.ApplicationPaths.ProgramDataPath))
|
||||||
|
@ -542,7 +535,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
{
|
{
|
||||||
if (fileInfo == null)
|
if (fileInfo == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("fileInfo");
|
throw new ArgumentNullException(nameof(fileInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
var fullPath = fileInfo.FullName;
|
var fullPath = fileInfo.FullName;
|
||||||
|
@ -823,7 +816,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(path))
|
if (string.IsNullOrEmpty(path))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("path");
|
throw new ArgumentNullException(nameof(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
//_logger.LogInformation("FindByPath {0}", path);
|
//_logger.LogInformation("FindByPath {0}", path);
|
||||||
|
@ -921,7 +914,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
{
|
{
|
||||||
if (value <= 0)
|
if (value <= 0)
|
||||||
{
|
{
|
||||||
throw new ArgumentOutOfRangeException("Years less than or equal to 0 are invalid.");
|
throw new ArgumentOutOfRangeException(nameof(value),"Years less than or equal to 0 are invalid.");
|
||||||
}
|
}
|
||||||
|
|
||||||
var name = value.ToString(CultureInfo.InvariantCulture);
|
var name = value.ToString(CultureInfo.InvariantCulture);
|
||||||
|
@ -1249,7 +1242,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
{
|
{
|
||||||
if (id.Equals(Guid.Empty))
|
if (id.Equals(Guid.Empty))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("id");
|
throw new ArgumentNullException(nameof(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseItem item;
|
BaseItem item;
|
||||||
|
@ -1828,7 +1821,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
/// Creates the item.
|
/// Creates the item.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="item">The item.</param>
|
/// <param name="item">The item.</param>
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="parent">The parent item.</param>
|
||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
public void CreateItem(BaseItem item, BaseItem parent)
|
public void CreateItem(BaseItem item, BaseItem parent)
|
||||||
{
|
{
|
||||||
|
@ -2023,7 +2016,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
return GetCollectionFoldersInternal(item, allUserRootChildren);
|
return GetCollectionFoldersInternal(item, allUserRootChildren);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Folder> GetCollectionFoldersInternal(BaseItem item, List<Folder> allUserRootChildren)
|
private static List<Folder> GetCollectionFoldersInternal(BaseItem item, List<Folder> allUserRootChildren)
|
||||||
{
|
{
|
||||||
return allUserRootChildren
|
return allUserRootChildren
|
||||||
.Where(i => string.Equals(i.Path, item.Path, StringComparison.OrdinalIgnoreCase) || i.PhysicalLocations.Contains(item.Path, StringComparer.OrdinalIgnoreCase))
|
.Where(i => string.Equals(i.Path, item.Path, StringComparison.OrdinalIgnoreCase) || i.PhysicalLocations.Contains(item.Path, StringComparer.OrdinalIgnoreCase))
|
||||||
|
@ -2247,7 +2240,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
{
|
{
|
||||||
if (parent == null)
|
if (parent == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("parent");
|
throw new ArgumentNullException(nameof(parent));
|
||||||
}
|
}
|
||||||
|
|
||||||
var name = parent.Name;
|
var name = parent.Name;
|
||||||
|
@ -2313,7 +2306,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(name))
|
if (string.IsNullOrEmpty(name))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("name");
|
throw new ArgumentNullException(nameof(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
var parentIdString = parentId.Equals(Guid.Empty) ? null : parentId.ToString("N");
|
var parentIdString = parentId.Equals(Guid.Empty) ? null : parentId.ToString("N");
|
||||||
|
@ -2708,15 +2701,15 @@ namespace Emby.Server.Implementations.Library
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(path))
|
if (string.IsNullOrWhiteSpace(path))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("path");
|
throw new ArgumentNullException(nameof(path));
|
||||||
}
|
}
|
||||||
if (string.IsNullOrWhiteSpace(from))
|
if (string.IsNullOrWhiteSpace(from))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("from");
|
throw new ArgumentNullException(nameof(from));
|
||||||
}
|
}
|
||||||
if (string.IsNullOrWhiteSpace(to))
|
if (string.IsNullOrWhiteSpace(to))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("to");
|
throw new ArgumentNullException(nameof(to));
|
||||||
}
|
}
|
||||||
|
|
||||||
from = from.Trim();
|
from = from.Trim();
|
||||||
|
@ -2864,7 +2857,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(name))
|
if (string.IsNullOrWhiteSpace(name))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("name");
|
throw new ArgumentNullException(nameof(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
name = _fileSystem.GetValidFilename(name);
|
name = _fileSystem.GetValidFilename(name);
|
||||||
|
@ -2937,7 +2930,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ValidateNetworkPath(string path)
|
private static bool ValidateNetworkPath(string path)
|
||||||
{
|
{
|
||||||
//if (Environment.OSVersion.Platform == PlatformID.Win32NT)
|
//if (Environment.OSVersion.Platform == PlatformID.Win32NT)
|
||||||
//{
|
//{
|
||||||
|
@ -2962,14 +2955,14 @@ namespace Emby.Server.Implementations.Library
|
||||||
{
|
{
|
||||||
if (pathInfo == null)
|
if (pathInfo == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("path");
|
throw new ArgumentNullException(nameof(pathInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
var path = pathInfo.Path;
|
var path = pathInfo.Path;
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(path))
|
if (string.IsNullOrWhiteSpace(path))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("path");
|
throw new ArgumentNullException(nameof(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_fileSystem.DirectoryExists(path))
|
if (!_fileSystem.DirectoryExists(path))
|
||||||
|
@ -3017,7 +3010,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
{
|
{
|
||||||
if (pathInfo == null)
|
if (pathInfo == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("path");
|
throw new ArgumentNullException(nameof(pathInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(pathInfo.NetworkPath) && !ValidateNetworkPath(pathInfo.NetworkPath))
|
if (!string.IsNullOrWhiteSpace(pathInfo.NetworkPath) && !ValidateNetworkPath(pathInfo.NetworkPath))
|
||||||
|
@ -3075,7 +3068,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(name))
|
if (string.IsNullOrWhiteSpace(name))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("name");
|
throw new ArgumentNullException(nameof(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
var rootFolderPath = ConfigurationManager.ApplicationPaths.DefaultUserViewsPath;
|
var rootFolderPath = ConfigurationManager.ApplicationPaths.DefaultUserViewsPath;
|
||||||
|
@ -3116,7 +3109,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(path))
|
if (string.IsNullOrWhiteSpace(path))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("path");
|
throw new ArgumentNullException(nameof(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
var removeList = new List<NameValuePair>();
|
var removeList = new List<NameValuePair>();
|
||||||
|
@ -3148,7 +3141,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(mediaPath))
|
if (string.IsNullOrEmpty(mediaPath))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("mediaPath");
|
throw new ArgumentNullException(nameof(mediaPath));
|
||||||
}
|
}
|
||||||
|
|
||||||
var rootFolderPath = ConfigurationManager.ApplicationPaths.DefaultUserViewsPath;
|
var rootFolderPath = ConfigurationManager.ApplicationPaths.DefaultUserViewsPath;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using MediaBrowser.Common.Extensions;
|
using MediaBrowser.Common.Extensions;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Entities.Audio;
|
using MediaBrowser.Controller.Entities.Audio;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
|
@ -74,7 +74,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool StreamSupportsExternalStream(MediaStream stream)
|
private static bool StreamSupportsExternalStream(MediaStream stream)
|
||||||
{
|
{
|
||||||
if (stream.IsExternal)
|
if (stream.IsExternal)
|
||||||
{
|
{
|
||||||
|
@ -261,7 +261,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetKeyProperties(IMediaSourceProvider provider, MediaSourceInfo mediaSource)
|
private static void SetKeyProperties(IMediaSourceProvider provider, MediaSourceInfo mediaSource)
|
||||||
{
|
{
|
||||||
var prefix = provider.GetType().FullName.GetMD5().ToString("N") + LiveStreamIdDelimeter;
|
var prefix = provider.GetType().FullName.GetMD5().ToString("N") + LiveStreamIdDelimeter;
|
||||||
|
|
||||||
|
@ -292,7 +292,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
{
|
{
|
||||||
if (item == null)
|
if (item == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("item");
|
throw new ArgumentNullException(nameof(item));
|
||||||
}
|
}
|
||||||
|
|
||||||
var hasMediaSources = (IHasMediaSources)item;
|
var hasMediaSources = (IHasMediaSources)item;
|
||||||
|
@ -401,7 +401,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<MediaSourceInfo> SortMediaSources(IEnumerable<MediaSourceInfo> sources)
|
private static IEnumerable<MediaSourceInfo> SortMediaSources(IEnumerable<MediaSourceInfo> sources)
|
||||||
{
|
{
|
||||||
return sources.OrderBy(i =>
|
return sources.OrderBy(i =>
|
||||||
{
|
{
|
||||||
|
@ -501,7 +501,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
}, liveStream as IDirectStreamProvider);
|
}, liveStream as IDirectStreamProvider);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddMediaInfo(MediaSourceInfo mediaSource, bool isAudio)
|
private static void AddMediaInfo(MediaSourceInfo mediaSource, bool isAudio)
|
||||||
{
|
{
|
||||||
mediaSource.DefaultSubtitleStreamIndex = null;
|
mediaSource.DefaultSubtitleStreamIndex = null;
|
||||||
|
|
||||||
|
@ -629,6 +629,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
_logger.LogDebug(ex, "_jsonSerializer.DeserializeFromFile threw an exception.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -759,7 +760,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(id))
|
if (string.IsNullOrEmpty(id))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("id");
|
throw new ArgumentNullException(nameof(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
var info = await GetLiveStreamInfo(id, cancellationToken).ConfigureAwait(false);
|
var info = await GetLiveStreamInfo(id, cancellationToken).ConfigureAwait(false);
|
||||||
|
@ -770,7 +771,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(id))
|
if (string.IsNullOrEmpty(id))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("id");
|
throw new ArgumentNullException(nameof(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
await _liveStreamSemaphore.WaitAsync(cancellationToken).ConfigureAwait(false);
|
await _liveStreamSemaphore.WaitAsync(cancellationToken).ConfigureAwait(false);
|
||||||
|
@ -803,7 +804,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(id))
|
if (string.IsNullOrEmpty(id))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("id");
|
throw new ArgumentNullException(nameof(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
await _liveStreamSemaphore.WaitAsync().ConfigureAwait(false);
|
await _liveStreamSemaphore.WaitAsync().ConfigureAwait(false);
|
||||||
|
|
|
@ -16,12 +16,12 @@ namespace Emby.Server.Implementations.Library
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(str))
|
if (string.IsNullOrEmpty(str))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("str");
|
throw new ArgumentNullException(nameof(str));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(attrib))
|
if (string.IsNullOrEmpty(attrib))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("attrib");
|
throw new ArgumentNullException(nameof(attrib));
|
||||||
}
|
}
|
||||||
|
|
||||||
string srch = "[" + attrib + "=";
|
string srch = "[" + attrib + "=";
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue