mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-21 09:34:44 +01:00
Add remote control chapter menu
This commit is contained in:
@@ -12,6 +12,7 @@ using MediaBrowser.Controller.LiveTv;
|
||||
using MediaBrowser.Controller.Persistence;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Controller.Session;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.Drawing;
|
||||
using MediaBrowser.Model.Dto;
|
||||
using MediaBrowser.Model.Entities;
|
||||
@@ -110,6 +111,15 @@ namespace MediaBrowser.Server.Implementations.Dto
|
||||
|
||||
AttachBasicFields(dto, item, owner, fields);
|
||||
|
||||
if (user != null && dto.MediaSources != null && item is Video)
|
||||
{
|
||||
foreach (var source in dto.MediaSources)
|
||||
{
|
||||
//source.DefaultAudioStreamIndex = GetDefaultAudioStreamIndex(source, user.Configuration);
|
||||
//source.DefaultSubtitleStreamIndex = GetDefaultSubtitleStreamIndex(source, user.Configuration);
|
||||
}
|
||||
}
|
||||
|
||||
if (fields.Contains(ItemFields.SoundtrackIds))
|
||||
{
|
||||
var hasSoundtracks = item as IHasSoundtracks;
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
"HeaderPlaybackSettings": "Playback Settings",
|
||||
"LabelAudioLanguagePreference": "Audio language preference:",
|
||||
"LabelSubtitleLanguagePreference": "Subtitle language preference:",
|
||||
"LabelDisplayForcedSubtitlesOnly": "Display only forced subtitles",
|
||||
"OptionDefaultSubtitles": "Default",
|
||||
"TabProfiles": "Profiles",
|
||||
"TabSecurity": "Security",
|
||||
"ButtonAddUser": "Add User",
|
||||
@@ -228,6 +228,8 @@
|
||||
"ButtonSearch": "Search",
|
||||
"ButtonGroupVersions": "Group Versions",
|
||||
"PismoMessage": "Utilizing Pismo File Mount through a donated license.",
|
||||
"TangibleSoftwareMessage": "Utilizing Tangible Solutions Java/C# converters through a donated license.",
|
||||
"HeaderCredits": "Credits",
|
||||
"PleaseSupportOtherProduces": "Please support other free products we utilize:",
|
||||
"VersionNumber": "Version {0}",
|
||||
"TabPaths": "Paths",
|
||||
@@ -327,7 +329,7 @@
|
||||
"OptionAutomatic": "Auto",
|
||||
"LiveTvPluginRequired": "A Live TV service provider plugin is required in order to continue.",
|
||||
"LiveTvPluginRequiredHelp": "Please install one of our available plugins, such as Next Pvr or ServerWmc.",
|
||||
"HeaderCustomizeOptionsPerMediaType": "Customize options per media type",
|
||||
"LabelCustomizeOptionsPerMediaType": "Customize for media type:",
|
||||
"OptionDownloadThumbImage": "Thumb",
|
||||
"OptionDownloadMenuImage": "Menu",
|
||||
"OptionDownloadLogoImage": "Logo",
|
||||
@@ -339,6 +341,7 @@
|
||||
"OptionDownloadPrimaryImage": "Primary",
|
||||
"HeaderFetchImages": "Fetch Images:",
|
||||
"HeaderImageSettings": "Image Settings",
|
||||
"TabCustomizations": "Customizations",
|
||||
"LabelMaxBackdropsPerItem": "Maximum number of backdrops per item:",
|
||||
"LabelMaxScreenshotsPerItem": "Maximum number of screenshots per item:",
|
||||
"LabelMinBackdropDownloadWidth": "Minimum backdrop download width:",
|
||||
@@ -721,7 +724,8 @@
|
||||
"TabSubtitles": "Subtitles",
|
||||
"LabelOpenSubtitlesUsername": "Open Subtitles username:",
|
||||
"LabelOpenSubtitlesPassword": "Open Subtitles password:",
|
||||
"LabelAudioLanguagePreferenceHelp": "If empty, the default audio track will be selected, regardless of language.",
|
||||
"LabelPlayDefaultAudioTrack": "Play default audio track regardless of language",
|
||||
"LabelSubtitlePlaybackMode": "Subtitle mode:",
|
||||
"LabelDownloadLanguages": "Download languages:",
|
||||
"ButtonRegister": "Register",
|
||||
"LabelSkipIfAudioTrackPresent": "Skip if the default audio track matches the download language",
|
||||
|
||||
@@ -200,7 +200,6 @@
|
||||
<Compile Include="Persistence\SqliteShrinkMemoryTimer.cs" />
|
||||
<Compile Include="Persistence\TypeMapper.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Roku\RokuControllerFactory.cs" />
|
||||
<Compile Include="ScheduledTasks\PeopleValidationTask.cs" />
|
||||
<Compile Include="ScheduledTasks\ChapterImagesTask.cs" />
|
||||
<Compile Include="ScheduledTasks\RefreshIntrosTask.cs" />
|
||||
@@ -209,7 +208,7 @@
|
||||
<Compile Include="ServerApplicationPaths.cs" />
|
||||
<Compile Include="ServerManager\ServerManager.cs" />
|
||||
<Compile Include="ServerManager\WebSocketConnection.cs" />
|
||||
<Compile Include="Roku\RokuSessionController.cs" />
|
||||
<Compile Include="Session\HttpSessionController.cs" />
|
||||
<Compile Include="Session\SessionManager.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Controller;
|
||||
using MediaBrowser.Controller.Session;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Roku
|
||||
{
|
||||
public class RokuControllerFactory : ISessionControllerFactory
|
||||
{
|
||||
private readonly IHttpClient _httpClient;
|
||||
private readonly IJsonSerializer _json;
|
||||
private readonly IServerApplicationHost _appHost;
|
||||
|
||||
public RokuControllerFactory(IHttpClient httpClient, IJsonSerializer json, IServerApplicationHost appHost)
|
||||
{
|
||||
_httpClient = httpClient;
|
||||
_json = json;
|
||||
_appHost = appHost;
|
||||
}
|
||||
|
||||
public ISessionController GetSessionController(SessionInfo session)
|
||||
{
|
||||
if (string.Equals(session.Client, "roku", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
session.PlayableMediaTypes = new List<string> { MediaType.Video, MediaType.Audio };
|
||||
|
||||
return new RokuSessionController(_httpClient, _json, _appHost, session);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,9 +10,9 @@ using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Roku
|
||||
namespace MediaBrowser.Server.Implementations.Session
|
||||
{
|
||||
public class RokuSessionController : ISessionController
|
||||
public class HttpSessionController : ISessionController
|
||||
{
|
||||
private readonly IHttpClient _httpClient;
|
||||
private readonly IJsonSerializer _json;
|
||||
@@ -20,12 +20,21 @@ namespace MediaBrowser.Server.Implementations.Roku
|
||||
|
||||
public SessionInfo Session { get; private set; }
|
||||
|
||||
public RokuSessionController(IHttpClient httpClient, IJsonSerializer json, IServerApplicationHost appHost, SessionInfo session)
|
||||
//var postUrl = string.Format("http://{0}/mediabrowser/message", session.RemoteEndPoint);
|
||||
|
||||
private readonly string _postUrl;
|
||||
|
||||
public HttpSessionController(IHttpClient httpClient,
|
||||
IJsonSerializer json,
|
||||
IServerApplicationHost appHost,
|
||||
SessionInfo session,
|
||||
string postUrl)
|
||||
{
|
||||
_httpClient = httpClient;
|
||||
_json = json;
|
||||
_appHost = appHost;
|
||||
Session = session;
|
||||
_postUrl = postUrl;
|
||||
}
|
||||
|
||||
public bool SupportsMediaRemoteControl
|
||||
@@ -41,6 +50,19 @@ namespace MediaBrowser.Server.Implementations.Roku
|
||||
}
|
||||
}
|
||||
|
||||
private Task SendMessage(object obj, CancellationToken cancellationToken)
|
||||
{
|
||||
var json = _json.SerializeToString(obj);
|
||||
|
||||
return _httpClient.Post(new HttpRequestOptions
|
||||
{
|
||||
Url = _postUrl,
|
||||
CancellationToken = cancellationToken,
|
||||
RequestContent = json,
|
||||
RequestContentType = "application/json"
|
||||
});
|
||||
}
|
||||
|
||||
public Task SendSessionEndedNotification(SessionInfoDto sessionInfo, CancellationToken cancellationToken)
|
||||
{
|
||||
return Task.FromResult(true);
|
||||
@@ -58,7 +80,7 @@ namespace MediaBrowser.Server.Implementations.Roku
|
||||
|
||||
public Task SendPlayCommand(PlayRequest command, CancellationToken cancellationToken)
|
||||
{
|
||||
return SendCommand(new WebSocketMessage<PlayRequest>
|
||||
return SendMessage(new WebSocketMessage<PlayRequest>
|
||||
{
|
||||
MessageType = "Play",
|
||||
Data = command
|
||||
@@ -68,7 +90,7 @@ namespace MediaBrowser.Server.Implementations.Roku
|
||||
|
||||
public Task SendPlaystateCommand(PlaystateRequest command, CancellationToken cancellationToken)
|
||||
{
|
||||
return SendCommand(new WebSocketMessage<PlaystateRequest>
|
||||
return SendMessage(new WebSocketMessage<PlaystateRequest>
|
||||
{
|
||||
MessageType = "Playstate",
|
||||
Data = command
|
||||
@@ -78,13 +100,12 @@ namespace MediaBrowser.Server.Implementations.Roku
|
||||
|
||||
public Task SendLibraryUpdateInfo(LibraryUpdateInfo info, CancellationToken cancellationToken)
|
||||
{
|
||||
// Roku probably won't care about this
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
|
||||
public Task SendRestartRequiredNotification(CancellationToken cancellationToken)
|
||||
{
|
||||
return SendCommand(new WebSocketMessage<SystemInfo>
|
||||
return SendMessage(new WebSocketMessage<SystemInfo>
|
||||
{
|
||||
MessageType = "RestartRequired",
|
||||
Data = _appHost.GetSystemInfo()
|
||||
@@ -94,13 +115,12 @@ namespace MediaBrowser.Server.Implementations.Roku
|
||||
|
||||
public Task SendUserDataChangeInfo(UserDataChangeInfo info, CancellationToken cancellationToken)
|
||||
{
|
||||
// Roku probably won't care about this
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
|
||||
public Task SendServerShutdownNotification(CancellationToken cancellationToken)
|
||||
{
|
||||
return SendCommand(new WebSocketMessage<string>
|
||||
return SendMessage(new WebSocketMessage<string>
|
||||
{
|
||||
MessageType = "ServerShuttingDown",
|
||||
Data = string.Empty
|
||||
@@ -110,7 +130,7 @@ namespace MediaBrowser.Server.Implementations.Roku
|
||||
|
||||
public Task SendServerRestartNotification(CancellationToken cancellationToken)
|
||||
{
|
||||
return SendCommand(new WebSocketMessage<string>
|
||||
return SendMessage(new WebSocketMessage<string>
|
||||
{
|
||||
MessageType = "ServerRestarting",
|
||||
Data = string.Empty
|
||||
@@ -118,24 +138,11 @@ namespace MediaBrowser.Server.Implementations.Roku
|
||||
}, cancellationToken);
|
||||
}
|
||||
|
||||
private Task SendCommand(object obj, CancellationToken cancellationToken)
|
||||
{
|
||||
var json = _json.SerializeToString(obj);
|
||||
|
||||
return _httpClient.Post(new HttpRequestOptions
|
||||
{
|
||||
Url = "http://" + Session.RemoteEndPoint + "/mb/remotecontrol",
|
||||
CancellationToken = cancellationToken,
|
||||
RequestContent = json,
|
||||
RequestContentType = "application/json"
|
||||
});
|
||||
}
|
||||
|
||||
public Task SendGeneralCommand(GeneralCommand command, CancellationToken cancellationToken)
|
||||
{
|
||||
return SendCommand(new WebSocketMessage<GeneralCommand>
|
||||
return SendMessage(new WebSocketMessage<GeneralCommand>
|
||||
{
|
||||
MessageType = "Command",
|
||||
MessageType = "GeneralCommand",
|
||||
Data = command
|
||||
|
||||
}, cancellationToken);
|
||||
Reference in New Issue
Block a user