1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-03-05 13:21:25 -05:00

Compare commits

..

29 Commits

Author SHA1 Message Date
Bogdan
ef9836d71d Fixed: Movie status on Wanted pages
(cherry picked from commit c9c8d4ad400f9e7066063236da180cf85ff63031)
2025-10-25 12:51:40 -05:00
Bogdan
955ee2f29b Switch to FluentMigrator.Runner.Core to avoid extranous platform runners
(cherry picked from commit f93100d9fd1deb2982dbd154dd05032b17099774)
2025-10-25 12:51:40 -05:00
Bogdan
abf3fc4557 Remove redundant code in selecting with click on poster
(cherry picked from commit b116f63a1d95a23a6f3684e6b60ead60c2584f0f)
2025-10-25 12:51:40 -05:00
bakerboy448
1e72cc6b5a Bump to 6.0.3 2025-10-05 18:37:06 -05:00
Bogdan
24639a7016 Pin System.Drawing.Common to 8.0.20
(cherry picked from commit b9a79c4225b85230b4fdec702621c7b0f41c6ae1)
2025-10-05 18:36:38 -05:00
bakerboy448
e52547fa37 chore: sync CONTRIBUTING.md from Servarr/wiki (#11207)
[skip-ci]
2025-10-04 15:23:05 -05:00
bakerboy448
ff6a69701f Bump to 6.0.2 2025-09-28 21:57:01 -05:00
Collin Heist
f6afbfa684 Fixed: Prevent modals from overflowing screen width
(cherry picked from commit 6c581b7e3c5c74db350d7ba2aad04f2df77c7671)
2025-09-28 21:57:01 -05:00
Stevie Robinson
b1b33e0dbf New: Switch theme automatically on system change
(cherry picked from commit 4904e85887b8455483e509b83abaa2c6517d45a0)
2025-09-28 21:57:01 -05:00
Bogdan
cf465899b4 New: Retry SQLite writes for database is locked errors
(cherry picked from commit 2e1289b9248a70ce50bde52a66d3a589f3dcb8f5)
2025-09-28 21:57:01 -05:00
Mark McDowall
e63691935d Upgrade MonoTorrent to 3.0.2
(cherry picked from commit b0224c1c5cf00c8959c67d9e61f3e932800060c4)
2025-09-28 21:57:01 -05:00
Bogdan
1bae9499e4 Bump System.Data.SQLite to official 2.0.2
(cherry picked from commit 89ed33e1ac10a8b50082e47c604501a848ece3ea)
2025-09-28 21:57:01 -05:00
Bogdan
c991a8927d Bump FluentMigrator to official 6.2.0
(cherry picked from commit 82299cfc04732371e6709612cdb7d8d4eaf6ead3)
2025-09-28 21:57:01 -05:00
Bogdan
3c75250c08 Bump postcss to 8.5.6
(cherry picked from commit f84650b6c04f01fd498f50403c83a2103cb75140)
2025-09-28 21:57:01 -05:00
Bogdan
1e06fc5b43 Switch HttpProxySettingsProviderFixture to test cases
(cherry picked from commit 4e8fe6e81b1ac3f53135ad2e2b95d7aae811b87e)
2025-09-28 21:57:01 -05:00
Bogdan
52307038af Bump Moq to 4.18.4
(cherry picked from commit 90bb9b513cb1ac874bfa9a0a7b12b7fa7b8ede5a)
2025-09-28 21:57:01 -05:00
Bogdan
0297dba7f9 Attempt to remove pid file only if config folder exists
(cherry picked from commit df4a56662f6870a194179ffc29c98dc64af9e07c)
2025-09-28 21:57:01 -05:00
Bogdan
554a54b009 Improve error tracing in migrate app data folder
(cherry picked from commit 5ef6145db350df36507b3efaf1f8f412c1a13779)
2025-09-28 21:57:01 -05:00
nuxen
64b2a10b3f Fixed: RlsGrp parser exeption for 126811 2025-09-27 19:39:59 -05:00
Bogdan
97c226c23c Fix code coverage on CI
Signed-off-by: bakerboy448 <55419169+bakerboy448@users.noreply.github.com>
2025-09-26 12:40:19 -05:00
Bogdan
9959c658be Avoid rewriting file names in builds
Signed-off-by: bakerboy448 <55419169+bakerboy448@users.noreply.github.com>
2025-09-26 12:40:19 -05:00
Bogdan
eaeb668eb5 Bump coverlet.collector to official 6.0.4
Signed-off-by: bakerboy448 <55419169+bakerboy448@users.noreply.github.com>
2025-09-26 12:40:19 -05:00
bakerboy448
bb6713f1d2 Fixed: Improve IMDb list logging 2025-09-23 17:59:37 -05:00
bakerboy448
9906b95893 New: Prioritize Exact Exception Release Group Matches over non-Exact Exception Groups 2025-09-23 17:47:36 -05:00
bakerboy448
8c94581cb6 Fixed: Treat TAoE and QxR as release groups
(cherry picked from commit b00229e53c7a4bcb8684fd0aa4f66650c64a9a20)

Co-Authored-By: Mark McDowall <mark@mcdowall.ca>
2025-09-23 17:47:36 -05:00
bakerboy448
6bdbc9c600 align parsing with upstream
Separate release group parsing logic into dedicated classes and update references throughout codebase.

(cherry picked from commit b00229e53c7a4bcb8684fd0aa4f66650c64a9a20)

Co-Authored-By: Mark McDowall <mark@mcdowall.ca>
2025-09-23 17:47:36 -05:00
Erik Frantz
f28691e48d New: Add MovieCollectionThe Naming Token (#11145) 2025-09-23 16:39:25 -05:00
Weblate
e7bddaeedd Multiple Translations updated by Weblate
ignore-downstream

Co-authored-by: Jeremi Florczyk <j.m.florczyk@gmail.com>
Co-authored-by: Storm <storm47rus@gmail.com>
Co-authored-by: Weblate <noreply@weblate.org>
Translate-URL: https://translate.servarr.com/projects/servarr/radarr/pl/
Translate-URL: https://translate.servarr.com/projects/servarr/radarr/ru/
Translation: Servarr/Radarr
2025-09-23 08:04:14 -05:00
bakerboy448
94ced8cff9 Bump to 6.0.1 2025-09-21 14:54:50 -05:00
49 changed files with 922 additions and 307 deletions

View File

@@ -1,13 +1,186 @@
# How to Contribute
We're always looking for people to help make Radarr even better, there are a number of ways to contribute.
This file has been moved to the wiki for the latest details please see the [contributing wiki page](https://wiki.servarr.com/radarr/contributing).
# Documentation
## Documentation
Setup guides, [FAQ](/radarr/faq), the more information we have on the [wiki](https://wiki.servarr.com/radarr) the better.
Setup guides, [FAQ](https://wiki.servarr.com/radarr/faq), the more information we have on the [wiki](https://wiki.servarr.com/radarr) the better.
# Development
## Development
Radarr is written in C# (backend) and JS (frontend). The backend is built on the .NET6 (and _soon_ .NET8) framework, while the frontend utilizes Reactjs.
See the [Wiki Page](https://wiki.servarr.com/radarr/contributing)
## Tools required
- Visual Studio 2022 or higher is recommended (<https://www.visualstudio.com/vs/>). The community version is free and works (<https://www.visualstudio.com/downloads/>).
> VS 2022 V17.0 or higher is recommended as it includes the .NET6 SDK
{.is-info}
- HTML/Javascript editor of choice (VS Code/Sublime Text/Webstorm/Atom/etc)
- [Git](https://git-scm.com/downloads)
- The [Node.js](https://nodejs.org/) runtime is required. The following versions are supported:
- **20** (any minor or patch version within this)
{.grid-list}
> The Application will **NOT** run on older versions such as `18.x`, `16.x` or any version below 20.0! Due to a dependency issue, it will also not run on `21.x` and is untested on other verisons.
{.is-warning}
- [Yarn](https://yarnpkg.com/getting-started/install) is required to build the frontend
- Yarn is included with **Node 20**+ by default. Enable it with `corepack enable`
- For other Node versions, install it with `npm i -g corepack`
## Getting started
1. Fork Radarr
1. Clone the repository into your development machine. [*info*](https://docs.github.com/en/get-started/quickstart/fork-a-repo)
> Be sure to run lint `yarn lint --fix` on your code for any front end changes before committing.
For css changes `yarn stylelint-windows --fix` {.is-info}
### Building the frontend
- Navigate to the cloned directory
- Install the required Node Packages
```bash
yarn install
```
- Start webpack to monitor your development environment for any changes that need post processing using:
```bash
yarn start
```
### Building the Backend
The backend solution is most easily built and ran in Visual Studio or Rider, however if the only priority is working on the frontend UI it can be built easily from command line as well when the correct SDK is installed.
#### Visual Studio
> Ensure startup project is set to `Radarr.Console` and framework to `net6.0`
{.is-info}
1. First `Build` the solution in Visual Studio, this will ensure all projects are correctly built and dependencies restored
1. Next `Debug/Run` the project in Visual Studio to start Radarr
1. Open <http://localhost:7878>
#### Command line
1. Clean solution
```shell
dotnet clean src/Radarr.sln -c Debug
```
1. Restore and Build debug configuration for the correct platform (Posix or Windows)
```shell
dotnet msbuild -restore src/Radarr.sln -p:Configuration=Debug -p:Platform=Posix -t:PublishAllRids
```
1. Run the produced executable from `/_output`
## Contributing Code
- If you're adding a new, already requested feature, please comment on [GitHub Issues](https://github.com/Radarr/Radarr/issues) so work is not duplicated (If you want to add something not already on there, please talk to us first)
- Rebase from Radarr's develop branch, do not merge
- Make meaningful commits, or squash them
- Feel free to make a pull request before work is complete, this will let us see where its at and make comments/suggest improvements
- Reach out to us on the discord if you have any questions
- Add tests (unit/integration)
- Commit with \*nix line endings for consistency (We checkout Windows and commit \*nix)
- One feature/bug fix per pull request to keep things clean and easy to understand
- Use 4 spaces instead of tabs, this is the default for VS 2022 and WebStorm
## Pull Requesting
- Only make pull requests to `develop`, never `master`, if you make a PR to `master` we will comment on it and close it
- You're probably going to get some comments or questions from us, they will be to ensure consistency and maintainability
- We'll try to respond to pull requests as soon as possible, if its been a day or two, please reach out to us, we may have missed it
- Each PR should come from its own [feature branch](http://martinfowler.com/bliki/FeatureBranch.html) not develop in your fork, it should have a meaningful branch name (what is being added/fixed)
- `new-feature` (Good)
- `fix-bug` (Good)
- `patch` (Bad)
- `develop` (Bad)
- Commits should be wrote as `New:` or `Fixed:` for changes that would not be considered a `maintenance release`
## Unit Testing
Radarr utilizes nunit for its unit, integration, and automation test suite.
### Running Tests
Tests can be run easily from within VS using the included nunit3testadapter nuget package or from the command line using the included bash script `test.sh`.
From VS simply navigate to Test Explorer and run or debug the tests you'd like to examine.
Tests can be run all at once or one at a time in VS.
From command line the `test.sh` script accepts 3 parameters
```bash
test.sh <PLATFORM> <TYPE> <COVERAGE>
```
### Writing Tests
While not always fun, we encourage writing unit tests for any backend code changes. This will ensure the change is functioning as you intended and that future changes dont break the expected behavior.
> We currently require 80% coverage on new code when submitting a PR
{.is-info}
If you have any questions about any of this, please let us know.
# Translation
Radarr uses a self hosted open access [Weblate](https://translate.servarr.com) instance to manage its json translation files. These files are stored in the repo at `src/NzbDrone.Core/Localization`
## Contributing to an Existing Translation
Weblate handles synchronization and translation of strings for all languages other than English. Editing of translated strings and translating existing strings for supported languages should be performed there for the Radarr project.
The English translation, `en.json`, serves as the source for all other translations and is managed on GitHub repo.
## Adding a Language
Adding translations to Radarr requires two steps
- Adding the Language to weblate
- Adding the Language to Radarr codebase
## Adding Translation Strings in Code
The English translation, `src/NzbDrone.Core/Localization/en.json`, serves as the source for all other translations and is managed on GitHub repo. When adding a new string to either the UI or backend a key must also be added to `en.json` along with the default value in English. This key may then be consumed as follows:
> PRs for translation of log messages will not be accepted
{.is-warning}
### Backend Strings
Backend strings may be added utilizing the Localization Service `GetLocalizedString` method
```dotnet
private readonly ILocalizationService _localizationService;
public IndexerCheck(ILocalizationService localizationService)
{
_localizationService = localizationService;
}
var translated = _localizationService.GetLocalizedString("IndexerHealthCheckNoIndexers")
```
### Frontend Strings
New strings can be added to the frontend by importing the translate function and using a key specified from `en.json`
```js
import translate from 'Utilities/String/translate';
<div>
{translate('UnableToAddANewIndexerPleaseTryAgain')}
</div>
```

View File

@@ -9,7 +9,7 @@ variables:
testsFolder: './_tests'
yarnCacheFolder: $(Pipeline.Workspace)/.yarn
nugetCacheFolder: $(Pipeline.Workspace)/.nuget/packages
majorVersion: '6.0.0'
majorVersion: '6.0.3'
minorVersion: $[counter('minorVersion', 2000)]
radarrVersion: '$(majorVersion).$(minorVersion)'
buildName: '$(Build.SourceBranchName).$(radarrVersion)'
@@ -1194,7 +1194,7 @@ stages:
extraProperties: |
sonar.exclusions=**/obj/**,**/*.dll,**/NzbDrone.Core.Test/Files/**/*,./frontend/**,**/ExternalModules/**,./src/Libraries/**
sonar.coverage.exclusions=**/Radarr.Api.V3/**/*
sonar.cs.opencover.reportsPaths=$(Build.SourcesDirectory)/CoverageResults/**/coverage.opencover.xml
sonar.cs.cobertura.reportsPaths=$(Build.SourcesDirectory)/CoverageResults/**/coverage.cobertura.xml
sonar.cs.nunit.reportsPaths=$(Build.SourcesDirectory)/TestResult.xml
- bash: |
./build.sh --backend -f net8.0 -r win-x64
@@ -1206,10 +1206,11 @@ stages:
- task: reportgenerator@5
displayName: Generate Coverage Report
inputs:
reports: '$(Build.SourcesDirectory)/CoverageResults/**/coverage.opencover.xml'
reports: '$(Build.SourcesDirectory)/CoverageResults/**/coverage.cobertura.xml'
targetdir: '$(Build.SourcesDirectory)/CoverageResults/combined'
reporttypes: 'HtmlInline_AzurePipelines;Cobertura;Badges'
publishCodeCoverageResults: true
sourcedirs: src
- stage: Report_Out
dependsOn:

View File

@@ -19,6 +19,7 @@
.modal {
position: relative;
display: flex;
max-width: 90%;
max-height: 90%;
border-radius: 6px;
opacity: 1;

View File

@@ -0,0 +1,56 @@
import { useEffect, useState } from 'react';
import { useSelector } from 'react-redux';
import { createSelector } from 'reselect';
import AppState from 'App/State/AppState';
import themes from 'Styles/Themes';
function createThemeSelector() {
return createSelector(
(state: AppState) => state.settings.ui.item.theme || window.Radarr.theme,
(theme) => theme
);
}
const useTheme = () => {
const selectedTheme = useSelector(createThemeSelector());
const [resolvedTheme, setResolvedTheme] = useState(selectedTheme);
useEffect(() => {
if (selectedTheme !== 'auto') {
setResolvedTheme(selectedTheme);
return;
}
const applySystemTheme = () => {
setResolvedTheme(
window.matchMedia('(prefers-color-scheme: dark)').matches
? 'dark'
: 'light'
);
};
applySystemTheme();
window
.matchMedia('(prefers-color-scheme: dark)')
.addEventListener('change', applySystemTheme);
return () => {
window
.matchMedia('(prefers-color-scheme: dark)')
.removeEventListener('change', applySystemTheme);
};
}, [selectedTheme]);
return resolvedTheme;
};
export default useTheme;
export const useThemeColor = (color: string) => {
const theme = useTheme();
const themeVariables = themes[theme];
// @ts-expect-error - themeVariables is a string indexable type
return themeVariables[color];
};

View File

@@ -67,6 +67,7 @@ function MovieIndexOverview(props: MovieIndexOverviewProps) {
monitored,
status,
path,
titleSlug,
overview,
statistics = {} as Statistics,
images,
@@ -141,7 +142,9 @@ function MovieIndexOverview(props: MovieIndexOverviewProps) {
<div className={styles.content}>
<div className={styles.poster}>
<div className={styles.posterContainer}>
{isSelectMode ? <MovieIndexPosterSelect movieId={movieId} /> : null}
{isSelectMode ? (
<MovieIndexPosterSelect movieId={movieId} titleSlug={titleSlug} />
) : null}
{status === 'deleted' ? (
<div className={styles.deleted} title={translate('Deleted')} />

View File

@@ -1,6 +1,5 @@
import React, { SyntheticEvent, useCallback, useState } from 'react';
import React, { useCallback, useState } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { useSelect } from 'App/SelectContext';
import { MOVIE_SEARCH, REFRESH_MOVIE } from 'Commands/commandNames';
import Icon from 'Components/Icon';
import ImdbRating from 'Components/ImdbRating';
@@ -70,6 +69,7 @@ function MovieIndexPoster(props: MovieIndexPosterProps) {
monitored,
status,
images,
titleSlug,
tmdbId,
imdbId,
youTubeTrailerId,
@@ -142,30 +142,7 @@ function MovieIndexPoster(props: MovieIndexPosterProps) {
setIsDeleteMovieModalOpen(false);
}, [setIsDeleteMovieModalOpen]);
const [selectState, selectDispatch] = useSelect();
const onSelectPress = useCallback(
(event: SyntheticEvent<HTMLElement, MouseEvent>) => {
if (event.nativeEvent.ctrlKey || event.nativeEvent.metaKey) {
window.open(`/movie/${tmdbId}`, '_blank');
return;
}
const shiftKey = event.nativeEvent.shiftKey;
selectDispatch({
type: 'toggleSelected',
id: movieId,
isSelected: !selectState.selectedState[movieId],
shiftKey,
});
},
[movieId, selectState.selectedState, selectDispatch, tmdbId]
);
const link = `/movie/${tmdbId}`;
const linkProps = isSelectMode ? { onPress: onSelectPress } : { to: link };
const link = `/movie/${titleSlug}`;
const elementStyle = {
width: `${posterWidth}px`,
@@ -175,7 +152,9 @@ function MovieIndexPoster(props: MovieIndexPosterProps) {
return (
<div className={styles.content}>
<div className={styles.posterContainer} title={title}>
{isSelectMode ? <MovieIndexPosterSelect movieId={movieId} /> : null}
{isSelectMode ? (
<MovieIndexPosterSelect movieId={movieId} titleSlug={titleSlug} />
) : null}
<Label className={styles.controls}>
<SpinnerIconButton
@@ -220,7 +199,7 @@ function MovieIndexPoster(props: MovieIndexPosterProps) {
<div className={styles.deleted} title={translate('Deleted')} />
) : null}
<Link className={styles.link} style={elementStyle} {...linkProps}>
<Link className={styles.link} style={elementStyle} to={link}>
<MoviePoster
style={elementStyle}
images={images}

View File

@@ -3,8 +3,8 @@
top: 0;
left: 0;
z-index: 3;
width: 36px;
height: 36px;
width: 100%;
height: 100%;
}
.checkContainer {

View File

@@ -7,15 +7,23 @@ import styles from './MovieIndexPosterSelect.css';
interface MovieIndexPosterSelectProps {
movieId: number;
titleSlug: string;
}
function MovieIndexPosterSelect(props: MovieIndexPosterSelectProps) {
const { movieId } = props;
function MovieIndexPosterSelect({
movieId,
titleSlug,
}: MovieIndexPosterSelectProps) {
const [selectState, selectDispatch] = useSelect();
const isSelected = selectState.selectedState[movieId];
const onSelectPress = useCallback(
(event: SyntheticEvent<HTMLElement, PointerEvent>) => {
if (event.nativeEvent.ctrlKey || event.nativeEvent.metaKey) {
window.open(`${window.Radarr.urlBase}/movie/${titleSlug}`, '_blank');
return;
}
const shiftKey = event.nativeEvent.shiftKey;
selectDispatch({
@@ -25,7 +33,7 @@ function MovieIndexPosterSelect(props: MovieIndexPosterSelectProps) {
shiftKey,
});
},
[movieId, isSelected, selectDispatch]
[movieId, titleSlug, isSelected, selectDispatch]
);
return (

View File

@@ -114,6 +114,11 @@ const movieTokens = [
example: 'The Movie Collection',
footNotes: '1',
},
{
token: '{Movie CollectionThe}',
example: 'Movie Collection, The',
footNotes: '1',
},
{ token: '{Movie Certification}', example: 'R' },
{ token: '{Release Year}', example: '2009' },
];

View File

@@ -18,9 +18,19 @@ import TableOptionsModalWrapper from 'Components/Table/TableOptions/TableOptions
import TablePager from 'Components/Table/TablePager';
import usePaging from 'Components/Table/usePaging';
import useCurrentPage from 'Helpers/Hooks/useCurrentPage';
import usePrevious from 'Helpers/Hooks/usePrevious';
import useSelectState from 'Helpers/Hooks/useSelectState';
import { align, icons, kinds } from 'Helpers/Props';
import Movie from 'Movie/Movie';
import { executeCommand } from 'Store/Actions/commandActions';
import {
clearMovieFiles,
fetchMovieFiles,
} from 'Store/Actions/movieFileActions';
import {
clearQueueDetails,
fetchQueueDetails,
} from 'Store/Actions/queueActions';
import {
batchToggleCutoffUnmetMovies,
clearCutoffUnmet,
@@ -35,6 +45,8 @@ import { CheckInputChanged } from 'typings/inputs';
import { SelectStateInputProps } from 'typings/props';
import { TableOptionsChangePayload } from 'typings/Table';
import getFilterValue from 'Utilities/Filter/getFilterValue';
import hasDifferentItems from 'Utilities/Object/hasDifferentItems';
import selectUniqueIds from 'Utilities/Object/selectUniqueIds';
import {
registerPagePopulator,
unregisterPagePopulator,
@@ -108,6 +120,8 @@ function CutoffUnmet() {
const isSearchingForMovies =
isSearchingForAllMovies || isSearchingForSelectedMovies;
const previousItems = usePrevious(items);
const handleSelectAllChange = useCallback(
({ value }: CheckInputChanged) => {
setSelectState({ type: value ? 'selectAll' : 'unselectAll', items });
@@ -204,6 +218,8 @@ function CutoffUnmet() {
return () => {
dispatch(clearCutoffUnmet());
dispatch(clearQueueDetails());
dispatch(clearMovieFiles());
};
}, [requestCurrentPage, dispatch]);
@@ -223,6 +239,21 @@ function CutoffUnmet() {
};
}, [dispatch]);
useEffect(() => {
if (!previousItems || hasDifferentItems(items, previousItems)) {
const movieIds = selectUniqueIds<Movie, number>(items, 'id');
const movieFileIds = selectUniqueIds<Movie, number>(items, 'movieFileId');
if (movieIds.length) {
dispatch(fetchQueueDetails({ movieIds }));
}
if (movieFileIds.length) {
dispatch(fetchMovieFiles({ movieFileIds }));
}
}
}, [items, previousItems, dispatch]);
return (
<PageContent title={translate('CutoffUnmet')}>
<PageToolbar>

View File

@@ -18,10 +18,16 @@ import TableOptionsModalWrapper from 'Components/Table/TableOptions/TableOptions
import TablePager from 'Components/Table/TablePager';
import usePaging from 'Components/Table/usePaging';
import useCurrentPage from 'Helpers/Hooks/useCurrentPage';
import usePrevious from 'Helpers/Hooks/usePrevious';
import useSelectState from 'Helpers/Hooks/useSelectState';
import { align, icons, kinds } from 'Helpers/Props';
import InteractiveImportModal from 'InteractiveImport/InteractiveImportModal';
import Movie from 'Movie/Movie';
import { executeCommand } from 'Store/Actions/commandActions';
import {
clearQueueDetails,
fetchQueueDetails,
} from 'Store/Actions/queueActions';
import {
batchToggleMissingMovies,
clearMissing,
@@ -36,6 +42,8 @@ import { CheckInputChanged } from 'typings/inputs';
import { SelectStateInputProps } from 'typings/props';
import { TableOptionsChangePayload } from 'typings/Table';
import getFilterValue from 'Utilities/Filter/getFilterValue';
import hasDifferentItems from 'Utilities/Object/hasDifferentItems';
import selectUniqueIds from 'Utilities/Object/selectUniqueIds';
import {
registerPagePopulator,
unregisterPagePopulator,
@@ -112,6 +120,8 @@ function Missing() {
const isSearchingForMovies =
isSearchingForAllMovies || isSearchingForSelectedMovies;
const previousItems = usePrevious(items);
const handleSelectAllChange = useCallback(
({ value }: CheckInputChanged) => {
setSelectState({ type: value ? 'selectAll' : 'unselectAll', items });
@@ -216,6 +226,7 @@ function Missing() {
return () => {
dispatch(clearMissing());
dispatch(clearQueueDetails());
};
}, [requestCurrentPage, dispatch]);
@@ -235,6 +246,16 @@ function Missing() {
};
}, [dispatch]);
useEffect(() => {
if (!previousItems || hasDifferentItems(items, previousItems)) {
const movieIds = selectUniqueIds<Movie, number>(items, 'id');
if (movieIds.length) {
dispatch(fetchQueueDetails({ movieIds }));
}
}
}, [items, previousItems, dispatch]);
return (
<PageContent title={translate('Missing')}>
<PageToolbar>

View File

@@ -131,7 +131,7 @@
"html-webpack-plugin": "5.6.0",
"loader-utils": "^3.2.1",
"mini-css-extract-plugin": "2.9.1",
"postcss": "8.4.47",
"postcss": "8.5.6",
"postcss-color-function": "4.1.0",
"postcss-loader": "7.3.0",
"postcss-mixins": "9.0.4",

View File

@@ -84,7 +84,7 @@
<Deterministic Condition="$(AssemblyVersion.EndsWith('*'))">False</Deterministic>
<PathMap>$(MSBuildProjectDirectory)=./$(MSBuildProjectName)/</PathMap>
<PathMap>$(MSBuildThisFileDirectory)=./</PathMap>
</PropertyGroup>
<!-- Set the AssemblyConfiguration attribute for projects -->
@@ -123,14 +123,11 @@
<!-- Standard testing packages -->
<ItemGroup Condition="'$(TestProject)'=='true'">
<PackageReference Include="coverlet.collector" Version="6.0.4" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="NUnit" Version="3.14.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="NunitXml.TestLogger" Version="3.0.131" />
</ItemGroup>
<ItemGroup Condition="'$(TestProject)'=='true' and '$(TargetFramework)'=='net8.0'">
<PackageReference Include="coverlet.collector" Version="3.0.4-preview.27.ge7cb7c3b40" />
<PackageReference Include="NUnit3TestAdapter" Version="5.1.0" />
<PackageReference Include="NunitXml.TestLogger" Version="3.1.20" />
</ItemGroup>
<PropertyGroup Condition="'$(RadarrProject)'=='true' and '$(EnableAnalyzers)'=='false'">

View File

@@ -5,9 +5,6 @@
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="dotnet-bsd-crossbuild" value="https://pkgs.dev.azure.com/Servarr/Servarr/_packaging/dotnet-bsd-crossbuild/nuget/v3/index.json" />
<add key="Mono.Posix.NETStandard" value="https://pkgs.dev.azure.com/Servarr/Servarr/_packaging/Mono.Posix.NETStandard/nuget/v3/index.json" />
<add key="SQLite" value="https://pkgs.dev.azure.com/Servarr/Servarr/_packaging/SQLite/nuget/v3/index.json" />
<add key="coverlet-nightly" value="https://pkgs.dev.azure.com/Servarr/coverlet/_packaging/coverlet-nightly/nuget/v3/index.json" />
<add key="FFMpegCore" value="https://pkgs.dev.azure.com/Servarr/Servarr/_packaging/FFMpegCore/nuget/v3/index.json" />
<add key="FluentMigrator" value="https://pkgs.dev.azure.com/Servarr/Servarr/_packaging/FluentMigrator/nuget/v3/index.json" />
</packageSources>
</configuration>

View File

@@ -122,7 +122,7 @@ namespace NzbDrone.Common.EnvironmentInfo
catch (Exception ex)
{
_logger.Debug(ex, ex.Message);
throw new RadarrStartupException("Unable to migrate DB from nzbdrone.db to {0}. Migrate manually", _appFolderInfo.GetDatabase());
throw new RadarrStartupException(ex, "Unable to migrate DB from nzbdrone.db to {0}. Migrate manually", _appFolderInfo.GetDatabase());
}
}
@@ -199,7 +199,7 @@ namespace NzbDrone.Common.EnvironmentInfo
private void RemovePidFile()
{
if (OsInfo.IsNotWindows)
if (OsInfo.IsNotWindows && _diskProvider.FolderExists(_appFolderInfo.AppDataFolder))
{
_diskProvider.DeleteFile(Path.Combine(_appFolderInfo.AppDataFolder, "radarr.pid"));
}

View File

@@ -16,9 +16,10 @@
<PackageReference Include="Sentry" Version="4.0.2" />
<PackageReference Include="NLog.Targets.Syslog" Version="7.0.0" />
<PackageReference Include="SharpZipLib" Version="1.4.2" />
<PackageReference Include="SourceGear.sqlite3" Version="3.50.4.2" />
<PackageReference Include="System.Data.SQLite" Version="2.0.2" />
<PackageReference Include="System.Text.Json" Version="8.0.5" />
<PackageReference Include="System.ValueTuple" Version="4.6.1" />
<PackageReference Include="System.Data.SQLite.Core.Servarr" Version="1.0.115.5-18" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="8.0.1" />
<PackageReference Include="System.IO.FileSystem.AccessControl" Version="5.0.0" />
<PackageReference Include="System.Runtime.Loader" Version="4.3.0" />

View File

@@ -15,24 +15,24 @@ namespace NzbDrone.Core.Test.Http
return new HttpProxySettings(ProxyType.Socks5, "localhost", 8080, "*.httpbin.org,google.com,172.16.0.0/12", true, null, null);
}
[Test]
public void should_bypass_proxy()
[TestCase("http://eu.httpbin.org/get")]
[TestCase("http://google.com/get")]
[TestCase("http://localhost:8654/get")]
[TestCase("http://172.21.0.1:8989/api/v3/indexer/schema")]
public void should_bypass_proxy(string url)
{
var settings = GetProxySettings();
Subject.ShouldProxyBeBypassed(settings, new HttpUri("http://eu.httpbin.org/get")).Should().BeTrue();
Subject.ShouldProxyBeBypassed(settings, new HttpUri("http://google.com/get")).Should().BeTrue();
Subject.ShouldProxyBeBypassed(settings, new HttpUri("http://localhost:8654/get")).Should().BeTrue();
Subject.ShouldProxyBeBypassed(settings, new HttpUri("http://172.21.0.1:8989/api/v3/indexer/schema")).Should().BeTrue();
Subject.ShouldProxyBeBypassed(settings, new HttpUri(url)).Should().BeTrue();
}
[Test]
public void should_not_bypass_proxy()
[TestCase("http://bing.com/get")]
[TestCase("http://172.3.0.1:8989/api/v3/indexer/schema")]
public void should_not_bypass_proxy(string url)
{
var settings = GetProxySettings();
Subject.ShouldProxyBeBypassed(settings, new HttpUri("http://bing.com/get")).Should().BeFalse();
Subject.ShouldProxyBeBypassed(settings, new HttpUri("http://172.3.0.1:8989/api/v3/indexer/schema")).Should().BeFalse();
Subject.ShouldProxyBeBypassed(settings, new HttpUri(url)).Should().BeFalse();
}
}
}

View File

@@ -0,0 +1,90 @@
using System.Collections.Generic;
using System.Linq;
using FizzWare.NBuilder;
using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Core.CustomFormats;
using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.Movies;
using NzbDrone.Core.Organizer;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
{
[TestFixture]
public class CollectionTheFixture : CoreTest<FileNameBuilder>
{
private Movie _movie;
private MovieFile _movieFile;
private NamingConfig _namingConfig;
[SetUp]
public void Setup()
{
_movie = Builder<Movie>
.CreateNew()
.With(e => e.Title = "Movie Title")
.Build();
_movieFile = new MovieFile { Quality = new QualityModel(Quality.HDTV720p), ReleaseGroup = "RadarrTest" };
_namingConfig = NamingConfig.Default;
_namingConfig.RenameMovies = true;
Mocker.GetMock<INamingConfigService>()
.Setup(c => c.GetConfig()).Returns(_namingConfig);
Mocker.GetMock<IQualityDefinitionService>()
.Setup(v => v.Get(Moq.It.IsAny<Quality>()))
.Returns<Quality>(v => Quality.DefaultQualityDefinitions.First(c => c.Quality == v));
Mocker.GetMock<ICustomFormatService>()
.Setup(v => v.All())
.Returns(new List<CustomFormat>());
}
[TestCase("The Badger Collection", "Badger Collection, The")]
[TestCase("The Mover Collection", "Mover Collection, The")]
[TestCase("A Stupid Collection", "Stupid Collection, A")]
[TestCase("An Astounding Collection", "Astounding Collection, An")]
[TestCase("The Amazing Animal-Hero Collection (2001)", "Amazing Animal-Hero Collection, The (2001)")]
[TestCase("A Different Movie (AU)", "Different Movie, A (AU)")]
[TestCase("The Repairer (ZH) (2015)", "Repairer, The (ZH) (2015)")]
[TestCase("The Eighth Sense 2 (Thai)", "Eighth Sense 2, The (Thai)")]
[TestCase("The Astonishing Jog (Latin America)", "Astonishing Jog, The (Latin America)")]
[TestCase("The Hampster Pack (B&F)", "Hampster Pack, The (B&F)")]
[TestCase("The Gasm: I (Almost) Got Away With It (1900)", "Gasm - I (Almost) Got Away With It, The (1900)")]
public void should_get_expected_title_back(string collection, string expected)
{
SetCollectionName(_movie, collection);
_namingConfig.StandardMovieFormat = "{Movie CollectionThe}";
Subject.BuildFileName(_movie, _movieFile)
.Should().Be(expected);
}
[TestCase("A")]
[TestCase("Anne")]
[TestCase("Theodore")]
[TestCase("3%")]
public void should_not_change_title(string collection)
{
SetCollectionName(_movie, collection);
_namingConfig.StandardMovieFormat = "{Movie CollectionThe}";
Subject.BuildFileName(_movie, _movieFile)
.Should().Be(collection);
}
private void SetCollectionName(Movie movie, string collectionName)
{
var metadata = new MovieMetadata()
{
CollectionTitle = collectionName,
};
movie.MovieMetadata = new Core.Datastore.LazyLoaded<MovieMetadata>(metadata);
movie.MovieMetadata.Value.CollectionTitle = collectionName;
}
}
}

View File

@@ -55,14 +55,14 @@ namespace NzbDrone.Core.Test.ParserTests
[TestCase("Movie.Title.2019.1080p.AMZN.WEB-Rip.DDP.5.1.HEVC", null)]
[TestCase("Movie Name (2017) [2160p REMUX] [HEVC DV HYBRID HDR10+ Dolby TrueHD Atmos 7 1 24-bit Audio English] [Data Lass]", null)]
[TestCase("Movie Name (2017) [2160p REMUX] [HEVC DV HYBRID HDR10+ Dolby TrueHD Atmos 7 1 24-bit Audio English]-DataLass", "DataLass")]
[TestCase("Movie Name (2017) (Showtime) (1080p.BD.DD5.1.x265-TheSickle[TAoE])", "TheSickle")]
[TestCase("Movie Name (2017) (Showtime) (1080p.BD.DD5.1.x265-TheSickle[TAoE])", "TAoE")]
public void should_parse_release_group(string title, string expected)
{
Parser.Parser.ParseReleaseGroup(title).Should().Be(expected);
Parser.ReleaseGroupParser.ParseReleaseGroup(title).Should().Be(expected);
}
[TestCase("Movie Name (2020) [2160p x265 10bit S82 Joy]", "Joy")]
[TestCase("Movie Name (2003) (2160p BluRay X265 HEVC 10bit HDR AAC 7.1 Tigole) [QxR]", "Tigole")]
[TestCase("Movie Name (2003) (2160p BluRay X265 HEVC 10bit HDR AAC 7.1 Tigole) [QxR]", "QxR")]
[TestCase("Ode To Joy (2009) (2160p BluRay x265 10bit HDR Joy)", "Joy")]
[TestCase("Movie Name (2001) 1080p NF WEB-DL DDP2.0 x264-E.N.D", "E.N.D")]
[TestCase("Movie Name (2020) [1080p] [WEBRip] [5.1] [YTS.MX]", "YTS.MX")]
@@ -109,7 +109,8 @@ namespace NzbDrone.Core.Test.ParserTests
[TestCase("Movie Title (2022) (2160p ATV WEB-DL Hybrid H265 DV HDR DDP Atmos 5.1 English - HONE)", "HONE")]
[TestCase("Movie Title (2009) (2160p PMTP WEB-DL Hybrid H265 DV HDR10+ DDP Atmos 5.1 English - HONE)", "HONE")]
[TestCase("Why.Cant.You.Use.Normal.Characters.2021.2160p.UHD.HDR10+.BluRay.TrueHD.Atmos.7.1.x265-ZØNEHD", "ZØNEHD")]
[TestCase("Movie.Should.Not.Use.Dots.2022.1080p.BluRay.x265.10bit.Tigole", "Tigole")]
[TestCase("Movie.Should.Not.Use.Dots.2022.1080p.BluRay.x265.10bit.Tigole)", "Tigole")]
[TestCase("Movie.Should.Not.Use.Dots.2022.1080p.BluRay.x265.10bit.Tigole", null)]
[TestCase("Movie.Title.2005.2160p.UHD.BluRay.TrueHD 7.1.Atmos.x265 - HQMUX", "HQMUX")]
[TestCase("Movie.Name.2022.1080p.BluRay.x264-VARYG (Blue Lock, Multi-Subs)", "VARYG")]
[TestCase("Movie Title (2023) (1080p BluRay x265 SDR AAC 2.0 English Vyndros)", "Vyndros")]
@@ -117,8 +118,8 @@ namespace NzbDrone.Core.Test.ParserTests
[TestCase("Movie Title (2011) [BluRay] [1080p] [YTS.MX] [YIFY]", "YIFY")]
[TestCase("Movie Title (2014) [BluRay] [1080p] [YIFY] [YTS]", "YTS")]
[TestCase("Movie Title (2018) [BluRay] [1080p] [YIFY] [YTS.LT]", "YTS.LT")]
[TestCase("Movie Title (2016) (1080p AMZN WEB-DL x265 HEVC 10bit EAC3 5 1 RZeroX) QxR", "RZeroX")]
[TestCase("Movie Title (2016) (1080p AMZN WEB-DL x265 HEVC 10bit EAC3 5 1 Garshasp) QxR", "Garshasp")]
[TestCase("Movie Title (2016) (1080p AMZN WEB-DL x265 HEVC 10bit EAC3 5 1 RZeroX) QxR", "QxR")]
[TestCase("Movie Title (2016) (1080p AMZN WEB-DL x265 HEVC 10bit EAC3 5 1 Garshasp) QxR", "QxR")]
[TestCase("Movie Title 2024 mUHD 10Bits DoVi HDR10 2160p BluRay DD 5 1 x265 - TMd", "TMd")]
[TestCase("Movie Title 2024 mUHD 10Bits DoVi HDR10 2160p BluRay DD 5 1 x265 TMd", "TMd")]
[TestCase("Movie Title (2024) 2160p WEB-DL ESP DD+ 5.1 ING DD+ 5.1 Atmos DV HDR H.265-Eml HDTeam", "Eml HDTeam")]
@@ -126,15 +127,16 @@ namespace NzbDrone.Core.Test.ParserTests
[TestCase("Movie Title (2022) BDFull 1080p DTS-HD MA 5.1 AVC LMain", "LMain")]
[TestCase("Movie Title (2024) (1080p BluRay x265 SDR DDP 5.1 English - DarQ)", "DarQ")]
[TestCase("Movie Title (2024) (1080p BluRay x265 SDR DDP 5.1 English -BEN THE MEN", "BEN THE MEN")]
[TestCase("Movie Title 2024 2160p WEB-DL DoVi HDR10+ H265 DDP 5.1 Atmos-126811", "126811")]
public void should_parse_exception_release_group(string title, string expected)
{
Parser.Parser.ParseReleaseGroup(title).Should().Be(expected);
Parser.ReleaseGroupParser.ParseReleaseGroup(title).Should().Be(expected);
}
[TestCase(@"C:\Test\Doctor.Series.2005.s01e01.internal.bdrip.x264-archivist.mkv", "archivist")]
public void should_not_include_extension_in_release_group(string title, string expected)
{
Parser.Parser.ParseReleaseGroup(title).Should().Be(expected);
Parser.ReleaseGroupParser.ParseReleaseGroup(title).Should().Be(expected);
}
[TestCase("Some.Movie.S02E04.720p.WEBRip.x264-SKGTV English", "SKGTV")]
@@ -143,7 +145,7 @@ namespace NzbDrone.Core.Test.ParserTests
public void should_not_include_language_in_release_group(string title, string expected)
{
Parser.Parser.ParseReleaseGroup(title).Should().Be(expected);
Parser.ReleaseGroupParser.ParseReleaseGroup(title).Should().Be(expected);
}
[TestCase("Some.Movie.2019.1080p.BDRip.X264.AC3-EVO-RP", "EVO")]
@@ -173,7 +175,7 @@ namespace NzbDrone.Core.Test.ParserTests
public void should_not_include_bad_suffix_in_release_group(string title, string expected)
{
Parser.Parser.ParseReleaseGroup(title).Should().Be(expected);
Parser.ReleaseGroupParser.ParseReleaseGroup(title).Should().Be(expected);
}
[TestCase("[FFF] Invaders of the Movies!! - S01E11 - Someday, With Movies", "FFF")]
@@ -184,13 +186,13 @@ namespace NzbDrone.Core.Test.ParserTests
public void should_parse_anime_release_groups(string title, string expected)
{
Parser.Parser.ParseReleaseGroup(title).Should().Be(expected);
Parser.ReleaseGroupParser.ParseReleaseGroup(title).Should().Be(expected);
}
[TestCase("Terrible.Anime.Title.2020.DBOX.480p.x264-iKaos [v3] [6AFFEF6B]")]
public void should_not_parse_anime_hash_as_release_group(string title)
{
Parser.Parser.ParseReleaseGroup(title).Should().BeNull();
Parser.ReleaseGroupParser.ParseReleaseGroup(title).Should().BeNull();
}
}
}

View File

@@ -38,7 +38,7 @@ namespace NzbDrone.Core.Test.ParserTests
[TestCase("Movie Title Future 2023 DVDRip XviD RUNNER[www.allstate.net]", null)]
public void should_not_parse_url_in_group(string title, string expected)
{
Parser.Parser.ParseReleaseGroup(title).Should().Be(expected);
Parser.ReleaseGroupParser.ParseReleaseGroup(title).Should().Be(expected);
}
}
}

View File

@@ -5,7 +5,6 @@
<ItemGroup>
<PackageReference Include="Dapper" Version="2.1.66" />
<PackageReference Include="NBuilder" Version="6.1.0" />
<PackageReference Include="System.Data.SQLite.Core.Servarr" Version="1.0.115.5-18" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\NzbDrone.Test.Common\Radarr.Test.Common.csproj" />

View File

@@ -1,13 +1,18 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SQLite;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Text;
using Dapper;
using NLog;
using NzbDrone.Common.Instrumentation;
using NzbDrone.Core.Datastore.Events;
using NzbDrone.Core.Messaging.Events;
using Polly;
using Polly.Retry;
namespace NzbDrone.Core.Datastore
{
@@ -40,12 +45,31 @@ namespace NzbDrone.Core.Datastore
public class BasicRepository<TModel> : IBasicRepository<TModel>
where TModel : ModelBase, new()
{
private static readonly ILogger Logger = NzbDroneLogger.GetLogger(typeof(BasicRepository<TModel>));
private readonly IEventAggregator _eventAggregator;
private readonly PropertyInfo _keyProperty;
private readonly List<PropertyInfo> _properties;
private readonly string _updateSql;
private readonly string _insertSql;
private static ResiliencePipeline RetryStrategy => new ResiliencePipelineBuilder()
.AddRetry(new RetryStrategyOptions
{
ShouldHandle = new PredicateBuilder().Handle<SQLiteException>(ex => ex.ResultCode == SQLiteErrorCode.Busy),
Delay = TimeSpan.FromMilliseconds(100),
MaxRetryAttempts = 3,
BackoffType = DelayBackoffType.Exponential,
UseJitter = true,
OnRetry = args =>
{
Logger.Warn(args.Outcome.Exception, "Failed writing to database. Retry #{0}", args.AttemptNumber);
return default;
}
})
.Build();
protected readonly IDatabase _database;
protected readonly string _table;
@@ -186,7 +210,9 @@ namespace NzbDrone.Core.Datastore
private TModel Insert(IDbConnection connection, IDbTransaction transaction, TModel model)
{
SqlBuilderExtensions.LogQuery(_insertSql, model);
var multi = connection.QueryMultiple(_insertSql, model, transaction);
var multi = RetryStrategy.Execute(static (state, _) => state.connection.QueryMultiple(state._insertSql, state.model, state.transaction), (connection, _insertSql, model, transaction));
var multiRead = multi.Read();
var id = (int)(multiRead.First().id ?? multiRead.First().Id);
_keyProperty.SetValue(model, id);
@@ -381,7 +407,7 @@ namespace NzbDrone.Core.Datastore
SqlBuilderExtensions.LogQuery(sql, model);
connection.Execute(sql, model, transaction: transaction);
RetryStrategy.Execute(static (state, _) => state.connection.Execute(state.sql, state.model, transaction: state.transaction), (connection, sql, model, transaction));
}
private void UpdateFields(IDbConnection connection, IDbTransaction transaction, IList<TModel> models, List<PropertyInfo> propertiesToUpdate)
@@ -393,7 +419,7 @@ namespace NzbDrone.Core.Datastore
SqlBuilderExtensions.LogQuery(sql, model);
}
connection.Execute(sql, models, transaction: transaction);
RetryStrategy.Execute(static (state, _) => state.connection.Execute(state.sql, state.models, transaction: state.transaction), (connection, sql, models, transaction));
}
protected virtual SqlBuilder PagedBuilder() => Builder();

View File

@@ -7,7 +7,7 @@ using NzbDrone.Common.Instrumentation;
namespace NzbDrone.Core.Datastore.Migration
{
[Maintenance(MigrationStage.BeforeAll, TransactionBehavior.None)]
public class DatabaseEngineVersionCheck : FluentMigrator.Migration
public class DatabaseEngineVersionCheck : ForwardOnlyMigration
{
protected readonly Logger _logger;
@@ -22,11 +22,6 @@ namespace NzbDrone.Core.Datastore.Migration
IfDatabase("postgres").Execute.WithConnection(LogPostgresVersion);
}
public override void Down()
{
// No-op
}
private void LogSqliteVersion(IDbConnection conn, IDbTransaction tran)
{
using (var versionCmd = conn.CreateCommand())

View File

@@ -16,7 +16,7 @@ namespace NzbDrone.Core.Datastore.Migration
if (!Schema.Table("ImportExclusions").Exists())
{
Create.TableForModel("ImportExclusions")
.WithColumn("TmdbId").AsInt64().NotNullable().Unique().PrimaryKey()
.WithColumn("TmdbId").AsInt64().NotNullable().Unique()
.WithColumn("MovieTitle").AsString().Nullable()
.WithColumn("MovieYear").AsInt64().Nullable().WithDefaultValue(0);
}

View File

@@ -12,6 +12,7 @@ using NzbDrone.Common.EnvironmentInfo;
using NzbDrone.Common.Extensions;
using NzbDrone.Common.Serializer;
using NzbDrone.Core.Datastore.Migration.Framework;
using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.MediaFiles.MediaInfo;
namespace NzbDrone.Core.Datastore.Migration
@@ -809,7 +810,7 @@ namespace NzbDrone.Core.Datastore.Migration
private static string GetSceneNameMatch(string sceneName, params string[] tokens)
{
sceneName = sceneName.IsNotNullOrWhiteSpace() ? Parser.Parser.RemoveFileExtension(sceneName) : string.Empty;
sceneName = sceneName.IsNotNullOrWhiteSpace() ? FileExtensions.RemoveFileExtension(sceneName) : string.Empty;
foreach (var token in tokens)
{

View File

@@ -6,7 +6,6 @@ using FluentMigrator.Runner.Generators;
using FluentMigrator.Runner.Initialization;
using FluentMigrator.Runner.Processors;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using NLog;
using NLog.Extensions.Logging;
@@ -20,13 +19,10 @@ namespace NzbDrone.Core.Datastore.Migration.Framework
public class MigrationController : IMigrationController
{
private readonly Logger _logger;
private readonly ILoggerProvider _migrationLoggerProvider;
public MigrationController(Logger logger,
ILoggerProvider migrationLoggerProvider)
public MigrationController(Logger logger)
{
_logger = logger;
_migrationLoggerProvider = migrationLoggerProvider;
}
public void Migrate(string connectionString, MigrationContext migrationContext, DatabaseType databaseType)
@@ -35,16 +31,13 @@ namespace NzbDrone.Core.Datastore.Migration.Framework
_logger.Info("*** Migrating {0} ***", connectionString);
ServiceProvider serviceProvider;
var db = databaseType == DatabaseType.SQLite ? "sqlite" : "postgres";
serviceProvider = new ServiceCollection()
var serviceProvider = new ServiceCollection()
.AddLogging(b => b.AddNLog())
.AddFluentMigratorCore()
.Configure<RunnerOptions>(cfg => cfg.IncludeUntaggedMaintenances = true)
.ConfigureRunner(
builder => builder
.ConfigureRunner(builder => builder
.AddPostgres()
.AddNzbDroneSQLite()
.WithGlobalConnectionString(connectionString)

View File

@@ -4,9 +4,14 @@ using FluentMigrator.Builders.Create;
using FluentMigrator.Builders.Create.Table;
using FluentMigrator.Runner;
using FluentMigrator.Runner.BatchParser;
using FluentMigrator.Runner.Generators;
using FluentMigrator.Runner.Generators.SQLite;
using FluentMigrator.Runner.Initialization;
using FluentMigrator.Runner.Processors;
using FluentMigrator.Runner.Processors.SQLite;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
namespace NzbDrone.Core.Datastore.Migration.Framework
{
@@ -26,23 +31,40 @@ namespace NzbDrone.Core.Datastore.Migration.Framework
return command;
}
public static void AddParameter(this System.Data.IDbCommand command, object value)
public static void AddParameter(this IDbCommand command, object value)
{
var parameter = command.CreateParameter();
parameter.Value = value;
command.Parameters.Add(parameter);
}
public static IMigrationRunnerBuilder AddNzbDroneSQLite(this IMigrationRunnerBuilder builder)
public static IMigrationRunnerBuilder AddNzbDroneSQLite(this IMigrationRunnerBuilder builder, bool binaryGuid = false, bool useStrictTables = false)
{
builder.Services
.AddTransient<SQLiteBatchParser>()
.AddScoped<SQLiteDbFactory>()
.AddScoped<NzbDroneSQLiteProcessor>()
.AddScoped<NzbDroneSQLiteProcessor>(sp =>
{
var factory = sp.GetService<SQLiteDbFactory>();
var logger = sp.GetService<ILogger<NzbDroneSQLiteProcessor>>();
var options = sp.GetService<IOptionsSnapshot<ProcessorOptions>>();
var connectionStringAccessor = sp.GetService<IConnectionStringAccessor>();
var sqliteQuoter = new SQLiteQuoter(false);
return new NzbDroneSQLiteProcessor(factory, sp.GetService<SQLiteGenerator>(), logger, options, connectionStringAccessor, sp, sqliteQuoter);
})
.AddScoped<ISQLiteTypeMap>(_ => new NzbDroneSQLiteTypeMap(useStrictTables))
.AddScoped<IMigrationProcessor>(sp => sp.GetRequiredService<NzbDroneSQLiteProcessor>())
.AddScoped<SQLiteQuoter>()
.AddScoped<SQLiteGenerator>()
.AddScoped(
sp =>
{
var typeMap = sp.GetRequiredService<ISQLiteTypeMap>();
return new SQLiteGenerator(
new SQLiteQuoter(binaryGuid),
typeMap,
new OptionsWrapper<GeneratorOptions>(new GeneratorOptions()));
})
.AddScoped<IMigrationGenerator>(sp => sp.GetRequiredService<SQLiteGenerator>());
return builder;
}
}

View File

@@ -15,6 +15,8 @@ namespace NzbDrone.Core.Datastore.Migration.Framework
{
public class NzbDroneSQLiteProcessor : SQLiteProcessor
{
private readonly SQLiteQuoter _quoter;
public NzbDroneSQLiteProcessor(SQLiteDbFactory factory,
SQLiteGenerator generator,
ILogger<NzbDroneSQLiteProcessor> logger,
@@ -24,6 +26,7 @@ namespace NzbDrone.Core.Datastore.Migration.Framework
SQLiteQuoter quoter)
: base(factory, generator, logger, options, connectionStringAccessor, serviceProvider, quoter)
{
_quoter = quoter;
}
public override void Process(AlterColumnExpression expression)
@@ -35,7 +38,7 @@ namespace NzbDrone.Core.Datastore.Migration.Framework
if (columnIndex == -1)
{
throw new ApplicationException(string.Format("Column {0} does not exist on table {1}.", expression.Column.Name, expression.TableName));
throw new ApplicationException($"Column {expression.Column.Name} does not exist on table {expression.TableName}.");
}
columnDefinitions[columnIndex] = expression.Column;
@@ -45,6 +48,28 @@ namespace NzbDrone.Core.Datastore.Migration.Framework
ProcessAlterTable(tableDefinition);
}
public override void Process(AlterDefaultConstraintExpression expression)
{
var tableDefinition = GetTableSchema(expression.TableName);
var columnDefinitions = tableDefinition.Columns.ToList();
var columnIndex = columnDefinitions.FindIndex(c => c.Name == expression.ColumnName);
if (columnIndex == -1)
{
throw new ApplicationException($"Column {expression.ColumnName} does not exist on table {expression.TableName}.");
}
var changedColumn = columnDefinitions[columnIndex];
changedColumn.DefaultValue = expression.DefaultValue;
columnDefinitions[columnIndex] = changedColumn;
tableDefinition.Columns = columnDefinitions;
ProcessAlterTable(tableDefinition);
}
public override void Process(DeleteColumnExpression expression)
{
var tableDefinition = GetTableSchema(expression.TableName);
@@ -62,7 +87,7 @@ namespace NzbDrone.Core.Datastore.Migration.Framework
if (columnsToRemove.Any())
{
throw new ApplicationException(string.Format("Column {0} does not exist on table {1}.", columnsToRemove.First(), expression.TableName));
throw new ApplicationException($"Column {columnsToRemove.First()} does not exist on table {expression.TableName}.");
}
ProcessAlterTable(tableDefinition);
@@ -78,12 +103,12 @@ namespace NzbDrone.Core.Datastore.Migration.Framework
if (columnIndex == -1)
{
throw new ApplicationException(string.Format("Column {0} does not exist on table {1}.", expression.OldName, expression.TableName));
throw new ApplicationException($"Column {expression.OldName} does not exist on table {expression.TableName}.");
}
if (columnDefinitions.Any(c => c.Name == expression.NewName))
{
throw new ApplicationException(string.Format("Column {0} already exists on table {1}.", expression.NewName, expression.TableName));
throw new ApplicationException($"Column {expression.NewName} already exists on table {expression.TableName}.");
}
oldColumnDefinitions[columnIndex] = (ColumnDefinition)columnDefinitions[columnIndex].Clone();
@@ -128,21 +153,20 @@ namespace NzbDrone.Core.Datastore.Migration.Framework
}
// What is the cleanest way to do this? Add function to Generator?
var quoter = new SQLiteQuoter();
var columnsToInsert = string.Join(", ", tableDefinition.Columns.Select(c => quoter.QuoteColumnName(c.Name)));
var columnsToFetch = string.Join(", ", (oldColumnDefinitions ?? tableDefinition.Columns).Select(c => quoter.QuoteColumnName(c.Name)));
var columnsToInsert = string.Join(", ", tableDefinition.Columns.Select(c => _quoter.QuoteColumnName(c.Name)));
var columnsToFetch = string.Join(", ", (oldColumnDefinitions ?? tableDefinition.Columns).Select(c => _quoter.QuoteColumnName(c.Name)));
Process(new CreateTableExpression() { TableName = tempTableName, Columns = tableDefinition.Columns.ToList() });
Process(new CreateTableExpression { TableName = tempTableName, Columns = tableDefinition.Columns.ToList() });
Process(string.Format("INSERT INTO {0} ({1}) SELECT {2} FROM {3}", quoter.QuoteTableName(tempTableName), columnsToInsert, columnsToFetch, quoter.QuoteTableName(tableName)));
Process($"INSERT INTO {_quoter.QuoteTableName(tempTableName)} ({columnsToInsert}) SELECT {columnsToFetch} FROM {_quoter.QuoteTableName(tableName)}");
Process(new DeleteTableExpression() { TableName = tableName });
Process(new DeleteTableExpression { TableName = tableName });
Process(new RenameTableExpression() { OldName = tempTableName, NewName = tableName });
Process(new RenameTableExpression { OldName = tempTableName, NewName = tableName });
foreach (var index in tableDefinition.Indexes)
{
Process(new CreateIndexExpression() { Index = index });
Process(new CreateIndexExpression { Index = index });
}
}
}

View File

@@ -0,0 +1,76 @@
using System.Data;
using FluentMigrator.Runner.Generators.Base;
using FluentMigrator.Runner.Generators.SQLite;
namespace NzbDrone.Core.Datastore.Migration.Framework;
// Based on https://github.com/fluentmigrator/fluentmigrator/blob/v6.2.0/src/FluentMigrator.Runner.SQLite/Generators/SQLite/SQLiteTypeMap.cs
public sealed class NzbDroneSQLiteTypeMap : TypeMapBase, ISQLiteTypeMap
{
public bool UseStrictTables { get; }
public NzbDroneSQLiteTypeMap(bool useStrictTables = false)
{
UseStrictTables = useStrictTables;
SetupTypeMaps();
}
// Must be kept in sync with upstream
protected override void SetupTypeMaps()
{
SetTypeMap(DbType.Binary, "BLOB");
SetTypeMap(DbType.Byte, "INTEGER");
SetTypeMap(DbType.Int16, "INTEGER");
SetTypeMap(DbType.Int32, "INTEGER");
SetTypeMap(DbType.Int64, "INTEGER");
SetTypeMap(DbType.SByte, "INTEGER");
SetTypeMap(DbType.UInt16, "INTEGER");
SetTypeMap(DbType.UInt32, "INTEGER");
SetTypeMap(DbType.UInt64, "INTEGER");
if (!UseStrictTables)
{
SetTypeMap(DbType.Currency, "NUMERIC");
SetTypeMap(DbType.Decimal, "NUMERIC");
SetTypeMap(DbType.Double, "NUMERIC");
SetTypeMap(DbType.Single, "NUMERIC");
SetTypeMap(DbType.VarNumeric, "NUMERIC");
SetTypeMap(DbType.Date, "DATETIME");
SetTypeMap(DbType.DateTime, "DATETIME");
SetTypeMap(DbType.DateTime2, "DATETIME");
SetTypeMap(DbType.Time, "DATETIME");
SetTypeMap(DbType.Guid, "UNIQUEIDENTIFIER");
// Custom so that we can use DateTimeOffset in Postgres for appropriate DB typing
SetTypeMap(DbType.DateTimeOffset, "DATETIME");
}
else
{
SetTypeMap(DbType.Currency, "TEXT");
SetTypeMap(DbType.Decimal, "TEXT");
SetTypeMap(DbType.Double, "REAL");
SetTypeMap(DbType.Single, "REAL");
SetTypeMap(DbType.VarNumeric, "TEXT");
SetTypeMap(DbType.Date, "TEXT");
SetTypeMap(DbType.DateTime, "TEXT");
SetTypeMap(DbType.DateTime2, "TEXT");
SetTypeMap(DbType.Time, "TEXT");
SetTypeMap(DbType.Guid, "TEXT");
// Custom so that we can use DateTimeOffset in Postgres for appropriate DB typing
SetTypeMap(DbType.DateTimeOffset, "TEXT");
}
SetTypeMap(DbType.AnsiString, "TEXT");
SetTypeMap(DbType.String, "TEXT");
SetTypeMap(DbType.AnsiStringFixedLength, "TEXT");
SetTypeMap(DbType.StringFixedLength, "TEXT");
SetTypeMap(DbType.Boolean, "INTEGER");
}
public override string GetTypeMap(DbType type, int? size, int? precision)
{
return base.GetTypeMap(type, size: null, precision: null);
}
}

View File

@@ -221,7 +221,7 @@ namespace NzbDrone.Core.Download
try
{
hash = MagnetLink.Parse(magnetUrl).InfoHash.ToHex();
hash = MagnetLink.Parse(magnetUrl).InfoHashes.V1OrV2.ToHex();
}
catch (FormatException ex)
{

View File

@@ -76,7 +76,7 @@ namespace NzbDrone.Core.ImportLists.RadarrList2.IMDbList
public override IParseImportListResponse GetParser()
{
return new IMDbListParser(Settings);
return new IMDbListParser(Settings, _logger);
}
}
}

View File

@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;
using NLog;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.ImportLists.ImportListMovies;
using NzbDrone.Core.MetadataSource.SkyHook.Resource;
@@ -11,10 +12,12 @@ namespace NzbDrone.Core.ImportLists.RadarrList2.IMDbList
public class IMDbListParser : RadarrList2Parser
{
private readonly IMDbListSettings _settings;
private readonly Logger _logger;
public IMDbListParser(IMDbListSettings settings)
public IMDbListParser(IMDbListSettings settings, Logger logger)
{
_settings = settings;
_logger = logger;
}
public override IList<ImportListMovie> ParseResponse(ImportListResponse importListResponse)
@@ -25,6 +28,7 @@ namespace NzbDrone.Core.ImportLists.RadarrList2.IMDbList
if (!PreProcess(importResponse))
{
_logger.Debug("IMDb List {0}: Found {1} movies", _settings.ListId, movies.Count);
return movies;
}
@@ -34,20 +38,19 @@ namespace NzbDrone.Core.ImportLists.RadarrList2.IMDbList
var rows = importResponse.Content.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
movies = rows.Skip(1).SelectList(m => m.Split(',')).Where(m => m.Length > 5).SelectList(i => new ImportListMovie { ImdbId = i[1], Title = i[5] });
return movies;
}
else
{
var jsonResponse = JsonConvert.DeserializeObject<List<MovieResource>>(importResponse.Content);
if (jsonResponse == null)
if (jsonResponse != null)
{
return movies;
movies = jsonResponse.SelectList(m => new ImportListMovie { TmdbId = m.TmdbId });
}
return jsonResponse.SelectList(m => new ImportListMovie { TmdbId = m.TmdbId });
}
_logger.Debug("IMDb List {0}: Found {1} movies", _settings.ListId, movies.Count);
return movies;
}
}
}

View File

@@ -9,16 +9,22 @@ namespace NzbDrone.Core.ImportLists.RadarrList2.IMDbList
protected override HttpRequest GetHttpRequest()
{
Logger.Info("IMDb List {0}: Importing movies", Settings.ListId);
// Use IMDb list Export for user lists to bypass RadarrAPI caching
if (Settings.ListId.StartsWith("ls", StringComparison.OrdinalIgnoreCase))
{
throw new Exception("IMDb lists of the form 'ls12345678' are no longer supported. Feel free to remove this list after you review your Clean Library Level.");
}
return RequestBuilder.Create()
var request = RequestBuilder.Create()
.SetSegment("route", $"list/imdb/{Settings.ListId}")
.Accept(HttpAccept.Json)
.Build();
Logger.Trace("IMDb List {0}: Request URL: {1}", Settings.ListId, request.Url);
return request;
}
}
}

View File

@@ -82,7 +82,7 @@ namespace NzbDrone.Core.Indexers
{
try
{
return MagnetLink.Parse(magnetUrl).InfoHash.ToHex();
return MagnetLink.Parse(magnetUrl).InfoHashes.V1OrV2.ToHex();
}
catch
{

View File

@@ -10,9 +10,9 @@
"AppDataLocationHealthCheckMessage": "Aktualizacja nie będzie możliwa w celu uniknięcia usunięcia danych aplikacji",
"Analytics": "Analityka",
"All": "Wszystkie",
"Agenda": "Lista",
"Agenda": "Terminarz",
"AddNewTmdbIdMessage": "Możesz również użyć ID TMDb, np. 'tmdb:71663'",
"AddNewMessage": "Dodanie nowego filmu jest bardzo łatwe, po prostu zacznij wpisywać nazwę jakiegoś filmu",
"AddNewMessage": "Dodanie nowego filmu jest bardzo łatwe, po prostu zacznij wpisywać nazwę",
"AddNew": "Dodaj nowy",
"AddMovies": "Dodaj filmy",
"AddExclusion": "Dodaj wyjątek",
@@ -85,7 +85,7 @@
"EditCustomFormat": "Edytuj format niestandardowy",
"EnableCompletedDownloadHandlingHelpText": "Automatycznie importuj ukończone pliki do pobrania z klienta pobierania",
"SearchIsNotSupportedWithThisIndexer": "Wyszukiwanie nie jest obsługiwane przez ten indeksator",
"AnalyseVideoFilesHelpText": "Wyodrębnij z plików informacje wideo, takie jak rozdzielczość, czas działania i kodeki. Wymaga to odczytu przez {appName} części pliku, które mogą powodować dużą aktywność dysku lub sieci podczas skanowania.",
"AnalyseVideoFilesHelpText": "Wyodrębnij z plików informacje o wideo, takie jak rozdzielczość, czas trwania i kodeki. Wymaga to odczytu przez {appName} części pliku, które mogą powodować dużą aktywność dysku lub sieci podczas skanowania.",
"ChangeFileDateHelpText": "Zmień datę pliku przy imporcie / ponownym skanowaniu",
"FollowPerson": "Śledź osobę",
"Genres": "Gatunki",
@@ -124,9 +124,9 @@
"TagsSettingsSummary": "Zobacz wszystkie tagi i sposób ich używania. Nieużywane tagi można usunąć",
"TheLogLevelDefault": "Poziom dziennika jest domyślnie ustawiony na „Informacje” i można go zmienić w",
"TorrentDelayTime": "Opóźnienie torrenta: {0}",
"AddIndexerError": "Nie można dodać nowego indeksatora, spróbuj ponownie.",
"AddQualityProfileError": "Nie udało się dodać nowego profilu jakości, spróbuj później.",
"AddRemotePathMappingError": "Nie można dodać nowego mapowania ścieżki zdalnej, spróbuj ponownie.",
"AddIndexerError": "Nie można dodać nowego indeksera, spróbuj ponownie.",
"AddQualityProfileError": "Nie udało się dodać nowego profilu jakości, spróbuj ponownie.",
"AddRemotePathMappingError": "Nie udało się dodać nowego mapowania ścieżki zdalnej, spróbuj ponownie.",
"BackupsLoadError": "Nie można załadować kopii zapasowych",
"ListOptionsLoadError": "Nie można załadować opcji listy",
"UnableToLoadRestrictions": "Nie można załadować ograniczeń",
@@ -157,7 +157,7 @@
"Date": "Data",
"AddToDownloadQueue": "Dodaj do kolejki pobierania",
"Add": "Dodaj",
"AddCustomFormat": "Dodaj format niestandardowy",
"AddCustomFormat": "Dodaj niestandardowy format",
"AddDelayProfile": "Dodaj profil opóźnienia",
"AddDownloadClient": "Dodaj klienta pobierania",
"AfterManualRefresh": "Po ręcznym odświeżeniu",
@@ -172,7 +172,7 @@
"EnableSsl": "Włącz SSL",
"EditGroups": "Edytuj grupy",
"AllMoviesInPathHaveBeenImported": "Wszystkie filmy w {path} zostały zaimportowane",
"AllResultsHiddenFilter": "Wszystkie wyniki są ukrywane przez zastosowany filtr",
"AllResultsHiddenFilter": "Wszystkie wyniki są ukryte przez zastosowany filtr",
"Always": "Zawsze",
"HomePage": "Strona główna",
"Hours": "godziny",
@@ -389,7 +389,7 @@
"FileBrowserPlaceholderText": "Zacznij pisać lub wybierz ścieżkę poniżej",
"ApiKey": "Klucz API",
"StartupDirectory": "Katalog Startowy",
"AddImportListExclusion": "Dodaj wykluczenie z listy",
"AddImportListExclusion": "Dodaj wykluczenie z listy importu",
"AnalyseVideoFiles": "Analizuj pliki wideo",
"Age": "Wiek",
"AgeWhenGrabbed": "Wiek (przy złapaniu)",
@@ -397,7 +397,7 @@
"AllowHardcodedSubsHelpText": "Wykryte wbudowane napisy zostaną automatycznie pobrane",
"AlreadyInYourLibrary": "Już w Twojej bibliotece",
"SystemTimeHealthCheckMessage": "Czas systemowy jest wyłączony o więcej niż 1 dzień. Zaplanowane zadania mogą nie działać poprawnie, dopóki czas nie zostanie skorygowany",
"AnalyticsEnabledHelpText": "Wysyłaj anonimowe informacje o użytkowaniu i błędach do serwerów {appName}. Obejmuje to informacje o Twojej przeglądarce, z których stron {appName} WebUI korzystasz, raportowanie błędów, a także wersję systemu operacyjnego i środowiska wykonawczego. Wykorzystamy te informacje, aby nadać priorytet funkcjom i poprawkom błędów.",
"AnalyticsEnabledHelpText": "Wysyłaj anonimowe informacje o użytkowaniu i błędach do serwerów {appName}. Obejmuje to informacje o Twojej przeglądarce, których stron interfejsu webowego {appName} używasz, raportowanie błędów, a także wersję systemu operacyjnego i środowiska wykonawczego. Wykorzystamy te informacje, aby nadać priorytet funkcjom i poprawkom błędów.",
"MinimumFreeSpace": "Minimalna wolna przestrzeń",
"MinimumLimits": "Minimalne limity",
"ReleaseRejected": "Wersja odrzucona",
@@ -838,7 +838,7 @@
"Status": "Status",
"Studio": "Studio",
"Style": "Styl",
"AddNewMovieRootFolderHelpText": "Podfolder „{0}” zostanie utworzony automatycznie",
"AddNewMovieRootFolderHelpText": "Podfolder '{folder}' zostanie utworzony automatycznie",
"Sunday": "niedziela",
"Table": "Stół",
"TableOptions": "Opcje tabeli",
@@ -875,9 +875,9 @@
"AddConditionError": "Nie można dodać nowego warunku, spróbuj ponownie.",
"AddCustomFormatError": "Nie można dodać nowego formatu niestandardowego, spróbuj ponownie.",
"AddDownloadClientError": "Nie można dodać nowego klienta pobierania, spróbuj ponownie.",
"AddImportListExclusionError": "Nie można dodać nowego wykluczenia listy, spróbuj ponownie.",
"AddImportListExclusionError": "Nie można dodać nowego wyjątku listy, spróbuj ponownie.",
"AddListError": "Nie można dodać nowej listy, spróbuj ponownie.",
"AddNotificationError": "Nie udało się dodać nowego powiadomienia, spróbuj później.",
"AddNotificationError": "Nie udało się dodać nowego powiadomienia, spróbuj ponownie.",
"CustomFormatsLoadError": "Nie można załadować formatów niestandardowych",
"DelayProfilesLoadError": "Nie można załadować profili opóźnień",
"DownloadClientOptionsLoadError": "Nie można załadować opcji klienta pobierania",
@@ -1045,7 +1045,7 @@
"CollectionShowOverviewsHelpText": "Pokaż przegląd kolekcji",
"TotalMovies": "Filmów całkowicie",
"RottenTomatoesRating": "Ocena Tomato",
"ApplicationUrlHelpText": "Zewnętrzny URL tej aplikacji zawierający http(s)://, port i adres URL",
"ApplicationUrlHelpText": "Zewnętrzny link tej aplikacji zawierający http(s)://, port i adres URL",
"ApplicationURL": "Link do aplikacji",
"File": "Plik",
"Language": "Język",
@@ -1065,22 +1065,22 @@
"DeleteImportListExclusionMessageText": "Czy na pewno chcesz usunąć to wykluczenie listy importu?",
"RemoveSelectedItemQueueMessageText": "Czy na pewno chcesz usunąć {0} element {1} z kolejki?",
"ApplyTagsHelpTextAdd": "Dodaj: dodaj tagi do istniejącej listy tagów",
"ApplyTagsHelpTextHowToApplyIndexers": "Jak zastosować tagi do wybranych indeksatorów",
"ApplyTagsHelpTextHowToApplyIndexers": "Jak stosować tagi do wybranych indekserów",
"ApplyTagsHelpTextRemove": "Usuń: usuń wprowadzone tagi",
"ApplyTagsHelpTextReplace": "Zastąp: Zastąp tagi wprowadzonymi tagami (nie wprowadzaj tagów, aby usunąć wszystkie tagi)",
"ApplyTagsHelpTextHowToApplyMovies": "Jak zastosować tagi do wybranych filmów",
"ApplyTagsHelpTextHowToApplyMovies": "Jak stosować tagi do wybranych filmów",
"ApplyChanges": "Zastosuj zmiany",
"AddCondition": "Dodaj warunek",
"AutoTagging": "Automatyczne tagowanie",
"AllTitles": "Wszystkie tytuły",
"ApplyTagsHelpTextHowToApplyImportLists": "Jak zastosować tagi do wybranych list",
"ApplyTagsHelpTextHowToApplyDownloadClients": "Jak",
"ApplyTagsHelpTextHowToApplyImportLists": "Jak stosować tagi do wybranych list importu",
"ApplyTagsHelpTextHowToApplyDownloadClients": "Jak stosować tagi do wybranych klientów pobierania",
"ApiKeyValidationHealthCheckMessage": "Zaktualizuj swój klucz API aby był długi na co najmniej {length} znaków. Możesz to zrobić poprzez ustawienia lub plik konfiguracyjny",
"AddAutoTag": "Dodaj automatyczne tagi",
"AutoTaggingNegateHelpText": "Jeśli zaznaczone, reguła automatycznego tagowania nie zostanie zastosowana, jeśli warunek {implementationName} zostanie spełniony.",
"AddConnection": "Dodaj połączenie",
"AddConditionImplementation": "Dodaj warunek {implementationName}",
"AddConnectionImplementation": "Dodaj Connection - {implementationName}",
"AddConnectionImplementation": "Dodaj połączenie - {implementationName}",
"AddDownloadClientImplementation": "Dodaj klienta pobierania - {implementationName}",
"No": "Nie",
"QueueLoadError": "Nie udało się załadować kolejki",
@@ -1094,7 +1094,7 @@
"BlocklistLoadError": "Nie można załadować czarnej listy",
"QualityCutoffNotMet": "Odcięcie jakości nie zostało osiągnięte",
"TablePageSizeHelpText": "Liczba elementów do pokazania na każdej stronie",
"AddIndexerImplementation": "Dodaj indeks - {implementationName}",
"AddIndexerImplementation": "Dodaj indekser - {implementationName}",
"RemoveQueueItemConfirmation": "Czy na pewno chcesz usunąć elementy ({0}) z kolejki?",
"Directory": "Folder",
"DeleteReleaseProfile": "Usuń profil opóźnienia",
@@ -1128,9 +1128,9 @@
"NotificationStatusSingleClientHealthCheckMessage": "Listy niedostępne z powodu błędów: {notificationNames}",
"Lists": "Listy",
"Yes": "tak",
"AddRootFolderError": "Nie można dodać folderu głównego",
"AddRootFolderError": "Nie udało się dodać folderu głównego",
"DelayingDownloadUntil": "Opóźnianie pobierania do {0} o {1}",
"AddListExclusion": "Dodaj wykluczenie z listy",
"AddListExclusion": "Dodaj wyjątek z listy",
"ConditionUsingRegularExpressions": "Ten warunek pasuje przy użyciu wyrażeń regularnych. Zwróć uwagę, że znaki {0} mają specjalne znaczenie i muszą być poprzedzone znakiem {1}",
"CustomFilter": "Filtry niestandardowe",
"DeleteSpecification": "Usuń powiadomienie",
@@ -1152,7 +1152,7 @@
"DeletedReasonMovieMissingFromDisk": "{appName} nie mógł znaleźć pliku na dysku, więc został usunięty",
"DeleteSelectedMovieFilesHelpText": "Czy na pewno chcesz usunąć wybrane pliki filmowe?",
"IMDbId": "Identyfikator TMDb",
"AddDelayProfileError": "Nie można dodać nowego profilu opóźnienia, spróbuj później.",
"AddDelayProfileError": "Nie można dodać nowego profilu opóźnienia, spróbuj ponownie.",
"MovieFileDeletedTooltip": "Usuń plik filmowy",
"DeleteMovieFolders": "Usuń folder filmu",
"DeleteMovieFoldersHelpText": "Usuń folder z filmami i jego zawartość",
@@ -1160,14 +1160,14 @@
"DeleteSelectedImportListExclusionsMessageText": "Czy na pewno chcesz usunąć to wykluczenie listy importu?",
"Any": "Dowolny",
"AddImportList": "Dodaj listę importu",
"AddImportListImplementation": "Dodaj Listę Importu - {implementationName}",
"AddImportListImplementation": "Dodaj listę importu - {implementationName}",
"AuthenticationRequired": "Wymagana Autoryzacja",
"AudioLanguages": "Języki Dźwięku",
"AuthenticationMethodHelpTextWarning": "Wybierz prawidłową metodę autoryzacji",
"AuthenticationMethod": "Metoda Autoryzacji",
"AppUpdatedVersion": "{appName} został zaktualizowany do wersji `{version}`, by uzyskać nowe zmiany należy przeładować {appName}",
"AddReleaseProfile": "Dodaj Profil Wydania",
"AppUpdated": "{appName} Zaktualizowany",
"AddReleaseProfile": "Dodaj profil wydania",
"AppUpdated": "{appName} zaktualizowany",
"Theme": "Motyw",
"AutoTaggingSpecificationTag": "Etykieta",
"EditReleaseProfile": "Dodaj Profil Wydania",
@@ -1239,5 +1239,77 @@
"AutomaticUpdatesDisabledDocker": "Automatyczne aktualizacje nie są bezpośrednio obsługiwane podczas korzystania z mechanizmu aktualizacji Docker. Konieczne będzie zaktualizowanie kontenera poza {appName} lub użycie skryptu",
"BlackholeWatchFolder": "Folder obserwowany",
"BlackholeWatchFolderHelpText": "Folder z którego {appName} powinien importować zakończone pobrania",
"CutoffUnmetNoItems": "Brak pozycji niespełniających wymagań"
"CutoffUnmetNoItems": "Brak pozycji niespełniających wymagań",
"DeleteSelectedCustomFormatsMessageText": "Czy na pewno chcesz usunąć {count} wybranych niestandardowych formatów?",
"DeleteSelectedImportLists": "Usuń listy importu",
"DeleteSelectedImportListsMessageText": "Czy na pewno chcesz usunąć {count} wybranych list importu?",
"DoNotBlocklistHint": "Usuń bez blokowania",
"DownloadClientDelugeSettingsDirectoryCompleted": "Katalog do przenoszenia po zakończeniu",
"DownloadClientDelugeValidationLabelPluginFailure": "Konfiguracja etykiety nie powiodła się",
"DownloadClientDelugeValidationLabelPluginInactive": "Plugin etykiet nie jest aktywowany",
"BlocklistReleaseHelpText": "Blokuje tą premierę przed ponownym pobraniem przez {appName} poprzez RSS albo automatyczne wyszukiwanie",
"BypassDelayIfAboveCustomFormatScoreHelpText": "Włącz pomijanie kiedy premiera ma wagę wyższą niż skonfigurowane minimum niestandardowego formatu",
"BypassDelayIfAboveCustomFormatScoreMinimumScoreHelpText": "Minimalna waga niestandardowego formatu wymagana by pominąć opóźnienie dla preferowanego protokołu",
"ChangeCategory": "Zmień kategorię",
"ChangeCategoryMultipleHint": "Zmień pobierania na 'Kategorię po imporcie' z klienta pobierania",
"Complete": "Zakończone",
"Completed": "Zakończone",
"ConnectionSettingsUrlBaseHelpText": "Dodaj prefix do URL {connectionName}, np. {url}",
"CustomFormatsSpecificationExceptLanguage": "Wyklucz język",
"CustomFormatsSpecificationExceptLanguageHelpText": "Dopasowuje jeżeli występuje jakikolwiek inny język poza wybranym",
"CustomFormatsSpecificationFlag": "Flaga",
"DefaultNotFoundMessage": "Musiałeś się zgubić, nic tutaj nie ma.",
"DeleteAutoTag": "Usuń automatyczny tag",
"DeleteImportList": "Usuń listę importu",
"Disposition": "Stan",
"DoNotBlocklist": "Nie blokuj",
"DownloadClientDelugeSettingsDirectory": "Katalog pobierania",
"DownloadClientDelugeSettingsDirectoryHelpText": "Opcjonalna lokalizacja dla pobrań, pozostaw puste by korzystać z domyślnej lokalizacji Deluge",
"DownloadClientDelugeValidationLabelPluginFailureDetail": "{appName} nie mógł dodać etykiety do {clientName}.",
"DownloadClientDownloadStationProviderMessage": "{appName} nie jest w stanie połączyć się ze stacją pobierania jeżeli dwuetapowa autoryzacja nie jest włączona w Twoim koncie DSM",
"DownloadClientDelugeValidationLabelPluginInactiveDetail": "Musisz mieć włączony plugin etykiet w {clientName} by korzystać z kategorii.",
"CustomFormatsSpecificationMaximumYear": "Maksymalny rok",
"CustomFormatsSpecificationMinimumSize": "Minimalny rozmiar",
"CustomFormatsSpecificationRegularExpression": "Wyrażenie regularne",
"CustomFormatsSpecificationRegularExpressionHelpText": "RegEx niestandardowego formatu nie rozróżnia wielkości liter",
"CutoffNotMet": "Limit nieosiągnięty",
"CinemaRelease": "Premiera kinowa",
"ClearBlocklist": "Wyczyść listę blokowania",
"ClickToChangeIndexerFlags": "Kliknij aby zmienić flagi indeksera",
"ClearBlocklistMessageText": "Czy na pewno chcesz wyczyścić wszystkie elementy listy blokowania?",
"CloneCondition": "Klonuj warunek",
"CloneAutoTag": "Klonuj automatyczny tag",
"CountCustomFormatsSelected": "Wybrano {count} niestandardowych formatów",
"CountImportListsSelected": "Wybrano {count} list importu",
"CountVotes": "{votes} głosów",
"DeleteCondition": "Usuń warunek",
"DeleteMovieFolderCountWithFilesConfirmation": "Czy na pewno chcesz usunąć {count} wybranych filmów i całą zawartość?",
"DeletedReasonManual": "Plik został usunięty przez {appName}, ręcznie lub przez API",
"DownloadClientDelugeTorrentStateError": "Deluge zgłasza błąd",
"DownloadClientDelugeSettingsDirectoryCompletedHelpText": "Opcjonalna lokalizacja do przenoszenia ukończonych pobrań, pozostaw puste by korzystać z domyślnej lokalizacji Deluge",
"BlocklistAndSearch": "Lista blokowania i wyszukiwanie",
"BlocklistAndSearchHint": "Rozpocznij wyszukiwanie po zamiennik po dodaniu do listy blokowania",
"BlocklistAndSearchMultipleHint": "Rozpocznij wyszukiwania po zamienniki po dodaniu do listy blokowania",
"BlocklistFilterHasNoItems": "Wybrane filtry listy blokowania nie zawierają pozycji",
"BlocklistMultipleOnlyHint": "Blokuj bez wyszukiwania zamienników",
"BlocklistOnly": "Tylko zablokuj",
"BlocklistOnlyHint": "Zablokuj bez szukania zamiennika",
"BlocklistedAt": "Zablokowany {date}",
"BypassDelayIfAboveCustomFormatScore": "Pomiń jeśli powyżej wagi niestandardowego formatu",
"ChangeCategoryHint": "Zmień pobieranie na 'Kategorię po imporcie' z klienta pobierania",
"ChownGroup": "Zmień grupę właściciela (chown)",
"CloneImportList": "Klonuj listę importu",
"CountMissingMoviesFromLibrary": "{count} brakujących filmów z biblioteki",
"CustomFormatJson": "JSON niestandardowego formatu",
"CustomFormatsSettingsTriggerInfo": "Niestandardowy format zostanie zastosowany do premiery lub pliku kiedy spełni co najmniej jeden z każdego typu wybranych warunków.",
"CustomFormatsSpecificationMaximumSizeHelpText": "Premiera musi mieć rozmiar mniejszy lub równy z tym",
"CustomFormatsSpecificationMinimumSizeHelpText": "Premiera musi być większa niż ten rozmiar",
"CustomFormatsSpecificationMinimumYear": "Minimalny rok",
"CustomFormatsSpecificationQualityModifier": "Modyfikator jakości",
"DayOfWeekAt": "{day} {time}",
"DelayMinutes": "{delay} minut",
"DelayProfileProtocol": "Protokół: {preferredProtocol}",
"DeleteMovieFolderCountConfirmation": "Czy na pewno chcesz usunąć {count} wybranych filmów?",
"DeleteMovieFolderMovieCount": "{movieFileCount} plików filmu o rozmiarze {size}",
"DeleteSelected": "Usuń wybrane"
}

View File

@@ -2036,5 +2036,6 @@
"NotificationsPushcutSettingsIncludePoster": "Добавить постер",
"NotificationsPushcutSettingsIncludePosterHelpText": "Добавляет постер в уведомление",
"NotificationsPushcutSettingsMetadataLinks": "Ссылки на метаданные",
"NotificationsPushcutSettingsMetadataLinksHelpText": "Добавляет ссылки на метаданные сериала при отправке уведомлений"
"NotificationsPushcutSettingsMetadataLinksHelpText": "Добавляет ссылки на метаданные сериала при отправке уведомлений",
"FilterMoviePropertiesOnlyNotFileWarning": "Фильтры доступны только для свойств фильма, они недоступны для свойств файл(ов), которые могут быть у вас для этого фильма."
}

View File

@@ -1,11 +1,21 @@
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
namespace NzbDrone.Core.MediaFiles
{
internal static class FileExtensions
public static class FileExtensions
{
private static List<string> _archiveExtensions = new List<string>
private static readonly Regex FileExtensionRegex = new (@"\.[a-z0-9]{2,4}$",
RegexOptions.IgnoreCase | RegexOptions.Compiled);
private static readonly HashSet<string> UsenetExtensions = new HashSet<string>()
{
".par2",
".nzb"
};
public static HashSet<string> ArchiveExtensions => new (StringComparer.OrdinalIgnoreCase)
{
".7z",
".bz2",
@@ -20,8 +30,7 @@ namespace NzbDrone.Core.MediaFiles
".tgz",
".zip"
};
private static List<string> _dangerousExtensions = new List<string>
public static HashSet<string> DangerousExtensions => new (StringComparer.OrdinalIgnoreCase)
{
".arj",
".lnk",
@@ -31,8 +40,7 @@ namespace NzbDrone.Core.MediaFiles
".vbs",
".zipx"
};
private static List<string> _executableExtensions = new List<string>
public static HashSet<string> ExecutableExtensions => new (StringComparer.OrdinalIgnoreCase)
{
".bat",
".cmd",
@@ -40,8 +48,20 @@ namespace NzbDrone.Core.MediaFiles
".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);
public static string RemoveFileExtension(string title)
{
title = FileExtensionRegex.Replace(title, m =>
{
var extension = m.Value.ToLower();
if (MediaFileExtensions.Extensions.Contains(extension) || UsenetExtensions.Contains(extension))
{
return string.Empty;
}
return m.Value;
});
return title;
}
}
}

View File

@@ -293,7 +293,7 @@ namespace NzbDrone.Core.MediaFiles.MediaInfo
private static string GetSceneNameMatch(string sceneName, params string[] tokens)
{
sceneName = sceneName.IsNotNullOrWhiteSpace() ? Parser.Parser.RemoveFileExtension(sceneName) : string.Empty;
sceneName = sceneName.IsNotNullOrWhiteSpace() ? FileExtensions.RemoveFileExtension(sceneName) : string.Empty;
foreach (var token in tokens)
{

View File

@@ -144,7 +144,7 @@ namespace NzbDrone.Core.MediaFiles.MovieImport.Manual
var downloadClientItem = GetTrackedDownload(downloadId)?.DownloadItem;
var finalReleaseGroup = releaseGroup.IsNullOrWhiteSpace()
? Parser.Parser.ParseReleaseGroup(path)
? ReleaseGroupParser.ParseReleaseGroup(path)
: releaseGroup;
var finalQuality = (quality?.Quality ?? Quality.Unknown) == Quality.Unknown ? QualityParser.ParseQuality(path) : quality;
var finalLanguages =
@@ -282,7 +282,7 @@ namespace NzbDrone.Core.MediaFiles.MovieImport.Manual
{
var localMovie = new LocalMovie();
localMovie.Path = file;
localMovie.ReleaseGroup = Parser.Parser.ParseReleaseGroup(file);
localMovie.ReleaseGroup = ReleaseGroupParser.ParseReleaseGroup(file);
localMovie.Quality = QualityParser.ParseQuality(file);
localMovie.Languages = LanguageParser.ParseLanguages(file);
localMovie.Size = _diskProvider.GetFileSize(file);
@@ -327,7 +327,7 @@ namespace NzbDrone.Core.MediaFiles.MovieImport.Manual
localMovie.Path = file;
localMovie.Quality = new QualityModel(Quality.Unknown);
localMovie.Languages = new List<Language> { Language.Unknown };
localMovie.ReleaseGroup = Parser.Parser.ParseReleaseGroup(file);
localMovie.ReleaseGroup = ReleaseGroupParser.ParseReleaseGroup(file);
localMovie.Size = _diskProvider.GetFileSize(file);
items.Add(MapItem(new ImportDecision(localMovie), rootFolder, null, null));

View File

@@ -14,7 +14,7 @@ namespace NzbDrone.Core.MediaFiles.MovieImport
if (!otherVideoFiles && downloadClientInfo != null)
{
return Parser.Parser.RemoveFileExtension(downloadClientInfo.ReleaseTitle);
return FileExtensions.RemoveFileExtension(downloadClientInfo.ReleaseTitle);
}
var fileName = Path.GetFileNameWithoutExtension(localMovie.Path.CleanFilePath());

View File

@@ -22,7 +22,7 @@ namespace NzbDrone.Core.MediaFiles.TorrentInfo
{
try
{
return Torrent.Load(fileContents).InfoHash.ToHex();
return Torrent.Load(fileContents).InfoHashes.V1OrV2.ToHex();
}
catch
{

View File

@@ -268,6 +268,7 @@ namespace NzbDrone.Core.Organizer
tokenHandlers["{Movie Certification}"] = m => movie.MovieMetadata.Value.Certification ?? string.Empty;
tokenHandlers["{Movie Collection}"] = m => Truncate(movie.MovieMetadata.Value.CollectionTitle, m.CustomFormat) ?? string.Empty;
tokenHandlers["{Movie CollectionThe}"] = m => Truncate(TitleThe(movie.MovieMetadata.Value.CollectionTitle), m.CustomFormat) ?? string.Empty;
}
private string GetLanguageTitle(Movie movie, string isoCodes)

View File

@@ -6,6 +6,7 @@ using System.Text.RegularExpressions;
using NLog;
using NzbDrone.Common.Extensions;
using NzbDrone.Common.Instrumentation;
using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.Parser.Model;
namespace NzbDrone.Core.Parser
@@ -21,8 +22,6 @@ namespace NzbDrone.Core.Parser
private static readonly Regex HardcodedSubsRegex = new Regex(@"\b((?<hcsub>(\w+(?<!SOFT|MULTI|HORRIBLE)SUBS?))|(?<hc>(HC|SUBBED)))\b",
RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);
private static readonly RegexReplace[] PreSubstitutionRegex = Array.Empty<RegexReplace>();
private static readonly Regex[] ReportMovieTitleRegex = new[]
{
// Anime [Subgroup] and Year
@@ -110,9 +109,6 @@ namespace NzbDrone.Core.Parser
private static readonly Regex NormalizeRegex = new Regex(@"((?:\b|_)(?<!^|[^a-zA-Z0-9_']\w[^a-zA-Z0-9_'])([aà](?!$|[^a-zA-Z0-9_']\w[^a-zA-Z0-9_'])|an|the|and|or|of)(?!$)(?:\b|_))|\W|_",
RegexOptions.IgnoreCase | RegexOptions.Compiled);
private static readonly Regex FileExtensionRegex = new Regex(@"\.[a-z0-9]{2,4}$",
RegexOptions.IgnoreCase | RegexOptions.Compiled);
private static readonly Regex ReportImdbId = new Regex(@"(?<imdbid>tt\d{7,8})", RegexOptions.IgnoreCase | RegexOptions.Compiled);
private static readonly Regex ReportTmdbId = new Regex(@"tmdb(id)?-(?<tmdbid>\d+)", RegexOptions.IgnoreCase | RegexOptions.Compiled);
@@ -123,44 +119,13 @@ namespace NzbDrone.Core.Parser
private static readonly Regex SimpleReleaseTitleRegex = new Regex(@"\s*(?:[<>?*|])", RegexOptions.Compiled | RegexOptions.IgnoreCase);
// Valid TLDs http://data.iana.org/TLD/tlds-alpha-by-domain.txt
private static readonly RegexReplace WebsitePrefixRegex = new RegexReplace(@"^(?:(?:\[|\()\s*)?(?:www\.)?[-a-z0-9-]{1,256}\.(?<!Naruto-Kun\.)(?:[a-z]{2,6}\.[a-z]{2,6}|xn--[a-z0-9-]{4,}|[a-z]{2,})\b(?:\s*(?:\]|\))|[ -]{2,})[ -]*",
string.Empty,
RegexOptions.IgnoreCase | RegexOptions.Compiled);
private static readonly RegexReplace WebsitePostfixRegex = new RegexReplace(@"(?:\[\s*)?(?:www\.)?[-a-z0-9-]{1,256}\.(?:xn--[a-z0-9-]{4,}|[a-z]{2,6})\b(?:\s*\])$",
string.Empty,
RegexOptions.IgnoreCase | RegexOptions.Compiled);
private static readonly RegexReplace CleanReleaseGroupRegex = new RegexReplace(@"(-(RP|1|NZBGeek|Obfuscated|Obfuscation|Scrambled|sample|Pre|postbot|xpost|Rakuv[a-z0-9]*|WhiteRev|BUYMORE|AsRequested|AlternativeToRequested|GEROV|Z0iDS3N|Chamele0n|4P|4Planet|AlteZachen|RePACKPOST))+$",
string.Empty,
RegexOptions.IgnoreCase | RegexOptions.Compiled);
private static readonly RegexReplace CleanTorrentSuffixRegex = new RegexReplace(@"\[(?:ettv|rartv|rarbg|cttv|publichd)\]$",
string.Empty,
RegexOptions.IgnoreCase | RegexOptions.Compiled);
private static readonly Regex CleanQualityBracketsRegex = new Regex(@"\[[a-z0-9 ._-]+\]$",
RegexOptions.IgnoreCase | RegexOptions.Compiled);
private static readonly Regex ReleaseGroupRegex = new Regex(@"-(?<releasegroup>[a-z0-9]+(?<part2>-[a-z0-9]+)?(?!.+?(?:480p|576p|720p|1080p|2160p)))(?<!(?:WEB-(DL|Rip)|Blu-Ray|480p|576p|720p|1080p|2160p|DTS-HD|DTS-X|DTS-MA|DTS-ES|-ES|-EN|-CAT|-ENG|-JAP|-GER|-FRA|-FRE|-ITA|-HDRip|\d{1,2}-bit|[ ._]\d{4}-\d{2}|-\d{2}|tmdb(id)?-(?<tmdbid>\d+)|(?<imdbid>tt\d{7,8}))(?:\k<part2>)?)(?:\b|[-._ ]|$)|[-._ ]\[(?<releasegroup>[a-z0-9]+)\]$",
RegexOptions.IgnoreCase | RegexOptions.Compiled);
private static readonly Regex InvalidReleaseGroupRegex = new Regex(@"^([se]\d+|[0-9a-f]{8})$", RegexOptions.IgnoreCase | RegexOptions.Compiled);
private static readonly Regex AnimeReleaseGroupRegex = new Regex(@"^(?:\[(?<subgroup>(?!\s).+?(?<!\s))\](?:_|-|\s|\.)?)",
RegexOptions.IgnoreCase | RegexOptions.Compiled);
private static readonly Regex YearInTitleRegex = new Regex(@"^(?<title>.+?)(?:\W|_.)?[\(\[]?(?<year>\d{4})[\]\)]?",
RegexOptions.IgnoreCase | RegexOptions.Compiled);
// Handle Exception Release Groups that don't follow -RlsGrp; Manual List
// groups whose releases end with RlsGroup) or RlsGroup]
private static readonly Regex ExceptionReleaseGroupRegex = new Regex(@"(?<=[._ \[])(?<releasegroup>(Silence|afm72|Panda|Ghost|MONOLITH|Tigole|Joy|ImE|UTR|t3nzin|Anime Time|Project Angel|Hakata Ramen|HONE|Vyndros|SEV|Garshasp|Kappa|Natty|RCVR|SAMPA|YOGI|r00t|EDGE2020|RZeroX|FreetheFish|Anna|Bandi|Qman|theincognito|HDO|DusIctv|DHD|CtrlHD|-ZR-|ADC|XZVN|RH|Kametsu|Garshasp)(?=\]|\)))", RegexOptions.IgnoreCase | RegexOptions.Compiled);
// Handle Exception Release Groups that don't follow -RlsGrp; Manual List
// name only...BE VERY CAREFUL WITH THIS, HIGH CHANCE OF FALSE POSITIVES
private static readonly Regex ExceptionReleaseGroupRegexExact = new Regex(@"\b(?<releasegroup>KRaLiMaRKo|E\.N\.D|D\-Z0N3|Koten_Gars|BluDragon|ZØNEHD|Tigole|HQMUX|VARYG|YIFY|YTS(.(MX|LT|AG))?|TMd|Eml HDTeam|LMain|DarQ|BEN THE MEN)\b", RegexOptions.IgnoreCase | RegexOptions.Compiled);
private static readonly Regex SpecialCharRegex = new Regex(@"(\&|\:|\\|\/)+", RegexOptions.Compiled);
private static readonly Regex PunctuationRegex = new Regex(@"[^\w\s]", RegexOptions.Compiled);
private static readonly Regex ArticleWordRegex = new Regex(@"^(a|an|the)\s", RegexOptions.IgnoreCase | RegexOptions.Compiled);
@@ -215,7 +180,7 @@ namespace NzbDrone.Core.Parser
if (ReversedTitleRegex.IsMatch(title))
{
var titleWithoutExtension = RemoveFileExtension(title).ToCharArray();
var titleWithoutExtension = FileExtensions.RemoveFileExtension(title).ToCharArray();
Array.Reverse(titleWithoutExtension);
title = $"{titleWithoutExtension}{title.Substring(titleWithoutExtension.Length)}";
@@ -223,14 +188,14 @@ namespace NzbDrone.Core.Parser
Logger.Debug("Reversed name detected. Converted to '{0}'", title);
}
var releaseTitle = RemoveFileExtension(title);
var releaseTitle = FileExtensions.RemoveFileExtension(title);
// Trim dashes from end
releaseTitle = releaseTitle.Trim('-', '_');
releaseTitle = releaseTitle.Replace("【", "[").Replace("】", "]");
foreach (var replace in PreSubstitutionRegex)
foreach (var replace in ParserCommon.PreSubstitutionRegex)
{
if (replace.TryReplace(ref releaseTitle))
{
@@ -242,10 +207,10 @@ namespace NzbDrone.Core.Parser
var simpleTitle = SimpleTitleRegex.Replace(releaseTitle);
// TODO: Quick fix stripping [url] - prefixes.
simpleTitle = WebsitePrefixRegex.Replace(simpleTitle);
simpleTitle = WebsitePostfixRegex.Replace(simpleTitle);
simpleTitle = ParserCommon.WebsitePrefixRegex.Replace(simpleTitle);
simpleTitle = ParserCommon.WebsitePostfixRegex.Replace(simpleTitle);
simpleTitle = CleanTorrentSuffixRegex.Replace(simpleTitle);
simpleTitle = ParserCommon.CleanTorrentSuffixRegex.Replace(simpleTitle);
simpleTitle = CleanQualityBracketsRegex.Replace(simpleTitle, m =>
{
@@ -295,7 +260,7 @@ namespace NzbDrone.Core.Parser
}
}
result.ReleaseGroup = ParseReleaseGroup(simpleReleaseTitle);
result.ReleaseGroup = ReleaseGroupParser.ParseReleaseGroup(simpleReleaseTitle);
var subGroup = GetSubGroup(match);
if (!subGroup.IsNullOrWhiteSpace())
@@ -521,74 +486,6 @@ namespace NzbDrone.Core.Parser
return null;
}
public static string ParseReleaseGroup(string title)
{
title = title.Trim();
title = RemoveFileExtension(title);
title = WebsitePrefixRegex.Replace(title);
title = CleanTorrentSuffixRegex.Replace(title);
var animeMatch = AnimeReleaseGroupRegex.Match(title);
if (animeMatch.Success)
{
return animeMatch.Groups["subgroup"].Value;
}
title = CleanReleaseGroupRegex.Replace(title);
var exceptionReleaseGroupRegex = ExceptionReleaseGroupRegex.Matches(title);
if (exceptionReleaseGroupRegex.Count != 0)
{
return exceptionReleaseGroupRegex.OfType<Match>().Last().Groups["releasegroup"].Value;
}
var exceptionExactMatch = ExceptionReleaseGroupRegexExact.Matches(title);
if (exceptionExactMatch.Count != 0)
{
return exceptionExactMatch.OfType<Match>().Last().Groups["releasegroup"].Value;
}
var matches = ReleaseGroupRegex.Matches(title);
if (matches.Count != 0)
{
var group = matches.OfType<Match>().Last().Groups["releasegroup"].Value;
if (int.TryParse(group, out _))
{
return null;
}
if (InvalidReleaseGroupRegex.IsMatch(group))
{
return null;
}
return group;
}
return null;
}
public static string RemoveFileExtension(string title)
{
title = FileExtensionRegex.Replace(title, m =>
{
var extension = m.Value.ToLower();
if (MediaFiles.MediaFileExtensions.Extensions.Contains(extension) || new[] { ".par2", ".nzb" }.Contains(extension))
{
return string.Empty;
}
return m.Value;
});
return title;
}
public static bool HasMultipleLanguages(string title)
{
return MultiRegex.IsMatch(title);
@@ -697,7 +594,7 @@ namespace NzbDrone.Core.Parser
return false;
}
var titleWithoutExtension = RemoveFileExtension(title);
var titleWithoutExtension = FileExtensions.RemoveFileExtension(title);
if (RejectHashedReleasesRegex.Any(v => v.IsMatch(titleWithoutExtension)))
{

View File

@@ -0,0 +1,23 @@
using System.Text.RegularExpressions;
namespace NzbDrone.Core.Parser;
// These are functions shared between different parser functions
// they are not intended to be used outside of them parsing.
internal static class ParserCommon
{
internal static readonly RegexReplace[] PreSubstitutionRegex = System.Array.Empty<RegexReplace>();
// Valid TLDs http://data.iana.org/TLD/tlds-alpha-by-domain.txt
internal static readonly RegexReplace WebsitePrefixRegex = new (@"^(?:(?:\[|\()\s*)?(?:www\.)?[-a-z0-9-]{1,256}\.(?<!Naruto-Kun\.)(?:[a-z]{2,6}\.[a-z]{2,6}|xn--[a-z0-9-]{4,}|[a-z]{2,})\b(?:\s*(?:\]|\))|[ -]{2,})[ -]*",
string.Empty,
RegexOptions.IgnoreCase | RegexOptions.Compiled);
internal static readonly RegexReplace WebsitePostfixRegex = new (@"(?:\[\s*)?(?:www\.)?[-a-z0-9-]{1,256}\.(?:xn--[a-z0-9-]{4,}|[a-z]{2,6})\b(?:\s*\])$",
string.Empty,
RegexOptions.IgnoreCase | RegexOptions.Compiled);
internal static readonly RegexReplace CleanTorrentSuffixRegex = new (@"\[(?:ettv|rartv|rarbg|cttv|publichd)\]$",
string.Empty,
RegexOptions.IgnoreCase | RegexOptions.Compiled);
}

View File

@@ -0,0 +1,87 @@
using System.Linq;
using System.Text.RegularExpressions;
using NzbDrone.Core.MediaFiles;
namespace NzbDrone.Core.Parser;
public static class ReleaseGroupParser
{
private static readonly Regex ReleaseGroupRegex = new (@"-(?<releasegroup>[a-z0-9]+(?<part2>-[a-z0-9]+)?(?!.+?(?:480p|576p|720p|1080p|2160p)))(?<!(?:WEB-(DL|Rip)|Blu-Ray|480p|576p|720p|1080p|2160p|DTS-HD|DTS-X|DTS-MA|DTS-ES|-ES|-EN|-CAT|-ENG|-JAP|-GER|-FRA|-FRE|-ITA|-HDRip|\d{1,2}-bit|[ ._]\d{4}-\d{2}|-\d{2}|tmdb(id)?-(?<tmdbid>\d+)|(?<imdbid>tt\d{7,8}))(?:\k<part2>)?)(?:\b|[-._ ]|$)|[-._ ]\[(?<releasegroup>[a-z0-9]+)\]$",
RegexOptions.IgnoreCase | RegexOptions.Compiled);
private static readonly Regex InvalidReleaseGroupRegex = new (@"^([se]\d+|[0-9a-f]{8})$", RegexOptions.IgnoreCase | RegexOptions.Compiled);
private static readonly Regex AnimeReleaseGroupRegex = new (@"^(?:\[(?<subgroup>(?!\s).+?(?<!\s))\](?:_|-|\s|\.)?)",
RegexOptions.IgnoreCase | RegexOptions.Compiled);
// Handle Exception Release Groups that don't follow -RlsGrp; Manual List
// name only...be very careful with this last; high chance of false positives
private static readonly Regex ExceptionReleaseGroupRegexExact = new (@"\b(?<releasegroup>KRaLiMaRKo|E\.N\.D|D\-Z0N3|Koten_Gars|BluDragon|ZØNEHD|HQMUX|VARYG|YIFY|YTS(.(MX|LT|AG))?|TMd|Eml HDTeam|LMain|DarQ|BEN THE MEN|TAoE|QxR|126811)\b", RegexOptions.IgnoreCase | RegexOptions.Compiled);
// groups whose releases end with RlsGroup) or RlsGroup]
private static readonly Regex ExceptionReleaseGroupRegex = new (@"(?<=[._ \[])(?<releasegroup>(Silence|afm72|Panda|Ghost|MONOLITH|Tigole|Joy|ImE|UTR|t3nzin|Anime Time|Project Angel|Hakata Ramen|HONE|Vyndros|SEV|Garshasp|Kappa|Natty|RCVR|SAMPA|YOGI|r00t|EDGE2020|RZeroX|FreetheFish|Anna|Bandi|Qman|theincognito|HDO|DusIctv|DHD|CtrlHD|-ZR-|ADC|XZVN|RH|Kametsu)(?=\]|\)))", RegexOptions.IgnoreCase | RegexOptions.Compiled);
private static readonly RegexReplace CleanReleaseGroupRegex = new (@"(-(RP|1|NZBGeek|Obfuscated|Obfuscation|Scrambled|sample|Pre|postbot|xpost|Rakuv[a-z0-9]*|WhiteRev|BUYMORE|AsRequested|AlternativeToRequested|GEROV|Z0iDS3N|Chamele0n|4P|4Planet|AlteZachen|RePACKPOST))+$",
string.Empty,
RegexOptions.IgnoreCase | RegexOptions.Compiled);
public static string ParseReleaseGroup(string title)
{
title = title.Trim();
title = FileExtensions.RemoveFileExtension(title);
foreach (var replace in ParserCommon.PreSubstitutionRegex)
{
if (replace.TryReplace(ref title))
{
break;
}
}
title = ParserCommon.WebsitePrefixRegex.Replace(title);
title = ParserCommon.CleanTorrentSuffixRegex.Replace(title);
var animeMatch = AnimeReleaseGroupRegex.Match(title);
if (animeMatch.Success)
{
return animeMatch.Groups["subgroup"].Value;
}
title = CleanReleaseGroupRegex.Replace(title);
var exceptionExactMatch = ExceptionReleaseGroupRegexExact.Matches(title);
if (exceptionExactMatch.Count != 0)
{
return exceptionExactMatch.OfType<Match>().Last().Groups["releasegroup"].Value;
}
var exceptionReleaseGroupRegex = ExceptionReleaseGroupRegex.Matches(title);
if (exceptionReleaseGroupRegex.Count != 0)
{
return exceptionReleaseGroupRegex.OfType<Match>().Last().Groups["releasegroup"].Value;
}
var matches = ReleaseGroupRegex.Matches(title);
if (matches.Count != 0)
{
var group = matches.OfType<Match>().Last().Groups["releasegroup"].Value;
if (int.TryParse(group, out _))
{
return null;
}
if (InvalidReleaseGroupRegex.IsMatch(group))
{
return null;
}
return group;
}
return null;
}
}

View File

@@ -13,19 +13,19 @@
<PackageReference Include="Polly" Version="8.6.0" />
<PackageReference Include="Servarr.FFMpegCore" Version="4.7.0-26" />
<PackageReference Include="Servarr.FFprobe" Version="5.1.4.112" />
<PackageReference Include="System.Drawing.Common" Version="8.0.20" />
<PackageReference Include="System.Memory" Version="4.6.3" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageReference Include="Servarr.FluentMigrator.Runner" Version="3.3.2.9" />
<PackageReference Include="Servarr.FluentMigrator.Runner.SQLite" Version="3.3.2.9" />
<PackageReference Include="Servarr.FluentMigrator.Runner.Postgres" Version="3.3.2.9" />
<PackageReference Include="FluentMigrator.Runner.Core" Version="6.2.0" />
<PackageReference Include="FluentMigrator.Runner.SQLite" Version="6.2.0" />
<PackageReference Include="FluentMigrator.Runner.Postgres" Version="6.2.0" />
<PackageReference Include="FluentValidation" Version="9.5.4" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.11" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NLog" Version="5.4.0" />
<PackageReference Include="System.Data.SQLite.Core.Servarr" Version="1.0.115.5-18" />
<PackageReference Include="MonoTorrent" Version="2.0.7" />
<PackageReference Include="MonoTorrent" Version="3.0.2" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="8.0.0" />
<PackageReference Include="System.Text.Json" Version="8.0.5" />
</ItemGroup>

View File

@@ -5,7 +5,7 @@
<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.12.1" />
<PackageReference Include="FluentValidation" Version="9.5.4" />
<PackageReference Include="Moq" Version="4.17.2" />
<PackageReference Include="Moq" Version="4.18.4" />
<PackageReference Include="NLog" Version="5.4.0" />
<PackageReference Include="NUnit" Version="3.14.0" />
<PackageReference Include="RestSharp" Version="106.15.0" />

View File

@@ -4,7 +4,7 @@
<DataCollectors>
<DataCollector friendlyName="XPlat code coverage">
<Configuration>
<Format>opencover</Format>
<Format>cobertura</Format>
<Exclude>[Radarr.*.Test]*,[Radarr.Test.*]*,[Radarr.Api*]*,[Marr.Data]*,[MonoTorrent]*</Exclude>
</Configuration>
</DataCollector>

View File

@@ -4875,10 +4875,10 @@ ms@^2.1.1, ms@^2.1.3:
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2"
integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==
nanoid@^3.3.7:
version "3.3.7"
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.7.tgz#d0c301a691bc8d54efa0a2226ccf3fe2fd656bd8"
integrity sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==
nanoid@^3.3.11, nanoid@^3.3.8:
version "3.3.11"
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.11.tgz#4f4f112cefbe303202f2199838128936266d185b"
integrity sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==
natural-compare@^1.4.0:
version "1.4.0"
@@ -5211,12 +5211,7 @@ performance-now@^2.1.0:
resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b"
integrity sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==
picocolors@^1.0.0, picocolors@^1.0.1, picocolors@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.0.tgz#5358b76a78cde483ba5cef6a9dc9671440b27d59"
integrity sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw==
picocolors@^1.1.1:
picocolors@^1.0.0, picocolors@^1.0.1, picocolors@^1.1.0, picocolors@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.1.tgz#3d321af3eab939b083c8f929a1d12cda81c26b6b"
integrity sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==
@@ -5402,13 +5397,13 @@ postcss-value-parser@^4.1.0, postcss-value-parser@^4.2.0:
resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz#723c09920836ba6d3e5af019f92bc0971c02e514"
integrity sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==
postcss@8.4.47, postcss@^8.0.0, postcss@^8.4.19, postcss@^8.4.21, postcss@^8.4.23, postcss@^8.4.32:
version "8.4.47"
resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.47.tgz#5bf6c9a010f3e724c503bf03ef7947dcb0fea365"
integrity sha512-56rxCq7G/XfB4EkXq9Egn5GCqugWvDFjafDOThIdMBsI15iqPqR5r15TfSr1YPYeEI19YeaXMCbY6u88Y76GLQ==
postcss@8.5.6:
version "8.5.6"
resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.5.6.tgz#2825006615a619b4f62a9e7426cc120b349a8f3c"
integrity sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==
dependencies:
nanoid "^3.3.7"
picocolors "^1.1.0"
nanoid "^3.3.11"
picocolors "^1.1.1"
source-map-js "^1.2.1"
postcss@^6.0.23:
@@ -5420,6 +5415,15 @@ postcss@^6.0.23:
source-map "^0.6.1"
supports-color "^5.4.0"
postcss@^8.0.0, postcss@^8.4.19, postcss@^8.4.21, postcss@^8.4.23, postcss@^8.4.32:
version "8.5.0"
resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.5.0.tgz#15244b9fd65f809b2819682456f0e7e1e30c145b"
integrity sha512-27VKOqrYfPncKA2NrFOVhP5MGAfHKLYn/Q0mz9cNQyRAKYi3VNHwYU2qKKqPCqgBmeeJ0uAFB56NumXZ5ZReXg==
dependencies:
nanoid "^3.3.8"
picocolors "^1.1.1"
source-map-js "^1.2.1"
prefix-style@2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/prefix-style/-/prefix-style-2.0.1.tgz#66bba9a870cfda308a5dc20e85e9120932c95a06"