Merge branch 'develop' of https://github.com/tidusjar/Ombi into develop

pull/3016/head
Jamie Rees 5 years ago
commit d098e6fd32

23
.github/stale.yml vendored

@ -0,0 +1,23 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 60
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Issues with these labels will never be considered stale
exemptLabels:
- pinned
- security
- bug / issue
- help wanted
- possible feature
- planned
- in progress
- enhancement
# Label to use when marking an issue as stale
staleLabel: wontfix
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false

@ -20,9 +20,8 @@ Follow me developing Ombi!
___ ___
<a href='https://play.google.com/store/apps/details?id=com.tidusjar.Ombi&pcampaignid=MKT-Other-global-all-co-prtnr-py-PartBadge-Mar2515-1'><img width="150" alt='Get it on Google Play' src='https://play.google.com/intl/en_gb/badges/images/generic/en_badge_web_generic.png'/></a> <a href='https://play.google.com/store/apps/details?id=com.tidusjar.Ombi&pcampaignid=MKT-Other-global-all-co-prtnr-py-PartBadge-Mar2515-1'><img width="150" alt='Get it on Google Play' src='https://play.google.com/intl/en_gb/badges/images/generic/en_badge_web_generic.png'/></a>
<br>
<a href='https://itunes.apple.com/us/app/ombi/id1335260043?ls=1&mt=8'><img width="150" alt='Get it on App Store' src='https://i.imgur.com/cJFa0M4.png'/></a> _**Note:** There is no longer an iOS app due to complications outside of our control._
___ ___
@ -43,6 +42,7 @@ Here are some of the features Ombi V3 has:
* Now working without crashes on Linux. * Now working without crashes on Linux.
* Lets users request Movies, Music, and TV Shows (whether it being the entire series, an entire season, or even single episodes.) * Lets users request Movies, Music, and TV Shows (whether it being the entire series, an entire season, or even single episodes.)
* Easily manage your requests * Easily manage your requests
* Allows you to set specific users to automatically have requests approved and added to the relevant service (Sonarr/Radarr/Lidarr/Couchpotato etc)
* User management system (supports plex.tv, Emby and local accounts) * User management system (supports plex.tv, Emby and local accounts)
* A landing page that will give you the availability of your Plex/Emby server and also add custom notification text to inform your users of downtime. * A landing page that will give you the availability of your Plex/Emby server and also add custom notification text to inform your users of downtime.
* Allows your users to get custom notifications! * Allows your users to get custom notifications!
@ -50,7 +50,7 @@ Here are some of the features Ombi V3 has:
* Will show if the request is already on plex or even if it's already monitored. * Will show if the request is already on plex or even if it's already monitored.
* Automatically updates the status of requests when they are available on Plex/Emby * Automatically updates the status of requests when they are available on Plex/Emby
* Slick, responsive and mobile friendly UI * Slick, responsive and mobile friendly UI
* Ombi will automatically update itself :) * Ombi will automatically update itself :) (YMMV)
* Very fast! * Very fast!
### Integration ### Integration

@ -23,6 +23,6 @@ namespace Ombi.Api.Lidarr
Task<List<LanguageProfiles>> GetLanguageProfile(string apiKey, string baseUrl); Task<List<LanguageProfiles>> GetLanguageProfile(string apiKey, string baseUrl);
Task<LidarrStatus> Status(string apiKey, string baseUrl); Task<LidarrStatus> Status(string apiKey, string baseUrl);
Task<CommandResult> AlbumSearch(int[] albumIds, string apiKey, string baseUrl); Task<CommandResult> AlbumSearch(int[] albumIds, string apiKey, string baseUrl);
Task<AlbumResponse> AlbumInformation(string albumId, string apiKey, string baseUrl); Task<AlbumByForeignId> AlbumInformation(string albumId, string apiKey, string baseUrl);
} }
} }

@ -105,14 +105,13 @@ namespace Ombi.Api.Lidarr
return Api.Request<List<AlbumResponse>>(request); return Api.Request<List<AlbumResponse>>(request);
} }
public async Task<AlbumResponse> AlbumInformation(string albumId, string apiKey, string baseUrl) public async Task<AlbumByForeignId> AlbumInformation(string albumId, string apiKey, string baseUrl)
{ {
var request = new Request($"{ApiVersion}/album", baseUrl, HttpMethod.Get); var request = new Request($"{ApiVersion}/album", baseUrl, HttpMethod.Get);
request.AddQueryString("foreignAlbumId", albumId); request.AddQueryString("foreignAlbumId", albumId);
AddHeaders(request, apiKey); AddHeaders(request, apiKey);
var albums = await Api.Request<List<AlbumResponse>>(request); var albums = await Api.Request<List<AlbumByForeignId>>(request);
return albums.Where(x => x.foreignAlbumId.Equals(albumId, StringComparison.InvariantCultureIgnoreCase)) return albums.FirstOrDefault();
.FirstOrDefault();
} }

