mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
added ability to mark IBN items as favorites
This commit is contained in:
parent
25d2a57aca
commit
5231cab777
@ -1,4 +1,5 @@
|
|||||||
using MediaBrowser.Controller.Persistence;
|
using MediaBrowser.Controller.Dto;
|
||||||
|
using MediaBrowser.Controller.Persistence;
|
||||||
using ServiceStack.ServiceHost;
|
using ServiceStack.ServiceHost;
|
||||||
using System;
|
using System;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
@ -146,7 +147,7 @@ namespace MediaBrowser.Api.UserLibrary
|
|||||||
// Get the user data for this item
|
// Get the user data for this item
|
||||||
var data = UserDataRepository.GetUserData(request.UserId, request.Name).Result;
|
var data = UserDataRepository.GetUserData(request.UserId, request.Name).Result;
|
||||||
|
|
||||||
return ToOptimizedResult(data);
|
return ToOptimizedResult(DtoBuilder.GetUserItemDataDto(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -175,7 +176,7 @@ namespace MediaBrowser.Api.UserLibrary
|
|||||||
/// Deletes the specified request.
|
/// Deletes the specified request.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="request">The request.</param>
|
/// <param name="request">The request.</param>
|
||||||
public void Delete(MarkItemByNameFavorite request)
|
public void Delete(UnmarkItemByNameFavorite request)
|
||||||
{
|
{
|
||||||
var task = MarkFavorite(request.UserId, request.Name, false);
|
var task = MarkFavorite(request.UserId, request.Name, false);
|
||||||
|
|
||||||
|
@ -682,7 +682,7 @@ namespace MediaBrowser.Controller.Dto
|
|||||||
/// <param name="data">The data.</param>
|
/// <param name="data">The data.</param>
|
||||||
/// <returns>DtoUserItemData.</returns>
|
/// <returns>DtoUserItemData.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException"></exception>
|
/// <exception cref="System.ArgumentNullException"></exception>
|
||||||
public UserItemDataDto GetUserItemDataDto(UserItemData data)
|
public static UserItemDataDto GetUserItemDataDto(UserItemData data)
|
||||||
{
|
{
|
||||||
if (data == null)
|
if (data == null)
|
||||||
{
|
{
|
||||||
|
@ -1724,12 +1724,12 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates a user's favorite status for a person.
|
* Updates a user's favorite status for an item by name.
|
||||||
* @param {String} userId
|
* @param {String} userId
|
||||||
* @param {String} name
|
* @param {String} name
|
||||||
* @param {Boolean} isFavorite
|
* @param {Boolean} isFavorite
|
||||||
*/
|
*/
|
||||||
self.updateFavoritePersonStatus = function (userId, name, isFavorite) {
|
self.updateItemByNameFavoriteStatus = function (userId, name, isFavorite) {
|
||||||
|
|
||||||
if (!userId) {
|
if (!userId) {
|
||||||
throw new Error("null userId");
|
throw new Error("null userId");
|
||||||
@ -1739,7 +1739,7 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
|
|||||||
throw new Error("null name");
|
throw new Error("null name");
|
||||||
}
|
}
|
||||||
|
|
||||||
var url = self.getUrl("Users/" + userId + "/FavoritePersons/" + name);
|
var url = self.getUrl("Users/" + userId + "/ItemsByName/Favorites/" + name);
|
||||||
|
|
||||||
var method = isFavorite ? "POST" : "DELETE";
|
var method = isFavorite ? "POST" : "DELETE";
|
||||||
|
|
||||||
@ -1751,12 +1751,12 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates a user's favorite status for a genre.
|
* Updates a user's rating for an item by name.
|
||||||
* @param {String} userId
|
* @param {String} userId
|
||||||
* @param {String} name
|
* @param {String} name
|
||||||
* @param {Boolean} isFavorite
|
* @param {Boolean} likes
|
||||||
*/
|
*/
|
||||||
self.updateFavoriteGenreStatus = function (userId, name, isFavorite) {
|
self.updateItemByNameRating = function (userId, name, likes) {
|
||||||
|
|
||||||
if (!userId) {
|
if (!userId) {
|
||||||
throw new Error("null userId");
|
throw new Error("null userId");
|
||||||
@ -1766,24 +1766,46 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
|
|||||||
throw new Error("null name");
|
throw new Error("null name");
|
||||||
}
|
}
|
||||||
|
|
||||||
var url = self.getUrl("Users/" + userId + "/FavoriteGenre/" + name);
|
var url = self.getUrl("Users/" + userId + "/ItemsByName/" + name + "/Rating", {
|
||||||
|
likes: likes
|
||||||
var method = isFavorite ? "POST" : "DELETE";
|
});
|
||||||
|
|
||||||
return self.ajax({
|
return self.ajax({
|
||||||
type: method,
|
type: "POST",
|
||||||
|
url: url
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clears a user's rating for an item by name.
|
||||||
|
* @param {String} userId
|
||||||
|
* @param {String} name
|
||||||
|
*/
|
||||||
|
self.clearItemByNameRating = function (userId, name) {
|
||||||
|
|
||||||
|
if (!userId) {
|
||||||
|
throw new Error("null userId");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!name) {
|
||||||
|
throw new Error("null name");
|
||||||
|
}
|
||||||
|
|
||||||
|
var url = self.getUrl("Users/" + userId + "/ItemsByName/" + name + "/Rating");
|
||||||
|
|
||||||
|
return self.ajax({
|
||||||
|
type: "DELETE",
|
||||||
url: url,
|
url: url,
|
||||||
dataType: "json"
|
dataType: "json"
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates a user's favorite status for a studio.
|
* Gets the full user data object for an item by name.
|
||||||
* @param {String} userId
|
* @param {String} userId
|
||||||
* @param {String} name
|
* @param {String} name
|
||||||
* @param {Boolean} isFavorite
|
*/
|
||||||
*/
|
self.getItembyNameUserData = function (userId, name) {
|
||||||
self.updateFavoriteStudioStatus = function (userId, name, isFavorite) {
|
|
||||||
|
|
||||||
if (!userId) {
|
if (!userId) {
|
||||||
throw new Error("null userId");
|
throw new Error("null userId");
|
||||||
@ -1793,12 +1815,10 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
|
|||||||
throw new Error("null name");
|
throw new Error("null name");
|
||||||
}
|
}
|
||||||
|
|
||||||
var url = self.getUrl("Users/" + userId + "/FavoriteStudios/" + name);
|
var url = self.getUrl("Users/" + userId + "/ItemsByName/" + name + "/UserData");
|
||||||
|
|
||||||
var method = isFavorite ? "POST" : "DELETE";
|
|
||||||
|
|
||||||
return self.ajax({
|
return self.ajax({
|
||||||
type: method,
|
type: "GET",
|
||||||
url: url,
|
url: url,
|
||||||
dataType: "json"
|
dataType: "json"
|
||||||
});
|
});
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="MediaBrowser.ApiClient.Javascript" version="3.0.74" targetFramework="net45" />
|
<package id="MediaBrowser.ApiClient.Javascript" version="3.0.76" targetFramework="net45" />
|
||||||
<package id="ServiceStack.Common" version="3.9.43" targetFramework="net45" />
|
<package id="ServiceStack.Common" version="3.9.43" targetFramework="net45" />
|
||||||
<package id="ServiceStack.Text" version="3.9.43" targetFramework="net45" />
|
<package id="ServiceStack.Text" version="3.9.43" targetFramework="net45" />
|
||||||
</packages>
|
</packages>
|
Loading…
x
Reference in New Issue
Block a user