From 901d7b509c712ababc489166e05bdfea1908fa0f Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 9 Nov 2017 15:58:09 -0500 Subject: [PATCH] update play media source feature --- Emby.Dlna/PlayTo/PlayToController.cs | 2 +- .../Localization/Core/cs.json | 2 +- .../Localization/Core/fr.json | 2 +- .../Localization/Core/sk.json | 100 +++++++++--------- .../Session/HttpSessionController.cs | 12 +++ .../Session/SessionManager.cs | 11 +- MediaBrowser.Api/Session/SessionsService.cs | 33 +----- MediaBrowser.Model/Session/PlayRequest.cs | 10 +- SharedVersion.cs | 2 +- 9 files changed, 82 insertions(+), 92 deletions(-) diff --git a/Emby.Dlna/PlayTo/PlayToController.cs b/Emby.Dlna/PlayTo/PlayToController.cs index ba1d3a6de2..bd0a9e1f42 100644 --- a/Emby.Dlna/PlayTo/PlayToController.cs +++ b/Emby.Dlna/PlayTo/PlayToController.cs @@ -328,7 +328,7 @@ namespace Emby.Dlna.PlayTo { if (isFirst && command.StartPositionTicks.HasValue) { - playlist.Add(CreatePlaylistItem(item, user, command.StartPositionTicks.Value, null, null, null)); + playlist.Add(CreatePlaylistItem(item, user, command.StartPositionTicks.Value, command.MediaSourceId, command.AudioStreamIndex, command.SubtitleStreamIndex)); isFirst = false; } else diff --git a/Emby.Server.Implementations/Localization/Core/cs.json b/Emby.Server.Implementations/Localization/Core/cs.json index 82d8699a7e..d59e40ed35 100644 --- a/Emby.Server.Implementations/Localization/Core/cs.json +++ b/Emby.Server.Implementations/Localization/Core/cs.json @@ -27,7 +27,7 @@ "Artists": "Um\u011blci", "Folders": "Slo\u017eky", "Songs": "Skladby", - "TvShows": "TV Shows", + "TvShows": "TV seri\u00e1ly", "Shows": "Seri\u00e1ly", "Genres": "\u017d\u00e1nry", "NameSeasonNumber": "Sez\u00f3na {0}", diff --git a/Emby.Server.Implementations/Localization/Core/fr.json b/Emby.Server.Implementations/Localization/Core/fr.json index 953d7f4347..6552a47abb 100644 --- a/Emby.Server.Implementations/Localization/Core/fr.json +++ b/Emby.Server.Implementations/Localization/Core/fr.json @@ -27,7 +27,7 @@ "Artists": "Artistes", "Folders": "Dossiers", "Songs": "Chansons", - "TvShows": "TV Shows", + "TvShows": "S\u00e9ries T\u00e9l\u00e9", "Shows": "\u00c9missions", "Genres": "Genres", "NameSeasonNumber": "Saison {0}", diff --git a/Emby.Server.Implementations/Localization/Core/sk.json b/Emby.Server.Implementations/Localization/Core/sk.json index 0c7bce1daa..f09eb15068 100644 --- a/Emby.Server.Implementations/Localization/Core/sk.json +++ b/Emby.Server.Implementations/Localization/Core/sk.json @@ -1,7 +1,7 @@ { - "Latest": "Latest", - "ValueSpecialEpisodeName": "Special - {0}", - "Inherit": "Inherit", + "Latest": "Najnov\u0161ie", + "ValueSpecialEpisodeName": "\u0160peci\u00e1l - {0}", + "Inherit": "Zdedi\u0165", "Books": "Knihy", "Music": "Hudba", "Games": "Hry", @@ -9,13 +9,13 @@ "MixedContent": "Zmie\u0161an\u00fd obsah", "MusicVideos": "Hudobn\u00e9 vide\u00e1", "HomeVideos": "Dom\u00e1ce vide\u00e1", - "Playlists": "Playlists", + "Playlists": "Zoznamy skladieb", "HeaderRecordingGroups": "Recording Groups", - "HeaderContinueWatching": "Continue Watching", - "HeaderFavoriteArtists": "Favorite Artists", + "HeaderContinueWatching": "Pokra\u010dujte v pozeran\u00ed", + "HeaderFavoriteArtists": "Ob\u013e\u00faben\u00ed umelci", "HeaderFavoriteSongs": "Ob\u013e\u00faben\u00e9 pesni\u010dky", "HeaderAlbumArtists": "Album Artists", - "HeaderFavoriteAlbums": "Favorite Albums", + "HeaderFavoriteAlbums": "Ob\u013e\u00faben\u00e9 albumy", "HeaderFavoriteEpisodes": "Ob\u013e\u00faben\u00e9 epiz\u00f3dy", "HeaderFavoriteShows": "Ob\u013e\u00faben\u00e9 seri\u00e1ly", "HeaderNextUp": "Nasleduje", @@ -30,62 +30,62 @@ "TvShows": "TV Shows", "Shows": "Series", "Genres": "\u017d\u00e1nre", - "NameSeasonNumber": "Season {0}", - "AppDeviceValues": "App: {0}, Device: {1}", - "UserDownloadingItemWithValues": "{0} is downloading {1}", + "NameSeasonNumber": "Sez\u00f3na {0}", + "AppDeviceValues": "Aplik\u00e1cia: {0}, Zariadenie: {1}", + "UserDownloadingItemWithValues": "{0} s\u0165ahuje {1}", "HeaderLiveTV": "Live TV", - "ChapterNameValue": "Chapter {0}", - "ScheduledTaskFailedWithName": "{0} failed", - "LabelRunningTimeValue": "Running time: {0}", + "ChapterNameValue": "Kapitola {0}", + "ScheduledTaskFailedWithName": "{0} zlyhalo", + "LabelRunningTimeValue": "D\u013a\u017eka: {0}", "ScheduledTaskStartedWithName": "{0} started", - "VersionNumber": "Version {0}", - "PluginInstalledWithName": "{0} was installed", - "StartupEmbyServerIsLoading": "Emby Server is loading. Please try again shortly.", - "PluginUpdatedWithName": "{0} was updated", - "PluginUninstalledWithName": "{0} was uninstalled", - "ItemAddedWithName": "{0} was added to the library", - "ItemRemovedWithName": "{0} was removed from the library", - "LabelIpAddressValue": "Ip address: {0}", - "DeviceOnlineWithName": "{0} is connected", - "UserOnlineFromDevice": "{0} is online from {1}", + "VersionNumber": "Verzia {0}", + "PluginInstalledWithName": "{0} bol nain\u0161talovan\u00fd", + "StartupEmbyServerIsLoading": "Emby Server sa sp\u00fa\u0161\u0165a. Sk\u00faste to pros\u00edm o chv\u00ed\u013eu znova.", + "PluginUpdatedWithName": "{0} bol aktualizovan\u00fd", + "PluginUninstalledWithName": "{0} bol odin\u0161talovan\u00fd", + "ItemAddedWithName": "{0} bol pridan\u00fd do kni\u017enice", + "ItemRemovedWithName": "{0} bol odstr\u00e1nen\u00fd z kni\u017enice", + "LabelIpAddressValue": "IP adresa: {0}", + "DeviceOnlineWithName": "{0} je pripojen\u00fd", + "UserOnlineFromDevice": "{0} je online z {1}", "ProviderValue": "Provider: {0}", - "SubtitlesDownloadedForItem": "Subtitles downloaded for {0}", - "UserCreatedWithName": "User {0} has been created", - "UserPasswordChangedWithName": "Password has been changed for user {0}", - "UserDeletedWithName": "User {0} has been deleted", + "SubtitlesDownloadedForItem": "Titulky pre {0} stiahnut\u00e9", + "UserCreatedWithName": "Pou\u017e\u00edvate\u013e {0} bol vytvoren\u00fd", + "UserPasswordChangedWithName": "Heslo pou\u017e\u00edvate\u013ea {0} zmenen\u00e9", + "UserDeletedWithName": "Pou\u017e\u00edvate\u013e {0} bol vymazan\u00fd", "UserConfigurationUpdatedWithName": "User configuration has been updated for {0}", - "MessageServerConfigurationUpdated": "Server configuration has been updated", - "MessageNamedServerConfigurationUpdatedWithValue": "Server configuration section {0} has been updated", - "MessageApplicationUpdated": "Emby Server has been updated", - "FailedLoginAttemptWithUserName": "Failed login attempt from {0}", - "AuthenticationSucceededWithUserName": "{0} successfully authenticated", - "UserOfflineFromDevice": "{0} has disconnected from {1}", - "DeviceOfflineWithName": "{0} has disconnected", - "UserStartedPlayingItemWithValues": "{0} has started playing {1}", - "UserStoppedPlayingItemWithValues": "{0} has stopped playing {1}", + "MessageServerConfigurationUpdated": "Konfigur\u00e1cia servera aktualizovan\u00e1", + "MessageNamedServerConfigurationUpdatedWithValue": "Sekcia {0} konfigur\u00e1cie servera bola aktualizovan\u00e1", + "MessageApplicationUpdated": "Emby Server bol aktualizovan\u00fd", + "FailedLoginAttemptWithUserName": "Ne\u00faspe\u0161n\u00fd pokus o prihl\u00e1senie z {0}", + "AuthenticationSucceededWithUserName": "{0} \u00faspe\u0161ne overen\u00fd", + "UserOfflineFromDevice": "{0} sa odpojil od {1}", + "DeviceOfflineWithName": "{0} je odpojen\u00fd", + "UserStartedPlayingItemWithValues": "{0} spustil prehr\u00e1vanie {1}", + "UserStoppedPlayingItemWithValues": "{0} zastavil prehr\u00e1vanie {1}", "NotificationOptionPluginError": "Plugin failure", - "NotificationOptionApplicationUpdateAvailable": "Application update available", - "NotificationOptionApplicationUpdateInstalled": "Application update installed", + "NotificationOptionApplicationUpdateAvailable": "Je dostupn\u00e1 aktualiz\u00e1cia aplik\u00e1cie", + "NotificationOptionApplicationUpdateInstalled": "Aktualiz\u00e1cia aplik\u00e1cie nain\u0161talovan\u00e1", "NotificationOptionPluginUpdateInstalled": "Plugin update installed", "NotificationOptionPluginInstalled": "Plugin installed", "NotificationOptionPluginUninstalled": "Plugin uninstalled", - "NotificationOptionVideoPlayback": "Video playback started", - "NotificationOptionAudioPlayback": "Audio playback started", + "NotificationOptionVideoPlayback": "Spusten\u00e9 prehr\u00e1vanie videa", + "NotificationOptionAudioPlayback": "Spusten\u00e9 prehr\u00e1vanie audia", "NotificationOptionGamePlayback": "Game playback started", - "NotificationOptionVideoPlaybackStopped": "Video playback stopped", - "NotificationOptionAudioPlaybackStopped": "Audio playback stopped", - "NotificationOptionGamePlaybackStopped": "Game playback stopped", - "NotificationOptionTaskFailed": "Scheduled task failure", - "NotificationOptionInstallationFailed": "Installation failure", - "NotificationOptionNewLibraryContent": "New content added", + "NotificationOptionVideoPlaybackStopped": "Zastaven\u00e9 prehr\u00e1vanie videa", + "NotificationOptionAudioPlaybackStopped": "Zastaven\u00e9 prehr\u00e1vanie audia", + "NotificationOptionGamePlaybackStopped": "Hra ukon\u010den\u00e1", + "NotificationOptionTaskFailed": "Napl\u00e1novan\u00e1 \u00faloha zlyhala", + "NotificationOptionInstallationFailed": "Chyba in\u0161tal\u00e1cie", + "NotificationOptionNewLibraryContent": "Pridan\u00fd nov\u00fd obsah", "NotificationOptionCameraImageUploaded": "Camera image uploaded", "NotificationOptionUserLockedOut": "User locked out", - "NotificationOptionServerRestartRequired": "Server restart required", + "NotificationOptionServerRestartRequired": "Vy\u017eaduje sa re\u0161tart servera", "UserLockedOutWithName": "User {0} has been locked out", - "SubtitleDownloadFailureForItem": "Subtitles failed to download for {0}", + "SubtitleDownloadFailureForItem": "S\u0165ahovanie titulkov pre {0} zlyhalo", "Sync": "Sync", - "User": "User", - "System": "System", + "User": "Pou\u017e\u00edvate\u013e", + "System": "Syst\u00e9m", "Application": "Aplik\u00e1cia", "Plugin": "Plugin" } \ No newline at end of file diff --git a/Emby.Server.Implementations/Session/HttpSessionController.cs b/Emby.Server.Implementations/Session/HttpSessionController.cs index 940c821e2f..e1c1bbe2b8 100644 --- a/Emby.Server.Implementations/Session/HttpSessionController.cs +++ b/Emby.Server.Implementations/Session/HttpSessionController.cs @@ -109,6 +109,18 @@ namespace Emby.Server.Implementations.Session { dict["StartPositionTicks"] = command.StartPositionTicks.Value.ToString(CultureInfo.InvariantCulture); } + if (command.AudioStreamIndex.HasValue) + { + dict["AudioStreamIndex"] = command.AudioStreamIndex.Value.ToString(CultureInfo.InvariantCulture); + } + if (command.SubtitleStreamIndex.HasValue) + { + dict["SubtitleStreamIndex"] = command.SubtitleStreamIndex.Value.ToString(CultureInfo.InvariantCulture); + } + if (!string.IsNullOrWhiteSpace(command.MediaSourceId)) + { + dict["MediaSourceId"] = command.MediaSourceId; + } return SendMessage(command.PlayCommand.ToString(), dict, cancellationToken); } diff --git a/Emby.Server.Implementations/Session/SessionManager.cs b/Emby.Server.Implementations/Session/SessionManager.cs index 2c15351656..30f6e65218 100644 --- a/Emby.Server.Implementations/Session/SessionManager.cs +++ b/Emby.Server.Implementations/Session/SessionManager.cs @@ -972,7 +972,6 @@ namespace Emby.Server.Implementations.Session if (command.PlayCommand == PlayCommand.PlayInstantMix) { items = command.ItemIds.SelectMany(i => TranslateItemForInstantMix(i, user)) - .Where(i => i.LocationType != LocationType.Virtual) .ToList(); command.PlayCommand = PlayCommand.PlayNow; @@ -986,9 +985,7 @@ namespace Emby.Server.Implementations.Session list.AddRange(subItems); } - items = list - .Where(i => i.LocationType != LocationType.Virtual) - .ToList(); + items = list; } if (command.PlayCommand == PlayCommand.PlayShuffle) @@ -1074,7 +1071,8 @@ namespace Emby.Server.Implementations.Session { ItemFields.SortName } - } + }, + IsVirtualItem = false }); return FilterToSingleMediaType(items) @@ -1097,7 +1095,8 @@ namespace Emby.Server.Implementations.Session { ItemFields.SortName } - } + }, + IsVirtualItem = false }); diff --git a/MediaBrowser.Api/Session/SessionsService.cs b/MediaBrowser.Api/Session/SessionsService.cs index e961f9d516..35c29cd15b 100644 --- a/MediaBrowser.Api/Session/SessionsService.cs +++ b/MediaBrowser.Api/Session/SessionsService.cs @@ -66,7 +66,7 @@ namespace MediaBrowser.Api.Session [Route("/Sessions/{Id}/Playing", "POST", Summary = "Instructs a session to play an item")] [Authenticated] - public class Play : IReturnVoid + public class Play : PlayRequest { /// /// Gets or sets the id. @@ -74,27 +74,6 @@ namespace MediaBrowser.Api.Session /// The id. [ApiMember(Name = "Id", Description = "Session Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")] public string Id { get; set; } - - /// - /// Artist, Genre, Studio, Person, or any kind of BaseItem - /// - /// The type of the item. - [ApiMember(Name = "ItemIds", Description = "The ids of the items to play, comma delimited", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "POST", AllowMultiple = true)] - public string ItemIds { get; set; } - - /// - /// Gets or sets the start position ticks that the first item should be played at - /// - /// The start position ticks. - [ApiMember(Name = "StartPositionTicks", Description = "The starting position of the first item.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")] - public long? StartPositionTicks { get; set; } - - /// - /// Gets or sets the play command. - /// - /// The play command. - [ApiMember(Name = "PlayCommand", Description = "The type of play command to issue (PlayNow, PlayNext, PlayLast). Clients who have not yet implemented play next and play last may play now.", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "POST")] - public PlayCommand PlayCommand { get; set; } } [Route("/Sessions/{Id}/Playing/{Command}", "POST", Summary = "Issues a playstate command to a client")] @@ -471,15 +450,7 @@ namespace MediaBrowser.Api.Session /// The request. public void Post(Play request) { - var command = new PlayRequest - { - ItemIds = request.ItemIds.Split(','), - - PlayCommand = request.PlayCommand, - StartPositionTicks = request.StartPositionTicks - }; - - var task = _sessionManager.SendPlayCommand(GetSession(_sessionContext).Result.Id, request.Id, command, CancellationToken.None); + var task = _sessionManager.SendPlayCommand(GetSession(_sessionContext).Result.Id, request.Id, request, CancellationToken.None); Task.WaitAll(task); } diff --git a/MediaBrowser.Model/Session/PlayRequest.cs b/MediaBrowser.Model/Session/PlayRequest.cs index 5db5e90cb7..d50cb59533 100644 --- a/MediaBrowser.Model/Session/PlayRequest.cs +++ b/MediaBrowser.Model/Session/PlayRequest.cs @@ -1,4 +1,5 @@ - +using MediaBrowser.Model.Services; + namespace MediaBrowser.Model.Session { /// @@ -10,18 +11,21 @@ namespace MediaBrowser.Model.Session /// Gets or sets the item ids. /// /// The item ids. + [ApiMember(Name = "ItemIds", Description = "The ids of the items to play, comma delimited", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "POST", AllowMultiple = true)] public string[] ItemIds { get; set; } /// /// Gets or sets the start position ticks that the first item should be played at /// /// The start position ticks. + [ApiMember(Name = "StartPositionTicks", Description = "The starting position of the first item.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")] public long? StartPositionTicks { get; set; } /// /// Gets or sets the play command. /// /// The play command. + [ApiMember(Name = "PlayCommand", Description = "The type of play command to issue (PlayNow, PlayNext, PlayLast). Clients who have not yet implemented play next and play last may play now.", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "POST")] public PlayCommand PlayCommand { get; set; } /// @@ -29,5 +33,9 @@ namespace MediaBrowser.Model.Session /// /// The controlling user identifier. public string ControllingUserId { get; set; } + + public int? SubtitleStreamIndex { get; set; } + public int? AudioStreamIndex { get; set; } + public string MediaSourceId { get; set; } } } \ No newline at end of file diff --git a/SharedVersion.cs b/SharedVersion.cs index f0a2b930d6..1505ef0b8b 100644 --- a/SharedVersion.cs +++ b/SharedVersion.cs @@ -1,3 +1,3 @@ using System.Reflection; -[assembly: AssemblyVersion("3.2.36.5")] +[assembly: AssemblyVersion("3.2.36.6")]