aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations
diff options
context:
space:
mode:
Diffstat (limited to 'Emby.Server.Implementations')
-rw-r--r--Emby.Server.Implementations/ApplicationHost.cs9
-rw-r--r--Emby.Server.Implementations/Browser/BrowserLauncher.cs2
-rw-r--r--Emby.Server.Implementations/EntryPoints/StartupWizard.cs25
-rw-r--r--Emby.Server.Implementations/Library/Resolvers/TV/SeasonResolver.cs27
-rw-r--r--Emby.Server.Implementations/Library/UserManager.cs9
-rw-r--r--Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs16
-rw-r--r--Emby.Server.Implementations/LiveTv/TunerHosts/M3UTunerHost.cs5
-rw-r--r--Emby.Server.Implementations/LiveTv/TunerHosts/SharedHttpStream.cs22
-rw-r--r--Emby.Server.Implementations/Session/HttpSessionController.cs4
-rw-r--r--Emby.Server.Implementations/Session/SessionManager.cs2
10 files changed, 88 insertions, 33 deletions
diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs
index 745d83eb5..531e13123 100644
--- a/Emby.Server.Implementations/ApplicationHost.cs
+++ b/Emby.Server.Implementations/ApplicationHost.cs
@@ -2317,12 +2317,17 @@ namespace Emby.Server.Implementations
}
}
- public void LaunchUrl(string url)
+ public virtual void LaunchUrl(string url)
{
if (EnvironmentInfo.OperatingSystem != MediaBrowser.Model.System.OperatingSystem.Windows &&
EnvironmentInfo.OperatingSystem != MediaBrowser.Model.System.OperatingSystem.OSX)
{
- throw new NotImplementedException();
+ throw new NotSupportedException();
+ }
+
+ if (!Environment.UserInteractive)
+ {
+ throw new NotSupportedException();
}
var process = ProcessFactory.Create(new ProcessOptions
diff --git a/Emby.Server.Implementations/Browser/BrowserLauncher.cs b/Emby.Server.Implementations/Browser/BrowserLauncher.cs
index 05cde91e2..71497f6bf 100644
--- a/Emby.Server.Implementations/Browser/BrowserLauncher.cs
+++ b/Emby.Server.Implementations/Browser/BrowserLauncher.cs
@@ -61,7 +61,7 @@ namespace Emby.Server.Implementations.Browser
{
appHost.LaunchUrl(url);
}
- catch (NotImplementedException)
+ catch (NotSupportedException)
{
}
diff --git a/Emby.Server.Implementations/EntryPoints/StartupWizard.cs b/Emby.Server.Implementations/EntryPoints/StartupWizard.cs
index 614c04fd2..8d1355795 100644
--- a/Emby.Server.Implementations/EntryPoints/StartupWizard.cs
+++ b/Emby.Server.Implementations/EntryPoints/StartupWizard.cs
@@ -3,6 +3,7 @@ using Emby.Server.Implementations.Browser;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Plugins;
using MediaBrowser.Model.Logging;
+using MediaBrowser.Controller.Configuration;
namespace Emby.Server.Implementations.EntryPoints
{
@@ -20,15 +21,13 @@ namespace Emby.Server.Implementations.EntryPoints
/// </summary>
private readonly ILogger _logger;
- /// <summary>
- /// Initializes a new instance of the <see cref="StartupWizard" /> class.
- /// </summary>
- /// <param name="appHost">The app host.</param>
- /// <param name="logger">The logger.</param>
- public StartupWizard(IServerApplicationHost appHost, ILogger logger)
+ private IServerConfigurationManager _config;
+
+ public StartupWizard(IServerApplicationHost appHost, ILogger logger, IServerConfigurationManager config)
{
_appHost = appHost;
_logger = logger;
+ _config = config;
}
/// <summary>
@@ -38,16 +37,12 @@ namespace Emby.Server.Implementations.EntryPoints
{
if (_appHost.IsFirstRun)
{
- LaunchStartupWizard();
+ BrowserLauncher.OpenDashboardPage("wizardstart.html", _appHost);
+ }
+ else if (_config.Configuration.IsStartupWizardCompleted)
+ {
+ BrowserLauncher.OpenDashboardPage("index.html", _appHost);
}
- }
-
- /// <summary>
- /// Launches the startup wizard.
- /// </summary>
- private void LaunchStartupWizard()
- {
- BrowserLauncher.OpenDashboardPage("wizardstart.html", _appHost);
}
/// <summary>
diff --git a/Emby.Server.Implementations/Library/Resolvers/TV/SeasonResolver.cs b/Emby.Server.Implementations/Library/Resolvers/TV/SeasonResolver.cs
index a0ff29482..3bad69b56 100644
--- a/Emby.Server.Implementations/Library/Resolvers/TV/SeasonResolver.cs
+++ b/Emby.Server.Implementations/Library/Resolvers/TV/SeasonResolver.cs
@@ -5,6 +5,7 @@ using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Globalization;
using Emby.Naming.Common;
using Emby.Naming.TV;
+using MediaBrowser.Model.Logging;
namespace Emby.Server.Implementations.Library.Resolvers.TV
{
@@ -21,16 +22,18 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
private readonly ILibraryManager _libraryManager;
private static readonly CultureInfo UsCulture = new CultureInfo("en-US");
private readonly ILocalizationManager _localization;
+ private readonly ILogger _logger;
/// <summary>
/// Initializes a new instance of the <see cref="SeasonResolver"/> class.
/// </summary>
/// <param name="config">The config.</param>
- public SeasonResolver(IServerConfigurationManager config, ILibraryManager libraryManager, ILocalizationManager localization)
+ public SeasonResolver(IServerConfigurationManager config, ILibraryManager libraryManager, ILocalizationManager localization, ILogger logger)
{
_config = config;
_libraryManager = libraryManager;
_localization = localization;
+ _logger = logger;
}
/// <summary>
@@ -45,20 +48,40 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
var namingOptions = ((LibraryManager)_libraryManager).GetNamingOptions();
var series = ((Series)args.Parent);
+ var path = args.Path;
+
var season = new Season
{
- IndexNumber = new SeasonPathParser(namingOptions, new RegexProvider()).Parse(args.Path, true, true).SeasonNumber,
+ IndexNumber = new SeasonPathParser(namingOptions, new RegexProvider()).Parse(path, true, true).SeasonNumber,
SeriesId = series.Id,
SeriesName = series.Name
};
if (season.IndexNumber.HasValue)
{
+ var resolver = new Emby.Naming.TV.EpisodeResolver(namingOptions);
+
+ var episodeInfo = resolver.Resolve(path, true);
+
+ if (episodeInfo != null)
+ {
+ if (episodeInfo.EpisodeNumber.HasValue && episodeInfo.SeasonNumber.HasValue)
+ {
+ _logger.Info("Found folder underneath series with episode number: {0}. Season {1}. Episode {2}",
+ path,
+ episodeInfo.SeasonNumber.Value,
+ episodeInfo.EpisodeNumber.Value);
+
+ return null;
+ }
+ }
+
var seasonNumber = season.IndexNumber.Value;
season.Name = seasonNumber == 0 ?
args.LibraryOptions.SeasonZeroDisplayName :
string.Format(_localization.GetLocalizedString("NameSeasonNumber"), seasonNumber.ToString(UsCulture), args.GetLibraryOptions().PreferredMetadataLanguage);
+
}
return season;
diff --git a/Emby.Server.Implementations/Library/UserManager.cs b/Emby.Server.Implementations/Library/UserManager.cs
index 0f48ff46b..c4e75add8 100644
--- a/Emby.Server.Implementations/Library/UserManager.cs
+++ b/Emby.Server.Implementations/Library/UserManager.cs
@@ -218,7 +218,7 @@ namespace Emby.Server.Implementations.Library
return builder.ToString();
}
- public async Task<User> AuthenticateUser(string username, string password, string hashedPassword, string passwordMd5, string remoteEndPoint)
+ public async Task<User> AuthenticateUser(string username, string password, string hashedPassword, string passwordMd5, string remoteEndPoint, bool isUserSession)
{
if (string.IsNullOrWhiteSpace(username))
{
@@ -288,8 +288,11 @@ namespace Emby.Server.Implementations.Library
// Update LastActivityDate and LastLoginDate, then save
if (success)
{
- user.LastActivityDate = user.LastLoginDate = DateTime.UtcNow;
- UpdateUser(user);
+ if (isUserSession)
+ {
+ user.LastActivityDate = user.LastLoginDate = DateTime.UtcNow;
+ UpdateUser(user);
+ }
UpdateInvalidLoginAttemptCount(user, 0);
}
else
diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
index 9992c71ec..a4c5645e7 100644
--- a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
@@ -1897,7 +1897,15 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
imageSaveFilenameWithoutExtension = "logo";
break;
case ImageType.Thumb:
- imageSaveFilenameWithoutExtension = "landscape";
+ if (program.IsSeries)
+ {
+ imageSaveFilenameWithoutExtension = Path.GetFileNameWithoutExtension(recordingPath) + "-thumb";
+ }
+ else
+ {
+ imageSaveFilenameWithoutExtension = "landscape";
+ }
+
break;
case ImageType.Backdrop:
imageSaveFilenameWithoutExtension = "fanart";
@@ -1921,9 +1929,11 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
private async Task SaveRecordingImages(string recordingPath, LiveTvProgram program)
{
- var image = program.GetImageInfo(ImageType.Primary, 0);
+ var image = program.IsSeries ?
+ (program.GetImageInfo(ImageType.Thumb, 0) ?? program.GetImageInfo(ImageType.Primary, 0)) :
+ (program.GetImageInfo(ImageType.Primary, 0) ?? program.GetImageInfo(ImageType.Thumb, 0));
- if (image != null && program.IsMovie)
+ if (image != null)
{
try
{
diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/M3UTunerHost.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/M3UTunerHost.cs
index c96d1f359..e6c9b184e 100644
--- a/Emby.Server.Implementations/LiveTv/TunerHosts/M3UTunerHost.cs
+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/M3UTunerHost.cs
@@ -152,6 +152,8 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
isRemote = !_networkManager.IsInLocalNetwork(uri.Host);
}
+ var supportsDirectPlay = !info.EnableStreamLooping && info.TunerCount == 0;
+
var mediaSource = new MediaSourceInfo
{
Path = path,
@@ -183,7 +185,8 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
IsInfiniteStream = true,
IsRemote = isRemote,
- IgnoreDts = true
+ IgnoreDts = true,
+ SupportsDirectPlay = supportsDirectPlay
};
mediaSource.InferTotalBitrate();
diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/SharedHttpStream.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/SharedHttpStream.cs
index cc2cb3e5e..b8c7c7b18 100644
--- a/Emby.Server.Implementations/LiveTv/TunerHosts/SharedHttpStream.cs
+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/SharedHttpStream.cs
@@ -88,6 +88,9 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
SetTempFilePath(extension);
var taskCompletionSource = new TaskCompletionSource<bool>();
+
+ var now = DateTime.UtcNow;
+
StartStreaming(response, taskCompletionSource, LiveStreamCancellationTokenSource.Token);
//OpenedMediaSource.Protocol = MediaProtocol.File;
@@ -97,11 +100,6 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
OpenedMediaSource.Path = _appHost.GetLocalApiUrl("127.0.0.1") + "/LiveTv/LiveStreamFiles/" + UniqueId + "/stream.ts";
OpenedMediaSource.Protocol = MediaProtocol.Http;
- if (OpenedMediaSource.SupportsProbing)
- {
- await Task.Delay(3000).ConfigureAwait(false);
- }
-
//OpenedMediaSource.Path = TempFilePath;
//OpenedMediaSource.Protocol = MediaProtocol.File;
@@ -111,6 +109,20 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
//OpenedMediaSource.SupportsDirectStream = true;
//OpenedMediaSource.SupportsTranscoding = true;
await taskCompletionSource.Task.ConfigureAwait(false);
+
+ if (OpenedMediaSource.SupportsProbing)
+ {
+ var elapsed = (DateTime.UtcNow - now).TotalMilliseconds;
+
+ var delay = Convert.ToInt32(3000 - elapsed);
+
+ if (delay > 0)
+ {
+ Logger.Info("Delaying shared stream by {0}ms to allow the buffer to build.", delay);
+
+ await Task.Delay(delay).ConfigureAwait(false);
+ }
+ }
}
protected override void CloseInternal()
diff --git a/Emby.Server.Implementations/Session/HttpSessionController.cs b/Emby.Server.Implementations/Session/HttpSessionController.cs
index e1c1bbe2b..e85254420 100644
--- a/Emby.Server.Implementations/Session/HttpSessionController.cs
+++ b/Emby.Server.Implementations/Session/HttpSessionController.cs
@@ -117,6 +117,10 @@ namespace Emby.Server.Implementations.Session
{
dict["SubtitleStreamIndex"] = command.SubtitleStreamIndex.Value.ToString(CultureInfo.InvariantCulture);
}
+ if (command.StartIndex.HasValue)
+ {
+ dict["StartIndex"] = command.StartIndex.Value.ToString(CultureInfo.InvariantCulture);
+ }
if (!string.IsNullOrWhiteSpace(command.MediaSourceId))
{
dict["MediaSourceId"] = command.MediaSourceId;
diff --git a/Emby.Server.Implementations/Session/SessionManager.cs b/Emby.Server.Implementations/Session/SessionManager.cs
index 30f6e6521..411781b25 100644
--- a/Emby.Server.Implementations/Session/SessionManager.cs
+++ b/Emby.Server.Implementations/Session/SessionManager.cs
@@ -1423,7 +1423,7 @@ namespace Emby.Server.Implementations.Session
if (enforcePassword)
{
- var result = await _userManager.AuthenticateUser(request.Username, request.Password, request.PasswordSha1, request.PasswordMd5, request.RemoteEndPoint).ConfigureAwait(false);
+ var result = await _userManager.AuthenticateUser(request.Username, request.Password, request.PasswordSha1, request.PasswordMd5, request.RemoteEndPoint, true).ConfigureAwait(false);
if (result == null)
{