From 6df78dcb342bd38792cde75498292e3f6ef15fd7 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 20 Mar 2015 13:17:03 -0400 Subject: improve people naming --- .../Session/WebSocketController.cs | 25 ---------------------- 1 file changed, 25 deletions(-) (limited to 'MediaBrowser.Server.Implementations/Session/WebSocketController.cs') diff --git a/MediaBrowser.Server.Implementations/Session/WebSocketController.cs b/MediaBrowser.Server.Implementations/Session/WebSocketController.cs index 19aaaf8a5..f51998fea 100644 --- a/MediaBrowser.Server.Implementations/Session/WebSocketController.cs +++ b/MediaBrowser.Server.Implementations/Session/WebSocketController.cs @@ -233,8 +233,6 @@ namespace MediaBrowser.Server.Implementations.Session private Task SendMessageInternal(WebSocketMessage message, CancellationToken cancellationToken) { - if (SkipSending()) return Task.FromResult(true); - var socket = GetActiveSocket(); return socket.SendAsync(message, cancellationToken); @@ -242,8 +240,6 @@ namespace MediaBrowser.Server.Implementations.Session private Task SendMessagesInternal(WebSocketMessage message, CancellationToken cancellationToken) { - if (SkipSending()) return Task.FromResult(true); - var tasks = GetActiveSockets().Select(i => Task.Run(async () => { try @@ -260,27 +256,6 @@ namespace MediaBrowser.Server.Implementations.Session return Task.WhenAll(tasks); } - private bool SkipSending() - { - if (Session != null) - { - if (string.Equals(Session.Client, "mb-classic", StringComparison.OrdinalIgnoreCase)) - { - Version version; - - if (!string.IsNullOrWhiteSpace(Session.ApplicationVersion) && Version.TryParse(Session.ApplicationVersion, out version)) - { - if (version < new Version(3, 0, 196)) - { - _logger.Debug("Skipping web socket message to MBC version {0}.", version); - return true; - } - } - } - } - return false; - } - public void Dispose() { foreach (var socket in Sockets.ToList()) -- cgit v1.2.3 From c0aec48a31d96726a6fb1814f28b6971fabca163 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 21 Mar 2015 12:10:02 -0400 Subject: beta fixes --- .../BaseApplicationHost.cs | 2 +- .../Persistence/IItemRepository.cs | 2 +- .../Session/ISessionController.cs | 5 ++ .../ContentDirectory/ContentDirectoryBrowser.cs | 2 +- MediaBrowser.Dlna/PlayTo/PlayToController.cs | 4 ++ MediaBrowser.MediaEncoding/Subtitles/AssParser.cs | 71 +++++++++++----------- MediaBrowser.Model/Dlna/Profiles/DefaultProfile.cs | 14 ++--- .../Connect/ConnectManager.cs | 6 +- .../EntryPoints/Notifications/Notifications.cs | 2 +- .../HttpServer/Security/SessionContext.cs | 5 +- .../LiveTv/LiveTvManager.cs | 11 +++- .../Localization/Server/server.json | 2 +- .../Notifications/CoreNotificationTypes.cs | 6 +- .../Persistence/SqliteItemRepository.cs | 11 +--- .../ScheduledTasks/SystemUpdateTask.cs | 2 +- .../Session/HttpSessionController.cs | 4 ++ .../Session/SessionManager.cs | 48 +++++++++------ .../Session/WebSocketController.cs | 19 +++++- .../ApplicationHost.cs | 2 +- MediaBrowser.ServerApplication/ServerNotifyIcon.cs | 4 +- .../Splash/SplashForm.Designer.cs | 4 +- MediaBrowser.WebDashboard/Api/PackageCreator.cs | 4 +- MediaBrowser.XbmcMetadata/Images/XbmcImageSaver.cs | 2 +- 23 files changed, 134 insertions(+), 98 deletions(-) (limited to 'MediaBrowser.Server.Implementations/Session/WebSocketController.cs') diff --git a/MediaBrowser.Common.Implementations/BaseApplicationHost.cs b/MediaBrowser.Common.Implementations/BaseApplicationHost.cs index 0f89bd1a6..bc1b0e785 100644 --- a/MediaBrowser.Common.Implementations/BaseApplicationHost.cs +++ b/MediaBrowser.Common.Implementations/BaseApplicationHost.cs @@ -294,7 +294,7 @@ namespace MediaBrowser.Common.Implementations public static void LogEnvironmentInfo(ILogger logger, IApplicationPaths appPaths, bool isStartup) { - logger.LogMultiline("Media Browser", LogSeverity.Info, GetBaseExceptionMessage(appPaths)); + logger.LogMultiline("Emby", LogSeverity.Info, GetBaseExceptionMessage(appPaths)); } protected static StringBuilder GetBaseExceptionMessage(IApplicationPaths appPaths) diff --git a/MediaBrowser.Controller/Persistence/IItemRepository.cs b/MediaBrowser.Controller/Persistence/IItemRepository.cs index edaa15c9d..245c81d70 100644 --- a/MediaBrowser.Controller/Persistence/IItemRepository.cs +++ b/MediaBrowser.Controller/Persistence/IItemRepository.cs @@ -107,7 +107,7 @@ namespace MediaBrowser.Controller.Persistence /// /// The type. /// IEnumerable{Guid}. - IEnumerable GetItemsOfType(Type type); + IEnumerable GetItemsOfType(Type type); /// /// Saves the children. diff --git a/MediaBrowser.Controller/Session/ISessionController.cs b/MediaBrowser.Controller/Session/ISessionController.cs index a4badee47..f8a6ed1fc 100644 --- a/MediaBrowser.Controller/Session/ISessionController.cs +++ b/MediaBrowser.Controller/Session/ISessionController.cs @@ -115,5 +115,10 @@ namespace MediaBrowser.Controller.Session /// The cancellation token. /// Task. Task SendMessage(string name, T data, CancellationToken cancellationToken); + + /// + /// Called when [activity]. + /// + void OnActivity(); } } diff --git a/MediaBrowser.Dlna/ContentDirectory/ContentDirectoryBrowser.cs b/MediaBrowser.Dlna/ContentDirectory/ContentDirectoryBrowser.cs index 0c62ada80..d90f0765f 100644 --- a/MediaBrowser.Dlna/ContentDirectory/ContentDirectoryBrowser.cs +++ b/MediaBrowser.Dlna/ContentDirectory/ContentDirectoryBrowser.cs @@ -33,7 +33,7 @@ namespace MediaBrowser.Dlna.ContentDirectory var options = new HttpRequestOptions { CancellationToken = cancellationToken, - UserAgent = "Media Browser", + UserAgent = "Emby", RequestContentType = "text/xml; charset=\"utf-8\"", LogErrorResponseBody = true, Url = request.ContentDirectoryUrl diff --git a/MediaBrowser.Dlna/PlayTo/PlayToController.cs b/MediaBrowser.Dlna/PlayTo/PlayToController.cs index f53318069..d52428dc9 100644 --- a/MediaBrowser.Dlna/PlayTo/PlayToController.cs +++ b/MediaBrowser.Dlna/PlayTo/PlayToController.cs @@ -47,6 +47,10 @@ namespace MediaBrowser.Dlna.PlayTo } } + public void OnActivity() + { + } + public bool SupportsMediaControl { get { return IsSessionActive; } diff --git a/MediaBrowser.MediaEncoding/Subtitles/AssParser.cs b/MediaBrowser.MediaEncoding/Subtitles/AssParser.cs index 2a8c958b2..4d426683f 100644 --- a/MediaBrowser.MediaEncoding/Subtitles/AssParser.cs +++ b/MediaBrowser.MediaEncoding/Subtitles/AssParser.cs @@ -42,6 +42,9 @@ namespace MediaBrowser.MediaEncoding.Subtitles subEvent.StartPositionTicks = GetTicks(sections[headers["Start"]]); subEvent.EndPositionTicks = GetTicks(sections[headers["End"]]); + + //RemoteNativeFormatting(subEvent); + subEvent.Text = string.Join(",", sections.Skip(headers["Text"])); subEvent.Text = subEvent.Text.Replace(@"\N", ParserValues.NewLine, StringComparison.OrdinalIgnoreCase); subEvent.Text = Regex.Replace(subEvent.Text, @"\{(\\[\w]+\(?([\w\d]+,?)+\)?)+\}", string.Empty, RegexOptions.IgnoreCase); @@ -49,7 +52,6 @@ namespace MediaBrowser.MediaEncoding.Subtitles trackInfo.TrackEvents.Add(subEvent); } } - RemoteNativeFormatting(trackInfo); return trackInfo; } @@ -74,46 +76,43 @@ namespace MediaBrowser.MediaEncoding.Subtitles /// /// Credit: https://github.com/SubtitleEdit/subtitleedit/blob/master/src/Logic/SubtitleFormats/AdvancedSubStationAlpha.cs /// - private void RemoteNativeFormatting(SubtitleTrackInfo subtitle) + private void RemoteNativeFormatting(SubtitleTrackEvent p) { - foreach (var p in subtitle.TrackEvents) + int indexOfBegin = p.Text.IndexOf('{'); + string pre = string.Empty; + while (indexOfBegin >= 0 && p.Text.IndexOf('}') > indexOfBegin) { - int indexOfBegin = p.Text.IndexOf('{'); - string pre = string.Empty; - while (indexOfBegin >= 0 && p.Text.IndexOf('}') > indexOfBegin) + string s = p.Text.Substring(indexOfBegin); + if (s.StartsWith("{\\an1}", StringComparison.Ordinal) || + s.StartsWith("{\\an2}", StringComparison.Ordinal) || + s.StartsWith("{\\an3}", StringComparison.Ordinal) || + s.StartsWith("{\\an4}", StringComparison.Ordinal) || + s.StartsWith("{\\an5}", StringComparison.Ordinal) || + s.StartsWith("{\\an6}", StringComparison.Ordinal) || + s.StartsWith("{\\an7}", StringComparison.Ordinal) || + s.StartsWith("{\\an8}", StringComparison.Ordinal) || + s.StartsWith("{\\an9}", StringComparison.Ordinal)) { - string s = p.Text.Substring(indexOfBegin); - if (s.StartsWith("{\\an1}", StringComparison.Ordinal) || - s.StartsWith("{\\an2}", StringComparison.Ordinal) || - s.StartsWith("{\\an3}", StringComparison.Ordinal) || - s.StartsWith("{\\an4}", StringComparison.Ordinal) || - s.StartsWith("{\\an5}", StringComparison.Ordinal) || - s.StartsWith("{\\an6}", StringComparison.Ordinal) || - s.StartsWith("{\\an7}", StringComparison.Ordinal) || - s.StartsWith("{\\an8}", StringComparison.Ordinal) || - s.StartsWith("{\\an9}", StringComparison.Ordinal)) - { - pre = s.Substring(0, 6); - } - else if (s.StartsWith("{\\an1\\", StringComparison.Ordinal) || - s.StartsWith("{\\an2\\", StringComparison.Ordinal) || - s.StartsWith("{\\an3\\", StringComparison.Ordinal) || - s.StartsWith("{\\an4\\", StringComparison.Ordinal) || - s.StartsWith("{\\an5\\", StringComparison.Ordinal) || - s.StartsWith("{\\an6\\", StringComparison.Ordinal) || - s.StartsWith("{\\an7\\", StringComparison.Ordinal) || - s.StartsWith("{\\an8\\", StringComparison.Ordinal) || - s.StartsWith("{\\an9\\", StringComparison.Ordinal)) - { - pre = s.Substring(0, 5) + "}"; - } - int indexOfEnd = p.Text.IndexOf('}'); - p.Text = p.Text.Remove(indexOfBegin, (indexOfEnd - indexOfBegin) + 1); - - indexOfBegin = p.Text.IndexOf('{'); + pre = s.Substring(0, 6); } - p.Text = pre + p.Text; + else if (s.StartsWith("{\\an1\\", StringComparison.Ordinal) || + s.StartsWith("{\\an2\\", StringComparison.Ordinal) || + s.StartsWith("{\\an3\\", StringComparison.Ordinal) || + s.StartsWith("{\\an4\\", StringComparison.Ordinal) || + s.StartsWith("{\\an5\\", StringComparison.Ordinal) || + s.StartsWith("{\\an6\\", StringComparison.Ordinal) || + s.StartsWith("{\\an7\\", StringComparison.Ordinal) || + s.StartsWith("{\\an8\\", StringComparison.Ordinal) || + s.StartsWith("{\\an9\\", StringComparison.Ordinal)) + { + pre = s.Substring(0, 5) + "}"; + } + int indexOfEnd = p.Text.IndexOf('}'); + p.Text = p.Text.Remove(indexOfBegin, (indexOfEnd - indexOfBegin) + 1); + + indexOfBegin = p.Text.IndexOf('{'); } + p.Text = pre + p.Text; } } } diff --git a/MediaBrowser.Model/Dlna/Profiles/DefaultProfile.cs b/MediaBrowser.Model/Dlna/Profiles/DefaultProfile.cs index 959f8b801..c9db9fbf8 100644 --- a/MediaBrowser.Model/Dlna/Profiles/DefaultProfile.cs +++ b/MediaBrowser.Model/Dlna/Profiles/DefaultProfile.cs @@ -13,13 +13,13 @@ namespace MediaBrowser.Model.Dlna.Profiles XDlnaDoc = "DMS-1.50"; - FriendlyName = "Media Browser"; - Manufacturer = "Media Browser"; - ModelDescription = "Media Browser"; - ModelName = "Media Browser"; - ModelNumber = "Media Browser"; - ModelUrl = "http://mediabrowser.tv/"; - ManufacturerUrl = "http://mediabrowser.tv/"; + FriendlyName = "Emby"; + Manufacturer = "Emby"; + ModelDescription = "Emby"; + ModelName = "Emby"; + ModelNumber = "Emby"; + ModelUrl = "http://emby.media/"; + ManufacturerUrl = "http://emby.media/"; AlbumArtPn = "JPEG_SM"; diff --git a/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs b/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs index be0b32548..a7f8717a7 100644 --- a/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs +++ b/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs @@ -150,7 +150,7 @@ namespace MediaBrowser.Server.Implementations.Connect if (string.IsNullOrWhiteSpace(wanApiAddress)) { - _logger.Warn("Cannot update Media Browser Connect information without a WanApiAddress"); + _logger.Warn("Cannot update Emby Connect information without a WanApiAddress"); return; } @@ -411,7 +411,7 @@ namespace MediaBrowser.Server.Implementations.Connect if (!connectUser.IsActive) { - throw new ArgumentException("The Media Browser account has been disabled."); + throw new ArgumentException("The Emby account has been disabled."); } var user = GetUser(userId); @@ -517,7 +517,7 @@ namespace MediaBrowser.Server.Implementations.Connect if (!connectUser.IsActive) { - throw new ArgumentException("The Media Browser account has been disabled."); + throw new ArgumentException("The Emby account has been disabled."); } connectUserId = connectUser.Id; diff --git a/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifications.cs b/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifications.cs index f6a35973b..bc995d62a 100644 --- a/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifications.cs +++ b/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifications.cs @@ -389,7 +389,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints.Notifications var notification = new NotificationRequest { UserIds = new List { e.Argument.Id.ToString("N") }, - Name = "Welcome to Media Browser!", + Name = "Welcome to Emby!", Description = "Check back here for more notifications." }; diff --git a/MediaBrowser.Server.Implementations/HttpServer/Security/SessionContext.cs b/MediaBrowser.Server.Implementations/HttpServer/Security/SessionContext.cs index 1bbe9893b..c8278dc54 100644 --- a/MediaBrowser.Server.Implementations/HttpServer/Security/SessionContext.cs +++ b/MediaBrowser.Server.Implementations/HttpServer/Security/SessionContext.cs @@ -28,7 +28,10 @@ namespace MediaBrowser.Server.Implementations.HttpServer.Security if (!string.IsNullOrWhiteSpace(authorization.Token)) { var auth = GetTokenInfo(requestContext); - return _sessionManager.GetSessionByAuthenticationToken(auth, authorization.DeviceId, requestContext.RemoteIp, authorization.Version); + if (auth != null) + { + return _sessionManager.GetSessionByAuthenticationToken(auth, authorization.DeviceId, requestContext.RemoteIp, authorization.Version); + } } var session = _sessionManager.GetSession(authorization.DeviceId, authorization.Client, authorization.Version); diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs index 075451146..aff801516 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs @@ -1111,13 +1111,18 @@ namespace MediaBrowser.Server.Implementations.LiveTv var numComplete = 0; - foreach (var program in list) + foreach (var programId in list) { cancellationToken.ThrowIfCancellationRequested(); - if (!currentIdList.Contains(program.Id)) + if (!currentIdList.Contains(new Guid(programId))) { - await _libraryManager.DeleteItem(program).ConfigureAwait(false); + var program = _libraryManager.GetItemById(programId); + + if (program != null) + { + await _libraryManager.DeleteItem(program).ConfigureAwait(false); + } } numComplete++; diff --git a/MediaBrowser.Server.Implementations/Localization/Server/server.json b/MediaBrowser.Server.Implementations/Localization/Server/server.json index c2a115df4..8681eb7c8 100644 --- a/MediaBrowser.Server.Implementations/Localization/Server/server.json +++ b/MediaBrowser.Server.Implementations/Localization/Server/server.json @@ -16,7 +16,7 @@ "LabelNext": "Next", "LabelYoureDone": "You're Done!", "WelcomeToMediaBrowser": "Welcome to Media Browser!", - "TitleMediaBrowser": "Media Browser", + "TitleMediaBrowser": "Emby", "ThisWizardWillGuideYou": "This wizard will help guide you through the setup process. To begin, please select your preferred language.", "TellUsAboutYourself": "Tell us about yourself", "ButtonQuickStartGuide": "Quick start guide", diff --git a/MediaBrowser.Server.Implementations/Notifications/CoreNotificationTypes.cs b/MediaBrowser.Server.Implementations/Notifications/CoreNotificationTypes.cs index a33fe2147..98d3672fa 100644 --- a/MediaBrowser.Server.Implementations/Notifications/CoreNotificationTypes.cs +++ b/MediaBrowser.Server.Implementations/Notifications/CoreNotificationTypes.cs @@ -27,7 +27,7 @@ namespace MediaBrowser.Server.Implementations.Notifications { Type = NotificationType.ApplicationUpdateInstalled.ToString(), DefaultDescription = "{ReleaseNotes}", - DefaultTitle = "A new version of Media Browser Server has been installed.", + DefaultTitle = "A new version of Emby Server has been installed.", Variables = new List{"Version"} }, @@ -71,7 +71,7 @@ namespace MediaBrowser.Server.Implementations.Notifications new NotificationTypeInfo { Type = NotificationType.ServerRestartRequired.ToString(), - DefaultTitle = "Please restart Media Browser Server to finish updating." + DefaultTitle = "Please restart Emby Server to finish updating." }, new NotificationTypeInfo @@ -158,7 +158,7 @@ namespace MediaBrowser.Server.Implementations.Notifications knownTypes.Add(new NotificationTypeInfo { Type = NotificationType.ApplicationUpdateAvailable.ToString(), - DefaultTitle = "A new version of Media Browser Server is available for download." + DefaultTitle = "A new version of Emby Server is available for download." }); } diff --git a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs index 3ffe31ed1..4c45d5b83 100644 --- a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs +++ b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs @@ -522,7 +522,7 @@ namespace MediaBrowser.Server.Implementations.Persistence } } - public IEnumerable GetItemsOfType(Type type) + public IEnumerable GetItemsOfType(Type type) { if (type == null) { @@ -533,7 +533,7 @@ namespace MediaBrowser.Server.Implementations.Persistence using (var cmd = _connection.CreateCommand()) { - cmd.CommandText = "select type,data from TypedBaseItems where type = @type"; + cmd.CommandText = "select guid from TypedBaseItems where type = @type"; cmd.Parameters.Add(cmd, "@type", DbType.String).Value = type.FullName; @@ -541,12 +541,7 @@ namespace MediaBrowser.Server.Implementations.Persistence { while (reader.Read()) { - var item = GetItem(reader); - - if (item != null) - { - yield return item; - } + yield return reader.GetString(0); } } } diff --git a/MediaBrowser.Server.Implementations/ScheduledTasks/SystemUpdateTask.cs b/MediaBrowser.Server.Implementations/ScheduledTasks/SystemUpdateTask.cs index 231a98b4a..fa3cd6be7 100644 --- a/MediaBrowser.Server.Implementations/ScheduledTasks/SystemUpdateTask.cs +++ b/MediaBrowser.Server.Implementations/ScheduledTasks/SystemUpdateTask.cs @@ -108,7 +108,7 @@ namespace MediaBrowser.Server.Implementations.ScheduledTasks } else { - Logger.Info("A new version of Media Browser is available."); + Logger.Info("A new version of " + _appHost.Name + " is available."); } progress.Report(100); diff --git a/MediaBrowser.Server.Implementations/Session/HttpSessionController.cs b/MediaBrowser.Server.Implementations/Session/HttpSessionController.cs index 4d5c40853..9a7fb33df 100644 --- a/MediaBrowser.Server.Implementations/Session/HttpSessionController.cs +++ b/MediaBrowser.Server.Implementations/Session/HttpSessionController.cs @@ -43,6 +43,10 @@ namespace MediaBrowser.Server.Implementations.Session ResetPingTimer(); } + public void OnActivity() + { + } + private string PostUrl { get diff --git a/MediaBrowser.Server.Implementations/Session/SessionManager.cs b/MediaBrowser.Server.Implementations/Session/SessionManager.cs index 5ea970426..f88e21aea 100644 --- a/MediaBrowser.Server.Implementations/Session/SessionManager.cs +++ b/MediaBrowser.Server.Implementations/Session/SessionManager.cs @@ -236,34 +236,44 @@ namespace MediaBrowser.Server.Implementations.Session } var activityDate = DateTime.UtcNow; - var session = await GetSessionInfo(appName, appVersion, deviceId, deviceName, remoteEndPoint, user).ConfigureAwait(false); - + var lastActivityDate = session.LastActivityDate; session.LastActivityDate = activityDate; - if (user == null) + if (user != null) { - return session; - } - - var lastActivityDate = user.LastActivityDate; + var userLastActivityDate = user.LastActivityDate ?? DateTime.MinValue; + user.LastActivityDate = activityDate; - user.LastActivityDate = activityDate; + // Don't log in the db anymore frequently than 10 seconds + if ((activityDate - userLastActivityDate).TotalSeconds > 10) + { + try + { + // Save this directly. No need to fire off all the events for this. + await _userRepository.SaveUser(user, CancellationToken.None).ConfigureAwait(false); + } + catch (Exception ex) + { + _logger.ErrorException("Error updating user", ex); + } + } + } - // Don't log in the db anymore frequently than 10 seconds - if (lastActivityDate.HasValue && (activityDate - lastActivityDate.Value).TotalSeconds < 10) + if ((activityDate - lastActivityDate).TotalSeconds > 10) { - return session; - } + EventHelper.FireEventIfNotNull(SessionActivity, this, new SessionEventArgs + { + SessionInfo = session - // Save this directly. No need to fire off all the events for this. - await _userRepository.SaveUser(user, CancellationToken.None).ConfigureAwait(false); + }, _logger); + } - EventHelper.FireEventIfNotNull(SessionActivity, this, new SessionEventArgs + var controller = session.SessionController; + if (controller != null) { - SessionInfo = session - - }, _logger); + controller.OnActivity(); + } return session; } @@ -1680,7 +1690,7 @@ namespace MediaBrowser.Server.Implementations.Session deviceId = info.DeviceId; } - return GetSessionInfo(appName, appVersion, deviceId, deviceName, remoteEndpoint, user); + return LogSessionActivity(appName, appVersion, deviceId, deviceName, remoteEndpoint, user); } public Task GetSessionByAuthenticationToken(string token, string deviceId, string remoteEndpoint) diff --git a/MediaBrowser.Server.Implementations/Session/WebSocketController.cs b/MediaBrowser.Server.Implementations/Session/WebSocketController.cs index f51998fea..d4ecd9572 100644 --- a/MediaBrowser.Server.Implementations/Session/WebSocketController.cs +++ b/MediaBrowser.Server.Implementations/Session/WebSocketController.cs @@ -30,17 +30,28 @@ namespace MediaBrowser.Server.Implementations.Session Sockets = new List(); } + private bool HasOpenSockets + { + get { return GetActiveSockets().Any(); } + } + + public bool SupportsMediaControl + { + get { return HasOpenSockets; } + } + + private bool _isActive; public bool IsSessionActive { get { - return Sockets.Any(i => i.State == WebSocketState.Open); + return _isActive; } } - public bool SupportsMediaControl + public void OnActivity() { - get { return GetActiveSockets().Any(); } + _isActive = true; } private IEnumerable GetActiveSockets() @@ -64,6 +75,8 @@ namespace MediaBrowser.Server.Implementations.Session { if (!GetActiveSockets().Any()) { + _isActive = false; + try { _sessionManager.ReportSessionEnded(Session.Id); diff --git a/MediaBrowser.Server.Startup.Common/ApplicationHost.cs b/MediaBrowser.Server.Startup.Common/ApplicationHost.cs index f35317cd2..db3b85e19 100644 --- a/MediaBrowser.Server.Startup.Common/ApplicationHost.cs +++ b/MediaBrowser.Server.Startup.Common/ApplicationHost.cs @@ -432,7 +432,7 @@ namespace MediaBrowser.Server.Startup.Common RegisterSingleInstance(() => new SearchEngine(LogManager, LibraryManager, UserManager)); - HttpServer = ServerFactory.CreateServer(this, LogManager, "Media Browser", "web/index.html"); + HttpServer = ServerFactory.CreateServer(this, LogManager, "Emby", "web/index.html"); RegisterSingleInstance(HttpServer, false); progress.Report(10); diff --git a/MediaBrowser.ServerApplication/ServerNotifyIcon.cs b/MediaBrowser.ServerApplication/ServerNotifyIcon.cs index e3e1359d9..f04593e90 100644 --- a/MediaBrowser.ServerApplication/ServerNotifyIcon.cs +++ b/MediaBrowser.ServerApplication/ServerNotifyIcon.cs @@ -75,7 +75,7 @@ namespace MediaBrowser.ServerApplication // notifyIcon1.ContextMenuStrip = contextMenuStrip1; notifyIcon1.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon1.Icon"))); - notifyIcon1.Text = "Media Browser"; + notifyIcon1.Text = "Emby"; notifyIcon1.Visible = true; // // contextMenuStrip1 @@ -162,7 +162,7 @@ namespace MediaBrowser.ServerApplication if (_appHost.IsFirstRun) { - Action action = () => notifyIcon1.ShowBalloonTip(5000, "Media Browser", "Welcome to Media Browser Server!", ToolTipIcon.Info); + Action action = () => notifyIcon1.ShowBalloonTip(5000, "Emby", "Welcome to Emby Server!", ToolTipIcon.Info); contextMenuStrip1.Invoke(action); } diff --git a/MediaBrowser.ServerApplication/Splash/SplashForm.Designer.cs b/MediaBrowser.ServerApplication/Splash/SplashForm.Designer.cs index ef3b79699..190a98178 100644 --- a/MediaBrowser.ServerApplication/Splash/SplashForm.Designer.cs +++ b/MediaBrowser.ServerApplication/Splash/SplashForm.Designer.cs @@ -123,7 +123,7 @@ this.lblStatus.Name = "lblStatus"; this.lblStatus.Size = new System.Drawing.Size(469, 59); this.lblStatus.TabIndex = 0; - this.lblStatus.Text = "Loading Media Browser"; + this.lblStatus.Text = "Loading Emby Server"; this.lblStatus.UseWaitCursor = true; // // panel1 @@ -162,7 +162,7 @@ this.Name = "SplashForm"; this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "Media Browser"; + this.Text = "Emby"; this.UseWaitCursor = true; this.panelMainContainer.ResumeLayout(false); this.panel2.ResumeLayout(false); diff --git a/MediaBrowser.WebDashboard/Api/PackageCreator.cs b/MediaBrowser.WebDashboard/Api/PackageCreator.cs index a93cccfbc..4262a314d 100644 --- a/MediaBrowser.WebDashboard/Api/PackageCreator.cs +++ b/MediaBrowser.WebDashboard/Api/PackageCreator.cs @@ -180,11 +180,9 @@ namespace MediaBrowser.WebDashboard.Api sb.Append(""); //sb.Append(""); sb.Append(""); - sb.Append(""); + sb.Append(""); //sb.Append(""); - sb.Append(""); - sb.Append(""); // http://developer.apple.com/library/ios/#DOCUMENTATION/AppleApplications/Reference/SafariWebContent/ConfiguringWebApplications/ConfiguringWebApplications.html diff --git a/MediaBrowser.XbmcMetadata/Images/XbmcImageSaver.cs b/MediaBrowser.XbmcMetadata/Images/XbmcImageSaver.cs index 054a7eabb..01eeb5f3b 100644 --- a/MediaBrowser.XbmcMetadata/Images/XbmcImageSaver.cs +++ b/MediaBrowser.XbmcMetadata/Images/XbmcImageSaver.cs @@ -266,7 +266,7 @@ namespace MediaBrowser.XbmcMetadata.Images public string Name { - get { return "Media Browser/Plex/Xbmc Images"; } + get { return "Emby/Plex/Xbmc Images"; } } } } -- cgit v1.2.3 From e62270df353aa8e2ae0a20aeff7d5aa6f9b62630 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 24 Mar 2015 21:34:34 -0400 Subject: add socket error message --- MediaBrowser.Api/ApiEntryPoint.cs | 7 +++++++ MediaBrowser.Api/Playback/BaseStreamingService.cs | 2 +- MediaBrowser.Api/Playback/TranscodingThrottler.cs | 6 ++++++ .../HttpServer/SocketSharp/SharpWebSocket.cs | 3 ++- MediaBrowser.Server.Implementations/Session/WebSocketController.cs | 2 +- .../UserViews/StripCollageBuilder.cs | 2 +- 6 files changed, 18 insertions(+), 4 deletions(-) (limited to 'MediaBrowser.Server.Implementations/Session/WebSocketController.cs') diff --git a/MediaBrowser.Api/ApiEntryPoint.cs b/MediaBrowser.Api/ApiEntryPoint.cs index 281f764b5..a21fc22fe 100644 --- a/MediaBrowser.Api/ApiEntryPoint.cs +++ b/MediaBrowser.Api/ApiEntryPoint.cs @@ -407,6 +407,11 @@ namespace MediaBrowser.Api { try { + if (job.TranscodingThrottler != null) + { + job.TranscodingThrottler.Stop(); + } + Logger.Info("Killing ffmpeg process for {0}", job.Path); //process.Kill(); @@ -578,6 +583,8 @@ namespace MediaBrowser.Api public long? TranscodingPositionTicks { get; set; } public long? DownloadPositionTicks { get; set; } + public TranscodingThrottler TranscodingThrottler { get; set; } + public void DisposeKillTimer() { if (KillTimer != null) diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs index ae71ac262..bc194b45b 100644 --- a/MediaBrowser.Api/Playback/BaseStreamingService.cs +++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs @@ -1123,7 +1123,7 @@ namespace MediaBrowser.Api.Playback { if (state.RunTimeTicks.Value >= TimeSpan.FromMinutes(5).Ticks && state.IsInputVideo) { - state.TranscodingThrottler = new TranscodingThrottler(transcodingJob, Logger); + transcodingJob.TranscodingThrottler = state.TranscodingThrottler = new TranscodingThrottler(transcodingJob, Logger); state.TranscodingThrottler.Start(); } } diff --git a/MediaBrowser.Api/Playback/TranscodingThrottler.cs b/MediaBrowser.Api/Playback/TranscodingThrottler.cs index 38ce9e298..19a9fe934 100644 --- a/MediaBrowser.Api/Playback/TranscodingThrottler.cs +++ b/MediaBrowser.Api/Playback/TranscodingThrottler.cs @@ -139,6 +139,12 @@ namespace MediaBrowser.Api.Playback return false; } + public void Stop() + { + DisposeTimer(); + UnpauseTranscoding(); + } + public void Dispose() { DisposeTimer(); diff --git a/MediaBrowser.Server.Implementations/HttpServer/SocketSharp/SharpWebSocket.cs b/MediaBrowser.Server.Implementations/HttpServer/SocketSharp/SharpWebSocket.cs index 8ab8b0215..a8b3bc10b 100644 --- a/MediaBrowser.Server.Implementations/HttpServer/SocketSharp/SharpWebSocket.cs +++ b/MediaBrowser.Server.Implementations/HttpServer/SocketSharp/SharpWebSocket.cs @@ -56,7 +56,8 @@ namespace MediaBrowser.Server.Implementations.HttpServer.SocketSharp void socket_OnError(object sender, SocketHttpListener.ErrorEventArgs e) { - EventHelper.FireEventIfNotNull(Closed, this, EventArgs.Empty, _logger); + _logger.Error("Error in SharpWebSocket: {0}", e.Message ?? string.Empty); + //EventHelper.FireEventIfNotNull(Closed, this, EventArgs.Empty, _logger); } void socket_OnClose(object sender, SocketHttpListener.CloseEventArgs e) diff --git a/MediaBrowser.Server.Implementations/Session/WebSocketController.cs b/MediaBrowser.Server.Implementations/Session/WebSocketController.cs index d4ecd9572..1e1949533 100644 --- a/MediaBrowser.Server.Implementations/Session/WebSocketController.cs +++ b/MediaBrowser.Server.Implementations/Session/WebSocketController.cs @@ -45,7 +45,7 @@ namespace MediaBrowser.Server.Implementations.Session { get { - return _isActive; + return HasOpenSockets; } } diff --git a/MediaBrowser.Server.Implementations/UserViews/StripCollageBuilder.cs b/MediaBrowser.Server.Implementations/UserViews/StripCollageBuilder.cs index 2f2d9860c..00be0f18e 100644 --- a/MediaBrowser.Server.Implementations/UserViews/StripCollageBuilder.cs +++ b/MediaBrowser.Server.Implementations/UserViews/StripCollageBuilder.cs @@ -20,7 +20,7 @@ namespace MediaBrowser.Server.Implementations.UserViews public Stream BuildThumbCollage(IEnumerable paths, string text, int width, int height) { - using (var wand = BuildThumbCollageWandWithText(paths, text, width, height)) + using (var wand = BuildThumbCollageWand(paths, width, height)) { return DynamicImageHelpers.GetStream(wand, _appPaths); } -- cgit v1.2.3 From bbaf88ae1f088584f9130852cd99ad372adce136 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 24 Mar 2015 23:54:32 -0400 Subject: update tv db cleanup --- MediaBrowser.Controller/Persistence/IItemRepository.cs | 2 +- MediaBrowser.Dlna/PlayTo/PlayToController.cs | 5 ----- .../HttpServer/Security/SessionContext.cs | 16 ++++++++-------- .../LiveTv/LiveTvManager.cs | 2 +- .../Persistence/SqliteItemRepository.cs | 6 +++--- .../Photos/BaseDynamicImageProvider.cs | 2 +- .../Session/WebSocketController.cs | 10 +++++++++- 7 files changed, 23 insertions(+), 20 deletions(-) (limited to 'MediaBrowser.Server.Implementations/Session/WebSocketController.cs') diff --git a/MediaBrowser.Controller/Persistence/IItemRepository.cs b/MediaBrowser.Controller/Persistence/IItemRepository.cs index 245c81d70..f306518df 100644 --- a/MediaBrowser.Controller/Persistence/IItemRepository.cs +++ b/MediaBrowser.Controller/Persistence/IItemRepository.cs @@ -107,7 +107,7 @@ namespace MediaBrowser.Controller.Persistence /// /// The type. /// IEnumerable{Guid}. - IEnumerable GetItemsOfType(Type type); + IEnumerable GetItemsOfType(Type type); /// /// Saves the children. diff --git a/MediaBrowser.Dlna/PlayTo/PlayToController.cs b/MediaBrowser.Dlna/PlayTo/PlayToController.cs index d52428dc9..f8f939f47 100644 --- a/MediaBrowser.Dlna/PlayTo/PlayToController.cs +++ b/MediaBrowser.Dlna/PlayTo/PlayToController.cs @@ -134,11 +134,6 @@ namespace MediaBrowser.Dlna.PlayTo } } - private string GetServerAddress() - { - return _serverAddress; - } - async void _device_MediaChanged(object sender, MediaChangedEventArgs e) { try diff --git a/MediaBrowser.Server.Implementations/HttpServer/Security/SessionContext.cs b/MediaBrowser.Server.Implementations/HttpServer/Security/SessionContext.cs index c8278dc54..f40d117c4 100644 --- a/MediaBrowser.Server.Implementations/HttpServer/Security/SessionContext.cs +++ b/MediaBrowser.Server.Implementations/HttpServer/Security/SessionContext.cs @@ -25,14 +25,14 @@ namespace MediaBrowser.Server.Implementations.HttpServer.Security { var authorization = _authContext.GetAuthorizationInfo(requestContext); - if (!string.IsNullOrWhiteSpace(authorization.Token)) - { - var auth = GetTokenInfo(requestContext); - if (auth != null) - { - return _sessionManager.GetSessionByAuthenticationToken(auth, authorization.DeviceId, requestContext.RemoteIp, authorization.Version); - } - } + //if (!string.IsNullOrWhiteSpace(authorization.Token)) + //{ + // var auth = GetTokenInfo(requestContext); + // if (auth != null) + // { + // return _sessionManager.GetSessionByAuthenticationToken(auth, authorization.DeviceId, requestContext.RemoteIp, authorization.Version); + // } + //} var session = _sessionManager.GetSession(authorization.DeviceId, authorization.Client, authorization.Version); return Task.FromResult(session); diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs index ffa774300..2bc6cbadf 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs @@ -1115,7 +1115,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv { cancellationToken.ThrowIfCancellationRequested(); - if (!currentIdList.Contains(new Guid(programId))) + if (!currentIdList.Contains(programId)) { var program = _libraryManager.GetItemById(programId); diff --git a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs index 4c45d5b83..12ce60d45 100644 --- a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs +++ b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs @@ -521,8 +521,8 @@ namespace MediaBrowser.Server.Implementations.Persistence } } } - - public IEnumerable GetItemsOfType(Type type) + + public IEnumerable GetItemsOfType(Type type) { if (type == null) { @@ -541,7 +541,7 @@ namespace MediaBrowser.Server.Implementations.Persistence { while (reader.Read()) { - yield return reader.GetString(0); + yield return reader.GetGuid(0); } } } diff --git a/MediaBrowser.Server.Implementations/Photos/BaseDynamicImageProvider.cs b/MediaBrowser.Server.Implementations/Photos/BaseDynamicImageProvider.cs index 2cfc873de..6fb02358e 100644 --- a/MediaBrowser.Server.Implementations/Photos/BaseDynamicImageProvider.cs +++ b/MediaBrowser.Server.Implementations/Photos/BaseDynamicImageProvider.cs @@ -125,7 +125,7 @@ namespace MediaBrowser.Server.Implementations.Photos protected abstract Task> GetItemsWithImages(IHasImages item); - private const string Version = "3"; + private const string Version = "4"; protected string GetConfigurationCacheKey(List items, string itemName) { var parts = Version + "_" + (itemName ?? string.Empty) + "_" + diff --git a/MediaBrowser.Server.Implementations/Session/WebSocketController.cs b/MediaBrowser.Server.Implementations/Session/WebSocketController.cs index 1e1949533..765664299 100644 --- a/MediaBrowser.Server.Implementations/Session/WebSocketController.cs +++ b/MediaBrowser.Server.Implementations/Session/WebSocketController.cs @@ -41,17 +41,25 @@ namespace MediaBrowser.Server.Implementations.Session } private bool _isActive; + private DateTime _lastActivityDate; public bool IsSessionActive { get { - return HasOpenSockets; + if (HasOpenSockets) + { + return true; + } + + //return false; + return _isActive && (DateTime.UtcNow - _lastActivityDate).TotalMinutes <= 10; } } public void OnActivity() { _isActive = true; + _lastActivityDate = DateTime.UtcNow; } private IEnumerable GetActiveSockets() -- cgit v1.2.3