Merge pull request #3009 from MediaBrowser/dev

update play media source feature
pull/1154/head
Luke 7 years ago committed by GitHub
commit e86cd223c6

@ -328,7 +328,7 @@ namespace Emby.Dlna.PlayTo
{ {
if (isFirst && command.StartPositionTicks.HasValue) 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; isFirst = false;
} }
else else

@ -27,7 +27,7 @@
"Artists": "Um\u011blci", "Artists": "Um\u011blci",
"Folders": "Slo\u017eky", "Folders": "Slo\u017eky",
"Songs": "Skladby", "Songs": "Skladby",
"TvShows": "TV Shows", "TvShows": "TV seri\u00e1ly",
"Shows": "Seri\u00e1ly", "Shows": "Seri\u00e1ly",
"Genres": "\u017d\u00e1nry", "Genres": "\u017d\u00e1nry",
"NameSeasonNumber": "Sez\u00f3na {0}", "NameSeasonNumber": "Sez\u00f3na {0}",

@ -27,7 +27,7 @@
"Artists": "Artistes", "Artists": "Artistes",
"Folders": "Dossiers", "Folders": "Dossiers",
"Songs": "Chansons", "Songs": "Chansons",
"TvShows": "TV Shows", "TvShows": "S\u00e9ries T\u00e9l\u00e9",
"Shows": "\u00c9missions", "Shows": "\u00c9missions",
"Genres": "Genres", "Genres": "Genres",
"NameSeasonNumber": "Saison {0}", "NameSeasonNumber": "Saison {0}",

