mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
fix mac ffmpeg build
This commit is contained in:
parent
3be25f8bfb
commit
c05cb1dcb1
@ -1,4 +1,5 @@
|
|||||||
using MediaBrowser.Common.Configuration;
|
using MediaBrowser.Common.Configuration;
|
||||||
|
using MediaBrowser.Common.Extensions;
|
||||||
using MediaBrowser.Common.IO;
|
using MediaBrowser.Common.IO;
|
||||||
using MediaBrowser.Common.Net;
|
using MediaBrowser.Common.Net;
|
||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
@ -156,6 +157,20 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The _semaphoreLocks
|
||||||
|
/// </summary>
|
||||||
|
private readonly ConcurrentDictionary<string, SemaphoreSlim> _semaphoreLocks = new ConcurrentDictionary<string, SemaphoreSlim>(StringComparer.OrdinalIgnoreCase);
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the lock.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="url">The filename.</param>
|
||||||
|
/// <returns>System.Object.</returns>
|
||||||
|
private SemaphoreSlim GetLock(string url)
|
||||||
|
{
|
||||||
|
return _semaphoreLocks.GetOrAdd(url, key => new SemaphoreSlim(1, 1));
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the response internal.
|
/// Gets the response internal.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -215,6 +230,107 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager
|
|||||||
/// <exception cref="HttpException">
|
/// <exception cref="HttpException">
|
||||||
/// </exception>
|
/// </exception>
|
||||||
public async Task<HttpResponseInfo> SendAsync(HttpRequestOptions options, string httpMethod)
|
public async Task<HttpResponseInfo> SendAsync(HttpRequestOptions options, string httpMethod)
|
||||||
|
{
|
||||||
|
if (!options.EnableUnconditionalCache)
|
||||||
|
{
|
||||||
|
return await SendAsyncInternal(options, httpMethod).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
var url = options.Url;
|
||||||
|
var urlHash = url.ToLower().GetMD5().ToString("N");
|
||||||
|
var semaphore = GetLock(url);
|
||||||
|
|
||||||
|
var responseCachePath = Path.Combine(_appPaths.CachePath, "httpclient", urlHash);
|
||||||
|
|
||||||
|
var response = await GetCachedResponse(responseCachePath, options.CacheLength, url).ConfigureAwait(false);
|
||||||
|
if (response != null)
|
||||||
|
{
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
await semaphore.WaitAsync(options.CancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
response = await GetCachedResponse(responseCachePath, options.CacheLength, url).ConfigureAwait(false);
|
||||||
|
if (response != null)
|
||||||
|
{
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
response = await SendAsyncInternal(options, httpMethod).ConfigureAwait(false);
|
||||||
|
|
||||||
|
if (response.StatusCode == HttpStatusCode.OK)
|
||||||
|
{
|
||||||
|
await CacheResponse(response, responseCachePath).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
semaphore.Release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<HttpResponseInfo> GetCachedResponse(string responseCachePath, TimeSpan cacheLength, string url)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (_fileSystem.GetLastWriteTimeUtc(responseCachePath).Add(cacheLength) > DateTime.UtcNow)
|
||||||
|
{
|
||||||
|
using (var stream = _fileSystem.GetFileStream(responseCachePath, FileMode.Open, FileAccess.Read, FileShare.Read, true))
|
||||||
|
{
|
||||||
|
var memoryStream = new MemoryStream();
|
||||||
|
|
||||||
|
await stream.CopyToAsync(memoryStream).ConfigureAwait(false);
|
||||||
|
memoryStream.Position = 0;
|
||||||
|
|
||||||
|
return new HttpResponseInfo
|
||||||
|
{
|
||||||
|
ResponseUrl = url,
|
||||||
|
Content = memoryStream,
|
||||||
|
StatusCode = HttpStatusCode.OK,
|
||||||
|
Headers = new NameValueCollection(),
|
||||||
|
ContentLength = memoryStream.Length
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (FileNotFoundException)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (DirectoryNotFoundException)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task CacheResponse(HttpResponseInfo response, string responseCachePath)
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(Path.GetDirectoryName(responseCachePath));
|
||||||
|
|
||||||
|
using (var responseStream = response.Content)
|
||||||
|
{
|
||||||
|
using (var fileStream = _fileSystem.GetFileStream(responseCachePath, FileMode.Create, FileAccess.Write, FileShare.Read, true))
|
||||||
|
{
|
||||||
|
var memoryStream = new MemoryStream();
|
||||||
|
|
||||||
|
await responseStream.CopyToAsync(memoryStream).ConfigureAwait(false);
|
||||||
|
|
||||||
|
memoryStream.Position = 0;
|
||||||
|
await memoryStream.CopyToAsync(fileStream).ConfigureAwait(false);
|
||||||
|
|
||||||
|
memoryStream.Position = 0;
|
||||||
|
response.Content = memoryStream;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<HttpResponseInfo> SendAsyncInternal(HttpRequestOptions options, string httpMethod)
|
||||||
{
|
{
|
||||||
ValidateParams(options);
|
ValidateParams(options);
|
||||||
|
|
||||||
|
@ -91,6 +91,9 @@ namespace MediaBrowser.Common.Net
|
|||||||
public bool LogErrorResponseBody { get; set; }
|
public bool LogErrorResponseBody { get; set; }
|
||||||
public bool EnableKeepAlive { get; set; }
|
public bool EnableKeepAlive { get; set; }
|
||||||
|
|
||||||
|
public bool EnableUnconditionalCache { get; set; }
|
||||||
|
public TimeSpan CacheLength { get; set; }
|
||||||
|
|
||||||
private string GetHeaderValue(string name)
|
private string GetHeaderValue(string name)
|
||||||
{
|
{
|
||||||
string value;
|
string value;
|
||||||
|
@ -74,6 +74,7 @@ namespace MediaBrowser.Model.Channels
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The extra types.</value>
|
/// <value>The extra types.</value>
|
||||||
public ExtraType[] ExtraTypes { get; set; }
|
public ExtraType[] ExtraTypes { get; set; }
|
||||||
|
public TrailerType[] TrailerTypes { get; set; }
|
||||||
|
|
||||||
public AllChannelMediaQuery()
|
public AllChannelMediaQuery()
|
||||||
{
|
{
|
||||||
@ -81,6 +82,7 @@ namespace MediaBrowser.Model.Channels
|
|||||||
|
|
||||||
ContentTypes = new ChannelMediaContentType[] { };
|
ContentTypes = new ChannelMediaContentType[] { };
|
||||||
ExtraTypes = new ExtraType[] { };
|
ExtraTypes = new ExtraType[] { };
|
||||||
|
TrailerTypes = new TrailerType[] { };
|
||||||
|
|
||||||
Filters = new ItemFilter[] { };
|
Filters = new ItemFilter[] { };
|
||||||
Fields = new List<ItemFields>();
|
Fields = new List<ItemFields>();
|
||||||
|
@ -38,6 +38,7 @@ namespace MediaBrowser.Providers.Music
|
|||||||
var releaseId = searchInfo.GetReleaseId();
|
var releaseId = searchInfo.GetReleaseId();
|
||||||
|
|
||||||
string url = null;
|
string url = null;
|
||||||
|
var isNameSearch = false;
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(releaseId))
|
if (!string.IsNullOrEmpty(releaseId))
|
||||||
{
|
{
|
||||||
@ -55,6 +56,8 @@ namespace MediaBrowser.Providers.Music
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
isNameSearch = true;
|
||||||
|
|
||||||
url = string.Format("http://www.musicbrainz.org/ws/2/release/?query=\"{0}\" AND artist:\"{1}\"",
|
url = string.Format("http://www.musicbrainz.org/ws/2/release/?query=\"{0}\" AND artist:\"{1}\"",
|
||||||
WebUtility.UrlEncode(searchInfo.Name),
|
WebUtility.UrlEncode(searchInfo.Name),
|
||||||
WebUtility.UrlEncode(searchInfo.GetAlbumArtist()));
|
WebUtility.UrlEncode(searchInfo.GetAlbumArtist()));
|
||||||
@ -63,7 +66,7 @@ namespace MediaBrowser.Providers.Music
|
|||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(url))
|
if (!string.IsNullOrWhiteSpace(url))
|
||||||
{
|
{
|
||||||
var doc = await GetMusicBrainzResponse(url, cancellationToken).ConfigureAwait(false);
|
var doc = await GetMusicBrainzResponse(url, isNameSearch, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
return GetResultsFromResponse(doc);
|
return GetResultsFromResponse(doc);
|
||||||
}
|
}
|
||||||
@ -193,7 +196,7 @@ namespace MediaBrowser.Providers.Music
|
|||||||
WebUtility.UrlEncode(albumName),
|
WebUtility.UrlEncode(albumName),
|
||||||
artistId);
|
artistId);
|
||||||
|
|
||||||
var doc = await GetMusicBrainzResponse(url, cancellationToken).ConfigureAwait(false);
|
var doc = await GetMusicBrainzResponse(url, true, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
return GetReleaseResult(doc);
|
return GetReleaseResult(doc);
|
||||||
}
|
}
|
||||||
@ -204,7 +207,7 @@ namespace MediaBrowser.Providers.Music
|
|||||||
WebUtility.UrlEncode(albumName),
|
WebUtility.UrlEncode(albumName),
|
||||||
WebUtility.UrlEncode(artistName));
|
WebUtility.UrlEncode(artistName));
|
||||||
|
|
||||||
var doc = await GetMusicBrainzResponse(url, cancellationToken).ConfigureAwait(false);
|
var doc = await GetMusicBrainzResponse(url, true, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
return GetReleaseResult(doc);
|
return GetReleaseResult(doc);
|
||||||
}
|
}
|
||||||
@ -252,7 +255,7 @@ namespace MediaBrowser.Providers.Music
|
|||||||
{
|
{
|
||||||
var url = string.Format("http://www.musicbrainz.org/ws/2/release-group/?query=reid:{0}", releaseEntryId);
|
var url = string.Format("http://www.musicbrainz.org/ws/2/release-group/?query=reid:{0}", releaseEntryId);
|
||||||
|
|
||||||
var doc = await GetMusicBrainzResponse(url, cancellationToken).ConfigureAwait(false);
|
var doc = await GetMusicBrainzResponse(url, false, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
var ns = new XmlNamespaceManager(doc.NameTable);
|
var ns = new XmlNamespaceManager(doc.NameTable);
|
||||||
ns.AddNamespace("mb", "http://musicbrainz.org/ns/mmd-2.0#");
|
ns.AddNamespace("mb", "http://musicbrainz.org/ns/mmd-2.0#");
|
||||||
@ -274,9 +277,10 @@ namespace MediaBrowser.Providers.Music
|
|||||||
/// Gets the music brainz response.
|
/// Gets the music brainz response.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="url">The URL.</param>
|
/// <param name="url">The URL.</param>
|
||||||
|
/// <param name="isSearch">if set to <c>true</c> [is search].</param>
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
/// <returns>Task{XmlDocument}.</returns>
|
/// <returns>Task{XmlDocument}.</returns>
|
||||||
internal async Task<XmlDocument> GetMusicBrainzResponse(string url, CancellationToken cancellationToken)
|
internal async Task<XmlDocument> GetMusicBrainzResponse(string url, bool isSearch, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
await _musicBrainzResourcePool.WaitAsync(cancellationToken).ConfigureAwait(false);
|
await _musicBrainzResourcePool.WaitAsync(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
@ -294,15 +298,20 @@ namespace MediaBrowser.Providers.Music
|
|||||||
|
|
||||||
var doc = new XmlDocument();
|
var doc = new XmlDocument();
|
||||||
|
|
||||||
var userAgent = _appHost.Name + "/" + _appHost.ApplicationVersion;
|
var options = new HttpRequestOptions
|
||||||
|
|
||||||
using (var xml = await _httpClient.Get(new HttpRequestOptions
|
|
||||||
{
|
{
|
||||||
Url = url,
|
Url = url,
|
||||||
CancellationToken = cancellationToken,
|
CancellationToken = cancellationToken,
|
||||||
UserAgent = userAgent
|
UserAgent = _appHost.Name + "/" + _appHost.ApplicationVersion
|
||||||
|
};
|
||||||
|
|
||||||
}).ConfigureAwait(false))
|
if (!isSearch)
|
||||||
|
{
|
||||||
|
options.EnableUnconditionalCache = true;
|
||||||
|
options.CacheLength = TimeSpan.FromDays(7);
|
||||||
|
}
|
||||||
|
|
||||||
|
using (var xml = await _httpClient.Get(options).ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
using (var oReader = new StreamReader(xml, Encoding.UTF8))
|
using (var oReader = new StreamReader(xml, Encoding.UTF8))
|
||||||
{
|
{
|
||||||
|
@ -25,7 +25,7 @@ namespace MediaBrowser.Providers.Music
|
|||||||
{
|
{
|
||||||
var url = string.Format("http://www.musicbrainz.org/ws/2/artist/?query=arid:{0}", musicBrainzId);
|
var url = string.Format("http://www.musicbrainz.org/ws/2/artist/?query=arid:{0}", musicBrainzId);
|
||||||
|
|
||||||
var doc = await MusicBrainzAlbumProvider.Current.GetMusicBrainzResponse(url, cancellationToken)
|
var doc = await MusicBrainzAlbumProvider.Current.GetMusicBrainzResponse(url, false, cancellationToken)
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
return GetResultsFromResponse(doc);
|
return GetResultsFromResponse(doc);
|
||||||
@ -37,7 +37,7 @@ namespace MediaBrowser.Providers.Music
|
|||||||
|
|
||||||
var url = String.Format("http://www.musicbrainz.org/ws/2/artist/?query=artist:\"{0}\"", UrlEncode(nameToSearch));
|
var url = String.Format("http://www.musicbrainz.org/ws/2/artist/?query=artist:\"{0}\"", UrlEncode(nameToSearch));
|
||||||
|
|
||||||
var doc = await MusicBrainzAlbumProvider.Current.GetMusicBrainzResponse(url, cancellationToken).ConfigureAwait(false);
|
var doc = await MusicBrainzAlbumProvider.Current.GetMusicBrainzResponse(url, true, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
var results = GetResultsFromResponse(doc).ToList();
|
var results = GetResultsFromResponse(doc).ToList();
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ namespace MediaBrowser.Providers.Music
|
|||||||
// Try again using the search with accent characters url
|
// Try again using the search with accent characters url
|
||||||
url = String.Format("http://www.musicbrainz.org/ws/2/artist/?query=artistaccent:\"{0}\"", UrlEncode(nameToSearch));
|
url = String.Format("http://www.musicbrainz.org/ws/2/artist/?query=artistaccent:\"{0}\"", UrlEncode(nameToSearch));
|
||||||
|
|
||||||
doc = await MusicBrainzAlbumProvider.Current.GetMusicBrainzResponse(url, cancellationToken).ConfigureAwait(false);
|
doc = await MusicBrainzAlbumProvider.Current.GetMusicBrainzResponse(url, true, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
return GetResultsFromResponse(doc);
|
return GetResultsFromResponse(doc);
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,9 @@ namespace MediaBrowser.Providers.Omdb
|
|||||||
{
|
{
|
||||||
Url = url,
|
Url = url,
|
||||||
ResourcePool = ResourcePool,
|
ResourcePool = ResourcePool,
|
||||||
CancellationToken = cancellationToken
|
CancellationToken = cancellationToken,
|
||||||
|
EnableUnconditionalCache = true,
|
||||||
|
CacheLength = TimeSpan.FromDays(7)
|
||||||
|
|
||||||
}).ConfigureAwait(false))
|
}).ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
using System.Collections.Generic;
|
using MediaBrowser.Common.Progress;
|
||||||
using MediaBrowser.Common.Progress;
|
|
||||||
using MediaBrowser.Controller.Channels;
|
using MediaBrowser.Controller.Channels;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Model.Channels;
|
using MediaBrowser.Model.Channels;
|
||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@ -61,6 +61,7 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||||||
}, cancellationToken);
|
}, cancellationToken);
|
||||||
|
|
||||||
var numComplete = 0;
|
var numComplete = 0;
|
||||||
|
var numItems = channels.Items.Length;
|
||||||
|
|
||||||
foreach (var channel in channels.Items)
|
foreach (var channel in channels.Items)
|
||||||
{
|
{
|
||||||
@ -71,9 +72,20 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||||||
const int currentRefreshLevel = 1;
|
const int currentRefreshLevel = 1;
|
||||||
var maxRefreshLevel = features.AutoRefreshLevels ?? 1;
|
var maxRefreshLevel = features.AutoRefreshLevels ?? 1;
|
||||||
|
|
||||||
|
var innerProgress = new ActionableProgress<double>();
|
||||||
|
|
||||||
|
var startingNumberComplete = numComplete;
|
||||||
|
innerProgress.RegisterAction(p =>
|
||||||
|
{
|
||||||
|
double innerPercent = startingNumberComplete;
|
||||||
|
innerPercent += (p / 100);
|
||||||
|
innerPercent /= numItems;
|
||||||
|
progress.Report(innerPercent * 100);
|
||||||
|
});
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await GetAllItems(user, channelId, null, currentRefreshLevel, maxRefreshLevel, cancellationToken).ConfigureAwait(false);
|
await GetAllItems(user, channelId, null, currentRefreshLevel, maxRefreshLevel, innerProgress, cancellationToken).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -82,7 +94,7 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||||||
|
|
||||||
numComplete++;
|
numComplete++;
|
||||||
double percent = numComplete;
|
double percent = numComplete;
|
||||||
percent /= channels.Items.Length;
|
percent /= numItems;
|
||||||
progress.Report(percent * 100);
|
progress.Report(percent * 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,7 +102,7 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task GetAllItems(string user, string channelId, string folderId, int currentRefreshLevel, int maxRefreshLevel, CancellationToken cancellationToken)
|
private async Task GetAllItems(string user, string channelId, string folderId, int currentRefreshLevel, int maxRefreshLevel, IProgress<double> progress, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var folderItems = new List<string>();
|
var folderItems = new List<string>();
|
||||||
|
|
||||||
@ -130,7 +142,9 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await GetAllItems(user, channelId, folder, currentRefreshLevel + 1, maxRefreshLevel, cancellationToken).ConfigureAwait(false);
|
var innerProgress = new Progress<double>();
|
||||||
|
|
||||||
|
await GetAllItems(user, channelId, folder, currentRefreshLevel + 1, maxRefreshLevel, innerProgress, cancellationToken).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -63,16 +63,5 @@ namespace MediaBrowser.ServerApplication.Native
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Task<CheckForUpdateResult> CheckForApplicationUpdate(Version currentVersion,
|
|
||||||
PackageVersionClass updateLevel,
|
|
||||||
IInstallationManager installationManager,
|
|
||||||
CancellationToken cancellationToken,
|
|
||||||
IProgress<double> progress)
|
|
||||||
{
|
|
||||||
var result = new CheckForUpdateResult { AvailableVersion = currentVersion.ToString(), IsUpdateAvailable = false };
|
|
||||||
|
|
||||||
return Task.FromResult(result);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ namespace MediaBrowser.Server.Mono
|
|||||||
// Allow all https requests
|
// Allow all https requests
|
||||||
ServicePointManager.ServerCertificateValidationCallback = _ignoreCertificates;
|
ServicePointManager.ServerCertificateValidationCallback = _ignoreCertificates;
|
||||||
|
|
||||||
_appHost = new ApplicationHost(appPaths, logManager, false, false, options);
|
_appHost = new ApplicationHost(appPaths, logManager, false, false, options, "MBServer.Mono");
|
||||||
|
|
||||||
Console.WriteLine ("appHost.Init");
|
Console.WriteLine ("appHost.Init");
|
||||||
|
|
||||||
|
@ -219,7 +219,8 @@ namespace MediaBrowser.ServerApplication
|
|||||||
private ISyncRepository SyncRepository { get; set; }
|
private ISyncRepository SyncRepository { get; set; }
|
||||||
private ITVSeriesManager TVSeriesManager { get; set; }
|
private ITVSeriesManager TVSeriesManager { get; set; }
|
||||||
|
|
||||||
private StartupOptions _startupOptions;
|
private readonly StartupOptions _startupOptions;
|
||||||
|
private readonly string _remotePackageName;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="ApplicationHost" /> class.
|
/// Initializes a new instance of the <see cref="ApplicationHost" /> class.
|
||||||
@ -229,14 +230,16 @@ namespace MediaBrowser.ServerApplication
|
|||||||
/// <param name="supportsRunningAsService">if set to <c>true</c> [supports running as service].</param>
|
/// <param name="supportsRunningAsService">if set to <c>true</c> [supports running as service].</param>
|
||||||
/// <param name="isRunningAsService">if set to <c>true</c> [is running as service].</param>
|
/// <param name="isRunningAsService">if set to <c>true</c> [is running as service].</param>
|
||||||
/// <param name="options">The options.</param>
|
/// <param name="options">The options.</param>
|
||||||
|
/// <param name="remotePackageName">Name of the remote package.</param>
|
||||||
public ApplicationHost(ServerApplicationPaths applicationPaths,
|
public ApplicationHost(ServerApplicationPaths applicationPaths,
|
||||||
ILogManager logManager,
|
ILogManager logManager,
|
||||||
bool supportsRunningAsService,
|
bool supportsRunningAsService,
|
||||||
bool isRunningAsService,
|
bool isRunningAsService,
|
||||||
StartupOptions options)
|
StartupOptions options, string remotePackageName)
|
||||||
: base(applicationPaths, logManager)
|
: base(applicationPaths, logManager)
|
||||||
{
|
{
|
||||||
_startupOptions = options;
|
_startupOptions = options;
|
||||||
|
_remotePackageName = remotePackageName;
|
||||||
_isRunningAsService = isRunningAsService;
|
_isRunningAsService = isRunningAsService;
|
||||||
SupportsRunningAsService = supportsRunningAsService;
|
SupportsRunningAsService = supportsRunningAsService;
|
||||||
}
|
}
|
||||||
@ -1091,9 +1094,17 @@ namespace MediaBrowser.ServerApplication
|
|||||||
/// <returns>Task{CheckForUpdateResult}.</returns>
|
/// <returns>Task{CheckForUpdateResult}.</returns>
|
||||||
public override async Task<CheckForUpdateResult> CheckForApplicationUpdate(CancellationToken cancellationToken, IProgress<double> progress)
|
public override async Task<CheckForUpdateResult> CheckForApplicationUpdate(CancellationToken cancellationToken, IProgress<double> progress)
|
||||||
{
|
{
|
||||||
var result = await NativeApp.CheckForApplicationUpdate(ApplicationVersion,
|
var availablePackages = await InstallationManager.GetAvailablePackagesWithoutRegistrationInfo(cancellationToken).ConfigureAwait(false);
|
||||||
ConfigurationManager.CommonConfiguration.SystemUpdateLevel, InstallationManager,
|
|
||||||
cancellationToken, progress).ConfigureAwait(false);
|
var version = InstallationManager.GetLatestCompatibleVersion(availablePackages, _remotePackageName, null, ApplicationVersion, ConfigurationManager.CommonConfiguration.SystemUpdateLevel);
|
||||||
|
|
||||||
|
var versionObject = version == null || string.IsNullOrWhiteSpace(version.versionStr) ? null : new Version(version.versionStr);
|
||||||
|
|
||||||
|
var isUpdateAvailable = versionObject != null && versionObject > ApplicationVersion;
|
||||||
|
|
||||||
|
var result = versionObject != null ?
|
||||||
|
new CheckForUpdateResult { AvailableVersion = versionObject.ToString(), IsUpdateAvailable = isUpdateAvailable, Package = version } :
|
||||||
|
new CheckForUpdateResult { AvailableVersion = ApplicationVersion.ToString(), IsUpdateAvailable = false };
|
||||||
|
|
||||||
HasUpdateAvailable = result.IsUpdateAvailable;
|
HasUpdateAvailable = result.IsUpdateAvailable;
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ namespace MediaBrowser.ServerApplication.FFMpeg
|
|||||||
case "FFProbeFilename":
|
case "FFProbeFilename":
|
||||||
return "ffprobe";
|
return "ffprobe";
|
||||||
case "ArchiveType":
|
case "ArchiveType":
|
||||||
return "gz";
|
return "7z";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (PlatformDetection.IsX86)
|
if (PlatformDetection.IsX86)
|
||||||
|
@ -209,7 +209,7 @@ namespace MediaBrowser.ServerApplication
|
|||||||
/// <param name="options">The options.</param>
|
/// <param name="options">The options.</param>
|
||||||
private static void RunApplication(ServerApplicationPaths appPaths, ILogManager logManager, bool runService, StartupOptions options)
|
private static void RunApplication(ServerApplicationPaths appPaths, ILogManager logManager, bool runService, StartupOptions options)
|
||||||
{
|
{
|
||||||
_appHost = new ApplicationHost(appPaths, logManager, true, runService, options);
|
_appHost = new ApplicationHost(appPaths, logManager, true, runService, options, "MBServer");
|
||||||
|
|
||||||
var initProgress = new Progress<double>();
|
var initProgress = new Progress<double>();
|
||||||
|
|
||||||
|
@ -1,10 +1,4 @@
|
|||||||
using System;
|
using System.Runtime.InteropServices;
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using MediaBrowser.Common.Updates;
|
|
||||||
using MediaBrowser.Model.Logging;
|
|
||||||
using MediaBrowser.Model.Updates;
|
|
||||||
|
|
||||||
namespace MediaBrowser.ServerApplication.Native
|
namespace MediaBrowser.ServerApplication.Native
|
||||||
{
|
{
|
||||||
@ -90,24 +84,5 @@ namespace MediaBrowser.ServerApplication.Native
|
|||||||
EXECUTION_STATE es = SetThreadExecutionState(EXECUTION_STATE.ES_SYSTEM_REQUIRED);
|
EXECUTION_STATE es = SetThreadExecutionState(EXECUTION_STATE.ES_SYSTEM_REQUIRED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async Task<CheckForUpdateResult> CheckForApplicationUpdate(Version currentVersion,
|
|
||||||
PackageVersionClass updateLevel,
|
|
||||||
IInstallationManager installationManager,
|
|
||||||
CancellationToken cancellationToken,
|
|
||||||
IProgress<double> progress)
|
|
||||||
{
|
|
||||||
var availablePackages = await installationManager.GetAvailablePackagesWithoutRegistrationInfo(cancellationToken).ConfigureAwait(false);
|
|
||||||
|
|
||||||
var version = installationManager.GetLatestCompatibleVersion(availablePackages, "MBServer", null, currentVersion, updateLevel);
|
|
||||||
|
|
||||||
var versionObject = version == null || string.IsNullOrWhiteSpace(version.versionStr) ? null : new Version(version.versionStr);
|
|
||||||
|
|
||||||
var isUpdateAvailable = versionObject != null && versionObject > currentVersion;
|
|
||||||
|
|
||||||
return versionObject != null ?
|
|
||||||
new CheckForUpdateResult { AvailableVersion = versionObject.ToString(), IsUpdateAvailable = isUpdateAvailable, Package = version } :
|
|
||||||
new CheckForUpdateResult { AvailableVersion = currentVersion.ToString(), IsUpdateAvailable = false };
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>MediaBrowser.Common.Internal</id>
|
<id>MediaBrowser.Common.Internal</id>
|
||||||
<version>3.0.443</version>
|
<version>3.0.445</version>
|
||||||
<title>MediaBrowser.Common.Internal</title>
|
<title>MediaBrowser.Common.Internal</title>
|
||||||
<authors>Luke</authors>
|
<authors>Luke</authors>
|
||||||
<owners>ebr,Luke,scottisafool</owners>
|
<owners>ebr,Luke,scottisafool</owners>
|
||||||
@ -12,7 +12,7 @@
|
|||||||
<description>Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption.</description>
|
<description>Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption.</description>
|
||||||
<copyright>Copyright © Media Browser 2013</copyright>
|
<copyright>Copyright © Media Browser 2013</copyright>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency id="MediaBrowser.Common" version="3.0.443" />
|
<dependency id="MediaBrowser.Common" version="3.0.445" />
|
||||||
<dependency id="NLog" version="3.1.0.0" />
|
<dependency id="NLog" version="3.1.0.0" />
|
||||||
<dependency id="SimpleInjector" version="2.5.2" />
|
<dependency id="SimpleInjector" version="2.5.2" />
|
||||||
<dependency id="sharpcompress" version="0.10.2" />
|
<dependency id="sharpcompress" version="0.10.2" />
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>MediaBrowser.Common</id>
|
<id>MediaBrowser.Common</id>
|
||||||
<version>3.0.443</version>
|
<version>3.0.445</version>
|
||||||
<title>MediaBrowser.Common</title>
|
<title>MediaBrowser.Common</title>
|
||||||
<authors>Media Browser Team</authors>
|
<authors>Media Browser Team</authors>
|
||||||
<owners>ebr,Luke,scottisafool</owners>
|
<owners>ebr,Luke,scottisafool</owners>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>MediaBrowser.Model.Signed</id>
|
<id>MediaBrowser.Model.Signed</id>
|
||||||
<version>3.0.443</version>
|
<version>3.0.445</version>
|
||||||
<title>MediaBrowser.Model - Signed Edition</title>
|
<title>MediaBrowser.Model - Signed Edition</title>
|
||||||
<authors>Media Browser Team</authors>
|
<authors>Media Browser Team</authors>
|
||||||
<owners>ebr,Luke,scottisafool</owners>
|
<owners>ebr,Luke,scottisafool</owners>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>MediaBrowser.Server.Core</id>
|
<id>MediaBrowser.Server.Core</id>
|
||||||
<version>3.0.443</version>
|
<version>3.0.445</version>
|
||||||
<title>Media Browser.Server.Core</title>
|
<title>Media Browser.Server.Core</title>
|
||||||
<authors>Media Browser Team</authors>
|
<authors>Media Browser Team</authors>
|
||||||
<owners>ebr,Luke,scottisafool</owners>
|
<owners>ebr,Luke,scottisafool</owners>
|
||||||
@ -12,7 +12,7 @@
|
|||||||
<description>Contains core components required to build plugins for Media Browser Server.</description>
|
<description>Contains core components required to build plugins for Media Browser Server.</description>
|
||||||
<copyright>Copyright © Media Browser 2013</copyright>
|
<copyright>Copyright © Media Browser 2013</copyright>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency id="MediaBrowser.Common" version="3.0.443" />
|
<dependency id="MediaBrowser.Common" version="3.0.445" />
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</metadata>
|
</metadata>
|
||||||
<files>
|
<files>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user