mirror of https://github.com/jellyfin/jellyfin.git
Some minor code cleanups
This commit is contained in:
parent
016590529f
commit
670a53258e
|
@ -3,7 +3,6 @@ using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Entities.Movies;
|
using MediaBrowser.Controller.Entities.Movies;
|
||||||
using MediaBrowser.Controller.Entities.TV;
|
using MediaBrowser.Controller.Entities.TV;
|
||||||
using MediaBrowser.Model.DTO;
|
using MediaBrowser.Model.DTO;
|
||||||
using MediaBrowser.Model.Entities;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
@ -33,9 +32,9 @@ namespace MediaBrowser.Api
|
||||||
/// <param name="logActivity">Whether or not to update the user's LastActivityDate</param>
|
/// <param name="logActivity">Whether or not to update the user's LastActivityDate</param>
|
||||||
public static User GetUserById(string id, bool logActivity)
|
public static User GetUserById(string id, bool logActivity)
|
||||||
{
|
{
|
||||||
Guid guid = new Guid(id);
|
var guid = new Guid(id);
|
||||||
|
|
||||||
User user = Kernel.Instance.Users.FirstOrDefault(u => u.Id == guid);
|
var user = Kernel.Instance.Users.FirstOrDefault(u => u.Id == guid);
|
||||||
|
|
||||||
if (logActivity)
|
if (logActivity)
|
||||||
{
|
{
|
||||||
|
@ -73,11 +72,11 @@ namespace MediaBrowser.Api
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Converts a BaseItem to a DTOBaseItem
|
/// Converts a BaseItem to a DTOBaseItem
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public async static Task<DTOBaseItem> GetDTOBaseItem(BaseItem item, User user,
|
public async static Task<DtoBaseItem> GetDtoBaseItem(BaseItem item, User user,
|
||||||
bool includeChildren = true,
|
bool includeChildren = true,
|
||||||
bool includePeople = true)
|
bool includePeople = true)
|
||||||
{
|
{
|
||||||
DTOBaseItem dto = new DTOBaseItem();
|
DtoBaseItem dto = new DtoBaseItem();
|
||||||
|
|
||||||
List<Task> tasks = new List<Task>();
|
List<Task> tasks = new List<Task>();
|
||||||
|
|
||||||
|
@ -108,7 +107,7 @@ namespace MediaBrowser.Api
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets simple property values on a DTOBaseItem
|
/// Sets simple property values on a DTOBaseItem
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static void AttachBasicFields(DTOBaseItem dto, BaseItem item, User user)
|
private static void AttachBasicFields(DtoBaseItem dto, BaseItem item, User user)
|
||||||
{
|
{
|
||||||
dto.AspectRatio = item.AspectRatio;
|
dto.AspectRatio = item.AspectRatio;
|
||||||
dto.BackdropCount = item.BackdropImagePaths == null ? 0 : item.BackdropImagePaths.Count();
|
dto.BackdropCount = item.BackdropImagePaths == null ? 0 : item.BackdropImagePaths.Count();
|
||||||
|
@ -173,7 +172,7 @@ namespace MediaBrowser.Api
|
||||||
dto.Type = item.GetType().Name;
|
dto.Type = item.GetType().Name;
|
||||||
dto.UserRating = item.UserRating;
|
dto.UserRating = item.UserRating;
|
||||||
|
|
||||||
dto.UserData = GetDTOUserItemData(item.GetUserData(user, false));
|
dto.UserData = GetDtoUserItemData(item.GetUserData(user, false));
|
||||||
|
|
||||||
Folder folder = item as Folder;
|
Folder folder = item as Folder;
|
||||||
|
|
||||||
|
@ -190,7 +189,7 @@ namespace MediaBrowser.Api
|
||||||
|
|
||||||
if (audio != null)
|
if (audio != null)
|
||||||
{
|
{
|
||||||
dto.AudioInfo = new AudioInfo()
|
dto.AudioInfo = new AudioInfo
|
||||||
{
|
{
|
||||||
Album = audio.Album,
|
Album = audio.Album,
|
||||||
AlbumArtist = audio.AlbumArtist,
|
AlbumArtist = audio.AlbumArtist,
|
||||||
|
@ -205,7 +204,7 @@ namespace MediaBrowser.Api
|
||||||
|
|
||||||
if (video != null)
|
if (video != null)
|
||||||
{
|
{
|
||||||
dto.VideoInfo = new VideoInfo()
|
dto.VideoInfo = new VideoInfo
|
||||||
{
|
{
|
||||||
Height = video.Height,
|
Height = video.Height,
|
||||||
Width = video.Width,
|
Width = video.Width,
|
||||||
|
@ -232,7 +231,7 @@ namespace MediaBrowser.Api
|
||||||
{
|
{
|
||||||
DayOfWeek[] airDays = series.AirDays == null ? new DayOfWeek[] { } : series.AirDays.ToArray(); ;
|
DayOfWeek[] airDays = series.AirDays == null ? new DayOfWeek[] { } : series.AirDays.ToArray(); ;
|
||||||
|
|
||||||
dto.SeriesInfo = new SeriesInfo()
|
dto.SeriesInfo = new SeriesInfo
|
||||||
{
|
{
|
||||||
AirDays = airDays,
|
AirDays = airDays,
|
||||||
AirTime = series.AirTime,
|
AirTime = series.AirTime,
|
||||||
|
@ -247,7 +246,7 @@ namespace MediaBrowser.Api
|
||||||
{
|
{
|
||||||
int specialFeatureCount = movie.SpecialFeatures == null ? 0 : movie.SpecialFeatures.Count();
|
int specialFeatureCount = movie.SpecialFeatures == null ? 0 : movie.SpecialFeatures.Count();
|
||||||
|
|
||||||
dto.MovieInfo = new MovieInfo()
|
dto.MovieInfo = new MovieInfo
|
||||||
{
|
{
|
||||||
SpecialFeatureCount = specialFeatureCount
|
SpecialFeatureCount = specialFeatureCount
|
||||||
};
|
};
|
||||||
|
@ -257,12 +256,12 @@ namespace MediaBrowser.Api
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Attaches Studio DTO's to a DTOBaseItem
|
/// Attaches Studio DTO's to a DTOBaseItem
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static async Task AttachStudios(DTOBaseItem dto, BaseItem item)
|
private static async Task AttachStudios(DtoBaseItem dto, BaseItem item)
|
||||||
{
|
{
|
||||||
// Attach Studios by transforming them into BaseItemStudio (DTO)
|
// Attach Studios by transforming them into BaseItemStudio (DTO)
|
||||||
if (item.Studios != null)
|
if (item.Studios != null)
|
||||||
{
|
{
|
||||||
Studio[] entities = await Task.WhenAll<Studio>(item.Studios.Select(c => Kernel.Instance.ItemController.GetStudio(c))).ConfigureAwait(false);
|
Studio[] entities = await Task.WhenAll(item.Studios.Select(c => Kernel.Instance.ItemController.GetStudio(c))).ConfigureAwait(false);
|
||||||
|
|
||||||
dto.Studios = new BaseItemStudio[entities.Length];
|
dto.Studios = new BaseItemStudio[entities.Length];
|
||||||
|
|
||||||
|
@ -283,7 +282,7 @@ namespace MediaBrowser.Api
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Attaches child DTO's to a DTOBaseItem
|
/// Attaches child DTO's to a DTOBaseItem
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static async Task AttachChildren(DTOBaseItem dto, BaseItem item, User user)
|
private static async Task AttachChildren(DtoBaseItem dto, BaseItem item, User user)
|
||||||
{
|
{
|
||||||
var folder = item as Folder;
|
var folder = item as Folder;
|
||||||
|
|
||||||
|
@ -291,30 +290,30 @@ namespace MediaBrowser.Api
|
||||||
{
|
{
|
||||||
IEnumerable<BaseItem> children = folder.GetParentalAllowedChildren(user);
|
IEnumerable<BaseItem> children = folder.GetParentalAllowedChildren(user);
|
||||||
|
|
||||||
dto.Children = await Task.WhenAll<DTOBaseItem>(children.Select(c => GetDTOBaseItem(c, user, false, false))).ConfigureAwait(false);
|
dto.Children = await Task.WhenAll(children.Select(c => GetDtoBaseItem(c, user, false, false))).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Attaches trailer DTO's to a DTOBaseItem
|
/// Attaches trailer DTO's to a DTOBaseItem
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static async Task AttachLocalTrailers(DTOBaseItem dto, BaseItem item, User user)
|
private static async Task AttachLocalTrailers(DtoBaseItem dto, BaseItem item, User user)
|
||||||
{
|
{
|
||||||
if (item.LocalTrailers != null && item.LocalTrailers.Any())
|
if (item.LocalTrailers != null && item.LocalTrailers.Any())
|
||||||
{
|
{
|
||||||
dto.LocalTrailers = await Task.WhenAll<DTOBaseItem>(item.LocalTrailers.Select(c => GetDTOBaseItem(c, user, false, false))).ConfigureAwait(false);
|
dto.LocalTrailers = await Task.WhenAll(item.LocalTrailers.Select(c => GetDtoBaseItem(c, user, false, false))).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Attaches People DTO's to a DTOBaseItem
|
/// Attaches People DTO's to a DTOBaseItem
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static async Task AttachPeople(DTOBaseItem dto, BaseItem item)
|
private static async Task AttachPeople(DtoBaseItem dto, BaseItem item)
|
||||||
{
|
{
|
||||||
// Attach People by transforming them into BaseItemPerson (DTO)
|
// Attach People by transforming them into BaseItemPerson (DTO)
|
||||||
if (item.People != null)
|
if (item.People != null)
|
||||||
{
|
{
|
||||||
IEnumerable<Person> entities = await Task.WhenAll<Person>(item.People.Select(c => Kernel.Instance.ItemController.GetPerson(c.Key))).ConfigureAwait(false);
|
IEnumerable<Person> entities = await Task.WhenAll(item.People.Select(c => Kernel.Instance.ItemController.GetPerson(c.Key))).ConfigureAwait(false);
|
||||||
|
|
||||||
dto.People = item.People.Select(p =>
|
dto.People = item.People.Select(p =>
|
||||||
{
|
{
|
||||||
|
@ -384,7 +383,7 @@ namespace MediaBrowser.Api
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static IBNItem GetIBNItem(BaseEntity entity, int itemCount)
|
public static IBNItem GetIBNItem(BaseEntity entity, int itemCount)
|
||||||
{
|
{
|
||||||
return new IBNItem()
|
return new IBNItem
|
||||||
{
|
{
|
||||||
Id = entity.Id,
|
Id = entity.Id,
|
||||||
BaseItemCount = itemCount,
|
BaseItemCount = itemCount,
|
||||||
|
@ -396,9 +395,9 @@ namespace MediaBrowser.Api
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Converts a User to a DTOUser
|
/// Converts a User to a DTOUser
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static DTOUser GetDTOUser(User user)
|
public static DtoUser GetDtoUser(User user)
|
||||||
{
|
{
|
||||||
return new DTOUser()
|
return new DtoUser
|
||||||
{
|
{
|
||||||
Id = user.Id,
|
Id = user.Id,
|
||||||
Name = user.Name,
|
Name = user.Name,
|
||||||
|
@ -412,14 +411,14 @@ namespace MediaBrowser.Api
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Converts a UserItemData to a DTOUserItemData
|
/// Converts a UserItemData to a DTOUserItemData
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static DTOUserItemData GetDTOUserItemData(UserItemData data)
|
public static DtoUserItemData GetDtoUserItemData(UserItemData data)
|
||||||
{
|
{
|
||||||
if (data == null)
|
if (data == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new DTOUserItemData()
|
return new DtoUserItemData
|
||||||
{
|
{
|
||||||
IsFavorite = data.IsFavorite,
|
IsFavorite = data.IsFavorite,
|
||||||
Likes = data.Likes,
|
Likes = data.Likes,
|
||||||
|
|
|
@ -86,7 +86,7 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected override string GetCommandLineArguments()
|
protected override string GetCommandLineArguments()
|
||||||
{
|
{
|
||||||
List<string> audioTranscodeParams = new List<string>();
|
var audioTranscodeParams = new List<string>();
|
||||||
|
|
||||||
AudioOutputFormats outputFormat = GetConversionOutputFormat();
|
AudioOutputFormats outputFormat = GetConversionOutputFormat();
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private TBaseItemType _LibraryItem;
|
private TBaseItemType _libraryItem;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the library item that will be played, if any
|
/// Gets the library item that will be played, if any
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -46,17 +46,17 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (_LibraryItem == null)
|
if (_libraryItem == null)
|
||||||
{
|
{
|
||||||
string id = QueryString["id"];
|
string id = QueryString["id"];
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(id))
|
if (!string.IsNullOrEmpty(id))
|
||||||
{
|
{
|
||||||
_LibraryItem = Kernel.Instance.GetItemById(Guid.Parse(id)) as TBaseItemType;
|
_libraryItem = Kernel.Instance.GetItemById(Guid.Parse(id)) as TBaseItemType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return _LibraryItem;
|
return _libraryItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
|
|
||||||
public override Task<string> GetContentType()
|
public override Task<string> GetContentType()
|
||||||
{
|
{
|
||||||
return Task.FromResult<string>(MimeTypes.GetMimeType("." + GetConversionOutputFormat()));
|
return Task.FromResult(MimeTypes.GetMimeType("." + GetConversionOutputFormat()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool ShouldCompressResponse(string contentType)
|
public override bool ShouldCompressResponse(string contentType)
|
||||||
|
@ -106,12 +106,10 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
|
|
||||||
if (!RequiresConversion())
|
if (!RequiresConversion())
|
||||||
{
|
{
|
||||||
return new StaticFileHandler() { Path = LibraryItem.Path }.ProcessRequest(ctx);
|
return new StaticFileHandler { Path = LibraryItem.Path }.ProcessRequest(ctx);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return base.ProcessRequest(ctx);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return base.ProcessRequest(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract string GetCommandLineArguments();
|
protected abstract string GetCommandLineArguments();
|
||||||
|
@ -173,7 +171,7 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
|
|
||||||
process.EnableRaisingEvents = true;
|
process.EnableRaisingEvents = true;
|
||||||
|
|
||||||
process.Exited += process_Exited;
|
process.Exited += ProcessExited;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -203,7 +201,7 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void process_Exited(object sender, EventArgs e)
|
void ProcessExited(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (LogFileStream != null)
|
if (LogFileStream != null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
using MediaBrowser.Common.Net.Handlers;
|
using MediaBrowser.Common.Net.Handlers;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Model.DTO;
|
using MediaBrowser.Model.DTO;
|
||||||
using MediaBrowser.Model.Entities;
|
|
||||||
using System.ComponentModel.Composition;
|
using System.ComponentModel.Composition;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
@ -12,14 +11,14 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
/// Provides a handler to set user favorite status for an item
|
/// Provides a handler to set user favorite status for an item
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(BaseHandler))]
|
[Export(typeof(BaseHandler))]
|
||||||
public class FavoriteStatusHandler : BaseSerializationHandler<DTOUserItemData>
|
public class FavoriteStatusHandler : BaseSerializationHandler<DtoUserItemData>
|
||||||
{
|
{
|
||||||
public override bool HandlesRequest(HttpListenerRequest request)
|
public override bool HandlesRequest(HttpListenerRequest request)
|
||||||
{
|
{
|
||||||
return ApiService.IsApiUrlMatch("FavoriteStatus", request);
|
return ApiService.IsApiUrlMatch("FavoriteStatus", request);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Task<DTOUserItemData> GetObjectToSerialize()
|
protected override Task<DtoUserItemData> GetObjectToSerialize()
|
||||||
{
|
{
|
||||||
// Get the item
|
// Get the item
|
||||||
BaseItem item = ApiService.GetItemById(QueryString["id"]);
|
BaseItem item = ApiService.GetItemById(QueryString["id"]);
|
||||||
|
@ -33,7 +32,7 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
// Set favorite status
|
// Set favorite status
|
||||||
data.IsFavorite = QueryString["isfavorite"] == "1";
|
data.IsFavorite = QueryString["isfavorite"] == "1";
|
||||||
|
|
||||||
return Task.FromResult<DTOUserItemData>(ApiService.GetDTOUserItemData(data));
|
return Task.FromResult(ApiService.GetDtoUserItemData(data));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -60,7 +60,7 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the Genre objects
|
// Get the Genre objects
|
||||||
Genre[] entities = await Task.WhenAll<Genre>(data.Keys.Select(key => { return Kernel.Instance.ItemController.GetGenre(key); })).ConfigureAwait(false);
|
Genre[] entities = await Task.WhenAll(data.Keys.Select(key => { return Kernel.Instance.ItemController.GetGenre(key); })).ConfigureAwait(false);
|
||||||
|
|
||||||
// Convert to an array of IBNItem
|
// Convert to an array of IBNItem
|
||||||
IBNItem[] items = new IBNItem[entities.Length];
|
IBNItem[] items = new IBNItem[entities.Length];
|
||||||
|
|
|
@ -21,15 +21,15 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
return ApiService.IsApiUrlMatch("image", request);
|
return ApiService.IsApiUrlMatch("image", request);
|
||||||
}
|
}
|
||||||
|
|
||||||
private string _ImagePath = null;
|
private string _imagePath;
|
||||||
private async Task<string> GetImagePath()
|
private async Task<string> GetImagePath()
|
||||||
{
|
{
|
||||||
if (_ImagePath == null)
|
if (_imagePath == null)
|
||||||
{
|
{
|
||||||
_ImagePath = await DiscoverImagePath();
|
_imagePath = await DiscoverImagePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
return _ImagePath;
|
return _imagePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<string> DiscoverImagePath()
|
private async Task<string> DiscoverImagePath()
|
||||||
|
@ -77,21 +77,21 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
return GetImagePathFromTypes(item, ImageType, index);
|
return GetImagePathFromTypes(item, ImageType, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Stream _SourceStream = null;
|
private Stream _sourceStream;
|
||||||
private async Task<Stream> GetSourceStream()
|
private async Task<Stream> GetSourceStream()
|
||||||
{
|
{
|
||||||
await EnsureSourceStream().ConfigureAwait(false);
|
await EnsureSourceStream().ConfigureAwait(false);
|
||||||
return _SourceStream;
|
return _sourceStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool _SourceStreamEnsured = false;
|
private bool _sourceStreamEnsured;
|
||||||
private async Task EnsureSourceStream()
|
private async Task EnsureSourceStream()
|
||||||
{
|
{
|
||||||
if (!_SourceStreamEnsured)
|
if (!_sourceStreamEnsured)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_SourceStream = File.OpenRead(await GetImagePath().ConfigureAwait(false));
|
_sourceStream = File.OpenRead(await GetImagePath().ConfigureAwait(false));
|
||||||
}
|
}
|
||||||
catch (FileNotFoundException ex)
|
catch (FileNotFoundException ex)
|
||||||
{
|
{
|
||||||
|
@ -110,7 +110,7 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
_SourceStreamEnsured = true;
|
_sourceStreamEnsured = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -248,26 +248,24 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
{
|
{
|
||||||
return item.LogoImagePath;
|
return item.LogoImagePath;
|
||||||
}
|
}
|
||||||
else if (imageType == ImageType.Backdrop)
|
if (imageType == ImageType.Backdrop)
|
||||||
{
|
{
|
||||||
return item.BackdropImagePaths.ElementAt(imageIndex);
|
return item.BackdropImagePaths.ElementAt(imageIndex);
|
||||||
}
|
}
|
||||||
else if (imageType == ImageType.Banner)
|
if (imageType == ImageType.Banner)
|
||||||
{
|
{
|
||||||
return item.BannerImagePath;
|
return item.BannerImagePath;
|
||||||
}
|
}
|
||||||
else if (imageType == ImageType.Art)
|
if (imageType == ImageType.Art)
|
||||||
{
|
{
|
||||||
return item.ArtImagePath;
|
return item.ArtImagePath;
|
||||||
}
|
}
|
||||||
else if (imageType == ImageType.Thumbnail)
|
if (imageType == ImageType.Thumbnail)
|
||||||
{
|
{
|
||||||
return item.ThumbnailImagePath;
|
return item.ThumbnailImagePath;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
return item.PrimaryImagePath;
|
||||||
return item.PrimaryImagePath;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,14 +11,14 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
/// Provides a handler to retrieve a single item
|
/// Provides a handler to retrieve a single item
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(BaseHandler))]
|
[Export(typeof(BaseHandler))]
|
||||||
public class ItemHandler : BaseSerializationHandler<DTOBaseItem>
|
public class ItemHandler : BaseSerializationHandler<DtoBaseItem>
|
||||||
{
|
{
|
||||||
public override bool HandlesRequest(HttpListenerRequest request)
|
public override bool HandlesRequest(HttpListenerRequest request)
|
||||||
{
|
{
|
||||||
return ApiService.IsApiUrlMatch("item", request);
|
return ApiService.IsApiUrlMatch("item", request);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Task<DTOBaseItem> GetObjectToSerialize()
|
protected override Task<DtoBaseItem> GetObjectToSerialize()
|
||||||
{
|
{
|
||||||
User user = ApiService.GetUserById(QueryString["userid"], true);
|
User user = ApiService.GetUserById(QueryString["userid"], true);
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ApiService.GetDTOBaseItem(item, user);
|
return ApiService.GetDtoBaseItem(item, user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,20 +11,20 @@ using System.Threading.Tasks;
|
||||||
namespace MediaBrowser.Api.HttpHandlers
|
namespace MediaBrowser.Api.HttpHandlers
|
||||||
{
|
{
|
||||||
[Export(typeof(BaseHandler))]
|
[Export(typeof(BaseHandler))]
|
||||||
public class ItemListHandler : BaseSerializationHandler<DTOBaseItem[]>
|
public class ItemListHandler : BaseSerializationHandler<DtoBaseItem[]>
|
||||||
{
|
{
|
||||||
public override bool HandlesRequest(HttpListenerRequest request)
|
public override bool HandlesRequest(HttpListenerRequest request)
|
||||||
{
|
{
|
||||||
return ApiService.IsApiUrlMatch("itemlist", request);
|
return ApiService.IsApiUrlMatch("itemlist", request);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Task<DTOBaseItem[]> GetObjectToSerialize()
|
protected override Task<DtoBaseItem[]> GetObjectToSerialize()
|
||||||
{
|
{
|
||||||
User user = ApiService.GetUserById(QueryString["userid"], true);
|
User user = ApiService.GetUserById(QueryString["userid"], true);
|
||||||
|
|
||||||
return Task.WhenAll<DTOBaseItem>(GetItemsToSerialize(user).Select(i =>
|
return Task.WhenAll(GetItemsToSerialize(user).Select(i =>
|
||||||
{
|
{
|
||||||
return ApiService.GetDTOBaseItem(i, user, includeChildren: false, includePeople: false);
|
return ApiService.GetDtoBaseItem(i, user, includeChildren: false, includePeople: false);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,31 +36,31 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
{
|
{
|
||||||
return parent.GetInProgressItems(user);
|
return parent.GetInProgressItems(user);
|
||||||
}
|
}
|
||||||
else if (ListType.Equals("recentlyaddeditems", StringComparison.OrdinalIgnoreCase))
|
if (ListType.Equals("recentlyaddeditems", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return parent.GetRecentlyAddedItems(user);
|
return parent.GetRecentlyAddedItems(user);
|
||||||
}
|
}
|
||||||
else if (ListType.Equals("recentlyaddedunplayeditems", StringComparison.OrdinalIgnoreCase))
|
if (ListType.Equals("recentlyaddedunplayeditems", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return parent.GetRecentlyAddedUnplayedItems(user);
|
return parent.GetRecentlyAddedUnplayedItems(user);
|
||||||
}
|
}
|
||||||
else if (ListType.Equals("itemswithgenre", StringComparison.OrdinalIgnoreCase))
|
if (ListType.Equals("itemswithgenre", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return parent.GetItemsWithGenre(QueryString["name"], user);
|
return parent.GetItemsWithGenre(QueryString["name"], user);
|
||||||
}
|
}
|
||||||
else if (ListType.Equals("itemswithyear", StringComparison.OrdinalIgnoreCase))
|
if (ListType.Equals("itemswithyear", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return parent.GetItemsWithYear(int.Parse(QueryString["year"]), user);
|
return parent.GetItemsWithYear(int.Parse(QueryString["year"]), user);
|
||||||
}
|
}
|
||||||
else if (ListType.Equals("itemswithstudio", StringComparison.OrdinalIgnoreCase))
|
if (ListType.Equals("itemswithstudio", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return parent.GetItemsWithStudio(QueryString["name"], user);
|
return parent.GetItemsWithStudio(QueryString["name"], user);
|
||||||
}
|
}
|
||||||
else if (ListType.Equals("itemswithperson", StringComparison.OrdinalIgnoreCase))
|
if (ListType.Equals("itemswithperson", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return parent.GetItemsWithPerson(QueryString["name"], null, user);
|
return parent.GetItemsWithPerson(QueryString["name"], null, user);
|
||||||
}
|
}
|
||||||
else if (ListType.Equals("favorites", StringComparison.OrdinalIgnoreCase))
|
if (ListType.Equals("favorites", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return parent.GetFavoriteItems(user);
|
return parent.GetFavoriteItems(user);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,14 +13,14 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
/// This handler retrieves special features for movies
|
/// This handler retrieves special features for movies
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(BaseHandler))]
|
[Export(typeof(BaseHandler))]
|
||||||
public class MovieSpecialFeaturesHandler : BaseSerializationHandler<DTOBaseItem[]>
|
public class MovieSpecialFeaturesHandler : BaseSerializationHandler<DtoBaseItem[]>
|
||||||
{
|
{
|
||||||
public override bool HandlesRequest(HttpListenerRequest request)
|
public override bool HandlesRequest(HttpListenerRequest request)
|
||||||
{
|
{
|
||||||
return ApiService.IsApiUrlMatch("MovieSpecialFeatures", request);
|
return ApiService.IsApiUrlMatch("MovieSpecialFeatures", request);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Task<DTOBaseItem[]> GetObjectToSerialize()
|
protected override Task<DtoBaseItem[]> GetObjectToSerialize()
|
||||||
{
|
{
|
||||||
User user = ApiService.GetUserById(QueryString["userid"], true);
|
User user = ApiService.GetUserById(QueryString["userid"], true);
|
||||||
|
|
||||||
|
@ -29,12 +29,12 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
// If none
|
// If none
|
||||||
if (movie.SpecialFeatures == null)
|
if (movie.SpecialFeatures == null)
|
||||||
{
|
{
|
||||||
return Task.FromResult<DTOBaseItem[]>(new DTOBaseItem[] { });
|
return Task.FromResult(new DtoBaseItem[] { });
|
||||||
}
|
}
|
||||||
|
|
||||||
return Task.WhenAll<DTOBaseItem>(movie.SpecialFeatures.Select(i =>
|
return Task.WhenAll(movie.SpecialFeatures.Select(i =>
|
||||||
{
|
{
|
||||||
return ApiService.GetDTOBaseItem(i, user, includeChildren: false, includePeople: true);
|
return ApiService.GetDtoBaseItem(i, user, includeChildren: false);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
using MediaBrowser.Common.Net.Handlers;
|
using MediaBrowser.Common.Net.Handlers;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Model.DTO;
|
using MediaBrowser.Model.DTO;
|
||||||
using MediaBrowser.Model.Entities;
|
|
||||||
using System.ComponentModel.Composition;
|
using System.ComponentModel.Composition;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
@ -12,14 +11,14 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
/// Provides a handler to set played status for an item
|
/// Provides a handler to set played status for an item
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(BaseHandler))]
|
[Export(typeof(BaseHandler))]
|
||||||
public class PlayedStatusHandler : BaseSerializationHandler<DTOUserItemData>
|
public class PlayedStatusHandler : BaseSerializationHandler<DtoUserItemData>
|
||||||
{
|
{
|
||||||
public override bool HandlesRequest(HttpListenerRequest request)
|
public override bool HandlesRequest(HttpListenerRequest request)
|
||||||
{
|
{
|
||||||
return ApiService.IsApiUrlMatch("PlayedStatus", request);
|
return ApiService.IsApiUrlMatch("PlayedStatus", request);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Task<DTOUserItemData> GetObjectToSerialize()
|
protected override Task<DtoUserItemData> GetObjectToSerialize()
|
||||||
{
|
{
|
||||||
// Get the item
|
// Get the item
|
||||||
BaseItem item = ApiService.GetItemById(QueryString["id"]);
|
BaseItem item = ApiService.GetItemById(QueryString["id"]);
|
||||||
|
@ -33,7 +32,7 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
|
|
||||||
UserItemData data = item.GetUserData(user, true);
|
UserItemData data = item.GetUserData(user, true);
|
||||||
|
|
||||||
return Task.FromResult<DTOUserItemData>(ApiService.GetDTOUserItemData(data));
|
return Task.FromResult(ApiService.GetDtoUserItemData(data));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -32,7 +32,7 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
|
|
||||||
string path = Path.Combine(Kernel.Instance.ApplicationPaths.PluginsPath, filename);
|
string path = Path.Combine(Kernel.Instance.ApplicationPaths.PluginsPath, filename);
|
||||||
|
|
||||||
return new StaticFileHandler() { Path = path }.ProcessRequest(ctx);
|
return new StaticFileHandler { Path = path }.ProcessRequest(ctx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,25 +18,25 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
return ApiService.IsApiUrlMatch("pluginconfiguration", request);
|
return ApiService.IsApiUrlMatch("pluginconfiguration", request);
|
||||||
}
|
}
|
||||||
|
|
||||||
private BasePlugin _Plugin = null;
|
private BasePlugin _plugin;
|
||||||
private BasePlugin Plugin
|
private BasePlugin Plugin
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (_Plugin == null)
|
if (_plugin == null)
|
||||||
{
|
{
|
||||||
string name = QueryString["assemblyfilename"];
|
string name = QueryString["assemblyfilename"];
|
||||||
|
|
||||||
_Plugin = Kernel.Instance.Plugins.First(p => p.AssemblyFileName.Equals(name, StringComparison.OrdinalIgnoreCase));
|
_plugin = Kernel.Instance.Plugins.First(p => p.AssemblyFileName.Equals(name, StringComparison.OrdinalIgnoreCase));
|
||||||
}
|
}
|
||||||
|
|
||||||
return _Plugin;
|
return _plugin;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Task<BasePluginConfiguration> GetObjectToSerialize()
|
protected override Task<BasePluginConfiguration> GetObjectToSerialize()
|
||||||
{
|
{
|
||||||
return Task.FromResult<BasePluginConfiguration>(Plugin.Configuration);
|
return Task.FromResult(Plugin.Configuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override TimeSpan CacheDuration
|
public override TimeSpan CacheDuration
|
||||||
|
|
|
@ -24,7 +24,7 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
{
|
{
|
||||||
var plugins = Kernel.Instance.Plugins.Select(p =>
|
var plugins = Kernel.Instance.Plugins.Select(p =>
|
||||||
{
|
{
|
||||||
return new PluginInfo()
|
return new PluginInfo
|
||||||
{
|
{
|
||||||
Name = p.Name,
|
Name = p.Name,
|
||||||
Enabled = p.Enabled,
|
Enabled = p.Enabled,
|
||||||
|
@ -35,7 +35,7 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
return Task.FromResult<IEnumerable<PluginInfo>>(plugins);
|
return Task.FromResult(plugins);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
|
|
||||||
protected override Task<ServerConfiguration> GetObjectToSerialize()
|
protected override Task<ServerConfiguration> GetObjectToSerialize()
|
||||||
{
|
{
|
||||||
return Task.FromResult<ServerConfiguration>(Kernel.Instance.Configuration);
|
return Task.FromResult(Kernel.Instance.Configuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override TimeSpan CacheDuration
|
public override TimeSpan CacheDuration
|
||||||
|
|
|
@ -60,7 +60,7 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the Studio objects
|
// Get the Studio objects
|
||||||
Studio[] entities = await Task.WhenAll<Studio>(data.Keys.Select(key => { return Kernel.Instance.ItemController.GetStudio(key); })).ConfigureAwait(false);
|
Studio[] entities = await Task.WhenAll(data.Keys.Select(key => { return Kernel.Instance.ItemController.GetStudio(key); })).ConfigureAwait(false);
|
||||||
|
|
||||||
// Convert to an array of IBNItem
|
// Convert to an array of IBNItem
|
||||||
IBNItem[] items = new IBNItem[entities.Length];
|
IBNItem[] items = new IBNItem[entities.Length];
|
||||||
|
|
|
@ -8,22 +8,22 @@ using System.Threading.Tasks;
|
||||||
namespace MediaBrowser.Api.HttpHandlers
|
namespace MediaBrowser.Api.HttpHandlers
|
||||||
{
|
{
|
||||||
[Export(typeof(BaseHandler))]
|
[Export(typeof(BaseHandler))]
|
||||||
class UserHandler : BaseSerializationHandler<DTOUser>
|
class UserHandler : BaseSerializationHandler<DtoUser>
|
||||||
{
|
{
|
||||||
public override bool HandlesRequest(HttpListenerRequest request)
|
public override bool HandlesRequest(HttpListenerRequest request)
|
||||||
{
|
{
|
||||||
return ApiService.IsApiUrlMatch("user", request);
|
return ApiService.IsApiUrlMatch("user", request);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Task<DTOUser> GetObjectToSerialize()
|
protected override Task<DtoUser> GetObjectToSerialize()
|
||||||
{
|
{
|
||||||
string id = QueryString["id"];
|
string id = QueryString["id"];
|
||||||
|
|
||||||
User user = string.IsNullOrEmpty(id) ? ApiService.GetDefaultUser(false) : ApiService.GetUserById(id, false); ;
|
User user = string.IsNullOrEmpty(id) ? ApiService.GetDefaultUser(false) : ApiService.GetUserById(id, false); ;
|
||||||
|
|
||||||
DTOUser dto = ApiService.GetDTOUser(user);
|
DtoUser dto = ApiService.GetDtoUser(user);
|
||||||
|
|
||||||
return Task.FromResult<DTOUser>(dto);
|
return Task.FromResult(dto);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
using MediaBrowser.Common.Net.Handlers;
|
using MediaBrowser.Common.Net.Handlers;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Model.DTO;
|
using MediaBrowser.Model.DTO;
|
||||||
using MediaBrowser.Model.Entities;
|
|
||||||
using System.ComponentModel.Composition;
|
using System.ComponentModel.Composition;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
@ -12,14 +11,14 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
/// Provides a handler to set a user's rating for an item
|
/// Provides a handler to set a user's rating for an item
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(BaseHandler))]
|
[Export(typeof(BaseHandler))]
|
||||||
public class UserItemRatingHandler : BaseSerializationHandler<DTOUserItemData>
|
public class UserItemRatingHandler : BaseSerializationHandler<DtoUserItemData>
|
||||||
{
|
{
|
||||||
public override bool HandlesRequest(HttpListenerRequest request)
|
public override bool HandlesRequest(HttpListenerRequest request)
|
||||||
{
|
{
|
||||||
return ApiService.IsApiUrlMatch("UserItemRating", request);
|
return ApiService.IsApiUrlMatch("UserItemRating", request);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Task<DTOUserItemData> GetObjectToSerialize()
|
protected override Task<DtoUserItemData> GetObjectToSerialize()
|
||||||
{
|
{
|
||||||
// Get the item
|
// Get the item
|
||||||
BaseItem item = ApiService.GetItemById(QueryString["id"]);
|
BaseItem item = ApiService.GetItemById(QueryString["id"]);
|
||||||
|
@ -41,7 +40,7 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
data.Likes = QueryString["likes"] == "1";
|
data.Likes = QueryString["likes"] == "1";
|
||||||
}
|
}
|
||||||
|
|
||||||
return Task.FromResult<DTOUserItemData>(ApiService.GetDTOUserItemData(data));
|
return Task.FromResult(ApiService.GetDtoUserItemData(data));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -10,16 +10,16 @@ using System.Threading.Tasks;
|
||||||
namespace MediaBrowser.Api.HttpHandlers
|
namespace MediaBrowser.Api.HttpHandlers
|
||||||
{
|
{
|
||||||
[Export(typeof(BaseHandler))]
|
[Export(typeof(BaseHandler))]
|
||||||
class UsersHandler : BaseSerializationHandler<IEnumerable<DTOUser>>
|
class UsersHandler : BaseSerializationHandler<IEnumerable<DtoUser>>
|
||||||
{
|
{
|
||||||
public override bool HandlesRequest(HttpListenerRequest request)
|
public override bool HandlesRequest(HttpListenerRequest request)
|
||||||
{
|
{
|
||||||
return ApiService.IsApiUrlMatch("users", request);
|
return ApiService.IsApiUrlMatch("users", request);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Task<IEnumerable<DTOUser>> GetObjectToSerialize()
|
protected override Task<IEnumerable<DtoUser>> GetObjectToSerialize()
|
||||||
{
|
{
|
||||||
return Task.FromResult<IEnumerable<DTOUser>>(Kernel.Instance.Users.Select(u => ApiService.GetDTOUser(u)));
|
return Task.FromResult(Kernel.Instance.Users.Select(u => ApiService.GetDtoUser(u)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
// mp4, 3gp, mov - muxer does not support non-seekable output
|
// mp4, 3gp, mov - muxer does not support non-seekable output
|
||||||
// avi, mov, mkv, m4v - can't stream these when encoding. the player will try to download them completely before starting playback.
|
// avi, mov, mkv, m4v - can't stream these when encoding. the player will try to download them completely before starting playback.
|
||||||
// wmv - can't seem to figure out the output format name
|
// wmv - can't seem to figure out the output format name
|
||||||
return new VideoOutputFormats[] { VideoOutputFormats.Mp4, VideoOutputFormats.ThreeGP, VideoOutputFormats.M4v, VideoOutputFormats.Mkv, VideoOutputFormats.Avi, VideoOutputFormats.Mov, VideoOutputFormats.Wmv };
|
return new VideoOutputFormats[] { VideoOutputFormats.Mp4, VideoOutputFormats.ThreeGp, VideoOutputFormats.M4V, VideoOutputFormats.Mkv, VideoOutputFormats.Avi, VideoOutputFormats.Mov, VideoOutputFormats.Wmv };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,11 +87,11 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
{
|
{
|
||||||
return "matroska";
|
return "matroska";
|
||||||
}
|
}
|
||||||
else if (outputFormat == VideoOutputFormats.Ts)
|
if (outputFormat == VideoOutputFormats.Ts)
|
||||||
{
|
{
|
||||||
return "mpegts";
|
return "mpegts";
|
||||||
}
|
}
|
||||||
else if (outputFormat == VideoOutputFormats.Ogv)
|
if (outputFormat == VideoOutputFormats.Ogv)
|
||||||
{
|
{
|
||||||
return "ogg";
|
return "ogg";
|
||||||
}
|
}
|
||||||
|
@ -104,8 +104,6 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected override string GetCommandLineArguments()
|
protected override string GetCommandLineArguments()
|
||||||
{
|
{
|
||||||
List<string> audioTranscodeParams = new List<string>();
|
|
||||||
|
|
||||||
VideoOutputFormats outputFormat = GetConversionOutputFormat();
|
VideoOutputFormats outputFormat = GetConversionOutputFormat();
|
||||||
|
|
||||||
return string.Format("-i \"{0}\" -threads 0 {1} {2} -f {3} -",
|
return string.Format("-i \"{0}\" -threads 0 {1} {2} -f {3} -",
|
||||||
|
@ -195,15 +193,15 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
// Per webm specification, it must be vpx
|
// Per webm specification, it must be vpx
|
||||||
return "libvpx";
|
return "libvpx";
|
||||||
}
|
}
|
||||||
else if (outputFormat == VideoOutputFormats.Asf)
|
if (outputFormat == VideoOutputFormats.Asf)
|
||||||
{
|
{
|
||||||
return "wmv2";
|
return "wmv2";
|
||||||
}
|
}
|
||||||
else if (outputFormat == VideoOutputFormats.Wmv)
|
if (outputFormat == VideoOutputFormats.Wmv)
|
||||||
{
|
{
|
||||||
return "wmv2";
|
return "wmv2";
|
||||||
}
|
}
|
||||||
else if (outputFormat == VideoOutputFormats.Ogv)
|
if (outputFormat == VideoOutputFormats.Ogv)
|
||||||
{
|
{
|
||||||
return "libtheora";
|
return "libtheora";
|
||||||
}
|
}
|
||||||
|
@ -223,21 +221,21 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
private string GetAudioCodec(AudioStream audioStream, VideoOutputFormats outputFormat)
|
private string GetAudioCodec(AudioStream audioStream, VideoOutputFormats outputFormat)
|
||||||
{
|
{
|
||||||
// Some output containers require specific codecs
|
// Some output containers require specific codecs
|
||||||
|
|
||||||
if (outputFormat == VideoOutputFormats.Webm)
|
if (outputFormat == VideoOutputFormats.Webm)
|
||||||
{
|
{
|
||||||
// Per webm specification, it must be vorbis
|
// Per webm specification, it must be vorbis
|
||||||
return "libvorbis";
|
return "libvorbis";
|
||||||
}
|
}
|
||||||
else if (outputFormat == VideoOutputFormats.Asf)
|
if (outputFormat == VideoOutputFormats.Asf)
|
||||||
{
|
{
|
||||||
return "wmav2";
|
return "wmav2";
|
||||||
}
|
}
|
||||||
else if (outputFormat == VideoOutputFormats.Wmv)
|
if (outputFormat == VideoOutputFormats.Wmv)
|
||||||
{
|
{
|
||||||
return "wmav2";
|
return "wmav2";
|
||||||
}
|
}
|
||||||
else if (outputFormat == VideoOutputFormats.Ogv)
|
if (outputFormat == VideoOutputFormats.Ogv)
|
||||||
{
|
{
|
||||||
return "libvorbis";
|
return "libvorbis";
|
||||||
}
|
}
|
||||||
|
@ -263,7 +261,7 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
// libvo_aacenc currently only supports two channel output
|
// libvo_aacenc currently only supports two channel output
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
else if (audioCodec.Equals("wmav2"))
|
if (audioCodec.Equals("wmav2"))
|
||||||
{
|
{
|
||||||
// wmav2 currently only supports two channel output
|
// wmav2 currently only supports two channel output
|
||||||
return 2;
|
return 2;
|
||||||
|
|
|
@ -57,7 +57,7 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the Year objects
|
// Get the Year objects
|
||||||
Year[] entities = await Task.WhenAll<Year>(data.Keys.Select(key => { return Kernel.Instance.ItemController.GetYear(key); })).ConfigureAwait(false);
|
Year[] entities = await Task.WhenAll(data.Keys.Select(key => { return Kernel.Instance.ItemController.GetYear(key); })).ConfigureAwait(false);
|
||||||
|
|
||||||
// Convert to an array of IBNItem
|
// Convert to an array of IBNItem
|
||||||
IBNItem[] items = new IBNItem[entities.Length];
|
IBNItem[] items = new IBNItem[entities.Length];
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
// General Information about an assembly is controlled through the following
|
||||||
|
|
|
@ -12,7 +12,7 @@ namespace MediaBrowser.ApiInteraction
|
||||||
/// This means that this class can currently only handle types within the Model project.
|
/// This means that this class can currently only handle types within the Model project.
|
||||||
/// If we need to, we can always add a param indicating whether or not the model serializer should be used.
|
/// If we need to, we can always add a param indicating whether or not the model serializer should be used.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static ProtobufModelSerializer ProtobufModelSerializer = new ProtobufModelSerializer();
|
private static readonly ProtobufModelSerializer ProtobufModelSerializer = new ProtobufModelSerializer();
|
||||||
|
|
||||||
public static T DeserializeFromStream<T>(Stream stream, SerializationFormats format)
|
public static T DeserializeFromStream<T>(Stream stream, SerializationFormats format)
|
||||||
where T : class
|
where T : class
|
||||||
|
|
|
@ -1,585 +0,0 @@
|
||||||
using MediaBrowser.Model.Authentication;
|
|
||||||
using MediaBrowser.Model.Configuration;
|
|
||||||
using MediaBrowser.Model.DTO;
|
|
||||||
using MediaBrowser.Model.Weather;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Net;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace MediaBrowser.ApiInteraction.Portable
|
|
||||||
{
|
|
||||||
public class ApiClient : BaseApiClient
|
|
||||||
{
|
|
||||||
private HttpWebRequest GetNewRequest(string url)
|
|
||||||
{
|
|
||||||
return HttpWebRequest.CreateHttp(url);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets an image stream based on a url
|
|
||||||
/// </summary>
|
|
||||||
public void GetImageStreamAsync(string url, Action<Stream> callback)
|
|
||||||
{
|
|
||||||
GetStreamAsync(url, callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets an image stream based on a url
|
|
||||||
/// </summary>
|
|
||||||
private void GetStreamAsync(string url, Action<Stream> callback)
|
|
||||||
{
|
|
||||||
HttpWebRequest request = GetNewRequest(url);
|
|
||||||
|
|
||||||
request.BeginGetResponse(new AsyncCallback(result =>
|
|
||||||
{
|
|
||||||
using (WebResponse response = (result.AsyncState as HttpWebRequest).EndGetResponse(result))
|
|
||||||
{
|
|
||||||
Stream stream = response.GetResponseStream();
|
|
||||||
callback(stream);
|
|
||||||
}
|
|
||||||
|
|
||||||
}), request);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets a BaseItem
|
|
||||||
/// </summary>
|
|
||||||
public void GetItemAsync(Guid id, Guid userId, Action<DTOBaseItem> callback)
|
|
||||||
{
|
|
||||||
string url = ApiUrl + "/item?userId=" + userId.ToString();
|
|
||||||
|
|
||||||
if (id != Guid.Empty)
|
|
||||||
{
|
|
||||||
url += "&id=" + id.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
GetDataAsync(url, callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets all users
|
|
||||||
/// </summary>
|
|
||||||
public void GetAllUsersAsync(Action<DTOUser[]> callback)
|
|
||||||
{
|
|
||||||
string url = ApiUrl + "/users";
|
|
||||||
|
|
||||||
GetDataAsync(url, callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets all Genres
|
|
||||||
/// </summary>
|
|
||||||
public void GetAllGenresAsync(Guid userId, Action<IBNItem[]> callback)
|
|
||||||
{
|
|
||||||
string url = ApiUrl + "/genres?userId=" + userId.ToString();
|
|
||||||
|
|
||||||
GetDataAsync(url, callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets in-progress items
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="userId">The user id.</param>
|
|
||||||
/// <param name="folderId">(Optional) Specify a folder Id to localize the search to a specific folder.</param>
|
|
||||||
public void GetInProgressItemsItemsAsync(Guid userId, Action<DTOBaseItem[]> callback, Guid? folderId = null)
|
|
||||||
{
|
|
||||||
string url = ApiUrl + "/itemlist?listtype=inprogressitems&userId=" + userId.ToString();
|
|
||||||
|
|
||||||
if (folderId.HasValue)
|
|
||||||
{
|
|
||||||
url += "&id=" + folderId.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
GetDataAsync(url, callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets recently added items
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="userId">The user id.</param>
|
|
||||||
/// <param name="folderId">(Optional) Specify a folder Id to localize the search to a specific folder.</param>
|
|
||||||
public void GetRecentlyAddedItemsAsync(Guid userId, Action<DTOBaseItem[]> callback, Guid? folderId = null)
|
|
||||||
{
|
|
||||||
string url = ApiUrl + "/itemlist?listtype=recentlyaddeditems&userId=" + userId.ToString();
|
|
||||||
|
|
||||||
if (folderId.HasValue)
|
|
||||||
{
|
|
||||||
url += "&id=" + folderId.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
GetDataAsync(url, callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets favorite items
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="userId">The user id.</param>
|
|
||||||
/// <param name="folderId">(Optional) Specify a folder Id to localize the search to a specific folder.</param>
|
|
||||||
public void GetFavoriteItemsAsync(Guid userId, Action<DTOBaseItem[]> callback, Guid? folderId = null)
|
|
||||||
{
|
|
||||||
string url = ApiUrl + "/itemlist?listtype=favorites&userId=" + userId.ToString();
|
|
||||||
|
|
||||||
if (folderId.HasValue)
|
|
||||||
{
|
|
||||||
url += "&id=" + folderId.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
GetDataAsync(url, callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets recently added items that are unplayed.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="userId">The user id.</param>
|
|
||||||
/// <param name="folderId">(Optional) Specify a folder Id to localize the search to a specific folder.</param>
|
|
||||||
public void GetRecentlyAddedUnplayedItemsAsync(Guid userId, Action<DTOBaseItem[]> callback, Guid? folderId = null)
|
|
||||||
{
|
|
||||||
string url = ApiUrl + "/itemlist?listtype=recentlyaddedunplayeditems&userId=" + userId.ToString();
|
|
||||||
|
|
||||||
if (folderId.HasValue)
|
|
||||||
{
|
|
||||||
url += "&id=" + folderId.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
GetDataAsync(url, callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets all Years
|
|
||||||
/// </summary>
|
|
||||||
public void GetAllYearsAsync(Guid userId, Action<IBNItem[]> callback)
|
|
||||||
{
|
|
||||||
string url = ApiUrl + "/years?userId=" + userId.ToString();
|
|
||||||
|
|
||||||
GetDataAsync(url, callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets all items that contain a given Year
|
|
||||||
/// </summary>
|
|
||||||
public void GetItemsWithYearAsync(string name, Guid userId, Action<DTOBaseItem[]> callback, Guid? folderId = null)
|
|
||||||
{
|
|
||||||
string url = ApiUrl + "/itemlist?listtype=itemswithyear&userId=" + userId.ToString() + "&name=" + name;
|
|
||||||
|
|
||||||
if (folderId.HasValue)
|
|
||||||
{
|
|
||||||
url += "&id=" + folderId.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
GetDataAsync(url, callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets all items that contain a given Genre
|
|
||||||
/// </summary>
|
|
||||||
public void GetItemsWithGenreAsync(string name, Guid userId, Action<DTOBaseItem[]> callback, Guid? folderId = null)
|
|
||||||
{
|
|
||||||
string url = ApiUrl + "/itemlist?listtype=itemswithgenre&userId=" + userId.ToString() + "&name=" + name;
|
|
||||||
|
|
||||||
if (folderId.HasValue)
|
|
||||||
{
|
|
||||||
url += "&id=" + folderId.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
GetDataAsync(url, callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets all items that contain a given Person
|
|
||||||
/// </summary>
|
|
||||||
public void GetItemsWithPersonAsync(string name, Guid userId, Action<DTOBaseItem[]> callback, Guid? folderId = null)
|
|
||||||
{
|
|
||||||
string url = ApiUrl + "/itemlist?listtype=itemswithperson&userId=" + userId.ToString() + "&name=" + name;
|
|
||||||
|
|
||||||
if (folderId.HasValue)
|
|
||||||
{
|
|
||||||
url += "&id=" + folderId.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
GetDataAsync(url, callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets all items that contain a given Person
|
|
||||||
/// </summary>
|
|
||||||
public void GetItemsWithPersonAsync(string name, string personType, Guid userId, Action<DTOBaseItem[]> callback, Guid? folderId = null)
|
|
||||||
{
|
|
||||||
string url = ApiUrl + "/itemlist?listtype=itemswithperson&userId=" + userId.ToString() + "&name=" + name;
|
|
||||||
|
|
||||||
if (folderId.HasValue)
|
|
||||||
{
|
|
||||||
url += "&id=" + folderId.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
url += "&persontype=" + personType;
|
|
||||||
|
|
||||||
GetDataAsync(url, callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets all studious
|
|
||||||
/// </summary>
|
|
||||||
public void GetAllStudiosAsync(Guid userId, Action<IBNItem[]> callback)
|
|
||||||
{
|
|
||||||
string url = ApiUrl + "/studios?userId=" + userId.ToString();
|
|
||||||
|
|
||||||
GetDataAsync(url, callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets all items that contain a given Studio
|
|
||||||
/// </summary>
|
|
||||||
public void GetItemsWithStudioAsync(string name, Guid userId, Action<DTOBaseItem[]> callback, Guid? folderId = null)
|
|
||||||
{
|
|
||||||
string url = ApiUrl + "/itemlist?listtype=itemswithstudio&userId=" + userId.ToString() + "&name=" + name;
|
|
||||||
|
|
||||||
if (folderId.HasValue)
|
|
||||||
{
|
|
||||||
url += "&id=" + folderId.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
GetDataAsync(url, callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets a studio
|
|
||||||
/// </summary>
|
|
||||||
public void GetStudioAsync(Guid userId, string name, Action<IBNItem> callback)
|
|
||||||
{
|
|
||||||
string url = ApiUrl + "/studio?userId=" + userId.ToString() + "&name=" + name;
|
|
||||||
|
|
||||||
GetDataAsync(url, callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets a genre
|
|
||||||
/// </summary>
|
|
||||||
public void GetGenreAsync(Guid userId, string name, Action<IBNItem> callback)
|
|
||||||
{
|
|
||||||
string url = ApiUrl + "/genre?userId=" + userId.ToString() + "&name=" + name;
|
|
||||||
|
|
||||||
GetDataAsync(url, callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets a person
|
|
||||||
/// </summary>
|
|
||||||
public void GetPersonAsync(Guid userId, string name, Action<IBNItem> callback)
|
|
||||||
{
|
|
||||||
string url = ApiUrl + "/person?userId=" + userId.ToString() + "&name=" + name;
|
|
||||||
|
|
||||||
GetDataAsync(url, callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets a year
|
|
||||||
/// </summary>
|
|
||||||
public void GetYearAsync(Guid userId, int year, Action<IBNItem> callback)
|
|
||||||
{
|
|
||||||
string url = ApiUrl + "/year?userId=" + userId.ToString() + "&year=" + year;
|
|
||||||
|
|
||||||
GetDataAsync(url, callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets a list of plugins installed on the server
|
|
||||||
/// </summary>
|
|
||||||
public void GetInstalledPluginsAsync(Action<PluginInfo[]> callback)
|
|
||||||
{
|
|
||||||
string url = ApiUrl + "/plugins";
|
|
||||||
|
|
||||||
GetDataAsync(url, callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets a list of plugins installed on the server
|
|
||||||
/// </summary>
|
|
||||||
public void GetPluginAssemblyAsync(PluginInfo plugin, Action<Stream> callback)
|
|
||||||
{
|
|
||||||
string url = ApiUrl + "/pluginassembly?assemblyfilename=" + plugin.AssemblyFileName;
|
|
||||||
|
|
||||||
GetStreamAsync(url, callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the current server configuration
|
|
||||||
/// </summary>
|
|
||||||
public void GetServerConfigurationAsync(Action<ServerConfiguration> callback)
|
|
||||||
{
|
|
||||||
string url = ApiUrl + "/ServerConfiguration";
|
|
||||||
|
|
||||||
GetDataAsync(url, callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets weather information for the default location as set in configuration
|
|
||||||
/// </summary>
|
|
||||||
public void GetPluginConfigurationAsync(PluginInfo plugin, Type configurationType, Action<object> callback)
|
|
||||||
{
|
|
||||||
string url = ApiUrl + "/PluginConfiguration?assemblyfilename=" + plugin.AssemblyFileName;
|
|
||||||
|
|
||||||
// At the moment this can't be retrieved in protobuf format
|
|
||||||
SerializationFormats format = DataSerializer.CanDeSerializeJsv ? SerializationFormats.Jsv : SerializationFormats.Json;
|
|
||||||
|
|
||||||
GetDataAsync(url, callback, configurationType, format);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the default user
|
|
||||||
/// </summary>
|
|
||||||
public void GetDefaultUserAsync(Action<DTOUser> callback)
|
|
||||||
{
|
|
||||||
string url = ApiUrl + "/user";
|
|
||||||
|
|
||||||
GetDataAsync(url, callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets a user by id
|
|
||||||
/// </summary>
|
|
||||||
public void GetUserAsync(Guid id, Action<DTOUser> callback)
|
|
||||||
{
|
|
||||||
string url = ApiUrl + "/user?id=" + id.ToString();
|
|
||||||
|
|
||||||
GetDataAsync(url, callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets weather information for the default location as set in configuration
|
|
||||||
/// </summary>
|
|
||||||
public void GetWeatherInfoAsync(Action<WeatherInfo> callback)
|
|
||||||
{
|
|
||||||
string url = ApiUrl + "/weather";
|
|
||||||
|
|
||||||
GetDataAsync(url, callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets weather information for a specific zip code
|
|
||||||
/// </summary>
|
|
||||||
public void GetWeatherInfoAsync(string zipCode, Action<WeatherInfo> callback)
|
|
||||||
{
|
|
||||||
string url = ApiUrl + "/weather?zipcode=" + zipCode;
|
|
||||||
|
|
||||||
GetDataAsync(url, callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets special features for a Movie
|
|
||||||
/// </summary>
|
|
||||||
public void GetMovieSpecialFeaturesAsync(Guid itemId, Guid userId, Action<DTOBaseItem[]> callback)
|
|
||||||
{
|
|
||||||
string url = ApiUrl + "/MovieSpecialFeatures?id=" + itemId;
|
|
||||||
url += "&userid=" + userId;
|
|
||||||
|
|
||||||
GetDataAsync(url, callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Authenticates a user and returns the result
|
|
||||||
/// </summary>
|
|
||||||
public void AuthenticateUserAsync(Guid userId, string password, Action<AuthenticationResult> callback)
|
|
||||||
{
|
|
||||||
string url = ApiUrl + "/UserAuthentication?dataformat=" + SerializationFormat.ToString();
|
|
||||||
|
|
||||||
Dictionary<string, string> formValues = new Dictionary<string, string>();
|
|
||||||
|
|
||||||
formValues["userid"] = userId.ToString();
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(password))
|
|
||||||
{
|
|
||||||
formValues["password"] = password;
|
|
||||||
}
|
|
||||||
|
|
||||||
PostDataAsync(url, formValues, callback, SerializationFormat);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Updates a user's favorite status for an item and returns the updated UserItemData object.
|
|
||||||
/// </summary>
|
|
||||||
public void UpdateFavoriteStatusAsync(Guid itemId, Guid userId, bool isFavorite, Action<DTOUserItemData> callback)
|
|
||||||
{
|
|
||||||
string url = ApiUrl + "/favoritestatus?id=" + itemId;
|
|
||||||
|
|
||||||
url += "&userid=" + userId;
|
|
||||||
url += "&isfavorite=" + (isFavorite ? "1" : "0");
|
|
||||||
|
|
||||||
GetDataAsync(url, callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Updates played status for an item
|
|
||||||
/// </summary>
|
|
||||||
public void UpdatePlayedStatusAsync(Guid itemId, Guid userId, bool wasPlayed, Action<DTOUserItemData> callback)
|
|
||||||
{
|
|
||||||
string url = ApiUrl + "/PlayedStatus?id=" + itemId;
|
|
||||||
|
|
||||||
url += "&userid=" + userId;
|
|
||||||
url += "&played=" + (wasPlayed ? "1" : "0");
|
|
||||||
|
|
||||||
GetDataAsync(url, callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clears a user's rating for an item
|
|
||||||
/// </summary>
|
|
||||||
public void ClearUserItemRatingAsync(Guid itemId, Guid userId, Action<DTOUserItemData> callback)
|
|
||||||
{
|
|
||||||
string url = ApiUrl + "/UserItemRating?id=" + itemId;
|
|
||||||
|
|
||||||
url += "&userid=" + userId;
|
|
||||||
url += "&clear=1";
|
|
||||||
|
|
||||||
GetDataAsync(url, callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Updates a user's rating for an item, based on likes or dislikes
|
|
||||||
/// </summary>
|
|
||||||
public void UpdateUserItemRatingAsync(Guid itemId, Guid userId, bool likes, Action<DTOUserItemData> callback)
|
|
||||||
{
|
|
||||||
string url = ApiUrl + "/UserItemRating?id=" + itemId;
|
|
||||||
|
|
||||||
url += "&userid=" + userId;
|
|
||||||
url += "&likes=" + (likes ? "1" : "0");
|
|
||||||
|
|
||||||
GetDataAsync(url, callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Performs a GET request, and deserializes the response stream to an object of Type T
|
|
||||||
/// </summary>
|
|
||||||
private void GetDataAsync<T>(string url, Action<T> callback)
|
|
||||||
where T : class
|
|
||||||
{
|
|
||||||
GetDataAsync<T>(url, callback, SerializationFormat);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Performs a GET request, and deserializes the response stream to an object of Type T
|
|
||||||
/// </summary>
|
|
||||||
private void GetDataAsync<T>(string url, Action<T> callback, SerializationFormats serializationFormat)
|
|
||||||
where T : class
|
|
||||||
{
|
|
||||||
if (url.IndexOf('?') == -1)
|
|
||||||
{
|
|
||||||
url += "?dataformat=" + serializationFormat.ToString();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
url += "&dataformat=" + serializationFormat.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
HttpWebRequest request = GetNewRequest(url);
|
|
||||||
|
|
||||||
request.BeginGetResponse(new AsyncCallback(result =>
|
|
||||||
{
|
|
||||||
T value;
|
|
||||||
|
|
||||||
using (WebResponse response = (result.AsyncState as HttpWebRequest).EndGetResponse(result))
|
|
||||||
{
|
|
||||||
using (Stream stream = response.GetResponseStream())
|
|
||||||
{
|
|
||||||
value = DeserializeFromStream<T>(stream);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
callback(value);
|
|
||||||
|
|
||||||
}), request);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Performs a GET request, and deserializes the response stream to an object of Type T
|
|
||||||
/// </summary>
|
|
||||||
private void GetDataAsync(string url, Action<object> callback, Type type, SerializationFormats serializationFormat)
|
|
||||||
{
|
|
||||||
if (url.IndexOf('?') == -1)
|
|
||||||
{
|
|
||||||
url += "?dataformat=" + serializationFormat.ToString();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
url += "&dataformat=" + serializationFormat.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
HttpWebRequest request = GetNewRequest(url);
|
|
||||||
|
|
||||||
request.BeginGetResponse(new AsyncCallback(result =>
|
|
||||||
{
|
|
||||||
object value;
|
|
||||||
|
|
||||||
using (WebResponse response = (result.AsyncState as HttpWebRequest).EndGetResponse(result))
|
|
||||||
{
|
|
||||||
using (Stream stream = response.GetResponseStream())
|
|
||||||
{
|
|
||||||
value = DataSerializer.DeserializeFromStream(stream, serializationFormat, type);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
callback(value);
|
|
||||||
|
|
||||||
}), request);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Performs a POST request, and deserializes the response stream to an object of Type T
|
|
||||||
/// </summary>
|
|
||||||
private void PostDataAsync<T>(string url, Dictionary<string, string> formValues, Action<T> callback, SerializationFormats serializationFormat)
|
|
||||||
where T : class
|
|
||||||
{
|
|
||||||
if (url.IndexOf('?') == -1)
|
|
||||||
{
|
|
||||||
url += "?dataformat=" + serializationFormat.ToString();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
url += "&dataformat=" + serializationFormat.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
HttpWebRequest request = GetNewRequest(url);
|
|
||||||
|
|
||||||
request.Method = "POST";
|
|
||||||
request.ContentType = "application/x-www-form-urlencoded";
|
|
||||||
|
|
||||||
// Begin getting request stream
|
|
||||||
request.BeginGetRequestStream(new AsyncCallback(beginGetRequestStreamResult =>
|
|
||||||
{
|
|
||||||
// Once we have the request stream, write the post data
|
|
||||||
using (Stream requestStream = request.EndGetRequestStream(beginGetRequestStreamResult))
|
|
||||||
{
|
|
||||||
// Construct the body
|
|
||||||
string postBody = string.Join("&", formValues.Keys.Select(s => string.Format("{0}={1}", s, formValues[s])).ToArray());
|
|
||||||
|
|
||||||
// Convert the string into a byte array.
|
|
||||||
byte[] byteArray = Encoding.UTF8.GetBytes(postBody);
|
|
||||||
|
|
||||||
// Write to the request stream.
|
|
||||||
requestStream.Write(byteArray, 0, byteArray.Length);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Begin getting response stream
|
|
||||||
request.BeginGetResponse(new AsyncCallback(result =>
|
|
||||||
{
|
|
||||||
// Once we have it, deserialize the data and execute the callback
|
|
||||||
T value;
|
|
||||||
|
|
||||||
using (WebResponse response = request.EndGetResponse(result))
|
|
||||||
{
|
|
||||||
using (Stream responseStream = response.GetResponseStream())
|
|
||||||
{
|
|
||||||
value = DeserializeFromStream<T>(responseStream);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
callback(value);
|
|
||||||
|
|
||||||
}), null);
|
|
||||||
|
|
||||||
}), null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,72 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
|
||||||
<PropertyGroup>
|
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
|
||||||
<ProjectGuid>{756B93D2-5FFA-4B8D-BDCA-127476F1E6FB}</ProjectGuid>
|
|
||||||
<OutputType>Library</OutputType>
|
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
|
||||||
<RootNamespace>MediaBrowser.ApiInteraction.Portable</RootNamespace>
|
|
||||||
<AssemblyName>MediaBrowser.ApiInteraction.Portable</AssemblyName>
|
|
||||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
|
||||||
<TargetFrameworkProfile>Profile4</TargetFrameworkProfile>
|
|
||||||
<FileAlignment>512</FileAlignment>
|
|
||||||
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<Optimize>false</Optimize>
|
|
||||||
<OutputPath>bin\Debug\</OutputPath>
|
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
|
||||||
<DebugType>pdbonly</DebugType>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<OutputPath>bin\Release\</OutputPath>
|
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="..\MediaBrowser.ApiInteraction\BaseApiClient.cs">
|
|
||||||
<Link>BaseApiClient.cs</Link>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="..\MediaBrowser.ApiInteraction.Metro\DataSerializer.cs">
|
|
||||||
<Link>DataSerializer.cs</Link>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="..\MediaBrowser.ApiInteraction\SerializationFormats.cs">
|
|
||||||
<Link>SerializationFormats.cs</Link>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="ApiClient.cs" />
|
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Reference Include="Newtonsoft.Json">
|
|
||||||
<HintPath>..\Json.Net\Portable\Newtonsoft.Json.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="protobuf-net">
|
|
||||||
<HintPath>..\protobuf-net\Full\portable\protobuf-net.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="ProtobufModelSerializer">
|
|
||||||
<HintPath>..\MediaBrowser.Model\bin\ProtobufModelSerializer.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj">
|
|
||||||
<Project>{7eeeb4bb-f3e8-48fc-b4c5-70f0fff8329b}</Project>
|
|
||||||
<Name>MediaBrowser.Model</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
|
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
|
||||||
<Target Name="BeforeBuild">
|
|
||||||
</Target>
|
|
||||||
<Target Name="AfterBuild">
|
|
||||||
</Target>
|
|
||||||
-->
|
|
||||||
</Project>
|
|
|
@ -1,30 +0,0 @@
|
||||||
using System.Resources;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
|
||||||
// set of attributes. Change these attribute values to modify the information
|
|
||||||
// associated with an assembly.
|
|
||||||
[assembly: AssemblyTitle("MediaBrowser.ApiInteraction.Portable")]
|
|
||||||
[assembly: AssemblyDescription("")]
|
|
||||||
[assembly: AssemblyConfiguration("")]
|
|
||||||
[assembly: AssemblyCompany("")]
|
|
||||||
[assembly: AssemblyProduct("MediaBrowser.ApiInteraction.Portable")]
|
|
||||||
[assembly: AssemblyCopyright("Copyright © 2012")]
|
|
||||||
[assembly: AssemblyTrademark("")]
|
|
||||||
[assembly: AssemblyCulture("")]
|
|
||||||
[assembly: NeutralResourcesLanguage("en")]
|
|
||||||
|
|
||||||
// Version information for an assembly consists of the following four values:
|
|
||||||
//
|
|
||||||
// Major Version
|
|
||||||
// Minor Version
|
|
||||||
// Build Number
|
|
||||||
// Revision
|
|
||||||
//
|
|
||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
|
||||||
// by using the '*' as shown below:
|
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
|
||||||
[assembly: AssemblyVersion("1.0.0.0")]
|
|
||||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
|
@ -12,18 +12,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{F0E0E6
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaBrowser.ApiInteraction.Metro", "MediaBrowser.ApiInteraction.Metro\MediaBrowser.ApiInteraction.Metro.csproj", "{94CEA07A-307C-4663-AA43-7BD852808574}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaBrowser.ApiInteraction.Metro", "MediaBrowser.ApiInteraction.Metro\MediaBrowser.ApiInteraction.Metro.csproj", "{94CEA07A-307C-4663-AA43-7BD852808574}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaBrowser.ApiInteraction.Portable", "MediaBrowser.ApiInteraction.Portable\MediaBrowser.ApiInteraction.Portable.csproj", "{756B93D2-5FFA-4B8D-BDCA-127476F1E6FB}"
|
|
||||||
EndProject
|
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
Release|Any CPU = Release|Any CPU
|
Release|Any CPU = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{756B93D2-5FFA-4B8D-BDCA-127476F1E6FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{756B93D2-5FFA-4B8D-BDCA-127476F1E6FB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{756B93D2-5FFA-4B8D-BDCA-127476F1E6FB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{756B93D2-5FFA-4B8D-BDCA-127476F1E6FB}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{7EEEB4BB-F3E8-48FC-B4C5-70F0FFF8329B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{7EEEB4BB-F3E8-48FC-B4C5-70F0FFF8329B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{7EEEB4BB-F3E8-48FC-B4C5-70F0FFF8329B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{7EEEB4BB-F3E8-48FC-B4C5-70F0FFF8329B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{7EEEB4BB-F3E8-48FC-B4C5-70F0FFF8329B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{7EEEB4BB-F3E8-48FC-B4C5-70F0FFF8329B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
|
|
@ -299,7 +299,7 @@ namespace MediaBrowser.ApiInteraction
|
||||||
/// <param name="maxWidth">Use if a max width is required. Aspect ratio will be preserved.</param>
|
/// <param name="maxWidth">Use if a max width is required. Aspect ratio will be preserved.</param>
|
||||||
/// <param name="maxHeight">Use if a max height is required. Aspect ratio will be preserved.</param>
|
/// <param name="maxHeight">Use if a max height is required. Aspect ratio will be preserved.</param>
|
||||||
/// <param name="quality">Quality level, from 0-100. Currently only applies to JPG. The default value should suffice.</param>
|
/// <param name="quality">Quality level, from 0-100. Currently only applies to JPG. The default value should suffice.</param>
|
||||||
public string[] GetBackdropImageUrls(DTOBaseItem item, int? width = null, int? height = null, int? maxWidth = null, int? maxHeight = null, int? quality = null)
|
public string[] GetBackdropImageUrls(DtoBaseItem item, int? width = null, int? height = null, int? maxWidth = null, int? maxHeight = null, int? quality = null)
|
||||||
{
|
{
|
||||||
Guid? backdropItemId = null;
|
Guid? backdropItemId = null;
|
||||||
int backdropCount = 0;
|
int backdropCount = 0;
|
||||||
|
@ -339,7 +339,7 @@ namespace MediaBrowser.ApiInteraction
|
||||||
/// <param name="maxWidth">Use if a max width is required. Aspect ratio will be preserved.</param>
|
/// <param name="maxWidth">Use if a max width is required. Aspect ratio will be preserved.</param>
|
||||||
/// <param name="maxHeight">Use if a max height is required. Aspect ratio will be preserved.</param>
|
/// <param name="maxHeight">Use if a max height is required. Aspect ratio will be preserved.</param>
|
||||||
/// <param name="quality">Quality level, from 0-100. Currently only applies to JPG. The default value should suffice.</param>
|
/// <param name="quality">Quality level, from 0-100. Currently only applies to JPG. The default value should suffice.</param>
|
||||||
public string GetLogoImageUrl(DTOBaseItem item, int? width = null, int? height = null, int? maxWidth = null, int? maxHeight = null, int? quality = null)
|
public string GetLogoImageUrl(DtoBaseItem item, int? width = null, int? height = null, int? maxWidth = null, int? maxHeight = null, int? quality = null)
|
||||||
{
|
{
|
||||||
Guid? logoItemId = item.HasLogo ? item.Id : item.ParentLogoItemId;
|
Guid? logoItemId = item.HasLogo ? item.Id : item.ParentLogoItemId;
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ namespace MediaBrowser.ApiInteraction
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a BaseItem
|
/// Gets a BaseItem
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public async Task<DTOBaseItem> GetItemAsync(Guid id, Guid userId)
|
public async Task<DtoBaseItem> GetItemAsync(Guid id, Guid userId)
|
||||||
{
|
{
|
||||||
string url = ApiUrl + "/item?userId=" + userId.ToString();
|
string url = ApiUrl + "/item?userId=" + userId.ToString();
|
||||||
|
|
||||||
|
@ -61,20 +61,20 @@ namespace MediaBrowser.ApiInteraction
|
||||||
|
|
||||||
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
|
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
return DeserializeFromStream<DTOBaseItem>(stream);
|
return DeserializeFromStream<DtoBaseItem>(stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets all Users
|
/// Gets all Users
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public async Task<DTOUser[]> GetAllUsersAsync()
|
public async Task<DtoUser[]> GetAllUsersAsync()
|
||||||
{
|
{
|
||||||
string url = ApiUrl + "/users";
|
string url = ApiUrl + "/users";
|
||||||
|
|
||||||
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
|
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
return DeserializeFromStream<DTOUser[]>(stream);
|
return DeserializeFromStream<DtoUser[]>(stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ namespace MediaBrowser.ApiInteraction
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="userId">The user id.</param>
|
/// <param name="userId">The user id.</param>
|
||||||
/// <param name="folderId">(Optional) Specify a folder Id to localize the search to a specific folder.</param>
|
/// <param name="folderId">(Optional) Specify a folder Id to localize the search to a specific folder.</param>
|
||||||
public async Task<DTOBaseItem[]> GetInProgressItemsItemsAsync(Guid userId, Guid? folderId = null)
|
public async Task<DtoBaseItem[]> GetInProgressItemsItemsAsync(Guid userId, Guid? folderId = null)
|
||||||
{
|
{
|
||||||
string url = ApiUrl + "/itemlist?listtype=inprogressitems&userId=" + userId.ToString();
|
string url = ApiUrl + "/itemlist?listtype=inprogressitems&userId=" + userId.ToString();
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ namespace MediaBrowser.ApiInteraction
|
||||||
|
|
||||||
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
|
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
return DeserializeFromStream<DTOBaseItem[]>(stream);
|
return DeserializeFromStream<DtoBaseItem[]>(stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ namespace MediaBrowser.ApiInteraction
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="userId">The user id.</param>
|
/// <param name="userId">The user id.</param>
|
||||||
/// <param name="folderId">(Optional) Specify a folder Id to localize the search to a specific folder.</param>
|
/// <param name="folderId">(Optional) Specify a folder Id to localize the search to a specific folder.</param>
|
||||||
public async Task<DTOBaseItem[]> GetRecentlyAddedItemsAsync(Guid userId, Guid? folderId = null)
|
public async Task<DtoBaseItem[]> GetRecentlyAddedItemsAsync(Guid userId, Guid? folderId = null)
|
||||||
{
|
{
|
||||||
string url = ApiUrl + "/itemlist?listtype=recentlyaddeditems&userId=" + userId.ToString();
|
string url = ApiUrl + "/itemlist?listtype=recentlyaddeditems&userId=" + userId.ToString();
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ namespace MediaBrowser.ApiInteraction
|
||||||
|
|
||||||
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
|
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
return DeserializeFromStream<DTOBaseItem[]>(stream);
|
return DeserializeFromStream<DtoBaseItem[]>(stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ namespace MediaBrowser.ApiInteraction
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="userId">The user id.</param>
|
/// <param name="userId">The user id.</param>
|
||||||
/// <param name="folderId">(Optional) Specify a folder Id to localize the search to a specific folder.</param>
|
/// <param name="folderId">(Optional) Specify a folder Id to localize the search to a specific folder.</param>
|
||||||
public async Task<DTOBaseItem[]> GetFavoriteItemsAsync(Guid userId, Guid? folderId = null)
|
public async Task<DtoBaseItem[]> GetFavoriteItemsAsync(Guid userId, Guid? folderId = null)
|
||||||
{
|
{
|
||||||
string url = ApiUrl + "/itemlist?listtype=favorites&userId=" + userId.ToString();
|
string url = ApiUrl + "/itemlist?listtype=favorites&userId=" + userId.ToString();
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ namespace MediaBrowser.ApiInteraction
|
||||||
|
|
||||||
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
|
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
return DeserializeFromStream<DTOBaseItem[]>(stream);
|
return DeserializeFromStream<DtoBaseItem[]>(stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ namespace MediaBrowser.ApiInteraction
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="userId">The user id.</param>
|
/// <param name="userId">The user id.</param>
|
||||||
/// <param name="folderId">(Optional) Specify a folder Id to localize the search to a specific folder.</param>
|
/// <param name="folderId">(Optional) Specify a folder Id to localize the search to a specific folder.</param>
|
||||||
public async Task<DTOBaseItem[]> GetRecentlyAddedUnplayedItemsAsync(Guid userId, Guid? folderId = null)
|
public async Task<DtoBaseItem[]> GetRecentlyAddedUnplayedItemsAsync(Guid userId, Guid? folderId = null)
|
||||||
{
|
{
|
||||||
string url = ApiUrl + "/itemlist?listtype=recentlyaddedunplayeditems&userId=" + userId.ToString();
|
string url = ApiUrl + "/itemlist?listtype=recentlyaddedunplayeditems&userId=" + userId.ToString();
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ namespace MediaBrowser.ApiInteraction
|
||||||
|
|
||||||
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
|
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
return DeserializeFromStream<DTOBaseItem[]>(stream);
|
return DeserializeFromStream<DtoBaseItem[]>(stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,7 +188,7 @@ namespace MediaBrowser.ApiInteraction
|
||||||
/// Gets all items that contain a given Year
|
/// Gets all items that contain a given Year
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="folderId">(Optional) Specify a folder Id to localize the search to a specific folder.</param>
|
/// <param name="folderId">(Optional) Specify a folder Id to localize the search to a specific folder.</param>
|
||||||
public async Task<DTOBaseItem[]> GetItemsWithYearAsync(string name, Guid userId, Guid? folderId = null)
|
public async Task<DtoBaseItem[]> GetItemsWithYearAsync(string name, Guid userId, Guid? folderId = null)
|
||||||
{
|
{
|
||||||
string url = ApiUrl + "/itemlist?listtype=itemswithyear&userId=" + userId.ToString() + "&name=" + name;
|
string url = ApiUrl + "/itemlist?listtype=itemswithyear&userId=" + userId.ToString() + "&name=" + name;
|
||||||
|
|
||||||
|
@ -199,7 +199,7 @@ namespace MediaBrowser.ApiInteraction
|
||||||
|
|
||||||
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
|
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
return DeserializeFromStream<DTOBaseItem[]>(stream);
|
return DeserializeFromStream<DtoBaseItem[]>(stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -207,7 +207,7 @@ namespace MediaBrowser.ApiInteraction
|
||||||
/// Gets all items that contain a given Genre
|
/// Gets all items that contain a given Genre
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="folderId">(Optional) Specify a folder Id to localize the search to a specific folder.</param>
|
/// <param name="folderId">(Optional) Specify a folder Id to localize the search to a specific folder.</param>
|
||||||
public async Task<DTOBaseItem[]> GetItemsWithGenreAsync(string name, Guid userId, Guid? folderId = null)
|
public async Task<DtoBaseItem[]> GetItemsWithGenreAsync(string name, Guid userId, Guid? folderId = null)
|
||||||
{
|
{
|
||||||
string url = ApiUrl + "/itemlist?listtype=itemswithgenre&userId=" + userId.ToString() + "&name=" + name;
|
string url = ApiUrl + "/itemlist?listtype=itemswithgenre&userId=" + userId.ToString() + "&name=" + name;
|
||||||
|
|
||||||
|
@ -218,7 +218,7 @@ namespace MediaBrowser.ApiInteraction
|
||||||
|
|
||||||
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
|
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
return DeserializeFromStream<DTOBaseItem[]>(stream);
|
return DeserializeFromStream<DtoBaseItem[]>(stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,7 +226,7 @@ namespace MediaBrowser.ApiInteraction
|
||||||
/// Gets all items that contain a given Person
|
/// Gets all items that contain a given Person
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="folderId">(Optional) Specify a folder Id to localize the search to a specific folder.</param>
|
/// <param name="folderId">(Optional) Specify a folder Id to localize the search to a specific folder.</param>
|
||||||
public async Task<DTOBaseItem[]> GetItemsWithPersonAsync(string name, Guid userId, Guid? folderId = null)
|
public async Task<DtoBaseItem[]> GetItemsWithPersonAsync(string name, Guid userId, Guid? folderId = null)
|
||||||
{
|
{
|
||||||
string url = ApiUrl + "/itemlist?listtype=itemswithperson&userId=" + userId.ToString() + "&name=" + name;
|
string url = ApiUrl + "/itemlist?listtype=itemswithperson&userId=" + userId.ToString() + "&name=" + name;
|
||||||
|
|
||||||
|
@ -237,7 +237,7 @@ namespace MediaBrowser.ApiInteraction
|
||||||
|
|
||||||
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
|
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
return DeserializeFromStream<DTOBaseItem[]>(stream);
|
return DeserializeFromStream<DtoBaseItem[]>(stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,7 +245,7 @@ namespace MediaBrowser.ApiInteraction
|
||||||
/// Gets all items that contain a given Person
|
/// Gets all items that contain a given Person
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="folderId">(Optional) Specify a folder Id to localize the search to a specific folder.</param>
|
/// <param name="folderId">(Optional) Specify a folder Id to localize the search to a specific folder.</param>
|
||||||
public async Task<DTOBaseItem[]> GetItemsWithPersonAsync(string name, string personType, Guid userId, Guid? folderId = null)
|
public async Task<DtoBaseItem[]> GetItemsWithPersonAsync(string name, string personType, Guid userId, Guid? folderId = null)
|
||||||
{
|
{
|
||||||
string url = ApiUrl + "/itemlist?listtype=itemswithperson&userId=" + userId.ToString() + "&name=" + name;
|
string url = ApiUrl + "/itemlist?listtype=itemswithperson&userId=" + userId.ToString() + "&name=" + name;
|
||||||
|
|
||||||
|
@ -258,7 +258,7 @@ namespace MediaBrowser.ApiInteraction
|
||||||
|
|
||||||
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
|
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
return DeserializeFromStream<DTOBaseItem[]>(stream);
|
return DeserializeFromStream<DtoBaseItem[]>(stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -279,7 +279,7 @@ namespace MediaBrowser.ApiInteraction
|
||||||
/// Gets all items that contain a given Studio
|
/// Gets all items that contain a given Studio
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="folderId">(Optional) Specify a folder Id to localize the search to a specific folder.</param>
|
/// <param name="folderId">(Optional) Specify a folder Id to localize the search to a specific folder.</param>
|
||||||
public async Task<DTOBaseItem[]> GetItemsWithStudioAsync(string name, Guid userId, Guid? folderId = null)
|
public async Task<DtoBaseItem[]> GetItemsWithStudioAsync(string name, Guid userId, Guid? folderId = null)
|
||||||
{
|
{
|
||||||
string url = ApiUrl + "/itemlist?listtype=itemswithstudio&userId=" + userId.ToString() + "&name=" + name;
|
string url = ApiUrl + "/itemlist?listtype=itemswithstudio&userId=" + userId.ToString() + "&name=" + name;
|
||||||
|
|
||||||
|
@ -290,7 +290,7 @@ namespace MediaBrowser.ApiInteraction
|
||||||
|
|
||||||
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
|
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
return DeserializeFromStream<DTOBaseItem[]>(stream);
|
return DeserializeFromStream<DtoBaseItem[]>(stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -401,26 +401,26 @@ namespace MediaBrowser.ApiInteraction
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the default user
|
/// Gets the default user
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public async Task<DTOUser> GetDefaultUserAsync()
|
public async Task<DtoUser> GetDefaultUserAsync()
|
||||||
{
|
{
|
||||||
string url = ApiUrl + "/user";
|
string url = ApiUrl + "/user";
|
||||||
|
|
||||||
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
|
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
return DeserializeFromStream<DTOUser>(stream);
|
return DeserializeFromStream<DtoUser>(stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a user by id
|
/// Gets a user by id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public async Task<DTOUser> GetUserAsync(Guid id)
|
public async Task<DtoUser> GetUserAsync(Guid id)
|
||||||
{
|
{
|
||||||
string url = ApiUrl + "/user?id=" + id.ToString();
|
string url = ApiUrl + "/user?id=" + id.ToString();
|
||||||
|
|
||||||
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
|
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
return DeserializeFromStream<DTOUser>(stream);
|
return DeserializeFromStream<DtoUser>(stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -453,21 +453,21 @@ namespace MediaBrowser.ApiInteraction
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets special features for a Movie
|
/// Gets special features for a Movie
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public async Task<DTOBaseItem[]> GetMovieSpecialFeaturesAsync(Guid itemId, Guid userId)
|
public async Task<DtoBaseItem[]> GetMovieSpecialFeaturesAsync(Guid itemId, Guid userId)
|
||||||
{
|
{
|
||||||
string url = ApiUrl + "/MovieSpecialFeatures?id=" + itemId;
|
string url = ApiUrl + "/MovieSpecialFeatures?id=" + itemId;
|
||||||
url += "&userid=" + userId;
|
url += "&userid=" + userId;
|
||||||
|
|
||||||
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
|
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
return DeserializeFromStream<DTOBaseItem[]>(stream);
|
return DeserializeFromStream<DtoBaseItem[]>(stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Updates played status for an item
|
/// Updates played status for an item
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public async Task<DTOUserItemData> UpdatePlayedStatusAsync(Guid itemId, Guid userId, bool wasPlayed)
|
public async Task<DtoUserItemData> UpdatePlayedStatusAsync(Guid itemId, Guid userId, bool wasPlayed)
|
||||||
{
|
{
|
||||||
string url = ApiUrl + "/PlayedStatus?id=" + itemId;
|
string url = ApiUrl + "/PlayedStatus?id=" + itemId;
|
||||||
|
|
||||||
|
@ -476,14 +476,14 @@ namespace MediaBrowser.ApiInteraction
|
||||||
|
|
||||||
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
|
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
return DeserializeFromStream<DTOUserItemData>(stream);
|
return DeserializeFromStream<DtoUserItemData>(stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Updates a user's favorite status for an item and returns the updated UserItemData object.
|
/// Updates a user's favorite status for an item and returns the updated UserItemData object.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public async Task<DTOUserItemData> UpdateFavoriteStatusAsync(Guid itemId, Guid userId, bool isFavorite)
|
public async Task<DtoUserItemData> UpdateFavoriteStatusAsync(Guid itemId, Guid userId, bool isFavorite)
|
||||||
{
|
{
|
||||||
string url = ApiUrl + "/favoritestatus?id=" + itemId;
|
string url = ApiUrl + "/favoritestatus?id=" + itemId;
|
||||||
|
|
||||||
|
@ -492,14 +492,14 @@ namespace MediaBrowser.ApiInteraction
|
||||||
|
|
||||||
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
|
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
return DeserializeFromStream<DTOUserItemData>(stream);
|
return DeserializeFromStream<DtoUserItemData>(stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Clears a user's rating for an item
|
/// Clears a user's rating for an item
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public async Task<DTOUserItemData> ClearUserItemRatingAsync(Guid itemId, Guid userId)
|
public async Task<DtoUserItemData> ClearUserItemRatingAsync(Guid itemId, Guid userId)
|
||||||
{
|
{
|
||||||
string url = ApiUrl + "/UserItemRating?id=" + itemId;
|
string url = ApiUrl + "/UserItemRating?id=" + itemId;
|
||||||
|
|
||||||
|
@ -508,14 +508,14 @@ namespace MediaBrowser.ApiInteraction
|
||||||
|
|
||||||
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
|
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
return DeserializeFromStream<DTOUserItemData>(stream);
|
return DeserializeFromStream<DtoUserItemData>(stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Updates a user's rating for an item, based on likes or dislikes
|
/// Updates a user's rating for an item, based on likes or dislikes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public async Task<DTOUserItemData> UpdateUserItemRatingAsync(Guid itemId, Guid userId, bool likes)
|
public async Task<DtoUserItemData> UpdateUserItemRatingAsync(Guid itemId, Guid userId, bool likes)
|
||||||
{
|
{
|
||||||
string url = ApiUrl + "/UserItemRating?id=" + itemId;
|
string url = ApiUrl + "/UserItemRating?id=" + itemId;
|
||||||
|
|
||||||
|
@ -524,7 +524,7 @@ namespace MediaBrowser.ApiInteraction
|
||||||
|
|
||||||
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
|
using (Stream stream = await GetSerializedStreamAsync(url).ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
return DeserializeFromStream<DTOUserItemData>(stream);
|
return DeserializeFromStream<DtoUserItemData>(stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ namespace MediaBrowser.ApiInteraction
|
||||||
/// This means that this class can currently only handle types within the Model project.
|
/// This means that this class can currently only handle types within the Model project.
|
||||||
/// If we need to, we can always add a param indicating whether or not the model serializer should be used.
|
/// If we need to, we can always add a param indicating whether or not the model serializer should be used.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static ProtobufModelSerializer ProtobufModelSerializer = new ProtobufModelSerializer();
|
private static readonly ProtobufModelSerializer ProtobufModelSerializer = new ProtobufModelSerializer();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Deserializes an object using generics
|
/// Deserializes an object using generics
|
||||||
|
@ -20,16 +20,16 @@ namespace MediaBrowser.ApiInteraction
|
||||||
public static T DeserializeFromStream<T>(Stream stream, SerializationFormats format)
|
public static T DeserializeFromStream<T>(Stream stream, SerializationFormats format)
|
||||||
where T : class
|
where T : class
|
||||||
{
|
{
|
||||||
if (format == ApiInteraction.SerializationFormats.Protobuf)
|
if (format == SerializationFormats.Protobuf)
|
||||||
{
|
{
|
||||||
//return Serializer.Deserialize<T>(stream);
|
//return Serializer.Deserialize<T>(stream);
|
||||||
return ProtobufModelSerializer.Deserialize(stream, null, typeof(T)) as T;
|
return ProtobufModelSerializer.Deserialize(stream, null, typeof(T)) as T;
|
||||||
}
|
}
|
||||||
else if (format == ApiInteraction.SerializationFormats.Jsv)
|
else if (format == SerializationFormats.Jsv)
|
||||||
{
|
{
|
||||||
return TypeSerializer.DeserializeFromStream<T>(stream);
|
return TypeSerializer.DeserializeFromStream<T>(stream);
|
||||||
}
|
}
|
||||||
else if (format == ApiInteraction.SerializationFormats.Json)
|
else if (format == SerializationFormats.Json)
|
||||||
{
|
{
|
||||||
return JsonSerializer.DeserializeFromStream<T>(stream);
|
return JsonSerializer.DeserializeFromStream<T>(stream);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
// General Information about an assembly is controlled through the following
|
||||||
|
|
|
@ -67,7 +67,7 @@ namespace MediaBrowser.Common.Kernel
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract KernelContext KernelContext { get; }
|
public abstract KernelContext KernelContext { get; }
|
||||||
|
|
||||||
public BaseKernel()
|
protected BaseKernel()
|
||||||
{
|
{
|
||||||
ApplicationPaths = new TApplicationPathsType();
|
ApplicationPaths = new TApplicationPathsType();
|
||||||
}
|
}
|
||||||
|
@ -76,13 +76,13 @@ namespace MediaBrowser.Common.Kernel
|
||||||
{
|
{
|
||||||
ReloadLogger();
|
ReloadLogger();
|
||||||
|
|
||||||
progress.Report(new TaskProgress() { Description = "Loading configuration", PercentComplete = 0 });
|
progress.Report(new TaskProgress { Description = "Loading configuration", PercentComplete = 0 });
|
||||||
ReloadConfiguration();
|
ReloadConfiguration();
|
||||||
|
|
||||||
progress.Report(new TaskProgress() { Description = "Starting Http server", PercentComplete = 5 });
|
progress.Report(new TaskProgress { Description = "Starting Http server", PercentComplete = 5 });
|
||||||
ReloadHttpServer();
|
ReloadHttpServer();
|
||||||
|
|
||||||
progress.Report(new TaskProgress() { Description = "Loading Plugins", PercentComplete = 10 });
|
progress.Report(new TaskProgress { Description = "Loading Plugins", PercentComplete = 10 });
|
||||||
await ReloadComposableParts().ConfigureAwait(false);
|
await ReloadComposableParts().ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,7 +192,7 @@ namespace MediaBrowser.Common.Kernel
|
||||||
|
|
||||||
HttpServer = new HttpServer(HttpServerUrlPrefix);
|
HttpServer = new HttpServer(HttpServerUrlPrefix);
|
||||||
|
|
||||||
HttpListener = HttpServer.Subscribe((ctx) =>
|
HttpListener = HttpServer.Subscribe(ctx =>
|
||||||
{
|
{
|
||||||
BaseHandler handler = HttpHandlers.FirstOrDefault(h => h.HandlesRequest(ctx.Request));
|
BaseHandler handler = HttpHandlers.FirstOrDefault(h => h.HandlesRequest(ctx.Request));
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ namespace MediaBrowser.Common.Logging
|
||||||
|
|
||||||
Thread currentThread = Thread.CurrentThread;
|
Thread currentThread = Thread.CurrentThread;
|
||||||
|
|
||||||
LogRow row = new LogRow()
|
LogRow row = new LogRow
|
||||||
{
|
{
|
||||||
Severity = severity,
|
Severity = severity,
|
||||||
Message = message,
|
Message = message,
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Text;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace MediaBrowser.Common.Logging
|
namespace MediaBrowser.Common.Logging
|
||||||
{
|
{
|
||||||
|
@ -17,7 +15,7 @@ namespace MediaBrowser.Common.Logging
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
List<string> data = new List<string>();
|
var data = new List<string>();
|
||||||
|
|
||||||
data.Add(Time.ToString(TimePattern));
|
data.Add(Time.ToString(TimePattern));
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ namespace MediaBrowser.Common.Logging
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Provides a Logger that can write to any Stream
|
/// Provides a Logger that can write to any Stream
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class StreamLogger : ThreadedLogger
|
public class StreamLogger : BaseLogger
|
||||||
{
|
{
|
||||||
private Stream Stream { get; set; }
|
private Stream Stream { get; set; }
|
||||||
|
|
||||||
|
@ -17,11 +17,15 @@ namespace MediaBrowser.Common.Logging
|
||||||
Stream = stream;
|
Stream = stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void AsyncLogMessage(LogRow row)
|
protected override void LogEntry(LogRow row)
|
||||||
{
|
{
|
||||||
byte[] bytes = new UTF8Encoding().GetBytes(row.ToString() + Environment.NewLine);
|
byte[] bytes = new UTF8Encoding().GetBytes(row.ToString() + Environment.NewLine);
|
||||||
Stream.Write(bytes, 0, bytes.Length);
|
|
||||||
Stream.Flush();
|
lock (Stream)
|
||||||
|
{
|
||||||
|
Stream.Write(bytes, 0, bytes.Length);
|
||||||
|
Stream.Flush();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Dispose()
|
public override void Dispose()
|
||||||
|
|
|
@ -1,73 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Threading;
|
|
||||||
|
|
||||||
namespace MediaBrowser.Common.Logging
|
|
||||||
{
|
|
||||||
public abstract class ThreadedLogger : BaseLogger
|
|
||||||
{
|
|
||||||
Thread loggingThread;
|
|
||||||
Queue<Action> queue = new Queue<Action>();
|
|
||||||
AutoResetEvent hasNewItems = new AutoResetEvent(false);
|
|
||||||
volatile bool terminate = false;
|
|
||||||
bool waiting = false;
|
|
||||||
|
|
||||||
public ThreadedLogger()
|
|
||||||
: base()
|
|
||||||
{
|
|
||||||
loggingThread = new Thread(new ThreadStart(ProcessQueue));
|
|
||||||
loggingThread.IsBackground = true;
|
|
||||||
loggingThread.Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ProcessQueue()
|
|
||||||
{
|
|
||||||
while (!terminate)
|
|
||||||
{
|
|
||||||
waiting = true;
|
|
||||||
hasNewItems.WaitOne(10000, true);
|
|
||||||
waiting = false;
|
|
||||||
|
|
||||||
Queue<Action> queueCopy;
|
|
||||||
lock (queue)
|
|
||||||
{
|
|
||||||
queueCopy = new Queue<Action>(queue);
|
|
||||||
queue.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var log in queueCopy)
|
|
||||||
{
|
|
||||||
log();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void LogEntry(LogRow row)
|
|
||||||
{
|
|
||||||
lock (queue)
|
|
||||||
{
|
|
||||||
queue.Enqueue(() => AsyncLogMessage(row));
|
|
||||||
}
|
|
||||||
hasNewItems.Set();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected abstract void AsyncLogMessage(LogRow row);
|
|
||||||
|
|
||||||
protected override void Flush()
|
|
||||||
{
|
|
||||||
while (!waiting)
|
|
||||||
{
|
|
||||||
Thread.Sleep(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Dispose()
|
|
||||||
{
|
|
||||||
Flush();
|
|
||||||
terminate = true;
|
|
||||||
hasNewItems.Set();
|
|
||||||
base.Dispose();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -83,7 +83,6 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Kernel\BaseApplicationPaths.cs" />
|
<Compile Include="Kernel\BaseApplicationPaths.cs" />
|
||||||
<Compile Include="Drawing\DrawingUtils.cs" />
|
<Compile Include="Drawing\DrawingUtils.cs" />
|
||||||
<Compile Include="Logging\ThreadedLogger.cs" />
|
|
||||||
<Compile Include="Logging\TraceLogger.cs" />
|
<Compile Include="Logging\TraceLogger.cs" />
|
||||||
<Compile Include="Net\Handlers\StaticFileHandler.cs" />
|
<Compile Include="Net\Handlers\StaticFileHandler.cs" />
|
||||||
<Compile Include="Net\MimeTypes.cs" />
|
<Compile Include="Net\MimeTypes.cs" />
|
||||||
|
|
|
@ -5,7 +5,7 @@ namespace MediaBrowser.Common.Net.Handlers
|
||||||
{
|
{
|
||||||
public abstract class BaseEmbeddedResourceHandler : BaseHandler
|
public abstract class BaseEmbeddedResourceHandler : BaseHandler
|
||||||
{
|
{
|
||||||
public BaseEmbeddedResourceHandler(string resourcePath)
|
protected BaseEmbeddedResourceHandler(string resourcePath)
|
||||||
: base()
|
: base()
|
||||||
{
|
{
|
||||||
ResourcePath = resourcePath;
|
ResourcePath = resourcePath;
|
||||||
|
@ -15,7 +15,7 @@ namespace MediaBrowser.Common.Net.Handlers
|
||||||
|
|
||||||
public override Task<string> GetContentType()
|
public override Task<string> GetContentType()
|
||||||
{
|
{
|
||||||
return Task.FromResult<string>(MimeTypes.GetMimeType(ResourcePath));
|
return Task.FromResult(MimeTypes.GetMimeType(ResourcePath));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Task WriteResponseToOutputStream(Stream stream)
|
protected override Task WriteResponseToOutputStream(Stream stream)
|
||||||
|
|
|
@ -25,8 +25,8 @@ namespace MediaBrowser.Common.Net.Handlers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool _TotalContentLengthDiscovered = false;
|
private bool _TotalContentLengthDiscovered;
|
||||||
private long? _TotalContentLength = null;
|
private long? _TotalContentLength;
|
||||||
public long? TotalContentLength
|
public long? TotalContentLength
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -34,6 +34,7 @@ namespace MediaBrowser.Common.Net.Handlers
|
||||||
if (!_TotalContentLengthDiscovered)
|
if (!_TotalContentLengthDiscovered)
|
||||||
{
|
{
|
||||||
_TotalContentLength = GetTotalContentLength();
|
_TotalContentLength = GetTotalContentLength();
|
||||||
|
_TotalContentLengthDiscovered = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _TotalContentLength;
|
return _TotalContentLength;
|
||||||
|
@ -64,7 +65,7 @@ namespace MediaBrowser.Common.Net.Handlers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected List<KeyValuePair<long, long?>> _RequestedRanges = null;
|
private List<KeyValuePair<long, long?>> _RequestedRanges;
|
||||||
protected IEnumerable<KeyValuePair<long, long?>> RequestedRanges
|
protected IEnumerable<KeyValuePair<long, long?>> RequestedRanges
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -367,7 +368,7 @@ namespace MediaBrowser.Common.Net.Handlers
|
||||||
{
|
{
|
||||||
DateTime? value = null;
|
DateTime? value = null;
|
||||||
|
|
||||||
return Task.FromResult<DateTime?>(value);
|
return Task.FromResult(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool IsResponseValid
|
private bool IsResponseValid
|
||||||
|
@ -378,7 +379,7 @@ namespace MediaBrowser.Common.Net.Handlers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Hashtable _FormValues = null;
|
private Hashtable _FormValues;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value from form POST data
|
/// Gets a value from form POST data
|
||||||
|
|
|
@ -15,7 +15,7 @@ namespace MediaBrowser.Common.Net.Handlers
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(format))
|
if (string.IsNullOrEmpty(format))
|
||||||
{
|
{
|
||||||
return Handlers.SerializationFormat.Json;
|
return SerializationFormat.Json;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (SerializationFormat)Enum.Parse(typeof(SerializationFormat), format, true);
|
return (SerializationFormat)Enum.Parse(typeof(SerializationFormat), format, true);
|
||||||
|
@ -26,16 +26,16 @@ namespace MediaBrowser.Common.Net.Handlers
|
||||||
{
|
{
|
||||||
switch (SerializationFormat)
|
switch (SerializationFormat)
|
||||||
{
|
{
|
||||||
case Handlers.SerializationFormat.Jsv:
|
case SerializationFormat.Jsv:
|
||||||
return Task.FromResult<string>("text/plain");
|
return Task.FromResult("text/plain");
|
||||||
case Handlers.SerializationFormat.Protobuf:
|
case SerializationFormat.Protobuf:
|
||||||
return Task.FromResult<string>("application/x-protobuf");
|
return Task.FromResult("application/x-protobuf");
|
||||||
default:
|
default:
|
||||||
return Task.FromResult<string>(MimeTypes.JsonMimeType);
|
return Task.FromResult(MimeTypes.JsonMimeType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool _ObjectToSerializeEnsured = false;
|
private bool _ObjectToSerializeEnsured;
|
||||||
private T _ObjectToSerialize;
|
private T _ObjectToSerialize;
|
||||||
|
|
||||||
private async Task EnsureObjectToSerialize()
|
private async Task EnsureObjectToSerialize()
|
||||||
|
@ -66,14 +66,14 @@ namespace MediaBrowser.Common.Net.Handlers
|
||||||
|
|
||||||
switch (SerializationFormat)
|
switch (SerializationFormat)
|
||||||
{
|
{
|
||||||
case Handlers.SerializationFormat.Jsv:
|
case SerializationFormat.Jsv:
|
||||||
JsvSerializer.SerializeToStream<T>(_ObjectToSerialize, stream);
|
JsvSerializer.SerializeToStream(_ObjectToSerialize, stream);
|
||||||
break;
|
break;
|
||||||
case Handlers.SerializationFormat.Protobuf:
|
case SerializationFormat.Protobuf:
|
||||||
ProtobufSerializer.SerializeToStream<T>(_ObjectToSerialize, stream);
|
ProtobufSerializer.SerializeToStream(_ObjectToSerialize, stream);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
JsonSerializer.SerializeToStream<T>(_ObjectToSerialize, stream);
|
JsonSerializer.SerializeToStream(_ObjectToSerialize, stream);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,8 +33,8 @@ namespace MediaBrowser.Common.Net.Handlers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool _SourceStreamEnsured = false;
|
private bool _SourceStreamEnsured;
|
||||||
private Stream _SourceStream = null;
|
private Stream _SourceStream;
|
||||||
private Stream SourceStream
|
private Stream SourceStream
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -116,12 +116,12 @@ namespace MediaBrowser.Common.Net.Handlers
|
||||||
value = File.GetLastWriteTimeUtc(Path);
|
value = File.GetLastWriteTimeUtc(Path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Task.FromResult<DateTime?>(value);
|
return Task.FromResult(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Task<string> GetContentType()
|
public override Task<string> GetContentType()
|
||||||
{
|
{
|
||||||
return Task.FromResult<string>(MimeTypes.GetMimeType(Path));
|
return Task.FromResult(MimeTypes.GetMimeType(Path));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Task PrepareResponse()
|
protected override Task PrepareResponse()
|
||||||
|
@ -141,21 +141,17 @@ namespace MediaBrowser.Common.Net.Handlers
|
||||||
{
|
{
|
||||||
return ServeCompleteRangeRequest(requestedRange, stream);
|
return ServeCompleteRangeRequest(requestedRange, stream);
|
||||||
}
|
}
|
||||||
else if (TotalContentLength.HasValue)
|
if (TotalContentLength.HasValue)
|
||||||
{
|
{
|
||||||
// This will have to buffer a portion of the content into memory
|
// This will have to buffer a portion of the content into memory
|
||||||
return ServePartialRangeRequestWithKnownTotalContentLength(requestedRange, stream);
|
return ServePartialRangeRequestWithKnownTotalContentLength(requestedRange, stream);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
// This will have to buffer the entire content into memory
|
||||||
// This will have to buffer the entire content into memory
|
return ServePartialRangeRequestWithUnknownTotalContentLength(requestedRange, stream);
|
||||||
return ServePartialRangeRequestWithUnknownTotalContentLength(requestedRange, stream);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return SourceStream.CopyToAsync(stream);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return SourceStream.CopyToAsync(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void DisposeResponseStream()
|
protected override void DisposeResponseStream()
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace MediaBrowser.Common.Net
|
||||||
private IObservable<HttpListenerContext> ObservableHttpContext()
|
private IObservable<HttpListenerContext> ObservableHttpContext()
|
||||||
{
|
{
|
||||||
return Observable.Create<HttpListenerContext>(obs =>
|
return Observable.Create<HttpListenerContext>(obs =>
|
||||||
Observable.FromAsync<HttpListenerContext>(() => listener.GetContextAsync())
|
Observable.FromAsync(() => listener.GetContextAsync())
|
||||||
.Subscribe(obs))
|
.Subscribe(obs))
|
||||||
.Repeat()
|
.Repeat()
|
||||||
.Retry()
|
.Retry()
|
||||||
|
|
|
@ -9,7 +9,7 @@ namespace MediaBrowser.Common.Net
|
||||||
|
|
||||||
public static string GetMimeType(string path)
|
public static string GetMimeType(string path)
|
||||||
{
|
{
|
||||||
string ext = Path.GetExtension(path);
|
var ext = Path.GetExtension(path);
|
||||||
|
|
||||||
// http://en.wikipedia.org/wiki/Internet_media_type
|
// http://en.wikipedia.org/wiki/Internet_media_type
|
||||||
// Add more as needed
|
// Add more as needed
|
||||||
|
@ -19,137 +19,137 @@ namespace MediaBrowser.Common.Net
|
||||||
{
|
{
|
||||||
return "video/mpeg";
|
return "video/mpeg";
|
||||||
}
|
}
|
||||||
else if (ext.EndsWith("mp4", StringComparison.OrdinalIgnoreCase))
|
if (ext.EndsWith("mp4", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return "video/mp4";
|
return "video/mp4";
|
||||||
}
|
}
|
||||||
else if (ext.EndsWith("ogv", StringComparison.OrdinalIgnoreCase))
|
if (ext.EndsWith("ogv", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return "video/ogg";
|
return "video/ogg";
|
||||||
}
|
}
|
||||||
else if (ext.EndsWith("mov", StringComparison.OrdinalIgnoreCase))
|
if (ext.EndsWith("mov", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return "video/quicktime";
|
return "video/quicktime";
|
||||||
}
|
}
|
||||||
else if (ext.EndsWith("webm", StringComparison.OrdinalIgnoreCase))
|
if (ext.EndsWith("webm", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return "video/webm";
|
return "video/webm";
|
||||||
}
|
}
|
||||||
else if (ext.EndsWith("mkv", StringComparison.OrdinalIgnoreCase))
|
if (ext.EndsWith("mkv", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return "video/x-matroska";
|
return "video/x-matroska";
|
||||||
}
|
}
|
||||||
else if (ext.EndsWith("wmv", StringComparison.OrdinalIgnoreCase))
|
if (ext.EndsWith("wmv", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return "video/x-ms-wmv";
|
return "video/x-ms-wmv";
|
||||||
}
|
}
|
||||||
else if (ext.EndsWith("flv", StringComparison.OrdinalIgnoreCase))
|
if (ext.EndsWith("flv", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return "video/x-flv";
|
return "video/x-flv";
|
||||||
}
|
}
|
||||||
else if (ext.EndsWith("avi", StringComparison.OrdinalIgnoreCase))
|
if (ext.EndsWith("avi", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return "video/avi";
|
return "video/avi";
|
||||||
}
|
}
|
||||||
else if (ext.EndsWith("m4v", StringComparison.OrdinalIgnoreCase))
|
if (ext.EndsWith("m4v", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return "video/x-m4v";
|
return "video/x-m4v";
|
||||||
}
|
}
|
||||||
else if (ext.EndsWith("asf", StringComparison.OrdinalIgnoreCase))
|
if (ext.EndsWith("asf", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return "video/x-ms-asf";
|
return "video/x-ms-asf";
|
||||||
}
|
}
|
||||||
else if (ext.EndsWith("3gp", StringComparison.OrdinalIgnoreCase))
|
if (ext.EndsWith("3gp", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return "video/3gpp";
|
return "video/3gpp";
|
||||||
}
|
}
|
||||||
else if (ext.EndsWith("3g2", StringComparison.OrdinalIgnoreCase))
|
if (ext.EndsWith("3g2", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return "video/3gpp2";
|
return "video/3gpp2";
|
||||||
}
|
}
|
||||||
else if (ext.EndsWith("ts", StringComparison.OrdinalIgnoreCase))
|
if (ext.EndsWith("ts", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return "video/mp2t";
|
return "video/mp2t";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Type text
|
// Type text
|
||||||
else if (ext.EndsWith("css", StringComparison.OrdinalIgnoreCase))
|
if (ext.EndsWith("css", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return "text/css";
|
return "text/css";
|
||||||
}
|
}
|
||||||
else if (ext.EndsWith("csv", StringComparison.OrdinalIgnoreCase))
|
if (ext.EndsWith("csv", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return "text/csv";
|
return "text/csv";
|
||||||
}
|
}
|
||||||
else if (ext.EndsWith("html", StringComparison.OrdinalIgnoreCase) || ext.EndsWith("html", StringComparison.OrdinalIgnoreCase))
|
if (ext.EndsWith("html", StringComparison.OrdinalIgnoreCase) || ext.EndsWith("html", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return "text/html";
|
return "text/html";
|
||||||
}
|
}
|
||||||
else if (ext.EndsWith("txt", StringComparison.OrdinalIgnoreCase))
|
if (ext.EndsWith("txt", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return "text/plain";
|
return "text/plain";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Type image
|
// Type image
|
||||||
else if (ext.EndsWith("gif", StringComparison.OrdinalIgnoreCase))
|
if (ext.EndsWith("gif", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return "image/gif";
|
return "image/gif";
|
||||||
}
|
}
|
||||||
else if (ext.EndsWith("jpg", StringComparison.OrdinalIgnoreCase) || ext.EndsWith("jpeg", StringComparison.OrdinalIgnoreCase))
|
if (ext.EndsWith("jpg", StringComparison.OrdinalIgnoreCase) || ext.EndsWith("jpeg", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return "image/jpeg";
|
return "image/jpeg";
|
||||||
}
|
}
|
||||||
else if (ext.EndsWith("png", StringComparison.OrdinalIgnoreCase))
|
if (ext.EndsWith("png", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return "image/png";
|
return "image/png";
|
||||||
}
|
}
|
||||||
else if (ext.EndsWith("ico", StringComparison.OrdinalIgnoreCase))
|
if (ext.EndsWith("ico", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return "image/vnd.microsoft.icon";
|
return "image/vnd.microsoft.icon";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Type audio
|
// Type audio
|
||||||
else if (ext.EndsWith("mp3", StringComparison.OrdinalIgnoreCase))
|
if (ext.EndsWith("mp3", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return "audio/mpeg";
|
return "audio/mpeg";
|
||||||
}
|
}
|
||||||
else if (ext.EndsWith("m4a", StringComparison.OrdinalIgnoreCase) || ext.EndsWith("aac", StringComparison.OrdinalIgnoreCase))
|
if (ext.EndsWith("m4a", StringComparison.OrdinalIgnoreCase) || ext.EndsWith("aac", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return "audio/mp4";
|
return "audio/mp4";
|
||||||
}
|
}
|
||||||
else if (ext.EndsWith("webma", StringComparison.OrdinalIgnoreCase))
|
if (ext.EndsWith("webma", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return "audio/webm";
|
return "audio/webm";
|
||||||
}
|
}
|
||||||
else if (ext.EndsWith("wav", StringComparison.OrdinalIgnoreCase))
|
if (ext.EndsWith("wav", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return "audio/wav";
|
return "audio/wav";
|
||||||
}
|
}
|
||||||
else if (ext.EndsWith("wma", StringComparison.OrdinalIgnoreCase))
|
if (ext.EndsWith("wma", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return "audio/x-ms-wma";
|
return "audio/x-ms-wma";
|
||||||
}
|
}
|
||||||
else if (ext.EndsWith("flac", StringComparison.OrdinalIgnoreCase))
|
if (ext.EndsWith("flac", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return "audio/flac";
|
return "audio/flac";
|
||||||
}
|
}
|
||||||
else if (ext.EndsWith("aac", StringComparison.OrdinalIgnoreCase))
|
if (ext.EndsWith("aac", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return "audio/x-aac";
|
return "audio/x-aac";
|
||||||
}
|
}
|
||||||
else if (ext.EndsWith("ogg", StringComparison.OrdinalIgnoreCase) || ext.EndsWith("oga", StringComparison.OrdinalIgnoreCase))
|
if (ext.EndsWith("ogg", StringComparison.OrdinalIgnoreCase) || ext.EndsWith("oga", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return "audio/ogg";
|
return "audio/ogg";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Playlists
|
// Playlists
|
||||||
else if (ext.EndsWith("m3u8", StringComparison.OrdinalIgnoreCase))
|
if (ext.EndsWith("m3u8", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return "application/x-mpegURL";
|
return "application/x-mpegURL";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Misc
|
// Misc
|
||||||
else if (ext.EndsWith("dll", StringComparison.OrdinalIgnoreCase))
|
if (ext.EndsWith("dll", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return "application/x-msdownload";
|
return "application/x-msdownload";
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,7 @@ namespace MediaBrowser.Common.Plugins
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private DateTime? _ConfigurationDateLastModified = null;
|
private DateTime? _ConfigurationDateLastModified;
|
||||||
public DateTime ConfigurationDateLastModified
|
public DateTime ConfigurationDateLastModified
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -123,7 +123,7 @@ namespace MediaBrowser.Common.Plugins
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private string _DataFolderPath = null;
|
private string _DataFolderPath;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the full path to the data folder, where the plugin can store any miscellaneous files needed
|
/// Gets the full path to the data folder, where the plugin can store any miscellaneous files needed
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
// General Information about an assembly is controlled through the following
|
||||||
|
|
|
@ -12,7 +12,7 @@ namespace MediaBrowser.Common.Serialization
|
||||||
{
|
{
|
||||||
Configure();
|
Configure();
|
||||||
|
|
||||||
ServiceStack.Text.JsonSerializer.SerializeToStream<T>(obj, stream);
|
ServiceStack.Text.JsonSerializer.SerializeToStream(obj, stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SerializeToFile<T>(T obj, string file)
|
public static void SerializeToFile<T>(T obj, string file)
|
||||||
|
@ -21,7 +21,7 @@ namespace MediaBrowser.Common.Serialization
|
||||||
|
|
||||||
using (Stream stream = File.Open(file, FileMode.Create))
|
using (Stream stream = File.Open(file, FileMode.Create))
|
||||||
{
|
{
|
||||||
ServiceStack.Text.JsonSerializer.SerializeToStream<T>(obj, stream);
|
ServiceStack.Text.JsonSerializer.SerializeToStream(obj, stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ namespace MediaBrowser.Common.Serialization
|
||||||
return ServiceStack.Text.JsonSerializer.DeserializeFromStream(type, stream);
|
return ServiceStack.Text.JsonSerializer.DeserializeFromStream(type, stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool IsConfigured = false;
|
private static bool IsConfigured;
|
||||||
private static void Configure()
|
private static void Configure()
|
||||||
{
|
{
|
||||||
if (!IsConfigured)
|
if (!IsConfigured)
|
||||||
|
|
|
@ -12,7 +12,7 @@ namespace MediaBrowser.Common.Serialization
|
||||||
{
|
{
|
||||||
public static void SerializeToStream<T>(T obj, Stream stream)
|
public static void SerializeToStream<T>(T obj, Stream stream)
|
||||||
{
|
{
|
||||||
ServiceStack.Text.TypeSerializer.SerializeToStream<T>(obj, stream);
|
ServiceStack.Text.TypeSerializer.SerializeToStream(obj, stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static T DeserializeFromStream<T>(Stream stream)
|
public static T DeserializeFromStream<T>(Stream stream)
|
||||||
|
@ -29,7 +29,7 @@ namespace MediaBrowser.Common.Serialization
|
||||||
{
|
{
|
||||||
using (Stream stream = File.Open(file, FileMode.Create))
|
using (Stream stream = File.Open(file, FileMode.Create))
|
||||||
{
|
{
|
||||||
SerializeToStream<T>(obj, stream);
|
SerializeToStream(obj, stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ namespace MediaBrowser.Common.Serialization
|
||||||
/// This means that this class can currently only handle types within the Model project.
|
/// This means that this class can currently only handle types within the Model project.
|
||||||
/// If we need to, we can always add a param indicating whether or not the model serializer should be used.
|
/// If we need to, we can always add a param indicating whether or not the model serializer should be used.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static ProtobufModelSerializer ProtobufModelSerializer = new ProtobufModelSerializer();
|
private static readonly ProtobufModelSerializer ProtobufModelSerializer = new ProtobufModelSerializer();
|
||||||
|
|
||||||
public static void SerializeToStream<T>(T obj, Stream stream)
|
public static void SerializeToStream<T>(T obj, Stream stream)
|
||||||
{
|
{
|
||||||
|
@ -37,7 +37,7 @@ namespace MediaBrowser.Common.Serialization
|
||||||
{
|
{
|
||||||
using (Stream stream = File.Open(file, FileMode.Create))
|
using (Stream stream = File.Open(file, FileMode.Create))
|
||||||
{
|
{
|
||||||
SerializeToStream<T>(obj, stream);
|
SerializeToStream(obj, stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace MediaBrowser.Common.Serialization
|
||||||
{
|
{
|
||||||
using (FileStream stream = new FileStream(file, FileMode.Create))
|
using (FileStream stream = new FileStream(file, FileMode.Create))
|
||||||
{
|
{
|
||||||
SerializeToStream<T>(obj, stream);
|
SerializeToStream(obj, stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ namespace MediaBrowser.Common.UI
|
||||||
protected override void OnStartup(StartupEventArgs e)
|
protected override void OnStartup(StartupEventArgs e)
|
||||||
{
|
{
|
||||||
// Without this the app will shutdown after the splash screen closes
|
// Without this the app will shutdown after the splash screen closes
|
||||||
this.ShutdownMode = ShutdownMode.OnExplicitShutdown;
|
ShutdownMode = ShutdownMode.OnExplicitShutdown;
|
||||||
|
|
||||||
LoadKernel();
|
LoadKernel();
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ namespace MediaBrowser.Common.UI
|
||||||
Logger.LogInfo("Kernel.Init completed in {0} seconds.", (DateTime.UtcNow - now).TotalSeconds);
|
Logger.LogInfo("Kernel.Init completed in {0} seconds.", (DateTime.UtcNow - now).TotalSeconds);
|
||||||
splash.Close();
|
splash.Close();
|
||||||
|
|
||||||
this.ShutdownMode = System.Windows.ShutdownMode.OnLastWindowClose;
|
ShutdownMode = System.Windows.ShutdownMode.OnLastWindowClose;
|
||||||
InstantiateMainWindow().ShowDialog();
|
InstantiateMainWindow().ShowDialog();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|
|
@ -13,18 +13,17 @@ namespace Microsoft.Shell
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
using System.Runtime.Remoting;
|
using System.Runtime.Remoting;
|
||||||
using System.Runtime.Remoting.Channels;
|
using System.Runtime.Remoting.Channels;
|
||||||
using System.Runtime.Remoting.Channels.Ipc;
|
using System.Runtime.Remoting.Channels.Ipc;
|
||||||
using System.Runtime.Serialization.Formatters;
|
using System.Runtime.Serialization.Formatters;
|
||||||
|
using System.Security;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Threading;
|
using System.Windows.Threading;
|
||||||
using System.Xml.Serialization;
|
|
||||||
using System.Security;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.ComponentModel;
|
|
||||||
|
|
||||||
internal enum WM
|
internal enum WM
|
||||||
{
|
{
|
||||||
|
@ -184,7 +183,7 @@ namespace Microsoft.Shell
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|
||||||
IntPtr p = _LocalFree(argv);
|
_LocalFree(argv);
|
||||||
// Otherwise LocalFree failed.
|
// Otherwise LocalFree failed.
|
||||||
// Assert.AreEqual(IntPtr.Zero, p);
|
// Assert.AreEqual(IntPtr.Zero, p);
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,8 +27,8 @@ namespace MediaBrowser.Common.UI
|
||||||
Logger.LogInfo(e.Description);
|
Logger.LogInfo(e.Description);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.lblProgress.Content = e.Description;
|
lblProgress.Content = e.Description;
|
||||||
this.pbProgress.Value = (double)e.PercentComplete;
|
pbProgress.Value = (double)e.PercentComplete;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Splash_Loaded(object sender, RoutedEventArgs e)
|
private void Splash_Loaded(object sender, RoutedEventArgs e)
|
||||||
|
|
|
@ -61,7 +61,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ItemSpecialCounts GetSpecialCounts(User user)
|
public ItemSpecialCounts GetSpecialCounts(User user)
|
||||||
{
|
{
|
||||||
ItemSpecialCounts counts = new ItemSpecialCounts();
|
var counts = new ItemSpecialCounts();
|
||||||
|
|
||||||
IEnumerable<BaseItem> recursiveChildren = GetParentalAllowedRecursiveChildren(user);
|
IEnumerable<BaseItem> recursiveChildren = GetParentalAllowedRecursiveChildren(user);
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
{
|
{
|
||||||
public class UserItemData
|
public class UserItemData
|
||||||
{
|
{
|
||||||
private float? _Rating = null;
|
private float? _Rating;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the users 0-10 rating
|
/// Gets or sets the users 0-10 rating
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -61,7 +61,7 @@ namespace MediaBrowser.Controller.FFMpeg
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ProtobufSerializer.SerializeToFile<FFProbeResult>(result, outputCachePath);
|
ProtobufSerializer.SerializeToFile(result, outputCachePath);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,8 +10,8 @@ namespace MediaBrowser.Controller.IO
|
||||||
{
|
{
|
||||||
public class DirectoryWatchers
|
public class DirectoryWatchers
|
||||||
{
|
{
|
||||||
private List<FileSystemWatcher> FileSystemWatchers = new List<FileSystemWatcher>();
|
private readonly List<FileSystemWatcher> FileSystemWatchers = new List<FileSystemWatcher>();
|
||||||
private Timer updateTimer = null;
|
private Timer updateTimer;
|
||||||
private List<string> affectedPaths = new List<string>();
|
private List<string> affectedPaths = new List<string>();
|
||||||
|
|
||||||
private const int TimerDelayInSeconds = 5;
|
private const int TimerDelayInSeconds = 5;
|
||||||
|
@ -107,10 +107,8 @@ namespace MediaBrowser.Controller.IO
|
||||||
{
|
{
|
||||||
return Kernel.Instance.ReloadRoot();
|
return Kernel.Instance.ReloadRoot();
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
return Task.WhenAll(itemsToRefresh.Select(i => Kernel.Instance.ReloadItem(i)));
|
||||||
return Task.WhenAll(itemsToRefresh.Select(i => Kernel.Instance.ReloadItem(i)));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private BaseItem GetAffectedBaseItem(string path)
|
private BaseItem GetAffectedBaseItem(string path)
|
||||||
|
|
|
@ -149,7 +149,7 @@ namespace MediaBrowser.Controller.IO
|
||||||
private static extern bool FindClose(IntPtr hFindFile);
|
private static extern bool FindClose(IntPtr hFindFile);
|
||||||
|
|
||||||
private const char SpaceChar = ' ';
|
private const char SpaceChar = ' ';
|
||||||
private static char[] InvalidFileNameChars = Path.GetInvalidFileNameChars();
|
private static readonly char[] InvalidFileNameChars = Path.GetInvalidFileNameChars();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Takes a filename and removes invalid characters
|
/// Takes a filename and removes invalid characters
|
||||||
|
|
|
@ -93,13 +93,13 @@ namespace MediaBrowser.Controller
|
||||||
|
|
||||||
await base.Init(progress).ConfigureAwait(false);
|
await base.Init(progress).ConfigureAwait(false);
|
||||||
|
|
||||||
progress.Report(new TaskProgress() { Description = "Loading Users", PercentComplete = 15 });
|
progress.Report(new TaskProgress { Description = "Loading Users", PercentComplete = 15 });
|
||||||
ReloadUsers();
|
ReloadUsers();
|
||||||
|
|
||||||
progress.Report(new TaskProgress() { Description = "Loading Media Library", PercentComplete = 25 });
|
progress.Report(new TaskProgress { Description = "Loading Media Library", PercentComplete = 25 });
|
||||||
await ReloadRoot(allowInternetProviders: false).ConfigureAwait(false);
|
await ReloadRoot(allowInternetProviders: false).ConfigureAwait(false);
|
||||||
|
|
||||||
progress.Report(new TaskProgress() { Description = "Loading Complete", PercentComplete = 100 });
|
progress.Report(new TaskProgress { Description = "Loading Complete", PercentComplete = 100 });
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnComposablePartsLoaded()
|
protected override void OnComposablePartsLoaded()
|
||||||
|
|
|
@ -68,7 +68,7 @@ namespace MediaBrowser.Controller.Library
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public async Task<BaseItem> GetItem(string path, Folder parent = null, WIN32_FIND_DATA? fileInfo = null, bool allowInternetProviders = true)
|
public async Task<BaseItem> GetItem(string path, Folder parent = null, WIN32_FIND_DATA? fileInfo = null, bool allowInternetProviders = true)
|
||||||
{
|
{
|
||||||
ItemResolveEventArgs args = new ItemResolveEventArgs()
|
var args = new ItemResolveEventArgs
|
||||||
{
|
{
|
||||||
FileInfo = fileInfo ?? FileData.GetFileData(path),
|
FileInfo = fileInfo ?? FileData.GetFileData(path),
|
||||||
Parent = parent,
|
Parent = parent,
|
||||||
|
@ -113,7 +113,7 @@ namespace MediaBrowser.Controller.Library
|
||||||
if (item.IsFolder)
|
if (item.IsFolder)
|
||||||
{
|
{
|
||||||
// If it's a folder look for child entities
|
// If it's a folder look for child entities
|
||||||
(item as Folder).Children = (await Task.WhenAll<BaseItem>(GetChildren(item as Folder, fileSystemChildren, allowInternetProviders)).ConfigureAwait(false))
|
(item as Folder).Children = (await Task.WhenAll(GetChildren(item as Folder, fileSystemChildren, allowInternetProviders)).ConfigureAwait(false))
|
||||||
.Where(i => i != null).OrderBy(f =>
|
.Where(i => i != null).OrderBy(f =>
|
||||||
{
|
{
|
||||||
return string.IsNullOrEmpty(f.SortName) ? f.Name : f.SortName;
|
return string.IsNullOrEmpty(f.SortName) ? f.Name : f.SortName;
|
||||||
|
@ -193,10 +193,8 @@ namespace MediaBrowser.Controller.Library
|
||||||
resolvedShortcuts.InsertRange(0, returnArray);
|
resolvedShortcuts.InsertRange(0, returnArray);
|
||||||
return resolvedShortcuts.ToArray();
|
return resolvedShortcuts.ToArray();
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
return returnArray;
|
||||||
return returnArray;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -231,7 +229,7 @@ namespace MediaBrowser.Controller.Library
|
||||||
return GetImagesByNameItem<Year>(Kernel.Instance.ApplicationPaths.YearPath, value.ToString());
|
return GetImagesByNameItem<Year>(Kernel.Instance.ApplicationPaths.YearPath, value.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
private ConcurrentDictionary<string, object> ImagesByNameItemCache = new ConcurrentDictionary<string, object>(StringComparer.OrdinalIgnoreCase);
|
private readonly ConcurrentDictionary<string, object> ImagesByNameItemCache = new ConcurrentDictionary<string, object>(StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Generically retrieves an IBN item
|
/// Generically retrieves an IBN item
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
// General Information about an assembly is controlled through the following
|
||||||
|
|
|
@ -26,9 +26,6 @@ namespace MediaBrowser.Controller.Providers
|
||||||
{
|
{
|
||||||
MediaStream stream = data.streams.First(s => s.codec_type.Equals("audio", StringComparison.OrdinalIgnoreCase));
|
MediaStream stream = data.streams.First(s => s.codec_type.Equals("audio", StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
||||||
string bitrate = null;
|
|
||||||
string duration = null;
|
|
||||||
|
|
||||||
audio.Channels = stream.channels;
|
audio.Channels = stream.channels;
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(stream.sample_rate))
|
if (!string.IsNullOrEmpty(stream.sample_rate))
|
||||||
|
@ -36,8 +33,8 @@ namespace MediaBrowser.Controller.Providers
|
||||||
audio.SampleRate = int.Parse(stream.sample_rate);
|
audio.SampleRate = int.Parse(stream.sample_rate);
|
||||||
}
|
}
|
||||||
|
|
||||||
bitrate = stream.bit_rate;
|
string bitrate = stream.bit_rate;
|
||||||
duration = stream.duration;
|
string duration = stream.duration;
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(bitrate))
|
if (string.IsNullOrEmpty(bitrate))
|
||||||
{
|
{
|
||||||
|
@ -78,7 +75,7 @@ namespace MediaBrowser.Controller.Providers
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(composer))
|
if (!string.IsNullOrEmpty(composer))
|
||||||
{
|
{
|
||||||
audio.AddPerson(new PersonInfo() { Name = composer, Type = "Composer" });
|
audio.AddPerson(new PersonInfo { Name = composer, Type = "Composer" });
|
||||||
}
|
}
|
||||||
|
|
||||||
audio.Album = GetDictionaryValue(tags, "album");
|
audio.Album = GetDictionaryValue(tags, "album");
|
||||||
|
|
|
@ -62,7 +62,7 @@ namespace MediaBrowser.Controller.Providers
|
||||||
item.DisplayMediaType = VideoType.BluRay.ToString();
|
item.DisplayMediaType = VideoType.BluRay.ToString();
|
||||||
break;
|
break;
|
||||||
case "dvd":
|
case "dvd":
|
||||||
item.DisplayMediaType = VideoType.DVD.ToString();
|
item.DisplayMediaType = VideoType.Dvd.ToString();
|
||||||
break;
|
break;
|
||||||
case "":
|
case "":
|
||||||
item.DisplayMediaType = null;
|
item.DisplayMediaType = null;
|
||||||
|
@ -163,7 +163,7 @@ namespace MediaBrowser.Controller.Providers
|
||||||
|
|
||||||
case "Director":
|
case "Director":
|
||||||
{
|
{
|
||||||
foreach (PersonInfo p in GetSplitValues(reader.ReadElementContentAsString(), '|').Select(v => new PersonInfo() { Name = v, Type = "Director" }))
|
foreach (PersonInfo p in GetSplitValues(reader.ReadElementContentAsString(), '|').Select(v => new PersonInfo { Name = v, Type = "Director" }))
|
||||||
{
|
{
|
||||||
item.AddPerson(p);
|
item.AddPerson(p);
|
||||||
}
|
}
|
||||||
|
@ -171,7 +171,7 @@ namespace MediaBrowser.Controller.Providers
|
||||||
}
|
}
|
||||||
case "Writer":
|
case "Writer":
|
||||||
{
|
{
|
||||||
foreach (PersonInfo p in GetSplitValues(reader.ReadElementContentAsString(), '|').Select(v => new PersonInfo() { Name = v, Type = "Writer" }))
|
foreach (PersonInfo p in GetSplitValues(reader.ReadElementContentAsString(), '|').Select(v => new PersonInfo { Name = v, Type = "Writer" }))
|
||||||
{
|
{
|
||||||
item.AddPerson(p);
|
item.AddPerson(p);
|
||||||
}
|
}
|
||||||
|
@ -181,7 +181,7 @@ namespace MediaBrowser.Controller.Providers
|
||||||
case "Actors":
|
case "Actors":
|
||||||
case "GuestStars":
|
case "GuestStars":
|
||||||
{
|
{
|
||||||
foreach (PersonInfo p in GetSplitValues(reader.ReadElementContentAsString(), '|').Select(v => new PersonInfo() { Name = v, Type = "Actor" }))
|
foreach (PersonInfo p in GetSplitValues(reader.ReadElementContentAsString(), '|').Select(v => new PersonInfo { Name = v, Type = "Actor" }))
|
||||||
{
|
{
|
||||||
item.AddPerson(p);
|
item.AddPerson(p);
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,10 +34,8 @@ namespace MediaBrowser.Controller.Providers
|
||||||
{
|
{
|
||||||
return Task.Run(() => { PopulateBaseItemImages(baseItem, args); });
|
return Task.Run(() => { PopulateBaseItemImages(baseItem, args); });
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
return Task.Run(() => { PopulateImages(item, args); });
|
||||||
return Task.Run(() => { PopulateImages(item, args); });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Task.FromResult<object>(null);
|
return Task.FromResult<object>(null);
|
||||||
|
|
|
@ -46,7 +46,7 @@ namespace MediaBrowser.Controller.Resolvers.Movies
|
||||||
|
|
||||||
private void SetProviderIdFromPath(Movie item)
|
private void SetProviderIdFromPath(Movie item)
|
||||||
{
|
{
|
||||||
string srch = "[tmdbid=";
|
const string srch = "[tmdbid=";
|
||||||
int index = item.Path.IndexOf(srch, System.StringComparison.OrdinalIgnoreCase);
|
int index = item.Path.IndexOf(srch, System.StringComparison.OrdinalIgnoreCase);
|
||||||
|
|
||||||
if (index != -1)
|
if (index != -1)
|
||||||
|
|
|
@ -48,8 +48,8 @@ namespace MediaBrowser.Controller.Resolvers.TV
|
||||||
|
|
||||||
private void SetProviderIdFromPath(Series item)
|
private void SetProviderIdFromPath(Series item)
|
||||||
{
|
{
|
||||||
string srch = "[tvdbid=";
|
const string srch = "[tvdbid=";
|
||||||
int index = item.Path.IndexOf(srch, System.StringComparison.OrdinalIgnoreCase);
|
int index = item.Path.IndexOf(srch, StringComparison.OrdinalIgnoreCase);
|
||||||
|
|
||||||
if (index != -1)
|
if (index != -1)
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,7 +9,7 @@ namespace MediaBrowser.Controller.Resolvers.TV
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A season folder must contain one of these somewhere in the name
|
/// A season folder must contain one of these somewhere in the name
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static string[] SeasonFolderNames = new string[] {
|
private static readonly string[] SeasonFolderNames = new string[] {
|
||||||
"season",
|
"season",
|
||||||
"sæson",
|
"sæson",
|
||||||
"temporada",
|
"temporada",
|
||||||
|
@ -118,14 +118,12 @@ namespace MediaBrowser.Controller.Resolvers.TV
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
nonSeriesFolders++;
|
|
||||||
|
|
||||||
if (nonSeriesFolders >= 3)
|
nonSeriesFolders++;
|
||||||
{
|
|
||||||
return false;
|
if (nonSeriesFolders >= 3)
|
||||||
}
|
{
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -33,7 +33,7 @@ namespace MediaBrowser.Controller.Resolvers
|
||||||
{
|
{
|
||||||
VideoType type = Path.GetExtension(args.Path).EndsWith("iso", System.StringComparison.OrdinalIgnoreCase) ? VideoType.Iso : VideoType.VideoFile;
|
VideoType type = Path.GetExtension(args.Path).EndsWith("iso", System.StringComparison.OrdinalIgnoreCase) ? VideoType.Iso : VideoType.VideoFile;
|
||||||
|
|
||||||
return new T()
|
return new T
|
||||||
{
|
{
|
||||||
VideoType = type,
|
VideoType = type,
|
||||||
Path = args.Path
|
Path = args.Path
|
||||||
|
@ -77,15 +77,15 @@ namespace MediaBrowser.Controller.Resolvers
|
||||||
{
|
{
|
||||||
if (folder.IndexOf("video_ts", System.StringComparison.OrdinalIgnoreCase) != -1)
|
if (folder.IndexOf("video_ts", System.StringComparison.OrdinalIgnoreCase) != -1)
|
||||||
{
|
{
|
||||||
return new T()
|
return new T
|
||||||
{
|
{
|
||||||
VideoType = VideoType.DVD,
|
VideoType = VideoType.Dvd,
|
||||||
Path = Path.GetDirectoryName(folder)
|
Path = Path.GetDirectoryName(folder)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (folder.IndexOf("bdmv", System.StringComparison.OrdinalIgnoreCase) != -1)
|
if (folder.IndexOf("bdmv", System.StringComparison.OrdinalIgnoreCase) != -1)
|
||||||
{
|
{
|
||||||
return new T()
|
return new T
|
||||||
{
|
{
|
||||||
VideoType = VideoType.BluRay,
|
VideoType = VideoType.BluRay,
|
||||||
Path = Path.GetDirectoryName(folder)
|
Path = Path.GetDirectoryName(folder)
|
||||||
|
|
|
@ -153,7 +153,7 @@ namespace MediaBrowser.Controller
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private string _CacheDirectory = null;
|
private string _CacheDirectory;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the folder path to the cache directory
|
/// Gets the folder path to the cache directory
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -175,7 +175,7 @@ namespace MediaBrowser.Controller
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private string _FFProbeAudioCacheDirectory = null;
|
private string _FFProbeAudioCacheDirectory;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the folder path to the ffprobe audio cache directory
|
/// Gets the folder path to the ffprobe audio cache directory
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -197,7 +197,7 @@ namespace MediaBrowser.Controller
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private string _FFProbeVideoCacheDirectory = null;
|
private string _FFProbeVideoCacheDirectory;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the folder path to the ffprobe video cache directory
|
/// Gets the folder path to the ffprobe video cache directory
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -219,7 +219,7 @@ namespace MediaBrowser.Controller
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private string _FFMpegDirectory = null;
|
private string _FFMpegDirectory;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the folder path to ffmpeg
|
/// Gets the folder path to ffmpeg
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -241,7 +241,7 @@ namespace MediaBrowser.Controller
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private string _FFMpegPath = null;
|
private string _FFMpegPath;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the path to ffmpeg.exe
|
/// Gets the path to ffmpeg.exe
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -258,7 +258,7 @@ namespace MediaBrowser.Controller
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private string _FFProbePath = null;
|
private string _FFProbePath;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the path to ffprobe.exe
|
/// Gets the path to ffprobe.exe
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
using System;
|
using MediaBrowser.Common.Logging;
|
||||||
|
using MediaBrowser.Common.Serialization;
|
||||||
|
using MediaBrowser.Model.Weather;
|
||||||
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Cache;
|
using System.Net.Cache;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using MediaBrowser.Common.Logging;
|
|
||||||
using MediaBrowser.Common.Serialization;
|
|
||||||
using MediaBrowser.Model.Weather;
|
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.Weather
|
namespace MediaBrowser.Controller.Weather
|
||||||
{
|
{
|
||||||
|
@ -36,8 +36,8 @@ namespace MediaBrowser.Controller.Weather
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
int numDays = 5;
|
const int numDays = 5;
|
||||||
string apiKey = "24902f60f1231941120109";
|
const string apiKey = "24902f60f1231941120109";
|
||||||
|
|
||||||
string url = "http://free.worldweatheronline.com/feed/weather.ashx?q=" + zipCode + "&format=json&num_of_days=" + numDays + "&key=" + apiKey;
|
string url = "http://free.worldweatheronline.com/feed/weather.ashx?q=" + zipCode + "&format=json&num_of_days=" + numDays + "&key=" + apiKey;
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ namespace MediaBrowser.Controller.Weather
|
||||||
|
|
||||||
public WeatherStatus ToWeatherStatus()
|
public WeatherStatus ToWeatherStatus()
|
||||||
{
|
{
|
||||||
return new WeatherStatus()
|
return new WeatherStatus
|
||||||
{
|
{
|
||||||
TemperatureCelsius = int.Parse(temp_C),
|
TemperatureCelsius = int.Parse(temp_C),
|
||||||
TemperatureFahrenheit = int.Parse(temp_F),
|
TemperatureFahrenheit = int.Parse(temp_F),
|
||||||
|
@ -122,7 +122,7 @@ namespace MediaBrowser.Controller.Weather
|
||||||
|
|
||||||
public WeatherForecast ToWeatherForecast()
|
public WeatherForecast ToWeatherForecast()
|
||||||
{
|
{
|
||||||
return new WeatherForecast()
|
return new WeatherForecast
|
||||||
{
|
{
|
||||||
Date = DateTime.Parse(date),
|
Date = DateTime.Parse(date),
|
||||||
HighTemperatureCelsius = int.Parse(tempMaxC),
|
HighTemperatureCelsius = int.Parse(tempMaxC),
|
||||||
|
|
|
@ -5,7 +5,7 @@ namespace MediaBrowser.Controller.Xml
|
||||||
{
|
{
|
||||||
public static class XmlExtensions
|
public static class XmlExtensions
|
||||||
{
|
{
|
||||||
private static CultureInfo _usCulture = new CultureInfo("en-US");
|
private static readonly CultureInfo _usCulture = new CultureInfo("en-US");
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reads a float from the current element of an XmlReader
|
/// Reads a float from the current element of an XmlReader
|
||||||
|
|
|
@ -10,7 +10,7 @@ namespace MediaBrowser.Model.DTO
|
||||||
/// This holds information about a BaseItem in a format that is convenient for the client.
|
/// This holds information about a BaseItem in a format that is convenient for the client.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ProtoContract]
|
[ProtoContract]
|
||||||
public class DTOBaseItem : IHasProviderIds
|
public class DtoBaseItem : IHasProviderIds
|
||||||
{
|
{
|
||||||
[ProtoMember(1)]
|
[ProtoMember(1)]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
@ -91,7 +91,7 @@ namespace MediaBrowser.Model.DTO
|
||||||
public int BackdropCount { get; set; }
|
public int BackdropCount { get; set; }
|
||||||
|
|
||||||
[ProtoMember(27)]
|
[ProtoMember(27)]
|
||||||
public DTOBaseItem[] Children { get; set; }
|
public DtoBaseItem[] Children { get; set; }
|
||||||
|
|
||||||
[ProtoMember(28)]
|
[ProtoMember(28)]
|
||||||
public bool IsFolder { get; set; }
|
public bool IsFolder { get; set; }
|
||||||
|
@ -136,7 +136,7 @@ namespace MediaBrowser.Model.DTO
|
||||||
public int? ParentBackdropCount { get; set; }
|
public int? ParentBackdropCount { get; set; }
|
||||||
|
|
||||||
[ProtoMember(38)]
|
[ProtoMember(38)]
|
||||||
public DTOBaseItem[] LocalTrailers { get; set; }
|
public DtoBaseItem[] LocalTrailers { get; set; }
|
||||||
|
|
||||||
[ProtoMember(39)]
|
[ProtoMember(39)]
|
||||||
public int LocalTrailerCount { get; set; }
|
public int LocalTrailerCount { get; set; }
|
||||||
|
@ -145,7 +145,7 @@ namespace MediaBrowser.Model.DTO
|
||||||
/// User data for this item based on the user it's being requested for
|
/// User data for this item based on the user it's being requested for
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ProtoMember(40)]
|
[ProtoMember(40)]
|
||||||
public DTOUserItemData UserData { get; set; }
|
public DtoUserItemData UserData { get; set; }
|
||||||
|
|
||||||
[ProtoMember(41)]
|
[ProtoMember(41)]
|
||||||
public ItemSpecialCounts SpecialCounts { get; set; }
|
public ItemSpecialCounts SpecialCounts { get; set; }
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
using MediaBrowser.Model.Entities;
|
using ProtoBuf;
|
||||||
using ProtoBuf;
|
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace MediaBrowser.Model.DTO
|
namespace MediaBrowser.Model.DTO
|
||||||
{
|
{
|
||||||
[ProtoContract]
|
[ProtoContract]
|
||||||
public class DTOUser
|
public class DtoUser
|
||||||
{
|
{
|
||||||
[ProtoMember(1)]
|
[ProtoMember(1)]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
namespace MediaBrowser.Model.DTO
|
namespace MediaBrowser.Model.DTO
|
||||||
{
|
{
|
||||||
[ProtoContract]
|
[ProtoContract]
|
||||||
public class DTOUserItemData
|
public class DtoUserItemData
|
||||||
{
|
{
|
||||||
[ProtoMember(1)]
|
[ProtoMember(1)]
|
||||||
public float? Rating { get; set; }
|
public float? Rating { get; set; }
|
||||||
|
|
|
@ -9,12 +9,12 @@ namespace MediaBrowser.Model.DTO
|
||||||
{
|
{
|
||||||
Avi,
|
Avi,
|
||||||
Asf,
|
Asf,
|
||||||
M4v,
|
M4V,
|
||||||
Mkv,
|
Mkv,
|
||||||
Mov,
|
Mov,
|
||||||
Mp4,
|
Mp4,
|
||||||
Ogv,
|
Ogv,
|
||||||
ThreeGP,
|
ThreeGp,
|
||||||
Ts,
|
Ts,
|
||||||
Webm,
|
Webm,
|
||||||
Wmv
|
Wmv
|
||||||
|
|
|
@ -10,7 +10,7 @@ namespace MediaBrowser.Model.Entities
|
||||||
Dictionary<string, string> ProviderIds { get; set; }
|
Dictionary<string, string> ProviderIds { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class IProviderIdsExtensions
|
public static class ProviderIdsExtensions
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a provider id
|
/// Gets a provider id
|
||||||
|
|
|
@ -5,7 +5,7 @@ namespace MediaBrowser.Model.Entities
|
||||||
{
|
{
|
||||||
VideoFile,
|
VideoFile,
|
||||||
Iso,
|
Iso,
|
||||||
DVD,
|
Dvd,
|
||||||
BluRay
|
BluRay
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,12 +36,12 @@
|
||||||
<Compile Include="Configuration\ServerConfiguration.cs" />
|
<Compile Include="Configuration\ServerConfiguration.cs" />
|
||||||
<Compile Include="DTO\AudioInfo.cs" />
|
<Compile Include="DTO\AudioInfo.cs" />
|
||||||
<Compile Include="DTO\AudioOutputFormats.cs" />
|
<Compile Include="DTO\AudioOutputFormats.cs" />
|
||||||
<Compile Include="DTO\DTOUserItemData.cs" />
|
<Compile Include="DTO\DtoUserItemData.cs" />
|
||||||
<Compile Include="DTO\MovieInfo.cs" />
|
<Compile Include="DTO\MovieInfo.cs" />
|
||||||
<Compile Include="DTO\SeriesInfo.cs" />
|
<Compile Include="DTO\SeriesInfo.cs" />
|
||||||
<Compile Include="Authentication\AuthenticationResult.cs" />
|
<Compile Include="Authentication\AuthenticationResult.cs" />
|
||||||
<Compile Include="DTO\DTOBaseItem.cs" />
|
<Compile Include="DTO\DtoBaseItem.cs" />
|
||||||
<Compile Include="DTO\DTOUser.cs" />
|
<Compile Include="DTO\DtoUser.cs" />
|
||||||
<Compile Include="DTO\VideoInfo.cs" />
|
<Compile Include="DTO\VideoInfo.cs" />
|
||||||
<Compile Include="DTO\VideoOutputFormats.cs" />
|
<Compile Include="DTO\VideoOutputFormats.cs" />
|
||||||
<Compile Include="DTO\IBNItem.cs" />
|
<Compile Include="DTO\IBNItem.cs" />
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
using System;
|
|
||||||
using System.Runtime.Serialization;
|
|
||||||
|
|
||||||
namespace MediaBrowser.Model.Plugins
|
namespace MediaBrowser.Model.Plugins
|
||||||
{
|
{
|
||||||
public class BasePluginConfiguration
|
public class BasePluginConfiguration
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
using System.Resources;
|
using System.Reflection;
|
||||||
using System.Reflection;
|
using System.Resources;
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
// General Information about an assembly is controlled through the following
|
||||||
// set of attributes. Change these attribute values to modify the information
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Resources;
|
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
// General Information about an assembly is controlled through the following
|
||||||
|
|
Loading…
Reference in New Issue