mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-16 21:15:33 -04:00
Compare commits
19 Commits
v5.21.1.97
...
v5.22.0.98
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
74d2259f67 | ||
|
|
6e68a91922 | ||
|
|
a962de776b | ||
|
|
e8afde2e90 | ||
|
|
4633a834f3 | ||
|
|
cd021961f0 | ||
|
|
456ea3d57c | ||
|
|
d09fa6f880 | ||
|
|
bcd4fe1f08 | ||
|
|
8efce68922 | ||
|
|
4b3c29ed93 | ||
|
|
7ea9161779 | ||
|
|
f5c66c5093 | ||
|
|
a3515db9f7 | ||
|
|
d4bb318253 | ||
|
|
64e865f296 | ||
|
|
982f9062bd | ||
|
|
48075e33ac | ||
|
|
91f08a83cd |
@@ -9,7 +9,7 @@ variables:
|
||||
testsFolder: './_tests'
|
||||
yarnCacheFolder: $(Pipeline.Workspace)/.yarn
|
||||
nugetCacheFolder: $(Pipeline.Workspace)/.nuget/packages
|
||||
majorVersion: '5.21.1'
|
||||
majorVersion: '5.22.0'
|
||||
minorVersion: $[counter('minorVersion', 2000)]
|
||||
radarrVersion: '$(majorVersion).$(minorVersion)'
|
||||
buildName: '$(Build.SourceBranchName).$(radarrVersion)'
|
||||
|
||||
@@ -18,6 +18,7 @@ import {
|
||||
} from 'typings/History';
|
||||
import formatDateTime from 'Utilities/Date/formatDateTime';
|
||||
import formatAge from 'Utilities/Number/formatAge';
|
||||
import formatBytes from 'Utilities/Number/formatBytes';
|
||||
import formatCustomFormatScore from 'Utilities/Number/formatCustomFormatScore';
|
||||
import translate from 'Utilities/String/translate';
|
||||
import styles from './HistoryDetails.css';
|
||||
@@ -50,6 +51,7 @@ function HistoryDetails(props: HistoryDetailsProps) {
|
||||
ageHours,
|
||||
ageMinutes,
|
||||
publishedDate,
|
||||
size,
|
||||
} = data as GrabbedHistoryData;
|
||||
|
||||
const downloadClientNameInfo = downloadClientName ?? downloadClient;
|
||||
@@ -160,6 +162,13 @@ function HistoryDetails(props: HistoryDetailsProps) {
|
||||
})}
|
||||
/>
|
||||
) : null}
|
||||
|
||||
{size ? (
|
||||
<DescriptionListItem
|
||||
title={translate('Size')}
|
||||
data={formatBytes(size)}
|
||||
/>
|
||||
) : null}
|
||||
</DescriptionList>
|
||||
);
|
||||
}
|
||||
@@ -191,7 +200,7 @@ function HistoryDetails(props: HistoryDetailsProps) {
|
||||
}
|
||||
|
||||
if (eventType === 'downloadFolderImported') {
|
||||
const { customFormatScore, droppedPath, importedPath } =
|
||||
const { customFormatScore, droppedPath, importedPath, size } =
|
||||
data as DownloadFolderImportedHistory;
|
||||
|
||||
return (
|
||||
@@ -224,12 +233,19 @@ function HistoryDetails(props: HistoryDetailsProps) {
|
||||
data={formatCustomFormatScore(parseInt(customFormatScore))}
|
||||
/>
|
||||
) : null}
|
||||
|
||||
{size ? (
|
||||
<DescriptionListItem
|
||||
title={translate('FileSize')}
|
||||
data={formatBytes(size)}
|
||||
/>
|
||||
) : null}
|
||||
</DescriptionList>
|
||||
);
|
||||
}
|
||||
|
||||
if (eventType === 'movieFileDeleted') {
|
||||
const { reason, customFormatScore } = data as MovieFileDeletedHistory;
|
||||
const { reason, customFormatScore, size } = data as MovieFileDeletedHistory;
|
||||
|
||||
let reasonMessage = '';
|
||||
|
||||
@@ -259,6 +275,13 @@ function HistoryDetails(props: HistoryDetailsProps) {
|
||||
data={formatCustomFormatScore(parseInt(customFormatScore))}
|
||||
/>
|
||||
) : null}
|
||||
|
||||
{size ? (
|
||||
<DescriptionListItem
|
||||
title={translate('FileSize')}
|
||||
data={formatBytes(size)}
|
||||
/>
|
||||
) : null}
|
||||
</DescriptionList>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -82,13 +82,6 @@
|
||||
}
|
||||
|
||||
@media only screen and (max-width: $breakpointMedium) {
|
||||
.modal.small,
|
||||
.modal.medium {
|
||||
width: 90%;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (max-width: $breakpointSmall) {
|
||||
.modalContainer {
|
||||
position: fixed;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
line-height: 1.52857143;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: $breakpointSmall) {
|
||||
@media only screen and (max-width: $breakpointMedium) {
|
||||
.cell {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: $breakpointSmall) {
|
||||
@media only screen and (max-width: $breakpointMedium) {
|
||||
.cell {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: $breakpointSmall) {
|
||||
@media only screen and (max-width: $breakpointMedium) {
|
||||
.tableContainer {
|
||||
min-width: 100%;
|
||||
width: fit-content;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: $breakpointSmall) {
|
||||
@media only screen and (max-width: $breakpointMedium) {
|
||||
.headerCell {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
height: 25px;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: $breakpointSmall) {
|
||||
@media only screen and (max-width: $breakpointMedium) {
|
||||
.pager {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: $breakpointSmall) {
|
||||
@media only screen and (max-width: $breakpointMedium) {
|
||||
.headerCell {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import React, { useEffect } from 'react';
|
||||
import { useSelector } from 'react-redux';
|
||||
import { useParams } from 'react-router';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
import { useHistory, useParams } from 'react-router';
|
||||
import NotFound from 'Components/NotFound';
|
||||
import usePrevious from 'Helpers/Hooks/usePrevious';
|
||||
import createAllMoviesSelector from 'Store/Selectors/createAllMoviesSelector';
|
||||
|
||||
@@ -6,6 +6,7 @@ import React, {
|
||||
useState,
|
||||
} from 'react';
|
||||
import { useDispatch, useSelector } from 'react-redux';
|
||||
import { useHistory } from 'react-router';
|
||||
import { SelectProvider } from 'App/SelectContext';
|
||||
import ClientSideCollectionAppState from 'App/State/ClientSideCollectionAppState';
|
||||
import MoviesAppState, { MovieIndexAppState } from 'App/State/MoviesAppState';
|
||||
@@ -26,6 +27,7 @@ import { DESCENDING } from 'Helpers/Props/sortDirections';
|
||||
import InteractiveImportModal from 'InteractiveImport/InteractiveImportModal';
|
||||
import NoMovie from 'Movie/NoMovie';
|
||||
import { executeCommand } from 'Store/Actions/commandActions';
|
||||
import { fetchMovies } from 'Store/Actions/movieActions';
|
||||
import {
|
||||
setMovieFilter,
|
||||
setMovieSort,
|
||||
@@ -75,6 +77,8 @@ interface MovieIndexProps {
|
||||
}
|
||||
|
||||
const MovieIndex = withScrollPosition((props: MovieIndexProps) => {
|
||||
const history = useHistory();
|
||||
|
||||
const {
|
||||
isFetching,
|
||||
isPopulated,
|
||||
@@ -105,6 +109,12 @@ const MovieIndex = withScrollPosition((props: MovieIndexProps) => {
|
||||
);
|
||||
const [isSelectMode, setIsSelectMode] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (history.action === 'PUSH') {
|
||||
dispatch(fetchMovies());
|
||||
}
|
||||
}, [history, dispatch]);
|
||||
|
||||
useEffect(() => {
|
||||
dispatch(fetchQueueDetails({ all: true }));
|
||||
}, [dispatch]);
|
||||
|
||||
@@ -15,6 +15,7 @@ export interface MovieFile extends ModelBase {
|
||||
languages: Language[];
|
||||
quality: QualityModel;
|
||||
customFormats: CustomFormat[];
|
||||
customFormatScore: number;
|
||||
indexerFlags: number;
|
||||
mediaInfo: MediaInfo;
|
||||
qualityCutoffNotMet: boolean;
|
||||
|
||||
@@ -10,11 +10,11 @@ import ModalBody from 'Components/Modal/ModalBody';
|
||||
import ModalContent from 'Components/Modal/ModalContent';
|
||||
import ModalFooter from 'Components/Modal/ModalFooter';
|
||||
import ModalHeader from 'Components/Modal/ModalHeader';
|
||||
import Column from 'Components/Table/Column';
|
||||
import Table from 'Components/Table/Table';
|
||||
import TableBody from 'Components/Table/TableBody';
|
||||
import useSelectState from 'Helpers/Hooks/useSelectState';
|
||||
import { kinds } from 'Helpers/Props';
|
||||
import { SortDirection } from 'Helpers/Props/sortDirections';
|
||||
import {
|
||||
bulkDeleteCustomFormats,
|
||||
bulkEditCustomFormats,
|
||||
@@ -34,7 +34,7 @@ type OnSelectedChangeCallback = React.ComponentProps<
|
||||
typeof ManageCustomFormatsModalRow
|
||||
>['onSelectedChange'];
|
||||
|
||||
const COLUMNS = [
|
||||
const COLUMNS: Column[] = [
|
||||
{
|
||||
name: 'name',
|
||||
label: () => translate('Name'),
|
||||
@@ -56,8 +56,6 @@ const COLUMNS = [
|
||||
|
||||
interface ManageCustomFormatsModalContentProps {
|
||||
onModalClose(): void;
|
||||
sortKey?: string;
|
||||
sortDirection?: SortDirection;
|
||||
}
|
||||
|
||||
function ManageCustomFormatsModalContent(
|
||||
|
||||
@@ -48,7 +48,6 @@ class EditDownloadClientModalContent extends Component {
|
||||
implementationName,
|
||||
name,
|
||||
enable,
|
||||
protocol,
|
||||
priority,
|
||||
removeCompletedDownloads,
|
||||
removeFailedDownloads,
|
||||
@@ -171,20 +170,17 @@ class EditDownloadClientModalContent extends Component {
|
||||
/>
|
||||
</FormGroup>
|
||||
|
||||
{
|
||||
protocol.value !== 'torrent' &&
|
||||
<FormGroup>
|
||||
<FormLabel>{translate('RemoveFailed')}</FormLabel>
|
||||
<FormGroup>
|
||||
<FormLabel>{translate('RemoveFailed')}</FormLabel>
|
||||
|
||||
<FormInputGroup
|
||||
type={inputTypes.CHECK}
|
||||
name="removeFailedDownloads"
|
||||
helpText={translate('RemoveFailedDownloadsHelpText')}
|
||||
{...removeFailedDownloads}
|
||||
onChange={onInputChange}
|
||||
/>
|
||||
</FormGroup>
|
||||
}
|
||||
<FormInputGroup
|
||||
type={inputTypes.CHECK}
|
||||
name="removeFailedDownloads"
|
||||
helpText={translate('RemoveFailedDownloadsHelpText')}
|
||||
{...removeFailedDownloads}
|
||||
onChange={onInputChange}
|
||||
/>
|
||||
</FormGroup>
|
||||
</FieldSet>
|
||||
</Form>
|
||||
}
|
||||
|
||||
@@ -10,11 +10,11 @@ import ModalBody from 'Components/Modal/ModalBody';
|
||||
import ModalContent from 'Components/Modal/ModalContent';
|
||||
import ModalFooter from 'Components/Modal/ModalFooter';
|
||||
import ModalHeader from 'Components/Modal/ModalHeader';
|
||||
import Column from 'Components/Table/Column';
|
||||
import Table from 'Components/Table/Table';
|
||||
import TableBody from 'Components/Table/TableBody';
|
||||
import useSelectState from 'Helpers/Hooks/useSelectState';
|
||||
import { kinds } from 'Helpers/Props';
|
||||
import { SortDirection } from 'Helpers/Props/sortDirections';
|
||||
import {
|
||||
bulkDeleteDownloadClients,
|
||||
bulkEditDownloadClients,
|
||||
@@ -35,7 +35,7 @@ type OnSelectedChangeCallback = React.ComponentProps<
|
||||
typeof ManageDownloadClientsModalRow
|
||||
>['onSelectedChange'];
|
||||
|
||||
const COLUMNS = [
|
||||
const COLUMNS: Column[] = [
|
||||
{
|
||||
name: 'name',
|
||||
label: () => translate('Name'),
|
||||
@@ -82,8 +82,6 @@ const COLUMNS = [
|
||||
|
||||
interface ManageDownloadClientsModalContentProps {
|
||||
onModalClose(): void;
|
||||
sortKey?: string;
|
||||
sortDirection?: SortDirection;
|
||||
}
|
||||
|
||||
function ManageDownloadClientsModalContent(
|
||||
|
||||
@@ -10,11 +10,11 @@ import ModalBody from 'Components/Modal/ModalBody';
|
||||
import ModalContent from 'Components/Modal/ModalContent';
|
||||
import ModalFooter from 'Components/Modal/ModalFooter';
|
||||
import ModalHeader from 'Components/Modal/ModalHeader';
|
||||
import Column from 'Components/Table/Column';
|
||||
import Table from 'Components/Table/Table';
|
||||
import TableBody from 'Components/Table/TableBody';
|
||||
import useSelectState from 'Helpers/Hooks/useSelectState';
|
||||
import { kinds } from 'Helpers/Props';
|
||||
import { SortDirection } from 'Helpers/Props/sortDirections';
|
||||
import {
|
||||
bulkDeleteIndexers,
|
||||
bulkEditIndexers,
|
||||
@@ -35,7 +35,7 @@ type OnSelectedChangeCallback = React.ComponentProps<
|
||||
typeof ManageIndexersModalRow
|
||||
>['onSelectedChange'];
|
||||
|
||||
const COLUMNS = [
|
||||
const COLUMNS: Column[] = [
|
||||
{
|
||||
name: 'name',
|
||||
label: () => translate('Name'),
|
||||
@@ -82,8 +82,6 @@ const COLUMNS = [
|
||||
|
||||
interface ManageIndexersModalContentProps {
|
||||
onModalClose(): void;
|
||||
sortKey?: string;
|
||||
sortDirection?: SortDirection;
|
||||
}
|
||||
|
||||
function ManageIndexersModalContent(props: ManageIndexersModalContentProps) {
|
||||
|
||||
@@ -44,11 +44,13 @@ export interface DownloadFolderImportedHistory {
|
||||
downloadClientName: string;
|
||||
droppedPath: string;
|
||||
importedPath: string;
|
||||
size: string;
|
||||
}
|
||||
|
||||
export interface MovieFileDeletedHistory {
|
||||
customFormatScore?: string;
|
||||
reason: 'Manual' | 'MissingFromDisk' | 'Upgrade';
|
||||
size: string;
|
||||
}
|
||||
|
||||
export interface MovieFileRenamedHistory {
|
||||
|
||||
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using NLog;
|
||||
using NzbDrone.Common.EnsureThat;
|
||||
using NzbDrone.Common.EnvironmentInfo;
|
||||
@@ -316,9 +317,26 @@ namespace NzbDrone.Common.Disk
|
||||
{
|
||||
Ensure.That(path, () => path).IsValidPath(PathValidationType.CurrentOs);
|
||||
|
||||
var files = GetFiles(path, recursive);
|
||||
var files = GetFiles(path, recursive).ToList();
|
||||
|
||||
files.ToList().ForEach(RemoveReadOnly);
|
||||
files.ForEach(RemoveReadOnly);
|
||||
|
||||
var attempts = 0;
|
||||
|
||||
while (attempts < 3 && files.Any())
|
||||
{
|
||||
EmptyFolder(path);
|
||||
|
||||
if (GetFiles(path, recursive).Any())
|
||||
{
|
||||
// Wait for IO operations to complete after emptying the folder since they aren't always
|
||||
// instantly removed and it can lead to false positives that files are still present.
|
||||
Thread.Sleep(3000);
|
||||
}
|
||||
|
||||
attempts++;
|
||||
files = GetFiles(path, recursive).ToList();
|
||||
}
|
||||
|
||||
Directory.Delete(path, recursive);
|
||||
}
|
||||
|
||||
9
src/NzbDrone.Common/Utf8StringWriter.cs
Normal file
9
src/NzbDrone.Common/Utf8StringWriter.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace NzbDrone.Common;
|
||||
|
||||
public class Utf8StringWriter : StringWriter
|
||||
{
|
||||
public override Encoding Encoding => Encoding.UTF8;
|
||||
}
|
||||
@@ -1,8 +1,10 @@
|
||||
using FluentAssertions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.Indexers;
|
||||
using NzbDrone.Core.Indexers.Torznab;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
@@ -14,13 +16,13 @@ namespace NzbDrone.Core.Test.IndexerTests
|
||||
[Test]
|
||||
public void should_not_return_config_for_non_existent_indexer()
|
||||
{
|
||||
Mocker.GetMock<IIndexerFactory>()
|
||||
.Setup(v => v.Get(It.IsAny<int>()))
|
||||
.Throws(new ModelNotFoundException(typeof(IndexerDefinition), 0));
|
||||
Mocker.GetMock<ICachedIndexerSettingsProvider>()
|
||||
.Setup(v => v.GetSettings(It.IsAny<int>()))
|
||||
.Returns<CachedIndexerSettings>(null);
|
||||
|
||||
var result = Subject.GetSeedConfiguration(new RemoteMovie
|
||||
{
|
||||
Release = new ReleaseInfo()
|
||||
Release = new ReleaseInfo
|
||||
{
|
||||
DownloadProtocol = DownloadProtocol.Torrent,
|
||||
IndexerId = 0
|
||||
@@ -29,5 +31,53 @@ namespace NzbDrone.Core.Test.IndexerTests
|
||||
|
||||
result.Should().BeNull();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_not_return_config_for_invalid_indexer()
|
||||
{
|
||||
Mocker.GetMock<ICachedIndexerSettingsProvider>()
|
||||
.Setup(v => v.GetSettings(It.IsAny<int>()))
|
||||
.Returns<CachedIndexerSettings>(null);
|
||||
|
||||
var result = Subject.GetSeedConfiguration(new RemoteMovie
|
||||
{
|
||||
Release = new ReleaseInfo
|
||||
{
|
||||
DownloadProtocol = DownloadProtocol.Torrent,
|
||||
IndexerId = 1
|
||||
},
|
||||
ParsedMovieInfo = new ParsedMovieInfo()
|
||||
});
|
||||
|
||||
result.Should().BeNull();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_seed_time_for_movies()
|
||||
{
|
||||
var settings = new TorznabSettings();
|
||||
settings.SeedCriteria.SeedTime = 10;
|
||||
|
||||
Mocker.GetMock<ICachedIndexerSettingsProvider>()
|
||||
.Setup(v => v.GetSettings(It.IsAny<int>()))
|
||||
.Returns(new CachedIndexerSettings
|
||||
{
|
||||
FailDownloads = new HashSet<FailDownloads> { FailDownloads.Executables },
|
||||
SeedCriteriaSettings = settings.SeedCriteria
|
||||
});
|
||||
|
||||
var result = Subject.GetSeedConfiguration(new RemoteMovie
|
||||
{
|
||||
Release = new ReleaseInfo
|
||||
{
|
||||
DownloadProtocol = DownloadProtocol.Torrent,
|
||||
IndexerId = 1
|
||||
},
|
||||
ParsedMovieInfo = new ParsedMovieInfo()
|
||||
});
|
||||
|
||||
result.Should().NotBeNull();
|
||||
result.SeedTime.Should().Be(TimeSpan.FromMinutes(10));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,5 +15,6 @@ namespace NzbDrone.Core.Test.IndexerTests
|
||||
public string BaseUrl { get; set; }
|
||||
|
||||
public IEnumerable<int> MultiLanguages { get; set; }
|
||||
public IEnumerable<int> FailDownloads { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ namespace NzbDrone.Core.Download
|
||||
private readonly IParsingService _parsingService;
|
||||
private readonly IMovieService _movieService;
|
||||
private readonly ITrackedDownloadAlreadyImported _trackedDownloadAlreadyImported;
|
||||
private readonly IRejectedImportService _rejectedImportService;
|
||||
private readonly Logger _logger;
|
||||
|
||||
public CompletedDownloadService(IEventAggregator eventAggregator,
|
||||
@@ -42,6 +43,7 @@ namespace NzbDrone.Core.Download
|
||||
IParsingService parsingService,
|
||||
IMovieService movieService,
|
||||
ITrackedDownloadAlreadyImported trackedDownloadAlreadyImported,
|
||||
IRejectedImportService rejectedImportService,
|
||||
Logger logger)
|
||||
{
|
||||
_eventAggregator = eventAggregator;
|
||||
@@ -51,6 +53,7 @@ namespace NzbDrone.Core.Download
|
||||
_parsingService = parsingService;
|
||||
_movieService = movieService;
|
||||
_trackedDownloadAlreadyImported = trackedDownloadAlreadyImported;
|
||||
_rejectedImportService = rejectedImportService;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
@@ -159,10 +162,8 @@ namespace NzbDrone.Core.Download
|
||||
{
|
||||
var firstResult = importResults.First();
|
||||
|
||||
if (firstResult.Result == ImportResultType.Rejected && firstResult.ImportDecision.LocalMovie == null)
|
||||
if (_rejectedImportService.Process(trackedDownload, firstResult))
|
||||
{
|
||||
trackedDownload.Warn(new TrackedDownloadStatusMessage(firstResult.Errors.First(), new List<string>()));
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,14 +55,18 @@ namespace NzbDrone.Core.Download
|
||||
{
|
||||
try
|
||||
{
|
||||
// Process completed items followed by failed, this allows failed imports to have
|
||||
// their state changed and be processed immediately instead of the next execution.
|
||||
|
||||
if (enableCompletedDownloadHandling && trackedDownload.State == TrackedDownloadState.ImportPending)
|
||||
{
|
||||
_completedDownloadService.Import(trackedDownload);
|
||||
}
|
||||
|
||||
if (trackedDownload.State == TrackedDownloadState.FailedPending)
|
||||
{
|
||||
_failedDownloadService.ProcessFailed(trackedDownload);
|
||||
}
|
||||
else if (enableCompletedDownloadHandling && trackedDownload.State == TrackedDownloadState.ImportPending)
|
||||
{
|
||||
_completedDownloadService.Import(trackedDownload);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace NzbDrone.Core.Download
|
||||
|
||||
if (grabbedItems.Empty())
|
||||
{
|
||||
trackedDownload.Warn("Download wasn't grabbed by Radarr, skipping");
|
||||
trackedDownload.Warn(trackedDownload.DownloadItem.IsEncrypted ? "Download is encrypted and wasn't grabbed by Radarr, skipping automatic download handling" : "Download has failed wasn't grabbed by Radarr, skipping automatic download handling");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
60
src/NzbDrone.Core/Download/RejectedImportService.cs
Normal file
60
src/NzbDrone.Core/Download/RejectedImportService.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Download.TrackedDownloads;
|
||||
using NzbDrone.Core.Indexers;
|
||||
using NzbDrone.Core.MediaFiles.MovieImport;
|
||||
|
||||
namespace NzbDrone.Core.Download;
|
||||
|
||||
public interface IRejectedImportService
|
||||
{
|
||||
bool Process(TrackedDownload trackedDownload, ImportResult importResult);
|
||||
}
|
||||
|
||||
public class RejectedImportService : IRejectedImportService
|
||||
{
|
||||
private readonly ICachedIndexerSettingsProvider _cachedIndexerSettingsProvider;
|
||||
private readonly Logger _logger;
|
||||
|
||||
public RejectedImportService(ICachedIndexerSettingsProvider cachedIndexerSettingsProvider, Logger logger)
|
||||
{
|
||||
_cachedIndexerSettingsProvider = cachedIndexerSettingsProvider;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public bool Process(TrackedDownload trackedDownload, ImportResult importResult)
|
||||
{
|
||||
if (importResult.Result != ImportResultType.Rejected || trackedDownload.RemoteMovie?.Release == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var indexerSettings = _cachedIndexerSettingsProvider.GetSettings(trackedDownload.RemoteMovie.Release.IndexerId);
|
||||
var rejectionReason = importResult.ImportDecision.Rejections.FirstOrDefault()?.Reason;
|
||||
|
||||
if (indexerSettings == null)
|
||||
{
|
||||
trackedDownload.Warn(new TrackedDownloadStatusMessage(trackedDownload.DownloadItem.Title, importResult.Errors));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (rejectionReason == ImportRejectionReason.DangerousFile &&
|
||||
indexerSettings.FailDownloads.Contains(FailDownloads.PotentiallyDangerous))
|
||||
{
|
||||
_logger.Trace("Download '{0}' contains potentially dangerous file, marking as failed", trackedDownload.DownloadItem.Title);
|
||||
trackedDownload.Fail();
|
||||
}
|
||||
else if (rejectionReason == ImportRejectionReason.ExecutableFile &&
|
||||
indexerSettings.FailDownloads.Contains(FailDownloads.Executables))
|
||||
{
|
||||
_logger.Trace("Download '{0}' contains executable file, marking as failed", trackedDownload.DownloadItem.Title);
|
||||
trackedDownload.Fail();
|
||||
}
|
||||
else
|
||||
{
|
||||
trackedDownload.Warn(new TrackedDownloadStatusMessage(trackedDownload.DownloadItem.Title, importResult.Errors));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -35,6 +35,15 @@ namespace NzbDrone.Core.Download.TrackedDownloads
|
||||
Status = TrackedDownloadStatus.Warning;
|
||||
StatusMessages = statusMessages;
|
||||
}
|
||||
|
||||
public void Fail()
|
||||
{
|
||||
Status = TrackedDownloadStatus.Error;
|
||||
State = TrackedDownloadState.FailedPending;
|
||||
|
||||
// Set CanBeRemoved to allow the failed item to be removed from the client
|
||||
DownloadItem.CanBeRemoved = true;
|
||||
}
|
||||
}
|
||||
|
||||
public enum TrackedDownloadState
|
||||
|
||||
@@ -166,6 +166,11 @@ namespace NzbDrone.Core.Download.TrackedDownloads
|
||||
{
|
||||
trackedDownload.RemoteMovie.Release.IndexerFlags = flags;
|
||||
}
|
||||
|
||||
if (downloadHistory != null)
|
||||
{
|
||||
trackedDownload.RemoteMovie.Release.IndexerId = downloadHistory.IndexerId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ using System.Text.RegularExpressions;
|
||||
using System.Xml;
|
||||
using System.Xml.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Common.Disk;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Extras.Metadata.Files;
|
||||
@@ -56,7 +57,6 @@ namespace NzbDrone.Core.Extras.Metadata.Consumers.Xbmc
|
||||
public override string GetFilenameAfterMove(Movie movie, MovieFile movieFile, MetadataFile metadataFile)
|
||||
{
|
||||
var movieFilePath = Path.Combine(movie.Path, movieFile.RelativePath);
|
||||
var metadataPath = Path.Combine(movie.Path, metadataFile.RelativePath);
|
||||
|
||||
if (metadataFile.Type == MetadataType.MovieMetadata)
|
||||
{
|
||||
@@ -118,11 +118,12 @@ namespace NzbDrone.Core.Extras.Metadata.Consumers.Xbmc
|
||||
public override MetadataFileResult MovieMetadata(Movie movie, MovieFile movieFile)
|
||||
{
|
||||
var xmlResult = string.Empty;
|
||||
|
||||
if (Settings.MovieMetadata)
|
||||
{
|
||||
_logger.Debug("Generating Movie Metadata for: {0}", Path.Combine(movie.Path, movieFile.RelativePath));
|
||||
|
||||
var movieMetadataLanguage = (Settings.MovieMetadataLanguage == (int)Language.Original) ?
|
||||
var movieMetadataLanguage = Settings.MovieMetadataLanguage == (int)Language.Original ?
|
||||
(int)movie.MovieMetadata.Value.OriginalLanguage :
|
||||
Settings.MovieMetadataLanguage;
|
||||
|
||||
@@ -134,295 +135,299 @@ namespace NzbDrone.Core.Extras.Metadata.Consumers.Xbmc
|
||||
|
||||
var watched = GetExistingWatchedStatus(movie, movieFile.RelativePath);
|
||||
|
||||
var sb = new StringBuilder();
|
||||
var xws = new XmlWriterSettings();
|
||||
xws.OmitXmlDeclaration = true;
|
||||
xws.Indent = false;
|
||||
var thumbnail = movie.MovieMetadata.Value.Images.SingleOrDefault(i => i.CoverType == MediaCoverTypes.Screenshot);
|
||||
var posters = movie.MovieMetadata.Value.Images.Where(i => i.CoverType == MediaCoverTypes.Poster).ToList();
|
||||
var fanarts = movie.MovieMetadata.Value.Images.Where(i => i.CoverType == MediaCoverTypes.Fanart).ToList();
|
||||
|
||||
using (var xw = XmlWriter.Create(sb, xws))
|
||||
var details = new XElement("movie");
|
||||
|
||||
var metadataTitle = movieTranslation?.Title ?? movie.Title;
|
||||
|
||||
details.Add(new XElement("title", metadataTitle));
|
||||
|
||||
details.Add(new XElement("originaltitle", movie.MovieMetadata.Value.OriginalTitle));
|
||||
|
||||
details.Add(new XElement("sorttitle", Parser.Parser.NormalizeTitle(metadataTitle)));
|
||||
|
||||
if (movie.MovieMetadata.Value.Ratings?.Tmdb?.Votes > 0 || movie.MovieMetadata.Value.Ratings?.Imdb?.Votes > 0 || movie.MovieMetadata.Value.Ratings?.RottenTomatoes?.Value > 0)
|
||||
{
|
||||
var doc = new XDocument();
|
||||
var thumbnail = movie.MovieMetadata.Value.Images.SingleOrDefault(i => i.CoverType == MediaCoverTypes.Screenshot);
|
||||
var posters = movie.MovieMetadata.Value.Images.Where(i => i.CoverType == MediaCoverTypes.Poster);
|
||||
var fanarts = movie.MovieMetadata.Value.Images.Where(i => i.CoverType == MediaCoverTypes.Fanart);
|
||||
var setRating = new XElement("ratings");
|
||||
|
||||
var details = new XElement("movie");
|
||||
var defaultRatingSet = false;
|
||||
|
||||
var metadataTitle = movieTranslation?.Title ?? movie.Title;
|
||||
|
||||
details.Add(new XElement("title", metadataTitle));
|
||||
|
||||
details.Add(new XElement("originaltitle", movie.MovieMetadata.Value.OriginalTitle));
|
||||
|
||||
details.Add(new XElement("sorttitle", Parser.Parser.NormalizeTitle(metadataTitle)));
|
||||
|
||||
if (movie.MovieMetadata.Value.Ratings?.Tmdb?.Votes > 0 || movie.MovieMetadata.Value.Ratings?.Imdb?.Votes > 0 || movie.MovieMetadata.Value.Ratings?.RottenTomatoes?.Value > 0)
|
||||
if (movie.MovieMetadata.Value.Ratings?.Imdb?.Votes > 0)
|
||||
{
|
||||
var setRating = new XElement("ratings");
|
||||
var setRateImdb = new XElement("rating", new XAttribute("name", "imdb"), new XAttribute("max", "10"), new XAttribute("default", "true"));
|
||||
setRateImdb.Add(new XElement("value", movie.MovieMetadata.Value.Ratings.Imdb.Value));
|
||||
setRateImdb.Add(new XElement("votes", movie.MovieMetadata.Value.Ratings.Imdb.Votes));
|
||||
|
||||
var defaultRatingSet = false;
|
||||
|
||||
if (movie.MovieMetadata.Value.Ratings?.Imdb?.Votes > 0)
|
||||
{
|
||||
var setRateImdb = new XElement("rating", new XAttribute("name", "imdb"), new XAttribute("max", "10"), new XAttribute("default", "true"));
|
||||
setRateImdb.Add(new XElement("value", movie.MovieMetadata.Value.Ratings.Imdb.Value));
|
||||
setRateImdb.Add(new XElement("votes", movie.MovieMetadata.Value.Ratings.Imdb.Votes));
|
||||
|
||||
defaultRatingSet = true;
|
||||
setRating.Add(setRateImdb);
|
||||
}
|
||||
|
||||
if (movie.MovieMetadata.Value.Ratings?.Tmdb?.Votes > 0)
|
||||
{
|
||||
var setRateTheMovieDb = new XElement("rating", new XAttribute("name", "themoviedb"), new XAttribute("max", "10"));
|
||||
setRateTheMovieDb.Add(new XElement("value", movie.MovieMetadata.Value.Ratings.Tmdb.Value));
|
||||
setRateTheMovieDb.Add(new XElement("votes", movie.MovieMetadata.Value.Ratings.Tmdb.Votes));
|
||||
|
||||
if (!defaultRatingSet)
|
||||
{
|
||||
defaultRatingSet = true;
|
||||
setRateTheMovieDb.SetAttributeValue("default", "true");
|
||||
}
|
||||
|
||||
setRating.Add(setRateTheMovieDb);
|
||||
}
|
||||
|
||||
if (movie.MovieMetadata.Value.Ratings?.RottenTomatoes?.Value > 0)
|
||||
{
|
||||
var setRateRottenTomatoes = new XElement("rating", new XAttribute("name", "tomatometerallcritics"), new XAttribute("max", "100"));
|
||||
setRateRottenTomatoes.Add(new XElement("value", movie.MovieMetadata.Value.Ratings.RottenTomatoes.Value));
|
||||
|
||||
if (!defaultRatingSet)
|
||||
{
|
||||
setRateRottenTomatoes.SetAttributeValue("default", "true");
|
||||
}
|
||||
|
||||
setRating.Add(setRateRottenTomatoes);
|
||||
}
|
||||
|
||||
details.Add(setRating);
|
||||
defaultRatingSet = true;
|
||||
setRating.Add(setRateImdb);
|
||||
}
|
||||
|
||||
if (movie.MovieMetadata.Value.Ratings?.Tmdb?.Votes > 0)
|
||||
{
|
||||
details.Add(new XElement("rating", movie.MovieMetadata.Value.Ratings.Tmdb.Value));
|
||||
var setRateTheMovieDb = new XElement("rating", new XAttribute("name", "themoviedb"), new XAttribute("max", "10"));
|
||||
setRateTheMovieDb.Add(new XElement("value", movie.MovieMetadata.Value.Ratings.Tmdb.Value));
|
||||
setRateTheMovieDb.Add(new XElement("votes", movie.MovieMetadata.Value.Ratings.Tmdb.Votes));
|
||||
|
||||
if (!defaultRatingSet)
|
||||
{
|
||||
defaultRatingSet = true;
|
||||
setRateTheMovieDb.SetAttributeValue("default", "true");
|
||||
}
|
||||
|
||||
setRating.Add(setRateTheMovieDb);
|
||||
}
|
||||
|
||||
if (movie.MovieMetadata.Value.Ratings?.RottenTomatoes?.Value > 0)
|
||||
{
|
||||
details.Add(new XElement("criticrating", movie.MovieMetadata.Value.Ratings.RottenTomatoes.Value));
|
||||
}
|
||||
var setRateRottenTomatoes = new XElement("rating", new XAttribute("name", "tomatometerallcritics"), new XAttribute("max", "100"));
|
||||
setRateRottenTomatoes.Add(new XElement("value", movie.MovieMetadata.Value.Ratings.RottenTomatoes.Value));
|
||||
|
||||
details.Add(new XElement("userrating"));
|
||||
|
||||
details.Add(new XElement("top250"));
|
||||
|
||||
details.Add(new XElement("outline"));
|
||||
|
||||
details.Add(new XElement("plot", movieTranslation?.Overview ?? movie.MovieMetadata.Value.Overview));
|
||||
|
||||
details.Add(new XElement("tagline"));
|
||||
|
||||
details.Add(new XElement("runtime", movie.MovieMetadata.Value.Runtime));
|
||||
|
||||
if (thumbnail != null)
|
||||
{
|
||||
details.Add(new XElement("thumb", thumbnail.RemoteUrl));
|
||||
}
|
||||
|
||||
foreach (var poster in posters)
|
||||
{
|
||||
if (poster != null && poster.RemoteUrl != null)
|
||||
if (!defaultRatingSet)
|
||||
{
|
||||
details.Add(new XElement("thumb", new XAttribute("aspect", "poster"), new XAttribute("preview", poster.RemoteUrl), poster.RemoteUrl));
|
||||
}
|
||||
}
|
||||
|
||||
if (fanarts.Any())
|
||||
{
|
||||
var fanartElement = new XElement("fanart");
|
||||
foreach (var fanart in fanarts)
|
||||
{
|
||||
if (fanart != null && fanart.RemoteUrl != null)
|
||||
{
|
||||
fanartElement.Add(new XElement("thumb", new XAttribute("preview", fanart.RemoteUrl), fanart.RemoteUrl));
|
||||
}
|
||||
setRateRottenTomatoes.SetAttributeValue("default", "true");
|
||||
}
|
||||
|
||||
details.Add(fanartElement);
|
||||
setRating.Add(setRateRottenTomatoes);
|
||||
}
|
||||
|
||||
if (movie.MovieMetadata.Value.Certification.IsNotNullOrWhiteSpace())
|
||||
{
|
||||
details.Add(new XElement("mpaa", movie.MovieMetadata.Value.Certification));
|
||||
}
|
||||
|
||||
details.Add(new XElement("playcount"));
|
||||
|
||||
details.Add(new XElement("lastplayed"));
|
||||
|
||||
details.Add(new XElement("id", movie.TmdbId));
|
||||
|
||||
var uniqueId = new XElement("uniqueid", movie.TmdbId);
|
||||
uniqueId.SetAttributeValue("type", "tmdb");
|
||||
uniqueId.SetAttributeValue("default", true);
|
||||
details.Add(uniqueId);
|
||||
|
||||
if (movie.MovieMetadata.Value.ImdbId.IsNotNullOrWhiteSpace())
|
||||
{
|
||||
var imdbId = new XElement("uniqueid", movie.MovieMetadata.Value.ImdbId);
|
||||
imdbId.SetAttributeValue("type", "imdb");
|
||||
details.Add(imdbId);
|
||||
}
|
||||
|
||||
foreach (var genre in movie.MovieMetadata.Value.Genres)
|
||||
{
|
||||
details.Add(new XElement("genre", genre));
|
||||
}
|
||||
|
||||
details.Add(new XElement("country"));
|
||||
|
||||
if (Settings.AddCollectionName && movie.MovieMetadata.Value.CollectionTitle.IsNotNullOrWhiteSpace())
|
||||
{
|
||||
var setElement = new XElement("set");
|
||||
|
||||
setElement.Add(new XElement("name", movie.MovieMetadata.Value.CollectionTitle));
|
||||
setElement.Add(new XElement("overview"));
|
||||
|
||||
details.Add(setElement);
|
||||
}
|
||||
|
||||
if (movie.Tags.Any())
|
||||
{
|
||||
var tags = _tagRepository.GetTags(movie.Tags);
|
||||
|
||||
foreach (var tag in tags)
|
||||
{
|
||||
details.Add(new XElement("tag", tag.Label));
|
||||
}
|
||||
}
|
||||
|
||||
details.Add(new XElement("status", movie.MovieMetadata.Value.Status));
|
||||
|
||||
foreach (var credit in credits)
|
||||
{
|
||||
if (credit.Name != null && credit.Job == "Screenplay")
|
||||
{
|
||||
details.Add(new XElement("credits", credit.Name));
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var credit in credits)
|
||||
{
|
||||
if (credit.Name != null && credit.Job == "Director")
|
||||
{
|
||||
details.Add(new XElement("director", credit.Name));
|
||||
}
|
||||
}
|
||||
|
||||
if (movie.MovieMetadata.Value.InCinemas.HasValue)
|
||||
{
|
||||
details.Add(new XElement("premiered", movie.MovieMetadata.Value.InCinemas.Value.ToString("yyyy-MM-dd")));
|
||||
}
|
||||
|
||||
details.Add(new XElement("year", movie.Year));
|
||||
|
||||
details.Add(new XElement("studio", movie.MovieMetadata.Value.Studio));
|
||||
|
||||
details.Add(new XElement("trailer", "plugin://plugin.video.youtube/play/?video_id=" + movie.MovieMetadata.Value.YouTubeTrailerId));
|
||||
|
||||
details.Add(new XElement("watched", watched));
|
||||
|
||||
if (movieFile.MediaInfo != null)
|
||||
{
|
||||
var sceneName = movieFile.GetSceneOrFileName();
|
||||
|
||||
var fileInfo = new XElement("fileinfo");
|
||||
var streamDetails = new XElement("streamdetails");
|
||||
|
||||
var video = new XElement("video");
|
||||
video.Add(new XElement("aspect", (float)movieFile.MediaInfo.Width / (float)movieFile.MediaInfo.Height));
|
||||
video.Add(new XElement("bitrate", movieFile.MediaInfo.VideoBitrate));
|
||||
video.Add(new XElement("codec", MediaInfoFormatter.FormatVideoCodec(movieFile.MediaInfo, sceneName)));
|
||||
video.Add(new XElement("framerate", movieFile.MediaInfo.VideoFps));
|
||||
video.Add(new XElement("height", movieFile.MediaInfo.Height));
|
||||
video.Add(new XElement("scantype", movieFile.MediaInfo.ScanType));
|
||||
video.Add(new XElement("width", movieFile.MediaInfo.Width));
|
||||
|
||||
if (movieFile.MediaInfo.RunTime != default)
|
||||
{
|
||||
video.Add(new XElement("duration", movieFile.MediaInfo.RunTime.TotalMinutes));
|
||||
video.Add(new XElement("durationinseconds", Math.Round(movieFile.MediaInfo.RunTime.TotalSeconds)));
|
||||
}
|
||||
|
||||
if (movieFile.MediaInfo.VideoHdrFormat is HdrFormat.DolbyVision or HdrFormat.DolbyVisionHdr10 or HdrFormat.DolbyVisionHdr10Plus or HdrFormat.DolbyVisionHlg or HdrFormat.DolbyVisionSdr)
|
||||
{
|
||||
video.Add(new XElement("hdrtype", "dolbyvision"));
|
||||
}
|
||||
else if (movieFile.MediaInfo.VideoHdrFormat is HdrFormat.Hdr10 or HdrFormat.Hdr10Plus or HdrFormat.Pq10)
|
||||
{
|
||||
video.Add(new XElement("hdrtype", "hdr10"));
|
||||
}
|
||||
else if (movieFile.MediaInfo.VideoHdrFormat == HdrFormat.Hlg10)
|
||||
{
|
||||
video.Add(new XElement("hdrtype", "hlg"));
|
||||
}
|
||||
else if (movieFile.MediaInfo.VideoHdrFormat == HdrFormat.None)
|
||||
{
|
||||
video.Add(new XElement("hdrtype", ""));
|
||||
}
|
||||
|
||||
streamDetails.Add(video);
|
||||
|
||||
var audio = new XElement("audio");
|
||||
var audioChannelCount = movieFile.MediaInfo.AudioChannels;
|
||||
audio.Add(new XElement("bitrate", movieFile.MediaInfo.AudioBitrate));
|
||||
audio.Add(new XElement("channels", audioChannelCount));
|
||||
audio.Add(new XElement("codec", MediaInfoFormatter.FormatAudioCodec(movieFile.MediaInfo, sceneName)));
|
||||
audio.Add(new XElement("language", movieFile.MediaInfo.AudioLanguages));
|
||||
streamDetails.Add(audio);
|
||||
|
||||
if (movieFile.MediaInfo.Subtitles != null && movieFile.MediaInfo.Subtitles.Count > 0)
|
||||
{
|
||||
foreach (var s in movieFile.MediaInfo.Subtitles)
|
||||
{
|
||||
var subtitle = new XElement("subtitle");
|
||||
subtitle.Add(new XElement("language", s));
|
||||
streamDetails.Add(subtitle);
|
||||
}
|
||||
}
|
||||
|
||||
fileInfo.Add(streamDetails);
|
||||
details.Add(fileInfo);
|
||||
|
||||
foreach (var credit in credits)
|
||||
{
|
||||
if (credit.Name != null && credit.Character != null)
|
||||
{
|
||||
var actorElement = new XElement("actor");
|
||||
|
||||
actorElement.Add(new XElement("name", credit.Name));
|
||||
actorElement.Add(new XElement("role", credit.Character));
|
||||
actorElement.Add(new XElement("order", credit.Order));
|
||||
|
||||
var headshot = credit.Images.FirstOrDefault(m => m.CoverType == MediaCoverTypes.Headshot);
|
||||
|
||||
if (headshot != null && headshot.RemoteUrl != null)
|
||||
{
|
||||
actorElement.Add(new XElement("thumb", headshot.RemoteUrl));
|
||||
}
|
||||
|
||||
details.Add(actorElement);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
doc.Add(details);
|
||||
doc.Save(xw);
|
||||
|
||||
xmlResult += doc.ToString();
|
||||
xmlResult += Environment.NewLine;
|
||||
details.Add(setRating);
|
||||
}
|
||||
|
||||
if (movie.MovieMetadata.Value.Ratings?.Tmdb?.Votes > 0)
|
||||
{
|
||||
details.Add(new XElement("rating", movie.MovieMetadata.Value.Ratings.Tmdb.Value));
|
||||
}
|
||||
|
||||
if (movie.MovieMetadata.Value.Ratings?.RottenTomatoes?.Value > 0)
|
||||
{
|
||||
details.Add(new XElement("criticrating", movie.MovieMetadata.Value.Ratings.RottenTomatoes.Value));
|
||||
}
|
||||
|
||||
details.Add(new XElement("userrating"));
|
||||
|
||||
details.Add(new XElement("top250"));
|
||||
|
||||
details.Add(new XElement("outline"));
|
||||
|
||||
details.Add(new XElement("plot", movieTranslation?.Overview ?? movie.MovieMetadata.Value.Overview));
|
||||
|
||||
details.Add(new XElement("tagline"));
|
||||
|
||||
details.Add(new XElement("runtime", movie.MovieMetadata.Value.Runtime));
|
||||
|
||||
if (thumbnail != null)
|
||||
{
|
||||
details.Add(new XElement("thumb", thumbnail.RemoteUrl));
|
||||
}
|
||||
|
||||
foreach (var poster in posters)
|
||||
{
|
||||
if (poster != null && poster.RemoteUrl != null)
|
||||
{
|
||||
details.Add(new XElement("thumb", new XAttribute("aspect", "poster"), new XAttribute("preview", poster.RemoteUrl), poster.RemoteUrl));
|
||||
}
|
||||
}
|
||||
|
||||
if (fanarts.Any())
|
||||
{
|
||||
var fanartElement = new XElement("fanart");
|
||||
|
||||
foreach (var fanart in fanarts)
|
||||
{
|
||||
if (fanart != null && fanart.RemoteUrl != null)
|
||||
{
|
||||
fanartElement.Add(new XElement("thumb", new XAttribute("preview", fanart.RemoteUrl), fanart.RemoteUrl));
|
||||
}
|
||||
}
|
||||
|
||||
details.Add(fanartElement);
|
||||
}
|
||||
|
||||
if (movie.MovieMetadata.Value.Certification.IsNotNullOrWhiteSpace())
|
||||
{
|
||||
details.Add(new XElement("mpaa", movie.MovieMetadata.Value.Certification));
|
||||
}
|
||||
|
||||
details.Add(new XElement("playcount"));
|
||||
|
||||
details.Add(new XElement("lastplayed"));
|
||||
|
||||
details.Add(new XElement("id", movie.TmdbId));
|
||||
|
||||
var uniqueId = new XElement("uniqueid", movie.TmdbId);
|
||||
uniqueId.SetAttributeValue("type", "tmdb");
|
||||
uniqueId.SetAttributeValue("default", true);
|
||||
details.Add(uniqueId);
|
||||
|
||||
if (movie.MovieMetadata.Value.ImdbId.IsNotNullOrWhiteSpace())
|
||||
{
|
||||
var imdbId = new XElement("uniqueid", movie.MovieMetadata.Value.ImdbId);
|
||||
imdbId.SetAttributeValue("type", "imdb");
|
||||
details.Add(imdbId);
|
||||
}
|
||||
|
||||
foreach (var genre in movie.MovieMetadata.Value.Genres)
|
||||
{
|
||||
details.Add(new XElement("genre", genre));
|
||||
}
|
||||
|
||||
details.Add(new XElement("country"));
|
||||
|
||||
if (Settings.AddCollectionName && movie.MovieMetadata.Value.CollectionTitle.IsNotNullOrWhiteSpace())
|
||||
{
|
||||
var setElement = new XElement("set");
|
||||
|
||||
setElement.Add(new XElement("name", movie.MovieMetadata.Value.CollectionTitle));
|
||||
setElement.Add(new XElement("overview"));
|
||||
|
||||
details.Add(setElement);
|
||||
}
|
||||
|
||||
if (movie.Tags.Any())
|
||||
{
|
||||
var tags = _tagRepository.GetTags(movie.Tags);
|
||||
|
||||
foreach (var tag in tags)
|
||||
{
|
||||
details.Add(new XElement("tag", tag.Label));
|
||||
}
|
||||
}
|
||||
|
||||
details.Add(new XElement("status", movie.MovieMetadata.Value.Status));
|
||||
|
||||
foreach (var credit in credits)
|
||||
{
|
||||
if (credit.Name != null && credit.Job == "Screenplay")
|
||||
{
|
||||
details.Add(new XElement("credits", credit.Name));
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var credit in credits)
|
||||
{
|
||||
if (credit.Name != null && credit.Job == "Director")
|
||||
{
|
||||
details.Add(new XElement("director", credit.Name));
|
||||
}
|
||||
}
|
||||
|
||||
if (movie.MovieMetadata.Value.InCinemas.HasValue)
|
||||
{
|
||||
details.Add(new XElement("premiered", movie.MovieMetadata.Value.InCinemas.Value.ToString("yyyy-MM-dd")));
|
||||
}
|
||||
|
||||
details.Add(new XElement("year", movie.Year));
|
||||
|
||||
details.Add(new XElement("studio", movie.MovieMetadata.Value.Studio));
|
||||
|
||||
details.Add(new XElement("trailer", "plugin://plugin.video.youtube/play/?video_id=" + movie.MovieMetadata.Value.YouTubeTrailerId));
|
||||
|
||||
details.Add(new XElement("watched", watched));
|
||||
|
||||
if (movieFile.MediaInfo != null)
|
||||
{
|
||||
var sceneName = movieFile.GetSceneOrFileName();
|
||||
|
||||
var fileInfo = new XElement("fileinfo");
|
||||
var streamDetails = new XElement("streamdetails");
|
||||
|
||||
var video = new XElement("video");
|
||||
video.Add(new XElement("aspect", (float)movieFile.MediaInfo.Width / (float)movieFile.MediaInfo.Height));
|
||||
video.Add(new XElement("bitrate", movieFile.MediaInfo.VideoBitrate));
|
||||
video.Add(new XElement("codec", MediaInfoFormatter.FormatVideoCodec(movieFile.MediaInfo, sceneName)));
|
||||
video.Add(new XElement("framerate", movieFile.MediaInfo.VideoFps));
|
||||
video.Add(new XElement("height", movieFile.MediaInfo.Height));
|
||||
video.Add(new XElement("scantype", movieFile.MediaInfo.ScanType));
|
||||
video.Add(new XElement("width", movieFile.MediaInfo.Width));
|
||||
|
||||
if (movieFile.MediaInfo.RunTime != TimeSpan.Zero)
|
||||
{
|
||||
video.Add(new XElement("duration", movieFile.MediaInfo.RunTime.TotalMinutes));
|
||||
video.Add(new XElement("durationinseconds", Math.Round(movieFile.MediaInfo.RunTime.TotalSeconds)));
|
||||
}
|
||||
|
||||
if (movieFile.MediaInfo.VideoHdrFormat is HdrFormat.DolbyVision or HdrFormat.DolbyVisionHdr10 or HdrFormat.DolbyVisionHdr10Plus or HdrFormat.DolbyVisionHlg or HdrFormat.DolbyVisionSdr)
|
||||
{
|
||||
video.Add(new XElement("hdrtype", "dolbyvision"));
|
||||
}
|
||||
else if (movieFile.MediaInfo.VideoHdrFormat is HdrFormat.Hdr10 or HdrFormat.Hdr10Plus or HdrFormat.Pq10)
|
||||
{
|
||||
video.Add(new XElement("hdrtype", "hdr10"));
|
||||
}
|
||||
else if (movieFile.MediaInfo.VideoHdrFormat == HdrFormat.Hlg10)
|
||||
{
|
||||
video.Add(new XElement("hdrtype", "hlg"));
|
||||
}
|
||||
else if (movieFile.MediaInfo.VideoHdrFormat == HdrFormat.None)
|
||||
{
|
||||
video.Add(new XElement("hdrtype", ""));
|
||||
}
|
||||
|
||||
streamDetails.Add(video);
|
||||
|
||||
var audio = new XElement("audio");
|
||||
var audioChannelCount = movieFile.MediaInfo.AudioChannels;
|
||||
audio.Add(new XElement("bitrate", movieFile.MediaInfo.AudioBitrate));
|
||||
audio.Add(new XElement("channels", audioChannelCount));
|
||||
audio.Add(new XElement("codec", MediaInfoFormatter.FormatAudioCodec(movieFile.MediaInfo, sceneName)));
|
||||
audio.Add(new XElement("language", movieFile.MediaInfo.AudioLanguages));
|
||||
streamDetails.Add(audio);
|
||||
|
||||
if (movieFile.MediaInfo.Subtitles is { Count: > 0 })
|
||||
{
|
||||
foreach (var s in movieFile.MediaInfo.Subtitles)
|
||||
{
|
||||
var subtitle = new XElement("subtitle");
|
||||
subtitle.Add(new XElement("language", s));
|
||||
streamDetails.Add(subtitle);
|
||||
}
|
||||
}
|
||||
|
||||
fileInfo.Add(streamDetails);
|
||||
details.Add(fileInfo);
|
||||
|
||||
foreach (var credit in credits)
|
||||
{
|
||||
if (credit.Name != null && credit.Character != null)
|
||||
{
|
||||
var actorElement = new XElement("actor");
|
||||
|
||||
actorElement.Add(new XElement("name", credit.Name));
|
||||
actorElement.Add(new XElement("role", credit.Character));
|
||||
actorElement.Add(new XElement("order", credit.Order));
|
||||
|
||||
var headshot = credit.Images.FirstOrDefault(m => m.CoverType == MediaCoverTypes.Headshot);
|
||||
|
||||
if (headshot != null && headshot.RemoteUrl != null)
|
||||
{
|
||||
actorElement.Add(new XElement("thumb", headshot.RemoteUrl));
|
||||
}
|
||||
|
||||
details.Add(actorElement);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var doc = new XDocument(details)
|
||||
{
|
||||
Declaration = new XDeclaration("1.0", "UTF-8", "yes"),
|
||||
};
|
||||
|
||||
using var sw = new Utf8StringWriter();
|
||||
using var xw = XmlWriter.Create(sw, new XmlWriterSettings
|
||||
{
|
||||
Encoding = Encoding.UTF8,
|
||||
Indent = true
|
||||
});
|
||||
|
||||
doc.Save(xw);
|
||||
xw.Flush();
|
||||
|
||||
xmlResult += sw.ToString();
|
||||
xmlResult += Environment.NewLine;
|
||||
}
|
||||
|
||||
if (Settings.MovieMetadataURL)
|
||||
|
||||
@@ -143,7 +143,7 @@ namespace NzbDrone.Core.History
|
||||
history.Data.Add("Age", message.Movie.Release.Age.ToString());
|
||||
history.Data.Add("AgeHours", message.Movie.Release.AgeHours.ToString());
|
||||
history.Data.Add("AgeMinutes", message.Movie.Release.AgeMinutes.ToString());
|
||||
history.Data.Add("PublishedDate", message.Movie.Release.PublishDate.ToString("s") + "Z");
|
||||
history.Data.Add("PublishedDate", message.Movie.Release.PublishDate.ToUniversalTime().ToString("s") + "Z");
|
||||
history.Data.Add("DownloadClient", message.DownloadClient);
|
||||
history.Data.Add("DownloadClientName", message.DownloadClientName);
|
||||
history.Data.Add("Size", message.Movie.Release.Size.ToString());
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using NzbDrone.Core.Annotations;
|
||||
|
||||
namespace NzbDrone.Core.ImportLists.Trakt.Popular
|
||||
@@ -6,27 +7,39 @@ namespace NzbDrone.Core.ImportLists.Trakt.Popular
|
||||
{
|
||||
[FieldOption(Label = "ImportListsTraktSettingsPopularListTypeTrendingMovies")]
|
||||
Trending = 0,
|
||||
|
||||
[FieldOption(Label = "ImportListsTraktSettingsPopularListTypePopularMovies")]
|
||||
Popular = 1,
|
||||
|
||||
[FieldOption(Label = "ImportListsTraktSettingsPopularListTypeTopAnticipatedMovies")]
|
||||
Anticipated = 2,
|
||||
|
||||
[FieldOption(Label = "ImportListsTraktSettingsPopularListTypeTopBoxOfficeMovies")]
|
||||
BoxOffice = 3,
|
||||
|
||||
[FieldOption(Label = "ImportListsTraktSettingsPopularListTypeTopWatchedMoviesByWeek")]
|
||||
TopWatchedByWeek = 4,
|
||||
|
||||
[FieldOption(Label = "ImportListsTraktSettingsPopularListTypeTopWatchedMoviesByMonth")]
|
||||
TopWatchedByMonth = 5,
|
||||
|
||||
[Obsolete]
|
||||
[FieldOption(Label = "ImportListsTraktSettingsPopularListTypeTopWatchedMoviesByYear")]
|
||||
TopWatchedByYear = 6,
|
||||
|
||||
[FieldOption(Label = "ImportListsTraktSettingsPopularListTypeTopWatchedMoviesOfAllTime")]
|
||||
TopWatchedByAllTime = 7,
|
||||
|
||||
[FieldOption(Label = "ImportListsTraktSettingsPopularListTypeRecommendedMoviesByWeek")]
|
||||
RecommendedByWeek = 8,
|
||||
|
||||
[FieldOption(Label = "ImportListsTraktSettingsPopularListTypeRecommendedMoviesByMonth")]
|
||||
RecommendedByMonth = 9,
|
||||
|
||||
[Obsolete]
|
||||
[FieldOption(Label = "ImportListsTraktSettingsPopularListTypeRecommendedMoviesByYear")]
|
||||
RecommendedByYear = 10,
|
||||
|
||||
[FieldOption(Label = "ImportListsTraktSettingsPopularListTypeRecommendedMoviesOfAllTime")]
|
||||
RecommendedByAllTime = 11
|
||||
}
|
||||
|
||||
@@ -49,7 +49,9 @@ namespace NzbDrone.Core.ImportLists.Trakt.Popular
|
||||
case (int)TraktPopularListType.TopWatchedByMonth:
|
||||
link += "movies/watched/monthly";
|
||||
break;
|
||||
#pragma warning disable CS0612
|
||||
case (int)TraktPopularListType.TopWatchedByYear:
|
||||
#pragma warning restore CS0612
|
||||
link += "movies/watched/yearly";
|
||||
break;
|
||||
case (int)TraktPopularListType.TopWatchedByAllTime:
|
||||
@@ -61,11 +63,13 @@ namespace NzbDrone.Core.ImportLists.Trakt.Popular
|
||||
case (int)TraktPopularListType.RecommendedByMonth:
|
||||
link += "movies/recommended/monthly";
|
||||
break;
|
||||
#pragma warning disable CS0612
|
||||
case (int)TraktPopularListType.RecommendedByYear:
|
||||
#pragma warning restore CS0612
|
||||
link += "movies/recommended/yearly";
|
||||
break;
|
||||
case (int)TraktPopularListType.RecommendedByAllTime:
|
||||
link += "movies/recommended/yearly";
|
||||
link += "movies/recommended/all";
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,14 @@ namespace NzbDrone.Core.ImportLists.Trakt.Popular
|
||||
{
|
||||
public TraktPopularSettingsValidator()
|
||||
{
|
||||
RuleFor(c => c.TraktListType).NotNull();
|
||||
RuleFor(c => c.TraktListType)
|
||||
.NotNull()
|
||||
#pragma warning disable CS0612
|
||||
.NotEqual((int)TraktPopularListType.TopWatchedByYear)
|
||||
.WithMessage("Yearly lists are no longer supported")
|
||||
.NotEqual((int)TraktPopularListType.RecommendedByYear)
|
||||
.WithMessage("Yearly lists are no longer supported");
|
||||
#pragma warning restore CS0612
|
||||
|
||||
// Loose validation @TODO
|
||||
RuleFor(c => c.Rating)
|
||||
|
||||
79
src/NzbDrone.Core/Indexers/CachedIndexerSettingsProvider.cs
Normal file
79
src/NzbDrone.Core/Indexers/CachedIndexerSettingsProvider.cs
Normal file
@@ -0,0 +1,79 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Common.Cache;
|
||||
using NzbDrone.Common.Instrumentation;
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
using NzbDrone.Core.ThingiProvider.Events;
|
||||
|
||||
namespace NzbDrone.Core.Indexers;
|
||||
|
||||
public interface ICachedIndexerSettingsProvider
|
||||
{
|
||||
CachedIndexerSettings GetSettings(int indexerId);
|
||||
}
|
||||
|
||||
public class CachedIndexerSettingsProvider : ICachedIndexerSettingsProvider, IHandle<ProviderUpdatedEvent<IIndexer>>, IHandle<ProviderDeletedEvent<IIndexer>>
|
||||
{
|
||||
private static readonly Logger Logger = NzbDroneLogger.GetLogger(typeof(CachedIndexerSettingsProvider));
|
||||
|
||||
private readonly IIndexerFactory _indexerFactory;
|
||||
private readonly ICached<CachedIndexerSettings> _cache;
|
||||
|
||||
public CachedIndexerSettingsProvider(IIndexerFactory indexerFactory, ICacheManager cacheManager)
|
||||
{
|
||||
_indexerFactory = indexerFactory;
|
||||
_cache = cacheManager.GetRollingCache<CachedIndexerSettings>(GetType(), "settingsByIndexer", TimeSpan.FromHours(1));
|
||||
}
|
||||
|
||||
public CachedIndexerSettings GetSettings(int indexerId)
|
||||
{
|
||||
if (indexerId == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return _cache.Get(indexerId.ToString(), () => FetchIndexerSettings(indexerId));
|
||||
}
|
||||
|
||||
private CachedIndexerSettings FetchIndexerSettings(int indexerId)
|
||||
{
|
||||
var indexer = _indexerFactory.Find(indexerId);
|
||||
|
||||
if (indexer?.Settings is not IIndexerSettings indexerSettings)
|
||||
{
|
||||
Logger.Trace("Could not load settings for indexer ID: {0}", indexerId);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
var settings = new CachedIndexerSettings
|
||||
{
|
||||
FailDownloads = indexerSettings.FailDownloads.Select(f => (FailDownloads)f).ToHashSet()
|
||||
};
|
||||
|
||||
if (indexer.Settings is ITorrentIndexerSettings torrentIndexerSettings)
|
||||
{
|
||||
settings.SeedCriteriaSettings = torrentIndexerSettings.SeedCriteria;
|
||||
}
|
||||
|
||||
return settings;
|
||||
}
|
||||
|
||||
public void Handle(ProviderUpdatedEvent<IIndexer> message)
|
||||
{
|
||||
_cache.Clear();
|
||||
}
|
||||
|
||||
public void Handle(ProviderDeletedEvent<IIndexer> message)
|
||||
{
|
||||
_cache.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
public class CachedIndexerSettings
|
||||
{
|
||||
public HashSet<FailDownloads> FailDownloads { get; set; }
|
||||
public SeedCriteriaSettings SeedCriteriaSettings { get; set; }
|
||||
}
|
||||
12
src/NzbDrone.Core/Indexers/FailDownloads.cs
Normal file
12
src/NzbDrone.Core/Indexers/FailDownloads.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using NzbDrone.Core.Annotations;
|
||||
|
||||
namespace NzbDrone.Core.Indexers;
|
||||
|
||||
public enum FailDownloads
|
||||
{
|
||||
[FieldOption(Label = "Executables")]
|
||||
Executables = 0,
|
||||
|
||||
[FieldOption(Label = "Potentially Dangerous")]
|
||||
PotentiallyDangerous = 1
|
||||
}
|
||||
@@ -38,6 +38,7 @@ namespace NzbDrone.Core.Indexers.FileList
|
||||
};
|
||||
|
||||
MultiLanguages = Array.Empty<int>();
|
||||
FailDownloads = Array.Empty<int>();
|
||||
RequiredFlags = Array.Empty<int>();
|
||||
}
|
||||
|
||||
@@ -65,7 +66,10 @@ namespace NzbDrone.Core.Indexers.FileList
|
||||
[FieldDefinition(7, Type = FieldType.Select, SelectOptions = typeof(RealLanguageFieldConverter), Label = "IndexerSettingsMultiLanguageRelease", HelpText = "IndexerSettingsMultiLanguageReleaseHelpText", Advanced = true)]
|
||||
public IEnumerable<int> MultiLanguages { get; set; }
|
||||
|
||||
[FieldDefinition(8, Type = FieldType.Select, SelectOptions = typeof(IndexerFlags), Label = "IndexerSettingsRequiredFlags", HelpText = "IndexerSettingsRequiredFlagsHelpText", HelpLink = "https://wiki.servarr.com/radarr/settings#indexer-flags", Advanced = true)]
|
||||
[FieldDefinition(8, Type = FieldType.Select, SelectOptions = typeof(FailDownloads), Label = "IndexerSettingsFailDownloads", HelpText = "IndexerSettingsFailDownloadsHelpText", Advanced = true)]
|
||||
public IEnumerable<int> FailDownloads { get; set; }
|
||||
|
||||
[FieldDefinition(9, Type = FieldType.Select, SelectOptions = typeof(IndexerFlags), Label = "IndexerSettingsRequiredFlags", HelpText = "IndexerSettingsRequiredFlagsHelpText", HelpLink = "https://wiki.servarr.com/radarr/settings#indexer-flags", Advanced = true)]
|
||||
public IEnumerable<int> RequiredFlags { get; set; }
|
||||
|
||||
public NzbDroneValidationResult Validate()
|
||||
|
||||
@@ -33,6 +33,7 @@ namespace NzbDrone.Core.Indexers.HDBits
|
||||
Codecs = Array.Empty<int>();
|
||||
Mediums = Array.Empty<int>();
|
||||
MultiLanguages = Array.Empty<int>();
|
||||
FailDownloads = Array.Empty<int>();
|
||||
RequiredFlags = Array.Empty<int>();
|
||||
}
|
||||
|
||||
@@ -66,7 +67,10 @@ namespace NzbDrone.Core.Indexers.HDBits
|
||||
[FieldDefinition(9, Type = FieldType.Select, SelectOptions = typeof(RealLanguageFieldConverter), Label = "IndexerSettingsMultiLanguageRelease", HelpText = "IndexerSettingsMultiLanguageReleaseHelpText", Advanced = true)]
|
||||
public IEnumerable<int> MultiLanguages { get; set; }
|
||||
|
||||
[FieldDefinition(10, Type = FieldType.Select, SelectOptions = typeof(IndexerFlags), Label = "IndexerSettingsRequiredFlags", HelpText = "IndexerSettingsRequiredFlagsHelpText", HelpLink = "https://wiki.servarr.com/radarr/settings#indexer-flags", Advanced = true)]
|
||||
[FieldDefinition(10, Type = FieldType.Select, SelectOptions = typeof(FailDownloads), Label = "IndexerSettingsFailDownloads", HelpText = "IndexerSettingsFailDownloadsHelpText", Advanced = true)]
|
||||
public IEnumerable<int> FailDownloads { get; set; }
|
||||
|
||||
[FieldDefinition(11, Type = FieldType.Select, SelectOptions = typeof(IndexerFlags), Label = "IndexerSettingsRequiredFlags", HelpText = "IndexerSettingsRequiredFlagsHelpText", HelpLink = "https://wiki.servarr.com/radarr/settings#indexer-flags", Advanced = true)]
|
||||
public IEnumerable<int> RequiredFlags { get; set; }
|
||||
|
||||
public NzbDroneValidationResult Validate()
|
||||
|
||||
@@ -9,5 +9,7 @@ namespace NzbDrone.Core.Indexers
|
||||
|
||||
// TODO: Need to Create UI field for this and turn functionality back on per indexer.
|
||||
IEnumerable<int> MultiLanguages { get; set; }
|
||||
|
||||
IEnumerable<int> FailDownloads { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ namespace NzbDrone.Core.Indexers.IPTorrents
|
||||
BaseUrl = string.Empty;
|
||||
MinimumSeeders = IndexerDefaults.MINIMUM_SEEDERS;
|
||||
MultiLanguages = Array.Empty<int>();
|
||||
FailDownloads = Array.Empty<int>();
|
||||
RequiredFlags = Array.Empty<int>();
|
||||
}
|
||||
|
||||
@@ -54,7 +55,10 @@ namespace NzbDrone.Core.Indexers.IPTorrents
|
||||
[FieldDefinition(4, Type = FieldType.Select, SelectOptions = typeof(RealLanguageFieldConverter), Label = "IndexerSettingsMultiLanguageRelease", HelpText = "IndexerSettingsMultiLanguageReleaseHelpText", Advanced = true)]
|
||||
public IEnumerable<int> MultiLanguages { get; set; }
|
||||
|
||||
[FieldDefinition(5, Type = FieldType.Select, SelectOptions = typeof(IndexerFlags), Label = "IndexerSettingsRequiredFlags", HelpText = "IndexerSettingsRequiredFlagsHelpText", HelpLink = "https://wiki.servarr.com/radarr/settings#indexer-flags", Advanced = true)]
|
||||
[FieldDefinition(5, Type = FieldType.Select, SelectOptions = typeof(FailDownloads), Label = "IndexerSettingsFailDownloads", HelpText = "IndexerSettingsFailDownloadsHelpText", Advanced = true)]
|
||||
public IEnumerable<int> FailDownloads { get; set; }
|
||||
|
||||
[FieldDefinition(6, Type = FieldType.Select, SelectOptions = typeof(IndexerFlags), Label = "IndexerSettingsRequiredFlags", HelpText = "IndexerSettingsRequiredFlagsHelpText", HelpLink = "https://wiki.servarr.com/radarr/settings#indexer-flags", Advanced = true)]
|
||||
public IEnumerable<int> RequiredFlags { get; set; }
|
||||
|
||||
public NzbDroneValidationResult Validate()
|
||||
|
||||
@@ -58,6 +58,7 @@ namespace NzbDrone.Core.Indexers.Newznab
|
||||
ApiPath = "/api";
|
||||
Categories = new[] { 2000, 2010, 2020, 2030, 2040, 2045, 2050, 2060 };
|
||||
MultiLanguages = Array.Empty<int>();
|
||||
FailDownloads = Array.Empty<int>();
|
||||
}
|
||||
|
||||
[FieldDefinition(0, Label = "URL")]
|
||||
@@ -79,7 +80,10 @@ namespace NzbDrone.Core.Indexers.Newznab
|
||||
[FieldDefinition(5, Type = FieldType.Select, SelectOptions = typeof(RealLanguageFieldConverter), Label = "IndexerSettingsMultiLanguageRelease", HelpText = "IndexerSettingsMultiLanguageReleaseHelpText", Advanced = true)]
|
||||
public IEnumerable<int> MultiLanguages { get; set; }
|
||||
|
||||
[FieldDefinition(6, Type = FieldType.Checkbox, Label = "IndexerSettingsRemoveYear", HelpText = "IndexerSettingsRemoveYearHelpText", Advanced = true)]
|
||||
[FieldDefinition(6, Type = FieldType.Select, SelectOptions = typeof(FailDownloads), Label = "IndexerSettingsFailDownloads", HelpText = "IndexerSettingsFailDownloadsHelpText", Advanced = true)]
|
||||
public IEnumerable<int> FailDownloads { get; set; }
|
||||
|
||||
[FieldDefinition(7, Type = FieldType.Checkbox, Label = "IndexerSettingsRemoveYear", HelpText = "IndexerSettingsRemoveYearHelpText", Advanced = true)]
|
||||
public bool RemoveYear { get; set; }
|
||||
|
||||
// Field 8 is used by TorznabSettings MinimumSeeders
|
||||
|
||||
@@ -31,6 +31,7 @@ namespace NzbDrone.Core.Indexers.Nyaa
|
||||
AdditionalParameters = "&cats=1_0&filter=1";
|
||||
MinimumSeeders = IndexerDefaults.MINIMUM_SEEDERS;
|
||||
MultiLanguages = Array.Empty<int>();
|
||||
FailDownloads = Array.Empty<int>();
|
||||
RequiredFlags = Array.Empty<int>();
|
||||
}
|
||||
|
||||
@@ -52,7 +53,10 @@ namespace NzbDrone.Core.Indexers.Nyaa
|
||||
[FieldDefinition(5, Type = FieldType.Select, SelectOptions = typeof(RealLanguageFieldConverter), Label = "IndexerSettingsMultiLanguageRelease", HelpText = "IndexerSettingsMultiLanguageReleaseHelpText", Advanced = true)]
|
||||
public IEnumerable<int> MultiLanguages { get; set; }
|
||||
|
||||
[FieldDefinition(6, Type = FieldType.Select, SelectOptions = typeof(IndexerFlags), Label = "IndexerSettingsRequiredFlags", HelpText = "IndexerSettingsRequiredFlagsHelpText", HelpLink = "https://wiki.servarr.com/radarr/settings#indexer-flags", Advanced = true)]
|
||||
[FieldDefinition(6, Type = FieldType.Select, SelectOptions = typeof(FailDownloads), Label = "IndexerSettingsFailDownloads", HelpText = "IndexerSettingsFailDownloadsHelpText", Advanced = true)]
|
||||
public IEnumerable<int> FailDownloads { get; set; }
|
||||
|
||||
[FieldDefinition(7, Type = FieldType.Select, SelectOptions = typeof(IndexerFlags), Label = "IndexerSettingsRequiredFlags", HelpText = "IndexerSettingsRequiredFlagsHelpText", HelpLink = "https://wiki.servarr.com/radarr/settings#indexer-flags", Advanced = true)]
|
||||
public IEnumerable<int> RequiredFlags { get; set; }
|
||||
|
||||
public NzbDroneValidationResult Validate()
|
||||
|
||||
@@ -30,6 +30,7 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn
|
||||
BaseUrl = "https://passthepopcorn.me";
|
||||
MinimumSeeders = IndexerDefaults.MINIMUM_SEEDERS;
|
||||
MultiLanguages = Array.Empty<int>();
|
||||
FailDownloads = Array.Empty<int>();
|
||||
RequiredFlags = Array.Empty<int>();
|
||||
}
|
||||
|
||||
@@ -54,7 +55,10 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn
|
||||
[FieldDefinition(6, Type = FieldType.Select, SelectOptions = typeof(RealLanguageFieldConverter), Label = "IndexerSettingsMultiLanguageRelease", HelpText = "IndexerSettingsMultiLanguageReleaseHelpText", Advanced = true)]
|
||||
public IEnumerable<int> MultiLanguages { get; set; }
|
||||
|
||||
[FieldDefinition(7, Type = FieldType.Select, SelectOptions = typeof(IndexerFlags), Label = "IndexerSettingsRequiredFlags", HelpText = "IndexerSettingsRequiredFlagsHelpText", HelpLink = "https://wiki.servarr.com/radarr/settings#indexer-flags", Advanced = true)]
|
||||
[FieldDefinition(7, Type = FieldType.Select, SelectOptions = typeof(FailDownloads), Label = "IndexerSettingsFailDownloads", HelpText = "IndexerSettingsFailDownloadsHelpText", Advanced = true)]
|
||||
public IEnumerable<int> FailDownloads { get; set; }
|
||||
|
||||
[FieldDefinition(8, Type = FieldType.Select, SelectOptions = typeof(IndexerFlags), Label = "IndexerSettingsRequiredFlags", HelpText = "IndexerSettingsRequiredFlagsHelpText", HelpLink = "https://wiki.servarr.com/radarr/settings#indexer-flags", Advanced = true)]
|
||||
public IEnumerable<int> RequiredFlags { get; set; }
|
||||
|
||||
public NzbDroneValidationResult Validate()
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
using System;
|
||||
using NzbDrone.Common.Cache;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.Download.Clients;
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.ThingiProvider.Events;
|
||||
|
||||
namespace NzbDrone.Core.Indexers
|
||||
{
|
||||
@@ -14,15 +10,13 @@ namespace NzbDrone.Core.Indexers
|
||||
TorrentSeedConfiguration GetSeedConfiguration(int indexerId);
|
||||
}
|
||||
|
||||
public class SeedConfigProvider : ISeedConfigProvider, IHandle<ProviderUpdatedEvent<IIndexer>>
|
||||
public class SeedConfigProvider : ISeedConfigProvider
|
||||
{
|
||||
private readonly IIndexerFactory _indexerFactory;
|
||||
private readonly ICached<SeedCriteriaSettings> _cache;
|
||||
private readonly ICachedIndexerSettingsProvider _cachedIndexerSettingsProvider;
|
||||
|
||||
public SeedConfigProvider(IIndexerFactory indexerFactory, ICacheManager cacheManager)
|
||||
public SeedConfigProvider(ICachedIndexerSettingsProvider cachedIndexerSettingsProvider)
|
||||
{
|
||||
_indexerFactory = indexerFactory;
|
||||
_cache = cacheManager.GetRollingCache<SeedCriteriaSettings>(GetType(), "criteriaByIndexer", TimeSpan.FromHours(1));
|
||||
_cachedIndexerSettingsProvider = cachedIndexerSettingsProvider;
|
||||
}
|
||||
|
||||
public TorrentSeedConfiguration GetSeedConfiguration(RemoteMovie remoteMovie)
|
||||
@@ -47,7 +41,8 @@ namespace NzbDrone.Core.Indexers
|
||||
return null;
|
||||
}
|
||||
|
||||
var seedCriteria = _cache.Get(indexerId.ToString(), () => FetchSeedCriteria(indexerId));
|
||||
var settings = _cachedIndexerSettingsProvider.GetSettings(indexerId);
|
||||
var seedCriteria = settings?.SeedCriteriaSettings;
|
||||
|
||||
if (seedCriteria == null)
|
||||
{
|
||||
@@ -68,25 +63,5 @@ namespace NzbDrone.Core.Indexers
|
||||
|
||||
return seedConfig;
|
||||
}
|
||||
|
||||
private SeedCriteriaSettings FetchSeedCriteria(int indexerId)
|
||||
{
|
||||
try
|
||||
{
|
||||
var indexer = _indexerFactory.Get(indexerId);
|
||||
var torrentIndexerSettings = indexer.Settings as ITorrentIndexerSettings;
|
||||
|
||||
return torrentIndexerSettings?.SeedCriteria;
|
||||
}
|
||||
catch (ModelNotFoundException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void Handle(ProviderUpdatedEvent<IIndexer> message)
|
||||
{
|
||||
_cache.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ namespace NzbDrone.Core.Indexers.TorrentPotato
|
||||
BaseUrl = "http://127.0.0.1";
|
||||
MinimumSeeders = IndexerDefaults.MINIMUM_SEEDERS;
|
||||
MultiLanguages = Array.Empty<int>();
|
||||
FailDownloads = Array.Empty<int>();
|
||||
RequiredFlags = Array.Empty<int>();
|
||||
}
|
||||
|
||||
@@ -52,7 +53,10 @@ namespace NzbDrone.Core.Indexers.TorrentPotato
|
||||
[FieldDefinition(6, Type = FieldType.Select, SelectOptions = typeof(RealLanguageFieldConverter), Label = "IndexerSettingsMultiLanguageRelease", HelpText = "IndexerSettingsMultiLanguageReleaseHelpText", Advanced = true)]
|
||||
public IEnumerable<int> MultiLanguages { get; set; }
|
||||
|
||||
[FieldDefinition(7, Type = FieldType.Select, SelectOptions = typeof(IndexerFlags), Label = "IndexerSettingsRequiredFlags", HelpText = "IndexerSettingsRequiredFlagsHelpText", HelpLink = "https://wiki.servarr.com/radarr/settings#indexer-flags", Advanced = true)]
|
||||
[FieldDefinition(7, Type = FieldType.Select, SelectOptions = typeof(FailDownloads), Label = "IndexerSettingsFailDownloads", HelpText = "IndexerSettingsFailDownloadsHelpText", Advanced = true)]
|
||||
public IEnumerable<int> FailDownloads { get; set; }
|
||||
|
||||
[FieldDefinition(8, Type = FieldType.Select, SelectOptions = typeof(IndexerFlags), Label = "IndexerSettingsRequiredFlags", HelpText = "IndexerSettingsRequiredFlagsHelpText", HelpLink = "https://wiki.servarr.com/radarr/settings#indexer-flags", Advanced = true)]
|
||||
public IEnumerable<int> RequiredFlags { get; set; }
|
||||
|
||||
public NzbDroneValidationResult Validate()
|
||||
|
||||
@@ -29,6 +29,7 @@ namespace NzbDrone.Core.Indexers.TorrentRss
|
||||
AllowZeroSize = false;
|
||||
MinimumSeeders = IndexerDefaults.MINIMUM_SEEDERS;
|
||||
MultiLanguages = Array.Empty<int>();
|
||||
FailDownloads = Array.Empty<int>();
|
||||
RequiredFlags = Array.Empty<int>();
|
||||
}
|
||||
|
||||
@@ -53,7 +54,10 @@ namespace NzbDrone.Core.Indexers.TorrentRss
|
||||
[FieldDefinition(6, Type = FieldType.Select, SelectOptions = typeof(RealLanguageFieldConverter), Label = "IndexerSettingsMultiLanguageRelease", HelpText = "IndexerSettingsMultiLanguageReleaseHelpText", Advanced = true)]
|
||||
public IEnumerable<int> MultiLanguages { get; set; }
|
||||
|
||||
[FieldDefinition(7, Type = FieldType.Select, SelectOptions = typeof(IndexerFlags), Label = "IndexerSettingsRequiredFlags", HelpText = "IndexerSettingsRequiredFlagsHelpText", HelpLink = "https://wiki.servarr.com/radarr/settings#indexer-flags", Advanced = true)]
|
||||
[FieldDefinition(7, Type = FieldType.Select, SelectOptions = typeof(FailDownloads), Label = "IndexerSettingsFailDownloads", HelpText = "IndexerSettingsFailDownloadsHelpText", Advanced = true)]
|
||||
public IEnumerable<int> FailDownloads { get; set; }
|
||||
|
||||
[FieldDefinition(8, Type = FieldType.Select, SelectOptions = typeof(IndexerFlags), Label = "IndexerSettingsRequiredFlags", HelpText = "IndexerSettingsRequiredFlagsHelpText", HelpLink = "https://wiki.servarr.com/radarr/settings#indexer-flags", Advanced = true)]
|
||||
public IEnumerable<int> RequiredFlags { get; set; }
|
||||
|
||||
public NzbDroneValidationResult Validate()
|
||||
|
||||
@@ -55,16 +55,16 @@ namespace NzbDrone.Core.Indexers.Torznab
|
||||
RequiredFlags = Array.Empty<int>();
|
||||
}
|
||||
|
||||
[FieldDefinition(8, Type = FieldType.Number, Label = "IndexerSettingsMinimumSeeders", HelpText = "IndexerSettingsMinimumSeedersHelpText", Advanced = true)]
|
||||
[FieldDefinition(9, Type = FieldType.Number, Label = "IndexerSettingsMinimumSeeders", HelpText = "IndexerSettingsMinimumSeedersHelpText", Advanced = true)]
|
||||
public int MinimumSeeders { get; set; }
|
||||
|
||||
[FieldDefinition(9)]
|
||||
[FieldDefinition(10)]
|
||||
public SeedCriteriaSettings SeedCriteria { get; set; } = new ();
|
||||
|
||||
[FieldDefinition(10, Type = FieldType.Checkbox, Label = "IndexerSettingsRejectBlocklistedTorrentHashes", HelpText = "IndexerSettingsRejectBlocklistedTorrentHashesHelpText", Advanced = true)]
|
||||
[FieldDefinition(11, Type = FieldType.Checkbox, Label = "IndexerSettingsRejectBlocklistedTorrentHashes", HelpText = "IndexerSettingsRejectBlocklistedTorrentHashesHelpText", Advanced = true)]
|
||||
public bool RejectBlocklistedTorrentHashesWhileGrabbing { get; set; }
|
||||
|
||||
[FieldDefinition(11, Type = FieldType.Select, SelectOptions = typeof(IndexerFlags), Label = "IndexerSettingsRequiredFlags", HelpText = "IndexerSettingsRequiredFlagsHelpText", HelpLink = "https://wiki.servarr.com/radarr/settings#indexer-flags", Advanced = true)]
|
||||
[FieldDefinition(12, Type = FieldType.Select, SelectOptions = typeof(IndexerFlags), Label = "IndexerSettingsRequiredFlags", HelpText = "IndexerSettingsRequiredFlagsHelpText", HelpLink = "https://wiki.servarr.com/radarr/settings#indexer-flags", Advanced = true)]
|
||||
public IEnumerable<int> RequiredFlags { get; set; }
|
||||
|
||||
public override NzbDroneValidationResult Validate()
|
||||
|
||||
@@ -666,6 +666,7 @@
|
||||
"FileManagement": "File Management",
|
||||
"FileNameTokens": "File Name Tokens",
|
||||
"FileNames": "File Names",
|
||||
"FileSize": "File Size",
|
||||
"Filename": "Filename",
|
||||
"Files": "Files",
|
||||
"Filter": "Filter",
|
||||
@@ -889,6 +890,8 @@
|
||||
"IndexerSettingsCategories": "Categories",
|
||||
"IndexerSettingsCookie": "Cookie",
|
||||
"IndexerSettingsCookieHelpText": "If your site requires a login cookie to access the RSS, you'll have to retrieve it via a browser.",
|
||||
"IndexerSettingsFailDownloads": "Fail Downloads",
|
||||
"IndexerSettingsFailDownloadsHelpText": "While processing completed downloads {appName} will treat selected errors preventing importing as failed downloads.",
|
||||
"IndexerSettingsMinimumSeeders": "Minimum Seeders",
|
||||
"IndexerSettingsMinimumSeedersHelpText": "Minimum number of seeders required.",
|
||||
"IndexerSettingsMultiLanguageRelease": "Multi Languages",
|
||||
|
||||
@@ -277,6 +277,26 @@ namespace NzbDrone.Core.MediaFiles
|
||||
|
||||
var extension = Path.GetExtension(fileInfo.Name);
|
||||
|
||||
if (FileExtensions.DangerousExtensions.Contains(extension))
|
||||
{
|
||||
return new List<ImportResult>
|
||||
{
|
||||
new ImportResult(new ImportDecision(new LocalMovie { Path = fileInfo.FullName },
|
||||
new ImportRejection(ImportRejectionReason.DangerousFile, $"Caution: Found potentially dangerous file with extension: {extension}")),
|
||||
$"Caution: Found potentially dangerous file with extension: {extension}")
|
||||
};
|
||||
}
|
||||
|
||||
if (FileExtensions.ExecutableExtensions.Contains(extension))
|
||||
{
|
||||
return new List<ImportResult>
|
||||
{
|
||||
new ImportResult(new ImportDecision(new LocalMovie { Path = fileInfo.FullName },
|
||||
new ImportRejection(ImportRejectionReason.ExecutableFile, $"Caution: Found executable file with extension: '{extension}'")),
|
||||
$"Caution: Found executable file with extension: '{extension}'")
|
||||
};
|
||||
}
|
||||
|
||||
if (extension.IsNullOrWhiteSpace() || !MediaFileExtensions.Extensions.Contains(extension))
|
||||
{
|
||||
_logger.Debug("[{0}] has an unsupported extension: '{1}'", fileInfo.FullName, extension);
|
||||
@@ -335,6 +355,11 @@ namespace NzbDrone.Core.MediaFiles
|
||||
{
|
||||
var files = _diskProvider.GetFiles(folder, true);
|
||||
|
||||
if (files.Any(file => FileExtensions.DangerousExtensions.Contains(Path.GetExtension(file))))
|
||||
{
|
||||
return RejectionResult(ImportRejectionReason.DangerousFile, "Caution: Found potentially dangerous file");
|
||||
}
|
||||
|
||||
if (files.Any(file => FileExtensions.ExecutableExtensions.Contains(Path.GetExtension(file))))
|
||||
{
|
||||
return RejectionResult(ImportRejectionReason.ExecutableFile, "Caution: Found executable file");
|
||||
|
||||
@@ -20,6 +20,7 @@ namespace NzbDrone.Core.MediaFiles.Events
|
||||
ImportedMovie = importedMovie;
|
||||
OldFiles = oldFiles;
|
||||
NewDownload = newDownload;
|
||||
|
||||
if (downloadClientItem != null)
|
||||
{
|
||||
DownloadClientInfo = downloadClientItem.DownloadClientInfo;
|
||||
|
||||
@@ -18,19 +18,30 @@ namespace NzbDrone.Core.MediaFiles
|
||||
".tb2",
|
||||
".tbz2",
|
||||
".tgz",
|
||||
".zip",
|
||||
".zip"
|
||||
};
|
||||
|
||||
private static List<string> _dangerousExtensions = new List<string>
|
||||
{
|
||||
".arj",
|
||||
".lnk",
|
||||
".lzh",
|
||||
".ps1",
|
||||
".scr",
|
||||
".vbs",
|
||||
".zipx"
|
||||
};
|
||||
|
||||
private static List<string> _executableExtensions = new List<string>
|
||||
{
|
||||
".exe",
|
||||
".bat",
|
||||
".cmd",
|
||||
".exe",
|
||||
".sh"
|
||||
};
|
||||
|
||||
public static HashSet<string> ArchiveExtensions => new HashSet<string>(_archiveExtensions, StringComparer.OrdinalIgnoreCase);
|
||||
public static HashSet<string> DangerousExtensions => new HashSet<string>(_dangerousExtensions, StringComparer.OrdinalIgnoreCase);
|
||||
public static HashSet<string> ExecutableExtensions => new HashSet<string>(_executableExtensions, StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ public enum ImportRejectionReason
|
||||
Unknown,
|
||||
FileLocked,
|
||||
UnknownMovie,
|
||||
DangerousFile,
|
||||
ExecutableFile,
|
||||
ArchiveFile,
|
||||
MovieFolder,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using FluentValidation;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.SignalR;
|
||||
using Radarr.Http;
|
||||
@@ -13,6 +14,7 @@ namespace Radarr.Api.V3.DownloadClient
|
||||
public DownloadClientController(IBroadcastSignalRMessage signalRBroadcaster, IDownloadClientFactory downloadClientFactory)
|
||||
: base(signalRBroadcaster, downloadClientFactory, "downloadclient", ResourceMapper, BulkResourceMapper)
|
||||
{
|
||||
SharedValidator.RuleFor(c => c.Priority).InclusiveBetween(1, 50);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using FluentValidation;
|
||||
using NzbDrone.Core.Indexers;
|
||||
using NzbDrone.Core.Validation;
|
||||
using NzbDrone.SignalR;
|
||||
@@ -16,6 +17,7 @@ namespace Radarr.Api.V3.Indexers
|
||||
DownloadClientExistsValidator downloadClientExistsValidator)
|
||||
: base(signalRBroadcaster, indexerFactory, "indexer", ResourceMapper, BulkResourceMapper)
|
||||
{
|
||||
SharedValidator.RuleFor(c => c.Priority).InclusiveBetween(1, 50);
|
||||
SharedValidator.RuleFor(c => c.DownloadClientId).SetValidator(downloadClientExistsValidator);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Radarr.Api.V3.ManualImport
|
||||
[Produces("application/json")]
|
||||
public List<ManualImportResource> GetMediaFiles(string folder, string downloadId, int? movieId, bool filterExistingFiles = true)
|
||||
{
|
||||
if (movieId.HasValue)
|
||||
if (movieId.HasValue && downloadId.IsNullOrWhiteSpace())
|
||||
{
|
||||
return _manualImportService.GetMediaFiles(movieId.Value).ToResource().Select(AddQualityWeight).ToList();
|
||||
}
|
||||
|
||||
@@ -5,14 +5,12 @@ using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using FluentValidation;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using NLog;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Datastore.Events;
|
||||
using NzbDrone.Core.DecisionEngine.Specifications;
|
||||
using NzbDrone.Core.Languages;
|
||||
using NzbDrone.Core.MediaCover;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.MediaFiles.Events;
|
||||
using NzbDrone.Core.Messaging.Commands;
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
@@ -33,8 +31,6 @@ namespace Radarr.Api.V3.Movies
|
||||
{
|
||||
[V3ApiController]
|
||||
public class MovieController : RestControllerWithSignalR<MovieResource, Movie>,
|
||||
IHandle<MovieFileImportedEvent>,
|
||||
IHandle<MovieFileDeletedEvent>,
|
||||
IHandle<MovieUpdatedEvent>,
|
||||
IHandle<MovieEditedEvent>,
|
||||
IHandle<MoviesDeletedEvent>,
|
||||
@@ -51,7 +47,6 @@ namespace Radarr.Api.V3.Movies
|
||||
private readonly IRootFolderService _rootFolderService;
|
||||
private readonly IUpgradableSpecification _qualityUpgradableSpecification;
|
||||
private readonly IConfigService _configService;
|
||||
private readonly Logger _logger;
|
||||
|
||||
public MovieController(IBroadcastSignalRMessage signalRBroadcaster,
|
||||
IMovieService moviesService,
|
||||
@@ -72,8 +67,7 @@ namespace Radarr.Api.V3.Movies
|
||||
SystemFolderValidator systemFolderValidator,
|
||||
QualityProfileExistsValidator qualityProfileExistsValidator,
|
||||
RootFolderExistsValidator rootFolderExistsValidator,
|
||||
MovieFolderAsRootFolderValidator movieFolderAsRootFolderValidator,
|
||||
Logger logger)
|
||||
MovieFolderAsRootFolderValidator movieFolderAsRootFolderValidator)
|
||||
: base(signalRBroadcaster)
|
||||
{
|
||||
_moviesService = moviesService;
|
||||
@@ -85,7 +79,6 @@ namespace Radarr.Api.V3.Movies
|
||||
_coverMapper = coverMapper;
|
||||
_commandQueueManager = commandQueueManager;
|
||||
_rootFolderService = rootFolderService;
|
||||
_logger = logger;
|
||||
|
||||
SharedValidator.RuleFor(s => s.Path).Cascade(CascadeMode.Stop)
|
||||
.IsValidPath()
|
||||
@@ -327,23 +320,6 @@ namespace Radarr.Api.V3.Movies
|
||||
resource.SizeOnDisk = movieStatistics.SizeOnDisk;
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
public void Handle(MovieFileImportedEvent message)
|
||||
{
|
||||
BroadcastResourceChange(ModelAction.Updated, message.MovieInfo.Movie.Id);
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
public void Handle(MovieFileDeletedEvent message)
|
||||
{
|
||||
if (message.Reason == DeleteMediaFileReason.Upgrade)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
BroadcastResourceChange(ModelAction.Updated, message.MovieFile.MovieId);
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
public void Handle(MovieUpdatedEvent message)
|
||||
{
|
||||
|
||||
@@ -153,7 +153,7 @@ namespace Radarr.Api.V3.Movies
|
||||
[NonAction]
|
||||
public void Handle(MovieFileImportedEvent message)
|
||||
{
|
||||
BroadcastResourceChange(ModelAction.Updated, message.MovieInfo.Movie.Id);
|
||||
BroadcastResourceChange(ModelAction.Updated, message.ImportedMovie.Movie.Id);
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
|
||||
@@ -2254,9 +2254,9 @@ camelcase@^5.3.1:
|
||||
integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==
|
||||
|
||||
caniuse-lite@^1.0.30001646, caniuse-lite@^1.0.30001663:
|
||||
version "1.0.30001667"
|
||||
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001667.tgz#99fc5ea0d9c6e96897a104a8352604378377f949"
|
||||
integrity sha512-7LTwJjcRkzKFmtqGsibMeuXmvFDfZq/nzIjnmgCGzKKRVzjD72selLDK1oPF/Oxzmt4fNcPvTDvGqSDG4tCALw==
|
||||
version "1.0.30001707"
|
||||
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001707.tgz"
|
||||
integrity sha512-3qtRjw/HQSMlDWf+X79N206fepf4SOOU6SQLMaq/0KkZLmSjPxAkBOQQ+FxbHKfHmYLZFfdWsO3KA90ceHPSnw==
|
||||
|
||||
chalk@^2.4.1, chalk@^2.4.2:
|
||||
version "2.4.2"
|
||||
|
||||
Reference in New Issue
Block a user