mirror of
https://github.com/Radarr/Radarr.git
synced 2026-03-17 16:14:46 -04:00
Compare commits
39 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f1914082b8 | ||
|
|
6016948329 | ||
|
|
708db1a75c | ||
|
|
994e881ba6 | ||
|
|
893e20c27b | ||
|
|
23aace6149 | ||
|
|
e774e6a038 | ||
|
|
f19a1a5960 | ||
|
|
03156d62f6 | ||
|
|
04d01dc781 | ||
|
|
cfae8807aa | ||
|
|
f90e77987e | ||
|
|
2ed0738b30 | ||
|
|
74c5664a7f | ||
|
|
4c9abe3d84 | ||
|
|
7a45394820 | ||
|
|
588a48e65d | ||
|
|
83453e2464 | ||
|
|
e6809585c9 | ||
|
|
14bf63e21d | ||
|
|
b5d932866a | ||
|
|
0b8a84a57c | ||
|
|
3555b4ce20 | ||
|
|
8cad976e7f | ||
|
|
ad7b6a8ec2 | ||
|
|
906ecfb6a1 | ||
|
|
03cc3a1ad2 | ||
|
|
d62dbd48ae | ||
|
|
cb12945270 | ||
|
|
af74854b8e | ||
|
|
f35fae109b | ||
|
|
804b2130a8 | ||
|
|
49537a2efe | ||
|
|
1dfb4ddcd8 | ||
|
|
fb7969e046 | ||
|
|
cd4863b974 | ||
|
|
55f4a81dee | ||
|
|
d006df8d7c | ||
|
|
1ebd639e36 |
@@ -1,4 +1,9 @@
|
||||
# Radarr [](https://travis-ci.org/galli-leo/Radarr)#
|
||||
# Radarr
|
||||
|
||||
| Service | Master | Develop |
|
||||
|----------|:---------------------------:|:----------------------------:|
|
||||
| AppVeyor | [](https://ci.appveyor.com/project/galli-leo/Radarr) | [](https://ci.appveyor.com/project/galli-leo/Radarr) |
|
||||
| Travis | [](https://travis-ci.org/galli-leo/Radarr) | [](https://travis-ci.org/galli-leo/Radarr) |
|
||||
|
||||
This fork of Sonarr aims to turn it into something like Couchpotato.
|
||||
|
||||
|
||||
@@ -107,8 +107,8 @@ namespace NzbDrone.Api.Indexers
|
||||
ReleaseGroup = parsedMovieInfo.ReleaseGroup,
|
||||
ReleaseHash = parsedMovieInfo.ReleaseHash,
|
||||
Title = releaseInfo.Title,
|
||||
FullSeason = parsedMovieInfo.FullSeason,
|
||||
SeasonNumber = parsedMovieInfo.SeasonNumber,
|
||||
//FullSeason = parsedMovieInfo.FullSeason,
|
||||
//SeasonNumber = parsedMovieInfo.SeasonNumber,
|
||||
Language = parsedMovieInfo.Language,
|
||||
AirDate = "",
|
||||
SeriesTitle = parsedMovieInfo.MovieTitle,
|
||||
@@ -138,7 +138,7 @@ namespace NzbDrone.Api.Indexers
|
||||
IsDaily = false,
|
||||
IsAbsoluteNumbering = false,
|
||||
IsPossibleSpecialEpisode = false,
|
||||
Special = parsedMovieInfo.Special,
|
||||
//Special = parsedMovieInfo.Special,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
11
src/NzbDrone.Api/Movies/MovieModule.cs
Normal file
11
src/NzbDrone.Api/Movies/MovieModule.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace NzbDrone.Api.Movies
|
||||
{
|
||||
class MovieModule
|
||||
{
|
||||
}
|
||||
}
|
||||
35
src/NzbDrone.Api/Movies/RenameMovieModule.cs
Normal file
35
src/NzbDrone.Api/Movies/RenameMovieModule.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using NzbDrone.Api.REST;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace NzbDrone.Api.Movies
|
||||
{
|
||||
public class RenameMovieModule : NzbDroneRestModule<RenameMovieResource>
|
||||
{
|
||||
private readonly IRenameMovieFileService _renameMovieFileService;
|
||||
|
||||
public RenameMovieModule(IRenameMovieFileService renameMovieFileService)
|
||||
: base("rename")
|
||||
{
|
||||
_renameMovieFileService = renameMovieFileService;
|
||||
|
||||
GetResourceAll = GetMovies; //TODO: GetResourceSingle?
|
||||
}
|
||||
|
||||
private List<RenameMovieResource> GetMovies()
|
||||
{
|
||||
if(!Request.Query.MovieId.HasValue)
|
||||
{
|
||||
throw new BadRequestException("movieId is missing");
|
||||
}
|
||||
|
||||
var movieId = (int)Request.Query.MovieId;
|
||||
|
||||
return _renameMovieFileService.GetRenamePreviews(movieId).ToResource();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
35
src/NzbDrone.Api/Movies/RenameMovieResource.cs
Normal file
35
src/NzbDrone.Api/Movies/RenameMovieResource.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using NzbDrone.Api.REST;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace NzbDrone.Api.Movies
|
||||
{
|
||||
public class RenameMovieResource : RestResource
|
||||
{
|
||||
public int MovieId { get; set; }
|
||||
public int MovieFileId { get; set; }
|
||||
public string ExistingPath { get; set; }
|
||||
public string NewPath { get; set; }
|
||||
}
|
||||
|
||||
public static class RenameMovieResourceMapper
|
||||
{
|
||||
public static RenameMovieResource ToResource(this Core.MediaFiles.RenameMovieFilePreview model)
|
||||
{
|
||||
if (model == null) return null;
|
||||
|
||||
return new RenameMovieResource
|
||||
{
|
||||
MovieId = model.MovieId,
|
||||
MovieFileId = model.MovieFileId,
|
||||
ExistingPath = model.ExistingPath,
|
||||
NewPath = model.NewPath
|
||||
};
|
||||
}
|
||||
|
||||
public static List<RenameMovieResource> ToResource(this IEnumerable<Core.MediaFiles.RenameMovieFilePreview> models)
|
||||
{
|
||||
return models.Select(ToResource).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -116,6 +116,9 @@
|
||||
<Compile Include="Frontend\Mappers\RobotsTxtMapper.cs" />
|
||||
<Compile Include="Indexers\ReleaseModuleBase.cs" />
|
||||
<Compile Include="Indexers\ReleasePushModule.cs" />
|
||||
<Compile Include="Movies\MovieModule.cs" />
|
||||
<Compile Include="Movies\RenameMovieModule.cs" />
|
||||
<Compile Include="Movies\RenameMovieResource.cs" />
|
||||
<Compile Include="Parse\ParseModule.cs" />
|
||||
<Compile Include="Parse\ParseResource.cs" />
|
||||
<Compile Include="ManualImport\ManualImportModule.cs" />
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace NzbDrone.Api.Movie
|
||||
//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
|
||||
|
||||
|
||||
//View Only
|
||||
public string Title { get; set; }
|
||||
public List<AlternateTitleResource> AlternateTitles { get; set; }
|
||||
@@ -27,11 +27,13 @@ namespace NzbDrone.Api.Movie
|
||||
public MovieStatusType Status { get; set; }
|
||||
public string Overview { get; set; }
|
||||
public DateTime? InCinemas { get; set; }
|
||||
public DateTime? PhysicalRelease { get; set; }
|
||||
public List<MediaCover> Images { get; set; }
|
||||
public string Website { get; set; }
|
||||
|
||||
public bool Downloaded { get; set; }
|
||||
public string RemotePoster { get; set; }
|
||||
public int Year { get; set; }
|
||||
public bool HasFile { get; set; }
|
||||
|
||||
//View & Edit
|
||||
public string Path { get; set; }
|
||||
@@ -79,6 +81,22 @@ namespace NzbDrone.Api.Movie
|
||||
{
|
||||
if (model == null) return null;
|
||||
|
||||
|
||||
long size = 0;
|
||||
bool downloaded = false;
|
||||
|
||||
|
||||
if(model.MovieFile != null)
|
||||
{
|
||||
model.MovieFile.LazyLoad();
|
||||
}
|
||||
|
||||
if (model.MovieFile != null && model.MovieFile.IsLoaded && model.MovieFile.Value != null)
|
||||
{
|
||||
size = model.MovieFile.Value.Size;
|
||||
downloaded = true;
|
||||
}
|
||||
|
||||
return new MovieResource
|
||||
{
|
||||
Id = model.Id,
|
||||
@@ -87,6 +105,9 @@ namespace NzbDrone.Api.Movie
|
||||
//AlternateTitles
|
||||
SortTitle = model.SortTitle,
|
||||
InCinemas = model.InCinemas,
|
||||
PhysicalRelease = model.PhysicalRelease,
|
||||
HasFile = model.HasFile,
|
||||
Downloaded = downloaded,
|
||||
//TotalEpisodeCount
|
||||
//EpisodeCount
|
||||
//EpisodeFileCount
|
||||
@@ -104,6 +125,8 @@ namespace NzbDrone.Api.Movie
|
||||
|
||||
Monitored = model.Monitored,
|
||||
|
||||
SizeOnDisk = size,
|
||||
|
||||
Runtime = model.Runtime,
|
||||
LastInfoSync = model.LastInfoSync,
|
||||
CleanTitle = model.CleanTitle,
|
||||
@@ -134,6 +157,7 @@ namespace NzbDrone.Api.Movie
|
||||
//AlternateTitles
|
||||
SortTitle = resource.SortTitle,
|
||||
InCinemas = resource.InCinemas,
|
||||
PhysicalRelease = resource.PhysicalRelease,
|
||||
//TotalEpisodeCount
|
||||
//EpisodeCount
|
||||
//EpisodeFileCount
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace NzbDrone.Common.Cloud
|
||||
{
|
||||
public SonarrCloudRequestBuilder()
|
||||
{
|
||||
Services = new HttpRequestBuilder("https://radarr.aeonlucid.com/v1/")
|
||||
Services = new HttpRequestBuilder("http://radarr.aeonlucid.com/v1/")
|
||||
.CreateFactory();
|
||||
|
||||
SkyHookTvdb = new HttpRequestBuilder("http://skyhook.sonarr.tv/v1/tvdb/{route}/{language}/")
|
||||
|
||||
@@ -16,10 +16,10 @@ namespace NzbDrone.Common.Extensions
|
||||
private const string UPDATE_CLIENT_EXE = "Radarr.Update.exe";
|
||||
private const string BACKUP_FOLDER = "Backups";
|
||||
|
||||
private static readonly string UPDATE_SANDBOX_FOLDER_NAME = "nzbdrone_update" + Path.DirectorySeparatorChar;
|
||||
private static readonly string UPDATE_PACKAGE_FOLDER_NAME = "";
|
||||
private static readonly string UPDATE_BACKUP_FOLDER_NAME = "nzbdrone_backup" + Path.DirectorySeparatorChar;
|
||||
private static readonly string UPDATE_BACKUP_APPDATA_FOLDER_NAME = "nzbdrone_appdata_backup" + Path.DirectorySeparatorChar;
|
||||
private static readonly string UPDATE_SANDBOX_FOLDER_NAME = "radarr_update" + Path.DirectorySeparatorChar;
|
||||
private static readonly string UPDATE_PACKAGE_FOLDER_NAME = "Radarr" + Path.DirectorySeparatorChar;
|
||||
private static readonly string UPDATE_BACKUP_FOLDER_NAME = "radarr_backup" + Path.DirectorySeparatorChar;
|
||||
private static readonly string UPDATE_BACKUP_APPDATA_FOLDER_NAME = "radarr_appdata_backup" + Path.DirectorySeparatorChar;
|
||||
private static readonly string UPDATE_CLIENT_FOLDER_NAME = "NzbDrone.Update" + Path.DirectorySeparatorChar;
|
||||
private static readonly string UPDATE_LOG_FOLDER_NAME = "UpdateLogs" + Path.DirectorySeparatorChar;
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace NzbDrone.Common
|
||||
|
||||
public class ServiceProvider : IServiceProvider
|
||||
{
|
||||
public const string NZBDRONE_SERVICE_NAME = "NzbDrone";
|
||||
public const string NZBDRONE_SERVICE_NAME = "Radarr";
|
||||
|
||||
private readonly IProcessProvider _processProvider;
|
||||
private readonly Logger _logger;
|
||||
@@ -78,7 +78,7 @@ namespace NzbDrone.Common
|
||||
serviceInstaller.Context = context;
|
||||
serviceInstaller.DisplayName = serviceName;
|
||||
serviceInstaller.ServiceName = serviceName;
|
||||
serviceInstaller.Description = "NzbDrone Application Server";
|
||||
serviceInstaller.Description = "Radarr Application Server";
|
||||
serviceInstaller.StartType = ServiceStartMode.Automatic;
|
||||
serviceInstaller.ServicesDependedOn = new[] { "EventLog", "Tcpip", "http" };
|
||||
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common.Http;
|
||||
using NzbDrone.Core.Indexers;
|
||||
using NzbDrone.Core.Indexers.BitMeTv;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using FluentAssertions;
|
||||
|
||||
namespace NzbDrone.Core.Test.IndexerTests.BitMeTvTests
|
||||
{
|
||||
[TestFixture]
|
||||
public class BitMeTvFixture : CoreTest<BitMeTv>
|
||||
{
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
Subject.Definition = new IndexerDefinition()
|
||||
{
|
||||
Name = "BitMeTV",
|
||||
Settings = new BitMeTvSettings() { Cookie = "uid=123" }
|
||||
};
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_parse_recent_feed_from_BitMeTv()
|
||||
{
|
||||
var recentFeed = ReadAllText(@"Files/Indexers/BitMeTv/BitMeTv.xml");
|
||||
|
||||
Mocker.GetMock<IHttpClient>()
|
||||
.Setup(o => o.Execute(It.Is<HttpRequest>(v => v.Method == HttpMethod.GET)))
|
||||
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), recentFeed));
|
||||
|
||||
var releases = Subject.FetchRecent();
|
||||
|
||||
releases.Should().HaveCount(5);
|
||||
releases.First().Should().BeOfType<TorrentInfo>();
|
||||
|
||||
var torrentInfo = releases.First() as TorrentInfo;
|
||||
|
||||
torrentInfo.Title.Should().Be("Total.Divas.S02E08.HDTV.x264-CRiMSON");
|
||||
torrentInfo.DownloadProtocol.Should().Be(DownloadProtocol.Torrent);
|
||||
torrentInfo.DownloadUrl.Should().Be("http://www.bitmetv.org/download.php/12/Total.Divas.S02E08.HDTV.x264-CRiMSON.torrent");
|
||||
torrentInfo.InfoUrl.Should().BeNullOrEmpty();
|
||||
torrentInfo.CommentUrl.Should().BeNullOrEmpty();
|
||||
torrentInfo.Indexer.Should().Be(Subject.Definition.Name);
|
||||
torrentInfo.PublishDate.Should().Be(DateTime.Parse("2014/05/13 17:04:29"));
|
||||
torrentInfo.Size.Should().Be(395009065);
|
||||
torrentInfo.InfoHash.Should().Be(null);
|
||||
torrentInfo.MagnetUrl.Should().Be(null);
|
||||
torrentInfo.Peers.Should().Be(null);
|
||||
torrentInfo.Seeders.Should().Be(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,161 +0,0 @@
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common.Http;
|
||||
using NzbDrone.Core.Indexers;
|
||||
using NzbDrone.Core.Indexers.BroadcastheNet;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Test.Common;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using FluentAssertions;
|
||||
|
||||
namespace NzbDrone.Core.Test.IndexerTests.BroadcastheNetTests
|
||||
{
|
||||
[TestFixture]
|
||||
public class BroadcastheNetFixture : CoreTest<BroadcastheNet>
|
||||
{
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
Subject.Definition = new IndexerDefinition()
|
||||
{
|
||||
Name = "BroadcastheNet",
|
||||
Settings = new BroadcastheNetSettings() { ApiKey = "abc", BaseUrl = "https://api.btnapps.net/" }
|
||||
};
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_parse_recent_feed_from_BroadcastheNet()
|
||||
{
|
||||
var recentFeed = ReadAllText(@"Files/Indexers/BroadcastheNet/RecentFeed.json");
|
||||
|
||||
Mocker.GetMock<IHttpClient>()
|
||||
.Setup(o => o.Execute(It.Is<HttpRequest>(v => v.Method == HttpMethod.POST)))
|
||||
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), recentFeed));
|
||||
|
||||
var releases = Subject.FetchRecent();
|
||||
|
||||
releases.Should().HaveCount(2);
|
||||
releases.First().Should().BeOfType<TorrentInfo>();
|
||||
|
||||
var torrentInfo = releases.First() as TorrentInfo;
|
||||
|
||||
torrentInfo.Guid.Should().Be("BTN-123");
|
||||
torrentInfo.Title.Should().Be("Jimmy.Kimmel.2014.09.15.Jane.Fonda.HDTV.x264-aAF");
|
||||
torrentInfo.DownloadProtocol.Should().Be(DownloadProtocol.Torrent);
|
||||
torrentInfo.DownloadUrl.Should().Be("https://broadcasthe.net/torrents.php?action=download&id=123&authkey=123&torrent_pass=123");
|
||||
torrentInfo.InfoUrl.Should().Be("https://broadcasthe.net/torrents.php?id=237457&torrentid=123");
|
||||
torrentInfo.CommentUrl.Should().BeNullOrEmpty();
|
||||
torrentInfo.Indexer.Should().Be(Subject.Definition.Name);
|
||||
torrentInfo.PublishDate.Should().Be(DateTime.Parse("2014/09/16 21:15:33"));
|
||||
torrentInfo.Size.Should().Be(505099926);
|
||||
torrentInfo.InfoHash.Should().Be("123");
|
||||
torrentInfo.TvdbId.Should().Be(71998);
|
||||
torrentInfo.TvRageId.Should().Be(4055);
|
||||
torrentInfo.MagnetUrl.Should().BeNullOrEmpty();
|
||||
torrentInfo.Peers.Should().Be(40+9);
|
||||
torrentInfo.Seeders.Should().Be(40);
|
||||
|
||||
torrentInfo.Origin.Should().Be("Scene");
|
||||
torrentInfo.Source.Should().Be("HDTV");
|
||||
torrentInfo.Container.Should().Be("MP4");
|
||||
torrentInfo.Codec.Should().Be("x264");
|
||||
torrentInfo.Resolution.Should().Be("SD");
|
||||
}
|
||||
|
||||
private void VerifyBackOff()
|
||||
{
|
||||
Mocker.GetMock<IIndexerStatusService>()
|
||||
.Verify(v => v.RecordFailure(It.IsAny<int>(), It.IsAny<TimeSpan>()), Times.Once());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_back_off_on_bad_request()
|
||||
{
|
||||
Mocker.GetMock<IHttpClient>()
|
||||
.Setup(v => v.Execute(It.IsAny<HttpRequest>()))
|
||||
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), new byte[0], System.Net.HttpStatusCode.BadRequest));
|
||||
|
||||
var results = Subject.FetchRecent();
|
||||
|
||||
results.Should().BeEmpty();
|
||||
|
||||
VerifyBackOff();
|
||||
|
||||
ExceptionVerification.ExpectedWarns(1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_back_off_and_report_api_key_invalid()
|
||||
{
|
||||
Mocker.GetMock<IHttpClient>()
|
||||
.Setup(v => v.Execute(It.IsAny<HttpRequest>()))
|
||||
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), new byte[0], System.Net.HttpStatusCode.Unauthorized));
|
||||
|
||||
var results = Subject.FetchRecent();
|
||||
|
||||
results.Should().BeEmpty();
|
||||
|
||||
VerifyBackOff();
|
||||
|
||||
ExceptionVerification.ExpectedWarns(1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_back_off_on_unknown_method()
|
||||
{
|
||||
Mocker.GetMock<IHttpClient>()
|
||||
.Setup(v => v.Execute(It.IsAny<HttpRequest>()))
|
||||
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), new byte[0], System.Net.HttpStatusCode.NotFound));
|
||||
|
||||
var results = Subject.FetchRecent();
|
||||
|
||||
results.Should().BeEmpty();
|
||||
|
||||
VerifyBackOff();
|
||||
|
||||
ExceptionVerification.ExpectedWarns(1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_back_off_api_limit_reached()
|
||||
{
|
||||
Mocker.GetMock<IHttpClient>()
|
||||
.Setup(v => v.Execute(It.IsAny<HttpRequest>()))
|
||||
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), new byte[0], System.Net.HttpStatusCode.ServiceUnavailable));
|
||||
|
||||
var results = Subject.FetchRecent();
|
||||
|
||||
results.Should().BeEmpty();
|
||||
|
||||
VerifyBackOff();
|
||||
|
||||
ExceptionVerification.ExpectedWarns(1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_replace_https_http_as_needed()
|
||||
{
|
||||
var recentFeed = ReadAllText(@"Files/Indexers/BroadcastheNet/RecentFeed.json");
|
||||
|
||||
(Subject.Definition.Settings as BroadcastheNetSettings).BaseUrl = "http://api.btnapps.net/";
|
||||
|
||||
recentFeed = recentFeed.Replace("http:", "https:");
|
||||
|
||||
Mocker.GetMock<IHttpClient>()
|
||||
.Setup(o => o.Execute(It.Is<HttpRequest>(v => v.Method == HttpMethod.POST)))
|
||||
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), recentFeed));
|
||||
|
||||
var releases = Subject.FetchRecent();
|
||||
|
||||
releases.Should().HaveCount(2);
|
||||
releases.First().Should().BeOfType<TorrentInfo>();
|
||||
|
||||
var torrentInfo = releases.First() as TorrentInfo;
|
||||
|
||||
torrentInfo.DownloadUrl.Should().Be("http://broadcasthe.net/torrents.php?action=download&id=123&authkey=123&torrent_pass=123");
|
||||
torrentInfo.InfoUrl.Should().Be("http://broadcasthe.net/torrents.php?id=237457&torrentid=123");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common.Http;
|
||||
using NzbDrone.Core.Indexers;
|
||||
using NzbDrone.Core.Indexers.Torrentleech;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using FluentAssertions;
|
||||
|
||||
namespace NzbDrone.Core.Test.IndexerTests.TorrentleechTests
|
||||
{
|
||||
[TestFixture]
|
||||
public class TorrentleechFixture : CoreTest<Torrentleech>
|
||||
{
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
Subject.Definition = new IndexerDefinition()
|
||||
{
|
||||
Name = "Torrentleech",
|
||||
Settings = new TorrentleechSettings()
|
||||
};
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_parse_recent_feed_from_Torrentleech()
|
||||
{
|
||||
var recentFeed = ReadAllText(@"Files/Indexers/Torrentleech/Torrentleech.xml");
|
||||
|
||||
Mocker.GetMock<IHttpClient>()
|
||||
.Setup(o => o.Execute(It.Is<HttpRequest>(v => v.Method == HttpMethod.GET)))
|
||||
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), recentFeed));
|
||||
|
||||
var releases = Subject.FetchRecent();
|
||||
|
||||
releases.Should().HaveCount(5);
|
||||
releases.First().Should().BeOfType<TorrentInfo>();
|
||||
|
||||
var torrentInfo = releases.First() as TorrentInfo;
|
||||
|
||||
torrentInfo.Title.Should().Be("Classic Car Rescue S02E04 720p HDTV x264-C4TV");
|
||||
torrentInfo.DownloadProtocol.Should().Be(DownloadProtocol.Torrent);
|
||||
torrentInfo.DownloadUrl.Should().Be("http://www.torrentleech.org/rss/download/513575/1234/Classic.Car.Rescue.S02E04.720p.HDTV.x264-C4TV.torrent");
|
||||
torrentInfo.InfoUrl.Should().Be("http://www.torrentleech.org/torrent/513575");
|
||||
torrentInfo.CommentUrl.Should().Be("http://www.torrentleech.org/torrent/513575#comments");
|
||||
torrentInfo.Indexer.Should().Be(Subject.Definition.Name);
|
||||
torrentInfo.PublishDate.Should().Be(DateTime.Parse("2014/05/12 19:15:28"));
|
||||
torrentInfo.Size.Should().Be(0);
|
||||
torrentInfo.InfoHash.Should().Be(null);
|
||||
torrentInfo.MagnetUrl.Should().Be(null);
|
||||
torrentInfo.Peers.Should().Be(7+1);
|
||||
torrentInfo.Seeders.Should().Be(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -237,8 +237,6 @@
|
||||
<Compile Include="IndexerSearchTests\NzbSearchServiceFixture.cs" />
|
||||
<Compile Include="IndexerSearchTests\SearchDefinitionFixture.cs" />
|
||||
<Compile Include="IndexerTests\BasicRssParserFixture.cs" />
|
||||
<Compile Include="IndexerTests\BitMeTvTests\BitMeTvFixture.cs" />
|
||||
<Compile Include="IndexerTests\BroadcastheNetTests\BroadcastheNetFixture.cs" />
|
||||
<Compile Include="IndexerTests\HDBitsTests\HDBitsFixture.cs" />
|
||||
<Compile Include="IndexerTests\IndexerServiceFixture.cs" />
|
||||
<Compile Include="IndexerTests\IndexerStatusServiceFixture.cs" />
|
||||
@@ -259,7 +257,6 @@
|
||||
<Compile Include="IndexerTests\IPTorrentsTests\IPTorrentsFixture.cs" />
|
||||
<Compile Include="IndexerTests\KickassTorrentsTests\KickassTorrentsFixture.cs" />
|
||||
<Compile Include="IndexerTests\NyaaTests\NyaaFixture.cs" />
|
||||
<Compile Include="IndexerTests\TorrentleechTests\TorrentleechFixture.cs" />
|
||||
<Compile Include="IndexerTests\TorrentRssIndexerTests\TorrentRssIndexerFixture.cs" />
|
||||
<Compile Include="IndexerTests\TorrentRssIndexerTests\TestTorrentRssIndexer.cs" />
|
||||
<Compile Include="IndexerTests\WomblesTests\WomblesFixture.cs" />
|
||||
|
||||
@@ -161,7 +161,8 @@ namespace NzbDrone.Core.Configuration
|
||||
|
||||
public bool AnalyticsEnabled => GetValueBoolean("AnalyticsEnabled", true, persist: false);
|
||||
|
||||
public string Branch => GetValue("Branch", "master").ToLowerInvariant();
|
||||
// TODO: Change back to "master" for the first stable release.
|
||||
public string Branch => GetValue("Branch", "develop").ToLowerInvariant();
|
||||
|
||||
public string LogLevel => GetValue("LogLevel", "Info");
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using FluentMigrator;
|
||||
using NzbDrone.Core.Datastore.Migration.Framework;
|
||||
using System.Data;
|
||||
|
||||
namespace NzbDrone.Core.Datastore.Migration
|
||||
{
|
||||
[Migration(110)]
|
||||
public class add_phyiscal_release : NzbDroneMigrationBase
|
||||
{
|
||||
protected override void MainDbUpgrade()
|
||||
{
|
||||
Alter.Table("Movies").AddColumn("PhysicalRelease").AsDateTime().Nullable();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
14
src/NzbDrone.Core/Datastore/Migration/111_remove_bitmetv.cs
Normal file
14
src/NzbDrone.Core/Datastore/Migration/111_remove_bitmetv.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using FluentMigrator;
|
||||
using NzbDrone.Core.Datastore.Migration.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Datastore.Migration
|
||||
{
|
||||
[Migration(111)]
|
||||
public class remove_bitmetv : NzbDroneMigrationBase
|
||||
{
|
||||
protected override void MainDbUpgrade()
|
||||
{
|
||||
Delete.FromTable("Indexers").Row(new { Implementation = "BitMeTv" });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using FluentMigrator;
|
||||
using NzbDrone.Core.Datastore.Migration.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Datastore.Migration
|
||||
{
|
||||
[Migration(112)]
|
||||
public class remove_torrentleech : NzbDroneMigrationBase
|
||||
{
|
||||
protected override void MainDbUpgrade()
|
||||
{
|
||||
Delete.FromTable("Indexers").Row(new { Implementation = "Torrentleech" });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using FluentMigrator;
|
||||
using NzbDrone.Core.Datastore.Migration.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Datastore.Migration
|
||||
{
|
||||
[Migration(113)]
|
||||
public class remove_broadcasthenet : NzbDroneMigrationBase
|
||||
{
|
||||
protected override void MainDbUpgrade()
|
||||
{
|
||||
Delete.FromTable("Indexers").Row(new { Implementation = "BroadcastheNet" });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -111,6 +111,18 @@ namespace NzbDrone.Core.Extras
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: Implementing this will fix a lot of our warning exceptions
|
||||
//public void Handle(MediaCoversUpdatedEvent message)
|
||||
//{
|
||||
// var movie = message.Movie;
|
||||
// var movieFiles = GetMovieFiles(movie.Id);
|
||||
|
||||
// foreach (var extraFileManager in _extraFileManagers)
|
||||
// {
|
||||
// extraFileManager.CreateAfterMovieScan(movie, movieFiles);
|
||||
// }
|
||||
//}
|
||||
|
||||
public void Handle(EpisodeFolderCreatedEvent message)
|
||||
{
|
||||
var series = message.Series;
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
using NzbDrone.Common.Http;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Parser;
|
||||
|
||||
namespace NzbDrone.Core.Indexers.BitMeTv
|
||||
{
|
||||
public class BitMeTv : HttpIndexerBase<BitMeTvSettings>
|
||||
{
|
||||
public override string Name => "BitMeTV";
|
||||
|
||||
public override DownloadProtocol Protocol => DownloadProtocol.Torrent;
|
||||
public override bool SupportsSearch => false;
|
||||
public override int PageSize => 0;
|
||||
|
||||
public BitMeTv(IHttpClient httpClient, IIndexerStatusService indexerStatusService, IConfigService configService, IParsingService parsingService, Logger logger)
|
||||
: base(httpClient, indexerStatusService, configService, parsingService, logger)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override IIndexerRequestGenerator GetRequestGenerator()
|
||||
{
|
||||
return new BitMeTvRequestGenerator() { Settings = Settings };
|
||||
}
|
||||
|
||||
public override IParseIndexerResponse GetParser()
|
||||
{
|
||||
return new TorrentRssParser() { ParseSizeInDescription = true };
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
using System.Text.RegularExpressions;
|
||||
using FluentValidation;
|
||||
using NzbDrone.Core.Annotations;
|
||||
using NzbDrone.Core.ThingiProvider;
|
||||
using NzbDrone.Core.Validation;
|
||||
|
||||
namespace NzbDrone.Core.Indexers.BitMeTv
|
||||
{
|
||||
public class BitMeTvSettingsValidator : AbstractValidator<BitMeTvSettings>
|
||||
{
|
||||
public BitMeTvSettingsValidator()
|
||||
{
|
||||
RuleFor(c => c.BaseUrl).ValidRootUrl();
|
||||
RuleFor(c => c.UserId).NotEmpty();
|
||||
RuleFor(c => c.RssPasskey).NotEmpty();
|
||||
|
||||
RuleFor(c => c.Cookie).NotEmpty();
|
||||
|
||||
RuleFor(c => c.Cookie)
|
||||
.Matches(@"pass=[0-9a-f]{32}", RegexOptions.IgnoreCase)
|
||||
.WithMessage("Wrong pattern")
|
||||
.AsWarning();
|
||||
}
|
||||
}
|
||||
|
||||
public class BitMeTvSettings : IProviderConfig
|
||||
{
|
||||
private static readonly BitMeTvSettingsValidator Validator = new BitMeTvSettingsValidator();
|
||||
|
||||
public BitMeTvSettings()
|
||||
{
|
||||
BaseUrl = "https://www.bitmetv.org";
|
||||
}
|
||||
|
||||
[FieldDefinition(0, Label = "Website URL")]
|
||||
public string BaseUrl { get; set; }
|
||||
|
||||
[FieldDefinition(1, Label = "UserId")]
|
||||
public string UserId { get; set; }
|
||||
|
||||
[FieldDefinition(2, Label = "RSS Passkey")]
|
||||
public string RssPasskey { get; set; }
|
||||
|
||||
[FieldDefinition(3, Label = "Cookie", HelpText = "BitMeTv uses a login cookie needed to access the rss, you'll have to retrieve it via a browser.")]
|
||||
public string Cookie { get; set; }
|
||||
|
||||
public NzbDroneValidationResult Validate()
|
||||
{
|
||||
return new NzbDroneValidationResult(Validator.Validate(this));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
using NLog;
|
||||
using NzbDrone.Common.Http;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Parser;
|
||||
|
||||
namespace NzbDrone.Core.Indexers.BroadcastheNet
|
||||
{
|
||||
public class BroadcastheNet : HttpIndexerBase<BroadcastheNetSettings>
|
||||
{
|
||||
public override string Name => "BroadcastheNet";
|
||||
|
||||
public override DownloadProtocol Protocol => DownloadProtocol.Torrent;
|
||||
public override bool SupportsRss => true;
|
||||
public override bool SupportsSearch => true;
|
||||
public override int PageSize => 100;
|
||||
|
||||
public BroadcastheNet(IHttpClient httpClient, IIndexerStatusService indexerStatusService, IConfigService configService, IParsingService parsingService, Logger logger)
|
||||
: base(httpClient, indexerStatusService, configService, parsingService, logger)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override IIndexerRequestGenerator GetRequestGenerator()
|
||||
{
|
||||
var requestGenerator = new BroadcastheNetRequestGenerator() { Settings = Settings, PageSize = PageSize };
|
||||
|
||||
var releaseInfo = _indexerStatusService.GetLastRssSyncReleaseInfo(Definition.Id);
|
||||
if (releaseInfo != null)
|
||||
{
|
||||
int torrentID;
|
||||
if (int.TryParse(releaseInfo.Guid.Replace("BTN-", string.Empty), out torrentID))
|
||||
{
|
||||
requestGenerator.LastRecentTorrentID = torrentID;
|
||||
}
|
||||
}
|
||||
|
||||
return requestGenerator;
|
||||
}
|
||||
|
||||
public override IParseIndexerResponse GetParser()
|
||||
{
|
||||
return new BroadcastheNetParser();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,91 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Text.RegularExpressions;
|
||||
using NzbDrone.Common.Http;
|
||||
using NzbDrone.Core.Indexers.Exceptions;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
|
||||
namespace NzbDrone.Core.Indexers.BroadcastheNet
|
||||
{
|
||||
public class BroadcastheNetParser : IParseIndexerResponse
|
||||
{
|
||||
private static readonly Regex RegexProtocol = new Regex("^https?:", RegexOptions.Compiled);
|
||||
|
||||
public IList<ReleaseInfo> ParseResponse(IndexerResponse indexerResponse)
|
||||
{
|
||||
var results = new List<ReleaseInfo>();
|
||||
|
||||
switch (indexerResponse.HttpResponse.StatusCode)
|
||||
{
|
||||
case HttpStatusCode.Unauthorized:
|
||||
throw new ApiKeyException("API Key invalid or not authorized");
|
||||
case HttpStatusCode.NotFound:
|
||||
throw new IndexerException(indexerResponse, "Indexer API call returned NotFound, the Indexer API may have changed.");
|
||||
case HttpStatusCode.ServiceUnavailable:
|
||||
throw new RequestLimitReachedException("Cannot do more than 150 API requests per hour.");
|
||||
default:
|
||||
if (indexerResponse.HttpResponse.StatusCode != HttpStatusCode.OK)
|
||||
{
|
||||
throw new IndexerException(indexerResponse, "Indexer API call returned an unexpected StatusCode [{0}]", indexerResponse.HttpResponse.StatusCode);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (indexerResponse.Content == "Query execution was interrupted")
|
||||
{
|
||||
throw new IndexerException(indexerResponse, "Indexer API returned an internal server error");
|
||||
}
|
||||
|
||||
|
||||
JsonRpcResponse<BroadcastheNetTorrents> jsonResponse = new HttpResponse<JsonRpcResponse<BroadcastheNetTorrents>>(indexerResponse.HttpResponse).Resource;
|
||||
|
||||
if (jsonResponse.Error != null || jsonResponse.Result == null)
|
||||
{
|
||||
throw new IndexerException(indexerResponse, "Indexer API call returned an error [{0}]", jsonResponse.Error);
|
||||
}
|
||||
|
||||
if (jsonResponse.Result.Results == 0)
|
||||
{
|
||||
return results;
|
||||
}
|
||||
|
||||
var protocol = indexerResponse.HttpRequest.Url.Scheme + ":";
|
||||
|
||||
foreach (var torrent in jsonResponse.Result.Torrents.Values)
|
||||
{
|
||||
var torrentInfo = new TorrentInfo();
|
||||
|
||||
torrentInfo.Guid = string.Format("BTN-{0}", torrent.TorrentID);
|
||||
torrentInfo.Title = torrent.ReleaseName;
|
||||
torrentInfo.Size = torrent.Size;
|
||||
torrentInfo.DownloadUrl = RegexProtocol.Replace(torrent.DownloadURL, protocol);
|
||||
torrentInfo.InfoUrl = string.Format("{0}//broadcasthe.net/torrents.php?id={1}&torrentid={2}", protocol, torrent.GroupID, torrent.TorrentID);
|
||||
//torrentInfo.CommentUrl =
|
||||
if (torrent.TvdbID.HasValue)
|
||||
{
|
||||
torrentInfo.TvdbId = torrent.TvdbID.Value;
|
||||
}
|
||||
if (torrent.TvrageID.HasValue)
|
||||
{
|
||||
torrentInfo.TvRageId = torrent.TvrageID.Value;
|
||||
}
|
||||
torrentInfo.PublishDate = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc).ToUniversalTime().AddSeconds(torrent.Time);
|
||||
//torrentInfo.MagnetUrl =
|
||||
torrentInfo.InfoHash = torrent.InfoHash;
|
||||
torrentInfo.Seeders = torrent.Seeders;
|
||||
torrentInfo.Peers = torrent.Leechers + torrent.Seeders;
|
||||
|
||||
torrentInfo.Origin = torrent.Origin;
|
||||
torrentInfo.Source = torrent.Source;
|
||||
torrentInfo.Container = torrent.Container;
|
||||
torrentInfo.Codec = torrent.Codec;
|
||||
torrentInfo.Resolution = torrent.Resolution;
|
||||
|
||||
results.Add(torrentInfo);
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,199 +0,0 @@
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using NzbDrone.Common.Http;
|
||||
using NzbDrone.Core.IndexerSearch.Definitions;
|
||||
using System;
|
||||
|
||||
namespace NzbDrone.Core.Indexers.BroadcastheNet
|
||||
{
|
||||
public class BroadcastheNetRequestGenerator : IIndexerRequestGenerator
|
||||
{
|
||||
public int MaxPages { get; set; }
|
||||
public int PageSize { get; set; }
|
||||
public BroadcastheNetSettings Settings { get; set; }
|
||||
|
||||
public int? LastRecentTorrentID { get; set; }
|
||||
|
||||
public BroadcastheNetRequestGenerator()
|
||||
{
|
||||
MaxPages = 10;
|
||||
PageSize = 100;
|
||||
}
|
||||
|
||||
public virtual IndexerPageableRequestChain GetRecentRequests()
|
||||
{
|
||||
var pageableRequests = new IndexerPageableRequestChain();
|
||||
|
||||
if (LastRecentTorrentID.HasValue)
|
||||
{
|
||||
pageableRequests.Add(GetPagedRequests(MaxPages, new BroadcastheNetTorrentQuery()
|
||||
{
|
||||
Id = ">=" + (LastRecentTorrentID.Value - 100)
|
||||
}));
|
||||
}
|
||||
|
||||
pageableRequests.AddTier(GetPagedRequests(MaxPages, new BroadcastheNetTorrentQuery()
|
||||
{
|
||||
Age = "<=86400"
|
||||
}));
|
||||
|
||||
return pageableRequests;
|
||||
}
|
||||
|
||||
public virtual IndexerPageableRequestChain GetSearchRequests(SingleEpisodeSearchCriteria searchCriteria)
|
||||
{
|
||||
var pageableRequests = new IndexerPageableRequestChain();
|
||||
|
||||
var parameters = new BroadcastheNetTorrentQuery();
|
||||
if (AddSeriesSearchParameters(parameters, searchCriteria))
|
||||
{
|
||||
foreach (var episode in searchCriteria.Episodes)
|
||||
{
|
||||
parameters = parameters.Clone();
|
||||
|
||||
parameters.Category = "Episode";
|
||||
parameters.Name = string.Format("S{0:00}%E{1:00}%", episode.SeasonNumber, episode.EpisodeNumber);
|
||||
|
||||
pageableRequests.Add(GetPagedRequests(MaxPages, parameters));
|
||||
}
|
||||
|
||||
foreach (var seasonNumber in searchCriteria.Episodes.Select(v => v.SeasonNumber).Distinct())
|
||||
{
|
||||
parameters = parameters.Clone();
|
||||
|
||||
parameters.Category = "Season";
|
||||
parameters.Name = string.Format("Season {0}", seasonNumber);
|
||||
|
||||
pageableRequests.Add(GetPagedRequests(MaxPages, parameters));
|
||||
}
|
||||
}
|
||||
|
||||
return pageableRequests;
|
||||
}
|
||||
|
||||
public virtual IndexerPageableRequestChain GetSearchRequests(SeasonSearchCriteria searchCriteria)
|
||||
{
|
||||
var pageableRequests = new IndexerPageableRequestChain();
|
||||
|
||||
var parameters = new BroadcastheNetTorrentQuery();
|
||||
if (AddSeriesSearchParameters(parameters, searchCriteria))
|
||||
{
|
||||
foreach (var seasonNumber in searchCriteria.Episodes.Select(v => v.SeasonNumber).Distinct())
|
||||
{
|
||||
parameters.Category = "Season";
|
||||
parameters.Name = string.Format("Season {0}", seasonNumber);
|
||||
|
||||
pageableRequests.Add(GetPagedRequests(MaxPages, parameters));
|
||||
|
||||
parameters = parameters.Clone();
|
||||
|
||||
parameters.Category = "Episode";
|
||||
parameters.Name = string.Format("S{0:00}E%", seasonNumber);
|
||||
|
||||
pageableRequests.Add(GetPagedRequests(MaxPages, parameters));
|
||||
}
|
||||
}
|
||||
|
||||
return pageableRequests;
|
||||
}
|
||||
|
||||
public virtual IndexerPageableRequestChain GetSearchRequests(DailyEpisodeSearchCriteria searchCriteria)
|
||||
{
|
||||
var pageableRequests = new IndexerPageableRequestChain();
|
||||
|
||||
var parameters = new BroadcastheNetTorrentQuery();
|
||||
if (AddSeriesSearchParameters(parameters, searchCriteria))
|
||||
{
|
||||
parameters.Category = "Episode";
|
||||
parameters.Name = string.Format("{0:yyyy}.{0:MM}.{0:dd}", searchCriteria.AirDate);
|
||||
|
||||
pageableRequests.Add(GetPagedRequests(MaxPages, parameters));
|
||||
|
||||
pageableRequests.AddTier();
|
||||
|
||||
foreach (var episode in searchCriteria.Episodes)
|
||||
{
|
||||
parameters = parameters.Clone();
|
||||
|
||||
parameters.Category = "Episode";
|
||||
parameters.Name = string.Format("S{0:00}E{1:00}", episode.SeasonNumber, episode.EpisodeNumber);
|
||||
|
||||
pageableRequests.Add(GetPagedRequests(MaxPages, parameters));
|
||||
}
|
||||
}
|
||||
|
||||
return pageableRequests;
|
||||
}
|
||||
|
||||
public virtual IndexerPageableRequestChain GetSearchRequests(AnimeEpisodeSearchCriteria searchCriteria)
|
||||
{
|
||||
var pageableRequests = new IndexerPageableRequestChain();
|
||||
|
||||
var parameters = new BroadcastheNetTorrentQuery();
|
||||
if (AddSeriesSearchParameters(parameters, searchCriteria))
|
||||
{
|
||||
foreach (var episode in searchCriteria.Episodes)
|
||||
{
|
||||
parameters = parameters.Clone();
|
||||
|
||||
parameters.Category = "Episode";
|
||||
parameters.Name = string.Format("S{0:00}E{1:00}", episode.SeasonNumber, episode.EpisodeNumber);
|
||||
|
||||
pageableRequests.Add(GetPagedRequests(MaxPages, parameters));
|
||||
}
|
||||
|
||||
foreach (var seasonNumber in searchCriteria.Episodes.Select(v => v.SeasonNumber).Distinct())
|
||||
{
|
||||
parameters = parameters.Clone();
|
||||
|
||||
parameters.Category = "Season";
|
||||
parameters.Name = string.Format("Season {0}", seasonNumber);
|
||||
|
||||
pageableRequests.Add(GetPagedRequests(MaxPages, parameters));
|
||||
}
|
||||
}
|
||||
|
||||
return pageableRequests;
|
||||
}
|
||||
|
||||
public virtual IndexerPageableRequestChain GetSearchRequests(SpecialEpisodeSearchCriteria searchCriteria)
|
||||
{
|
||||
return new IndexerPageableRequestChain();
|
||||
}
|
||||
|
||||
private bool AddSeriesSearchParameters(BroadcastheNetTorrentQuery parameters, SearchCriteriaBase searchCriteria)
|
||||
{
|
||||
if (searchCriteria.Series.TvdbId != 0)
|
||||
{
|
||||
parameters.Tvdb = string.Format("{0}", searchCriteria.Series.TvdbId);
|
||||
return true;
|
||||
}
|
||||
if (searchCriteria.Series.TvRageId != 0)
|
||||
{
|
||||
parameters.Tvrage = string.Format("{0}", searchCriteria.Series.TvRageId);
|
||||
return true;
|
||||
}
|
||||
// BTN is very neatly managed, so it's unlikely they map tvrage/tvdb wrongly.
|
||||
return false;
|
||||
}
|
||||
|
||||
private IEnumerable<IndexerRequest> GetPagedRequests(int maxPages, BroadcastheNetTorrentQuery parameters)
|
||||
{
|
||||
var builder = new JsonRpcRequestBuilder(Settings.BaseUrl)
|
||||
.Call("getTorrents", Settings.ApiKey, parameters, PageSize, 0);
|
||||
builder.SuppressHttpError = true;
|
||||
|
||||
for (var page = 0; page < maxPages; page++)
|
||||
{
|
||||
builder.JsonParameters[3] = page * PageSize;
|
||||
|
||||
yield return new IndexerRequest(builder.Build());
|
||||
}
|
||||
}
|
||||
|
||||
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
|
||||
{
|
||||
return new IndexerPageableRequestChain();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
using FluentValidation;
|
||||
using NzbDrone.Core.Annotations;
|
||||
using NzbDrone.Core.ThingiProvider;
|
||||
using NzbDrone.Core.Validation;
|
||||
|
||||
namespace NzbDrone.Core.Indexers.BroadcastheNet
|
||||
{
|
||||
public class BroadcastheNetSettingsValidator : AbstractValidator<BroadcastheNetSettings>
|
||||
{
|
||||
public BroadcastheNetSettingsValidator()
|
||||
{
|
||||
RuleFor(c => c.BaseUrl).ValidRootUrl();
|
||||
RuleFor(c => c.ApiKey).NotEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
public class BroadcastheNetSettings : IProviderConfig
|
||||
{
|
||||
private static readonly BroadcastheNetSettingsValidator Validator = new BroadcastheNetSettingsValidator();
|
||||
|
||||
public BroadcastheNetSettings()
|
||||
{
|
||||
BaseUrl = "http://api.btnapps.net/";
|
||||
}
|
||||
|
||||
[FieldDefinition(0, 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(1, Label = "API Key")]
|
||||
public string ApiKey { get; set; }
|
||||
|
||||
public NzbDroneValidationResult Validate()
|
||||
{
|
||||
return new NzbDroneValidationResult(Validator.Validate(this));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
namespace NzbDrone.Core.Indexers.BroadcastheNet
|
||||
{
|
||||
public class BroadcastheNetTorrent
|
||||
{
|
||||
public string GroupName { get; set; }
|
||||
public int GroupID { get; set; }
|
||||
public int TorrentID { get; set; }
|
||||
public int SeriesID { get; set; }
|
||||
public string Series { get; set; }
|
||||
public string SeriesBanner { get; set; }
|
||||
public string SeriesPoster { get; set; }
|
||||
public string YoutubeTrailer { get; set; }
|
||||
public string Category { get; set; }
|
||||
public int? Snatched { get; set; }
|
||||
public int? Seeders { get; set; }
|
||||
public int? Leechers { get; set; }
|
||||
public string Source { get; set; }
|
||||
public string Container { get; set; }
|
||||
public string Codec { get; set; }
|
||||
public string Resolution { get; set; }
|
||||
public string Origin { get; set; }
|
||||
public string ReleaseName { get; set; }
|
||||
public long Size { get; set; }
|
||||
public long Time { get; set; }
|
||||
public int? TvdbID { get; set; }
|
||||
public int? TvrageID { get; set; }
|
||||
public string ImdbID { get; set; }
|
||||
public string InfoHash { get; set; }
|
||||
public string DownloadURL { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace NzbDrone.Core.Indexers.BroadcastheNet
|
||||
{
|
||||
public class BroadcastheNetTorrentQuery
|
||||
{
|
||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Id { get; set; }
|
||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Category { get; set; }
|
||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Name { get; set; }
|
||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Search { get; set; }
|
||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Codec { get; set; }
|
||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Container { get; set; }
|
||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Source { get; set; }
|
||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Resolution { get; set; }
|
||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Origin { get; set; }
|
||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Hash { get; set; }
|
||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Tvdb { get; set; }
|
||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Tvrage { get; set; }
|
||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string Age { get; set; }
|
||||
|
||||
public BroadcastheNetTorrentQuery Clone()
|
||||
{
|
||||
return MemberwiseClone() as BroadcastheNetTorrentQuery;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace NzbDrone.Core.Indexers.BroadcastheNet
|
||||
{
|
||||
public class BroadcastheNetTorrents
|
||||
{
|
||||
public Dictionary<int, BroadcastheNetTorrent> Torrents { get; set; }
|
||||
public int Results { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NzbDrone.Common.Http;
|
||||
@@ -22,21 +22,7 @@ namespace NzbDrone.Core.Indexers.HDBits
|
||||
|
||||
public virtual IndexerPageableRequestChain GetSearchRequests(AnimeEpisodeSearchCriteria searchCriteria)
|
||||
{
|
||||
var pageableRequests = new IndexerPageableRequestChain();
|
||||
|
||||
var queryBase = new TorrentQuery();
|
||||
if (TryAddSearchParameters(queryBase, searchCriteria))
|
||||
{
|
||||
foreach (var episode in searchCriteria.Episodes)
|
||||
{
|
||||
var query = queryBase.Clone();
|
||||
|
||||
query.TvdbInfo.Season = episode.SeasonNumber;
|
||||
query.TvdbInfo.Episode = episode.EpisodeNumber;
|
||||
}
|
||||
}
|
||||
|
||||
return pageableRequests;
|
||||
return new IndexerPageableRequestChain();
|
||||
}
|
||||
|
||||
public virtual IndexerPageableRequestChain GetSearchRequests(SpecialEpisodeSearchCriteria searchCriteria)
|
||||
@@ -46,69 +32,28 @@ namespace NzbDrone.Core.Indexers.HDBits
|
||||
|
||||
public virtual IndexerPageableRequestChain GetSearchRequests(DailyEpisodeSearchCriteria searchCriteria)
|
||||
{
|
||||
var pageableRequests = new IndexerPageableRequestChain();
|
||||
|
||||
var query = new TorrentQuery();
|
||||
if (TryAddSearchParameters(query, searchCriteria))
|
||||
{
|
||||
query.Search = string.Format("{0:yyyy}-{0:MM}-{0:dd}", searchCriteria.AirDate);
|
||||
|
||||
pageableRequests.Add(GetRequest(query));
|
||||
}
|
||||
|
||||
return pageableRequests;
|
||||
return new IndexerPageableRequestChain();
|
||||
}
|
||||
|
||||
public virtual IndexerPageableRequestChain GetSearchRequests(SeasonSearchCriteria searchCriteria)
|
||||
{
|
||||
var pageableRequests = new IndexerPageableRequestChain();
|
||||
|
||||
var queryBase = new TorrentQuery();
|
||||
if (TryAddSearchParameters(queryBase, searchCriteria))
|
||||
{
|
||||
foreach (var seasonNumber in searchCriteria.Episodes.Select(e => e.SeasonNumber).Distinct())
|
||||
{
|
||||
var query = queryBase.Clone();
|
||||
|
||||
query.TvdbInfo.Season = seasonNumber;
|
||||
|
||||
pageableRequests.Add(GetRequest(query));
|
||||
}
|
||||
}
|
||||
|
||||
return pageableRequests;
|
||||
return new IndexerPageableRequestChain();
|
||||
}
|
||||
|
||||
public virtual IndexerPageableRequestChain GetSearchRequests(SingleEpisodeSearchCriteria searchCriteria)
|
||||
{
|
||||
var pageableRequests = new IndexerPageableRequestChain();
|
||||
|
||||
var queryBase = new TorrentQuery();
|
||||
if (TryAddSearchParameters(queryBase, searchCriteria))
|
||||
{
|
||||
foreach (var episode in searchCriteria.Episodes)
|
||||
{
|
||||
var query = queryBase.Clone();
|
||||
|
||||
query.TvdbInfo.Season = episode.SeasonNumber;
|
||||
query.TvdbInfo.Episode = episode.EpisodeNumber;
|
||||
|
||||
pageableRequests.Add(GetRequest(query));
|
||||
}
|
||||
}
|
||||
|
||||
return pageableRequests;
|
||||
return new IndexerPageableRequestChain();
|
||||
}
|
||||
|
||||
private bool TryAddSearchParameters(TorrentQuery query, SearchCriteriaBase searchCriteria)
|
||||
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
|
||||
{
|
||||
if (searchCriteria.Series.TvdbId != 0)
|
||||
{
|
||||
query.TvdbInfo = query.TvdbInfo ?? new TvdbInfo();
|
||||
query.TvdbInfo.Id = searchCriteria.Series.TvdbId;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
var pageableRequests = new IndexerPageableRequestChain();
|
||||
var queryBase = new TorrentQuery();
|
||||
var query = queryBase.Clone();
|
||||
query.ImdbInfo.Id = int.Parse(searchCriteria.Movie.ImdbId.Substring(2));
|
||||
pageableRequests.Add(GetRequest(query));
|
||||
return pageableRequests;
|
||||
}
|
||||
|
||||
private IEnumerable<IndexerRequest> GetRequest(TorrentQuery query)
|
||||
@@ -129,10 +74,5 @@ namespace NzbDrone.Core.Indexers.HDBits
|
||||
|
||||
yield return new IndexerRequest(request);
|
||||
}
|
||||
|
||||
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
|
||||
{
|
||||
return new IndexerPageableRequestChain();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ namespace NzbDrone.Core.Indexers.Omgwtfnzbs
|
||||
private IEnumerable<IndexerRequest> GetPagedRequests(string query)
|
||||
{
|
||||
var url = new StringBuilder();
|
||||
url.AppendFormat("{0}?catid=19,20&user={1}&api={2}&eng=1&delay={3}", BaseUrl, Settings.Username, Settings.ApiKey, Settings.Delay);
|
||||
url.AppendFormat("{0}?catid=15,16,17&user={1}&api={2}&eng=1&delay={3}", BaseUrl, Settings.Username, Settings.ApiKey, Settings.Delay);
|
||||
|
||||
if (query.IsNotNullOrWhiteSpace())
|
||||
{
|
||||
@@ -105,7 +105,12 @@ namespace NzbDrone.Core.Indexers.Omgwtfnzbs
|
||||
|
||||
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
|
||||
{
|
||||
return new IndexerPageableRequestChain();
|
||||
var pageableRequests = new IndexerPageableRequestChain();
|
||||
|
||||
pageableRequests.Add(GetPagedRequests(string.Format("{0}",
|
||||
searchCriteria.Movie.Title)));
|
||||
|
||||
return pageableRequests;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
30
src/NzbDrone.Core/Indexers/PassThePopcorn/PassThePopcorn.cs
Normal file
30
src/NzbDrone.Core/Indexers/PassThePopcorn/PassThePopcorn.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using NLog;
|
||||
using NzbDrone.Common.Http;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Parser;
|
||||
|
||||
namespace NzbDrone.Core.Indexers.PassThePopcorn
|
||||
{
|
||||
public class PassThePopcorn : HttpIndexerBase<PassThePopcornSettings>
|
||||
{
|
||||
public override string Name => "PassThePopcorn";
|
||||
public override DownloadProtocol Protocol => DownloadProtocol.Torrent;
|
||||
public override bool SupportsRss => true;
|
||||
public override bool SupportsSearch => true;
|
||||
public override int PageSize => 50;
|
||||
|
||||
public PassThePopcorn(IHttpClient httpClient, IIndexerStatusService indexerStatusService, IConfigService configService, IParsingService parsingService, Logger logger)
|
||||
: base(httpClient, indexerStatusService, configService, parsingService, logger)
|
||||
{ }
|
||||
|
||||
public override IIndexerRequestGenerator GetRequestGenerator()
|
||||
{
|
||||
return new PassThePopcornRequestGenerator() { Settings = Settings };
|
||||
}
|
||||
|
||||
public override IParseIndexerResponse GetParser()
|
||||
{
|
||||
return new PassThePopcornParser(Settings);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace NzbDrone.Core.Indexers.PassThePopcorn
|
||||
{
|
||||
public class Director
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Id { get; set; }
|
||||
}
|
||||
|
||||
public class Torrent
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Quality { get; set; }
|
||||
public string Source { get; set; }
|
||||
public string Container { get; set; }
|
||||
public string Codec { get; set; }
|
||||
public string Resolution { get; set; }
|
||||
public bool Scene { get; set; }
|
||||
public string Size { get; set; }
|
||||
public DateTime UploadTime { get; set; }
|
||||
public string RemasterTitle { get; set; }
|
||||
public string Snatched { get; set; }
|
||||
public string Seeders { get; set; }
|
||||
public string Leechers { get; set; }
|
||||
public string ReleaseName { get; set; }
|
||||
public bool Checked { get; set; }
|
||||
public bool GoldenPopcorn { get; set; }
|
||||
}
|
||||
|
||||
public class Movie
|
||||
{
|
||||
public string GroupId { get; set; }
|
||||
public string Title { get; set; }
|
||||
public string Year { get; set; }
|
||||
public string Cover { get; set; }
|
||||
public List<string> Tags { get; set; }
|
||||
public List<Director> Directors { get; set; }
|
||||
public string ImdbId { get; set; }
|
||||
public int TotalLeechers { get; set; }
|
||||
public int TotalSeeders { get; set; }
|
||||
public int TotalSnatched { get; set; }
|
||||
public long MaxSize { get; set; }
|
||||
public string LastUploadTime { get; set; }
|
||||
public List<Torrent> Torrents { get; set; }
|
||||
}
|
||||
|
||||
public class PassThePopcornResponse
|
||||
{
|
||||
public string TotalResults { get; set; }
|
||||
public List<Movie> Movies { get; set; }
|
||||
public string Page { get; set; }
|
||||
public string AuthKey { get; set; }
|
||||
public string PassKey { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace NzbDrone.Core.Indexers.PassThePopcorn
|
||||
{
|
||||
public class PassThePopcornInfo : TorrentInfo
|
||||
{
|
||||
public bool? Golden { get; set; }
|
||||
public bool? Scene { get; set; }
|
||||
public bool? Approved { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using NzbDrone.Common.Http;
|
||||
using NzbDrone.Core.Indexers.Exceptions;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace NzbDrone.Core.Indexers.PassThePopcorn
|
||||
{
|
||||
public class PassThePopcornParser : IParseIndexerResponse
|
||||
{
|
||||
private readonly PassThePopcornSettings _settings;
|
||||
|
||||
public PassThePopcornParser(PassThePopcornSettings settings)
|
||||
{
|
||||
_settings = settings;
|
||||
}
|
||||
|
||||
public IList<ReleaseInfo> ParseResponse(IndexerResponse indexerResponse)
|
||||
{
|
||||
var torrentInfos = new List<ReleaseInfo>();
|
||||
|
||||
if (indexerResponse.HttpResponse.StatusCode != HttpStatusCode.OK)
|
||||
{
|
||||
throw new IndexerException(indexerResponse,
|
||||
"Unexpected response status {0} code from API request",
|
||||
indexerResponse.HttpResponse.StatusCode);
|
||||
}
|
||||
|
||||
var jsonResponse = JsonConvert.DeserializeObject<PassThePopcornResponse>(indexerResponse.Content);
|
||||
|
||||
var responseData = jsonResponse.Movies;
|
||||
if (responseData == null)
|
||||
{
|
||||
throw new IndexerException(indexerResponse,
|
||||
"Indexer API call response missing result data");
|
||||
}
|
||||
|
||||
foreach (var result in responseData)
|
||||
{
|
||||
foreach (var torrent in result.Torrents)
|
||||
{
|
||||
var id = torrent.Id;
|
||||
var title = torrent.ReleaseName;
|
||||
|
||||
if (torrent.GoldenPopcorn)
|
||||
{
|
||||
title = $"{title} 🍿";
|
||||
}
|
||||
|
||||
if (torrent.Checked)
|
||||
{
|
||||
title = $"{title} ✔";
|
||||
}
|
||||
|
||||
//if (IsPropertyExist(torrent, "RemasterTitle"))
|
||||
//{
|
||||
// if (torrent.RemasterTitle != null)
|
||||
// {
|
||||
// title = $"{title} - {torrent.RemasterTitle}";
|
||||
// }
|
||||
//}
|
||||
|
||||
// Only add approved torrents
|
||||
if (_settings.Approved && torrent.Checked)
|
||||
{
|
||||
torrentInfos.Add(new PassThePopcornInfo()
|
||||
{
|
||||
Guid = string.Format("PassThePopcorn-{0}", id),
|
||||
Title = title,
|
||||
Size = long.Parse(torrent.Size),
|
||||
DownloadUrl = GetDownloadUrl(id, jsonResponse.AuthKey, jsonResponse.PassKey),
|
||||
InfoUrl = GetInfoUrl(result.GroupId, id),
|
||||
Seeders = int.Parse(torrent.Seeders),
|
||||
Peers = int.Parse(torrent.Leechers) + int.Parse(torrent.Seeders),
|
||||
PublishDate = torrent.UploadTime.ToUniversalTime(),
|
||||
Golden = torrent.GoldenPopcorn,
|
||||
Scene = torrent.Scene,
|
||||
Approved = torrent.Checked
|
||||
});
|
||||
}
|
||||
// Add all torrents
|
||||
else if (!_settings.Approved)
|
||||
{
|
||||
torrentInfos.Add(new PassThePopcornInfo()
|
||||
{
|
||||
Guid = string.Format("PassThePopcorn-{0}", id),
|
||||
Title = title,
|
||||
Size = long.Parse(torrent.Size),
|
||||
DownloadUrl = GetDownloadUrl(id, jsonResponse.AuthKey, jsonResponse.PassKey),
|
||||
InfoUrl = GetInfoUrl(result.GroupId, id),
|
||||
Seeders = int.Parse(torrent.Seeders),
|
||||
Peers = int.Parse(torrent.Leechers) + int.Parse(torrent.Seeders),
|
||||
PublishDate = torrent.UploadTime.ToUniversalTime(),
|
||||
Golden = torrent.GoldenPopcorn,
|
||||
Scene = torrent.Scene,
|
||||
Approved = torrent.Checked
|
||||
});
|
||||
}
|
||||
// Don't add any torrents
|
||||
else if (_settings.Approved && !torrent.Checked)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// prefer golden
|
||||
// prefer scene
|
||||
// require approval
|
||||
return torrentInfos.OrderBy(o => ((dynamic)o).Golden ? 0 : 1).ThenBy(o => ((dynamic)o).Scene ? 0 : 1).ThenByDescending(o => ((dynamic)o).PublishDate).ToArray();
|
||||
}
|
||||
|
||||
private string GetDownloadUrl(int torrentId, string authKey, string passKey)
|
||||
{
|
||||
var url = new HttpUri(_settings.BaseUrl)
|
||||
.CombinePath("/torrents.php")
|
||||
.AddQueryParam("action", "download")
|
||||
.AddQueryParam("id", torrentId)
|
||||
.AddQueryParam("authkey", authKey)
|
||||
.AddQueryParam("torrent_pass", passKey);
|
||||
|
||||
return url.FullUri;
|
||||
}
|
||||
|
||||
private string GetInfoUrl(string groupId, int torrentId)
|
||||
{
|
||||
var url = new HttpUri(_settings.BaseUrl)
|
||||
.CombinePath("/torrents.php")
|
||||
.AddQueryParam("id", groupId)
|
||||
.AddQueryParam("torrentid", torrentId);
|
||||
|
||||
return url.FullUri;
|
||||
}
|
||||
|
||||
//public static bool IsPropertyExist(dynamic torrents, string name)
|
||||
//{
|
||||
// return torrents.GetType().GetProperty(name) != null;
|
||||
//}
|
||||
}
|
||||
}
|
||||
@@ -1,39 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NzbDrone.Common.Http;
|
||||
using NzbDrone.Common.Serializer;
|
||||
using NzbDrone.Core.IndexerSearch.Definitions;
|
||||
|
||||
namespace NzbDrone.Core.Indexers.BitMeTv
|
||||
namespace NzbDrone.Core.Indexers.PassThePopcorn
|
||||
{
|
||||
public class BitMeTvRequestGenerator : IIndexerRequestGenerator
|
||||
public class PassThePopcornRequestGenerator : IIndexerRequestGenerator
|
||||
{
|
||||
public BitMeTvSettings Settings { get; set; }
|
||||
|
||||
public PassThePopcornSettings Settings { get; set; }
|
||||
|
||||
public virtual IndexerPageableRequestChain GetRecentRequests()
|
||||
{
|
||||
var pageableRequests = new IndexerPageableRequestChain();
|
||||
|
||||
pageableRequests.Add(GetRssRequests());
|
||||
pageableRequests.Add(GetRequest(null));
|
||||
|
||||
return pageableRequests;
|
||||
}
|
||||
|
||||
public virtual IndexerPageableRequestChain GetSearchRequests(SingleEpisodeSearchCriteria searchCriteria)
|
||||
{
|
||||
return new IndexerPageableRequestChain();
|
||||
}
|
||||
|
||||
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
|
||||
{
|
||||
return new IndexerPageableRequestChain();
|
||||
var pageableRequests = new IndexerPageableRequestChain();
|
||||
pageableRequests.Add(GetRequest(searchCriteria.Movie.ImdbId));
|
||||
return pageableRequests;
|
||||
}
|
||||
|
||||
public virtual IndexerPageableRequestChain GetSearchRequests(SeasonSearchCriteria searchCriteria)
|
||||
{
|
||||
return new IndexerPageableRequestChain();
|
||||
}
|
||||
|
||||
public virtual IndexerPageableRequestChain GetSearchRequests(DailyEpisodeSearchCriteria searchCriteria)
|
||||
public virtual IndexerPageableRequestChain GetSearchRequests(SingleEpisodeSearchCriteria searchCriteria)
|
||||
{
|
||||
return new IndexerPageableRequestChain();
|
||||
}
|
||||
@@ -48,9 +42,19 @@ namespace NzbDrone.Core.Indexers.BitMeTv
|
||||
return new IndexerPageableRequestChain();
|
||||
}
|
||||
|
||||
private IEnumerable<IndexerRequest> GetRssRequests()
|
||||
public virtual IndexerPageableRequestChain GetSearchRequests(DailyEpisodeSearchCriteria searchCriteria)
|
||||
{
|
||||
var request = new IndexerRequest(string.Format("{0}/rss.php?uid={1}&passkey={2}", Settings.BaseUrl.Trim().TrimEnd('/'), Settings.UserId, Settings.RssPasskey), HttpAccept.Html);
|
||||
return new IndexerPageableRequestChain();
|
||||
}
|
||||
|
||||
public virtual IndexerPageableRequestChain GetSearchRequests(SeasonSearchCriteria searchCriteria)
|
||||
{
|
||||
return new IndexerPageableRequestChain();
|
||||
}
|
||||
|
||||
private IEnumerable<IndexerRequest> GetRequest(string searchParameters)
|
||||
{
|
||||
var request = new IndexerRequest(string.Format("{0}/torrents.php?json=noredirect&searchstr={1}", Settings.BaseUrl.Trim().TrimEnd('/'), searchParameters), HttpAccept.Json);
|
||||
|
||||
foreach (var cookie in HttpHeader.ParseCookies(Settings.Cookie))
|
||||
{
|
||||
@@ -0,0 +1,52 @@
|
||||
using FluentValidation;
|
||||
using NzbDrone.Core.Annotations;
|
||||
using NzbDrone.Core.ThingiProvider;
|
||||
using NzbDrone.Core.Validation;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace NzbDrone.Core.Indexers.PassThePopcorn
|
||||
{
|
||||
public class PassThePopcornSettingsValidator : AbstractValidator<PassThePopcornSettings>
|
||||
{
|
||||
public PassThePopcornSettingsValidator()
|
||||
{
|
||||
RuleFor(c => c.BaseUrl).ValidRootUrl();
|
||||
RuleFor(c => c.Cookie).NotEmpty();
|
||||
|
||||
RuleFor(c => c.Cookie)
|
||||
.Matches(@"__cfduid=[0-9a-f]{43}", RegexOptions.IgnoreCase)
|
||||
.WithMessage("Wrong pattern")
|
||||
.AsWarning();
|
||||
}
|
||||
}
|
||||
|
||||
public class PassThePopcornSettings : IProviderConfig
|
||||
{
|
||||
private static readonly PassThePopcornSettingsValidator Validator = new PassThePopcornSettingsValidator();
|
||||
|
||||
public PassThePopcornSettings()
|
||||
{
|
||||
BaseUrl = "https://passthepopcorn.me";
|
||||
}
|
||||
|
||||
[FieldDefinition(0, Label = "API URL", Advanced = true, HelpText = "Do not change this unless you know what you're doing. Since your cookie will be sent to that host.")]
|
||||
public string BaseUrl { get; set; }
|
||||
|
||||
[FieldDefinition(1, Label = "Cookie", HelpText = "PassThePopcorn uses a login cookie needed to access the API, you'll have to retrieve it via a browser.")]
|
||||
public string Cookie { get; set; }
|
||||
|
||||
[FieldDefinition(2, Type = FieldType.Checkbox, Label = "Prefer Golden", HelpText = "Favors Golden Popcorn-releases over all other releases.")]
|
||||
public bool Golden { get; set; }
|
||||
|
||||
[FieldDefinition(3, Type = FieldType.Checkbox, Label = "Prefer Scene", HelpText = "Favors scene-releases over non-scene releases.")]
|
||||
public bool Scene { get; set; }
|
||||
|
||||
[FieldDefinition(4, Type = FieldType.Checkbox, Label = "Require Approved", HelpText = "Require staff-approval for releases to be accepted.")]
|
||||
public bool Approved { get; set; }
|
||||
|
||||
public NzbDroneValidationResult Validate()
|
||||
{
|
||||
return new NzbDroneValidationResult(Validator.Validate(this));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
using NzbDrone.Common.Http;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Parser;
|
||||
using NLog;
|
||||
|
||||
namespace NzbDrone.Core.Indexers.Torrentleech
|
||||
{
|
||||
public class Torrentleech : HttpIndexerBase<TorrentleechSettings>
|
||||
{
|
||||
public override string Name => "TorrentLeech";
|
||||
|
||||
public override DownloadProtocol Protocol => DownloadProtocol.Torrent;
|
||||
public override bool SupportsSearch => false;
|
||||
public override int PageSize => 0;
|
||||
|
||||
public Torrentleech(IHttpClient httpClient, IIndexerStatusService indexerStatusService, IConfigService configService, IParsingService parsingService, Logger logger)
|
||||
: base(httpClient, indexerStatusService, configService, parsingService, logger)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override IIndexerRequestGenerator GetRequestGenerator()
|
||||
{
|
||||
return new TorrentleechRequestGenerator() { Settings = Settings };
|
||||
}
|
||||
|
||||
public override IParseIndexerResponse GetParser()
|
||||
{
|
||||
return new TorrentRssParser() { UseGuidInfoUrl = true, ParseSeedersInDescription = true };
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using NzbDrone.Common.Http;
|
||||
using NzbDrone.Core.IndexerSearch.Definitions;
|
||||
|
||||
namespace NzbDrone.Core.Indexers.Torrentleech
|
||||
{
|
||||
public class TorrentleechRequestGenerator : IIndexerRequestGenerator
|
||||
{
|
||||
public TorrentleechSettings Settings { get; set; }
|
||||
|
||||
public virtual IndexerPageableRequestChain GetRecentRequests()
|
||||
{
|
||||
var pageableRequests = new IndexerPageableRequestChain();
|
||||
|
||||
pageableRequests.Add(GetRssRequests(null));
|
||||
|
||||
return pageableRequests;
|
||||
}
|
||||
|
||||
public virtual IndexerPageableRequestChain GetSearchRequests(SingleEpisodeSearchCriteria searchCriteria)
|
||||
{
|
||||
return new IndexerPageableRequestChain();
|
||||
}
|
||||
|
||||
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
|
||||
{
|
||||
return new IndexerPageableRequestChain();
|
||||
}
|
||||
|
||||
public virtual IndexerPageableRequestChain GetSearchRequests(SeasonSearchCriteria searchCriteria)
|
||||
{
|
||||
return new IndexerPageableRequestChain();
|
||||
}
|
||||
|
||||
public virtual IndexerPageableRequestChain GetSearchRequests(DailyEpisodeSearchCriteria searchCriteria)
|
||||
{
|
||||
return new IndexerPageableRequestChain();
|
||||
}
|
||||
|
||||
public virtual IndexerPageableRequestChain GetSearchRequests(AnimeEpisodeSearchCriteria searchCriteria)
|
||||
{
|
||||
return new IndexerPageableRequestChain();
|
||||
}
|
||||
|
||||
public virtual IndexerPageableRequestChain GetSearchRequests(SpecialEpisodeSearchCriteria searchCriteria)
|
||||
{
|
||||
return new IndexerPageableRequestChain();
|
||||
}
|
||||
|
||||
private IEnumerable<IndexerRequest> GetRssRequests(string searchParameters)
|
||||
{
|
||||
yield return new IndexerRequest(string.Format("{0}/{1}{2}", Settings.BaseUrl.Trim().TrimEnd('/'), Settings.ApiKey, searchParameters), HttpAccept.Rss);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
using FluentValidation;
|
||||
using NzbDrone.Core.Annotations;
|
||||
using NzbDrone.Core.ThingiProvider;
|
||||
using NzbDrone.Core.Validation;
|
||||
|
||||
namespace NzbDrone.Core.Indexers.Torrentleech
|
||||
{
|
||||
public class TorrentleechSettingsValidator : AbstractValidator<TorrentleechSettings>
|
||||
{
|
||||
public TorrentleechSettingsValidator()
|
||||
{
|
||||
RuleFor(c => c.BaseUrl).ValidRootUrl();
|
||||
RuleFor(c => c.ApiKey).NotEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
public class TorrentleechSettings : IProviderConfig
|
||||
{
|
||||
private static readonly TorrentleechSettingsValidator Validator = new TorrentleechSettingsValidator();
|
||||
|
||||
public TorrentleechSettings()
|
||||
{
|
||||
BaseUrl = "http://rss.torrentleech.org";
|
||||
}
|
||||
|
||||
[FieldDefinition(0, Label = "Website URL")]
|
||||
public string BaseUrl { get; set; }
|
||||
|
||||
[FieldDefinition(1, Label = "API Key")]
|
||||
public string ApiKey { get; set; }
|
||||
|
||||
public NzbDroneValidationResult Validate()
|
||||
{
|
||||
return new NzbDroneValidationResult(Validator.Validate(this));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using NzbDrone.Core.Messaging.Commands;
|
||||
|
||||
namespace NzbDrone.Core.MediaFiles.Commands
|
||||
|
||||
19
src/NzbDrone.Core/MediaFiles/Commands/RenameMovieCommand.cs
Normal file
19
src/NzbDrone.Core/MediaFiles/Commands/RenameMovieCommand.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using NzbDrone.Core.Messaging.Commands;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace NzbDrone.Core.MediaFiles.Commands
|
||||
{
|
||||
public class RenameMovieCommand : Command
|
||||
{
|
||||
public List<int> MovieIds { get; set; }
|
||||
|
||||
public override bool SendUpdatesToClient => true;
|
||||
|
||||
public RenameMovieCommand()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using NzbDrone.Core.Messaging.Commands;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace NzbDrone.Core.MediaFiles.Commands
|
||||
{
|
||||
public class RenameMovieFilesCommand : Command
|
||||
{
|
||||
public int MovieId { get; set; }
|
||||
public List<int> Files { get; set; }
|
||||
|
||||
public override bool SendUpdatesToClient => true;
|
||||
|
||||
public RenameMovieFilesCommand()
|
||||
{
|
||||
}
|
||||
|
||||
public RenameMovieFilesCommand(int movieId, List<int> files)
|
||||
{
|
||||
MovieId = movieId;
|
||||
Files = files;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -38,6 +38,7 @@ namespace NzbDrone.Core.MediaFiles
|
||||
private readonly IDiskProvider _diskProvider;
|
||||
private readonly IMakeImportDecision _importDecisionMaker;
|
||||
private readonly IImportApprovedEpisodes _importApprovedEpisodes;
|
||||
private readonly IImportApprovedMovie _importApprovedMovies;
|
||||
private readonly IConfigService _configService;
|
||||
private readonly ISeriesService _seriesService;
|
||||
private readonly IMediaFileTableCleanupService _mediaFileTableCleanupService;
|
||||
@@ -48,6 +49,7 @@ namespace NzbDrone.Core.MediaFiles
|
||||
public DiskScanService(IDiskProvider diskProvider,
|
||||
IMakeImportDecision importDecisionMaker,
|
||||
IImportApprovedEpisodes importApprovedEpisodes,
|
||||
IImportApprovedMovie importApprovedMovies,
|
||||
IConfigService configService,
|
||||
ISeriesService seriesService,
|
||||
IMediaFileTableCleanupService mediaFileTableCleanupService,
|
||||
@@ -58,6 +60,7 @@ namespace NzbDrone.Core.MediaFiles
|
||||
_diskProvider = diskProvider;
|
||||
_importDecisionMaker = importDecisionMaker;
|
||||
_importApprovedEpisodes = importApprovedEpisodes;
|
||||
_importApprovedMovies = importApprovedMovies;
|
||||
_configService = configService;
|
||||
_seriesService = seriesService;
|
||||
_mediaFileTableCleanupService = mediaFileTableCleanupService;
|
||||
@@ -179,7 +182,8 @@ namespace NzbDrone.Core.MediaFiles
|
||||
decisionsStopwatch.Stop();
|
||||
_logger.Trace("Import decisions complete for: {0} [{1}]", movie, decisionsStopwatch.Elapsed);
|
||||
|
||||
_importApprovedEpisodes.Import(decisions, false);
|
||||
//_importApprovedEpisodes.Import(decisions, false);
|
||||
_importApprovedMovies.Import(decisions, false);
|
||||
|
||||
_logger.Info("Completed scanning disk for {0}", movie.Title);
|
||||
_eventAggregator.PublishEvent(new MovieScannedEvent(movie));
|
||||
|
||||
@@ -159,7 +159,7 @@ namespace NzbDrone.Core.MediaFiles
|
||||
}
|
||||
|
||||
var cleanedUpName = GetCleanedUpFolderName(directoryInfo.Name);
|
||||
var folderInfo = Parser.Parser.ParseTitle(directoryInfo.Name);
|
||||
var folderInfo = Parser.Parser.ParseMovieTitle(directoryInfo.Name);
|
||||
|
||||
if (folderInfo != null)
|
||||
{
|
||||
|
||||
@@ -47,6 +47,8 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport
|
||||
|
||||
public List<ImportResult> Import(List<ImportDecision> decisions, bool newDownload, DownloadClientItem downloadClientItem = null, ImportMode importMode = ImportMode.Auto)
|
||||
{
|
||||
_logger.Debug("Decisions: {0}", decisions.Count);
|
||||
|
||||
var qualifiedImports = decisions.Where(c => c.Approved)
|
||||
.GroupBy(c => c.LocalMovie.Movie.Id, (i, s) => s
|
||||
.OrderByDescending(c => c.LocalMovie.Quality, new QualityModelComparer(s.First().LocalMovie.Movie.Profile))
|
||||
@@ -80,7 +82,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport
|
||||
episodeFile.Quality = localMovie.Quality;
|
||||
episodeFile.MediaInfo = localMovie.MediaInfo;
|
||||
episodeFile.Movie = localMovie.Movie;
|
||||
episodeFile.ReleaseGroup = localMovie.ParsedEpisodeInfo.ReleaseGroup;
|
||||
episodeFile.ReleaseGroup = localMovie.ParsedMovieInfo.ReleaseGroup;
|
||||
|
||||
bool copyOnly;
|
||||
switch (importMode)
|
||||
|
||||
@@ -24,15 +24,15 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport
|
||||
{
|
||||
LocalMovie = localMovie;
|
||||
Rejections = rejections.ToList();
|
||||
LocalEpisode = new LocalEpisode
|
||||
{
|
||||
Quality = localMovie.Quality,
|
||||
ExistingFile = localMovie.ExistingFile,
|
||||
MediaInfo = localMovie.MediaInfo,
|
||||
ParsedEpisodeInfo = localMovie.ParsedEpisodeInfo,
|
||||
Path = localMovie.Path,
|
||||
Size = localMovie.Size
|
||||
};
|
||||
//LocalMovie = new LocalMovie
|
||||
//{
|
||||
// Quality = localMovie.Quality,
|
||||
// ExistingFile = localMovie.ExistingFile,
|
||||
// MediaInfo = localMovie.MediaInfo,
|
||||
// ParsedMovieInfo = localMovie.ParsedMovieInfo,
|
||||
// Path = localMovie.Path,
|
||||
// Size = localMovie.Size
|
||||
//};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport
|
||||
{
|
||||
List<ImportDecision> GetImportDecisions(List<string> videoFiles, Series series);
|
||||
List<ImportDecision> GetImportDecisions(List<string> videoFiles, Movie movie);
|
||||
List<ImportDecision> GetImportDecisions(List<string> videoFiles, Movie movie, ParsedEpisodeInfo folderInfo, bool sceneSource); //TODO: Needs changing to ParsedMovieInfo!!
|
||||
List<ImportDecision> GetImportDecisions(List<string> videoFiles, Movie movie, ParsedMovieInfo folderInfo, bool sceneSource); //TODO: Needs changing to ParsedMovieInfo!!
|
||||
List<ImportDecision> GetImportDecisions(List<string> videoFiles, Series series, ParsedEpisodeInfo folderInfo, bool sceneSource);
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport
|
||||
return decisions;
|
||||
}
|
||||
|
||||
public List<ImportDecision> GetImportDecisions(List<string> videoFiles, Movie movie, ParsedEpisodeInfo folderInfo, bool sceneSource)
|
||||
public List<ImportDecision> GetImportDecisions(List<string> videoFiles, Movie movie, ParsedMovieInfo folderInfo, bool sceneSource)
|
||||
{
|
||||
var newFiles = _mediaFileService.FilterExistingFiles(videoFiles.ToList(), movie);
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport
|
||||
return decisions;
|
||||
}
|
||||
|
||||
private ImportDecision GetDecision(string file, Movie movie, ParsedEpisodeInfo folderInfo, bool sceneSource, bool shouldUseFolderName)
|
||||
private ImportDecision GetDecision(string file, Movie movie, ParsedMovieInfo folderInfo, bool sceneSource, bool shouldUseFolderName)
|
||||
{
|
||||
ImportDecision decision = null;
|
||||
|
||||
@@ -123,18 +123,18 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport
|
||||
|
||||
else
|
||||
{
|
||||
var localEpisode = new LocalEpisode();
|
||||
localEpisode.Path = file;
|
||||
localMovie = new LocalMovie();
|
||||
localMovie.Path = file;
|
||||
|
||||
decision = new ImportDecision(localEpisode, new Rejection("Unable to parse file"));
|
||||
decision = new ImportDecision(localMovie, new Rejection("Unable to parse file"));
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_logger.Error(e, "Couldn't import file. " + file);
|
||||
|
||||
var localEpisode = new LocalEpisode { Path = file };
|
||||
decision = new ImportDecision(localEpisode, new Rejection("Unexpected error processing file"));
|
||||
var localMovie = new LocalMovie { Path = file };
|
||||
decision = new ImportDecision(localMovie, new Rejection("Unexpected error processing file"));
|
||||
}
|
||||
|
||||
//LocalMovie nullMovie = null;
|
||||
@@ -291,17 +291,17 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport
|
||||
}) == 1;
|
||||
}
|
||||
|
||||
private bool ShouldUseFolderName(List<string> videoFiles, Movie movie, ParsedEpisodeInfo folderInfo)
|
||||
private bool ShouldUseFolderName(List<string> videoFiles, Movie movie, ParsedMovieInfo folderInfo)
|
||||
{
|
||||
if (folderInfo == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (folderInfo.FullSeason)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
//if (folderInfo.FullSeason)
|
||||
//{
|
||||
// return false;
|
||||
//}
|
||||
|
||||
return videoFiles.Count(file =>
|
||||
{
|
||||
@@ -325,7 +325,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport
|
||||
}) == 1;
|
||||
}
|
||||
|
||||
private QualityModel GetQuality(ParsedEpisodeInfo folderInfo, QualityModel fileQuality, Movie movie)
|
||||
private QualityModel GetQuality(ParsedMovieInfo folderInfo, QualityModel fileQuality, Movie movie)
|
||||
{
|
||||
if (UseFolderQuality(folderInfo, fileQuality, movie))
|
||||
{
|
||||
@@ -347,7 +347,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport
|
||||
return fileQuality;
|
||||
}
|
||||
|
||||
private bool UseFolderQuality(ParsedEpisodeInfo folderInfo, QualityModel fileQuality, Movie movie)
|
||||
private bool UseFolderQuality(ParsedMovieInfo folderInfo, QualityModel fileQuality, Movie movie)
|
||||
{
|
||||
if (folderInfo == null)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
@@ -13,9 +13,9 @@ namespace NzbDrone.Core.MediaFiles
|
||||
{
|
||||
public interface IMediaFileService
|
||||
{
|
||||
MovieFile Add(MovieFile episodeFile);
|
||||
void Update(MovieFile episodeFile);
|
||||
void Delete(MovieFile episodeFile, DeleteMediaFileReason reason);
|
||||
MovieFile Add(MovieFile movieFile);
|
||||
void Update(MovieFile movieFile);
|
||||
void Delete(MovieFile movieFile, DeleteMediaFileReason reason);
|
||||
EpisodeFile Add(EpisodeFile episodeFile);
|
||||
void Update(EpisodeFile episodeFile);
|
||||
void Delete(EpisodeFile episodeFile, DeleteMediaFileReason reason);
|
||||
@@ -27,7 +27,9 @@ namespace NzbDrone.Core.MediaFiles
|
||||
List<string> FilterExistingFiles(List<string> files, Movie movie);
|
||||
EpisodeFile Get(int id);
|
||||
List<EpisodeFile> Get(IEnumerable<int> ids);
|
||||
List<MovieFile> GetMovies(IEnumerable<int> ids);
|
||||
|
||||
//List<MovieFile> Get(IEnumerable<int> ids);
|
||||
}
|
||||
|
||||
public class MediaFileService : IMediaFileService, IHandleAsync<SeriesDeletedEvent>
|
||||
@@ -125,6 +127,11 @@ namespace NzbDrone.Core.MediaFiles
|
||||
return _mediaFileRepository.Get(ids).ToList();
|
||||
}
|
||||
|
||||
public List<MovieFile> GetMovies(IEnumerable<int> ids)
|
||||
{
|
||||
return _movieFileRepository.Get(ids).ToList();
|
||||
}
|
||||
|
||||
public void HandleAsync(SeriesDeletedEvent message)
|
||||
{
|
||||
var files = GetFilesBySeries(message.Series.Id);
|
||||
|
||||
15
src/NzbDrone.Core/MediaFiles/RenameMovieFilePreview.cs
Normal file
15
src/NzbDrone.Core/MediaFiles/RenameMovieFilePreview.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace NzbDrone.Core.MediaFiles
|
||||
{
|
||||
public class RenameMovieFilePreview
|
||||
{
|
||||
public int MovieId { get; set; }
|
||||
public int MovieFileId { get; set; }
|
||||
public string ExistingPath { get; set; }
|
||||
public string NewPath { get; set; }
|
||||
}
|
||||
}
|
||||
138
src/NzbDrone.Core/MediaFiles/RenameMovieFileService.cs
Normal file
138
src/NzbDrone.Core/MediaFiles/RenameMovieFileService.cs
Normal file
@@ -0,0 +1,138 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Messaging.Commands;
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
using NzbDrone.Core.MediaFiles.Commands;
|
||||
using NzbDrone.Core.MediaFiles.Events;
|
||||
using NzbDrone.Common.Disk;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Common.Instrumentation.Extensions;
|
||||
using NzbDrone.Core.Organizer;
|
||||
using NzbDrone.Core.Tv;
|
||||
|
||||
namespace NzbDrone.Core.MediaFiles
|
||||
{
|
||||
public interface IRenameMovieFileService
|
||||
{
|
||||
List<RenameMovieFilePreview> GetRenamePreviews(int movieId);
|
||||
}
|
||||
|
||||
public class RenameMovieFileService : IRenameMovieFileService,
|
||||
IExecute<RenameMovieFilesCommand>,
|
||||
IExecute<RenameMovieCommand>
|
||||
{
|
||||
private readonly IMovieService _movieService;
|
||||
private readonly IMediaFileService _mediaFileService;
|
||||
private readonly IMoveMovieFiles _movieFileMover;
|
||||
private readonly IEventAggregator _eventAggregator;
|
||||
private readonly IBuildFileNames _filenameBuilder;
|
||||
private readonly Logger _logger;
|
||||
|
||||
public RenameMovieFileService(IMovieService movieService,
|
||||
IMediaFileService mediaFileService,
|
||||
IMoveMovieFiles movieFileMover,
|
||||
IEventAggregator eventAggregator,
|
||||
IBuildFileNames filenameBuilder,
|
||||
Logger logger)
|
||||
{
|
||||
_movieService = movieService;
|
||||
_mediaFileService = mediaFileService;
|
||||
_movieFileMover = movieFileMover;
|
||||
_eventAggregator = eventAggregator;
|
||||
_filenameBuilder = filenameBuilder;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public List<RenameMovieFilePreview> GetRenamePreviews(int movieId)
|
||||
{
|
||||
var movie = _movieService.GetMovie(movieId);
|
||||
var file = _mediaFileService.GetFilesByMovie(movieId);
|
||||
|
||||
return GetPreviews(movie, file).OrderByDescending(m => m.MovieId).ToList(); //TODO: Would really like to not have these be lists
|
||||
|
||||
}
|
||||
|
||||
private IEnumerable<RenameMovieFilePreview> GetPreviews(Movie movie, List<MovieFile> files)
|
||||
{
|
||||
foreach(var file in files)
|
||||
{
|
||||
var movieFilePath = Path.Combine(movie.Path, file.RelativePath);
|
||||
|
||||
var newName = _filenameBuilder.BuildFileName(movie, file);
|
||||
var newPath = _filenameBuilder.BuildFilePath(movie, newName, Path.GetExtension(movieFilePath));
|
||||
|
||||
if(!movieFilePath.PathEquals(newPath, StringComparison.Ordinal))
|
||||
{
|
||||
yield return new RenameMovieFilePreview
|
||||
{
|
||||
MovieId = movie.Id,
|
||||
MovieFileId = file.Id,
|
||||
ExistingPath = file.RelativePath,
|
||||
NewPath = movie.Path.GetRelativePath(newPath)
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void RenameFiles(List<MovieFile> movieFiles, Movie movie)
|
||||
{
|
||||
var renamed = new List<MovieFile>();
|
||||
|
||||
foreach(var movieFile in movieFiles)
|
||||
{
|
||||
var movieFilePath = Path.Combine(movie.Path, movieFile.RelativePath);
|
||||
|
||||
try
|
||||
{
|
||||
_logger.Debug("Renaming movie file: {0}", movieFile);
|
||||
_movieFileMover.MoveMovieFile(movieFile, movie);
|
||||
|
||||
_mediaFileService.Update(movieFile);
|
||||
renamed.Add(movieFile);
|
||||
|
||||
_logger.Debug("Renamed movie file: {0}", movieFile);
|
||||
|
||||
}
|
||||
catch(SameFilenameException ex)
|
||||
{
|
||||
_logger.Debug("File not renamed, source and destination are the same: {0}", ex.Filename);
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
_logger.Error(ex, "Failed to rename file: " + movieFilePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Execute(RenameMovieFilesCommand message)
|
||||
{
|
||||
var movie = _movieService.GetMovie(message.MovieId);
|
||||
var movieFiles = _mediaFileService.GetMovies(message.Files);
|
||||
|
||||
_logger.ProgressInfo("Renaming {0} files for {1}", movieFiles.Count, movie.Title);
|
||||
RenameFiles(movieFiles, movie);
|
||||
_logger.ProgressInfo("Selected movie files renamed for {0}", movie.Title);
|
||||
}
|
||||
|
||||
public void Execute(RenameMovieCommand message)
|
||||
{
|
||||
_logger.Debug("Renaming all files for selected movie");
|
||||
var moviesToRename = _movieService.GetMovies(message.MovieIds);
|
||||
|
||||
foreach(var movie in moviesToRename)
|
||||
{
|
||||
var movieFiles = _mediaFileService.GetFilesByMovie(movie.Id);
|
||||
_logger.ProgressInfo("Renaming all files in movie: {0}", movie.Title);
|
||||
RenameFiles(movieFiles, movie);
|
||||
_logger.ProgressInfo("All movie files renamed for {0}", movie.Title);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,10 @@ using System.Text;
|
||||
namespace NzbDrone.Core.MetadataSource.SkyHook.Resource
|
||||
{
|
||||
|
||||
public class FindRoot
|
||||
{
|
||||
public MovieResult[] movie_results { get; set; }
|
||||
}
|
||||
public class MovieSearchRoot
|
||||
{
|
||||
public int page { get; set; }
|
||||
@@ -61,6 +65,27 @@ namespace NzbDrone.Core.MetadataSource.SkyHook.Resource
|
||||
public float vote_average { get; set; }
|
||||
public int vote_count { get; set; }
|
||||
public AlternativeTitles alternative_titles { get; set; }
|
||||
public ReleaseDatesResource release_dates { get; set; }
|
||||
}
|
||||
|
||||
public class ReleaseDatesResource
|
||||
{
|
||||
public List<ReleaseDates> results { get; set; }
|
||||
}
|
||||
|
||||
public class ReleaseDate
|
||||
{
|
||||
public string certification { get; set; }
|
||||
public string iso_639_1 { get; set; }
|
||||
public string note { get; set; }
|
||||
public string release_date { get; set; }
|
||||
public int type { get; set; }
|
||||
}
|
||||
|
||||
public class ReleaseDates
|
||||
{
|
||||
public string iso_3166_1 { get; set; }
|
||||
public List<ReleaseDate> release_dates { get; set; }
|
||||
}
|
||||
|
||||
public class Belongs_To_Collection
|
||||
|
||||
@@ -24,13 +24,15 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
|
||||
private readonly IHttpRequestBuilderFactory _requestBuilder;
|
||||
private readonly IHttpRequestBuilderFactory _movieBuilder;
|
||||
private readonly ITmdbConfigService _configService;
|
||||
private readonly IMovieService _movieService;
|
||||
|
||||
public SkyHookProxy(IHttpClient httpClient, ISonarrCloudRequestBuilder requestBuilder, ITmdbConfigService configService, Logger logger)
|
||||
public SkyHookProxy(IHttpClient httpClient, ISonarrCloudRequestBuilder requestBuilder, ITmdbConfigService configService, IMovieService movieService, Logger logger)
|
||||
{
|
||||
_httpClient = httpClient;
|
||||
_requestBuilder = requestBuilder.SkyHookTvdb;
|
||||
_movieBuilder = requestBuilder.TMDB;
|
||||
_configService = configService;
|
||||
_movieService = movieService;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
@@ -70,7 +72,7 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
|
||||
.SetSegment("route", "movie")
|
||||
.SetSegment("id", TmdbId.ToString())
|
||||
.SetSegment("secondaryRoute", "")
|
||||
.AddQueryParam("append_to_response", "alternative_titles")
|
||||
.AddQueryParam("append_to_response", "alternative_titles,release_dates")
|
||||
.AddQueryParam("country", "US")
|
||||
.Build();
|
||||
|
||||
@@ -93,6 +95,13 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
|
||||
movie.InCinemas = DateTime.Parse(resource.release_date);
|
||||
movie.Year = movie.InCinemas.Value.Year;
|
||||
|
||||
var slugResult = _movieService.FindByTitleSlug(movie.TitleSlug);
|
||||
if (slugResult != null)
|
||||
{
|
||||
_logger.Debug("Movie with this title slug already exists. Adding year...");
|
||||
}
|
||||
movie.TitleSlug += "-" + movie.Year.ToString();
|
||||
|
||||
movie.Images.Add(_configService.GetCoverForURL(resource.poster_path, MediaCoverTypes.Poster));//TODO: Update to load image specs from tmdb page!
|
||||
movie.Images.Add(_configService.GetCoverForURL(resource.backdrop_path, MediaCoverTypes.Banner));
|
||||
movie.Runtime = resource.runtime;
|
||||
@@ -102,6 +111,27 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
|
||||
movie.AlternativeTitles.Add(title.title);
|
||||
}
|
||||
|
||||
foreach(ReleaseDates releaseDates in resource.release_dates.results)
|
||||
{
|
||||
foreach(ReleaseDate releaseDate in releaseDates.release_dates)
|
||||
{
|
||||
if (releaseDate.type == 5 || releaseDate.type == 4)
|
||||
{
|
||||
if (movie.PhysicalRelease.HasValue)
|
||||
{
|
||||
if (movie.PhysicalRelease.Value.After(DateTime.Parse(releaseDate.release_date)))
|
||||
{
|
||||
movie.PhysicalRelease = DateTime.Parse(releaseDate.release_date); //Use oldest release date available.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
movie.PhysicalRelease = DateTime.Parse(releaseDate.release_date);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
movie.Ratings = new Ratings();
|
||||
movie.Ratings.Votes = resource.vote_count;
|
||||
movie.Ratings.Value = (decimal)resource.vote_average;
|
||||
@@ -125,79 +155,29 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
|
||||
|
||||
public Movie GetMovieInfo(string ImdbId)
|
||||
{
|
||||
var imdbRequest = new HttpRequest("http://www.omdbapi.com/?i=" + ImdbId + "&plot=full&r=json");
|
||||
var request = _movieBuilder.Create()
|
||||
.SetSegment("route", "find")
|
||||
.SetSegment("id", ImdbId)
|
||||
.SetSegment("secondaryRoute", "")
|
||||
.AddQueryParam("external_source", "imdb_id")
|
||||
.Build();
|
||||
|
||||
var httpResponse = _httpClient.Get(imdbRequest);
|
||||
request.AllowAutoRedirect = true;
|
||||
request.SuppressHttpError = true;
|
||||
|
||||
if (httpResponse.HasHttpError)
|
||||
{
|
||||
if (httpResponse.StatusCode == HttpStatusCode.NotFound)
|
||||
{
|
||||
throw new MovieNotFoundException(ImdbId);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new HttpException(imdbRequest, httpResponse);
|
||||
}
|
||||
}
|
||||
var resources = _httpClient.Get<FindRoot>(request).Resource;
|
||||
|
||||
var response = httpResponse.Content;
|
||||
|
||||
dynamic json = JsonConvert.DeserializeObject(response);
|
||||
|
||||
var movie = new Movie();
|
||||
|
||||
movie.Title = json.Title;
|
||||
movie.TitleSlug = movie.Title.ToLower().Replace(" ", "-");
|
||||
movie.Overview = json.Plot;
|
||||
movie.CleanTitle = Parser.Parser.CleanSeriesTitle(movie.Title);
|
||||
string airDateStr = json.Released;
|
||||
DateTime airDate = DateTime.Parse(airDateStr);
|
||||
movie.InCinemas = airDate;
|
||||
movie.Year = airDate.Year;
|
||||
movie.ImdbId = ImdbId;
|
||||
string imdbRating = json.imdbVotes;
|
||||
if (imdbRating == "N/A")
|
||||
{
|
||||
movie.Status = MovieStatusType.Announced;
|
||||
}
|
||||
else
|
||||
{
|
||||
movie.Status = MovieStatusType.Released;
|
||||
}
|
||||
string url = json.Poster;
|
||||
var imdbPoster = new MediaCover.MediaCover(MediaCoverTypes.Poster, url);
|
||||
movie.Images.Add(imdbPoster);
|
||||
string runtime = json.Runtime;
|
||||
int runtimeNum = 0;
|
||||
int.TryParse(runtime.Replace("min", "").Trim(), out runtimeNum);
|
||||
movie.Runtime = runtimeNum;
|
||||
|
||||
return movie;
|
||||
}
|
||||
|
||||
private string[] SeparateYearFromTitle(string title)
|
||||
{
|
||||
var yearPattern = @"((?:19|20)\d{2})";
|
||||
var newTitle = title;
|
||||
var substrings = Regex.Split(title, yearPattern);
|
||||
var year = "";
|
||||
if (substrings.Length > 1) {
|
||||
newTitle = substrings[0].TrimEnd("(");
|
||||
year = substrings[1];
|
||||
}
|
||||
|
||||
return new[] { newTitle.Trim(), year.Trim() };
|
||||
return resources.movie_results.SelectList(MapMovie).FirstOrDefault();
|
||||
}
|
||||
|
||||
private string StripTrailingTheFromTitle(string title)
|
||||
{
|
||||
if(title.EndsWith(",the"))
|
||||
{
|
||||
title = title.Substring(title.Length - 4);
|
||||
title = title.Substring(0, title.Length - 4);
|
||||
} else if(title.EndsWith(", the"))
|
||||
{
|
||||
title = title.Substring(title.Length - 5);
|
||||
title = title.Substring(0, title.Length - 5);
|
||||
}
|
||||
return title;
|
||||
}
|
||||
@@ -205,10 +185,25 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
|
||||
public List<Movie> SearchForNewMovie(string title)
|
||||
{
|
||||
var lowerTitle = title.ToLower();
|
||||
var yearCheck = SeparateYearFromTitle(lowerTitle); // TODO: Make this much less hacky!
|
||||
|
||||
lowerTitle = yearCheck[0];
|
||||
var yearTerm = yearCheck[1];
|
||||
var parserResult = Parser.Parser.ParseMovieTitle(title);
|
||||
|
||||
var yearTerm = "";
|
||||
|
||||
if (parserResult != null && parserResult.MovieTitle != title)
|
||||
{
|
||||
//Parser found something interesting!
|
||||
lowerTitle = parserResult.MovieTitle.ToLower();
|
||||
if (parserResult.Year > 1800)
|
||||
{
|
||||
yearTerm = parserResult.Year.ToString();
|
||||
}
|
||||
|
||||
if (parserResult.ImdbId.IsNotNullOrWhiteSpace())
|
||||
{
|
||||
return new List<Movie> { GetMovieInfo(parserResult.ImdbId) };
|
||||
}
|
||||
}
|
||||
|
||||
lowerTitle = StripTrailingTheFromTitle(lowerTitle);
|
||||
|
||||
@@ -233,7 +228,7 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
|
||||
}
|
||||
}
|
||||
|
||||
var searchTerm = lowerTitle.Replace("_", "+").Replace(" ", "+");
|
||||
var searchTerm = lowerTitle.Replace("_", "+").Replace(" ", "+").Replace(".", "+");
|
||||
|
||||
var firstChar = searchTerm.First();
|
||||
|
||||
@@ -269,43 +264,7 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
|
||||
|
||||
var movieResults = response.Resource.results;
|
||||
|
||||
var imdbMovies = new List<Movie>();
|
||||
|
||||
foreach (MovieResult result in movieResults)
|
||||
{
|
||||
var imdbMovie = new Movie();
|
||||
imdbMovie.TmdbId = result.id;
|
||||
try
|
||||
{
|
||||
imdbMovie.SortTitle = result.title;
|
||||
imdbMovie.Title = result.title;
|
||||
string titleSlug = result.title;
|
||||
imdbMovie.TitleSlug = titleSlug.ToLower().Replace(" ", "-");
|
||||
imdbMovie.Year = DateTime.Parse(result.release_date).Year;
|
||||
imdbMovie.Images = new List<MediaCover.MediaCover>();
|
||||
imdbMovie.Overview = result.overview;
|
||||
try
|
||||
{
|
||||
string url = result.poster_path;
|
||||
var imdbPoster = _configService.GetCoverForURL(result.poster_path, MediaCoverTypes.Poster);
|
||||
imdbMovie.Images.Add(imdbPoster);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_logger.Debug(result);
|
||||
continue;
|
||||
}
|
||||
|
||||
imdbMovies.Add(imdbMovie);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return imdbMovies;
|
||||
return movieResults.SelectList(MapMovie);
|
||||
}
|
||||
|
||||
public List<Series> SearchForNewSeries(string title)
|
||||
@@ -359,6 +318,48 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
|
||||
}
|
||||
}
|
||||
|
||||
private Movie MapMovie(MovieResult result)
|
||||
{
|
||||
var imdbMovie = new Movie();
|
||||
imdbMovie.TmdbId = result.id;
|
||||
try
|
||||
{
|
||||
imdbMovie.SortTitle = result.title;
|
||||
imdbMovie.Title = result.title;
|
||||
string titleSlug = result.title;
|
||||
imdbMovie.TitleSlug = titleSlug.ToLower().Replace(" ", "-");
|
||||
imdbMovie.Year = DateTime.Parse(result.release_date).Year;
|
||||
|
||||
var slugResult = _movieService.FindByTitleSlug(imdbMovie.TitleSlug);
|
||||
if (slugResult != null)
|
||||
{
|
||||
_logger.Debug("Movie with this title slug already exists. Adding year...");
|
||||
}
|
||||
imdbMovie.TitleSlug += "-" + imdbMovie.Year.ToString();
|
||||
|
||||
imdbMovie.Images = new List<MediaCover.MediaCover>();
|
||||
imdbMovie.Overview = result.overview;
|
||||
try
|
||||
{
|
||||
string url = result.poster_path;
|
||||
var imdbPoster = _configService.GetCoverForURL(result.poster_path, MediaCoverTypes.Poster);
|
||||
imdbMovie.Images.Add(imdbPoster);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_logger.Debug(result);
|
||||
}
|
||||
|
||||
return imdbMovie;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_logger.Error(e, "Error occured while searching for new movies.");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static Series MapSeries(ShowResource show)
|
||||
{
|
||||
var series = new Series();
|
||||
|
||||
@@ -183,6 +183,9 @@
|
||||
<Compile Include="Datastore\Migration\002_remove_tvrage_imdb_unique_constraint.cs" />
|
||||
<Compile Include="Datastore\Migration\003_remove_clean_title_from_scene_mapping.cs" />
|
||||
<Compile Include="Datastore\Migration\004_updated_history.cs" />
|
||||
<Compile Include="Datastore\Migration\111_remove_bitmetv.cs" />
|
||||
<Compile Include="Datastore\Migration\112_remove_torrentleech.cs" />
|
||||
<Compile Include="Datastore\Migration\113_remove_broadcasthenet.cs" />
|
||||
<Compile Include="Datastore\Migration\108_update_schedule_interval.cs" />
|
||||
<Compile Include="Datastore\Migration\107_fix_movie_files.cs" />
|
||||
<Compile Include="Datastore\Migration\106_add_tmdb_stuff.cs" />
|
||||
@@ -286,6 +289,7 @@
|
||||
<Compile Include="Datastore\Migration\098_remove_titans_of_tv.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Datastore\Migration\110_add_physical_release_to_table.cs" />
|
||||
<Compile Include="Datastore\Migration\109_add_movie_formats_to_naming_config.cs" />
|
||||
<Compile Include="Datastore\Migration\Framework\MigrationContext.cs" />
|
||||
<Compile Include="Datastore\Migration\Framework\MigrationController.cs" />
|
||||
@@ -572,16 +576,6 @@
|
||||
<Compile Include="IndexerSearch\Definitions\MovieSearchCriteria.cs" />
|
||||
<Compile Include="IndexerSearch\MoviesSearchCommand.cs" />
|
||||
<Compile Include="IndexerSearch\MoviesSearchService.cs" />
|
||||
<Compile Include="Indexers\BitMeTv\BitMeTv.cs" />
|
||||
<Compile Include="Indexers\BitMeTv\BitMeTvSettings.cs" />
|
||||
<Compile Include="Indexers\BitMeTv\BitMeTvRequestGenerator.cs" />
|
||||
<Compile Include="Indexers\BroadcastheNet\BroadcastheNetRequestGenerator.cs" />
|
||||
<Compile Include="Indexers\BroadcastheNet\BroadcastheNet.cs" />
|
||||
<Compile Include="Indexers\BroadcastheNet\BroadcastheNetSettings.cs" />
|
||||
<Compile Include="Indexers\BroadcastheNet\BroadcastheNetParser.cs" />
|
||||
<Compile Include="Indexers\BroadcastheNet\BroadcastheNetTorrent.cs" />
|
||||
<Compile Include="Indexers\BroadcastheNet\BroadcastheNetTorrentQuery.cs" />
|
||||
<Compile Include="Indexers\BroadcastheNet\BroadcastheNetTorrents.cs" />
|
||||
<Compile Include="Indexers\DownloadProtocol.cs" />
|
||||
<Compile Include="Indexers\Exceptions\ApiKeyException.cs" />
|
||||
<Compile Include="Indexers\Exceptions\IndexerException.cs" />
|
||||
@@ -592,6 +586,12 @@
|
||||
<Compile Include="Indexers\Fanzub\FanzubRequestGenerator.cs" />
|
||||
<Compile Include="Indexers\Fanzub\FanzubSettings.cs" />
|
||||
<Compile Include="Indexers\FetchAndParseRssService.cs" />
|
||||
<Compile Include="Indexers\PassThePopcorn\PassThePopcorn.cs" />
|
||||
<Compile Include="Indexers\PassThePopcorn\PassThePopcornApi.cs" />
|
||||
<Compile Include="Indexers\PassThePopcorn\PassThePopcornInfo.cs" />
|
||||
<Compile Include="Indexers\PassThePopcorn\PassThePopcornParser.cs" />
|
||||
<Compile Include="Indexers\PassThePopcorn\PassThePopcornRequestGenerator.cs" />
|
||||
<Compile Include="Indexers\PassThePopcorn\PassThePopcornSettings.cs" />
|
||||
<Compile Include="Indexers\HDBits\HDBits.cs" />
|
||||
<Compile Include="Indexers\HDBits\HDBitsApi.cs" />
|
||||
<Compile Include="Indexers\HDBits\HDBitsParser.cs" />
|
||||
@@ -651,9 +651,6 @@
|
||||
<Compile Include="Indexers\RssSyncCommand.cs" />
|
||||
<Compile Include="Indexers\RssSyncCompleteEvent.cs" />
|
||||
<Compile Include="Indexers\RssSyncService.cs" />
|
||||
<Compile Include="Indexers\Torrentleech\TorrentleechRequestGenerator.cs" />
|
||||
<Compile Include="Indexers\Torrentleech\Torrentleech.cs" />
|
||||
<Compile Include="Indexers\Torrentleech\TorrentleechSettings.cs" />
|
||||
<Compile Include="Indexers\TorrentRss\TorrentRssIndexer.cs" />
|
||||
<Compile Include="Indexers\TorrentRss\TorrentRssIndexerParserSettings.cs" />
|
||||
<Compile Include="Indexers\TorrentRss\TorrentRssIndexerRequestGenerator.cs" />
|
||||
@@ -710,6 +707,8 @@
|
||||
<Compile Include="MediaFiles\Commands\BackendCommandAttribute.cs" />
|
||||
<Compile Include="MediaFiles\Commands\CleanUpRecycleBinCommand.cs" />
|
||||
<Compile Include="MediaFiles\Commands\DownloadedEpisodesScanCommand.cs" />
|
||||
<Compile Include="MediaFiles\Commands\RenameMovieCommand.cs" />
|
||||
<Compile Include="MediaFiles\Commands\RenameMovieFilesCommand.cs" />
|
||||
<Compile Include="MediaFiles\Commands\RescanMovieCommand.cs" />
|
||||
<Compile Include="MediaFiles\DownloadedMovieCommandService.cs" />
|
||||
<Compile Include="MediaFiles\MovieFileMovingService.cs" />
|
||||
@@ -783,6 +782,8 @@
|
||||
<Compile Include="MediaFiles\RecycleBinProvider.cs" />
|
||||
<Compile Include="MediaFiles\RenameEpisodeFilePreview.cs" />
|
||||
<Compile Include="MediaFiles\RenameEpisodeFileService.cs" />
|
||||
<Compile Include="MediaFiles\RenameMovieFilePreview.cs" />
|
||||
<Compile Include="MediaFiles\RenameMovieFileService.cs" />
|
||||
<Compile Include="MediaFiles\SameFilenameException.cs" />
|
||||
<Compile Include="MediaFiles\UpdateMovieFileService.cs" />
|
||||
<Compile Include="MediaFiles\UpdateEpisodeFileService.cs" />
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Linq;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using NzbDrone.Core.Qualities;
|
||||
using NzbDrone.Core.Tv;
|
||||
@@ -14,7 +14,7 @@ namespace NzbDrone.Core.Parser.Model
|
||||
|
||||
public string Path { get; set; }
|
||||
public long Size { get; set; }
|
||||
public ParsedEpisodeInfo ParsedEpisodeInfo { get; set; }
|
||||
public ParsedMovieInfo ParsedMovieInfo { get; set; }
|
||||
public Movie Movie { get; set; }
|
||||
public QualityModel Quality { get; set; }
|
||||
public MediaInfoModel MediaInfo { get; set; }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Linq;
|
||||
using System.Linq;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Qualities;
|
||||
|
||||
@@ -9,14 +9,15 @@ namespace NzbDrone.Core.Parser.Model
|
||||
public string MovieTitle { get; set; }
|
||||
public SeriesTitleInfo MovieTitleInfo { get; set; }
|
||||
public QualityModel Quality { get; set; }
|
||||
public int SeasonNumber { get; set; }
|
||||
//public int SeasonNumber { get; set; }
|
||||
public Language Language { get; set; }
|
||||
public bool FullSeason { get; set; }
|
||||
public bool Special { get; set; }
|
||||
//public bool FullSeason { get; set; }
|
||||
//public bool Special { get; set; }
|
||||
public string ReleaseGroup { get; set; }
|
||||
public string ReleaseHash { get; set; }
|
||||
public string Edition { get; set;}
|
||||
public int Year { get; set; }
|
||||
public string ImdbId { get; set; }
|
||||
|
||||
public ParsedMovieInfo()
|
||||
{
|
||||
|
||||
@@ -18,20 +18,20 @@ namespace NzbDrone.Core.Parser
|
||||
private static readonly Regex[] ReportMovieTitleRegex = new[]
|
||||
{
|
||||
//Special, Despecialized, etc. Edition Movies, e.g: Mission.Impossible.3.Special.Edition.2011
|
||||
new Regex(@"^(?<title>.+?)?(?:(?:[-_\W](?<![()\[!]))*(?<edition>(\w+\.?edition))\.(?<year>(?<!e|x)\d{4}(?!p|i|\d+|\)|\]|\W\d+)))+(\W+|_|$)(?!\\)",
|
||||
new Regex(@"^(?<title>.+?)?(?:(?:[-_\W](?<![)\[!]))*(?<edition>(\w+\.?edition))\.(?<year>(19|20)\d{2}(?!p|i|\d+|\]|\W\d+)))+(\W+|_|$)(?!\\)",
|
||||
RegexOptions.IgnoreCase | RegexOptions.Compiled),
|
||||
//Special, Despecialized, etc. Edition Movies, e.g: Mission.Impossible.3.2011.Special.Edition //TODO: Seems to slow down parsing heavily!
|
||||
new Regex(@"^(?<title>.+?)?(?:(?:[-_\W](?<![()\[!]))*(?<year>(?<!e|x)\d{4}(?!p|i|\d+|\)|\]|\W\d+)))+(\W+|_|$)(?!\\)(?<edition>((\w+\.?){1,3}edition))",
|
||||
new Regex(@"^(?<title>.+?)?(?:(?:[-_\W](?<![)\[!]))*(?<year>(19|20)\d{2}(?!p|i|\d+|\]|\W\d+)))+(\W+|_|$)(?!\\)(?<edition>((\w+\.?){1,3}edition))",
|
||||
RegexOptions.IgnoreCase | RegexOptions.Compiled),
|
||||
//Cut Movies, e.g: Mission.Impossible.3.Directors.Cut.2011
|
||||
new Regex(@"^(?<title>.+?)?(?:(?:[-_\W](?<![()\[!]))*(?<edition>(\w+\.?cut))\.(?<year>(?<!e|x)\d{4}(?!p|i|\d+|\)|\]|\W\d+)))+(\W+|_|$)(?!\\)",
|
||||
new Regex(@"^(?<title>.+?)?(?:(?:[-_\W](?<![)\[!]))*(?<edition>(\w+\.?cut))\.(?<year>(19|20)\d{2}(?!p|i|\d+|\]|\W\d+)))+(\W+|_|$)(?!\\)",
|
||||
RegexOptions.IgnoreCase | RegexOptions.Compiled),
|
||||
//Cut Movies, e.g: Mission.Impossible.3.2011.Directors.Cut
|
||||
new Regex(@"^(?<title>.+?)?(?:(?:[-_\W](?<![()\[!]))*(?<year>(?<!e|x)\d{4}(?!p|i|\d+|\)|\]|\W\d+)))+(\W+|_|$)(?!\\)(?<edition>((\w+\.?){1,3}cut))",
|
||||
new Regex(@"^(?<title>.+?)?(?:(?:[-_\W](?<![)\[!]))*(?<year>(19|20)\d{2}(?!p|i|\d+|\]|\W\d+)))+(\W+|_|$)(?!\\)(?<edition>((\w+\.?){1,3}cut))",
|
||||
RegexOptions.IgnoreCase | RegexOptions.Compiled),
|
||||
|
||||
//Normal movie format, e.g: Mission.Impossible.3.2011
|
||||
new Regex(@"^(?<title>.+?)?(?:(?:[-_\W](?<![()\[!]))*(?<year>(?<!e|x)\d{4}(?!p|i|\d+|\)|\]|\W\d+)))+(\W+|_|$)(?!\\)",
|
||||
new Regex(@"^(?<title>.+?)?(?:(?:[-_\W](?<![)\[!]))*(?<year>(19|20)\d{2}(?!p|i|\d+|\]|\W\d+)))+(\W+|_|$)(?!\\)",
|
||||
RegexOptions.IgnoreCase | RegexOptions.Compiled),
|
||||
//PassThePopcorn Torrent names: Star.Wars[PassThePopcorn]
|
||||
new Regex(@"^(?<title>.+?)?(?:(?:[-_\W](?<![()\[!]))*(?<year>(\[\w *\])))+(\W+|_|$)(?!\\)",
|
||||
@@ -263,7 +263,9 @@ namespace NzbDrone.Core.Parser
|
||||
private static readonly Regex FileExtensionRegex = new Regex(@"\.[a-z0-9]{2,4}$",
|
||||
RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
||||
|
||||
private static readonly Regex SimpleTitleRegex = new Regex(@"(?:480[ip]|720[ip]|1080[ip]|[xh][\W_]?26[45]|DD\W?5\W1|[<>?*:|]|848x480|1280x720|1920x1080|(8|10)b(it)?)\s*",
|
||||
private static readonly Regex ReportImdbId = new Regex(@"(?<imdbid>tt\d{9})", RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
||||
|
||||
private static readonly Regex SimpleTitleRegex = new Regex(@"(?:480[ip]|576[ip]|720[ip]|1080[ip]|[xh][\W_]?26[45]|DD\W?5\W1|[<>?*:|]|848x480|1280x720|1920x1080|(8|10)b(it)?)\s*",
|
||||
RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
||||
|
||||
private static readonly Regex WebsitePrefixRegex = new Regex(@"^\[\s*[a-z]+(\.[a-z]+)+\s*\][- ]*",
|
||||
@@ -321,6 +323,28 @@ namespace NzbDrone.Core.Parser
|
||||
return result;
|
||||
}
|
||||
|
||||
public static ParsedMovieInfo ParseMoviePath(string path)
|
||||
{
|
||||
var fileInfo = new FileInfo(path);
|
||||
|
||||
var result = ParseMovieTitle(fileInfo.Name);
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
Logger.Debug("Attempting to parse episode info using directory and file names. {0}", fileInfo.Directory.Name);
|
||||
result = ParseMovieTitle(fileInfo.Directory.Name + " " + fileInfo.Name);
|
||||
}
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
Logger.Debug("Attempting to parse episode info using directory name. {0}", fileInfo.Directory.Name);
|
||||
result = ParseMovieTitle(fileInfo.Directory.Name + fileInfo.Extension);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
public static ParsedMovieInfo ParseMovieTitle(string title)
|
||||
{
|
||||
|
||||
@@ -374,6 +398,8 @@ namespace NzbDrone.Core.Parser
|
||||
|
||||
result.ReleaseGroup = ParseReleaseGroup(title);
|
||||
|
||||
result.ImdbId = ParseImdbId(title);
|
||||
|
||||
var subGroup = GetSubGroup(match);
|
||||
if (!subGroup.IsNullOrWhiteSpace())
|
||||
{
|
||||
@@ -411,6 +437,23 @@ namespace NzbDrone.Core.Parser
|
||||
return realResult;
|
||||
}
|
||||
|
||||
public static string ParseImdbId(string title)
|
||||
{
|
||||
var match = ReportImdbId.Match(title);
|
||||
if (match.Success)
|
||||
{
|
||||
if (match.Groups["imdbid"].Value != null)
|
||||
{
|
||||
if (match.Groups["imdbid"].Length == 11)
|
||||
{
|
||||
return match.Groups["imdbid"].Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
public static ParsedEpisodeInfo ParseTitle(string title)
|
||||
{
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace NzbDrone.Core.Parser
|
||||
LocalEpisode GetLocalEpisode(string filename, Series series);
|
||||
LocalEpisode GetLocalEpisode(string filename, Series series, ParsedEpisodeInfo folderInfo, bool sceneSource);
|
||||
LocalMovie GetLocalMovie(string filename, Movie movie);
|
||||
LocalMovie GetLocalMovie(string filename, Movie movie, ParsedEpisodeInfo folderInfo, bool sceneSource);
|
||||
LocalMovie GetLocalMovie(string filename, Movie movie, ParsedMovieInfo folderInfo, bool sceneSource);
|
||||
Series GetSeries(string title);
|
||||
Movie GetMovie(string title);
|
||||
RemoteEpisode Map(ParsedEpisodeInfo parsedEpisodeInfo, int tvdbId, int tvRageId, SearchCriteriaBase searchCriteria = null);
|
||||
@@ -120,26 +120,26 @@ namespace NzbDrone.Core.Parser
|
||||
return GetLocalMovie(filename, movie, null, false);
|
||||
}
|
||||
|
||||
public LocalMovie GetLocalMovie(string filename, Movie movie, ParsedEpisodeInfo folderInfo, bool sceneSource)
|
||||
public LocalMovie GetLocalMovie(string filename, Movie movie, ParsedMovieInfo folderInfo, bool sceneSource)
|
||||
{
|
||||
ParsedEpisodeInfo parsedEpisodeInfo;
|
||||
ParsedMovieInfo parsedMovieInfo;
|
||||
|
||||
if (folderInfo != null)
|
||||
{
|
||||
parsedEpisodeInfo = folderInfo.JsonClone();
|
||||
parsedEpisodeInfo.Quality = QualityParser.ParseQuality(Path.GetFileName(filename));
|
||||
parsedMovieInfo = folderInfo.JsonClone();
|
||||
parsedMovieInfo.Quality = QualityParser.ParseQuality(Path.GetFileName(filename));
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
parsedEpisodeInfo = Parser.ParsePath(filename);
|
||||
parsedMovieInfo = Parser.ParseMoviePath(filename);
|
||||
}
|
||||
|
||||
if (parsedEpisodeInfo == null)
|
||||
if (parsedMovieInfo == null)
|
||||
{
|
||||
if (MediaFileExtensions.Extensions.Contains(Path.GetExtension(filename)))
|
||||
{
|
||||
_logger.Warn("Unable to parse episode info from path {0}", filename);
|
||||
_logger.Warn("Unable to parse movie info from path {0}", filename);
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -148,9 +148,9 @@ namespace NzbDrone.Core.Parser
|
||||
return new LocalMovie
|
||||
{
|
||||
Movie = movie,
|
||||
Quality = parsedEpisodeInfo.Quality,
|
||||
Quality = parsedMovieInfo.Quality,
|
||||
Path = filename,
|
||||
ParsedEpisodeInfo = parsedEpisodeInfo,
|
||||
ParsedMovieInfo = parsedMovieInfo,
|
||||
ExistingFile = movie.Path.IsParentPath(filename)
|
||||
};
|
||||
}
|
||||
|
||||
@@ -41,12 +41,16 @@ namespace NzbDrone.Core.Tv
|
||||
public string RootFolderPath { get; set; }
|
||||
public DateTime Added { get; set; }
|
||||
public DateTime? InCinemas { get; set; }
|
||||
public DateTime? PhysicalRelease { get; set; }
|
||||
public LazyLoaded<Profile> Profile { get; set; }
|
||||
public HashSet<int> Tags { get; set; }
|
||||
public AddMovieOptions AddOptions { get; set; }
|
||||
public LazyLoaded<MovieFile> MovieFile { get; set; }
|
||||
public int MovieFileId { get; set; }
|
||||
public List<string> AlternativeTitles { get; set; }
|
||||
|
||||
public bool HasFile => MovieFileId > 0;
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("[{0}][{1}]", ImdbId, Title.NullSafe());
|
||||
|
||||
@@ -13,6 +13,7 @@ namespace NzbDrone.Core.Tv
|
||||
Movie FindByTitle(string cleanTitle);
|
||||
Movie FindByTitle(string cleanTitle, int year);
|
||||
Movie FindByImdbId(string imdbid);
|
||||
Movie FindByTitleSlug(string slug);
|
||||
List<Movie> GetMoviesByFileId(int fileId);
|
||||
void SetFileId(int fileId, int movieId);
|
||||
}
|
||||
@@ -114,5 +115,9 @@ namespace NzbDrone.Core.Tv
|
||||
SetFields(new Movie { Id = episodeId, MovieFileId = fileId }, movie => movie.MovieFileId);
|
||||
}
|
||||
|
||||
public Movie FindByTitleSlug(string slug)
|
||||
{
|
||||
return Query.Where(m => m.TitleSlug == slug).FirstOrDefault();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,7 @@ namespace NzbDrone.Core.Tv
|
||||
Movie FindByTitle(string title);
|
||||
Movie FindByTitle(string title, int year);
|
||||
Movie FindByTitleInexact(string title);
|
||||
Movie FindByTitleSlug(string slug);
|
||||
Movie GetMovieByFileId(int fileId);
|
||||
void DeleteMovie(int movieId, bool deleteFiles);
|
||||
List<Movie> GetAllMovies();
|
||||
@@ -218,5 +219,10 @@ namespace NzbDrone.Core.Tv
|
||||
{
|
||||
return _movieRepository.GetMoviesByFileId(fileId).First();
|
||||
}
|
||||
|
||||
public Movie FindByTitleSlug(string slug)
|
||||
{
|
||||
return _movieRepository.FindByTitleSlug(slug);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,6 +83,7 @@ namespace NzbDrone.Core.Tv
|
||||
movie.Website = movieInfo.Website;
|
||||
movie.AlternativeTitles = movieInfo.AlternativeTitles;
|
||||
movie.Year = movieInfo.Year;
|
||||
movie.PhysicalRelease = movieInfo.PhysicalRelease;
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
@@ -6,6 +6,6 @@ namespace NzbDrone.Core.Update.Commands
|
||||
{
|
||||
public override bool SendUpdatesToClient => true;
|
||||
|
||||
public override string CompletionMessage => "Restarting Sonarr to apply updates";
|
||||
public override string CompletionMessage => "Restarting Radarr to apply updates";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ namespace NzbDrone.Core.Update
|
||||
_diskTransferService.TransferFolder(_appFolderInfo.GetUpdateClientFolder(), updateSandboxFolder, TransferMode.Move, false);
|
||||
|
||||
_logger.Info("Starting update client {0}", _appFolderInfo.GetUpdateClientExePath());
|
||||
_logger.ProgressInfo("Sonarr will restart shortly.");
|
||||
_logger.ProgressInfo("Radarr will restart shortly.");
|
||||
|
||||
_processProvider.Start(_appFolderInfo.GetUpdateClientExePath(), GetUpdaterArgs(updateSandboxFolder));
|
||||
}
|
||||
@@ -178,8 +178,9 @@ namespace NzbDrone.Core.Update
|
||||
{
|
||||
var processId = _processProvider.GetCurrentProcess().Id.ToString();
|
||||
var executingApplication = _runtimeInfo.ExecutingApplication;
|
||||
|
||||
return string.Join(" ", processId, updateSandboxFolder.TrimEnd(Path.DirectorySeparatorChar).WrapInQuotes(), executingApplication.WrapInQuotes(), _startupContext.PreservedArguments);
|
||||
var args = string.Join(" ", processId, updateSandboxFolder.TrimEnd(Path.DirectorySeparatorChar).WrapInQuotes(), executingApplication.WrapInQuotes(), _startupContext.PreservedArguments);
|
||||
_logger.Info("Updater Arguments: " + args);
|
||||
return args;
|
||||
}
|
||||
|
||||
private void EnsureAppDataSafety()
|
||||
@@ -187,7 +188,7 @@ namespace NzbDrone.Core.Update
|
||||
if (_appFolderInfo.StartUpFolder.IsParentPath(_appFolderInfo.AppDataFolder) ||
|
||||
_appFolderInfo.StartUpFolder.PathEquals(_appFolderInfo.AppDataFolder))
|
||||
{
|
||||
throw new UpdateFailedException("Your Sonarr configuration '{0}' is being stored in application folder '{1}' which will cause data lost during the upgrade. Please remove any symlinks or redirects before trying again.", _appFolderInfo.AppDataFolder, _appFolderInfo.StartUpFolder);
|
||||
throw new UpdateFailedException("Your Radarr configuration '{0}' is being stored in application folder '{1}' which will cause data lost during the upgrade. Please remove any symlinks or redirects before trying again.", _appFolderInfo.AppDataFolder, _appFolderInfo.StartUpFolder);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,8 +28,7 @@ namespace NzbDrone.Core.Update
|
||||
|
||||
public UpdatePackage AvailableUpdate()
|
||||
{
|
||||
//For new let's just use develop, afterwards we can change it back to the config: _configFileProvider.Branch
|
||||
return _updatePackageProvider.GetLatestUpdate("develop", BuildInfo.Version);
|
||||
return _updatePackageProvider.GetLatestUpdate(_configFileProvider.Branch, BuildInfo.Version);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -36,7 +36,7 @@ namespace NzbDrone.Update
|
||||
var startupArgument = new StartupContext(args);
|
||||
NzbDroneLogger.Register(startupArgument, true, true);
|
||||
|
||||
Logger.Info("Starting Sonarr Update Client");
|
||||
Logger.Info("Starting Radarr Update Client");
|
||||
|
||||
_container = UpdateContainerBuilder.Build(startupArgument);
|
||||
|
||||
@@ -66,9 +66,9 @@ namespace NzbDrone.Update
|
||||
}
|
||||
|
||||
var startupContext = new UpdateStartupContext
|
||||
{
|
||||
ProcessId = ParseProcessId(args[0])
|
||||
};
|
||||
{
|
||||
ProcessId = ParseProcessId(args[0])
|
||||
};
|
||||
|
||||
if (OsInfo.IsNotWindows)
|
||||
{
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace NzbDrone.Update
|
||||
{
|
||||
var assemblies = new List<string>
|
||||
{
|
||||
"NzbDrone.Update",
|
||||
"Radarr.Update",
|
||||
"NzbDrone.Common"
|
||||
};
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace NzbDrone.Update.UpdateEngine
|
||||
public void Start(string installationFolder, int processId)
|
||||
{
|
||||
_logger.Info("Installation Folder: {0}", installationFolder);
|
||||
_logger.Info("Updating Sonarr from version {0} to version {1}", _detectExistingVersion.GetExistingVersion(installationFolder), BuildInfo.Version);
|
||||
_logger.Info("Updating Radarr from version {0} to version {1}", _detectExistingVersion.GetExistingVersion(installationFolder), BuildInfo.Version);
|
||||
|
||||
Verify(installationFolder, processId);
|
||||
|
||||
@@ -103,7 +103,7 @@ namespace NzbDrone.Update.UpdateEngine
|
||||
{
|
||||
if (_processProvider.Exists(ProcessProvider.NZB_DRONE_CONSOLE_PROCESS_NAME) || _processProvider.Exists(ProcessProvider.NZB_DRONE_PROCESS_NAME))
|
||||
{
|
||||
_logger.Error("Sonarr was restarted prematurely by external process.");
|
||||
_logger.Error("Radarr was restarted prematurely by external process.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -146,7 +146,7 @@ namespace NzbDrone.Update.UpdateEngine
|
||||
|
||||
if (_processProvider.Exists(ProcessProvider.NZB_DRONE_PROCESS_NAME))
|
||||
{
|
||||
_logger.Info("Sonarr was restarted by external process.");
|
||||
_logger.Info("Radarr was restarted by external process.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ var Collection = PageableCollection.extend({
|
||||
},
|
||||
|
||||
sortMappings : {
|
||||
'movie' : { sortKey : 'movie.sortTitle' }
|
||||
'movie' : { sortKey : 'movie.title' }
|
||||
},
|
||||
|
||||
initialize : function(options) {
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
{{> ProfileSelectionPartial profiles}}
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
{{!--<div class="form-group col-md-2">
|
||||
<label>Season Folders</label>
|
||||
|
||||
<div class="input-group">
|
||||
@@ -65,7 +65,7 @@
|
||||
<div class="btn btn-primary slide-button"/>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>--}}
|
||||
{{/unless}}
|
||||
|
||||
{{#unless existing}}
|
||||
|
||||
6
src/UI/Cells/MovieDownloadStatusCell.js
Normal file
6
src/UI/Cells/MovieDownloadStatusCell.js
Normal file
@@ -0,0 +1,6 @@
|
||||
var TemplatedCell = require('./TemplatedCell');
|
||||
|
||||
module.exports = TemplatedCell.extend({
|
||||
className : 'movie-title-cell',
|
||||
template : 'Cells/MovieDownloadStatusTemplate',
|
||||
});
|
||||
1
src/UI/Cells/MovieDownloadStatusTemplate.hbs
Normal file
1
src/UI/Cells/MovieDownloadStatusTemplate.hbs
Normal file
@@ -0,0 +1 @@
|
||||
<span class="label label-{{DownloadedStatusColor}}">{{DownloadedStatus}}</span>
|
||||
@@ -4,8 +4,8 @@ module.exports = TemplatedCell.extend({
|
||||
className : 'series-title-cell',
|
||||
template : 'Cells/SeriesTitleTemplate',
|
||||
|
||||
render : function() {
|
||||
this.$el.html(this.model.get("movie").get("title")); //Hack, but somehow handlebar helper does not work.
|
||||
return this;
|
||||
}
|
||||
// render : function() {
|
||||
// this.$el.html(this.model.get("movie").get("title")); //Hack, but somehow handlebar helper does not work.
|
||||
// return this;
|
||||
// }
|
||||
});
|
||||
|
||||
@@ -11,6 +11,7 @@ var ReleaseLayout = require('./Release/ReleaseLayout');
|
||||
var SystemLayout = require('./System/SystemLayout');
|
||||
var SeasonPassLayout = require('./SeasonPass/SeasonPassLayout');
|
||||
var SeriesEditorLayout = require('./Series/Editor/SeriesEditorLayout');
|
||||
var MovieEditorLayout = require('./Movies/Editor/MovieEditorLayout');
|
||||
|
||||
module.exports = NzbDroneController.extend({
|
||||
addSeries : function(action) {
|
||||
@@ -61,5 +62,10 @@ module.exports = NzbDroneController.extend({
|
||||
seriesEditor : function() {
|
||||
this.setTitle('Series Editor');
|
||||
this.showMainRegion(new SeriesEditorLayout());
|
||||
},
|
||||
|
||||
movieEditor : function() {
|
||||
this.setTitle('Movie Editor');
|
||||
this.showMainRegion(new MovieEditorLayout());
|
||||
}
|
||||
});
|
||||
|
||||
@@ -127,17 +127,56 @@ Handlebars.registerHelper('GetBannerStatus', function() {
|
||||
else if (!monitored) {
|
||||
return new Handlebars.SafeString('<div class="announced-banner"><i class="icon-sonarr-series-unmonitored grid-icon" title=""></i> Not Monitored</div>');
|
||||
}
|
||||
});
|
||||
|
||||
Handlebars.registerHelper('DownloadedStatusColor', function() {
|
||||
if (!this.monitored) {
|
||||
if (this.downloaded) {
|
||||
return "default";
|
||||
}
|
||||
return "warning";
|
||||
}
|
||||
|
||||
if (this.downloaded) {
|
||||
return "success";
|
||||
}
|
||||
|
||||
if (this.status != "released") {
|
||||
return "primary";
|
||||
}
|
||||
|
||||
return "danger";
|
||||
})
|
||||
|
||||
Handlebars.registerHelper('DownloadedStatus', function() {
|
||||
|
||||
if (this.downloaded) {
|
||||
return "Downloaded";
|
||||
}
|
||||
if (!this.monitored) {
|
||||
return "Not Monitored";
|
||||
}
|
||||
|
||||
|
||||
return "Missing";
|
||||
});
|
||||
|
||||
|
||||
Handlebars.registerHelper('inCinemas', function() {
|
||||
var monthNames = ["January", "February", "March", "April", "May", "June",
|
||||
"July", "August", "September", "October", "November", "December"
|
||||
];
|
||||
if (this.physicalRelease) {
|
||||
var d = new Date(this.physicalRelease);
|
||||
var day = d.getDate();
|
||||
var month = monthNames[d.getMonth()];
|
||||
var year = d.getFullYear();
|
||||
return "Available: " + day + ". " + month + " " + year;
|
||||
}
|
||||
var cinemasDate = new Date(this.inCinemas);
|
||||
var year = cinemasDate.getFullYear();
|
||||
var month = monthNames[cinemasDate.getMonth()];
|
||||
return "In Cinemas " + month + " " + year;
|
||||
return "In Cinemas: " + month + " " + year;
|
||||
});
|
||||
|
||||
Handlebars.registerHelper('tvRageUrl', function() {
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
{{else}}
|
||||
<span class="label label-default">Announced</span>
|
||||
{{/if_eq}}
|
||||
<span class="label label-{{DownloadedStatusColor}}">{{DownloadedStatus}}</span>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<span class="series-info-links">
|
||||
|
||||
@@ -97,7 +97,7 @@ module.exports = Marionette.Layout.extend({
|
||||
CommandController.bindToCommand({
|
||||
element : this.ui.rename,
|
||||
command : {
|
||||
name : 'renameFiles',
|
||||
name : 'renameMovieFiles',
|
||||
movieId : this.model.id,
|
||||
seasonNumber : -1
|
||||
}
|
||||
@@ -237,7 +237,7 @@ module.exports = Marionette.Layout.extend({
|
||||
},
|
||||
|
||||
_commandComplete : function(options) {
|
||||
if (options.command.get('name') === 'renamefiles') {
|
||||
if (options.command.get('name') === 'renameMoviefiles') {
|
||||
if (options.command.get('moviesId') === this.model.get('id')) {
|
||||
this._refresh();
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<i class="icon-sonarr-refresh icon-can-spin" title="Update movie info and scan disk"/>
|
||||
</div>
|
||||
<div class="x-rename">
|
||||
<i class="icon-sonarr-rename" title="Preview rename for all episodes"/>
|
||||
<i class="icon-sonarr-rename" title="Preview rename for movie"/>
|
||||
</div>
|
||||
<div class="x-search">
|
||||
<i class="icon-sonarr-search" title="Search for movie"/>
|
||||
|
||||
126
src/UI/Movies/Editor/MovieEditorFooterView.js
Normal file
126
src/UI/Movies/Editor/MovieEditorFooterView.js
Normal file
@@ -0,0 +1,126 @@
|
||||
var _ = require('underscore');
|
||||
var Marionette = require('marionette');
|
||||
var vent = require('vent');
|
||||
var Profiles = require('../../Profile/ProfileCollection');
|
||||
var RootFolders = require('../../AddMovies/RootFolders/RootFolderCollection');
|
||||
var RootFolderLayout = require('../../AddMovies/RootFolders/RootFolderLayout');
|
||||
var UpdateFilesMoviesView = require('./Organize/OrganizeFilesView');
|
||||
var Config = require('../../Config');
|
||||
|
||||
module.exports = Marionette.ItemView.extend({
|
||||
template : 'Movies/Editor/MovieEditorFooterViewTemplate',
|
||||
|
||||
ui : {
|
||||
monitored : '.x-monitored',
|
||||
profile : '.x-profiles',
|
||||
seasonFolder : '.x-season-folder',
|
||||
rootFolder : '.x-root-folder',
|
||||
selectedCount : '.x-selected-count',
|
||||
container : '.series-editor-footer',
|
||||
actions : '.x-action'
|
||||
},
|
||||
|
||||
events : {
|
||||
'click .x-save' : '_updateAndSave',
|
||||
'change .x-root-folder' : '_rootFolderChanged',
|
||||
'click .x-organize-files' : '_organizeFiles'
|
||||
},
|
||||
|
||||
templateHelpers : function() {
|
||||
return {
|
||||
profiles : Profiles,
|
||||
rootFolders : RootFolders.toJSON()
|
||||
};
|
||||
},
|
||||
|
||||
initialize : function(options) {
|
||||
this.moviesCollection = options.collection;
|
||||
|
||||
RootFolders.fetch().done(function() {
|
||||
RootFolders.synced = true;
|
||||
});
|
||||
|
||||
this.editorGrid = options.editorGrid;
|
||||
this.listenTo(this.moviesCollection, 'backgrid:selected', this._updateInfo);
|
||||
this.listenTo(RootFolders, 'all', this.render);
|
||||
},
|
||||
|
||||
onRender : function() {
|
||||
this._updateInfo();
|
||||
},
|
||||
|
||||
_updateAndSave : function() {
|
||||
var selected = this.editorGrid.getSelectedModels();
|
||||
|
||||
var monitored = this.ui.monitored.val();
|
||||
var profile = this.ui.profile.val();
|
||||
var seasonFolder = this.ui.seasonFolder.val();
|
||||
var rootFolder = this.ui.rootFolder.val();
|
||||
|
||||
_.each(selected, function(model) {
|
||||
if (monitored === 'true') {
|
||||
model.set('monitored', true);
|
||||
} else if (monitored === 'false') {
|
||||
model.set('monitored', false);
|
||||
}
|
||||
|
||||
if (profile !== 'noChange') {
|
||||
model.set('profileId', parseInt(profile, 10));
|
||||
}
|
||||
|
||||
if (seasonFolder === 'true') {
|
||||
model.set('seasonFolder', true);
|
||||
} else if (seasonFolder === 'false') {
|
||||
model.set('seasonFolder', false);
|
||||
}
|
||||
|
||||
if (rootFolder !== 'noChange') {
|
||||
var rootFolderPath = RootFolders.get(parseInt(rootFolder, 10));
|
||||
|
||||
model.set('rootFolderPath', rootFolderPath.get('path'));
|
||||
}
|
||||
|
||||
model.edited = true;
|
||||
});
|
||||
|
||||
this.moviesCollection.save();
|
||||
},
|
||||
|
||||
_updateInfo : function() {
|
||||
var selected = this.editorGrid.getSelectedModels();
|
||||
var selectedCount = selected.length;
|
||||
|
||||
this.ui.selectedCount.html('{0} movies selected'.format(selectedCount));
|
||||
|
||||
if (selectedCount === 0) {
|
||||
this.ui.actions.attr('disabled', 'disabled');
|
||||
} else {
|
||||
this.ui.actions.removeAttr('disabled');
|
||||
}
|
||||
},
|
||||
|
||||
_rootFolderChanged : function() {
|
||||
var rootFolderValue = this.ui.rootFolder.val();
|
||||
if (rootFolderValue === 'addNew') {
|
||||
var rootFolderLayout = new RootFolderLayout();
|
||||
this.listenToOnce(rootFolderLayout, 'folderSelected', this._setRootFolder);
|
||||
vent.trigger(vent.Commands.OpenModalCommand, rootFolderLayout);
|
||||
} else {
|
||||
Config.setValue(Config.Keys.DefaultRootFolderId, rootFolderValue);
|
||||
}
|
||||
},
|
||||
|
||||
_setRootFolder : function(options) {
|
||||
vent.trigger(vent.Commands.CloseModalCommand);
|
||||
this.ui.rootFolder.val(options.model.id);
|
||||
this._rootFolderChanged();
|
||||
},
|
||||
|
||||
_organizeFiles : function() {
|
||||
var selected = this.editorGrid.getSelectedModels();
|
||||
var updateFilesMoviesView = new UpdateFilesMoviesView({ movies : selected });
|
||||
this.listenToOnce(updateFilesMoviesView, 'updatingFiles', this._afterSave);
|
||||
|
||||
vent.trigger(vent.Commands.OpenModalCommand, updateFilesMoviesView);
|
||||
}
|
||||
});
|
||||
54
src/UI/Movies/Editor/MovieEditorFooterViewTemplate.hbs
Normal file
54
src/UI/Movies/Editor/MovieEditorFooterViewTemplate.hbs
Normal file
@@ -0,0 +1,54 @@
|
||||
<div class="series-editor-footer">
|
||||
<div class="row">
|
||||
<div class="form-group col-md-2">
|
||||
<label>Monitored</label>
|
||||
|
||||
<select class="form-control x-action x-monitored">
|
||||
<option value="noChange">No change</option>
|
||||
<option value="true">Monitored</option>
|
||||
<option value="false">Unmonitored</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<label>Profile</label>
|
||||
|
||||
<select class="form-control x-action x-profiles">
|
||||
<option value="noChange">No change</option>
|
||||
{{#each profiles.models}}
|
||||
<option value="{{id}}">{{attributes.name}}</option>
|
||||
{{/each}}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
{{!--<div class="form-group col-md-2">
|
||||
<label>Season Folder</label>
|
||||
|
||||
<select class="form-control x-action x-season-folder">
|
||||
<option value="noChange">No change</option>
|
||||
<option value="true">Yes</option>
|
||||
<option value="false">No</option>
|
||||
</select>
|
||||
</div>--}}
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label>Root Folder</label>
|
||||
|
||||
<select class="form-control x-action x-root-folder" validation-name="RootFolderPath">
|
||||
<option value="noChange">No change</option>
|
||||
{{#each rootFolders}}
|
||||
<option value="{{id}}">{{path}}</option>
|
||||
{{/each}}
|
||||
<option value="addNew">Add a different path</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 actions">
|
||||
<label class="x-selected-count">0 movies selected</label>
|
||||
<div>
|
||||
<button class="btn btn-primary x-action x-save">Save</button>
|
||||
<button class="btn btn-danger x-action x-organize-files" title="Organize and rename movie files">Organize</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
153
src/UI/Movies/Editor/MovieEditorLayout.js
Normal file
153
src/UI/Movies/Editor/MovieEditorLayout.js
Normal file
@@ -0,0 +1,153 @@
|
||||
var vent = require('vent');
|
||||
var Marionette = require('marionette');
|
||||
var Backgrid = require('backgrid');
|
||||
var EmptyView = require('../Index/EmptyView');
|
||||
var MoviesCollection = require('../MoviesCollection');
|
||||
var MovieTitleCell = require('../../Cells/MovieTitleCell');
|
||||
var ProfileCell = require('../../Cells/ProfileCell');
|
||||
var SelectAllCell = require('../../Cells/SelectAllCell');
|
||||
var ToolbarLayout = require('../../Shared/Toolbar/ToolbarLayout');
|
||||
var FooterView = require('./MovieEditorFooterView');
|
||||
require('../../Mixins/backbone.signalr.mixin');
|
||||
|
||||
module.exports = Marionette.Layout.extend({
|
||||
template : 'Movies/Editor/MovieEditorLayoutTemplate',
|
||||
|
||||
regions : {
|
||||
seriesRegion : '#x-series-editor',
|
||||
toolbar : '#x-toolbar'
|
||||
},
|
||||
|
||||
ui : {
|
||||
monitored : '.x-monitored',
|
||||
profiles : '.x-profiles',
|
||||
rootFolder : '.x-root-folder',
|
||||
selectedCount : '.x-selected-count'
|
||||
},
|
||||
|
||||
events : {
|
||||
'click .x-save' : '_updateAndSave',
|
||||
'change .x-root-folder' : '_rootFolderChanged'
|
||||
},
|
||||
|
||||
columns : [
|
||||
{
|
||||
name : '',
|
||||
cell : SelectAllCell,
|
||||
headerCell : 'select-all',
|
||||
sortable : false
|
||||
},
|
||||
{
|
||||
name : 'title',
|
||||
label : 'Title',
|
||||
cell : MovieTitleCell,
|
||||
cellValue : 'this'
|
||||
},
|
||||
{
|
||||
name : 'profileId',
|
||||
label : 'Profile',
|
||||
cell : ProfileCell
|
||||
},
|
||||
{
|
||||
name : 'path',
|
||||
label : 'Path',
|
||||
cell : 'string'
|
||||
}
|
||||
],
|
||||
|
||||
leftSideButtons : {
|
||||
type : 'default',
|
||||
storeState : false,
|
||||
items : [
|
||||
{
|
||||
title : 'Update Library',
|
||||
icon : 'icon-sonarr-refresh',
|
||||
command : 'refreshseries',
|
||||
successMessage : 'Library was updated!',
|
||||
errorMessage : 'Library update failed!'
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
initialize : function() {
|
||||
this.movieCollection = MoviesCollection.clone();
|
||||
this.movieCollection.shadowCollection.bindSignalR();
|
||||
this.listenTo(this.movieCollection, 'save', this.render);
|
||||
|
||||
this.filteringOptions = {
|
||||
type : 'radio',
|
||||
storeState : true,
|
||||
menuKey : 'serieseditor.filterMode',
|
||||
defaultAction : 'all',
|
||||
items : [
|
||||
{
|
||||
key : 'all',
|
||||
title : '',
|
||||
tooltip : 'All',
|
||||
icon : 'icon-sonarr-all',
|
||||
callback : this._setFilter
|
||||
},
|
||||
{
|
||||
key : 'monitored',
|
||||
title : '',
|
||||
tooltip : 'Monitored Only',
|
||||
icon : 'icon-sonarr-monitored',
|
||||
callback : this._setFilter
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
|
||||
onRender : function() {
|
||||
this._showToolbar();
|
||||
this._showTable();
|
||||
},
|
||||
|
||||
onClose : function() {
|
||||
vent.trigger(vent.Commands.CloseControlPanelCommand);
|
||||
},
|
||||
|
||||
_showTable : function() {
|
||||
if (this.movieCollection.shadowCollection.length === 0) {
|
||||
this.seriesRegion.show(new EmptyView());
|
||||
this.toolbar.close();
|
||||
return;
|
||||
}
|
||||
|
||||
this.columns[0].sortedCollection = this.movieCollection;
|
||||
|
||||
this.editorGrid = new Backgrid.Grid({
|
||||
collection : this.movieCollection,
|
||||
columns : this.columns,
|
||||
className : 'table table-hover'
|
||||
});
|
||||
|
||||
this.seriesRegion.show(this.editorGrid);
|
||||
this._showFooter();
|
||||
},
|
||||
|
||||
_showToolbar : function() {
|
||||
this.toolbar.show(new ToolbarLayout({
|
||||
left : [
|
||||
this.leftSideButtons
|
||||
],
|
||||
right : [
|
||||
this.filteringOptions
|
||||
],
|
||||
context : this
|
||||
}));
|
||||
},
|
||||
|
||||
_showFooter : function() {
|
||||
vent.trigger(vent.Commands.OpenControlPanelCommand, new FooterView({
|
||||
editorGrid : this.editorGrid,
|
||||
collection : this.movieCollection
|
||||
}));
|
||||
},
|
||||
|
||||
_setFilter : function(buttonContext) {
|
||||
var mode = buttonContext.model.get('key');
|
||||
|
||||
this.movieCollection.setFilterMode(mode);
|
||||
}
|
||||
});
|
||||
7
src/UI/Movies/Editor/MovieEditorLayoutTemplate.hbs
Normal file
7
src/UI/Movies/Editor/MovieEditorLayoutTemplate.hbs
Normal file
@@ -0,0 +1,7 @@
|
||||
<div id="x-toolbar"></div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div id="x-series-editor" class="table-responsive"></div>
|
||||
</div>
|
||||
</div>
|
||||
33
src/UI/Movies/Editor/Organize/OrganizeFilesView.js
Normal file
33
src/UI/Movies/Editor/Organize/OrganizeFilesView.js
Normal file
@@ -0,0 +1,33 @@
|
||||
var _ = require('underscore');
|
||||
var vent = require('vent');
|
||||
var Backbone = require('backbone');
|
||||
var Marionette = require('marionette');
|
||||
var CommandController = require('../../../Commands/CommandController');
|
||||
|
||||
module.exports = Marionette.ItemView.extend({
|
||||
template : 'Movies/Editor/Organize/OrganizeFilesViewTemplate',
|
||||
|
||||
events : {
|
||||
'click .x-confirm-organize' : '_organize'
|
||||
},
|
||||
|
||||
initialize : function(options) {
|
||||
this.movies = options.movies;
|
||||
this.templateHelpers = {
|
||||
numberOfMovies : this.movies.length,
|
||||
movies : new Backbone.Collection(this.movies).toJSON()
|
||||
};
|
||||
},
|
||||
|
||||
_organize : function() {
|
||||
var movieIds = _.pluck(this.movies, 'id');
|
||||
|
||||
CommandController.Execute('renameMovie', {
|
||||
name : 'renameMovie',
|
||||
movieIds : movieIds
|
||||
});
|
||||
|
||||
this.trigger('organizingFiles');
|
||||
vent.trigger(vent.Commands.CloseModalCommand);
|
||||
}
|
||||
});
|
||||
25
src/UI/Movies/Editor/Organize/OrganizeFilesViewTemplate.hbs
Normal file
25
src/UI/Movies/Editor/Organize/OrganizeFilesViewTemplate.hbs
Normal file
@@ -0,0 +1,25 @@
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3>Organize Selected Movies</h3>
|
||||
</div>
|
||||
<div class="modal-body update-files-series-modal">
|
||||
<div class="alert alert-info">
|
||||
<button type="button" class="close" data-dismiss="alert">×</button>
|
||||
Tip: To preview a rename... select "Cancel" then any movie title and use the <i data-original-title="" class="icon-sonarr-rename" title=""></i>
|
||||
</div>
|
||||
|
||||
Are you sure you want to update all files in the {{numberOfMovies}} selected movies?
|
||||
|
||||
{{debug}}
|
||||
<ul class="selected-series">
|
||||
{{#each movie}}
|
||||
<li>{{title}}</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn" data-dismiss="modal">Cancel</button>
|
||||
<button class="btn btn-danger x-confirm-organize">Organize</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -12,6 +12,7 @@ var ProfileCell = require('../../Cells/ProfileCell');
|
||||
var MovieLinksCell = require('../../Cells/MovieLinksCell');
|
||||
var MovieActionCell = require('../../Cells/MovieActionCell');
|
||||
var MovieStatusCell = require('../../Cells/MovieStatusCell');
|
||||
var MovieDownloadStatusCell = require('../../Cells/MovieDownloadStatusCell');
|
||||
var FooterView = require('./FooterView');
|
||||
var FooterModel = require('./FooterModel');
|
||||
var ToolbarLayout = require('../../Shared/Toolbar/ToolbarLayout');
|
||||
@@ -38,7 +39,6 @@ module.exports = Marionette.Layout.extend({
|
||||
label : 'Title',
|
||||
cell : MovieTitleCell,
|
||||
cellValue : 'this',
|
||||
sortValue : 'sortTitle'
|
||||
},
|
||||
{
|
||||
name : 'profileId',
|
||||
@@ -56,6 +56,11 @@ module.exports = Marionette.Layout.extend({
|
||||
cell : MovieLinksCell,
|
||||
className : "movie-links-cell"
|
||||
},
|
||||
{
|
||||
name : "this",
|
||||
label : "Status",
|
||||
cell : MovieDownloadStatusCell,
|
||||
},
|
||||
{
|
||||
name : 'this',
|
||||
label : '',
|
||||
@@ -75,14 +80,9 @@ module.exports = Marionette.Layout.extend({
|
||||
route : 'addmovies'
|
||||
},
|
||||
{
|
||||
title : 'Season Pass',
|
||||
icon : 'icon-sonarr-monitored',
|
||||
route : 'seasonpass'
|
||||
},
|
||||
{
|
||||
title : 'Series Editor',
|
||||
title : 'Movie Editor',
|
||||
icon : 'icon-sonarr-edit',
|
||||
route : 'serieseditor'
|
||||
route : 'movieeditor'
|
||||
},
|
||||
{
|
||||
title : 'RSS Sync',
|
||||
@@ -128,25 +128,17 @@ module.exports = Marionette.Layout.extend({
|
||||
title : 'Title',
|
||||
name : 'title'
|
||||
},
|
||||
{
|
||||
title : 'Seasons',
|
||||
name : 'seasonCount'
|
||||
},
|
||||
{
|
||||
title : 'Quality',
|
||||
name : 'profileId'
|
||||
},
|
||||
{
|
||||
title : 'Network',
|
||||
name : 'network'
|
||||
title : 'In Cinemas',
|
||||
name : 'inCinemas'
|
||||
},
|
||||
{
|
||||
title : 'Next Airing',
|
||||
name : 'nextAiring'
|
||||
},
|
||||
{
|
||||
title : 'Episodes',
|
||||
name : 'percentOfEpisodes'
|
||||
title : "Status",
|
||||
name : "status",
|
||||
}
|
||||
]
|
||||
};
|
||||
@@ -170,27 +162,6 @@ module.exports = Marionette.Layout.extend({
|
||||
tooltip : 'Monitored Only',
|
||||
icon : 'icon-sonarr-monitored',
|
||||
callback : this._setFilter
|
||||
},
|
||||
{
|
||||
key : 'continuing',
|
||||
title : '',
|
||||
tooltip : 'Continuing Only',
|
||||
icon : 'icon-sonarr-series-continuing',
|
||||
callback : this._setFilter
|
||||
},
|
||||
{
|
||||
key : 'ended',
|
||||
title : '',
|
||||
tooltip : 'Ended Only',
|
||||
icon : 'icon-sonarr-series-ended',
|
||||
callback : this._setFilter
|
||||
},
|
||||
{
|
||||
key : 'missing',
|
||||
title : '',
|
||||
tooltip : 'Missing',
|
||||
icon : 'icon-sonarr-missing',
|
||||
callback : this._setFilter
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
@@ -40,6 +40,8 @@
|
||||
<span class="label label-default">{{inCinemas}}</span>
|
||||
|
||||
{{profile profileId}}
|
||||
|
||||
<span class="label label-{{DownloadedStatusColor}}">{{DownloadedStatus}}</span>
|
||||
</div>
|
||||
<div class="col-md-4 col-xs-4">
|
||||
<span class="movie-info-links">
|
||||
|
||||
@@ -15,10 +15,10 @@ var Collection = PageableCollection.extend({
|
||||
tableName : 'movie',
|
||||
|
||||
state : {
|
||||
sortKey : 'sortTitle',
|
||||
order : -1,
|
||||
sortKey : 'title',
|
||||
order : 1,
|
||||
pageSize : 100000,
|
||||
secondarySortKey : 'sortTitle',
|
||||
secondarySortKey : 'title',
|
||||
secondarySortOrder : -1
|
||||
},
|
||||
|
||||
@@ -73,7 +73,7 @@ var Collection = PageableCollection.extend({
|
||||
|
||||
sortMappings : {
|
||||
title : {
|
||||
sortKey : 'sortTitle'
|
||||
sortKey : 'title'
|
||||
},
|
||||
|
||||
nextAiring : {
|
||||
|
||||
@@ -1,3 +1,38 @@
|
||||
// var Backbone = require('backbone');
|
||||
// var RenamePreviewModel = require('./RenamePreviewModel');
|
||||
|
||||
// module.exports = Backbone.Collection.extend({
|
||||
// url : window.NzbDrone.ApiRoot + '/rename',
|
||||
// model : RenamePreviewModel,
|
||||
|
||||
// originalFetch : Backbone.Collection.prototype.fetch,
|
||||
|
||||
// initialize : function(options) {
|
||||
// if (!options.seriesId) {
|
||||
// throw 'seriesId is required';
|
||||
// }
|
||||
|
||||
// this.seriesId = options.seriesId;
|
||||
// this.seasonNumber = options.seasonNumber;
|
||||
// },
|
||||
|
||||
// fetch : function(options) {
|
||||
// if (!this.seriesId) {
|
||||
// throw 'seriesId is required';
|
||||
// }
|
||||
|
||||
// options = options || {};
|
||||
// options.data = {};
|
||||
// options.data.seriesId = this.seriesId;
|
||||
|
||||
// if (this.seasonNumber !== undefined) {
|
||||
// options.data.seasonNumber = this.seasonNumber;
|
||||
// }
|
||||
|
||||
// return this.originalFetch.call(this, options);
|
||||
// }
|
||||
// });
|
||||
|
||||
var Backbone = require('backbone');
|
||||
var RenamePreviewModel = require('./RenamePreviewModel');
|
||||
|
||||
@@ -8,26 +43,26 @@ module.exports = Backbone.Collection.extend({
|
||||
originalFetch : Backbone.Collection.prototype.fetch,
|
||||
|
||||
initialize : function(options) {
|
||||
if (!options.seriesId) {
|
||||
throw 'seriesId is required';
|
||||
if (!options.movieId) {
|
||||
throw 'movieId is required';
|
||||
}
|
||||
|
||||
this.seriesId = options.seriesId;
|
||||
this.seasonNumber = options.seasonNumber;
|
||||
this.movieId = options.movieId;
|
||||
//this.seasonNumber = options.seasonNumber;
|
||||
},
|
||||
|
||||
fetch : function(options) {
|
||||
if (!this.seriesId) {
|
||||
throw 'seriesId is required';
|
||||
if (!this.movieId) {
|
||||
throw 'movieId is required';
|
||||
}
|
||||
|
||||
options = options || {};
|
||||
options.data = {};
|
||||
options.data.seriesId = this.seriesId;
|
||||
options.data.movieId = this.movieId;
|
||||
|
||||
if (this.seasonNumber !== undefined) {
|
||||
options.data.seasonNumber = this.seasonNumber;
|
||||
}
|
||||
// if (this.seasonNumber !== undefined) {
|
||||
// options.data.seasonNumber = this.seasonNumber;
|
||||
//}
|
||||
|
||||
return this.originalFetch.call(this, options);
|
||||
}
|
||||
|
||||
@@ -29,12 +29,13 @@ module.exports = Marionette.Layout.extend({
|
||||
},
|
||||
|
||||
initialize : function(options) {
|
||||
this.model = options.series;
|
||||
this.model = options.movie;
|
||||
this.seasonNumber = options.seasonNumber;
|
||||
|
||||
var viewOptions = {};
|
||||
viewOptions.seriesId = this.model.id;
|
||||
viewOptions.seasonNumber = this.seasonNumber;
|
||||
//viewOptions.seriesId = this.model.id;
|
||||
//viewOptions.seasonNumber = this.seasonNumber;
|
||||
viewOptions.movieId = this.model.id;
|
||||
|
||||
this.collection = new RenamePreviewCollection(viewOptions);
|
||||
this.listenTo(this.collection, 'sync', this._showPreviews);
|
||||
@@ -66,7 +67,8 @@ module.exports = Marionette.Layout.extend({
|
||||
}
|
||||
|
||||
var files = _.map(this.collection.where({ rename : true }), function(model) {
|
||||
return model.get('episodeFileId');
|
||||
//return model.get('episodeFileId');
|
||||
return model.get('movieFileId');
|
||||
});
|
||||
|
||||
if (files.length === 0) {
|
||||
@@ -74,21 +76,11 @@ module.exports = Marionette.Layout.extend({
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.seasonNumber) {
|
||||
CommandController.Execute('renameFiles', {
|
||||
name : 'renameFiles',
|
||||
seriesId : this.model.id,
|
||||
seasonNumber : this.seasonNumber,
|
||||
files : files
|
||||
});
|
||||
} else {
|
||||
CommandController.Execute('renameFiles', {
|
||||
name : 'renameFiles',
|
||||
seriesId : this.model.id,
|
||||
seasonNumber : -1,
|
||||
files : files
|
||||
});
|
||||
}
|
||||
CommandController.Execute('renameMovieFiles', {
|
||||
name : 'renameMovieFiles',
|
||||
movieId : this.model.id,
|
||||
files : files
|
||||
});
|
||||
|
||||
vent.trigger(vent.Commands.CloseModalCommand);
|
||||
},
|
||||
|
||||
@@ -21,7 +21,7 @@ module.exports = Marionette.AppRouter.extend({
|
||||
'system' : 'system',
|
||||
'system/:action' : 'system',
|
||||
'seasonpass' : 'seasonPass',
|
||||
'serieseditor' : 'seriesEditor',
|
||||
'movieeditor' : 'movieEditor',
|
||||
':whatever' : 'showNotFound'
|
||||
}
|
||||
});
|
||||
|
||||
@@ -41,7 +41,7 @@ module.exports = Marionette.AppRouter.extend({
|
||||
var label = window.location.pathname === window.NzbDrone.UrlBase + '/system/updates' ? 'Reload' : 'View Changes';
|
||||
|
||||
Messenger.show({
|
||||
message : 'Sonarr has been updated',
|
||||
message : 'Radarr has been updated',
|
||||
hideAfter : 0,
|
||||
id : 'sonarrUpdated',
|
||||
actions : {
|
||||
|
||||
@@ -67,4 +67,4 @@ module.exports = Marionette.ItemView.extend({
|
||||
_removeSortIcon : function() {
|
||||
this.ui.icon.removeClass('icon-sonarr-sort-asc icon-sonarr-sort-desc');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -3,26 +3,25 @@
|
||||
|
||||
<dl class="dl-horizontal info">
|
||||
<dt>Home page</dt>
|
||||
<dd><a href="https://sonarr.tv/">sonarr.tv</a></dd>
|
||||
<dd><a href="https://radarr.tdb/">radarr.tdb</a></dd>
|
||||
|
||||
<dt>Wiki</dt>
|
||||
<dd><a href="https://wiki.sonarr.tv/">wiki.sonarr.tv</a></dd>
|
||||
<dd><a href="https://wiki.radarr.tdb/">wiki.radarr.tdb</a></dd>
|
||||
|
||||
<dt>Forums</dt>
|
||||
<!-- <dt>Forums</dt>
|
||||
<dd><a href="https://forums.sonarr.tv/">forums.sonarr.tv</a></dd>
|
||||
|
||||
<dt>Twitter</dt>
|
||||
<dd><a href="https://twitter.com/sonarrtv">@sonarrtv</a></dd>
|
||||
|
||||
<dt>IRC</dt>
|
||||
<dd><a href="irc://irc.freenode.net/#sonarr">#sonarr on Freenode</a> or (<a href="http://webchat.freenode.net/?channels=#sonarr">webchat</a>)</dd>
|
||||
<dd><a href="irc://irc.freenode.net/#sonarr">#sonarr on Freenode</a> or (<a href="http://webchat.freenode.net/?channels=#sonarr">webchat</a>)</dd>-->
|
||||
|
||||
<dt>Source</dt>
|
||||
<dd><a href="https://github.com/Sonarr/Sonarr/">github.com/Sonarr/Sonarr</a></dd>
|
||||
<dd><a href="https://github.com/galli-leo/Radarr/">github.com/galli-leo/Radarr</a></dd>
|
||||
|
||||
<dt>Feature Requests</dt>
|
||||
<dd><a href="https://forums.sonarr.tv/">forums.sonarr.tv</a></dd>
|
||||
<dd><a href="https://github.com/Sonarr/Sonarr/issues">github.com/Sonarr/Sonarr/issues</a> <b>(Please post issues on the forum first and not on github)</b></dd>
|
||||
<!--<dd><a href="https://forums.sonarr.tv/">forums.sonarr.tv</a></dd>-->
|
||||
<dd><a href="https://github.com/galli-leo/Radarr/issues">github.com/galli-leo/Radarr/issues</a></dd>
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user