aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.drone.yml28
-rw-r--r--Emby.Server.Implementations/ApplicationHost.cs112
-rw-r--r--Emby.Server.Implementations/Library/MediaSourceManager.cs4
-rw-r--r--Emby.Server.Implementations/Session/FirebaseSessionController.cs131
-rw-r--r--Emby.Server.Implementations/Session/SessionManager.cs13
-rw-r--r--Emby.Server.Implementations/Udp/UdpServer.cs1
-rw-r--r--MediaBrowser.Common/IApplicationHost.cs2
-rw-r--r--MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs13
-rw-r--r--MediaBrowser.Model/Session/ClientCapabilities.cs3
-rw-r--r--MediaBrowser.Providers/Music/MusicBrainzAlbumProvider.cs84
-rw-r--r--MediaBrowser.Providers/Omdb/OmdbProvider.cs16
-rw-r--r--MediaBrowser.sln4
12 files changed, 40 insertions, 371 deletions
diff --git a/.drone.yml b/.drone.yml
index 13762ba0a..c6d41b555 100644
--- a/.drone.yml
+++ b/.drone.yml
@@ -1,32 +1,12 @@
kind: pipeline
-name: build:debian
+name: build
steps:
- name: submodules
image: docker:git
commands:
- git submodule update --init --recursive
-- name: build:debian
- image: plugins/docker
- group: build
- settings:
- repo: jellyfin/jellyfin
- dry_run: true
- dockerfile: Dockerfile.debian_package
-
-
----
-kind: pipeline
-name: build:docker
-
-steps:
-- name: submodules
- image: docker:git
+- name: build
+ image: microsoft/dotnet:2-sdk
commands:
- - git submodule update --init --recursive
-- name: build:docker
- image: plugins/docker
- group: build
- settings:
- repo: jellyfin/jellyfin
- dry_run: true
+ - dotnet publish --configuration release --output /release
diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs
index 236851968..9b9c6146f 100644
--- a/Emby.Server.Implementations/ApplicationHost.cs
+++ b/Emby.Server.Implementations/ApplicationHost.cs
@@ -421,8 +421,6 @@ namespace Emby.Server.Implementations
ImageEncoder = imageEncoder;
- //SetBaseExceptionMessage();
-
fileSystem.AddShortcutHandler(new MbLinkShortcutHandler(fileSystem));
NetworkManager.NetworkChanged += NetworkManager_NetworkChanged;
@@ -687,18 +685,6 @@ namespace Emby.Server.Implementations
return parts;
}
- // TODO: @bond
- /*
- private void SetBaseExceptionMessage()
- {
- var builder = GetBaseExceptionMessage(ApplicationPaths);
-
- builder.Insert(0, string.Format("Version: {0}{1}", ApplicationVersion, Environment.NewLine));
- builder.Insert(0, "*** Error Report ***" + Environment.NewLine);
-
- LoggerFactory.ExceptionMessagePrefix = builder.ToString();
- }*/
-
/// <summary>
/// Runs the startup tasks.
/// </summary>
@@ -734,8 +720,6 @@ namespace Emby.Server.Implementations
RunEntryPoints(entryPoints, false);
Logger.LogInformation("All entry points have started");
- //LoggerFactory.RemoveConsoleOutput();
-
return Task.CompletedTask;
}
@@ -749,7 +733,7 @@ namespace Emby.Server.Implementations
}
var name = entryPoint.GetType().FullName;
- Logger.LogInformation("Starting entry point {0}", name);
+ Logger.LogInformation("Starting entry point {Name}", name);
var now = DateTime.UtcNow;
try
{
@@ -757,9 +741,9 @@ namespace Emby.Server.Implementations
}
catch (Exception ex)
{
- Logger.LogError(ex, "Error in {name}", name);
+ Logger.LogError(ex, "Error while running entrypoint {Name}", name);
}
- Logger.LogInformation("Entry point completed: {0}. Duration: {1} seconds", name, (DateTime.UtcNow - now).TotalSeconds.ToString(CultureInfo.InvariantCulture), "ImageInfos");
+ Logger.LogInformation("Entry point completed: {Name}. Duration: {Duration} seconds", name, (DateTime.UtcNow - now).TotalSeconds.ToString(CultureInfo.InvariantCulture), "ImageInfos");
}
}
@@ -1310,7 +1294,6 @@ namespace Emby.Server.Implementations
{
if (!ServerConfigurationManager.Configuration.IsPortAuthorized)
{
- RegisterServerWithAdministratorAccess();
ServerConfigurationManager.Configuration.IsPortAuthorized = true;
ConfigurationManager.SaveConfiguration();
}
@@ -1381,12 +1364,11 @@ namespace Emby.Server.Implementations
}
catch (Exception ex)
{
- Logger.LogError(ex, "Error getting plugin Id from {pluginName}.", plugin.GetType().FullName);
+ Logger.LogError(ex, "Error getting plugin Id from {PluginName}.", plugin.GetType().FullName);
}
}
- var hasPluginConfiguration = plugin as IHasPluginConfiguration;
- if (hasPluginConfiguration != null)
+ if (plugin is IHasPluginConfiguration hasPluginConfiguration)
{
hasPluginConfiguration.SetStartupInfo(s => Directory.CreateDirectory(s));
}
@@ -1805,13 +1787,13 @@ namespace Emby.Server.Implementations
{
var result = Version.Parse(FileVersionInfo.GetVersionInfo(path).FileVersion);
- Logger.LogInformation("File {0} has version {1}", path, result);
+ Logger.LogInformation("File {Path} has version {Version}", path, result);
return result;
}
catch (Exception ex)
{
- Logger.LogError(ex, "Error getting version number from {path}", path);
+ Logger.LogError(ex, "Error getting version number from {Path}", path);
return new Version(1, 0);
}
@@ -2225,32 +2207,6 @@ namespace Emby.Server.Implementations
protected abstract void ShutdownInternal();
- /// <summary>
- /// Registers the server with administrator access.
- /// </summary>
- private void RegisterServerWithAdministratorAccess()
- {
- Logger.LogInformation("Requesting administrative access to authorize http server");
-
- try
- {
- AuthorizeServer();
- }
- catch (NotImplementedException)
- {
-
- }
- catch (Exception ex)
- {
- Logger.LogError(ex, "Error authorizing server");
- }
- }
-
- protected virtual void AuthorizeServer()
- {
- throw new NotImplementedException();
- }
-
public event EventHandler HasUpdateAvailableChanged;
private bool _hasUpdateAvailable;
@@ -2413,15 +2369,14 @@ namespace Emby.Server.Implementations
{
var type = GetType();
- //LoggerFactory.AddConsoleOutput();
- Logger.LogInformation("Disposing " + type.Name);
+ Logger.LogInformation("Disposing {Type}", type.Name);
var parts = DisposableParts.Distinct().Where(i => i.GetType() != type).ToList();
DisposableParts.Clear();
foreach (var part in parts)
{
- Logger.LogInformation("Disposing " + part.GetType().Name);
+ Logger.LogInformation("Disposing {Type}", part.GetType().Name);
try
{
@@ -2429,57 +2384,10 @@ namespace Emby.Server.Implementations
}
catch (Exception ex)
{
- Logger.LogError(ex, "Error disposing {0}", part.GetType().Name);
- }
- }
- }
- }
-
- private Dictionary<string, string> _values;
- public string GetValue(string name)
- {
- if (_values == null)
- {
- _values = LoadValues();
- }
-
- string value;
-
- if (_values.TryGetValue(name, out value))
- {
- return value;
- }
-
- return null;
- }
-
- // TODO: @bond Remove?
- private Dictionary<string, string> LoadValues()
- {
- Dictionary<string, string> values = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
-
- using (var stream = typeof(ApplicationHost).Assembly.GetManifestResourceStream(typeof(ApplicationHost).Namespace + ".values.txt"))
- {
- using (var reader = new StreamReader(stream))
- {
- while (!reader.EndOfStream)
- {
- var line = reader.ReadLine();
- if (string.IsNullOrEmpty(line))
- {
- continue;
- }
-
- var index = line.IndexOf('=');
- if (index != -1)
- {
- values[line.Substring(0, index)] = line.Substring(index + 1);
- }
+ Logger.LogError(ex, "Error disposing {Type}", part.GetType().Name);
}
}
}
-
- return values;
}
}
diff --git a/Emby.Server.Implementations/Library/MediaSourceManager.cs b/Emby.Server.Implementations/Library/MediaSourceManager.cs
index e5fd28997..ddda4b2c3 100644
--- a/Emby.Server.Implementations/Library/MediaSourceManager.cs
+++ b/Emby.Server.Implementations/Library/MediaSourceManager.cs
@@ -160,9 +160,9 @@ namespace Emby.Server.Implementations.Library
list.Add(source);
}
- foreach (var source in list)
+ if (user != null)
{
- if (user != null)
+ foreach (var source in list)
{
if (string.Equals(item.MediaType, MediaType.Audio, StringComparison.OrdinalIgnoreCase))
{
diff --git a/Emby.Server.Implementations/Session/FirebaseSessionController.cs b/Emby.Server.Implementations/Session/FirebaseSessionController.cs
deleted file mode 100644
index cfe513305..000000000
--- a/Emby.Server.Implementations/Session/FirebaseSessionController.cs
+++ /dev/null
@@ -1,131 +0,0 @@
-using MediaBrowser.Controller.Session;
-using MediaBrowser.Model.Net;
-using MediaBrowser.Common.Net;
-using MediaBrowser.Model.Serialization;
-using System;
-using System.Threading;
-using System.Threading.Tasks;
-using System.Text;
-using MediaBrowser.Common;
-
-namespace Emby.Server.Implementations.Session
-{
- public class FirebaseSessionController : ISessionController
- {
- private readonly IHttpClient _httpClient;
- private readonly IJsonSerializer _json;
- private readonly ISessionManager _sessionManager;
-
- public SessionInfo Session { get; private set; }
-
- private readonly string _token;
-
- private IApplicationHost _appHost;
- private string _senderId;
- private string _applicationId;
-
- public FirebaseSessionController(IHttpClient httpClient,
- IApplicationHost appHost,
- IJsonSerializer json,
- SessionInfo session,
- string token, ISessionManager sessionManager)
- {
- _httpClient = httpClient;
- _json = json;
- _appHost = appHost;
- Session = session;
- _token = token;
- _sessionManager = sessionManager;
-
- _applicationId = _appHost.GetValue("firebase_applicationid");
- _senderId = _appHost.GetValue("firebase_senderid");
- }
-
- public static bool IsSupported(IApplicationHost appHost)
- {
- return !string.IsNullOrEmpty(appHost.GetValue("firebase_applicationid")) && !string.IsNullOrEmpty(appHost.GetValue("firebase_senderid"));
- }
-
- public bool IsSessionActive
- {
- get
- {
- return (DateTime.UtcNow - Session.LastActivityDate).TotalDays <= 3;
- }
- }
-
- public bool SupportsMediaControl
- {
- get { return true; }
- }
-
- public async Task SendMessage<T>(string name, string messageId, T data, ISessionController[] allControllers, CancellationToken cancellationToken)
- {
- if (!IsSessionActive)
- {
- return;
- }
-
- if (string.IsNullOrEmpty(_senderId) || string.IsNullOrEmpty(_applicationId))
- {
- return;
- }
-
- foreach (var controller in allControllers)
- {
- // Don't send if there's an active web socket connection
- if ((controller is WebSocketController) && controller.IsSessionActive)
- {
- return;
- }
- }
-
- var msg = new WebSocketMessage<T>
- {
- Data = data,
- MessageType = name,
- MessageId = messageId,
- ServerId = _appHost.SystemId
- };
-
- var req = new FirebaseBody<T>
- {
- to = _token,
- data = msg
- };
-
- var byteArray = Encoding.UTF8.GetBytes(_json.SerializeToString(req));
-
- var enableLogging = false;
-
-#if DEBUG
- enableLogging = true;
-#endif
-
- var options = new HttpRequestOptions
- {
- Url = "https://fcm.googleapis.com/fcm/send",
- RequestContentType = "application/json",
- RequestContentBytes = byteArray,
- CancellationToken = cancellationToken,
- LogRequest = enableLogging,
- LogResponse = enableLogging,
- LogErrors = enableLogging
- };
-
- options.RequestHeaders["Authorization"] = string.Format("key={0}", _applicationId);
- options.RequestHeaders["Sender"] = string.Format("id={0}", _senderId);
-
- using (var response = await _httpClient.Post(options).ConfigureAwait(false))
- {
-
- }
- }
- }
-
- internal class FirebaseBody<T>
- {
- public string to { get; set; }
- public WebSocketMessage<T> data { get; set; }
- }
-}
diff --git a/Emby.Server.Implementations/Session/SessionManager.cs b/Emby.Server.Implementations/Session/SessionManager.cs
index 419c24f13..7321e9f86 100644
--- a/Emby.Server.Implementations/Session/SessionManager.cs
+++ b/Emby.Server.Implementations/Session/SessionManager.cs
@@ -1574,14 +1574,6 @@ namespace Emby.Server.Implementations.Session
{
session.Capabilities = capabilities;
- if (!string.IsNullOrEmpty(capabilities.PushToken))
- {
- if (string.Equals(capabilities.PushTokenType, "firebase", StringComparison.OrdinalIgnoreCase) && FirebaseSessionController.IsSupported(_appHost))
- {
- EnsureFirebaseController(session, capabilities.PushToken);
- }
- }
-
if (saveCapabilities)
{
CapabilitiesChanged?.Invoke(this, new SessionEventArgs
@@ -1600,11 +1592,6 @@ namespace Emby.Server.Implementations.Session
}
}
- private void EnsureFirebaseController(SessionInfo session, string token)
- {
- session.EnsureController<FirebaseSessionController>(s => new FirebaseSessionController(_httpClient, _appHost, _jsonSerializer, s, token, this));
- }
-
private ClientCapabilities GetSavedCapabilities(string deviceId)
{
return _deviceManager.GetCapabilities(deviceId);
diff --git a/Emby.Server.Implementations/Udp/UdpServer.cs b/Emby.Server.Implementations/Udp/UdpServer.cs
index 8cacc1124..275bd83ea 100644
--- a/Emby.Server.Implementations/Udp/UdpServer.cs
+++ b/Emby.Server.Implementations/Udp/UdpServer.cs
@@ -40,6 +40,7 @@ namespace Emby.Server.Implementations.Udp
_json = json;
_socketFactory = socketFactory;
+ AddMessageResponder("who is JellyfinServer?", true, RespondToV2Message);
AddMessageResponder("who is EmbyServer?", true, RespondToV2Message);
AddMessageResponder("who is MediaBrowserServer_v2?", false, RespondToV2Message);
}
diff --git a/MediaBrowser.Common/IApplicationHost.cs b/MediaBrowser.Common/IApplicationHost.cs
index 39d69ea15..c4f760b15 100644
--- a/MediaBrowser.Common/IApplicationHost.cs
+++ b/MediaBrowser.Common/IApplicationHost.cs
@@ -135,7 +135,5 @@ namespace MediaBrowser.Common
object CreateInstance(Type type);
PackageVersionClass SystemUpdateLevel { get; }
-
- string GetValue(string name);
}
}
diff --git a/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs b/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs
index 43f775392..a1dc9b7d4 100644
--- a/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs
+++ b/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs
@@ -37,7 +37,17 @@ namespace MediaBrowser.MediaEncoding.Subtitles
private readonly IProcessFactory _processFactory;
private readonly ITextEncoding _textEncoding;
- public SubtitleEncoder(ILibraryManager libraryManager, ILogger logger, IApplicationPaths appPaths, IFileSystem fileSystem, IMediaEncoder mediaEncoder, IJsonSerializer json, IHttpClient httpClient, IMediaSourceManager mediaSourceManager, IProcessFactory processFactory, ITextEncoding textEncoding)
+ public SubtitleEncoder(
+ ILibraryManager libraryManager,
+ ILogger logger,
+ IApplicationPaths appPaths,
+ IFileSystem fileSystem,
+ IMediaEncoder mediaEncoder,
+ IJsonSerializer json,
+ IHttpClient httpClient,
+ IMediaSourceManager mediaSourceManager,
+ IProcessFactory processFactory,
+ ITextEncoding textEncoding)
{
_libraryManager = libraryManager;
_logger = logger;
@@ -46,6 +56,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
_mediaEncoder = mediaEncoder;
_json = json;
_httpClient = httpClient;
+ _mediaSourceManager = mediaSourceManager;
_processFactory = processFactory;
_textEncoding = textEncoding;
}
diff --git a/MediaBrowser.Model/Session/ClientCapabilities.cs b/MediaBrowser.Model/Session/ClientCapabilities.cs
index ded4c0e84..0682ac35e 100644
--- a/MediaBrowser.Model/Session/ClientCapabilities.cs
+++ b/MediaBrowser.Model/Session/ClientCapabilities.cs
@@ -1,5 +1,4 @@
using MediaBrowser.Model.Dlna;
-using System;
namespace MediaBrowser.Model.Session
{
@@ -12,8 +11,6 @@ namespace MediaBrowser.Model.Session
public bool SupportsMediaControl { get; set; }
public bool SupportsContentUploading { get; set; }
public string MessageCallbackUrl { get; set; }
- public string PushToken { get; set; }
- public string PushTokenType { get; set; }
public bool SupportsPersistentIdentifier { get; set; }
public bool SupportsSync { get; set; }
diff --git a/MediaBrowser.Providers/Music/MusicBrainzAlbumProvider.cs b/MediaBrowser.Providers/Music/MusicBrainzAlbumProvider.cs
index 0dbc43313..2c94d6a07 100644
--- a/MediaBrowser.Providers/Music/MusicBrainzAlbumProvider.cs
+++ b/MediaBrowser.Providers/Music/MusicBrainzAlbumProvider.cs
@@ -720,82 +720,6 @@ namespace MediaBrowser.Providers.Music
return null;
}
- private long _lastMbzUrlQueryTicks = 0;
- private List<MbzUrl> _mbzUrls = null;
- private MbzUrl _chosenUrl;
-
- private async Task<MbzUrl> GetMbzUrl(bool forceMusicBrainzProper = false)
- {
- if (_chosenUrl == null || _mbzUrls == null || (DateTime.UtcNow.Ticks - _lastMbzUrlQueryTicks) > TimeSpan.FromHours(12).Ticks)
- {
- var urls = await RefreshMzbUrls(forceMusicBrainzProper).ConfigureAwait(false);
-
- if (urls.Count > 1)
- {
- _chosenUrl = urls[new Random().Next(0, urls.Count)];
- }
- else
- {
- _chosenUrl = urls[0];
- }
- }
-
- return _chosenUrl;
- }
-
- private async Task<List<MbzUrl>> RefreshMzbUrls(bool forceMusicBrainzProper = false)
- {
- List<MbzUrl> list = null;
-
- if (!forceMusicBrainzProper)
- {
- var musicbrainzadminurl = _appHost.GetValue("musicbrainzadminurl");
-
- if (!string.IsNullOrEmpty(musicbrainzadminurl))
- {
- try
- {
- var options = new HttpRequestOptions
- {
- Url = musicbrainzadminurl,
- UserAgent = _appHost.Name + "/" + _appHost.ApplicationVersion
- };
-
- using (var response = await _httpClient.SendAsync(options, "GET").ConfigureAwait(false))
- {
- using (var stream = response.Content)
- {
- var results = await _json.DeserializeFromStreamAsync<List<MbzUrl>>(stream).ConfigureAwait(false);
-
- list = results;
- }
- }
- _lastMbzUrlQueryTicks = DateTime.UtcNow.Ticks;
- }
- catch (Exception ex)
- {
- _logger.LogError(ex, "Error getting music brainz info");
- }
- }
- }
-
- if (list == null)
- {
- list = new List<MbzUrl>
- {
- new MbzUrl
- {
- url = MusicBrainzBaseUrl,
- throttleMs = 1000
- }
- };
- }
-
- _mbzUrls = list.ToList();
-
- return list;
- }
-
internal Task<HttpResponseInfo> GetMusicBrainzResponse(string url, bool isSearch, CancellationToken cancellationToken)
{
return GetMusicBrainzResponse(url, isSearch, false, cancellationToken);
@@ -806,7 +730,7 @@ namespace MediaBrowser.Providers.Music
/// </summary>
internal async Task<HttpResponseInfo> GetMusicBrainzResponse(string url, bool isSearch, bool forceMusicBrainzProper, CancellationToken cancellationToken)
{
- var urlInfo = await GetMbzUrl(forceMusicBrainzProper).ConfigureAwait(false);
+ var urlInfo = new MbzUrl(MusicBrainzBaseUrl, 1000);
var throttleMs = urlInfo.throttleMs;
if (throttleMs > 0)
@@ -841,6 +765,12 @@ namespace MediaBrowser.Providers.Music
internal class MbzUrl
{
+ internal MbzUrl(string url, int throttleMs)
+ {
+ this.url = url;
+ this.throttleMs = throttleMs;
+ }
+
public string url { get; set; }
public int throttleMs { get; set; }
}
diff --git a/MediaBrowser.Providers/Omdb/OmdbProvider.cs b/MediaBrowser.Providers/Omdb/OmdbProvider.cs
index 5c4eb62a8..bb4624b5c 100644
--- a/MediaBrowser.Providers/Omdb/OmdbProvider.cs
+++ b/MediaBrowser.Providers/Omdb/OmdbProvider.cs
@@ -270,21 +270,13 @@ namespace MediaBrowser.Providers.Omdb
public static string GetOmdbUrl(string query, IApplicationHost appHost, CancellationToken cancellationToken)
{
- var baseUrl = appHost.GetValue("omdb_baseurl");
+ const string url = "https://www.omdbapi.com?apikey=fe53f97e";
- if (string.IsNullOrEmpty(baseUrl))
+ if (string.IsNullOrWhiteSpace(query))
{
- baseUrl = "https://www.omdbapi.com";
+ return url;
}
-
- var url = baseUrl + "?apikey=fe53f97e";
-
- if (!string.IsNullOrWhiteSpace(query))
- {
- url += "&" + query;
- }
-
- return url;
+ return url + "&" + query;
}
private async Task<string> EnsureItemInfo(string imdbId, CancellationToken cancellationToken)
diff --git a/MediaBrowser.sln b/MediaBrowser.sln
index dfc3b253e..13d1e26db 100644
--- a/MediaBrowser.sln
+++ b/MediaBrowser.sln
@@ -150,10 +150,6 @@ Global
{E5AF7B26-2239-4CE0-B477-0AA2018EDAA2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E5AF7B26-2239-4CE0-B477-0AA2018EDAA2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E5AF7B26-2239-4CE0-B477-0AA2018EDAA2}.Release|Any CPU.Build.0 = Release|Any CPU
- {D45FC504-D06B-41A0-A220-C20B7E8F1304}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {D45FC504-D06B-41A0-A220-C20B7E8F1304}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {D45FC504-D06B-41A0-A220-C20B7E8F1304}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {D45FC504-D06B-41A0-A220-C20B7E8F1304}.Release|Any CPU.Build.0 = Release|Any CPU
{6EAFA7F0-8A82-49E6-B2FA-086C5CAEA95B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6EAFA7F0-8A82-49E6-B2FA-086C5CAEA95B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6EAFA7F0-8A82-49E6-B2FA-086C5CAEA95B}.Release|Any CPU.ActiveCfg = Release|Any CPU