mirror of https://github.com/lidarr/Lidarr
parent
a602611a5f
commit
a4b78b44ce
|
@ -9,6 +9,35 @@ insert_final_newline = true
|
|||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
# Sort using and Import directives with System.* appearing first
|
||||
dotnet_sort_system_directives_first = true
|
||||
|
||||
# Avoid "this." and "Me." if not necessary
|
||||
dotnet_style_qualification_for_field = false:refactoring
|
||||
dotnet_style_qualification_for_property = false:refactoring
|
||||
dotnet_style_qualification_for_method = false:refactoring
|
||||
dotnet_style_qualification_for_event = false:refactoring
|
||||
|
||||
# Indentation preferences
|
||||
csharp_indent_block_contents = true
|
||||
csharp_indent_braces = false
|
||||
csharp_indent_case_contents = true
|
||||
csharp_indent_case_contents_when_block = true
|
||||
csharp_indent_switch_labels = true
|
||||
csharp_indent_labels = flush_left
|
||||
|
||||
dotnet_style_qualification_for_field = false:suggestion
|
||||
dotnet_style_qualification_for_property = false:suggestion
|
||||
dotnet_style_qualification_for_method = false:suggestion
|
||||
dotnet_style_qualification_for_event = false:suggestion
|
||||
dotnet_naming_style.instance_field_style.capitalization = camel_case
|
||||
dotnet_naming_style.instance_field_style.required_prefix = _
|
||||
|
||||
# Prefer "var" everywhere
|
||||
csharp_style_var_for_built_in_types = true:suggestion
|
||||
csharp_style_var_when_type_is_apparent = true:suggestion
|
||||
csharp_style_var_elsewhere = true:suggestion
|
||||
|
||||
[*.{js,html,js,hbs,less,css}]
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
|
|
|
@ -84,7 +84,6 @@ TestResults
|
|||
[Tt]est[Rr]esult*
|
||||
*.Cache
|
||||
ClientBin
|
||||
[Ss]tyle[Cc]op.*
|
||||
~$*
|
||||
*.dbmdl
|
||||
Generated_Code #added for RIA/Silverlight projects
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<Project>
|
||||
<!-- Common to all Lidarr Projects -->
|
||||
<PropertyGroup>
|
||||
<CodeAnalysisRuleSet>$(SolutionDir)Stylecop.ruleset</CodeAnalysisRuleSet>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
|
@ -92,6 +93,16 @@
|
|||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Set up stylecop -->
|
||||
<ItemGroup Condition="'$(LidarrProject)'=='true'">
|
||||
<!-- StyleCop analysis -->
|
||||
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||
</PackageReference>
|
||||
<AdditionalFiles Include="$(SolutionDir)stylecop.json" />
|
||||
</ItemGroup>
|
||||
|
||||
<!--
|
||||
Set runtime identifier to local system type if not specified
|
||||
-->
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using System.Linq;
|
||||
using Lidarr.Http.Extensions;
|
||||
using Nancy;
|
||||
using NzbDrone.Core.Music;
|
||||
using Lidarr.Http.Extensions;
|
||||
|
||||
namespace Lidarr.Api.V1.AlbumStudio
|
||||
{
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Lidarr.Http;
|
||||
using Nancy;
|
||||
using NzbDrone.Core.MediaCover;
|
||||
using NzbDrone.Core.MetadataSource;
|
||||
using Lidarr.Http;
|
||||
using Lidarr.Http.Extensions;
|
||||
|
||||
namespace Lidarr.Api.V1.Albums
|
||||
{
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FluentValidation;
|
||||
using Lidarr.Http.Extensions;
|
||||
using Nancy;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.ArtistStats;
|
||||
using NzbDrone.Core.Datastore.Events;
|
||||
using NzbDrone.Core.DecisionEngine.Specifications;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.SignalR;
|
||||
using Lidarr.Http.Extensions;
|
||||
using NzbDrone.Core.ArtistStats;
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.Music.Events;
|
||||
using NzbDrone.Core.MediaFiles.Events;
|
||||
using NzbDrone.Core.MediaCover;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.Validation.Paths;
|
||||
using FluentValidation;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.MediaFiles.Events;
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Music.Events;
|
||||
using NzbDrone.Core.Validation;
|
||||
using NzbDrone.Core.Validation.Paths;
|
||||
using NzbDrone.SignalR;
|
||||
|
||||
namespace Lidarr.Api.V1.Albums
|
||||
{
|
||||
|
@ -28,7 +28,6 @@ namespace Lidarr.Api.V1.Albums
|
|||
IHandle<AlbumImportedEvent>,
|
||||
IHandle<TrackImportedEvent>,
|
||||
IHandle<TrackFileDeletedEvent>
|
||||
|
||||
{
|
||||
protected readonly IReleaseService _releaseService;
|
||||
protected readonly IAddAlbumService _addAlbumService;
|
||||
|
@ -184,7 +183,10 @@ namespace Lidarr.Api.V1.Albums
|
|||
|
||||
public void Handle(TrackFileDeletedEvent message)
|
||||
{
|
||||
if (message.Reason == DeleteMediaFileReason.Upgrade) return;
|
||||
if (message.Reason == DeleteMediaFileReason.Upgrade)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
BroadcastResourceChange(ModelAction.Updated, MapToResource(message.TrackFile.Album.Value, true));
|
||||
}
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using Lidarr.Api.V1.Artist;
|
||||
using NzbDrone.Core.DecisionEngine.Specifications;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.ArtistStats;
|
||||
using NzbDrone.SignalR;
|
||||
using Lidarr.Http;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.ArtistStats;
|
||||
using NzbDrone.Core.DecisionEngine.Specifications;
|
||||
using NzbDrone.Core.MediaCover;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.SignalR;
|
||||
|
||||
namespace Lidarr.Api.V1.Albums
|
||||
{
|
||||
|
@ -119,7 +119,6 @@ namespace Lidarr.Api.V1.Albums
|
|||
var dictAlbumStats = artistStatistics.AlbumStatistics.ToDictionary(v => v.AlbumId);
|
||||
|
||||
resource.Statistics = dictAlbumStats.GetValueOrDefault(resource.Id).ToResource();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NzbDrone.Core.Music;
|
||||
|
@ -27,6 +26,7 @@ namespace Lidarr.Api.V1.Albums
|
|||
return Media.Where(s => s.MediumNumber > 0).Count();
|
||||
}
|
||||
}
|
||||
|
||||
public string Disambiguation { get; set; }
|
||||
public List<string> Country { get; set; }
|
||||
public List<string> Label { get; set; }
|
||||
|
@ -62,7 +62,6 @@ namespace Lidarr.Api.V1.Albums
|
|||
.GroupBy(x => x.Format)
|
||||
.Select(g => MediaFormatHelper(g.Key, g.Count()))
|
||||
.ToList())
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using NzbDrone.Core.Music;
|
||||
using Lidarr.Api.V1.Artist;
|
||||
using Lidarr.Http.REST;
|
||||
using Newtonsoft.Json;
|
||||
using NzbDrone.Core.MediaCover;
|
||||
using NzbDrone.Core.Music;
|
||||
|
||||
namespace Lidarr.Api.V1.Albums
|
||||
{
|
||||
|
@ -34,6 +34,7 @@ namespace Lidarr.Api.V1.Albums
|
|||
return Media.Where(s => s.MediumNumber > 0).Count();
|
||||
}
|
||||
}
|
||||
|
||||
public Ratings Ratings { get; set; }
|
||||
public DateTime? ReleaseDate { get; set; }
|
||||
public List<AlbumReleaseResource> Releases { get; set; }
|
||||
|
@ -55,7 +56,10 @@ namespace Lidarr.Api.V1.Albums
|
|||
{
|
||||
public static AlbumResource ToResource(this Album model)
|
||||
{
|
||||
if (model == null) return null;
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var selectedRelease = model.AlbumReleases?.Value.Where(x => x.Monitored).SingleOrDefault();
|
||||
|
||||
|
@ -86,7 +90,10 @@ namespace Lidarr.Api.V1.Albums
|
|||
|
||||
public static Album ToModel(this AlbumResource resource)
|
||||
{
|
||||
if (resource == null) return null;
|
||||
if (resource == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var artist = resource.Artist?.ToModel() ?? new NzbDrone.Core.Music.Artist();
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
using System;
|
||||
using NzbDrone.Core.ArtistStats;
|
||||
|
||||
namespace Lidarr.Api.V1.Albums
|
||||
|
@ -14,9 +13,12 @@ namespace Lidarr.Api.V1.Albums
|
|||
{
|
||||
get
|
||||
{
|
||||
if (TrackCount == 0) return 0;
|
||||
if (TrackCount == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return (decimal)TrackFileCount / (decimal)TrackCount * 100;
|
||||
return TrackFileCount / (decimal)TrackCount * 100;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +27,10 @@ namespace Lidarr.Api.V1.Albums
|
|||
{
|
||||
public static AlbumStatisticsResource ToResource(this AlbumStatistics model)
|
||||
{
|
||||
if (model == null) return null;
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new AlbumStatisticsResource
|
||||
{
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Lidarr.Api.V1.Albums
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Lidarr.Http.Extensions;
|
||||
using Nancy;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Messaging.Commands;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Music.Commands;
|
||||
using Lidarr.Http.Extensions;
|
||||
|
||||
namespace Lidarr.Api.V1.Artist
|
||||
{
|
||||
|
@ -59,7 +59,6 @@ namespace Lidarr.Api.V1.Artist
|
|||
ArtistId = artist.Id,
|
||||
SourcePath = artist.Path
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
if (resource.Tags != null)
|
||||
|
@ -92,8 +91,8 @@ namespace Lidarr.Api.V1.Artist
|
|||
}
|
||||
|
||||
return ResponseWithCode(_artistService.UpdateArtists(artistToUpdate, !resource.MoveFiles)
|
||||
.ToResource()
|
||||
, HttpStatusCode.Accepted);
|
||||
.ToResource(),
|
||||
HttpStatusCode.Accepted);
|
||||
}
|
||||
|
||||
private object DeleteArtist()
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using NzbDrone.Core.Music;
|
||||
|
||||
namespace Lidarr.Api.V1.Artist
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
using System.Collections.Generic;
|
||||
using Nancy;
|
||||
using NzbDrone.Core.Music;
|
||||
using Lidarr.Http;
|
||||
using Lidarr.Http.Extensions;
|
||||
using Nancy;
|
||||
using NzbDrone.Core.Music;
|
||||
|
||||
namespace Lidarr.Api.V1.Artist
|
||||
{
|
||||
|
@ -17,7 +17,6 @@ namespace Lidarr.Api.V1.Artist
|
|||
Post("/", x => Import());
|
||||
}
|
||||
|
||||
|
||||
private object Import()
|
||||
{
|
||||
var resource = Request.Body.FromJson<List<ArtistResource>>();
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Lidarr.Http;
|
||||
using Nancy;
|
||||
using NzbDrone.Core.MediaCover;
|
||||
using NzbDrone.Core.MetadataSource;
|
||||
using Lidarr.Http;
|
||||
using Lidarr.Http.Extensions;
|
||||
|
||||
namespace Lidarr.Api.V1.Artist
|
||||
{
|
||||
|
|
|
@ -1,25 +1,23 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FluentValidation;
|
||||
using Lidarr.Http;
|
||||
using Lidarr.Http.Extensions;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.ArtistStats;
|
||||
using NzbDrone.Core.Datastore.Events;
|
||||
using NzbDrone.Core.MediaCover;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.MediaFiles.Events;
|
||||
using NzbDrone.Core.Messaging.Commands;
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
using NzbDrone.Core.RootFolders;
|
||||
using NzbDrone.Core.ArtistStats;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Music.Commands;
|
||||
using NzbDrone.Core.Music.Events;
|
||||
using NzbDrone.Core.RootFolders;
|
||||
using NzbDrone.Core.Validation;
|
||||
using NzbDrone.Core.Validation.Paths;
|
||||
using Lidarr.Api.V1.Albums;
|
||||
using NzbDrone.SignalR;
|
||||
using Lidarr.Http;
|
||||
using Lidarr.Http.Extensions;
|
||||
|
||||
namespace Lidarr.Api.V1.Artist
|
||||
{
|
||||
|
@ -32,7 +30,6 @@ namespace Lidarr.Api.V1.Artist
|
|||
IHandle<ArtistDeletedEvent>,
|
||||
IHandle<ArtistRenamedEvent>,
|
||||
IHandle<MediaCoversUpdatedEvent>
|
||||
|
||||
{
|
||||
private readonly IArtistService _artistService;
|
||||
private readonly IAlbumService _albumService;
|
||||
|
@ -57,8 +54,7 @@ namespace Lidarr.Api.V1.Artist
|
|||
ArtistAncestorValidator artistAncestorValidator,
|
||||
SystemFolderValidator systemFolderValidator,
|
||||
ProfileExistsValidator profileExistsValidator,
|
||||
MetadataProfileExistsValidator metadataProfileExistsValidator
|
||||
)
|
||||
MetadataProfileExistsValidator metadataProfileExistsValidator)
|
||||
: base(signalRBroadcaster)
|
||||
{
|
||||
_artistService = artistService;
|
||||
|
@ -108,12 +104,16 @@ namespace Lidarr.Api.V1.Artist
|
|||
|
||||
private ArtistResource GetArtistResource(NzbDrone.Core.Music.Artist artist)
|
||||
{
|
||||
if (artist == null) return null;
|
||||
if (artist == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var resource = artist.ToResource();
|
||||
MapCoversToLocal(resource);
|
||||
FetchAndLinkArtistStatistics(resource);
|
||||
LinkNextPreviousAlbums(resource);
|
||||
|
||||
//PopulateAlternateTitles(resource);
|
||||
LinkRootFolderPath(resource);
|
||||
|
||||
|
@ -128,8 +128,8 @@ namespace Lidarr.Api.V1.Artist
|
|||
MapCoversToLocal(artistsResources.ToArray());
|
||||
LinkNextPreviousAlbums(artistsResources.ToArray());
|
||||
LinkArtistStatistics(artistsResources, artistStats);
|
||||
//PopulateAlternateTitles(seriesResources);
|
||||
|
||||
//PopulateAlternateTitles(seriesResources);
|
||||
return artistsResources;
|
||||
}
|
||||
|
||||
|
@ -204,7 +204,10 @@ namespace Lidarr.Api.V1.Artist
|
|||
foreach (var artist in resources)
|
||||
{
|
||||
var stats = artistStatistics.SingleOrDefault(ss => ss.ArtistId == artist.Id);
|
||||
if (stats == null) continue;
|
||||
if (stats == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
LinkArtistStatistics(artist, stats);
|
||||
}
|
||||
|
@ -231,7 +234,6 @@ namespace Lidarr.Api.V1.Artist
|
|||
|
||||
// resource.AlternateTitles = mappings.Select(v => new AlternateTitleResource { Title = v.Title, SeasonNumber = v.SeasonNumber, SceneSeasonNumber = v.SceneSeasonNumber }).ToList();
|
||||
//}
|
||||
|
||||
private void LinkRootFolderPath(ArtistResource resource)
|
||||
{
|
||||
resource.RootFolderPath = _rootFolderService.GetBestRootFolderPath(resource.Path);
|
||||
|
@ -249,7 +251,10 @@ namespace Lidarr.Api.V1.Artist
|
|||
|
||||
public void Handle(TrackFileDeletedEvent message)
|
||||
{
|
||||
if (message.Reason == DeleteMediaFileReason.Upgrade) return;
|
||||
if (message.Reason == DeleteMediaFileReason.Upgrade)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
BroadcastResourceChange(ModelAction.Updated, GetArtistResource(message.TrackFile.Artist.Value));
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Lidarr.Http.REST;
|
||||
using Newtonsoft.Json;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.MediaCover;
|
||||
using NzbDrone.Core.Music;
|
||||
using Lidarr.Http.REST;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Lidarr.Api.V1.Artist
|
||||
{
|
||||
|
@ -14,7 +14,6 @@ namespace Lidarr.Api.V1.Artist
|
|||
//Todo: Sorters should be done completely on the client
|
||||
//Todo: Is there an easy way to keep IgnoreArticlesWhenSorting in sync between, Series, History, Missing?
|
||||
//Todo: We should get the entire Profile instead of ID and Name separately
|
||||
|
||||
[JsonIgnore]
|
||||
public int ArtistMetadataId { get; set; }
|
||||
public ArtistStatusType Status { get; set; }
|
||||
|
@ -42,7 +41,6 @@ namespace Lidarr.Api.V1.Artist
|
|||
|
||||
public string RemotePoster { get; set; }
|
||||
|
||||
|
||||
//View & Edit
|
||||
public string Path { get; set; }
|
||||
public int QualityProfileId { get; set; }
|
||||
|
@ -68,7 +66,10 @@ namespace Lidarr.Api.V1.Artist
|
|||
{
|
||||
public static ArtistResource ToResource(this NzbDrone.Core.Music.Artist model)
|
||||
{
|
||||
if (model == null) return null;
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new ArtistResource
|
||||
{
|
||||
|
@ -76,6 +77,7 @@ namespace Lidarr.Api.V1.Artist
|
|||
ArtistMetadataId = model.ArtistMetadataId,
|
||||
|
||||
ArtistName = model.Name,
|
||||
|
||||
//AlternateTitles
|
||||
SortName = model.SortName,
|
||||
|
||||
|
@ -98,6 +100,7 @@ namespace Lidarr.Api.V1.Artist
|
|||
|
||||
CleanName = model.CleanName,
|
||||
ForeignArtistId = model.Metadata.Value.ForeignArtistId,
|
||||
|
||||
// Root folder path is now calculated from the artist path
|
||||
// RootFolderPath = model.RootFolderPath,
|
||||
Genres = model.Metadata.Value.Genres,
|
||||
|
@ -112,7 +115,10 @@ namespace Lidarr.Api.V1.Artist
|
|||
|
||||
public static NzbDrone.Core.Music.Artist ToModel(this ArtistResource resource)
|
||||
{
|
||||
if (resource == null) return null;
|
||||
if (resource == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new NzbDrone.Core.Music.Artist
|
||||
{
|
||||
|
@ -137,7 +143,6 @@ namespace Lidarr.Api.V1.Artist
|
|||
QualityProfileId = resource.QualityProfileId,
|
||||
MetadataProfileId = resource.MetadataProfileId,
|
||||
|
||||
|
||||
AlbumFolder = resource.AlbumFolder,
|
||||
Monitored = resource.Monitored,
|
||||
|
||||
|
@ -148,7 +153,6 @@ namespace Lidarr.Api.V1.Artist
|
|||
Tags = resource.Tags,
|
||||
Added = resource.Added,
|
||||
AddOptions = resource.AddOptions,
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
using System;
|
||||
using NzbDrone.Core.ArtistStats;
|
||||
|
||||
namespace Lidarr.Api.V1.Artist
|
||||
|
@ -15,9 +14,12 @@ namespace Lidarr.Api.V1.Artist
|
|||
{
|
||||
get
|
||||
{
|
||||
if (TrackCount == 0) return 0;
|
||||
if (TrackCount == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return (decimal)TrackFileCount / (decimal)TrackCount * 100;
|
||||
return TrackFileCount / (decimal)TrackCount * 100;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +28,10 @@ namespace Lidarr.Api.V1.Artist
|
|||
{
|
||||
public static ArtistStatisticsResource ToResource(this ArtistStatistics model)
|
||||
{
|
||||
if (model == null) return null;
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new ArtistStatisticsResource
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
using Lidarr.Http;
|
||||
using NzbDrone.Core.Blacklisting;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using Lidarr.Http;
|
||||
|
||||
namespace Lidarr.Api.V1.Blacklist
|
||||
{
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using NzbDrone.Core.Indexers;
|
||||
using NzbDrone.Core.Qualities;
|
||||
using Lidarr.Api.V1.Artist;
|
||||
using Lidarr.Http.REST;
|
||||
using NzbDrone.Core.Indexers;
|
||||
using NzbDrone.Core.Qualities;
|
||||
|
||||
namespace Lidarr.Api.V1.Blacklist
|
||||
{
|
||||
|
@ -25,7 +25,10 @@ namespace Lidarr.Api.V1.Blacklist
|
|||
{
|
||||
public static BlacklistResource MapToResource(this NzbDrone.Core.Blacklisting.Blacklist model)
|
||||
{
|
||||
if (model == null) return null;
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new BlacklistResource
|
||||
{
|
||||
|
|
|
@ -2,15 +2,15 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Ical.Net;
|
||||
using Ical.Net.CalendarComponents;
|
||||
using Ical.Net.DataTypes;
|
||||
using Ical.Net.Serialization;
|
||||
using Lidarr.Http.Extensions;
|
||||
using Nancy;
|
||||
using Nancy.Responses;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Tags;
|
||||
using NzbDrone.Core.Music;
|
||||
using Lidarr.Http.Extensions;
|
||||
using Ical.Net.CalendarComponents;
|
||||
using NzbDrone.Core.Tags;
|
||||
|
||||
namespace Lidarr.Api.V1.Calendar
|
||||
{
|
||||
|
@ -82,6 +82,7 @@ namespace Lidarr.Api.V1.Calendar
|
|||
|
||||
var occurrence = calendar.Create<CalendarEvent>();
|
||||
occurrence.Uid = "Lidarr_album_" + album.Id;
|
||||
|
||||
//occurrence.Status = album.HasFile ? EventStatus.Confirmed : EventStatus.Tentative;
|
||||
occurrence.Description = album.Overview;
|
||||
occurrence.Categories = album.Genres;
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NzbDrone.Core.DecisionEngine.Specifications;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.ArtistStats;
|
||||
using NzbDrone.SignalR;
|
||||
using Lidarr.Api.V1.Albums;
|
||||
using Lidarr.Http.Extensions;
|
||||
using NzbDrone.Core.ArtistStats;
|
||||
using NzbDrone.Core.DecisionEngine.Specifications;
|
||||
using NzbDrone.Core.MediaCover;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.SignalR;
|
||||
|
||||
namespace Lidarr.Api.V1.Calendar
|
||||
{
|
||||
|
@ -36,8 +36,15 @@ namespace Lidarr.Api.V1.Calendar
|
|||
var queryStart = Request.Query.Start;
|
||||
var queryEnd = Request.Query.End;
|
||||
|
||||
if (queryStart.HasValue) start = DateTime.Parse(queryStart.Value);
|
||||
if (queryEnd.HasValue) end = DateTime.Parse(queryEnd.Value);
|
||||
if (queryStart.HasValue)
|
||||
{
|
||||
start = DateTime.Parse(queryStart.Value);
|
||||
}
|
||||
|
||||
if (queryEnd.HasValue)
|
||||
{
|
||||
end = DateTime.Parse(queryEnd.Value);
|
||||
}
|
||||
|
||||
var resources = MapToResource(_albumService.AlbumsBetweenDates(start, end, includeUnmonitored), includeArtist);
|
||||
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Lidarr.Http;
|
||||
using Lidarr.Http.Extensions;
|
||||
using Lidarr.Http.Validation;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Common.TPL;
|
||||
using NzbDrone.Core.Datastore.Events;
|
||||
|
@ -8,9 +11,6 @@ using NzbDrone.Core.Messaging.Commands;
|
|||
using NzbDrone.Core.Messaging.Events;
|
||||
using NzbDrone.Core.ProgressMessaging;
|
||||
using NzbDrone.SignalR;
|
||||
using Lidarr.Http;
|
||||
using Lidarr.Http.Extensions;
|
||||
using Lidarr.Http.Validation;
|
||||
|
||||
namespace Lidarr.Api.V1.Commands
|
||||
{
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Lidarr.Http.REST;
|
||||
using Newtonsoft.Json;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Messaging.Commands;
|
||||
using Lidarr.Http.REST;
|
||||
|
||||
namespace Lidarr.Api.V1.Commands
|
||||
{
|
||||
|
@ -30,37 +30,51 @@ namespace Lidarr.Api.V1.Commands
|
|||
{
|
||||
get
|
||||
{
|
||||
|
||||
if (Started.HasValue) return Started.Value;
|
||||
if (Started.HasValue)
|
||||
{
|
||||
return Started.Value;
|
||||
}
|
||||
|
||||
return Ended;
|
||||
}
|
||||
|
||||
set { }
|
||||
set
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public bool SendUpdatesToClient
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Body != null) return Body.SendUpdatesToClient;
|
||||
if (Body != null)
|
||||
{
|
||||
return Body.SendUpdatesToClient;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
set { }
|
||||
set
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public bool UpdateScheduledTask
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Body != null) return Body.UpdateScheduledTask;
|
||||
if (Body != null)
|
||||
{
|
||||
return Body.UpdateScheduledTask;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
set { }
|
||||
set
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public DateTime? LastExecutionTime { get; set; }
|
||||
|
@ -70,7 +84,10 @@ namespace Lidarr.Api.V1.Commands
|
|||
{
|
||||
public static CommandResource ToResource(this CommandModel model)
|
||||
{
|
||||
if (model == null) return null;
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new CommandResource
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
using NzbDrone.Core.Configuration;
|
||||
using Lidarr.Http.REST;
|
||||
using Lidarr.Http.REST;
|
||||
using NzbDrone.Core.Configuration;
|
||||
|
||||
namespace Lidarr.Api.V1.Config
|
||||
{
|
||||
|
|
|
@ -2,13 +2,13 @@ using System.IO;
|
|||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using FluentValidation;
|
||||
using Lidarr.Http;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Authentication;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Update;
|
||||
using NzbDrone.Core.Validation;
|
||||
using NzbDrone.Core.Validation.Paths;
|
||||
using Lidarr.Http;
|
||||
|
||||
namespace Lidarr.Api.V1.Config
|
||||
{
|
||||
|
@ -51,7 +51,6 @@ namespace Lidarr.Api.V1.Config
|
|||
SharedValidator.RuleFor(c => c.BackupFolder).IsValidPath().When(c => Path.IsPathRooted(c.BackupFolder));
|
||||
SharedValidator.RuleFor(c => c.BackupInterval).InclusiveBetween(1, 7);
|
||||
SharedValidator.RuleFor(c => c.BackupRetention).InclusiveBetween(1, 90);
|
||||
|
||||
}
|
||||
|
||||
private HostConfigResource GetHostConfig()
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
using Lidarr.Http.REST;
|
||||
using NzbDrone.Common.Http.Proxy;
|
||||
using NzbDrone.Core.Authentication;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Security;
|
||||
using NzbDrone.Core.Update;
|
||||
using Lidarr.Http.REST;
|
||||
|
||||
namespace Lidarr.Api.V1.Config
|
||||
{
|
||||
|
@ -56,6 +56,7 @@ namespace Lidarr.Api.V1.Config
|
|||
LaunchBrowser = model.LaunchBrowser,
|
||||
AuthenticationMethod = model.AuthenticationMethod,
|
||||
AnalyticsEnabled = model.AnalyticsEnabled,
|
||||
|
||||
//Username
|
||||
//Password
|
||||
LogLevel = model.LogLevel,
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
using FluentValidation;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using Lidarr.Http.Validation;
|
||||
using NzbDrone.Core.Configuration;
|
||||
|
||||
namespace Lidarr.Api.V1.Config
|
||||
{
|
||||
public class IndexerConfigModule : LidarrConfigModule<IndexerConfigResource>
|
||||
{
|
||||
|
||||
public IndexerConfigModule(IConfigService configService)
|
||||
: base(configService)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
using NzbDrone.Core.Configuration;
|
||||
using Lidarr.Http.REST;
|
||||
using NzbDrone.Core.Configuration;
|
||||
|
||||
namespace Lidarr.Api.V1.Config
|
||||
{
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using Lidarr.Http;
|
||||
using Lidarr.Http.REST;
|
||||
using NzbDrone.Core.Configuration;
|
||||
|
||||
namespace Lidarr.Api.V1.Config
|
||||
{
|
||||
public abstract class LidarrConfigModule<TResource> : LidarrRestModule<TResource> where TResource : RestResource, new()
|
||||
public abstract class LidarrConfigModule<TResource> : LidarrRestModule<TResource>
|
||||
where TResource : RestResource, new()
|
||||
{
|
||||
private readonly IConfigService _configService;
|
||||
|
||||
|
@ -15,8 +16,8 @@ namespace Lidarr.Api.V1.Config
|
|||
{
|
||||
}
|
||||
|
||||
protected LidarrConfigModule(string resource, IConfigService configService) :
|
||||
base("config/" + resource.Trim('/'))
|
||||
protected LidarrConfigModule(string resource, IConfigService configService)
|
||||
: base("config/" + resource.Trim('/'))
|
||||
{
|
||||
_configService = configService;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
using Lidarr.Http.REST;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using Lidarr.Http.REST;
|
||||
using NzbDrone.Core.Qualities;
|
||||
|
||||
namespace Lidarr.Api.V1.Config
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using FluentValidation;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using Lidarr.Http;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Validation;
|
||||
|
||||
namespace Lidarr.Api.V1.Config
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
using NzbDrone.Core.Configuration;
|
||||
using Lidarr.Http.REST;
|
||||
using NzbDrone.Core.Configuration;
|
||||
|
||||
namespace Lidarr.Api.V1.Config
|
||||
{
|
||||
|
|
|
@ -2,13 +2,10 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using FluentValidation;
|
||||
using FluentValidation.Results;
|
||||
using Lidarr.Http;
|
||||
using Nancy.ModelBinding;
|
||||
using Nancy.Responses;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Organizer;
|
||||
using Lidarr.Http;
|
||||
using Lidarr.Http.Extensions;
|
||||
using Lidarr.Http.Mapping;
|
||||
|
||||
namespace Lidarr.Api.V1.Config
|
||||
{
|
||||
|
@ -35,7 +32,6 @@ namespace Lidarr.Api.V1.Config
|
|||
|
||||
Get("/examples", x => GetExamples(this.Bind<NamingConfigResource>()));
|
||||
|
||||
|
||||
SharedValidator.RuleFor(c => c.StandardTrackFormat).ValidTrackFormat();
|
||||
SharedValidator.RuleFor(c => c.MultiDiscTrackFormat).ValidTrackFormat();
|
||||
SharedValidator.RuleFor(c => c.ArtistFolderFormat).ValidArtistFolderFormat();
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using Lidarr.Http;
|
||||
using NzbDrone.Core.Configuration;
|
||||
|
||||
namespace Lidarr.Api.V1.Config
|
||||
{
|
||||
|
@ -10,7 +7,6 @@ namespace Lidarr.Api.V1.Config
|
|||
public UiConfigModule(IConfigService configService)
|
||||
: base(configService)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override UiConfigResource ToResource(IConfigService model)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
using NzbDrone.Core.Configuration;
|
||||
using Lidarr.Http.REST;
|
||||
using Lidarr.Http.REST;
|
||||
using NzbDrone.Core.Configuration;
|
||||
|
||||
namespace Lidarr.Api.V1.Config
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
using System.Collections.Generic;
|
||||
using NzbDrone.Core.CustomFilters;
|
||||
using Lidarr.Http;
|
||||
using NzbDrone.Core.CustomFilters;
|
||||
|
||||
namespace Lidarr.Api.V1.CustomFilters
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Lidarr.Http.REST;
|
||||
using NzbDrone.Common.Serializer;
|
||||
using NzbDrone.Core.CustomFilters;
|
||||
using Lidarr.Http.REST;
|
||||
|
||||
namespace Lidarr.Api.V1.CustomFilters
|
||||
{
|
||||
|
@ -17,7 +17,10 @@ namespace Lidarr.Api.V1.CustomFilters
|
|||
{
|
||||
public static CustomFilterResource ToResource(this CustomFilter model)
|
||||
{
|
||||
if (model == null) return null;
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new CustomFilterResource
|
||||
{
|
||||
|
@ -30,7 +33,10 @@ namespace Lidarr.Api.V1.CustomFilters
|
|||
|
||||
public static CustomFilter ToModel(this CustomFilterResource resource)
|
||||
{
|
||||
if (resource == null) return null;
|
||||
if (resource == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new CustomFilter
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
using System.Collections.Generic;
|
||||
using NzbDrone.Core.DiskSpace;
|
||||
using Lidarr.Http;
|
||||
using NzbDrone.Core.DiskSpace;
|
||||
|
||||
namespace Lidarr.Api.V1.DiskSpace
|
||||
{
|
||||
|
|
|
@ -14,7 +14,10 @@ namespace Lidarr.Api.V1.DiskSpace
|
|||
{
|
||||
public static DiskSpaceResource MapToResource(this NzbDrone.Core.DiskSpace.DiskSpace model)
|
||||
{
|
||||
if (model == null) return null;
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new DiskSpaceResource
|
||||
{
|
||||
|
|
|
@ -13,7 +13,11 @@ namespace Lidarr.Api.V1.DownloadClient
|
|||
|
||||
protected override void Validate(DownloadClientDefinition definition, bool includeWarnings)
|
||||
{
|
||||
if (!definition.Enable) return;
|
||||
if (!definition.Enable)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
base.Validate(definition, includeWarnings);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,10 @@ namespace Lidarr.Api.V1.DownloadClient
|
|||
{
|
||||
public override DownloadClientResource ToResource(DownloadClientDefinition definition)
|
||||
{
|
||||
if (definition == null) return null;
|
||||
if (definition == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var resource = base.ToResource(definition);
|
||||
|
||||
|
@ -27,7 +30,10 @@ namespace Lidarr.Api.V1.DownloadClient
|
|||
|
||||
public override DownloadClientDefinition ToModel(DownloadClientResource resource)
|
||||
{
|
||||
if (resource == null) return null;
|
||||
if (resource == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var definition = base.ToModel(resource);
|
||||
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.IO.Abstractions;
|
||||
using System.Linq;
|
||||
using Lidarr.Http.Extensions;
|
||||
using Nancy;
|
||||
using NzbDrone.Common.Disk;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using Lidarr.Http.Extensions;
|
||||
|
||||
namespace Lidarr.Api.V1.FileSystem
|
||||
{
|
||||
|
@ -62,7 +59,8 @@ namespace Lidarr.Api.V1.FileSystem
|
|||
return new string[0];
|
||||
}
|
||||
|
||||
return _diskScanService.GetAudioFiles(path).Select(f => new {
|
||||
return _diskScanService.GetAudioFiles(path).Select(f => new
|
||||
{
|
||||
Path = f.FullName,
|
||||
RelativePath = path.GetRelativePath(f.FullName),
|
||||
Name = f.Name
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
using System.Collections.Generic;
|
||||
using Lidarr.Http;
|
||||
using NzbDrone.Core.Datastore.Events;
|
||||
using NzbDrone.Core.HealthCheck;
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
using NzbDrone.SignalR;
|
||||
using Lidarr.Http;
|
||||
|
||||
namespace Lidarr.Api.V1.Health
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Lidarr.Http.REST;
|
||||
using NzbDrone.Common.Http;
|
||||
using NzbDrone.Core.HealthCheck;
|
||||
using Lidarr.Http.REST;
|
||||
|
||||
namespace Lidarr.Api.V1.Health
|
||||
{
|
||||
|
@ -18,7 +18,10 @@ namespace Lidarr.Api.V1.Health
|
|||
{
|
||||
public static HealthResource ToResource(this HealthCheck model)
|
||||
{
|
||||
if (model == null) return null;
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new HealthResource
|
||||
{
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Nancy;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.DecisionEngine.Specifications;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.History;
|
||||
using Lidarr.Api.V1.Albums;
|
||||
using Lidarr.Api.V1.Artist;
|
||||
using Lidarr.Api.V1.Tracks;
|
||||
using Lidarr.Http;
|
||||
using Lidarr.Http.Extensions;
|
||||
using Lidarr.Http.REST;
|
||||
using Nancy;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.DecisionEngine.Specifications;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.History;
|
||||
|
||||
namespace Lidarr.Api.V1.History
|
||||
{
|
||||
|
@ -43,16 +43,17 @@ namespace Lidarr.Api.V1.History
|
|||
{
|
||||
resource.Artist = model.Artist.ToResource();
|
||||
}
|
||||
|
||||
if (includeAlbum)
|
||||
{
|
||||
resource.Album = model.Album.ToResource();
|
||||
}
|
||||
|
||||
if (includeTrack)
|
||||
{
|
||||
resource.Track = model.Track.ToResource();
|
||||
}
|
||||
|
||||
|
||||
if (model.Artist != null)
|
||||
{
|
||||
resource.QualityCutoffNotMet = _upgradableSpecification.QualityCutoffNotMet(model.Artist.QualityProfile.Value, model.Quality);
|
||||
|
@ -90,7 +91,6 @@ namespace Lidarr.Api.V1.History
|
|||
pagingSpec.FilterExpressions.Add(h => h.DownloadId == downloadId);
|
||||
}
|
||||
|
||||
|
||||
return ApplyToPage(_historyService.Paged, pagingSpec, h => MapToResource(h, includeArtist, includeAlbum, includeTrack));
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using NzbDrone.Core.History;
|
||||
using NzbDrone.Core.Qualities;
|
||||
using Lidarr.Api.V1.Albums;
|
||||
using Lidarr.Api.V1.Artist;
|
||||
using Lidarr.Api.V1.Tracks;
|
||||
using Lidarr.Http.REST;
|
||||
using NzbDrone.Core.History;
|
||||
using NzbDrone.Core.Qualities;
|
||||
|
||||
namespace Lidarr.Api.V1.History
|
||||
{
|
||||
|
@ -33,7 +33,10 @@ namespace Lidarr.Api.V1.History
|
|||
{
|
||||
public static HistoryResource ToResource(this NzbDrone.Core.History.History model)
|
||||
{
|
||||
if (model == null) return null;
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new HistoryResource
|
||||
{
|
||||
|
@ -44,6 +47,7 @@ namespace Lidarr.Api.V1.History
|
|||
TrackId = model.TrackId,
|
||||
SourceTitle = model.SourceTitle,
|
||||
Quality = model.Quality,
|
||||
|
||||
//QualityCutoffNotMet
|
||||
Date = model.Date,
|
||||
DownloadId = model.DownloadId,
|
||||
|
@ -51,6 +55,7 @@ namespace Lidarr.Api.V1.History
|
|||
EventType = model.EventType,
|
||||
|
||||
Data = model.Data
|
||||
|
||||
//Episode
|
||||
//Series
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using System.Collections.Generic;
|
||||
using NzbDrone.Core.ImportLists.Exclusions;
|
||||
using Lidarr.Http;
|
||||
using FluentValidation;
|
||||
using Lidarr.Http;
|
||||
using NzbDrone.Core.ImportLists.Exclusions;
|
||||
using NzbDrone.Core.Validation;
|
||||
|
||||
namespace Lidarr.Api.V1.ImportLists
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NzbDrone.Core.ImportLists.Exclusions;
|
||||
using Lidarr.Http.REST;
|
||||
using NzbDrone.Core.ImportLists.Exclusions;
|
||||
|
||||
namespace Lidarr.Api.V1.ImportLists
|
||||
{
|
||||
|
@ -15,7 +15,10 @@ namespace Lidarr.Api.V1.ImportLists
|
|||
{
|
||||
public static ImportListExclusionResource ToResource(this ImportListExclusion model)
|
||||
{
|
||||
if (model == null) return null;
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new ImportListExclusionResource
|
||||
{
|
||||
|
@ -27,7 +30,10 @@ namespace Lidarr.Api.V1.ImportLists
|
|||
|
||||
public static ImportListExclusion ToModel(this ImportListExclusionResource resource)
|
||||
{
|
||||
if (resource == null) return null;
|
||||
if (resource == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new ImportListExclusion
|
||||
{
|
||||
|
|
|
@ -10,8 +10,7 @@ namespace Lidarr.Api.V1.ImportLists
|
|||
|
||||
public ImportListModule(ImportListFactory importListFactory,
|
||||
ProfileExistsValidator profileExistsValidator,
|
||||
MetadataProfileExistsValidator metadataProfileExistsValidator
|
||||
)
|
||||
MetadataProfileExistsValidator metadataProfileExistsValidator)
|
||||
: base(importListFactory, "importlist", ResourceMapper)
|
||||
{
|
||||
Http.Validation.RuleBuilderExtensions.ValidId(SharedValidator.RuleFor(s => s.QualityProfileId));
|
||||
|
@ -28,6 +27,7 @@ namespace Lidarr.Api.V1.ImportLists
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
base.Validate(definition, includeWarnings);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,11 @@ namespace Lidarr.Api.V1.Indexers
|
|||
|
||||
protected override void Validate(IndexerDefinition definition, bool includeWarnings)
|
||||
{
|
||||
if (!definition.Enable) return;
|
||||
if (!definition.Enable)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
base.Validate(definition, includeWarnings);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,10 @@ namespace Lidarr.Api.V1.Indexers
|
|||
{
|
||||
public override IndexerResource ToResource(IndexerDefinition definition)
|
||||
{
|
||||
if (definition == null) return null;
|
||||
if (definition == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var resource = base.ToResource(definition);
|
||||
|
||||
|
@ -32,7 +35,10 @@ namespace Lidarr.Api.V1.Indexers
|
|||
|
||||
public override IndexerDefinition ToModel(IndexerResource resource)
|
||||
{
|
||||
if (resource == null) return null;
|
||||
if (resource == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var definition = base.ToModel(resource);
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@ using NzbDrone.Core.Indexers;
|
|||
using NzbDrone.Core.IndexerSearch;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Validation;
|
||||
using Lidarr.Http.Extensions;
|
||||
using HttpStatusCode = System.Net.HttpStatusCode;
|
||||
|
||||
namespace Lidarr.Api.V1.Indexers
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
using System.Collections.Generic;
|
||||
using NzbDrone.Core.DecisionEngine;
|
||||
using Lidarr.Http;
|
||||
using NzbDrone.Core.DecisionEngine;
|
||||
|
||||
namespace Lidarr.Api.V1.Indexers
|
||||
{
|
||||
|
|
|
@ -2,19 +2,17 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using FluentValidation;
|
||||
using FluentValidation.Results;
|
||||
using Nancy;
|
||||
using NLog;
|
||||
using NzbDrone.Core.DecisionEngine;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using Lidarr.Http.Extensions;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.DecisionEngine;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.Indexers;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
|
||||
namespace Lidarr.Api.V1.Indexers
|
||||
{
|
||||
class ReleasePushModule : ReleaseModuleBase
|
||||
internal class ReleasePushModule : ReleaseModuleBase
|
||||
{
|
||||
private readonly IMakeDownloadDecision _downloadDecisionMaker;
|
||||
private readonly IProcessDownloadDecisions _downloadDecisionProcessor;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Lidarr.Http.REST;
|
||||
using Newtonsoft.Json;
|
||||
using NzbDrone.Core.DecisionEngine;
|
||||
using NzbDrone.Core.Indexers;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Qualities;
|
||||
using Lidarr.Http.REST;
|
||||
|
||||
namespace Lidarr.Api.V1.Indexers
|
||||
{
|
||||
|
@ -49,12 +49,13 @@ namespace Lidarr.Api.V1.Indexers
|
|||
public DownloadProtocol Protocol { get; set; }
|
||||
|
||||
// Sent when queuing an unknown release
|
||||
|
||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
|
||||
// [JsonIgnore]
|
||||
public int? ArtistId { get; set; }
|
||||
|
||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
|
||||
// [JsonIgnore]
|
||||
public int? AlbumId { get; set; }
|
||||
}
|
||||
|
@ -73,6 +74,7 @@ namespace Lidarr.Api.V1.Indexers
|
|||
{
|
||||
Guid = releaseInfo.Guid,
|
||||
Quality = parsedAlbumInfo.Quality,
|
||||
|
||||
//QualityWeight
|
||||
Age = releaseInfo.Age,
|
||||
AgeHours = releaseInfo.AgeHours,
|
||||
|
@ -95,17 +97,16 @@ namespace Lidarr.Api.V1.Indexers
|
|||
DownloadUrl = releaseInfo.DownloadUrl,
|
||||
InfoUrl = releaseInfo.InfoUrl,
|
||||
DownloadAllowed = remoteAlbum.DownloadAllowed,
|
||||
|
||||
//ReleaseWeight
|
||||
PreferredWordScore = remoteAlbum.PreferredWordScore,
|
||||
|
||||
|
||||
MagnetUrl = torrentInfo.MagnetUrl,
|
||||
InfoHash = torrentInfo.InfoHash,
|
||||
Seeders = torrentInfo.Seeders,
|
||||
Leechers = (torrentInfo.Peers.HasValue && torrentInfo.Seeders.HasValue) ? (torrentInfo.Peers.Value - torrentInfo.Seeders.Value) : (int?)null,
|
||||
Protocol = releaseInfo.DownloadProtocol,
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
public static ReleaseInfo ToModel(this ReleaseResource resource)
|
||||
|
|
|
@ -38,6 +38,5 @@ namespace Lidarr.Api.V1.Logs
|
|||
return "logfile";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,12 +1,12 @@
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Lidarr.Http;
|
||||
using Nancy;
|
||||
using Nancy.Responses;
|
||||
using NLog;
|
||||
using NzbDrone.Common.Disk;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using Lidarr.Http;
|
||||
using NLog;
|
||||
|
||||
namespace Lidarr.Api.V1.Logs
|
||||
{
|
||||
|
@ -60,7 +60,9 @@ namespace Lidarr.Api.V1.Logs
|
|||
var filePath = GetLogFilePath(filename);
|
||||
|
||||
if (!_diskProvider.FileExists(filePath))
|
||||
{
|
||||
return new NotFoundResponse();
|
||||
}
|
||||
|
||||
var data = _diskProvider.ReadAllText(filePath);
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
using System.Linq;
|
||||
using NzbDrone.Core.Instrumentation;
|
||||
using Lidarr.Http;
|
||||
using NzbDrone.Core.Instrumentation;
|
||||
|
||||
namespace Lidarr.Api.V1.Logs
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
using System;
|
||||
using NzbDrone.Core.Instrumentation;
|
||||
using Lidarr.Http.REST;
|
||||
using NzbDrone.Core.Instrumentation;
|
||||
|
||||
namespace Lidarr.Api.V1.Logs
|
||||
{
|
||||
|
@ -19,7 +19,10 @@ namespace Lidarr.Api.V1.Logs
|
|||
{
|
||||
public static LogResource ToResource(this Log model)
|
||||
{
|
||||
if (model == null) return null;
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new LogResource
|
||||
{
|
||||
|
|
|
@ -25,7 +25,10 @@ namespace Lidarr.Api.V1.Logs
|
|||
|
||||
protected override IEnumerable<string> GetLogFiles()
|
||||
{
|
||||
if (!_diskProvider.FolderExists(_appFolderInfo.GetUpdateLogFolder())) return Enumerable.Empty<string>();
|
||||
if (!_diskProvider.FolderExists(_appFolderInfo.GetUpdateLogFolder()))
|
||||
{
|
||||
return Enumerable.Empty<string>();
|
||||
}
|
||||
|
||||
return _diskProvider.GetFiles(_appFolderInfo.GetUpdateLogFolder(), SearchOption.TopDirectoryOnly)
|
||||
.Where(f => Regex.IsMatch(Path.GetFileName(f), LOGFILE_ROUTE.TrimStart('/'), RegexOptions.IgnoreCase))
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NzbDrone.Core.MediaFiles.TrackImport.Manual;
|
||||
using NzbDrone.Core.Qualities;
|
||||
using Lidarr.Http.Extensions;
|
||||
using NzbDrone.Core.Music;
|
||||
using NLog;
|
||||
using Nancy;
|
||||
using Lidarr.Http;
|
||||
using Lidarr.Http.Extensions;
|
||||
using Nancy;
|
||||
using NLog;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.MediaFiles.TrackImport.Manual;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Qualities;
|
||||
|
||||
namespace Lidarr.Api.V1.ManualImport
|
||||
{
|
||||
|
@ -67,7 +67,8 @@ namespace Lidarr.Api.V1.ManualImport
|
|||
var items = new List<ManualImportItem>();
|
||||
foreach (var resource in resources)
|
||||
{
|
||||
items.Add(new ManualImportItem {
|
||||
items.Add(new ManualImportItem
|
||||
{
|
||||
Id = resource.Id,
|
||||
Path = resource.Path,
|
||||
RelativePath = resource.RelativePath,
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
using NzbDrone.Core.DecisionEngine;
|
||||
using NzbDrone.Core.MediaFiles.TrackImport.Manual;
|
||||
using NzbDrone.Core.Qualities;
|
||||
using Lidarr.Api.V1.Artist;
|
||||
using Lidarr.Api.V1.Albums;
|
||||
using Lidarr.Api.V1.Tracks;
|
||||
using Lidarr.Http.REST;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Lidarr.Api.V1.Albums;
|
||||
using Lidarr.Api.V1.Artist;
|
||||
using Lidarr.Api.V1.Tracks;
|
||||
using Lidarr.Http.REST;
|
||||
using NzbDrone.Core.DecisionEngine;
|
||||
using NzbDrone.Core.MediaFiles.TrackImport.Manual;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Qualities;
|
||||
|
||||
namespace Lidarr.Api.V1.ManualImport
|
||||
{
|
||||
|
@ -35,7 +35,10 @@ namespace Lidarr.Api.V1.ManualImport
|
|||
{
|
||||
public static ManualImportResource ToResource(this ManualImportItem model)
|
||||
{
|
||||
if (model == null) return null;
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new ManualImportResource
|
||||
{
|
||||
|
@ -49,6 +52,7 @@ namespace Lidarr.Api.V1.ManualImport
|
|||
AlbumReleaseId = model.Release?.Id ?? 0,
|
||||
Tracks = model.Tracks.ToResource(),
|
||||
Quality = model.Quality,
|
||||
|
||||
//QualityWeight
|
||||
DownloadId = model.DownloadId,
|
||||
Rejections = model.Rejections,
|
||||
|
|
|
@ -10,15 +10,16 @@ namespace Lidarr.Api.V1.MediaCovers
|
|||
{
|
||||
public class MediaCoverModule : LidarrV1Module
|
||||
{
|
||||
private static readonly Regex RegexResizedImage = new Regex(@"-\d+(?=\.(jpg|png|gif)$)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
|
||||
private const string MEDIA_COVER_ARTIST_ROUTE = @"/Artist/(?<artistId>\d+)/(?<filename>(.+)\.(jpg|png|gif))";
|
||||
private const string MEDIA_COVER_ALBUM_ROUTE = @"/Album/(?<artistId>\d+)/(?<filename>(.+)\.(jpg|png|gif))";
|
||||
|
||||
private static readonly Regex RegexResizedImage = new Regex(@"-\d+(?=\.(jpg|png|gif)$)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
|
||||
private readonly IAppFolderInfo _appFolderInfo;
|
||||
private readonly IDiskProvider _diskProvider;
|
||||
|
||||
public MediaCoverModule(IAppFolderInfo appFolderInfo, IDiskProvider diskProvider) : base("MediaCover")
|
||||
public MediaCoverModule(IAppFolderInfo appFolderInfo, IDiskProvider diskProvider)
|
||||
: base("MediaCover")
|
||||
{
|
||||
_appFolderInfo = appFolderInfo;
|
||||
_diskProvider = diskProvider;
|
||||
|
@ -40,6 +41,7 @@ namespace Lidarr.Api.V1.MediaCovers
|
|||
{
|
||||
return new NotFoundResponse();
|
||||
}
|
||||
|
||||
filePath = basefilePath;
|
||||
}
|
||||
|
||||
|
@ -59,6 +61,7 @@ namespace Lidarr.Api.V1.MediaCovers
|
|||
{
|
||||
return new NotFoundResponse();
|
||||
}
|
||||
|
||||
filePath = basefilePath;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,11 @@ namespace Lidarr.Api.V1.Metadata
|
|||
|
||||
protected override void Validate(MetadataDefinition definition, bool includeWarnings)
|
||||
{
|
||||
if (!definition.Enable) return;
|
||||
if (!definition.Enable)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
base.Validate(definition, includeWarnings);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,10 @@ namespace Lidarr.Api.V1.Metadata
|
|||
{
|
||||
public override MetadataResource ToResource(MetadataDefinition definition)
|
||||
{
|
||||
if (definition == null) return null;
|
||||
if (definition == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var resource = base.ToResource(definition);
|
||||
|
||||
|
@ -22,7 +25,10 @@ namespace Lidarr.Api.V1.Metadata
|
|||
|
||||
public override MetadataDefinition ToModel(MetadataResource resource)
|
||||
{
|
||||
if (resource == null) return null;
|
||||
if (resource == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var definition = base.ToModel(resource);
|
||||
|
||||
|
|
|
@ -13,7 +13,11 @@ namespace Lidarr.Api.V1.Notifications
|
|||
|
||||
protected override void Validate(NotificationDefinition definition, bool includeWarnings)
|
||||
{
|
||||
if (!definition.Enable) return;
|
||||
if (!definition.Enable)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
base.Validate(definition, includeWarnings);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,10 @@ namespace Lidarr.Api.V1.Notifications
|
|||
{
|
||||
public override NotificationResource ToResource(NotificationDefinition definition)
|
||||
{
|
||||
if (definition == null) return default(NotificationResource);
|
||||
if (definition == null)
|
||||
{
|
||||
return default(NotificationResource);
|
||||
}
|
||||
|
||||
var resource = base.ToResource(definition);
|
||||
|
||||
|
@ -56,7 +59,10 @@ namespace Lidarr.Api.V1.Notifications
|
|||
|
||||
public override NotificationDefinition ToModel(NotificationResource resource)
|
||||
{
|
||||
if (resource == null) return default(NotificationDefinition);
|
||||
if (resource == null)
|
||||
{
|
||||
return default(NotificationDefinition);
|
||||
}
|
||||
|
||||
var definition = base.ToModel(resource);
|
||||
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Parser;
|
||||
using Lidarr.Api.V1.Albums;
|
||||
using Lidarr.Api.V1.Artist;
|
||||
using Lidarr.Http;
|
||||
using NzbDrone.Core.Parser;
|
||||
|
||||
namespace Lidarr.Api.V1.Parse
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
using System.Collections.Generic;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using Lidarr.Api.V1.Albums;
|
||||
using Lidarr.Api.V1.Artist;
|
||||
using Lidarr.Http.REST;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
|
||||
namespace Lidarr.Api.V1.Parse
|
||||
{
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using FluentValidation;
|
||||
using FluentValidation.Results;
|
||||
using Nancy;
|
||||
using NzbDrone.Core.Profiles.Delay;
|
||||
using Lidarr.Http;
|
||||
using Lidarr.Http.Extensions;
|
||||
using Lidarr.Http.REST;
|
||||
using Lidarr.Http.Validation;
|
||||
using Nancy;
|
||||
using NzbDrone.Core.Profiles.Delay;
|
||||
|
||||
namespace Lidarr.Api.V1.Profiles.Delay
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Lidarr.Http.REST;
|
||||
using NzbDrone.Core.Indexers;
|
||||
using NzbDrone.Core.Profiles.Delay;
|
||||
using Lidarr.Http.REST;
|
||||
|
||||
namespace Lidarr.Api.V1.Profiles.Delay
|
||||
{
|
||||
|
@ -21,7 +21,10 @@ namespace Lidarr.Api.V1.Profiles.Delay
|
|||
{
|
||||
public static DelayProfileResource ToResource(this DelayProfile model)
|
||||
{
|
||||
if (model == null) return null;
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new DelayProfileResource
|
||||
{
|
||||
|
@ -39,7 +42,10 @@ namespace Lidarr.Api.V1.Profiles.Delay
|
|||
|
||||
public static DelayProfile ToModel(this DelayProfileResource resource)
|
||||
{
|
||||
if (resource == null) return null;
|
||||
if (resource == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new DelayProfile
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using System.Collections.Generic;
|
||||
using FluentValidation;
|
||||
using NzbDrone.Core.Profiles.Metadata;
|
||||
using Lidarr.Http;
|
||||
using NzbDrone.Core.Profiles.Metadata;
|
||||
|
||||
namespace Lidarr.Api.V1.Profiles.Metadata
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NzbDrone.Core.Profiles.Metadata;
|
||||
using Lidarr.Http.REST;
|
||||
using NzbDrone.Core.Profiles.Metadata;
|
||||
|
||||
namespace Lidarr.Api.V1.Profiles.Metadata
|
||||
{
|
||||
|
@ -35,7 +35,10 @@ namespace Lidarr.Api.V1.Profiles.Metadata
|
|||
{
|
||||
public static MetadataProfileResource ToResource(this MetadataProfile model)
|
||||
{
|
||||
if (model == null) return null;
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new MetadataProfileResource
|
||||
{
|
||||
|
@ -49,7 +52,10 @@ namespace Lidarr.Api.V1.Profiles.Metadata
|
|||
|
||||
public static ProfilePrimaryAlbumTypeItemResource ToResource(this ProfilePrimaryAlbumTypeItem model)
|
||||
{
|
||||
if (model == null) return null;
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new ProfilePrimaryAlbumTypeItemResource
|
||||
{
|
||||
|
@ -105,7 +111,10 @@ namespace Lidarr.Api.V1.Profiles.Metadata
|
|||
|
||||
public static ProfilePrimaryAlbumTypeItem ToModel(this ProfilePrimaryAlbumTypeItemResource resource)
|
||||
{
|
||||
if (resource == null) return null;
|
||||
if (resource == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new ProfilePrimaryAlbumTypeItem
|
||||
{
|
||||
|
@ -116,7 +125,10 @@ namespace Lidarr.Api.V1.Profiles.Metadata
|
|||
|
||||
public static ProfileSecondaryAlbumTypeItem ToModel(this ProfileSecondaryAlbumTypeItemResource resource)
|
||||
{
|
||||
if (resource == null) return null;
|
||||
if (resource == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new ProfileSecondaryAlbumTypeItem
|
||||
{
|
||||
|
@ -127,7 +139,10 @@ namespace Lidarr.Api.V1.Profiles.Metadata
|
|||
|
||||
public static ProfileReleaseStatusItem ToModel(this ProfileReleaseStatusItemResource resource)
|
||||
{
|
||||
if (resource == null) return null;
|
||||
if (resource == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new ProfileReleaseStatusItem
|
||||
{
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
using System.Linq;
|
||||
using NzbDrone.Core.Profiles.Metadata;
|
||||
using Lidarr.Http;
|
||||
using NzbDrone.Core.Profiles.Metadata;
|
||||
|
||||
namespace Lidarr.Api.V1.Profiles.Metadata
|
||||
{
|
||||
public class MetadataProfileSchemaModule : LidarrRestModule<MetadataProfileResource>
|
||||
{
|
||||
|
||||
public MetadataProfileSchemaModule()
|
||||
: base("/metadataprofile/schema")
|
||||
{
|
||||
|
|
|
@ -29,7 +29,6 @@ namespace Lidarr.Api.V1.Profiles.Metadata
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public class PrimaryTypeValidator<T> : PropertyValidator
|
||||
{
|
||||
public PrimaryTypeValidator()
|
||||
|
|
|
@ -18,7 +18,6 @@ namespace Lidarr.Api.V1.Profiles.Quality
|
|||
public ValidCutoffValidator()
|
||||
: base("Cutoff must be an allowed quality or group")
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override bool IsValid(PropertyValidatorContext context)
|
||||
|
|
|
@ -26,7 +26,6 @@ namespace Lidarr.Api.V1.Profiles.Quality
|
|||
public AllowedValidator()
|
||||
: base("Must contain at least one allowed quality")
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override bool IsValid(PropertyValidatorContext context)
|
||||
|
@ -52,7 +51,6 @@ namespace Lidarr.Api.V1.Profiles.Quality
|
|||
public GroupItemValidator()
|
||||
: base("Groups must contain multiple qualities")
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override bool IsValid(PropertyValidatorContext context)
|
||||
|
@ -73,7 +71,6 @@ namespace Lidarr.Api.V1.Profiles.Quality
|
|||
public QualityNameValidator()
|
||||
: base("Individual qualities should not be named")
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override bool IsValid(PropertyValidatorContext context)
|
||||
|
@ -94,7 +91,6 @@ namespace Lidarr.Api.V1.Profiles.Quality
|
|||
public ItemGroupNameValidator()
|
||||
: base("Groups must have a name")
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override bool IsValid(PropertyValidatorContext context)
|
||||
|
@ -115,7 +111,6 @@ namespace Lidarr.Api.V1.Profiles.Quality
|
|||
public ItemGroupIdValidator()
|
||||
: base("Groups must have an ID")
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override bool IsValid(PropertyValidatorContext context)
|
||||
|
@ -136,7 +131,6 @@ namespace Lidarr.Api.V1.Profiles.Quality
|
|||
public UniqueIdValidator()
|
||||
: base("Groups must have a unique ID")
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override bool IsValid(PropertyValidatorContext context)
|
||||
|
@ -157,7 +151,6 @@ namespace Lidarr.Api.V1.Profiles.Quality
|
|||
public UniqueQualityIdValidator()
|
||||
: base("Qualities can only be used once")
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override bool IsValid(PropertyValidatorContext context)
|
||||
|
@ -179,7 +172,6 @@ namespace Lidarr.Api.V1.Profiles.Quality
|
|||
qualityIds.Add(quality.Quality.Id);
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if (qualityIds.Contains(item.Quality.Id))
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using System.Collections.Generic;
|
||||
using FluentValidation;
|
||||
using NzbDrone.Core.Profiles.Qualities;
|
||||
using Lidarr.Http;
|
||||
using NzbDrone.Core.Profiles.Qualities;
|
||||
|
||||
namespace Lidarr.Api.V1.Profiles.Quality
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NzbDrone.Core.Profiles.Qualities;
|
||||
using Lidarr.Http.REST;
|
||||
using NzbDrone.Core.Profiles.Qualities;
|
||||
|
||||
namespace Lidarr.Api.V1.Profiles.Quality
|
||||
{
|
||||
|
@ -30,7 +30,10 @@ namespace Lidarr.Api.V1.Profiles.Quality
|
|||
{
|
||||
public static QualityProfileResource ToResource(this QualityProfile model)
|
||||
{
|
||||
if (model == null) return null;
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new QualityProfileResource
|
||||
{
|
||||
|
@ -44,7 +47,10 @@ namespace Lidarr.Api.V1.Profiles.Quality
|
|||
|
||||
public static QualityProfileQualityItemResource ToResource(this QualityProfileQualityItem model)
|
||||
{
|
||||
if (model == null) return null;
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new QualityProfileQualityItemResource
|
||||
{
|
||||
|
@ -58,7 +64,10 @@ namespace Lidarr.Api.V1.Profiles.Quality
|
|||
|
||||
public static QualityProfile ToModel(this QualityProfileResource resource)
|
||||
{
|
||||
if (resource == null) return null;
|
||||
if (resource == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new QualityProfile
|
||||
{
|
||||
|
@ -72,7 +81,10 @@ namespace Lidarr.Api.V1.Profiles.Quality
|
|||
|
||||
public static QualityProfileQualityItem ToModel(this QualityProfileQualityItemResource resource)
|
||||
{
|
||||
if (resource == null) return null;
|
||||
if (resource == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new QualityProfileQualityItem
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
using NzbDrone.Core.Profiles.Qualities;
|
||||
using Lidarr.Http;
|
||||
using NzbDrone.Core.Profiles.Qualities;
|
||||
|
||||
namespace Lidarr.Api.V1.Profiles.Quality
|
||||
{
|
||||
|
@ -18,7 +18,6 @@ namespace Lidarr.Api.V1.Profiles.Quality
|
|||
{
|
||||
QualityProfile qualityProfile = _profileService.GetDefaultProfile(string.Empty);
|
||||
|
||||
|
||||
return qualityProfile.ToResource();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
using System.Collections.Generic;
|
||||
using FluentValidation;
|
||||
using Lidarr.Http;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Profiles.Releases;
|
||||
using Lidarr.Http;
|
||||
|
||||
namespace Lidarr.Api.V1.Profiles.Release
|
||||
{
|
||||
|
@ -10,7 +10,6 @@ namespace Lidarr.Api.V1.Profiles.Release
|
|||
{
|
||||
private readonly IReleaseProfileService _releaseProfileService;
|
||||
|
||||
|
||||
public ReleaseProfileModule(IReleaseProfileService releaseProfileService)
|
||||
{
|
||||
_releaseProfileService = releaseProfileService;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NzbDrone.Core.Profiles.Releases;
|
||||
using Lidarr.Http.REST;
|
||||
using NzbDrone.Core.Profiles.Releases;
|
||||
|
||||
namespace Lidarr.Api.V1.Profiles.Release
|
||||
{
|
||||
|
@ -23,7 +23,10 @@ namespace Lidarr.Api.V1.Profiles.Release
|
|||
{
|
||||
public static ReleaseProfileResource ToResource(this ReleaseProfile model)
|
||||
{
|
||||
if (model == null) return null;
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new ReleaseProfileResource
|
||||
{
|
||||
|
@ -39,7 +42,10 @@ namespace Lidarr.Api.V1.Profiles.Release
|
|||
|
||||
public static ReleaseProfile ToModel(this ReleaseProfileResource resource)
|
||||
{
|
||||
if (resource == null) return null;
|
||||
if (resource == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new ReleaseProfile
|
||||
{
|
||||
|
|
|
@ -2,13 +2,11 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using FluentValidation;
|
||||
using FluentValidation.Results;
|
||||
using Lidarr.Http;
|
||||
using Nancy;
|
||||
using Newtonsoft.Json;
|
||||
using NzbDrone.Common.Serializer;
|
||||
using NzbDrone.Core.ThingiProvider;
|
||||
using NzbDrone.Core.Validation;
|
||||
using Lidarr.Http;
|
||||
using Lidarr.Http.Extensions;
|
||||
|
||||
namespace Lidarr.Api.V1
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
using System.Collections.Generic;
|
||||
using NzbDrone.Common.Reflection;
|
||||
using NzbDrone.Core.ThingiProvider;
|
||||
using Lidarr.Http.ClientSchema;
|
||||
using Lidarr.Http.REST;
|
||||
using NzbDrone.Common.Reflection;
|
||||
using NzbDrone.Core.ThingiProvider;
|
||||
|
||||
namespace Lidarr.Api.V1
|
||||
{
|
||||
|
@ -25,7 +25,6 @@ namespace Lidarr.Api.V1
|
|||
where TProviderDefinition : ProviderDefinition, new()
|
||||
{
|
||||
public virtual TProviderResource ToResource(TProviderDefinition definition)
|
||||
|
||||
{
|
||||
return new TProviderResource
|
||||
{
|
||||
|
@ -47,7 +46,10 @@ namespace Lidarr.Api.V1
|
|||
|
||||
public virtual TProviderDefinition ToModel(TProviderResource resource)
|
||||
{
|
||||
if (resource == null) return default(TProviderDefinition);
|
||||
if (resource == null)
|
||||
{
|
||||
return default(TProviderDefinition);
|
||||
}
|
||||
|
||||
var definition = new TProviderDefinition
|
||||
{
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Nancy;
|
||||
using NzbDrone.Core.Qualities;
|
||||
using Lidarr.Http;
|
||||
using Lidarr.Http.Extensions;
|
||||
using Nancy;
|
||||
using NzbDrone.Core.Qualities;
|
||||
|
||||
namespace Lidarr.Api.V1.Qualities
|
||||
{
|
||||
|
@ -47,8 +47,8 @@ namespace Lidarr.Api.V1.Qualities
|
|||
_qualityDefinitionService.UpdateMany(qualityDefinitions);
|
||||
|
||||
return ResponseWithCode(_qualityDefinitionService.All()
|
||||
.ToResource()
|
||||
, HttpStatusCode.Accepted);
|
||||
.ToResource(),
|
||||
HttpStatusCode.Accepted);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NzbDrone.Core.Qualities;
|
||||
using Lidarr.Http.REST;
|
||||
using NzbDrone.Core.Qualities;
|
||||
|
||||
namespace Lidarr.Api.V1.Qualities
|
||||
{
|
||||
|
@ -21,7 +21,10 @@ namespace Lidarr.Api.V1.Qualities
|
|||
{
|
||||
public static QualityDefinitionResource ToResource(this QualityDefinition model)
|
||||
{
|
||||
if (model == null) return null;
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new QualityDefinitionResource
|
||||
{
|
||||
|
@ -36,7 +39,10 @@ namespace Lidarr.Api.V1.Qualities
|
|||
|
||||
public static QualityDefinition ToModel(this QualityDefinitionResource resource)
|
||||
{
|
||||
if (resource == null) return null;
|
||||
if (resource == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new QualityDefinition
|
||||
{
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Lidarr.Http;
|
||||
using Lidarr.Http.Extensions;
|
||||
using Lidarr.Http.REST;
|
||||
using Nancy;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.Download.Pending;
|
||||
using NzbDrone.Core.Download.TrackedDownloads;
|
||||
using NzbDrone.Core.Queue;
|
||||
using Lidarr.Http;
|
||||
using Lidarr.Http.Extensions;
|
||||
using Lidarr.Http.REST;
|
||||
|
||||
namespace Lidarr.Api.V1.Queue
|
||||
{
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Lidarr.Http;
|
||||
using Lidarr.Http.Extensions;
|
||||
using NzbDrone.Core.Datastore.Events;
|
||||
using NzbDrone.Core.Download.Pending;
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
using NzbDrone.Core.Queue;
|
||||
using NzbDrone.SignalR;
|
||||
using Lidarr.Http;
|
||||
using Lidarr.Http.Extensions;
|
||||
|
||||
namespace Lidarr.Api.V1.Queue
|
||||
{
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using Lidarr.Http;
|
||||
using Lidarr.Http.Extensions;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.Datastore.Events;
|
||||
using NzbDrone.Core.Download.Pending;
|
||||
|
@ -10,8 +11,6 @@ using NzbDrone.Core.Profiles.Qualities;
|
|||
using NzbDrone.Core.Qualities;
|
||||
using NzbDrone.Core.Queue;
|
||||
using NzbDrone.SignalR;
|
||||
using Lidarr.Http;
|
||||
using Lidarr.Http.Extensions;
|
||||
|
||||
namespace Lidarr.Api.V1.Queue
|
||||
{
|
||||
|
@ -21,7 +20,7 @@ namespace Lidarr.Api.V1.Queue
|
|||
private readonly IQueueService _queueService;
|
||||
private readonly IPendingReleaseService _pendingReleaseService;
|
||||
|
||||
private readonly QualityModelComparer QUALITY_COMPARER;
|
||||
private readonly QualityModelComparer _qualityComparer;
|
||||
|
||||
public QueueModule(IBroadcastSignalRMessage broadcastSignalRMessage,
|
||||
IQueueService queueService,
|
||||
|
@ -33,7 +32,7 @@ namespace Lidarr.Api.V1.Queue
|
|||
_pendingReleaseService = pendingReleaseService;
|
||||
GetResourcePaged = GetQueue;
|
||||
|
||||
QUALITY_COMPARER = new QualityModelComparer(qualityProfileService.GetDefaultProfile(string.Empty));
|
||||
_qualityComparer = new QualityModelComparer(qualityProfileService.GetDefaultProfile(string.Empty));
|
||||
}
|
||||
|
||||
private PagingResource<QueueResource> GetQueue(PagingResource<QueueResource> pagingResource)
|
||||
|
@ -63,7 +62,6 @@ namespace Lidarr.Api.V1.Queue
|
|||
? fullQueue.OrderBy(q => q.Timeleft, new TimeleftComparer())
|
||||
: fullQueue.OrderByDescending(q => q.Timeleft, new TimeleftComparer());
|
||||
}
|
||||
|
||||
else if (pagingSpec.SortKey == "estimatedCompletionTime")
|
||||
{
|
||||
ordered = ascending
|
||||
|
@ -71,41 +69,36 @@ namespace Lidarr.Api.V1.Queue
|
|||
: fullQueue.OrderByDescending(q => q.EstimatedCompletionTime,
|
||||
new EstimatedCompletionTimeComparer());
|
||||
}
|
||||
|
||||
else if (pagingSpec.SortKey == "protocol")
|
||||
{
|
||||
ordered = ascending
|
||||
? fullQueue.OrderBy(q => q.Protocol)
|
||||
: fullQueue.OrderByDescending(q => q.Protocol);
|
||||
}
|
||||
|
||||
else if (pagingSpec.SortKey == "indexer")
|
||||
{
|
||||
ordered = ascending
|
||||
? fullQueue.OrderBy(q => q.Indexer, StringComparer.InvariantCultureIgnoreCase)
|
||||
: fullQueue.OrderByDescending(q => q.Indexer, StringComparer.InvariantCultureIgnoreCase);
|
||||
}
|
||||
|
||||
else if (pagingSpec.SortKey == "downloadClient")
|
||||
{
|
||||
ordered = ascending
|
||||
? fullQueue.OrderBy(q => q.DownloadClient, StringComparer.InvariantCultureIgnoreCase)
|
||||
: fullQueue.OrderByDescending(q => q.DownloadClient, StringComparer.InvariantCultureIgnoreCase);
|
||||
}
|
||||
|
||||
else if (pagingSpec.SortKey == "quality")
|
||||
{
|
||||
ordered = ascending
|
||||
? fullQueue.OrderBy(q => q.Quality, QUALITY_COMPARER)
|
||||
: fullQueue.OrderByDescending(q => q.Quality, QUALITY_COMPARER);
|
||||
? fullQueue.OrderBy(q => q.Quality, _qualityComparer)
|
||||
: fullQueue.OrderByDescending(q => q.Quality, _qualityComparer);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
ordered = ascending ? fullQueue.OrderBy(orderByFunc) : fullQueue.OrderByDescending(orderByFunc);
|
||||
}
|
||||
|
||||
ordered = ordered.ThenByDescending(q => q.Size == 0 ? 0 : 100 - q.Sizeleft / q.Size * 100);
|
||||
ordered = ordered.ThenByDescending(q => q.Size == 0 ? 0 : 100 - (q.Sizeleft / q.Size * 100));
|
||||
|
||||
pagingSpec.Records = ordered.Skip((pagingSpec.Page - 1) * pagingSpec.PageSize).Take(pagingSpec.PageSize).ToList();
|
||||
pagingSpec.TotalRecords = fullQueue.Count;
|
||||
|
@ -119,7 +112,7 @@ namespace Lidarr.Api.V1.Queue
|
|||
return pagingSpec;
|
||||
}
|
||||
|
||||
private Func<NzbDrone.Core.Queue.Queue, Object> GetOrderByFunc(PagingSpec<NzbDrone.Core.Queue.Queue> pagingSpec)
|
||||
private Func<NzbDrone.Core.Queue.Queue, object> GetOrderByFunc(PagingSpec<NzbDrone.Core.Queue.Queue> pagingSpec)
|
||||
{
|
||||
switch (pagingSpec.SortKey)
|
||||
{
|
||||
|
@ -139,7 +132,7 @@ namespace Lidarr.Api.V1.Queue
|
|||
return q => q.Quality;
|
||||
case "progress":
|
||||
// Avoid exploding if a download's size is 0
|
||||
return q => 100 - q.Sizeleft / Math.Max(q.Size * 100, 1);
|
||||
return q => 100 - (q.Sizeleft / Math.Max(q.Size * 100, 1));
|
||||
default:
|
||||
return q => q.Timeleft;
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NzbDrone.Core.Download.TrackedDownloads;
|
||||
using NzbDrone.Core.Indexers;
|
||||
using NzbDrone.Core.Qualities;
|
||||
using Lidarr.Api.V1.Albums;
|
||||
using Lidarr.Api.V1.Artist;
|
||||
using Lidarr.Http.REST;
|
||||
using NzbDrone.Core.Download.TrackedDownloads;
|
||||
using NzbDrone.Core.Indexers;
|
||||
using NzbDrone.Core.Qualities;
|
||||
|
||||
namespace Lidarr.Api.V1.Queue
|
||||
{
|
||||
|
@ -38,7 +38,10 @@ namespace Lidarr.Api.V1.Queue
|
|||
{
|
||||
public static QueueResource ToResource(this NzbDrone.Core.Queue.Queue model, bool includeArtist, bool includeAlbum)
|
||||
{
|
||||
if (model == null) return null;
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new QueueResource
|
||||
{
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using Lidarr.Http;
|
||||
using NzbDrone.Common.TPL;
|
||||
using NzbDrone.Core.Datastore.Events;
|
||||
using NzbDrone.Core.Download.Pending;
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
using NzbDrone.Core.Queue;
|
||||
using NzbDrone.SignalR;
|
||||
using Lidarr.Http;
|
||||
|
||||
namespace Lidarr.Api.V1.Queue
|
||||
{
|
||||
|
@ -17,7 +17,6 @@ namespace Lidarr.Api.V1.Queue
|
|||
private readonly IPendingReleaseService _pendingReleaseService;
|
||||
private readonly Debouncer _broadcastDebounce;
|
||||
|
||||
|
||||
public QueueStatusModule(IBroadcastSignalRMessage broadcastSignalRMessage, IQueueService queueService, IPendingReleaseService pendingReleaseService)
|
||||
: base(broadcastSignalRMessage, "queue/status")
|
||||
{
|
||||
|
@ -26,7 +25,6 @@ namespace Lidarr.Api.V1.Queue
|
|||
|
||||
_broadcastDebounce = new Debouncer(BroadcastChange, TimeSpan.FromSeconds(5));
|
||||
|
||||
|
||||
Get("/", x => GetQueueStatusResponse());
|
||||
}
|
||||
|
||||
|
@ -72,7 +70,5 @@ namespace Lidarr.Api.V1.Queue
|
|||
{
|
||||
_broadcastDebounce.Execute();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
using System.Collections.Generic;
|
||||
using FluentValidation;
|
||||
using Lidarr.Http;
|
||||
using NzbDrone.Core.RemotePathMappings;
|
||||
using NzbDrone.Core.Validation.Paths;
|
||||
using Lidarr.Http;
|
||||
|
||||
namespace Lidarr.Api.V1.RemotePathMappings
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NzbDrone.Core.RemotePathMappings;
|
||||
using Lidarr.Http.REST;
|
||||
using NzbDrone.Core.RemotePathMappings;
|
||||
|
||||
namespace Lidarr.Api.V1.RemotePathMappings
|
||||
{
|
||||
|
@ -16,7 +16,10 @@ namespace Lidarr.Api.V1.RemotePathMappings
|
|||
{
|
||||
public static RemotePathMappingResource ToResource(this RemotePathMapping model)
|
||||
{
|
||||
if (model == null) return null;
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new RemotePathMappingResource
|
||||
{
|
||||
|
@ -30,7 +33,10 @@ namespace Lidarr.Api.V1.RemotePathMappings
|
|||
|
||||
public static RemotePathMapping ToModel(this RemotePathMappingResource resource)
|
||||
{
|
||||
if (resource == null) return null;
|
||||
if (resource == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new RemotePathMapping
|
||||
{
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
using System.Collections.Generic;
|
||||
using FluentValidation;
|
||||
using Lidarr.Http;
|
||||
using NzbDrone.Core.RootFolders;
|
||||
using NzbDrone.Core.Validation.Paths;
|
||||
using NzbDrone.SignalR;
|
||||
using Lidarr.Http;
|
||||
|
||||
namespace Lidarr.Api.V1.RootFolders
|
||||
{
|
||||
|
@ -18,8 +18,7 @@ namespace Lidarr.Api.V1.RootFolders
|
|||
MappedNetworkDriveValidator mappedNetworkDriveValidator,
|
||||
StartupFolderValidator startupFolderValidator,
|
||||
SystemFolderValidator systemFolderValidator,
|
||||
FolderWritableValidator folderWritableValidator
|
||||
)
|
||||
FolderWritableValidator folderWritableValidator)
|
||||
: base(signalRBroadcaster)
|
||||
{
|
||||
_rootFolderService = rootFolderService;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NzbDrone.Core.RootFolders;
|
||||
using Lidarr.Http.REST;
|
||||
using NzbDrone.Core.RootFolders;
|
||||
|
||||
namespace Lidarr.Api.V1.RootFolders
|
||||
{
|
||||
|
@ -19,7 +19,10 @@ namespace Lidarr.Api.V1.RootFolders
|
|||
{
|
||||
public static RootFolderResource ToResource(this RootFolder model)
|
||||
{
|
||||
if (model == null) return null;
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new RootFolderResource
|
||||
{
|
||||
|
@ -35,13 +38,17 @@ namespace Lidarr.Api.V1.RootFolders
|
|||
|
||||
public static RootFolder ToModel(this RootFolderResource resource)
|
||||
{
|
||||
if (resource == null) return null;
|
||||
if (resource == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new RootFolder
|
||||
{
|
||||
Id = resource.Id,
|
||||
|
||||
Path = resource.Path,
|
||||
|
||||
//Accessible
|
||||
//FreeSpace
|
||||
//UnmappedFolders
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Lidarr.Api.V1.Albums;
|
||||
using Lidarr.Api.V1.Artist;
|
||||
using Lidarr.Http;
|
||||
using Nancy;
|
||||
using NzbDrone.Core.MediaCover;
|
||||
using NzbDrone.Core.MetadataSource;
|
||||
using Lidarr.Http;
|
||||
using Lidarr.Api.V1.Artist;
|
||||
using Lidarr.Api.V1.Albums;
|
||||
using System;
|
||||
|
||||
namespace Lidarr.Api.V1.Search
|
||||
{
|
||||
|
@ -27,7 +27,7 @@ namespace Lidarr.Api.V1.Search
|
|||
return MapToResource(searchResults).ToList();
|
||||
}
|
||||
|
||||
private static IEnumerable<SearchResource> MapToResource(IEnumerable<Object> results)
|
||||
private static IEnumerable<SearchResource> MapToResource(IEnumerable<object> results)
|
||||
{
|
||||
int id = 1;
|
||||
foreach (var result in results)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
using Lidarr.Http.REST;
|
||||
using Lidarr.Api.V1.Artist;
|
||||
using Lidarr.Api.V1.Albums;
|
||||
using Lidarr.Api.V1.Artist;
|
||||
using Lidarr.Http.REST;
|
||||
|
||||
namespace Lidarr.Api.V1.Search
|
||||
{
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Nancy;
|
||||
using Lidarr.Http;
|
||||
using Lidarr.Http.REST;
|
||||
using NzbDrone.Common.Crypto;
|
||||
using NzbDrone.Common.Disk;
|
||||
using NzbDrone.Common.EnvironmentInfo;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Backup;
|
||||
using Lidarr.Http;
|
||||
using Lidarr.Http.Extensions;
|
||||
using Lidarr.Http.REST;
|
||||
|
||||
namespace Lidarr.Api.V1.System.Backup
|
||||
{
|
||||
|
@ -118,7 +116,6 @@ namespace Lidarr.Api.V1.System.Backup
|
|||
private string GetBackupPath(NzbDrone.Core.Backup.Backup backup)
|
||||
{
|
||||
return Path.Combine(_backupService.GetBackupFolder(backup.Type), backup.Name);
|
||||
|
||||
}
|
||||
|
||||
private int GetBackupId(NzbDrone.Core.Backup.Backup backup)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
using System;
|
||||
using NzbDrone.Core.Backup;
|
||||
using Lidarr.Http.REST;
|
||||
using NzbDrone.Core.Backup;
|
||||
|
||||
namespace Lidarr.Api.V1.System.Backup
|
||||
{
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue