mirror of
https://github.com/Radarr/Radarr
synced 2025-03-14 16:09:37 +00:00
Merged branch develop into develop
This commit is contained in:
commit
d22d5fcfc3
7 changed files with 82 additions and 32 deletions
|
@ -20,7 +20,7 @@ namespace NzbDrone.Core.Indexers.HDBits
|
|||
|
||||
public int[] Medium { get; set; }
|
||||
|
||||
public int[] Origin { get; set; }
|
||||
public int Origin { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "imdb")]
|
||||
public ImdbInfo ImdbInfo { get; set; }
|
||||
|
|
13
src/NzbDrone.Core/Indexers/HDBits/HDBitsInfo.cs
Normal file
13
src/NzbDrone.Core/Indexers/HDBits/HDBitsInfo.cs
Normal file
|
@ -0,0 +1,13 @@
|
|||
using NzbDrone.Core.Parser.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace NzbDrone.Core.Indexers.HDBits
|
||||
{
|
||||
public class HDBitsInfo : TorrentInfo
|
||||
{
|
||||
public bool? Internal { get; set; }
|
||||
}
|
||||
}
|
|
@ -5,6 +5,7 @@ using Newtonsoft.Json.Linq;
|
|||
using NzbDrone.Common.Http;
|
||||
using NzbDrone.Core.Indexers.Exceptions;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using System.Linq;
|
||||
|
||||
namespace NzbDrone.Core.Indexers.HDBits
|
||||
{
|
||||
|
@ -50,7 +51,7 @@ namespace NzbDrone.Core.Indexers.HDBits
|
|||
foreach (var result in queryResults)
|
||||
{
|
||||
var id = result.Id;
|
||||
torrentInfos.Add(new TorrentInfo()
|
||||
torrentInfos.Add(new HDBitsInfo()
|
||||
{
|
||||
Guid = string.Format("HDBits-{0}", id),
|
||||
Title = result.Name,
|
||||
|
@ -60,11 +61,25 @@ namespace NzbDrone.Core.Indexers.HDBits
|
|||
InfoUrl = GetInfoUrl(id),
|
||||
Seeders = result.Seeders,
|
||||
Peers = result.Leechers + result.Seeders,
|
||||
PublishDate = result.Added.ToUniversalTime()
|
||||
PublishDate = result.Added.ToUniversalTime(),
|
||||
Internal = (result.TypeOrigin == 1 ? true : false)
|
||||
});
|
||||
}
|
||||
|
||||
return torrentInfos.ToArray();
|
||||
// order by internal
|
||||
if (_settings.PreferInternal)
|
||||
{
|
||||
return
|
||||
torrentInfos.OrderByDescending(o => o.PublishDate)
|
||||
.ThenBy(o => ((dynamic)o).Internal ? 0 : 1)
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
// order by date
|
||||
return
|
||||
torrentInfos
|
||||
.OrderByDescending(o => o.PublishDate)
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
private string GetDownloadUrl(string torrentId)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NzbDrone.Common.Http;
|
||||
using NzbDrone.Common.Serializer;
|
||||
|
@ -13,37 +13,10 @@ namespace NzbDrone.Core.Indexers.HDBits
|
|||
public virtual IndexerPageableRequestChain GetRecentRequests()
|
||||
{
|
||||
var pageableRequests = new IndexerPageableRequestChain();
|
||||
|
||||
pageableRequests.Add(GetRequest(new TorrentQuery()));
|
||||
|
||||
return pageableRequests;
|
||||
}
|
||||
|
||||
public virtual IndexerPageableRequestChain GetSearchRequests(AnimeEpisodeSearchCriteria searchCriteria)
|
||||
{
|
||||
return new IndexerPageableRequestChain();
|
||||
}
|
||||
|
||||
public virtual IndexerPageableRequestChain GetSearchRequests(SpecialEpisodeSearchCriteria searchCriteria)
|
||||
{
|
||||
return new IndexerPageableRequestChain();
|
||||
}
|
||||
|
||||
public virtual IndexerPageableRequestChain GetSearchRequests(DailyEpisodeSearchCriteria searchCriteria)
|
||||
{
|
||||
return new IndexerPageableRequestChain();
|
||||
}
|
||||
|
||||
public virtual IndexerPageableRequestChain GetSearchRequests(SeasonSearchCriteria searchCriteria)
|
||||
{
|
||||
return new IndexerPageableRequestChain();
|
||||
}
|
||||
|
||||
public virtual IndexerPageableRequestChain GetSearchRequests(SingleEpisodeSearchCriteria searchCriteria)
|
||||
{
|
||||
return new IndexerPageableRequestChain();
|
||||
}
|
||||
|
||||
public virtual IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
|
||||
{
|
||||
var pageableRequests = new IndexerPageableRequestChain();
|
||||
|
@ -86,9 +59,40 @@ namespace NzbDrone.Core.Indexers.HDBits
|
|||
query.Username = Settings.Username;
|
||||
query.Passkey = Settings.ApiKey;
|
||||
|
||||
// Require Internal only if came from RSS sync
|
||||
if (Settings.RequireInternal && query.ImdbInfo == null)
|
||||
{
|
||||
query.Origin = 1;
|
||||
}
|
||||
|
||||
request.SetContent(query.ToJson());
|
||||
|
||||
yield return new IndexerRequest(request);
|
||||
}
|
||||
|
||||
public virtual IndexerPageableRequestChain GetSearchRequests(AnimeEpisodeSearchCriteria searchCriteria)
|
||||
{
|
||||
return new IndexerPageableRequestChain();
|
||||
}
|
||||
|
||||
public virtual IndexerPageableRequestChain GetSearchRequests(SpecialEpisodeSearchCriteria searchCriteria)
|
||||
{
|
||||
return new IndexerPageableRequestChain();
|
||||
}
|
||||
|
||||
public virtual IndexerPageableRequestChain GetSearchRequests(DailyEpisodeSearchCriteria searchCriteria)
|
||||
{
|
||||
return new IndexerPageableRequestChain();
|
||||
}
|
||||
|
||||
public virtual IndexerPageableRequestChain GetSearchRequests(SeasonSearchCriteria searchCriteria)
|
||||
{
|
||||
return new IndexerPageableRequestChain();
|
||||
}
|
||||
|
||||
public virtual IndexerPageableRequestChain GetSearchRequests(SingleEpisodeSearchCriteria searchCriteria)
|
||||
{
|
||||
return new IndexerPageableRequestChain();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -32,6 +32,12 @@ namespace NzbDrone.Core.Indexers.HDBits
|
|||
[FieldDefinition(2, Label = "API URL", Advanced = true, HelpText = "Do not change this unless you know what you're doing. Since your API key will be sent to that host.")]
|
||||
public string BaseUrl { get; set; }
|
||||
|
||||
[FieldDefinition(3, Label = "Prefer Internal", Type = FieldType.Checkbox, HelpText = "Favors Internal releases over all other releases.")]
|
||||
public bool PreferInternal { get; set; }
|
||||
|
||||
[FieldDefinition(4, Label = "Require Internal", Type = FieldType.Checkbox, HelpText = "Require Internal releases for release to be accepted.")]
|
||||
public bool RequireInternal { get; set; }
|
||||
|
||||
public NzbDroneValidationResult Validate()
|
||||
{
|
||||
return new NzbDroneValidationResult(Validator.Validate(this));
|
||||
|
|
|
@ -129,6 +129,7 @@
|
|||
<Compile Include="Datastore\Migration\130_remove_wombles_kickass.cs" />
|
||||
<Compile Include="Datastore\Migration\132_rename_torrent_downloadstation.cs" />
|
||||
<Compile Include="Datastore\Migration\133_add_minimumavailability.cs" />
|
||||
<Compile Include="Indexers\HDBits\HDBitsInfo.cs" />
|
||||
<Compile Include="NetImport\TMDb\TMDbLanguageCodes.cs" />
|
||||
<Compile Include="NetImport\TMDb\TMDbSettings.cs" />
|
||||
<Compile Include="NetImport\TMDb\TMDbListType.cs" />
|
||||
|
|
|
@ -13,6 +13,7 @@ using NzbDrone.Core.Tv.Events;
|
|||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.MediaFiles.Events;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.Configuration;
|
||||
|
||||
namespace NzbDrone.Core.Tv
|
||||
{
|
||||
|
@ -46,6 +47,7 @@ namespace NzbDrone.Core.Tv
|
|||
IHandle<MovieFileDeletedEvent>
|
||||
{
|
||||
private readonly IMovieRepository _movieRepository;
|
||||
private readonly IConfigService _configService;
|
||||
private readonly IEventAggregator _eventAggregator;
|
||||
private readonly IBuildFileNames _fileNameBuilder;
|
||||
private readonly Logger _logger;
|
||||
|
@ -55,11 +57,13 @@ namespace NzbDrone.Core.Tv
|
|||
ISceneMappingService sceneMappingService,
|
||||
IEpisodeService episodeService,
|
||||
IBuildFileNames fileNameBuilder,
|
||||
IConfigService configService,
|
||||
Logger logger)
|
||||
{
|
||||
_movieRepository = movieRepository;
|
||||
_eventAggregator = eventAggregator;
|
||||
_fileNameBuilder = fileNameBuilder;
|
||||
_configService = configService;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
|
@ -297,8 +301,15 @@ namespace NzbDrone.Core.Tv
|
|||
|
||||
public void Handle(MovieFileDeletedEvent message)
|
||||
{
|
||||
|
||||
var movie = _movieRepository.GetMoviesByFileId(message.MovieFile.Id).First();
|
||||
movie.MovieFileId = 0;
|
||||
_logger.Debug("Detaching movie {0} from file.", movie.Id);
|
||||
|
||||
if (message.Reason != DeleteMediaFileReason.Upgrade && _configService.AutoUnmonitorPreviouslyDownloadedEpisodes)
|
||||
{
|
||||
movie.Monitored = false;
|
||||
}
|
||||
|
||||
UpdateMovie(movie);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue