Skip to content

Commit

Permalink
Merge pull request #2525 from tidusjar/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
tidusjar committed Sep 21, 2018
2 parents 94a1f3a + 26ce54b commit c0e9227
Show file tree
Hide file tree
Showing 226 changed files with 12,166 additions and 509 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -243,3 +243,6 @@ _Pvt_Extensions
# CAKE - C# Make
/Tools/*
*.db-journal

# Ignore local vscode config
*.vscode
153 changes: 153 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,152 @@
# Changelog

## (unreleased)

### **New Features**

- Added the request limits in the ui for music. [Jamie]

- Added the root folders and qualities per user! [Jamie]

- Updated all the MS packages. [TidusJar]

- Update the .net core packages to fix "CVE-2018-8409: ASP.NET Core Denial Of Service Vulnerability" [TidusJar]

- Change way remainingrequests component is notified. [Kenton Royal]

- Added the music request limits. [TidusJar]

- Added the Notification Preferences to the user. [TidusJar]

- Added the API to add user notification preferences. [TidusJar]

- Added more logging into the updater. [Jamie]

- Update CHANGELOG.md. [Jamie]

### **Fixes**

- Fixed #2518. [TidusJar]

- Fixed #2522. [TidusJar]

- Fixed #2485. [TidusJar]

- Fixed #2516. [TidusJar]

- Fix bug in which requested TV wasn't logging for some users. [Kenton Royal]

- Add to translations. [Kenton Royal]

- Add html for displaying remaining requests on users page. [Kenton Royal]

- Add quota fields to user view model. [Kenton Royal]

- Users can now see the music search tab #2493. [TidusJar]

- Add href to a tags so that a pointer cursor shows on requests page. [Stephen Panzer]

- Allow Lidarr to specify if we should search for the album. [TidusJar]

- Fixed the issue if in Radarr we only want to add and monitor, if the movie already exists we search for it. [TidusJar]

- Fix bug causing wrong time to be displayed for next request. [Kenton Royal]

- Bodge fix test to prevent compile error. [Kenton Royal]

- Fix displaying year in issue dialog. [Stephen Panzer]

- Add clearfix class. Closes #2486. [Stephen Panzer]

- Correct path of lidarr component import for unix systems. [Kenton Royal]

- Refactor code. [Kenton Royal]

- Fix formatting error. [Kenton Royal]

- Revert "Revert request.service.ts to version on upstream/develop" [Kenton Royal]

- Revert request.service.ts to version on upstream/develop. [Kenton Royal]

- Fix lint errors. [Kenton Royal]

- Move logic for notifying when reuqest is complete. [Kenton Royal]

- Remove import. [Kenton Royal]

- Remove unused module. [Kenton Royal]

- Refactor code. [Kenton Royal]

- Add text to translation file. [Kenton Royal]

- Fix query for fetching requested tv shows. [Kenton Royal]

- Add vscode to gitignore. [Kenton Royal]

- Fix lint errors. [Kenton Royal]

- Remove unused methods from SearchController. [Kenton Royal]

- Remove local vscode files. [Kenton Royal]

- Fix bug when submitting requests for multiple episodes accross multiple seasons. [Kenton Royal]

- Fix bug with TV requests in which requesting a seasion would treat request as single episode. [Kenton Royal]

- Fix issues with remaining count updating. [Kenton Royal]

- Trigger update of request limit on new request. [Kenton Royal]

- Add logic for movie request count. [Kenton Royal]

- Add logic for retriving request information. [Kenton Royal]

- Move to seperate component and display for both TV and movies. [Kenton Royal]

- Add dummy for request counter. [Kenton Royal]

- Fix scss import for unix systems. [Kenton Royal]

- Add methods to interface and add model class. [Kenton Royal]

- !fixed lint. [TidusJar]

- Fixed #2481. [TidusJar]

- New translations en.json (Swedish) [Jamie]

- New translations en.json (Spanish) [Jamie]

- New translations en.json (Portuguese, Brazilian) [Jamie]

- New translations en.json (Polish) [Jamie]

- New translations en.json (Norwegian) [Jamie]

- New translations en.json (Italian) [Jamie]

- New translations en.json (German) [Jamie]

- New translations en.json (French) [Jamie]

- New translations en.json (Dutch) [Jamie]

- New translations en.json (Danish) [Jamie]

- Fixed #2475. [Jamie]

- Stript out certain characters when sending a pushover message #2385. [TidusJar]

- Add default values for Priority and Sound. [David Pooley]

- Allow for the ability to set Pushover notification sound and priority from within Ombi. [David Pooley]

- It works now when we request an album when we do not have the artist in Lidarr. Waiting on https://github.com/lidarr/Lidarr/issues/459 to do when we have the artist. [Jamie]

- Fix non-Windows builds. Fixes #2453. [Joe Groocock]


## v3.0.3587 (2018-08-19)

### **New Features**
Expand Down Expand Up @@ -30,6 +177,12 @@

### **Fixes**

- Now include the release year in the issue title #2381. [TidusJar]

- Made the OAuth a Popout to work with Org. [Jamie]

- Fixed #2418. [TidusJar]

- #2408 Added the feature to delete comments on issues. [Jamie]

- New translations en.json (Swedish) [Jamie]
Expand Down
Binary file added music-placeholder.psd
Binary file not shown.
27 changes: 27 additions & 0 deletions src/Ombi.Api.Lidarr/ILidarrApi.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Ombi.Api.Lidarr.Models;

namespace Ombi.Api.Lidarr
{
public interface ILidarrApi
{
Task<List<AlbumLookup>> AlbumLookup(string searchTerm, string apiKey, string baseUrl);
Task<List<ArtistLookup>> ArtistLookup(string searchTerm, string apiKey, string baseUrl);
Task<List<LidarrProfile>> GetProfiles(string apiKey, string baseUrl);
Task<List<LidarrRootFolder>> GetRootFolders(string apiKey, string baseUrl);
Task<ArtistResult> GetArtist(int artistId, string apiKey, string baseUrl);
Task<ArtistResult> GetArtistByForeignId(string foreignArtistId, string apiKey, string baseUrl);
Task<AlbumByArtistResponse> GetAlbumsByArtist(string foreignArtistId);
Task<AlbumLookup> GetAlbumByForeignId(string foreignArtistId, string apiKey, string baseUrl);
Task<List<ArtistResult>> GetArtists(string apiKey, string baseUrl);
Task<List<AlbumResponse>> GetAllAlbums(string apiKey, string baseUrl);
Task<ArtistResult> AddArtist(ArtistAdd artist, string apiKey, string baseUrl);
Task<AlbumResponse> MontiorAlbum(int albumId, string apiKey, string baseUrl);
Task<List<AlbumResponse>> GetAllAlbumsByArtistId(int artistId, string apiKey, string baseUrl);
Task<List<MetadataProfile>> GetMetadataProfile(string apiKey, string baseUrl);
Task<List<LanguageProfiles>> GetLanguageProfile(string apiKey, string baseUrl);
Task<LidarrStatus> Status(string apiKey, string baseUrl);
Task<CommandResult> AlbumSearch(int[] albumIds, string apiKey, string baseUrl);
}
}
170 changes: 170 additions & 0 deletions src/Ombi.Api.Lidarr/LidarrApi.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Ombi.Api.Lidarr.Models;

namespace Ombi.Api.Lidarr
{
public class LidarrApi : ILidarrApi
{
public LidarrApi(ILogger<LidarrApi> logger, IApi api)
{
Api = api;
Logger = logger;
}

private IApi Api { get; }
private ILogger Logger { get; }

private const string ApiVersion = "/api/v1";

public Task<List<LidarrProfile>> GetProfiles(string apiKey, string baseUrl)
{
var request = new Request($"{ApiVersion}/qualityprofile", baseUrl, HttpMethod.Get);

AddHeaders(request, apiKey);
return Api.Request<List<LidarrProfile>>(request);
}

public Task<List<LidarrRootFolder>> GetRootFolders(string apiKey, string baseUrl)
{
var request = new Request($"{ApiVersion}/rootfolder", baseUrl, HttpMethod.Get);

AddHeaders(request, apiKey);
return Api.Request<List<LidarrRootFolder>>(request);
}

public async Task<List<ArtistLookup>> ArtistLookup(string searchTerm, string apiKey, string baseUrl)
{
var request = new Request($"{ApiVersion}/Artist/lookup", baseUrl, HttpMethod.Get);
request.AddQueryString("term", searchTerm);

AddHeaders(request, apiKey);
return await Api.Request<List<ArtistLookup>>(request);
}

public Task<List<AlbumLookup>> AlbumLookup(string searchTerm, string apiKey, string baseUrl)
{
var request = new Request($"{ApiVersion}/Album/lookup", baseUrl, HttpMethod.Get);
request.AddQueryString("term", searchTerm);

AddHeaders(request, apiKey);
return Api.Request<List<AlbumLookup>>(request);
}

public Task<ArtistResult> GetArtist(int artistId, string apiKey, string baseUrl)
{
var request = new Request($"{ApiVersion}/artist/{artistId}", baseUrl, HttpMethod.Get);

AddHeaders(request, apiKey);
return Api.Request<ArtistResult>(request);
}

public async Task<ArtistResult> GetArtistByForeignId(string foreignArtistId, string apiKey, string baseUrl)
{
var request = new Request($"{ApiVersion}/artist/lookup", baseUrl, HttpMethod.Get);

request.AddQueryString("term", $"lidarr:{foreignArtistId}");
AddHeaders(request, apiKey);
return (await Api.Request<List<ArtistResult>>(request)).FirstOrDefault();
}

public async Task<AlbumLookup> GetAlbumByForeignId(string foreignArtistId, string apiKey, string baseUrl)
{
var request = new Request($"{ApiVersion}/album/lookup", baseUrl, HttpMethod.Get);

request.AddQueryString("term", $"lidarr:{foreignArtistId}");
AddHeaders(request, apiKey);
var albums = await Api.Request<List<AlbumLookup>>(request);
return albums.FirstOrDefault();
}

public Task<AlbumByArtistResponse> GetAlbumsByArtist(string foreignArtistId)
{
var request = new Request(string.Empty, $"https://api.lidarr.audio/api/v0.3/artist/{foreignArtistId}",
HttpMethod.Get) {IgnoreBaseUrlAppend = true};
return Api.Request<AlbumByArtistResponse>(request);
}

public Task<List<ArtistResult>> GetArtists(string apiKey, string baseUrl)
{
var request = new Request($"{ApiVersion}/artist", baseUrl, HttpMethod.Get);

AddHeaders(request, apiKey);
return Api.Request<List<ArtistResult>>(request);
}

public Task<List<AlbumResponse>> GetAllAlbums(string apiKey, string baseUrl)
{
var request = new Request($"{ApiVersion}/album", baseUrl, HttpMethod.Get);

AddHeaders(request, apiKey);
return Api.Request<List<AlbumResponse>>(request);
}

public Task<ArtistResult> AddArtist(ArtistAdd artist, string apiKey, string baseUrl)
{
var request = new Request($"{ApiVersion}/artist", baseUrl, HttpMethod.Post);
request.AddJsonBody(artist);
AddHeaders(request, apiKey);
return Api.Request<ArtistResult>(request);
}

public async Task<AlbumResponse> MontiorAlbum(int albumId, string apiKey, string baseUrl)
{
var request = new Request($"{ApiVersion}/album/monitor", baseUrl, HttpMethod.Put);
request.AddJsonBody(new
{
albumIds = new[] { albumId },
monitored = true
});
AddHeaders(request, apiKey);
return (await Api.Request<List<AlbumResponse>>(request)).FirstOrDefault();
}

public Task<List<AlbumResponse>> GetAllAlbumsByArtistId(int artistId, string apiKey, string baseUrl)
{
var request = new Request($"{ApiVersion}/album", baseUrl, HttpMethod.Get);
request.AddQueryString("artistId", artistId.ToString());
AddHeaders(request, apiKey);
return Api.Request<List<AlbumResponse>>(request);
}

public Task<List<LanguageProfiles>> GetLanguageProfile(string apiKey, string baseUrl)
{
var request = new Request($"{ApiVersion}/languageprofile", baseUrl, HttpMethod.Get);
AddHeaders(request, apiKey);
return Api.Request<List<LanguageProfiles>>(request);
}

public Task<List<MetadataProfile>> GetMetadataProfile(string apiKey, string baseUrl)
{
var request = new Request($"{ApiVersion}/metadataprofile", baseUrl, HttpMethod.Get);
AddHeaders(request, apiKey);
return Api.Request<List<MetadataProfile>>(request);
}

public Task<LidarrStatus> Status(string apiKey, string baseUrl)
{
var request = new Request($"{ApiVersion}/system/status", baseUrl, HttpMethod.Get);
AddHeaders(request, apiKey);
return Api.Request<LidarrStatus>(request);
}

public Task<CommandResult> AlbumSearch(int[] albumIds, string apiKey, string baseUrl)
{
var request = new Request($"{ApiVersion}/command/AlbumSearch", baseUrl, HttpMethod.Post);
request.AddJsonBody(albumIds);
AddHeaders(request, apiKey);
return Api.Request<CommandResult>(request);
}

private void AddHeaders(Request request, string key)
{
request.AddHeader("X-Api-Key", key);
}
}
}
Loading

0 comments on commit c0e9227

Please sign in to comment.