add device upload options

This commit is contained in:
Luke Pulverenti
2014-10-11 16:38:13 -04:00
parent 2486cffa71
commit f3539686bd
50 changed files with 1030 additions and 209 deletions

View File

@@ -1,5 +1,6 @@
using MediaBrowser.Model.Channels;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Devices;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Events;
@@ -793,17 +794,23 @@ namespace MediaBrowser.Model.ApiClient
/// <value>The type of the client.</value>
string ClientName { get; set; }
/// <summary>
/// Gets the device.
/// </summary>
/// <value>The device.</value>
IDevice Device { get; }
/// <summary>
/// Gets or sets the name of the device.
/// </summary>
/// <value>The name of the device.</value>
string DeviceName { get; set; }
string DeviceName { get; }
/// <summary>
/// Gets or sets the device id.
/// </summary>
/// <value>The device id.</value>
string DeviceId { get; set; }
string DeviceId { get; }
/// <summary>
/// Gets or sets the current user id.
@@ -1319,5 +1326,29 @@ namespace MediaBrowser.Model.ApiClient
/// <returns>Task.</returns>
Task SendContextMessageAsync(string itemType, string itemId, string itemName, string context,
CancellationToken cancellationToken);
/// <summary>
/// Gets the content upload history.
/// </summary>
/// <param name="deviceId">The device identifier.</param>
/// <returns>Task&lt;ContentUploadHistory&gt;.</returns>
Task<ContentUploadHistory> GetContentUploadHistory(string deviceId);
/// <summary>
/// Uploads the file.
/// </summary>
/// <param name="stream">The stream.</param>
/// <param name="file">The file.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
Task UploadFile(Stream stream,
LocalFileInfo file,
CancellationToken cancellationToken);
/// <summary>
/// Gets the devices options options.
/// </summary>
/// <returns>Task&lt;DevicesOptions&gt;.</returns>
Task<DevicesOptions> GetDevicesOptions();
}
}

View File

@@ -0,0 +1,44 @@
using MediaBrowser.Model.Devices;
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace MediaBrowser.Model.ApiClient
{
public interface IDevice
{
/// <summary>
/// Occurs when [resume from sleep].
/// </summary>
event EventHandler<EventArgs> ResumeFromSleep;
/// <summary>
/// Gets the name of the device.
/// </summary>
/// <value>The name of the device.</value>
string DeviceName { get; }
/// <summary>
/// Gets the device identifier.
/// </summary>
/// <value>The device identifier.</value>
string DeviceId { get; }
/// <summary>
/// Gets the local images.
/// </summary>
/// <returns>IEnumerable&lt;LocalFileInfo&gt;.</returns>
IEnumerable<LocalFileInfo> GetLocalPhotos();
/// <summary>
/// Gets the local videos.
/// </summary>
/// <returns>IEnumerable&lt;LocalFileInfo&gt;.</returns>
IEnumerable<LocalFileInfo> GetLocalVideos();
/// <summary>
/// Uploads the file.
/// </summary>
/// <param name="file">The file.</param>
/// <param name="apiClient">The API client.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
Task UploadFile(LocalFileInfo file, IApiClient apiClient, CancellationToken cancellationToken);
}
}

View File

@@ -0,0 +1,15 @@
using System.Collections.Generic;
namespace MediaBrowser.Model.Devices
{
public class ContentUploadHistory
{
public string DeviceId { get; set; }
public List<LocalFileInfo> FilesUploaded { get; set; }
public ContentUploadHistory()
{
FilesUploaded = new List<LocalFileInfo>();
}
}
}

View File

@@ -0,0 +1,44 @@
using System;
using MediaBrowser.Model.Session;
namespace MediaBrowser.Model.Devices
{
public class DeviceInfo
{
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public string Name { get; set; }
/// <summary>
/// Gets or sets the identifier.
/// </summary>
/// <value>The identifier.</value>
public string Id { get; set; }
/// <summary>
/// Gets or sets the last name of the user.
/// </summary>
/// <value>The last name of the user.</value>
public string LastUserName { get; set; }
/// <summary>
/// Gets or sets the last user identifier.
/// </summary>
/// <value>The last user identifier.</value>
public string LastUserId { get; set; }
/// <summary>
/// Gets or sets the date last modified.
/// </summary>
/// <value>The date last modified.</value>
public DateTime DateLastModified { get; set; }
/// <summary>
/// Gets or sets the capabilities.
/// </summary>
/// <value>The capabilities.</value>
public ClientCapabilities Capabilities { get; set; }
public DeviceInfo()
{
Capabilities = new ClientCapabilities();
}
}
}

View File

@@ -0,0 +1,14 @@

namespace MediaBrowser.Model.Devices
{
public class DevicesOptions
{
public string[] EnabledCameraUploadDevices { get; set; }
public string CameraUploadPath { get; set; }
public DevicesOptions()
{
EnabledCameraUploadDevices = new string[] { };
}
}
}

View File

@@ -0,0 +1,11 @@

namespace MediaBrowser.Model.Devices
{
public class LocalFileInfo
{
public string Name { get; set; }
public string FullPath { get; set; }
public string Album { get; set; }
public string MimeType { get; set; }
}
}

View File

@@ -6,7 +6,9 @@ namespace MediaBrowser.Model.Dlna.Profiles
[XmlRoot("Profile")]
public class AndroidProfile : DefaultProfile
{
public AndroidProfile(bool supportsHls, bool supportsMpegDash)
public AndroidProfile(bool supportsHls,
bool supportsMpegDash,
string[] supportedH264Profiles)
{
Name = "Android";
@@ -102,7 +104,7 @@ namespace MediaBrowser.Model.Dlna.Profiles
Conditions = new []
{
new ProfileCondition(ProfileConditionType.EqualsAny, ProfileConditionValue.VideoProfile, "baseline|constrained baseline"),
new ProfileCondition(ProfileConditionType.EqualsAny, ProfileConditionValue.VideoProfile, string.Join("|", supportedH264Profiles)),
new ProfileCondition(ProfileConditionType.LessThanEqual, ProfileConditionValue.Width, "1920"),
new ProfileCondition(ProfileConditionType.LessThanEqual, ProfileConditionValue.Height, "1080"),
new ProfileCondition(ProfileConditionType.LessThanEqual, ProfileConditionValue.VideoBitDepth, "8"),

View File

@@ -733,12 +733,6 @@ namespace MediaBrowser.Model.Dlna
private bool IsVideoDirectPlaySupported(DirectPlayProfile profile, MediaSourceInfo item, MediaStream videoStream, MediaStream audioStream)
{
// Only plain video files can be direct played
if (item.VideoType != VideoType.VideoFile)
{
return false;
}
if (profile.Container.Length > 0)
{
// Check container type

View File

@@ -76,7 +76,10 @@ namespace MediaBrowser.Model.Dlna
public bool IsDirectStream
{
get { return PlayMethod == PlayMethod.DirectStream; }
get {
return PlayMethod == PlayMethod.DirectStream ||
PlayMethod == PlayMethod.DirectPlay;
}
}
public string ToUrl(string baseUrl)
@@ -91,13 +94,6 @@ namespace MediaBrowser.Model.Dlna
throw new ArgumentNullException(baseUrl);
}
if (IsDirectStream && MediaSource != null && MediaSource.Protocol == MediaProtocol.Http)
{
if (MediaSource.RequiredHttpHeaders.Count == 0)
{
}
}
string dlnaCommand = BuildDlnaParam(this);
string extension = string.IsNullOrEmpty(Container) ? string.Empty : "." + Container;

View File

@@ -67,6 +67,7 @@
<Compile Include="ApiClient\IApiClient.cs" />
<Compile Include="ApiClient\ApiClientExtensions.cs" />
<Compile Include="ApiClient\IConnectionManager.cs" />
<Compile Include="ApiClient\IDevice.cs" />
<Compile Include="ApiClient\IServerEvents.cs" />
<Compile Include="ApiClient\GeneralCommandEventArgs.cs" />
<Compile Include="ApiClient\ServerDiscoveryInfo.cs" />
@@ -95,6 +96,9 @@
<Compile Include="Configuration\XbmcMetadataOptions.cs" />
<Compile Include="Configuration\SubtitlePlaybackMode.cs" />
<Compile Include="Connect\UserLinkType.cs" />
<Compile Include="Devices\LocalFileInfo.cs" />
<Compile Include="Devices\DeviceInfo.cs" />
<Compile Include="Devices\DevicesOptions.cs" />
<Compile Include="Dlna\EncodingContext.cs" />
<Compile Include="Dlna\Profiles\AndroidProfile.cs" />
<Compile Include="Dlna\Profiles\DefaultProfile.cs" />
@@ -331,11 +335,11 @@
<Compile Include="Serialization\IJsonSerializer.cs" />
<Compile Include="Serialization\IXmlSerializer.cs" />
<Compile Include="Session\PlaystateRequest.cs" />
<Compile Include="Session\SessionCapabilities.cs" />
<Compile Include="Session\SessionInfoDto.cs" />
<Compile Include="Session\SessionUserInfo.cs" />
<Compile Include="Session\TranscodingInfo.cs" />
<Compile Include="Session\UserDataChangeInfo.cs" />
<Compile Include="Devices\ContentUploadHistory.cs" />
<Compile Include="Sync\SyncJob.cs" />
<Compile Include="Sync\SyncJobCreationResult.cs" />
<Compile Include="Sync\SyncJobItem.cs" />

View File

@@ -5,8 +5,15 @@ namespace MediaBrowser.Model.Session
public class ClientCapabilities
{
public List<string> PlayableMediaTypes { get; set; }
public List<string> SupportedCommands { get; set; }
public bool SupportsMediaControl { get; set; }
public string MessageCallbackUrl { get; set; }
public bool SupportsContentUploading { get; set; }
public ClientCapabilities()
{
PlayableMediaTypes = new List<string>();

View File

@@ -1,21 +0,0 @@
using System.Collections.Generic;
namespace MediaBrowser.Model.Session
{
public class SessionCapabilities
{
public List<string> PlayableMediaTypes { get; set; }
public List<string> SupportedCommands { get; set; }
public bool SupportsMediaControl { get; set; }
public string MessageCallbackUrl { get; set; }
public SessionCapabilities()
{
PlayableMediaTypes = new List<string>();
SupportedCommands = new List<string>();
}
}
}