@ -0,0 +1,31 @@
using System;
using System.Net.Mime;
namespace Ombi.Api.Lidarr.Models
{
public class AlbumByForeignId
{
public string title { get; set; }
public string disambiguation { get; set; }
public string overview { get; set; }
public int artistId { get; set; }
public string foreignAlbumId { get; set; }
public bool monitored { get; set; }
public bool anyReleaseOk { get; set; }
public int profileId { get; set; }
public int duration { get; set; }
public string albumType { get; set; }
public object[] secondaryTypes { get; set; }
public int mediumCount { get; set; }
public Ratings ratings { get; set; }
public DateTime releaseDate { get; set; }
public Release[] releases { get; set; }
public object[] genres { get; set; }
public Medium[] media { get; set; }
public Artist artist { get; set; }
public Image[] images { get; set; }
public Link[] links { get; set; }
public Statistics statistics { get; set; }
public int id { get; set; }
}
}

@ -157,7 +157,7 @@ namespace Ombi.Core.Engine
// TODO // TODO
private async Task<SearchAlbumViewModel> MapIntoAlbumVm(AlbumResponse a, LidarrSettings settings) private async Task<SearchAlbumViewModel> MapIntoAlbumVm(AlbumByForeignId a, LidarrSettings settings)
{ {
var vm = new SearchAlbumViewModel var vm = new SearchAlbumViewModel
{ {
@ -167,7 +167,10 @@ namespace Ombi.Core.Engine
ReleaseDate = a.releaseDate, ReleaseDate = a.releaseDate,
Title = a.title, Title = a.title,
Disk = a.images?.FirstOrDefault(x => x.coverType.Equals("disc"))?.url?.Replace("http", "https"), Disk = a.images?.FirstOrDefault(x => x.coverType.Equals("disc"))?.url?.Replace("http", "https"),
Genres = a.genres Genres = a.genres,
AlbumType = a.albumType,
ArtistName = a.artist.artistName,
ForeignArtistId = a.artist.foreignArtistId,
}; };
if (a.artistId > 0) if (a.artistId > 0)
{ {
@ -185,10 +188,6 @@ namespace Ombi.Core.Engine
} }
vm.Cover = a.images?.FirstOrDefault(x => x.coverType.Equals("cover"))?.url?.Replace("http", "https"); vm.Cover = a.images?.FirstOrDefault(x => x.coverType.Equals("cover"))?.url?.Replace("http", "https");
if (vm.Cover.IsNullOrEmpty())
{
//vm.Cover = a.remoteCover;
}
await Rules.StartSpecificRules(vm, SpecificRules.LidarrAlbum); await Rules.StartSpecificRules(vm, SpecificRules.LidarrAlbum);

@ -1,4 +1,6 @@
using System.Security.Claims; using Ombi.Store.Entities;
using System.IO;
using System.Security.Claims;
using System.Security.Principal; using System.Security.Principal;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
@ -37,16 +39,24 @@ namespace Ombi.Core.Rule.Rules.Request
if (obj.RequestType == RequestType.TvShow) if (obj.RequestType == RequestType.TvShow)
{ {
if (await _manager.IsInRoleAsync(user, OmbiRoles.RequestTv) || await _manager.IsInRoleAsync(user, OmbiRoles.AutoApproveTv)) if (await _manager.IsInRoleAsync(user, OmbiRoles.RequestTv) || await _manager.IsInRoleAsync(user, OmbiRoles.AutoApproveTv))
{
return Success(); return Success();
}
return Fail("You do not have permissions to Request a TV Show");
} }
if (obj.RequestType == RequestType.Album) if (obj.RequestType == RequestType.Album)
{ {
if (await _manager.IsInRoleAsync(user, OmbiRoles.RequestMusic) || await _manager.IsInRoleAsync(user, OmbiRoles.AutoApproveMusic)) if (await _manager.IsInRoleAsync(user, OmbiRoles.RequestMusic) || await _manager.IsInRoleAsync(user, OmbiRoles.AutoApproveMusic))
{
return Success(); return Success();
}
return Fail("You do not have permissions to Request an Album");
} }
return Fail("You do not have permissions to Request a TV Show"); throw new InvalidDataException("Permission check failed: unknown RequestType");
} }
} }
} }

@ -216,7 +216,14 @@ namespace Ombi
app.UseSwagger(); app.UseSwagger();
app.UseSwaggerUI(c => app.UseSwaggerUI(c =>
{ {
c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1"); if (settings.BaseUrl.HasValue())
{
c.SwaggerEndpoint($"{settings.BaseUrl}/swagger/v1/swagger.json", "My API V1");
}
else
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
}
}); });
app.UseMvc(routes => app.UseMvc(routes =>

Loading…
Cancel
Save