@ -1,7 +1,7 @@
{ {
"Latest": "Latest", "Latest": "Najnov\u0161ie",
"ValueSpecialEpisodeName": "Special - {0}", "ValueSpecialEpisodeName": "\u0160peci\u00e1l - {0}",
"Inherit": "Inherit", "Inherit": "Zdedi\u0165",
"Books": "Knihy", "Books": "Knihy",
"Music": "Hudba", "Music": "Hudba",
"Games": "Hry", "Games": "Hry",
@ -9,13 +9,13 @@
"MixedContent": "Zmie\u0161an\u00fd obsah", "MixedContent": "Zmie\u0161an\u00fd obsah",
"MusicVideos": "Hudobn\u00e9 vide\u00e1", "MusicVideos": "Hudobn\u00e9 vide\u00e1",
"HomeVideos": "Dom\u00e1ce vide\u00e1", "HomeVideos": "Dom\u00e1ce vide\u00e1",
"Playlists": "Playlists", "Playlists": "Zoznamy skladieb",
"HeaderRecordingGroups": "Recording Groups", "HeaderRecordingGroups": "Recording Groups",
"HeaderContinueWatching": "Continue Watching", "HeaderContinueWatching": "Pokra\u010dujte v pozeran\u00ed",
"HeaderFavoriteArtists": "Favorite Artists", "HeaderFavoriteArtists": "Ob\u013e\u00faben\u00ed umelci",
"HeaderFavoriteSongs": "Ob\u013e\u00faben\u00e9 pesni\u010dky", "HeaderFavoriteSongs": "Ob\u013e\u00faben\u00e9 pesni\u010dky",
"HeaderAlbumArtists": "Album Artists", "HeaderAlbumArtists": "Album Artists",
"HeaderFavoriteAlbums": "Favorite Albums", "HeaderFavoriteAlbums": "Ob\u013e\u00faben\u00e9 albumy",
"HeaderFavoriteEpisodes": "Ob\u013e\u00faben\u00e9 epiz\u00f3dy", "HeaderFavoriteEpisodes": "Ob\u013e\u00faben\u00e9 epiz\u00f3dy",
"HeaderFavoriteShows": "Ob\u013e\u00faben\u00e9 seri\u00e1ly", "HeaderFavoriteShows": "Ob\u013e\u00faben\u00e9 seri\u00e1ly",
"HeaderNextUp": "Nasleduje", "HeaderNextUp": "Nasleduje",
@ -30,62 +30,62 @@
"TvShows": "TV Shows", "TvShows": "TV Shows",
"Shows": "Series", "Shows": "Series",
"Genres": "\u017d\u00e1nre", "Genres": "\u017d\u00e1nre",
"NameSeasonNumber": "Season {0}", "NameSeasonNumber": "Sez\u00f3na {0}",
"AppDeviceValues": "App: {0}, Device: {1}", "AppDeviceValues": "Aplik\u00e1cia: {0}, Zariadenie: {1}",
"UserDownloadingItemWithValues": "{0} is downloading {1}", "UserDownloadingItemWithValues": "{0} s\u0165ahuje {1}",
"HeaderLiveTV": "Live TV", "HeaderLiveTV": "Live TV",
"ChapterNameValue": "Chapter {0}", "ChapterNameValue": "Kapitola {0}",
"ScheduledTaskFailedWithName": "{0} failed", "ScheduledTaskFailedWithName": "{0} zlyhalo",
"LabelRunningTimeValue": "Running time: {0}", "LabelRunningTimeValue": "D\u013a\u017eka: {0}",
"ScheduledTaskStartedWithName": "{0} started", "ScheduledTaskStartedWithName": "{0} started",
"VersionNumber": "Version {0}", "VersionNumber": "Verzia {0}",
"PluginInstalledWithName": "{0} was installed", "PluginInstalledWithName": "{0} bol nain\u0161talovan\u00fd",
"StartupEmbyServerIsLoading": "Emby Server is loading. Please try again shortly.", "StartupEmbyServerIsLoading": "Emby Server sa sp\u00fa\u0161\u0165a. Sk\u00faste to pros\u00edm o chv\u00ed\u013eu znova.",
"PluginUpdatedWithName": "{0} was updated", "PluginUpdatedWithName": "{0} bol aktualizovan\u00fd",
"PluginUninstalledWithName": "{0} was uninstalled", "PluginUninstalledWithName": "{0} bol odin\u0161talovan\u00fd",
"ItemAddedWithName": "{0} was added to the library", "ItemAddedWithName": "{0} bol pridan\u00fd do kni\u017enice",
"ItemRemovedWithName": "{0} was removed from the library", "ItemRemovedWithName": "{0} bol odstr\u00e1nen\u00fd z kni\u017enice",
"LabelIpAddressValue": "Ip address: {0}", "LabelIpAddressValue": "IP adresa: {0}",
"DeviceOnlineWithName": "{0} is connected", "DeviceOnlineWithName": "{0} je pripojen\u00fd",
"UserOnlineFromDevice": "{0} is online from {1}", "UserOnlineFromDevice": "{0} je online z {1}",
"ProviderValue": "Provider: {0}", "ProviderValue": "Provider: {0}",
"SubtitlesDownloadedForItem": "Subtitles downloaded for {0}", "SubtitlesDownloadedForItem": "Titulky pre {0} stiahnut\u00e9",
"UserCreatedWithName": "User {0} has been created", "UserCreatedWithName": "Pou\u017e\u00edvate\u013e {0} bol vytvoren\u00fd",
"UserPasswordChangedWithName": "Password has been changed for user {0}", "UserPasswordChangedWithName": "Heslo pou\u017e\u00edvate\u013ea {0} zmenen\u00e9",
"UserDeletedWithName": "User {0} has been deleted", "UserDeletedWithName": "Pou\u017e\u00edvate\u013e {0} bol vymazan\u00fd",
"UserConfigurationUpdatedWithName": "User configuration has been updated for {0}", "UserConfigurationUpdatedWithName": "User configuration has been updated for {0}",
"MessageServerConfigurationUpdated": "Server configuration has been updated", "MessageServerConfigurationUpdated": "Konfigur\u00e1cia servera aktualizovan\u00e1",
"MessageNamedServerConfigurationUpdatedWithValue": "Server configuration section {0} has been updated", "MessageNamedServerConfigurationUpdatedWithValue": "Sekcia {0} konfigur\u00e1cie servera bola aktualizovan\u00e1",
"MessageApplicationUpdated": "Emby Server has been updated", "MessageApplicationUpdated": "Emby Server bol aktualizovan\u00fd",
"FailedLoginAttemptWithUserName": "Failed login attempt from {0}", "FailedLoginAttemptWithUserName": "Ne\u00faspe\u0161n\u00fd pokus o prihl\u00e1senie z {0}",
"AuthenticationSucceededWithUserName": "{0} successfully authenticated", "AuthenticationSucceededWithUserName": "{0} \u00faspe\u0161ne overen\u00fd",
"UserOfflineFromDevice": "{0} has disconnected from {1}", "UserOfflineFromDevice": "{0} sa odpojil od {1}",
"DeviceOfflineWithName": "{0} has disconnected", "DeviceOfflineWithName": "{0} je odpojen\u00fd",
"UserStartedPlayingItemWithValues": "{0} has started playing {1}", "UserStartedPlayingItemWithValues": "{0} spustil prehr\u00e1vanie {1}",
"UserStoppedPlayingItemWithValues": "{0} has stopped playing {1}", "UserStoppedPlayingItemWithValues": "{0} zastavil prehr\u00e1vanie {1}",
"NotificationOptionPluginError": "Plugin failure", "NotificationOptionPluginError": "Plugin failure",
"NotificationOptionApplicationUpdateAvailable": "Application update available", "NotificationOptionApplicationUpdateAvailable": "Je dostupn\u00e1 aktualiz\u00e1cia aplik\u00e1cie",
"NotificationOptionApplicationUpdateInstalled": "Application update installed", "NotificationOptionApplicationUpdateInstalled": "Aktualiz\u00e1cia aplik\u00e1cie nain\u0161talovan\u00e1",
"NotificationOptionPluginUpdateInstalled": "Plugin update installed", "NotificationOptionPluginUpdateInstalled": "Plugin update installed",
"NotificationOptionPluginInstalled": "Plugin installed", "NotificationOptionPluginInstalled": "Plugin installed",
"NotificationOptionPluginUninstalled": "Plugin uninstalled", "NotificationOptionPluginUninstalled": "Plugin uninstalled",
"NotificationOptionVideoPlayback": "Video playback started", "NotificationOptionVideoPlayback": "Spusten\u00e9 prehr\u00e1vanie videa",
"NotificationOptionAudioPlayback": "Audio playback started", "NotificationOptionAudioPlayback": "Spusten\u00e9 prehr\u00e1vanie audia",
"NotificationOptionGamePlayback": "Game playback started", "NotificationOptionGamePlayback": "Game playback started",
"NotificationOptionVideoPlaybackStopped": "Video playback stopped", "NotificationOptionVideoPlaybackStopped": "Zastaven\u00e9 prehr\u00e1vanie videa",
"NotificationOptionAudioPlaybackStopped": "Audio playback stopped", "NotificationOptionAudioPlaybackStopped": "Zastaven\u00e9 prehr\u00e1vanie audia",
"NotificationOptionGamePlaybackStopped": "Game playback stopped", "NotificationOptionGamePlaybackStopped": "Hra ukon\u010den\u00e1",
"NotificationOptionTaskFailed": "Scheduled task failure", "NotificationOptionTaskFailed": "Napl\u00e1novan\u00e1 \u00faloha zlyhala",
"NotificationOptionInstallationFailed": "Installation failure", "NotificationOptionInstallationFailed": "Chyba in\u0161tal\u00e1cie",
"NotificationOptionNewLibraryContent": "New content added", "NotificationOptionNewLibraryContent": "Pridan\u00fd nov\u00fd obsah",
"NotificationOptionCameraImageUploaded": "Camera image uploaded", "NotificationOptionCameraImageUploaded": "Camera image uploaded",
"NotificationOptionUserLockedOut": "User locked out", "NotificationOptionUserLockedOut": "User locked out",
"NotificationOptionServerRestartRequired": "Server restart required", "NotificationOptionServerRestartRequired": "Vy\u017eaduje sa re\u0161tart servera",
"UserLockedOutWithName": "User {0} has been locked out", "UserLockedOutWithName": "User {0} has been locked out",
"SubtitleDownloadFailureForItem": "Subtitles failed to download for {0}", "SubtitleDownloadFailureForItem": "S\u0165ahovanie titulkov pre {0} zlyhalo",
"Sync": "Sync", "Sync": "Sync",
"User": "User", "User": "Pou\u017e\u00edvate\u013e",
"System": "System", "System": "Syst\u00e9m",
"Application": "Aplik\u00e1cia", "Application": "Aplik\u00e1cia",
"Plugin": "Plugin" "Plugin": "Plugin"
} }

@ -109,6 +109,18 @@ namespace Emby.Server.Implementations.Session
{ {
dict["StartPositionTicks"] = command.StartPositionTicks.Value.ToString(CultureInfo.InvariantCulture); 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); return SendMessage(command.PlayCommand.ToString(), dict, cancellationToken);
} }

@ -972,7 +972,6 @@ namespace Emby.Server.Implementations.Session
if (command.PlayCommand == PlayCommand.PlayInstantMix) if (command.PlayCommand == PlayCommand.PlayInstantMix)
{ {
items = command.ItemIds.SelectMany(i => TranslateItemForInstantMix(i, user)) items = command.ItemIds.SelectMany(i => TranslateItemForInstantMix(i, user))
.Where(i => i.LocationType != LocationType.Virtual)
.ToList(); .ToList();
command.PlayCommand = PlayCommand.PlayNow; command.PlayCommand = PlayCommand.PlayNow;
@ -986,9 +985,7 @@ namespace Emby.Server.Implementations.Session
list.AddRange(subItems); list.AddRange(subItems);
} }
items = list items = list;
.Where(i => i.LocationType != LocationType.Virtual)
.ToList();
} }
if (command.PlayCommand == PlayCommand.PlayShuffle) if (command.PlayCommand == PlayCommand.PlayShuffle)
@ -1074,7 +1071,8 @@ namespace Emby.Server.Implementations.Session
{ {
ItemFields.SortName ItemFields.SortName
} }
} },
IsVirtualItem = false
}); });
return FilterToSingleMediaType(items) return FilterToSingleMediaType(items)
@ -1097,7 +1095,8 @@ namespace Emby.Server.Implementations.Session
{ {
ItemFields.SortName ItemFields.SortName
} }
} },
IsVirtualItem = false
}); });

