mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-14 10:36:54 -07:00
added the api to get libs
This commit is contained in:
parent
b3a2fbdb0d
commit
4505488289
4 changed files with 32 additions and 3 deletions
|
@ -6,5 +6,6 @@ namespace Ombi.Api.Jellyfin
|
|||
public interface IJellyfinApi : IBaseJellyfinApi
|
||||
{
|
||||
Task<JellyfinConnectUser> LoginConnectUser(string username, string password);
|
||||
Task<JellyfinItemContainer<MediaFolders>> GetLibraries(string apiKey, string baseUrl);
|
||||
}
|
||||
}
|
|
@ -1,12 +1,12 @@
|
|||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.EntityFrameworkCore.Internal;
|
||||
using Newtonsoft.Json;
|
||||
using Ombi.Api.Jellyfin.Models;
|
||||
using Ombi.Api.Jellyfin.Models.Media.Tv;
|
||||
using Ombi.Api.Jellyfin.Models.Movie;
|
||||
using Ombi.Helpers;
|
||||
|
||||
namespace Ombi.Api.Jellyfin
|
||||
{
|
||||
|
@ -87,6 +87,16 @@ namespace Ombi.Api.Jellyfin
|
|||
return await Api.Request<JellyfinItemContainer<JellyfinMovie>>(request);
|
||||
}
|
||||
|
||||
public async Task<JellyfinItemContainer<MediaFolders>> GetLibraries(string apiKey, string baseUrl)
|
||||
{
|
||||
var request = new Request("library/mediafolders", baseUrl, HttpMethod.Get);
|
||||
AddHeaders(request, apiKey);
|
||||
|
||||
var response = await Api.Request<JellyfinItemContainer<MediaFolders>>(request);
|
||||
response.Items = response.Items.Where(x => !x.CollectionType.Equals("playlists", StringComparison.InvariantCultureIgnoreCase)).ToList();
|
||||
return response;
|
||||
}
|
||||
|
||||
public async Task<JellyfinItemContainer<JellyfinMovie>> GetAllMovies(string apiKey, int startIndex, int count, string userId, string baseUri)
|
||||
{
|
||||
return await GetAll<JellyfinMovie>("Movie", apiKey, userId, baseUri, true, startIndex, count);
|
||||
|
|
10
src/Ombi.Api.Jellyfin/Models/MediaFolders.cs
Normal file
10
src/Ombi.Api.Jellyfin/Models/MediaFolders.cs
Normal file
|
@ -0,0 +1,10 @@
|
|||
namespace Ombi.Api.Jellyfin.Models
|
||||
{
|
||||
public class MediaFolders
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string ServerId { get; set; }
|
||||
public string Id { get; set; }
|
||||
public string CollectionType { get; set; }
|
||||
}
|
||||
}
|
|
@ -66,6 +66,14 @@ namespace Ombi.Controllers.V1.External
|
|||
return result;
|
||||
}
|
||||
|
||||
[HttpPost("Library")]
|
||||
public async Task<JellyfinItemContainer<MediaFolders>> GetLibaries([FromBody] JellyfinServers server)
|
||||
{
|
||||
var client = await JellyfinApi.CreateClient();
|
||||
var result = await client.GetLibraries(server.ApiKey, server.FullUri);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the jellyfin users.
|
||||
/// </summary>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue