chromecast updates
This commit is contained in:
parent
c58d4a4b2e
commit
6a2f6782d3
|
@ -466,11 +466,13 @@ namespace MediaBrowser.Api.Library
|
|||
/// Deletes the specified request.
|
||||
/// </summary>
|
||||
/// <param name="request">The request.</param>
|
||||
public Task Delete(DeleteItem request)
|
||||
public void Delete(DeleteItem request)
|
||||
{
|
||||
var item = _libraryManager.GetItemById(request.Id);
|
||||
|
||||
return _libraryManager.DeleteItem(item);
|
||||
var task = _libraryManager.DeleteItem(item);
|
||||
|
||||
Task.WaitAll(task);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -34,6 +34,20 @@ namespace MediaBrowser.Api.Music
|
|||
public string Name { get; set; }
|
||||
}
|
||||
|
||||
[Route("/Artists/InstantMix", "GET", Summary = "Creates an instant playlist based on a given artist")]
|
||||
public class GetInstantMixFromArtistId : BaseGetSimilarItems
|
||||
{
|
||||
[ApiMember(Name = "Id", Description = "The artist Id", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")]
|
||||
public string Id { get; set; }
|
||||
}
|
||||
|
||||
[Route("/MusicGenres/InstantMix", "GET", Summary = "Creates an instant playlist based on a music genre")]
|
||||
public class GetInstantMixFromMusicGenreId : BaseGetSimilarItems
|
||||
{
|
||||
[ApiMember(Name = "Id", Description = "The genre Id", IsRequired = true, DataType = "string", ParameterType = "querypath", Verb = "GET")]
|
||||
public string Id { get; set; }
|
||||
}
|
||||
|
||||
[Authenticated]
|
||||
public class InstantMixService : BaseApiService
|
||||
{
|
||||
|
@ -51,6 +65,28 @@ namespace MediaBrowser.Api.Music
|
|||
_libraryManager = libraryManager;
|
||||
}
|
||||
|
||||
public object Get(GetInstantMixFromArtistId request)
|
||||
{
|
||||
var item = (MusicArtist)_libraryManager.GetItemById(request.Id);
|
||||
|
||||
var user = _userManager.GetUserById(request.UserId.Value);
|
||||
|
||||
var items = _musicManager.GetInstantMixFromArtist(item.Name, user);
|
||||
|
||||
return GetResult(items, user, request);
|
||||
}
|
||||
|
||||
public object Get(GetInstantMixFromMusicGenreId request)
|
||||
{
|
||||
var item = (MusicGenre)_libraryManager.GetItemById(request.Id);
|
||||
|
||||
var user = _userManager.GetUserById(request.UserId.Value);
|
||||
|
||||
var items = _musicManager.GetInstantMixFromGenres(new[] { item.Name }, user);
|
||||
|
||||
return GetResult(items, user, request);
|
||||
}
|
||||
|
||||
public object Get(GetInstantMixFromSong request)
|
||||
{
|
||||
var item = (Audio)_libraryManager.GetItemById(request.Id);
|
||||
|
|
|
@ -87,9 +87,11 @@ namespace MediaBrowser.Api.Sync
|
|||
return ToOptimizedResult(result);
|
||||
}
|
||||
|
||||
public Task Delete(CancelSyncJob request)
|
||||
public void Delete(CancelSyncJob request)
|
||||
{
|
||||
return _syncManager.CancelJob(request.Id);
|
||||
var task = _syncManager.CancelJob(request.Id);
|
||||
|
||||
Task.WaitAll(task);
|
||||
}
|
||||
|
||||
public async Task<object> Post(CreateSyncJob request)
|
||||
|
|
|
@ -221,7 +221,14 @@ namespace MediaBrowser.Api.UserLibrary
|
|||
/// Posts the specified request.
|
||||
/// </summary>
|
||||
/// <param name="request">The request.</param>
|
||||
public async Task<object> Post(MarkPlayedItem request)
|
||||
public object Post(MarkPlayedItem request)
|
||||
{
|
||||
var result = MarkPlayed(request).Result;
|
||||
|
||||
return ToOptimizedResult(result);
|
||||
}
|
||||
|
||||
private async Task<UserItemDataDto> MarkPlayed(MarkPlayedItem request)
|
||||
{
|
||||
var user = _userManager.GetUserById(request.UserId);
|
||||
|
||||
|
@ -243,18 +250,18 @@ namespace MediaBrowser.Api.UserLibrary
|
|||
await UpdatePlayedStatus(additionalUser, request.Id, true, datePlayed).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
return ToOptimizedResult(dto);
|
||||
return dto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Posts the specified request.
|
||||
/// </summary>
|
||||
/// <param name="request">The request.</param>
|
||||
public Task Post(OnPlaybackStart request)
|
||||
public void Post(OnPlaybackStart request)
|
||||
{
|
||||
var queueableMediaTypes = (request.QueueableMediaTypes ?? string.Empty);
|
||||
|
||||
return Post(new ReportPlaybackStart
|
||||
Post(new ReportPlaybackStart
|
||||
{
|
||||
CanSeek = request.CanSeek,
|
||||
ItemId = request.Id,
|
||||
|
@ -265,20 +272,22 @@ namespace MediaBrowser.Api.UserLibrary
|
|||
});
|
||||
}
|
||||
|
||||
public Task Post(ReportPlaybackStart request)
|
||||
public void Post(ReportPlaybackStart request)
|
||||
{
|
||||
request.SessionId = GetSession().Id;
|
||||
|
||||
return _sessionManager.OnPlaybackStart(request);
|
||||
var task = _sessionManager.OnPlaybackStart(request);
|
||||
|
||||
Task.WaitAll(task);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Posts the specified request.
|
||||
/// </summary>
|
||||
/// <param name="request">The request.</param>
|
||||
public Task Post(OnPlaybackProgress request)
|
||||
public void Post(OnPlaybackProgress request)
|
||||
{
|
||||
return Post(new ReportPlaybackProgress
|
||||
Post(new ReportPlaybackProgress
|
||||
{
|
||||
ItemId = request.Id,
|
||||
PositionTicks = request.PositionTicks,
|
||||
|
@ -291,20 +300,22 @@ namespace MediaBrowser.Api.UserLibrary
|
|||
});
|
||||
}
|
||||
|
||||
public Task Post(ReportPlaybackProgress request)
|
||||
public void Post(ReportPlaybackProgress request)
|
||||
{
|
||||
request.SessionId = GetSession().Id;
|
||||
|
||||
return _sessionManager.OnPlaybackProgress(request);
|
||||
var task = _sessionManager.OnPlaybackProgress(request);
|
||||
|
||||
Task.WaitAll(task);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Posts the specified request.
|
||||
/// </summary>
|
||||
/// <param name="request">The request.</param>
|
||||
public Task Delete(OnPlaybackStopped request)
|
||||
public void Delete(OnPlaybackStopped request)
|
||||
{
|
||||
return Post(new ReportPlaybackStopped
|
||||
Post(new ReportPlaybackStopped
|
||||
{
|
||||
ItemId = request.Id,
|
||||
PositionTicks = request.PositionTicks,
|
||||
|
@ -312,11 +323,13 @@ namespace MediaBrowser.Api.UserLibrary
|
|||
});
|
||||
}
|
||||
|
||||
public Task Post(ReportPlaybackStopped request)
|
||||
public void Post(ReportPlaybackStopped request)
|
||||
{
|
||||
request.SessionId = GetSession().Id;
|
||||
|
||||
return _sessionManager.OnPlaybackStopped(request);
|
||||
var task = _sessionManager.OnPlaybackStopped(request);
|
||||
|
||||
Task.WaitAll(task);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -372,4 +385,4 @@ namespace MediaBrowser.Api.UserLibrary
|
|||
return _userDataRepository.GetUserDataDto(item, user);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -242,7 +242,7 @@ namespace MediaBrowser.Api
|
|||
{
|
||||
users = users.Where(i => i.Configuration.IsHidden == request.IsHidden.Value);
|
||||
}
|
||||
|
||||
|
||||
var result = users
|
||||
.OrderBy(u => u.Name)
|
||||
.Select(i => _userManager.GetUserDto(i, Request.RemoteIp))
|
||||
|
@ -274,7 +274,14 @@ namespace MediaBrowser.Api
|
|||
/// Deletes the specified request.
|
||||
/// </summary>
|
||||
/// <param name="request">The request.</param>
|
||||
public async Task Delete(DeleteUser request)
|
||||
public void Delete(DeleteUser request)
|
||||
{
|
||||
var task = DeleteAsync(request);
|
||||
|
||||
Task.WaitAll(task);
|
||||
}
|
||||
|
||||
public async Task DeleteAsync(DeleteUser request)
|
||||
{
|
||||
var user = _userManager.GetUserById(request.Id);
|
||||
|
||||
|
@ -347,7 +354,13 @@ namespace MediaBrowser.Api
|
|||
/// Posts the specified request.
|
||||
/// </summary>
|
||||
/// <param name="request">The request.</param>
|
||||
public async Task Post(UpdateUserPassword request)
|
||||
public void Post(UpdateUserPassword request)
|
||||
{
|
||||
var task = PostAsync(request);
|
||||
Task.WaitAll(task);
|
||||
}
|
||||
|
||||
public async Task PostAsync(UpdateUserPassword request)
|
||||
{
|
||||
var user = _userManager.GetUserById(request.Id);
|
||||
|
||||
|
@ -372,12 +385,19 @@ namespace MediaBrowser.Api
|
|||
await _userManager.ChangePassword(user, request.NewPassword).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Posts the specified request.
|
||||
/// </summary>
|
||||
/// <param name="request">The request.</param>
|
||||
public async Task Post(UpdateUser request)
|
||||
public void Post(UpdateUser request)
|
||||
{
|
||||
var task = PostAsync(request);
|
||||
|
||||
Task.WaitAll(task);
|
||||
}
|
||||
|
||||
public async Task PostAsync(UpdateUser request)
|
||||
{
|
||||
// We need to parse this manually because we told service stack not to with IRequiresRequestStream
|
||||
// https://code.google.com/p/servicestack/source/browse/trunk/Common/ServiceStack.Text/ServiceStack.Text/Controller/PathInfo.cs
|
||||
|
|
|
@ -97,7 +97,14 @@ namespace MediaBrowser.Api
|
|||
return ToOptimizedSerializedResultUsingCache(result);
|
||||
}
|
||||
|
||||
public async Task Delete(DeleteAlternateSources request)
|
||||
public void Delete(DeleteAlternateSources request)
|
||||
{
|
||||
var task = DeleteAsync(request);
|
||||
|
||||
Task.WaitAll(task);
|
||||
}
|
||||
|
||||
public async Task DeleteAsync(DeleteAlternateSources request)
|
||||
{
|
||||
var video = (Video)_libraryManager.GetItemById(request.Id);
|
||||
|
||||
|
@ -112,7 +119,14 @@ namespace MediaBrowser.Api
|
|||
await video.UpdateToRepository(ItemUpdateType.MetadataDownload, CancellationToken.None).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
public async Task Post(MergeVersions request)
|
||||
public void Post(MergeVersions request)
|
||||
{
|
||||
var task = PostAsync(request);
|
||||
|
||||
Task.WaitAll(task);
|
||||
}
|
||||
|
||||
public async Task PostAsync(MergeVersions request)
|
||||
{
|
||||
var items = request.Ids.Split(',')
|
||||
.Select(i => new Guid(i))
|
||||
|
|
|
@ -83,7 +83,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
|
|||
container.Adapter = _containerAdapter;
|
||||
|
||||
Plugins.Add(new SwaggerFeature());
|
||||
Plugins.Add(new CorsFeature(allowedHeaders: "Content-Type, Authorization, X-MediaBrowser-Token"));
|
||||
Plugins.Add(new CorsFeature(allowedHeaders: "Content-Type, Authorization, Range, X-MediaBrowser-Token"));
|
||||
|
||||
//Plugins.Add(new AuthFeature(() => new AuthUserSession(), new IAuthProvider[] {
|
||||
// new SessionAuthProvider(_containerAdapter.Resolve<ISessionContext>()),
|
||||
|
|
Loading…
Reference in New Issue
Block a user