@ -66,7 +66,7 @@ namespace MediaBrowser.Api.Session
[Route("/Sessions/{Id}/Playing", "POST", Summary = "Instructs a session to play an item")] [Route("/Sessions/{Id}/Playing", "POST", Summary = "Instructs a session to play an item")]
[Authenticated] [Authenticated]
public class Play : IReturnVoid public class Play : PlayRequest
{ {
/// <summary> /// <summary>
/// Gets or sets the id. /// Gets or sets the id.
@ -74,27 +74,6 @@ namespace MediaBrowser.Api.Session
/// <value>The id.</value> /// <value>The id.</value>
[ApiMember(Name = "Id", Description = "Session Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")] [ApiMember(Name = "Id", Description = "Session Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
public string Id { get; set; } public string Id { get; set; }
/// <summary>
/// Artist, Genre, Studio, Person, or any kind of BaseItem
/// </summary>
/// <value>The type of the item.</value>
[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; }
/// <summary>
/// Gets or sets the start position ticks that the first item should be played at
/// </summary>
/// <value>The start position ticks.</value>
[ApiMember(Name = "StartPositionTicks", Description = "The starting position of the first item.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")]
public long? StartPositionTicks { get; set; }
/// <summary>
/// Gets or sets the play command.
/// </summary>
/// <value>The play command.</value>
[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")] [Route("/Sessions/{Id}/Playing/{Command}", "POST", Summary = "Issues a playstate command to a client")]
@ -471,15 +450,7 @@ namespace MediaBrowser.Api.Session
/// <param name="request">The request.</param> /// <param name="request">The request.</param>
public void Post(Play request) public void Post(Play request)
{ {
var command = new PlayRequest var task = _sessionManager.SendPlayCommand(GetSession(_sessionContext).Result.Id, request.Id, request, CancellationToken.None);
{
ItemIds = request.ItemIds.Split(','),
PlayCommand = request.PlayCommand,
StartPositionTicks = request.StartPositionTicks
};
var task = _sessionManager.SendPlayCommand(GetSession(_sessionContext).Result.Id, request.Id, command, CancellationToken.None);
Task.WaitAll(task); Task.WaitAll(task);
} }

@ -1,4 +1,5 @@
 using MediaBrowser.Model.Services;
namespace MediaBrowser.Model.Session namespace MediaBrowser.Model.Session
{ {
/// <summary> /// <summary>
@ -10,18 +11,21 @@ namespace MediaBrowser.Model.Session
/// Gets or sets the item ids. /// Gets or sets the item ids.
/// </summary> /// </summary>
/// <value>The item ids.</value> /// <value>The item ids.</value>
[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; } public string[] ItemIds { get; set; }
/// <summary> /// <summary>
/// Gets or sets the start position ticks that the first item should be played at /// Gets or sets the start position ticks that the first item should be played at
/// </summary> /// </summary>
/// <value>The start position ticks.</value> /// <value>The start position ticks.</value>
[ApiMember(Name = "StartPositionTicks", Description = "The starting position of the first item.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")]
public long? StartPositionTicks { get; set; } public long? StartPositionTicks { get; set; }
/// <summary> /// <summary>
/// Gets or sets the play command. /// Gets or sets the play command.
/// </summary> /// </summary>
/// <value>The play command.</value> /// <value>The play command.</value>
[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; } public PlayCommand PlayCommand { get; set; }
/// <summary> /// <summary>
@ -29,5 +33,9 @@ namespace MediaBrowser.Model.Session
/// </summary> /// </summary>
/// <value>The controlling user identifier.</value> /// <value>The controlling user identifier.</value>
public string ControllingUserId { get; set; } public string ControllingUserId { get; set; }
public int? SubtitleStreamIndex { get; set; }
public int? AudioStreamIndex { get; set; }
public string MediaSourceId { get; set; }
} }
} }

@ -1,3 +1,3 @@
using System.Reflection; using System.Reflection;
[assembly: AssemblyVersion("3.2.36.5")] [assembly: AssemblyVersion("3.2.36.6")]

Loading…
Cancel
Save