New: Option to Import via Script

(cherry picked from commit 9f1e2151206a077334a9c34a12a373b465752d87)
pull/8632/head
JeWe37 1 year ago committed by Bogdan
parent 53857083f2
commit 0b4c12dd7b

@ -63,29 +63,29 @@ class MediaManagement extends Component {
<NamingConnector />
{
isFetching &&
isFetching ?
<FieldSet legend={translate('NamingSettings')}>
<LoadingIndicator />
</FieldSet>
</FieldSet> : null
}
{
!isFetching && error &&
!isFetching && error ?
<FieldSet legend={translate('NamingSettings')}>
<div>
{translate('UnableToLoadMediaManagementSettings')}
</div>
</FieldSet>
</FieldSet> : null
}
{
hasSettings && !isFetching && !error &&
hasSettings && !isFetching && !error ?
<Form
id="mediaManagementSettings"
{...otherProps}
>
{
advancedSettings &&
advancedSettings ?
<FieldSet legend={translate('Folders')}>
<FormGroup
advancedSettings={advancedSettings}
@ -120,11 +120,11 @@ class MediaManagement extends Component {
{...settings.deleteEmptyFolders}
/>
</FormGroup>
</FieldSet>
</FieldSet> : null
}
{
advancedSettings &&
advancedSettings ?
<FieldSet
legend={translate('Importing')}
>
@ -181,6 +181,41 @@ class MediaManagement extends Component {
/>
</FormGroup>
<FormGroup
advancedSettings={advancedSettings}
isAdvanced={true}
size={sizes.MEDIUM}
>
<FormLabel>{translate('ImportUsingScript')}</FormLabel>
<FormInputGroup
type={inputTypes.CHECK}
name="useScriptImport"
helpText={translate('UseScriptImportHelpText')}
onChange={onInputChange}
{...settings.useScriptImport}
/>
</FormGroup>
{
settings.useScriptImport.value ?
<FormGroup
advancedSettings={advancedSettings}
isAdvanced={true}
>
<FormLabel>{translate('ImportScriptPath')}</FormLabel>
<FormInputGroup
type={inputTypes.PATH}
includeFiles={true}
name="scriptImportPath"
helpText={translate('ScriptImportPathHelpText')}
onChange={onInputChange}
{...settings.scriptImportPath}
/>
</FormGroup> : null
}
<FormGroup size={sizes.MEDIUM}>
<FormLabel>{translate('ImportExtraFiles')}</FormLabel>
@ -194,7 +229,7 @@ class MediaManagement extends Component {
</FormGroup>
{
settings.importExtraFiles.value &&
settings.importExtraFiles.value ?
<FormGroup
advancedSettings={advancedSettings}
isAdvanced={true}
@ -211,9 +246,9 @@ class MediaManagement extends Component {
onChange={onInputChange}
{...settings.extraFileExtensions}
/>
</FormGroup>
</FormGroup> : null
}
</FieldSet>
</FieldSet> : null
}
<FieldSet
@ -339,7 +374,7 @@ class MediaManagement extends Component {
</FieldSet>
{
advancedSettings && !isWindows &&
advancedSettings && !isWindows ?
<FieldSet
legend={translate('Permissions')}
>
@ -392,9 +427,9 @@ class MediaManagement extends Component {
{...settings.chownGroup}
/>
</FormGroup>
</FieldSet>
</FieldSet> : null
}
</Form>
</Form> : null
}
<FieldSet legend={translate('RootFolders')}>

@ -266,6 +266,20 @@ namespace NzbDrone.Core.Configuration
set { SetValue("EnableMediaInfo", value); }
}
public bool UseScriptImport
{
get { return GetValueBoolean("UseScriptImport", false); }
set { SetValue("UseScriptImport", value); }
}
public string ScriptImportPath
{
get { return GetValue("ScriptImportPath"); }
set { SetValue("ScriptImportPath", value); }
}
public bool ImportExtraFiles
{
get { return GetValueBoolean("ImportExtraFiles", false); }

@ -35,6 +35,8 @@ namespace NzbDrone.Core.Configuration
int MinimumFreeSpaceWhenImporting { get; set; }
bool CopyUsingHardlinks { get; set; }
bool EnableMediaInfo { get; set; }
bool UseScriptImport { get; set; }
string ScriptImportPath { get; set; }
bool ImportExtraFiles { get; set; }
string ExtraFileExtensions { get; set; }
RescanAfterRefreshType RescanAfterRefresh { get; set; }

@ -7,12 +7,9 @@
"AddCustomFormat": "Add Custom Format",
"AddDelayProfile": "Add Delay Profile",
"AddDownloadClient": "Add Download Client",
"Added": "Added",
"AddedToDownloadQueue": "Added to download queue",
"AddExclusion": "Add Exclusion",
"AddImportExclusionHelpText": "Prevent movie from being added to Radarr by lists",
"AddIndexer": "Add Indexer",
"AddingTag": "Adding tag",
"AddList": "Add List",
"AddListExclusion": "Add List Exclusion",
"AddMovie": "Add Movie",
@ -27,18 +24,21 @@
"AddRestriction": "Add Restriction",
"AddRootFolder": "Add Root Folder",
"AddToDownloadQueue": "Add to download queue",
"Added": "Added",
"AddedToDownloadQueue": "Added to download queue",
"AddingTag": "Adding tag",
"AfterManualRefresh": "After Manual Refresh",
"Age": "Age",
"Agenda": "Agenda",
"AgeWhenGrabbed": "Age (when grabbed)",
"Agenda": "Agenda",
"All": "All",
"AllCollectionsHiddenDueToFilter": "All collections are hidden due to applied filter.",
"AllFiles": "All Files",
"AllMoviesHiddenDueToFilter": "All movies are hidden due to applied filter.",
"AllMoviesInPathHaveBeenImported": "All movies in {0} have been imported",
"AllResultsHiddenFilter": "All results are hidden by the applied filter",
"AllowHardcodedSubs": "Allow Hardcoded Subs",
"AllowHardcodedSubsHelpText": "Detected hardcoded subs will be automatically downloaded",
"AllResultsHiddenFilter": "All results are hidden by the applied filter",
"AlreadyInYourLibrary": "Already in your library",
"AlternativeTitle": "Alternative Title",
"Always": "Always",
@ -72,14 +72,14 @@
"AsAllDayHelpText": "Events will appear as all-day events in your calendar",
"AudioInfo": "Audio Info",
"AuthBasic": "Basic (Browser Popup)",
"AuthForm": "Forms (Login Page)",
"Authentication": "Authentication",
"AuthenticationMethodHelpText": "Require Username and Password to access Radarr",
"AuthForm": "Forms (Login Page)",
"Auto": "Auto",
"Automatic": "Automatic",
"AutomaticSearch": "Automatic Search",
"AutoRedownloadFailedHelpText": "Automatically search for and attempt to download a different release",
"AutoUnmonitorPreviouslyDownloadedMoviesHelpText": "Movies deleted from the disk are automatically unmonitored in Radarr",
"Automatic": "Automatic",
"AutomaticSearch": "Automatic Search",
"AvailabilityDelay": "Availability Delay",
"AvailabilityDelayHelpText": "Amount of time before or after available date to search for Movie",
"Backup": "Backup",
@ -92,10 +92,10 @@
"BindAddress": "Bind Address",
"BindAddressHelpText": "Valid IP address, localhost or '*' for all interfaces",
"Blocklist": "Blocklist",
"Blocklisted": "Blocklisted",
"BlocklistHelpText": "Prevents Radarr from automatically grabbing this release again",
"BlocklistRelease": "Blocklist Release",
"BlocklistReleases": "Blocklist Releases",
"Blocklisted": "Blocklisted",
"Branch": "Branch",
"BranchUpdate": "Branch to use to update Radarr",
"BranchUpdateMechanism": "Branch used by external update mechanism",
@ -110,12 +110,12 @@
"CancelProcessing": "Cancel Processing",
"CantFindMovie": "Why can't I find my movie?",
"Cast": "Cast",
"CertValidationNoLocal": "Disabled for Local Addresses",
"CertificateValidation": "Certificate Validation",
"CertificateValidationHelpText": "Change how strict HTTPS certification validation is. Do not change unless you understand the risks.",
"Certification": "Certification",
"CertificationCountry": "Certification Country",
"CertificationCountryHelpText": "Select Country for Movie Certifications",
"CertValidationNoLocal": "Disabled for Local Addresses",
"ChangeFileDate": "Change File Date",
"ChangeHasNotBeenSavedYet": "Change has not been saved yet",
"CheckDownloadClientForDetails": "check download client for more details",
@ -143,10 +143,10 @@
"CloseCurrentModal": "Close Current Modal",
"Collection": "Collection",
"CollectionOptions": "Collection Options",
"Collections": "Collections",
"CollectionShowDetailsHelpText": "Show collection status and properties",
"CollectionShowOverviewsHelpText": "Show collection overviews",
"CollectionShowPostersHelpText": "Show Collection item posters",
"Collections": "Collections",
"CollectionsSelectedInterp": "{0} Collections(s) Selected",
"ColonReplacement": "Colon Replacement",
"ColonReplacementFormatHelpText": "Change how Radarr handles colon replacement",
@ -155,13 +155,13 @@
"Component": "Component",
"Conditions": "Conditions",
"Connect": "Connect",
"ConnectSettings": "Connect Settings",
"ConnectSettingsSummary": "Notifications, connections to media servers/players, and custom scripts",
"Connection": "Connection",
"ConnectionLost": "Connection Lost",
"ConnectionLostAutomaticMessage": "Radarr will try to connect automatically, or you can click reload below.",
"ConnectionLostMessage": "Radarr has lost its connection to the backend and will need to be reloaded to restore functionality.",
"Connections": "Connections",
"ConnectSettings": "Connect Settings",
"ConnectSettingsSummary": "Notifications, connections to media servers/players, and custom scripts",
"ConsideredAvailable": "Considered Available",
"CopyToClipboard": "Copy to Clipboard",
"CopyUsingHardlinksHelpText": "Hardlinks allow Radarr to import seeding torrents to the movie folder without taking extra disk space or copying the entire contents of the file. Hardlinks will only work if the source and destination are on the same volume",
@ -178,35 +178,33 @@
"CustomFormat": "Custom Format",
"CustomFormatHelpText": "Radarr scores each release using the sum of scores for matching custom formats. If a new release would improve the score, at the same or better quality, then Radarr will grab it.",
"CustomFormatJSON": "Custom Format JSON",
"CustomFormats": "Custom Formats",
"CustomFormatScore": "Custom Format Score",
"CustomFormatsSettings": "Custom Formats Settings",
"CustomFormatsSettingsSummary": "Custom Formats and Settings",
"CustomFormatUnknownCondition": "Unknown Custom Format condition '{0}'",
"CustomFormatUnknownConditionOption": "Unknown option '{0}' for condition '{1}'",
"CustomFormats": "Custom Formats",
"CustomFormatsSettings": "Custom Formats Settings",
"CustomFormatsSettingsSummary": "Custom Formats and Settings",
"Cutoff": "Cutoff",
"CutoffFormatScoreHelpText": "Once this custom format score is reached Radarr will no longer download movies",
"CutoffHelpText": "Once this quality is reached Radarr will no longer download movies",
"CutoffUnmet": "Cut-off Unmet",
"DBMigration": "DB Migration",
"Database": "Database",
"Date": "Date",
"Dates": "Dates",
"Day": "Day",
"Days": "Days",
"DBMigration": "DB Migration",
"Debug": "Debug",
"DefaultCase": "Default Case",
"DefaultDelayProfile": "This is the default profile. It applies to all movies that don't have an explicit profile.",
"DelayingDownloadUntilInterp": "Delaying download until {0} at {1}",
"DelayProfile": "Delay Profile",
"DelayProfiles": "Delay Profiles",
"DelayingDownloadUntilInterp": "Delaying download until {0} at {1}",
"Delete": "Delete",
"DeleteBackup": "Delete Backup",
"DeleteBackupMessageText": "Are you sure you want to delete the backup '{0}'?",
"DeleteCustomFormat": "Delete Custom Format",
"Deleted": "Deleted",
"DeleteDelayProfile": "Delete Delay Profile",
"DeletedMsg": "Movie was deleted from TMDb",
"DeleteDownloadClient": "Delete Download Client",
"DeleteDownloadClientMessageText": "Are you sure you want to delete the download client '{0}'?",
"DeleteEmptyFolders": "Delete empty folders",
@ -234,6 +232,8 @@
"DeleteTag": "Delete Tag",
"DeleteTagMessageText": "Are you sure you want to delete the tag '{0}'?",
"DeleteTheMovieFolder": "The movie folder '{0}' and all its content will be deleted.",
"Deleted": "Deleted",
"DeletedMsg": "Movie was deleted from TMDb",
"DestinationPath": "Destination Path",
"DestinationRelativePath": "Destination Relative Path",
"DetailedProgressBar": "Detailed Progress Bar",
@ -245,37 +245,37 @@
"DiscordUrlInSlackNotification": "You have a Discord notification setup as a Slack notification. Set this up as a Discord notification for better functionality. The effected notifications are: {0}",
"Discover": "Discover",
"DiskSpace": "Disk Space",
"DoNotPrefer": "Do Not Prefer",
"DoNotUpgradeAutomatically": "Do not Upgrade Automatically",
"Docker": "Docker",
"DockerUpdater": "update the docker container to receive the update",
"Donations": "Donations",
"DoneEditingGroups": "Done Editing Groups",
"DoNotPrefer": "Do Not Prefer",
"DoNotUpgradeAutomatically": "Do not Upgrade Automatically",
"Download": "Download",
"DownloadClient": "Download Client",
"DownloadClientCheckDownloadingToRoot": "Download client {0} places downloads in the root folder {1}. You should not download to a root folder.",
"DownloadClientCheckNoneAvailableMessage": "No download client is available",
"DownloadClientCheckUnableToCommunicateMessage": "Unable to communicate with {0}.",
"DownloadClients": "Download Clients",
"DownloadClientSettings": "Download Client Settings",
"DownloadClientSortingCheckMessage": "Download client {0} has {1} sorting enabled for Radarr's category. You should disable sorting in your download client to avoid import issues.",
"DownloadClientsSettingsSummary": "Download clients, download handling and remote path mappings",
"DownloadClientStatusCheckAllClientMessage": "All download clients are unavailable due to failures",
"DownloadClientStatusCheckSingleClientMessage": "Download clients unavailable due to failures: {0}",
"DownloadClientUnavailable": "Download client is unavailable",
"Downloaded": "Downloaded",
"DownloadedAndMonitored": "Downloaded (Monitored)",
"DownloadedButNotMonitored": "Downloaded (Unmonitored)",
"DownloadClients": "Download Clients",
"DownloadClientsSettingsSummary": "Download clients, download handling and remote path mappings",
"DownloadFailed": "Download failed",
"DownloadFailedCheckDownloadClientForMoreDetails": "Download failed: check download client for more details",
"DownloadFailedInterp": "Download failed: {0}",
"Downloading": "Downloading",
"DownloadPropersAndRepacks": "Propers and Repacks",
"DownloadPropersAndRepacksHelpText1": "Whether or not to automatically upgrade to Propers/Repacks",
"DownloadPropersAndRepacksHelpText2": "Use 'Do not Prefer' to sort by custom format score over Propers/Repacks",
"DownloadPropersAndRepacksHelpTextWarning": "Use custom formats for automatic upgrades to Propers/Repacks",
"DownloadWarning": "Download warning: {0}",
"DownloadWarningCheckDownloadClientForMoreDetails": "Download warning: check download client for more details",
"Downloaded": "Downloaded",
"DownloadedAndMonitored": "Downloaded (Monitored)",
"DownloadedButNotMonitored": "Downloaded (Unmonitored)",
"Downloading": "Downloading",
"Duration": "Duration",
"Edit": "Edit",
"EditCollection": "Edit Collection",
@ -283,7 +283,6 @@
"EditDelayProfile": "Edit Delay Profile",
"EditGroups": "Edit Groups",
"EditIndexer": "Edit Indexer",
"Edition": "Edition",
"EditListExclusion": "Edit List Exclusion",
"EditMovie": "Edit Movie",
"EditMovieFile": "Edit Movie File",
@ -293,6 +292,7 @@
"EditRemotePathMapping": "Edit Remote Path Mapping",
"EditRestriction": "Edit Restriction",
"EditSelectedMovies": "Edit Selected Movies",
"Edition": "Edition",
"Enable": "Enable",
"EnableAutoHelpText": "If enabled, Movies will be automatically added to Radarr from this list",
"EnableAutomaticAdd": "Enable Automatic Add",
@ -302,8 +302,6 @@
"EnableColorImpairedMode": "Enable Color-Impaired Mode",
"EnableColorImpairedModeHelpText": "Altered style to allow color-impaired users to better distinguish color coded information",
"EnableCompletedDownloadHandlingHelpText": "Automatically import completed downloads from download client",
"Enabled": "Enabled",
"EnabledHelpText": "Enable this list for use in Radarr",
"EnableHelpText": "Enable metadata file creation for this metadata type",
"EnableInteractiveSearch": "Enable Interactive Search",
"EnableInteractiveSearchHelpText": "Will be used when interactive search is used",
@ -312,17 +310,19 @@
"EnableRSS": "Enable RSS",
"EnableSSL": "Enable SSL",
"EnableSslHelpText": " Requires restart running as administrator to take effect",
"Enabled": "Enabled",
"EnabledHelpText": "Enable this list for use in Radarr",
"Ended": "Ended",
"Error": "Error",
"ErrorLoadingContents": "Error loading contents",
"ErrorLoadingPreviews": "Error loading previews",
"ErrorRestoringBackup": "Error restoring backup",
"Events": "Events",
"EventType": "Event Type",
"Events": "Events",
"Exception": "Exception",
"Excluded": "Excluded",
"ExcludeMovie": "Exclude Movie",
"ExcludeTitle": "Exclude {0}? This will prevent Radarr from automatically adding via list sync.",
"Excluded": "Excluded",
"Existing": "Existing",
"ExistingMovies": "Existing Movie(s)",
"ExistingTag": "Existing tag",
@ -340,12 +340,12 @@
"File": "File",
"FileDateHelpText": "Change file date on import/rescan",
"FileManagement": "File Management",
"Filename": "Filename",
"FileNames": "File Names",
"FileNameTokens": "File Name Tokens",
"Files": "Files",
"FileNames": "File Names",
"FileWasDeletedByUpgrade": "File was deleted to import an upgrade",
"FileWasDeletedByViaUI": "File was deleted via the UI",
"Filename": "Filename",
"Files": "Files",
"Filter": "Filter",
"FilterPlaceHolder": "Search movies",
"Filters": "Filters",
@ -356,11 +356,11 @@
"FolderMoveRenameWarning": "This will also rename the movie folder per the movie folder format in settings.",
"Folders": "Folders",
"FollowPerson": "Follow Person",
"Forecast": "Forecast",
"Formats": "Formats",
"ForMoreInformationOnTheIndividualDownloadClients": "For more information on the individual download clients, click the more info buttons.",
"ForMoreInformationOnTheIndividualImportListsClinkOnTheInfoButtons": "For more information on the individual import lists, click on the info buttons.",
"ForMoreInformationOnTheIndividualIndexers": "For more information on the individual indexers, click on the info buttons.",
"Forecast": "Forecast",
"Formats": "Formats",
"FreeSpace": "Free Space",
"From": "from",
"General": "General",
@ -370,11 +370,11 @@
"Global": "Global",
"GoToInterp": "Go to {0}",
"Grab": "Grab",
"Grabbed": "Grabbed",
"GrabID": "Grab ID",
"GrabRelease": "Grab Release",
"GrabReleaseMessageText": "Radarr was unable to determine which movie this release was for. Radarr may be unable to automatically import this release. Do you want to grab '{0}'?",
"GrabSelected": "Grab Selected",
"Grabbed": "Grabbed",
"Group": "Group",
"HardlinkCopyFiles": "Hardlink/Copy Files",
"HaveNotAddedMovies": "You haven't added any movies yet, do you want to import some or all of your movies first?",
@ -390,22 +390,19 @@
"HttpHttps": "HTTP(S)",
"ICalFeed": "iCal Feed",
"ICalHttpUrlHelpText": "Copy this URL to your client(s) or click to subscribe if your browser supports webcal",
"iCalLink": "iCal Link",
"IMDb": "IMDb",
"IconForCutoffUnmet": "Icon for Cutoff Unmet",
"IgnoreDeletedMovies": "Unmonitor Deleted Movies",
"Ignored": "Ignored",
"IgnoredAddresses": "Ignored Addresses",
"IgnoreDeletedMovies": "Unmonitor Deleted Movies",
"IgnoredHelpText": "The release will be rejected if it contains one or more of the terms (case insensitive)",
"IgnoredPlaceHolder": "Add new restriction",
"IllRestartLater": "I'll restart later",
"Images": "Images",
"IMDb": "IMDb",
"ImdbRating": "IMDb Rating",
"ImdbVotes": "IMDb Votes",
"Import": "Import",
"ImportCustomFormat": "Import Custom Format",
"Imported": "Imported",
"ImportedTo": "Imported To",
"ImportErrors": "Import Errors",
"ImportExistingMovies": "Import Existing Movies",
"ImportExtraFiles": "Import Extra Files",
@ -414,7 +411,6 @@
"ImportFailedInterp": "Import failed: {0}",
"ImportHeader": "Import an existing organized library to add movies to Radarr",
"ImportIncludeQuality": "Make sure that your files include the quality in their filenames. e.g. {0}",
"Importing": "Importing",
"ImportLibrary": "Library Import",
"ImportListMissingRoot": "Missing root folder for import list(s): {0}",
"ImportListMultipleMissingRoots": "Multiple root folders are missing for import lists: {0}",
@ -425,7 +421,12 @@
"ImportMovies": "Import Movies",
"ImportNotForDownloads": "Do not use for importing downloads from your download client, this is only for existing organized libraries, not unsorted files.",
"ImportRootPath": "Point Radarr to the folder containing all of your movies, not a specific movie. e.g. {0} and not {1}. Additionally, each movie must be in its own folder within the root/library folder.",
"ImportScriptPath": "Import Script Path",
"ImportTipsMessage": "Some tips to ensure the import goes smoothly:",
"ImportUsingScript": "Import Using Script",
"Imported": "Imported",
"ImportedTo": "Imported To",
"Importing": "Importing",
"InCinemas": "In Cinemas",
"InCinemasDate": "In Cinemas Date",
"InCinemasMsg": "Movie is in Cinemas",
@ -446,15 +447,15 @@
"IndexerPriorityHelpText": "Indexer Priority from 1 (Highest) to 50 (Lowest). Default: 25. Used when grabbing releases as a tiebreaker for otherwise equal releases, Radarr will still use all enabled indexers for RSS Sync and Searching",
"IndexerRssHealthCheckNoAvailableIndexers": "All rss-capable indexers are temporarily unavailable due to recent indexer errors",
"IndexerRssHealthCheckNoIndexers": "No indexers available with RSS sync enabled, Radarr will not grab new releases automatically",
"Indexers": "Indexers",
"IndexerSearchCheckNoAutomaticMessage": "No indexers available with Automatic Search enabled, Radarr will not provide any automatic search results",
"IndexerSearchCheckNoAvailableIndexersMessage": "All search-capable indexers are temporarily unavailable due to recent indexer errors",
"IndexerSearchCheckNoInteractiveMessage": "No indexers available with Interactive Search enabled, Radarr will not provide any interactive search results",
"IndexerSettings": "Indexer Settings",
"IndexersSettingsSummary": "Indexers and release restrictions",
"IndexerStatusCheckAllClientMessage": "All indexers are unavailable due to failures",
"IndexerStatusCheckSingleClientMessage": "Indexers unavailable due to failures: {0}",
"IndexerTagHelpText": "Only use this indexer for movies with at least one matching tag. Leave blank to use with all movies.",
"Indexers": "Indexers",
"IndexersSettingsSummary": "Indexers and release restrictions",
"Info": "Info",
"InstallLatest": "Install Latest",
"InstanceName": "Instance Name",
@ -483,13 +484,13 @@
"Links": "Links",
"List": "List",
"ListExclusions": "List Exclusions",
"Lists": "Lists",
"ListSettings": "List Settings",
"ListsSettingsSummary": "Import Lists, list exclusions",
"ListSyncLevelHelpText": "Movies in library will be handled based on your selection if they fall off or do not appear on your list(s)",
"ListSyncLevelHelpTextWarning": "Movie files will be permanently deleted, this can result in wiping your library if your lists are empty",
"ListTagsHelpText": "Tags list items will be added with",
"ListUpdateInterval": "List Update Interval",
"Lists": "Lists",
"ListsSettingsSummary": "Import Lists, list exclusions",
"Loading": "Loading",
"LoadingMovieCreditsFailed": "Loading movie credits failed",
"LoadingMovieExtraFilesFailed": "Loading movie extra files failed",
@ -498,14 +499,15 @@
"LocalPath": "Local Path",
"Location": "Location",
"LogFiles": "Log Files",
"Logging": "Logging",
"LogLevel": "Log Level",
"LogLevelTraceHelpTextWarning": "Trace logging should only be enabled temporarily",
"LogOnly": "Log Only",
"Logging": "Logging",
"Logs": "Logs",
"LookingForReleaseProfiles1": "Looking for Release Profiles? Try",
"LookingForReleaseProfiles2": "instead.",
"LowerCase": "Lowercase",
"MIA": "MIA",
"MaintenanceRelease": "Maintenance Release: bug fixes and other improvements. See Github Commit History for more details",
"Manual": "Manual",
"ManualImport": "Manual Import",
@ -532,7 +534,6 @@
"Metadata": "Metadata",
"MetadataSettings": "Metadata Settings",
"MetadataSettingsSummary": "Create metadata files when movies are imported or refreshed",
"MIA": "MIA",
"Min": "Min",
"MinAvailability": "Min Availability",
"MinFormatScoreHelpText": "Minimum custom format score allowed to download",
@ -555,13 +556,13 @@
"Monday": "Monday",
"Monitor": "Monitor",
"MonitorCollection": "Monitor Collection",
"MonitorMovie": "Monitor Movie",
"MonitorMovies": "Monitor Movies",
"Monitored": "Monitored",
"MonitoredCollectionHelpText": "Monitor to automatically have movies from this collection added to the library",
"MonitoredHelpText": "Download movie if available",
"MonitoredOnly": "Monitored Only",
"MonitoredStatus": "Monitored/Status",
"MonitorMovie": "Monitor Movie",
"MonitorMovies": "Monitor Movies",
"Month": "Month",
"Months": "Months",
"More": "More",
@ -602,20 +603,20 @@
"MovieMatchType": "Movie Match Type",
"MovieNaming": "Movie Naming",
"MovieOnly": "Movie Only",
"Movies": "Movies",
"MoviesSelectedInterp": "{0} Movie(s) Selected",
"MovieTitle": "Movie Title",
"MovieTitleHelpText": "The title of the movie to exclude (can be anything meaningful)",
"MovieYear": "Movie Year",
"MovieYearHelpText": "The year of the movie to exclude",
"Movies": "Movies",
"MoviesSelectedInterp": "{0} Movie(s) Selected",
"MultiLanguage": "Multi-Language",
"MustContain": "Must Contain",
"MustNotContain": "Must Not Contain",
"Name": "Name",
"NamingSettings": "Naming Settings",
"Negate": "Negate",
"Negated": "Negated",
"NegateHelpText": "If checked, the custom format will not apply if this {0} condition matches.",
"Negated": "Negated",
"NetCore": ".NET",
"Never": "Never",
"New": "New",
@ -636,15 +637,15 @@
"NoMinimumForAnyRuntime": "No minimum for any runtime",
"NoMoveFilesSelf": " No, I'll Move the Files Myself",
"NoMoviesExist": "No movies found, to get started you'll want to add a new movie or import some existing ones.",
"None": "None",
"NoResultsFound": "No results found",
"NoTagsHaveBeenAddedYet": "No tags have been added yet",
"NoUpdatesAreAvailable": "No updates are available",
"NoVideoFilesFoundSelectedFolder": "No video files were found in the selected folder",
"None": "None",
"NotAvailable": "Not Available",
"NotMonitored": "Not Monitored",
"NotificationTriggers": "Notification Triggers",
"NotificationTriggersHelpText": "Select which events should trigger this notification",
"NotMonitored": "Not Monitored",
"NoUpdatesAreAvailable": "No updates are available",
"NoVideoFilesFoundSelectedFolder": "No video files were found in the selected folder",
"OAuthPopupMessage": "Pop-ups are being blocked by your browser",
"Ok": "Ok",
"OnApplicationUpdate": "On Application Update",
@ -658,8 +659,6 @@
"OnHealthRestoredHelpText": "On Health Restored",
"OnImport": "On Import",
"OnLatestVersion": "The latest version of Radarr is already installed",
"OnlyTorrent": "Only Torrent",
"OnlyUsenet": "Only Usenet",
"OnManualInteractionRequired": "On Manual Interaction Required",
"OnManualInteractionRequiredHelpText": "On Manual Interaction Required",
"OnMovieAdded": "On Movie Added",
@ -674,6 +673,8 @@
"OnRenameHelpText": "On Rename",
"OnUpgrade": "On Upgrade",
"OnUpgradeHelpText": "On Upgrade",
"OnlyTorrent": "Only Torrent",
"OnlyUsenet": "Only Usenet",
"OpenBrowserOnStart": "Open browser on start",
"OpenThisModal": "Open This Modal",
"Options": "Options",
@ -708,16 +709,16 @@
"Port": "Port",
"PortNumber": "Port Number",
"PosterOptions": "Poster Options",
"Posters": "Posters",
"PosterSize": "Poster Size",
"Posters": "Posters",
"PreferAndUpgrade": "Prefer and Upgrade",
"PreferIndexerFlags": "Prefer Indexer Flags",
"PreferIndexerFlagsHelpText": "Prioritize releases with special flags",
"PreferTorrent": "Prefer Torrent",
"PreferUsenet": "Prefer Usenet",
"Preferred": "Preferred",
"PreferredProtocol": "Preferred Protocol",
"PreferredSize": "Preferred Size",
"PreferTorrent": "Prefer Torrent",
"PreferUsenet": "Prefer Usenet",
"Presets": "Presets",
"PreviewRename": "Preview Rename",
"PreviewRenameHelpText": "Tip: To preview a rename... select 'Cancel' then click any movie title and use the",
@ -755,9 +756,15 @@
"QualitySettings": "Quality Settings",
"QualitySettingsSummary": "Quality sizes and naming",
"Queue": "Queue",
"Queued": "Queued",
"QueueIsEmpty": "Queue is empty",
"Queued": "Queued",
"QuickImport": "Move Automatically",
"RSS": "RSS",
"RSSHelpText": "Will be used when Radarr periodically looks for releases via RSS Sync",
"RSSIsNotSupportedWithThisIndexer": "RSS is not supported with this indexer",
"RSSSync": "RSS Sync",
"RSSSyncInterval": "RSS Sync Interval",
"RSSSyncIntervalHelpTextWarning": "This will apply to all indexers, please follow the rules set forth by them",
"RadarrCalendarFeed": "Radarr Calendar Feed",
"RadarrSupportsAnyDownloadClient": "Radarr supports many popular torrent and usenet download clients.",
"RadarrSupportsAnyIndexer": "Radarr supports any indexer that uses the Newznab standard, as well as other indexers listed below.",
@ -791,14 +798,14 @@
"RejectionCount": "Rejection Count",
"RelativePath": "Relative Path",
"ReleaseBranchCheckOfficialBranchMessage": "Branch {0} is not a valid Radarr release branch, you will not receive updates",
"Released": "Released",
"ReleaseDates": "Release Dates",
"ReleasedMsg": "Movie is released",
"ReleaseGroup": "Release Group",
"ReleaseRejected": "Release Rejected",
"ReleaseStatus": "Release Status",
"ReleaseTitle": "Release Title",
"ReleaseWillBeProcessedInterp": "Release will be processed {0}",
"Released": "Released",
"ReleasedMsg": "Movie is released",
"Reload": "Reload",
"RemotePath": "Remote Path",
"RemotePathMappingCheckBadDockerPath": "You are using docker; download client {0} places downloads in {1} but this is not a valid {2} path. Review your remote path mappings and download client settings.",
@ -821,9 +828,6 @@
"RemoveCompleted": "Remove Completed",
"RemoveCompletedDownloads": "Remove Completed Downloads",
"RemoveCompletedDownloadsHelpText": "Remove imported downloads from download client history",
"RemovedFromTaskQueue": "Removed from task queue",
"RemovedMovieCheckMultipleMessage": "Movies {0} were removed from TMDb",
"RemovedMovieCheckSingleMessage": "Movie {0} was removed from TMDb",
"RemoveDownloadsAlert": "The Remove settings were moved to the individual Download Client settings in the table above.",
"RemoveFailed": "Remove Failed",
"RemoveFailedDownloads": "Remove Failed Downloads",
@ -840,11 +844,14 @@
"RemoveSelected": "Remove Selected",
"RemoveSelectedItem": "Remove Selected Item",
"RemoveSelectedItems": "Remove Selected Items",
"RemovedFromTaskQueue": "Removed from task queue",
"RemovedMovieCheckMultipleMessage": "Movies {0} were removed from TMDb",
"RemovedMovieCheckSingleMessage": "Movie {0} was removed from TMDb",
"RemovingTag": "Removing tag",
"Renamed": "Renamed",
"RenameFiles": "Rename Files",
"RenameMovies": "Rename Movies",
"RenameMoviesHelpText": "Radarr will use the existing file name if renaming is disabled",
"Renamed": "Renamed",
"Reorder": "Reorder",
"Replace": "Replace",
"ReplaceIllegalCharacters": "Replace Illegal Characters",
@ -882,20 +889,20 @@
"RootFolderCheckSingleMessage": "Missing root folder: {0}",
"RootFolders": "Root Folders",
"RottenTomatoesRating": "Tomato Rating",
"RSS": "RSS",
"RSSHelpText": "Will be used when Radarr periodically looks for releases via RSS Sync",
"RSSIsNotSupportedWithThisIndexer": "RSS is not supported with this indexer",
"RSSSync": "RSS Sync",
"RssSyncHelpText": "Interval in minutes. Set to zero to disable (this will stop all automatic release grabbing)",
"RSSSyncInterval": "RSS Sync Interval",
"RSSSyncIntervalHelpTextWarning": "This will apply to all indexers, please follow the rules set forth by them",
"Runtime": "Runtime",
"SSLCertPassword": "SSL Cert Password",
"SSLCertPasswordHelpText": "Password for pfx file",
"SSLCertPath": "SSL Cert Path",
"SSLCertPathHelpText": "Path to pfx file",
"SSLPort": "SSL Port",
"Save": "Save",
"SaveChanges": "Save Changes",
"SaveSettings": "Save Settings",
"Scheduled": "Scheduled",
"Score": "Score",
"Script": "Script",
"ScriptImportPathHelpText": "The path to the script to use for importing",
"ScriptPath": "Script Path",
"ScrollMovies": "Scroll Movies",
"Search": "Search",
@ -961,7 +968,6 @@
"ShowMonitoredHelpText": "Show monitored status under poster",
"ShowMovieInformation": "Show Movie Information",
"ShowMovieInformationHelpText": "Show movie genres and certification",
"ShownClickToHide": "Shown, click to hide",
"ShowOverview": "Show Overview",
"ShowPath": "Show Path",
"ShowPosters": "Show Posters",
@ -978,6 +984,7 @@
"ShowTitleHelpText": "Show movie title under poster",
"ShowUnknownMovieItems": "Show Unknown Movie Items",
"ShowYear": "Show Year",
"ShownClickToHide": "Shown, click to hide",
"Shutdown": "Shutdown",
"Size": "Size",
"SizeLimit": "Size Limit",
@ -995,17 +1002,12 @@
"SourceRelativePath": "Source Relative Path",
"SourceTitle": "Source Title",
"SqliteVersionCheckUpgradeRequiredMessage": "Currently installed SQLite version {0} is no longer supported. Please upgrade SQLite to at least version {1}.",
"SSLCertPassword": "SSL Cert Password",
"SSLCertPasswordHelpText": "Password for pfx file",
"SSLCertPath": "SSL Cert Path",
"SSLCertPathHelpText": "Path to pfx file",
"SSLPort": "SSL Port",
"StandardMovieFormat": "Standard Movie Format",
"Started": "Started",
"StartImport": "Start Import",
"StartProcessing": "Start Processing",
"StartSearchForMissingMovie": "Start search for missing movie",
"StartTypingOrSelectAPathBelow": "Start typing or select a path below",
"Started": "Started",
"StartupDirectory": "Startup directory",
"Status": "Status",
"StopSelecting": "Stop Selecting",
@ -1016,6 +1018,8 @@
"Sunday": "Sunday",
"System": "System",
"SystemTimeCheckMessage": "System time is off by more than 1 day. Scheduled tasks may not run correctly until the time is corrected",
"TMDBId": "TMDb Id",
"TMDb": "TMDb",
"Table": "Table",
"TableOptions": "Table Options",
"TableOptionsColumnsMessage": "Choose which columns are visible and which order they appear in",
@ -1025,8 +1029,8 @@
"Tags": "Tags",
"TagsHelpText": "Applies to movies with at least one matching tag",
"TagsSettingsSummary": "See all tags and how they are used. Unused tags can be removed",
"Tasks": "Tasks",
"TaskUserAgentTooltip": "User-Agent provided by the app that called the API",
"Tasks": "Tasks",
"Test": "Test",
"TestAll": "Test All",
"TestAllClients": "Test All Clients",
@ -1042,8 +1046,6 @@
"Timeleft": "Time Left",
"Title": "Title",
"Titles": "Titles",
"TMDb": "TMDb",
"TMDBId": "TMDb Id",
"TmdbIdHelpText": "The TMDb Id of the movie to exclude",
"TmdbRating": "TMDb Rating",
"TmdbVotes": "TMDb Votes",
@ -1069,6 +1071,7 @@
"UISettings": "UI Settings",
"UISettingsSummary": "Calendar, date and color impaired options",
"UMask": "UMask",
"URLBase": "URL Base",
"UnableToAddANewConditionPleaseTryAgain": "Unable to add a new condition, please try again.",
"UnableToAddANewCustomFormatPleaseTryAgain": "Unable to add a new custom format, please try again.",
"UnableToAddANewDownloadClientPleaseTryAgain": "Unable to add a new download client, please try again.",
@ -1131,25 +1134,25 @@
"UpdateCheckUINotWritableMessage": "Cannot install update because UI folder '{0}' is not writable by the user '{1}'.",
"UpdateFiltered": "Update Filtered",
"UpdateMechanismHelpText": "Use Radarr's built-in updater or a script",
"Updates": "Updates",
"UpdateScriptPathHelpText": "Path to a custom script that takes an extracted update package and handle the remainder of the update process",
"UpdateSelected": "Update Selected",
"Updates": "Updates",
"UpgradeAllowedHelpText": "If disabled qualities will not be upgraded",
"UpgradesAllowed": "Upgrades Allowed",
"UpgradeUntilCustomFormatScore": "Upgrade Until Custom Format Score",
"UpgradeUntilQuality": "Upgrade Until Quality",
"UpgradeUntilThisQualityIsMetOrExceeded": "Upgrade until this quality is met or exceeded",
"UpgradesAllowed": "Upgrades Allowed",
"UpperCase": "Uppercase",
"Uptime": "Uptime",
"URLBase": "URL Base",
"UrlBaseHelpText": "For reverse proxy support, default is empty",
"UseHardlinksInsteadOfCopy": "Use Hardlinks instead of Copy",
"UseProxy": "Use Proxy",
"UseScriptImportHelpText": "Copy files for importing using a script (ex. for transcoding)",
"Usenet": "Usenet",
"UsenetDelay": "Usenet Delay",
"UsenetDelayHelpText": "Delay in minutes to wait before grabbing a release from Usenet",
"UsenetDelayTime": "Usenet Delay: {0}",
"UsenetDisabled": "Usenet Disabled",
"UseProxy": "Use Proxy",
"Username": "Username",
"Version": "Version",
"VersionUpdateText": "Version {0} of Radarr has been installed, in order to get the latest changes you'll need to reload Radarr.",
@ -1173,5 +1176,6 @@
"YesCancel": "Yes, Cancel",
"YesMoveFiles": "Yes, Move the Files",
"Yesterday": "Yesterday",
"YouCanAlsoSearch": "You can also search using TMDb ID or IMDb ID of a movie. e.g. `tmdb:71663`"
"YouCanAlsoSearch": "You can also search using TMDb ID or IMDb ID of a movie. e.g. `tmdb:71663`",
"iCalLink": "iCal Link"
}

@ -12,6 +12,7 @@ namespace NzbDrone.Core.MediaFiles.MediaInfo
public interface IUpdateMediaInfo
{
bool Update(MovieFile movieFile, Movie movie);
bool UpdateMediaInfo(MovieFile episodeFile, Movie movie);
}
public class UpdateMediaInfoService : IUpdateMediaInfo, IHandle<MovieScannedEvent>
@ -65,7 +66,7 @@ namespace NzbDrone.Core.MediaFiles.MediaInfo
return UpdateMediaInfo(movieFile, movie);
}
private bool UpdateMediaInfo(MovieFile movieFile, Movie movie)
public bool UpdateMediaInfo(MovieFile movieFile, Movie movie)
{
var path = Path.Combine(movie.Path, movieFile.RelativePath);

@ -29,6 +29,7 @@ namespace NzbDrone.Core.MediaFiles
private readonly IDiskTransferService _diskTransferService;
private readonly IDiskProvider _diskProvider;
private readonly IMediaFileAttributeService _mediaFileAttributeService;
private readonly IImportScript _scriptImportDecider;
private readonly IEventAggregator _eventAggregator;
private readonly IConfigService _configService;
private readonly IRootFolderService _rootFolderService;
@ -39,6 +40,7 @@ namespace NzbDrone.Core.MediaFiles
IDiskTransferService diskTransferService,
IDiskProvider diskProvider,
IMediaFileAttributeService mediaFileAttributeService,
IImportScript scriptImportDecider,
IEventAggregator eventAggregator,
IConfigService configService,
IRootFolderService rootFolderService,
@ -49,6 +51,7 @@ namespace NzbDrone.Core.MediaFiles
_diskTransferService = diskTransferService;
_diskProvider = diskProvider;
_mediaFileAttributeService = mediaFileAttributeService;
_scriptImportDecider = scriptImportDecider;
_eventAggregator = eventAggregator;
_configService = configService;
_rootFolderService = rootFolderService;
@ -76,7 +79,7 @@ namespace NzbDrone.Core.MediaFiles
_logger.Debug("Moving movie file: {0} to {1}", movieFile.Path, filePath);
return TransferFile(movieFile, localMovie.Movie, filePath, TransferMode.Move);
return TransferFile(movieFile, localMovie.Movie, filePath, TransferMode.Move, localMovie);
}
public MovieFile CopyMovieFile(MovieFile movieFile, LocalMovie localMovie)
@ -89,14 +92,14 @@ namespace NzbDrone.Core.MediaFiles
if (_configService.CopyUsingHardlinks)
{
_logger.Debug("Hardlinking movie file: {0} to {1}", movieFile.Path, filePath);
return TransferFile(movieFile, localMovie.Movie, filePath, TransferMode.HardLinkOrCopy);
return TransferFile(movieFile, localMovie.Movie, filePath, TransferMode.HardLinkOrCopy, localMovie);
}
_logger.Debug("Copying movie file: {0} to {1}", movieFile.Path, filePath);
return TransferFile(movieFile, localMovie.Movie, filePath, TransferMode.Copy);
return TransferFile(movieFile, localMovie.Movie, filePath, TransferMode.Copy, localMovie);
}
private MovieFile TransferFile(MovieFile movieFile, Movie movie, string destinationFilePath, TransferMode mode)
private MovieFile TransferFile(MovieFile movieFile, Movie movie, string destinationFilePath, TransferMode mode, LocalMovie localMovie = null)
{
Ensure.That(movieFile, () => movieFile).IsNotNull();
Ensure.That(movie, () => movie).IsNotNull();
@ -114,10 +117,33 @@ namespace NzbDrone.Core.MediaFiles
throw new SameFilenameException("File not moved, source and destination are the same", movieFilePath);
}
_diskTransferService.TransferFile(movieFilePath, destinationFilePath, mode);
var transfer = true;
movieFile.RelativePath = movie.Path.GetRelativePath(destinationFilePath);
if (localMovie is not null)
{
var scriptImportDecision = _scriptImportDecider.TryImport(movieFilePath, destinationFilePath, localMovie, movieFile, mode);
switch (scriptImportDecision)
{
case ScriptImportDecision.DeferMove:
break;
case ScriptImportDecision.RenameRequested:
MoveMovieFile(movieFile, movie);
transfer = false;
break;
case ScriptImportDecision.MoveComplete:
transfer = false;
break;
}
}
if (transfer)
{
_diskTransferService.TransferFile(movieFilePath, destinationFilePath, mode);
}
_updateMovieFileService.ChangeFileDateForFile(movieFile, movie);
try

@ -125,8 +125,8 @@ namespace NzbDrone.Core.MediaFiles.MovieImport
{
movieFile.SceneName = localMovie.SceneName;
movieFile.OriginalFilePath = GetOriginalFilePath(downloadClientItem, localMovie);
var moveResult = _movieFileUpgrader.UpgradeMovieFile(movieFile, localMovie, copyOnly); // TODO: Check if this works
oldFiles = moveResult.OldFiles;
oldFiles = _movieFileUpgrader.UpgradeMovieFile(movieFile, localMovie, copyOnly).OldFiles;
}
else
{

@ -91,6 +91,7 @@ namespace NzbDrone.Core.MediaFiles.MovieImport
{
Movie = movie,
DownloadClientMovieInfo = downloadClientItemInfo,
DownloadItem = downloadClientItem,
FolderMovieInfo = folderInfo,
Path = file,
SceneSource = sceneSource,

@ -117,6 +117,7 @@ namespace NzbDrone.Core.MediaFiles.MovieImport.Manual
Movie = movie,
FileMovieInfo = Parser.Parser.ParseMoviePath(path),
DownloadClientMovieInfo = downloadClientItem == null ? null : Parser.Parser.ParseMovieTitle(downloadClientItem.Title),
DownloadItem = downloadClientItem,
Path = path,
SceneSource = SceneSource(movie, rootFolder),
ExistingFile = movie.Path.IsParentPath(path),
@ -355,6 +356,7 @@ namespace NzbDrone.Core.MediaFiles.MovieImport.Manual
{
trackedDownload = _trackedDownloadService.Find(file.DownloadId);
localMovie.DownloadClientMovieInfo = trackedDownload?.RemoteMovie?.ParsedMovieInfo;
localMovie.DownloadItem = trackedDownload?.DownloadItem;
}
if (file.FolderName.IsNotNullOrWhiteSpace())

@ -0,0 +1,124 @@
using System.Collections.Specialized;
using System.IO;
using System.Linq;
using NLog;
using NzbDrone.Common.Disk;
using NzbDrone.Common.Extensions;
using NzbDrone.Common.Processes;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.MediaFiles.MediaInfo;
using NzbDrone.Core.Parser.Model;
namespace NzbDrone.Core.MediaFiles
{
public interface IImportScript
{
public ScriptImportDecision TryImport(string sourcePath, string destinationFilePath, LocalMovie localMovie, MovieFile movieFile, TransferMode mode);
}
public class ImportScriptService : IImportScript
{
private readonly IConfigFileProvider _configFileProvider;
private readonly IVideoFileInfoReader _videoFileInfoReader;
private readonly IProcessProvider _processProvider;
private readonly IConfigService _configService;
private readonly Logger _logger;
public ImportScriptService(IProcessProvider processProvider,
IVideoFileInfoReader videoFileInfoReader,
IConfigService configService,
IConfigFileProvider configFileProvider,
Logger logger)
{
_processProvider = processProvider;
_videoFileInfoReader = videoFileInfoReader;
_configService = configService;
_configFileProvider = configFileProvider;
_logger = logger;
}
public ScriptImportDecision TryImport(string sourcePath, string destinationFilePath, LocalMovie localMovie, MovieFile movieFile, TransferMode mode)
{
var movie = localMovie.Movie;
var oldFiles = localMovie.OldFiles;
var downloadClientInfo = localMovie.DownloadItem?.DownloadClientInfo;
var downloadId = localMovie.DownloadItem?.DownloadId;
if (!_configService.UseScriptImport)
{
return ScriptImportDecision.DeferMove;
}
var environmentVariables = new StringDictionary();
environmentVariables.Add("Radarr_SourcePath", sourcePath);
environmentVariables.Add("Radarr_DestinationPath", destinationFilePath);
environmentVariables.Add("Radarr_InstanceName", _configFileProvider.InstanceName);
environmentVariables.Add("Radarr_ApplicationUrl", _configService.ApplicationUrl);
environmentVariables.Add("Radarr_TransferMode", mode.ToString());
environmentVariables.Add("Radarr_Movie_Id", movie.Id.ToString());
environmentVariables.Add("Radarr_Movie_Title", movie.MovieMetadata.Value.Title);
environmentVariables.Add("Radarr_Movie_Year", movie.MovieMetadata.Value.Year.ToString());
environmentVariables.Add("Radarr_Movie_Path", movie.Path);
environmentVariables.Add("Radarr_Movie_TmdbId", movie.MovieMetadata.Value.TmdbId.ToString());
environmentVariables.Add("Radarr_Movie_ImdbId", movie.MovieMetadata.Value.ImdbId ?? string.Empty);
environmentVariables.Add("Radarr_Movie_In_Cinemas_Date", movie.MovieMetadata.Value.InCinemas.ToString() ?? string.Empty);
environmentVariables.Add("Radarr_Movie_Physical_Release_Date", movie.MovieMetadata.Value.PhysicalRelease.ToString() ?? string.Empty);
environmentVariables.Add("Radarr_Movie_Overview", movie.MovieMetadata.Value.Overview);
environmentVariables.Add("Radarr_MovieFile_Id", movieFile.Id.ToString());
environmentVariables.Add("Radarr_MovieFile_RelativePath", movieFile.RelativePath);
environmentVariables.Add("Radarr_MovieFile_Path", Path.Combine(movie.Path, movieFile.RelativePath));
environmentVariables.Add("Radarr_MovieFile_Quality", movieFile.Quality.Quality.Name);
environmentVariables.Add("Radarr_MovieFile_QualityVersion", movieFile.Quality.Revision.Version.ToString());
environmentVariables.Add("Radarr_MovieFile_ReleaseGroup", movieFile.ReleaseGroup ?? string.Empty);
environmentVariables.Add("Radarr_MovieFile_SceneName", movieFile.SceneName ?? string.Empty);
environmentVariables.Add("Radarr_Download_Client", downloadClientInfo?.Name ?? string.Empty);
environmentVariables.Add("Radarr_Download_Client_Type", downloadClientInfo?.Type ?? string.Empty);
environmentVariables.Add("Radarr_Download_Id", downloadId ?? string.Empty);
environmentVariables.Add("Radarr_MovieFile_MediaInfo_AudioChannels", MediaInfoFormatter.FormatAudioChannels(localMovie.MediaInfo).ToString());
environmentVariables.Add("Radarr_MovieFile_MediaInfo_AudioCodec", MediaInfoFormatter.FormatAudioCodec(movieFile.MediaInfo, null));
environmentVariables.Add("Radarr_MovieFile_MediaInfo_AudioLanguages", movieFile.MediaInfo.AudioLanguages.Distinct().ConcatToString(" / "));
environmentVariables.Add("Radarr_MovieFile_MediaInfo_Languages", movieFile.MediaInfo.AudioLanguages.ConcatToString(" / "));
environmentVariables.Add("Radarr_MovieFile_MediaInfo_Height", movieFile.MediaInfo.Height.ToString());
environmentVariables.Add("Radarr_MovieFile_MediaInfo_Width", movieFile.MediaInfo.Width.ToString());
environmentVariables.Add("Radarr_MovieFile_MediaInfo_Subtitles", movieFile.MediaInfo.Subtitles.ConcatToString(" / "));
environmentVariables.Add("Radarr_MovieFile_MediaInfo_VideoCodec", MediaInfoFormatter.FormatVideoCodec(movieFile.MediaInfo, null));
environmentVariables.Add("Radarr_MovieFile_MediaInfo_VideoDynamicRangeType", MediaInfoFormatter.FormatVideoDynamicRangeType(movieFile.MediaInfo));
environmentVariables.Add("Radarr_MovieFile_CustomFormat", string.Join("|", localMovie.CustomFormats));
environmentVariables.Add("Radarr_MovieFile_CustomFormatScore", localMovie.CustomFormatScore.ToString());
if (oldFiles.Any())
{
environmentVariables.Add("Radarr_DeletedRelativePaths", string.Join("|", oldFiles.Select(e => e.RelativePath)));
environmentVariables.Add("Radarr_DeletedPaths", string.Join("|", oldFiles.Select(e => Path.Combine(movie.Path, e.RelativePath))));
environmentVariables.Add("Radarr_DeletedDateAdded", string.Join("|", oldFiles.Select(e => e.DateAdded)));
}
_logger.Debug("Executing external script: {0}", _configService.ScriptImportPath);
var processOutput = _processProvider.StartAndCapture(_configService.ScriptImportPath, $"\"{sourcePath}\" \"{destinationFilePath}\"", environmentVariables);
_logger.Debug("Executed external script: {0} - Status: {1}", _configService.ScriptImportPath, processOutput.ExitCode);
_logger.Debug("Script Output: \r\n{0}", string.Join("\r\n", processOutput.Lines));
switch (processOutput.ExitCode)
{
case 0: // Copy complete
return ScriptImportDecision.MoveComplete;
case 2: // Copy complete, file potentially changed, should try renaming again
movieFile.MediaInfo = _videoFileInfoReader.GetMediaInfo(destinationFilePath);
movieFile.Path = null;
return ScriptImportDecision.RenameRequested;
case 3: // Let Radarr handle it
return ScriptImportDecision.DeferMove;
default: // Error, fail to import
throw new ScriptImportException("Moving with script failed! Exit code {0}", processOutput.ExitCode);
}
}
}
}

@ -0,0 +1,10 @@
namespace NzbDrone.Core.MediaFiles
{
public enum ScriptImportDecision
{
MoveComplete,
RenameRequested,
RejectExtra,
DeferMove
}
}

@ -0,0 +1,23 @@
using System;
using NzbDrone.Common.Exceptions;
namespace NzbDrone.Core.MediaFiles
{
public class ScriptImportException : NzbDroneException
{
public ScriptImportException(string message)
: base(message)
{
}
public ScriptImportException(string message, params object[] args)
: base(message, args)
{
}
public ScriptImportException(string message, Exception innerException)
: base(message, innerException)
{
}
}
}

@ -66,6 +66,8 @@ namespace NzbDrone.Core.MediaFiles
_mediaFileService.Delete(existingFile, DeleteMediaFileReason.Upgrade);
}
localMovie.OldFiles = moveFileResult.OldFiles;
if (copyOnly)
{
moveFileResult.MovieFile = _movieFileMover.CopyMovieFile(movieFile, localMovie);

@ -1,6 +1,8 @@
using System.Collections.Generic;
using NzbDrone.Core.CustomFormats;
using NzbDrone.Core.Download;
using NzbDrone.Core.Languages;
using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.MediaFiles.MediaInfo;
using NzbDrone.Core.Movies;
using NzbDrone.Core.Qualities;
@ -18,8 +20,10 @@ namespace NzbDrone.Core.Parser.Model
public long Size { get; set; }
public ParsedMovieInfo FileMovieInfo { get; set; }
public ParsedMovieInfo DownloadClientMovieInfo { get; set; }
public DownloadClientItem DownloadItem { get; set; }
public ParsedMovieInfo FolderMovieInfo { get; set; }
public Movie Movie { get; set; }
public List<MovieFile> OldFiles { get; set; }
public QualityModel Quality { get; set; }
public List<Language> Languages { get; set; }
public MediaInfoModel MediaInfo { get; set; }

@ -34,6 +34,8 @@ namespace Radarr.Api.V3.Config
.SetValidator(moviePathValidator)
.When(c => !string.IsNullOrWhiteSpace(c.RecycleBin));
SharedValidator.RuleFor(c => c.ScriptImportPath).IsValidPath().When(c => c.UseScriptImport);
SharedValidator.RuleFor(c => c.MinimumFreeSpaceWhenImporting).GreaterThanOrEqualTo(100);
}

@ -25,6 +25,8 @@ namespace Radarr.Api.V3.Config
public bool SkipFreeSpaceCheckWhenImporting { get; set; }
public int MinimumFreeSpaceWhenImporting { get; set; }
public bool CopyUsingHardlinks { get; set; }
public bool UseScriptImport { get; set; }
public string ScriptImportPath { get; set; }
public bool ImportExtraFiles { get; set; }
public string ExtraFileExtensions { get; set; }
public bool EnableMediaInfo { get; set; }
@ -53,6 +55,8 @@ namespace Radarr.Api.V3.Config
SkipFreeSpaceCheckWhenImporting = model.SkipFreeSpaceCheckWhenImporting,
MinimumFreeSpaceWhenImporting = model.MinimumFreeSpaceWhenImporting,
CopyUsingHardlinks = model.CopyUsingHardlinks,
UseScriptImport = model.UseScriptImport,
ScriptImportPath = model.ScriptImportPath,
ImportExtraFiles = model.ImportExtraFiles,
ExtraFileExtensions = model.ExtraFileExtensions,
EnableMediaInfo = model.EnableMediaInfo

Loading…
Cancel
Save