diff --git a/CHANGELOG.md b/CHANGELOG.md
index 667168e63a..a2ee55df44 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,7 @@
## Unreleased
#### New Features
+- Add Keep link as post processing method ([7986](https://github.com/pymedusa/Medusa/pull/7986))
#### Improvements
- Add show names with dashes to guessit expected titles ([#7918](https://github.com/pymedusa/Medusa/pull/7918))
diff --git a/medusa/post_processor.py b/medusa/post_processor.py
index 589a0acf0e..45e208de8e 100644
--- a/medusa/post_processor.py
+++ b/medusa/post_processor.py
@@ -512,6 +512,17 @@ def symlink(cur_file_path, new_file_path):
(cur_file_path, new_file_path, e), logger.ERROR)
raise EpisodePostProcessingFailedException('Unable to move and link the files to their new home')
+ def keeplink(cur_file_path, new_file_path):
+ self.log(u'Symbolic linking file from {0} to {1}'.format
+ (cur_file_path, new_file_path), logger.DEBUG)
+ try:
+ helpers.symlink(cur_file_path, new_file_path)
+ helpers.chmod_as_parent(new_file_path)
+ except (IOError, OSError) as e:
+ self.log(u'Unable to link file {0} to {1}: {2!r}'.format
+ (cur_file_path, new_file_path, e), logger.ERROR)
+ raise EpisodePostProcessingFailedException('Unable to move and link the files to their new home')
+
def reflink(cur_file_path, new_file_path):
self.log(u'Reflink file from {0} to {1}'.format(cur_file_path, new_basename), logger.DEBUG)
try:
@@ -522,7 +533,7 @@ def reflink(cur_file_path, new_file_path):
(cur_file_path, new_file_path, e), logger.ERROR)
raise EpisodePostProcessingFailedException('Unable to copy the files to their new home')
- action = {'copy': copy, 'move': move, 'hardlink': hardlink, 'symlink': symlink, 'reflink': reflink}.get(self.process_method)
+ action = {'copy': copy, 'move': move, 'hardlink': hardlink, 'symlink': symlink, 'reflink': reflink, 'keeplink': keeplink}.get(self.process_method)
# Subtitle action should be move in case of hardlink|symlink|reflink as downloaded subtitle is not part of torrent
subtitle_action = {'copy': copy, 'move': move, 'hardlink': move, 'symlink': move, 'reflink': move}.get(self.process_method)
self._combined_file_operation(file_path, new_path, new_basename, associated_files=associated_files,
@@ -1229,7 +1240,7 @@ def process(self):
try:
# do the action to the episode and associated files to the show dir
- if self.process_method in ['copy', 'hardlink', 'move', 'symlink', 'reflink']:
+ if self.process_method in ['copy', 'hardlink', 'move', 'symlink', 'reflink', 'keeplink']:
if not self.process_method == 'hardlink':
if helpers.is_file_locked(self.file_path, False):
raise EpisodePostProcessingFailedException('File is locked for reading')
@@ -1302,7 +1313,7 @@ def process(self):
self._run_extra_scripts(ep_obj)
if not self.nzb_name and all([app.USE_TORRENTS, app.TORRENT_SEED_LOCATION,
- self.process_method in ('hardlink', 'symlink', 'reflink')]):
+ self.process_method in ('hardlink', 'symlink', 'reflink', 'keeplink')]):
# Store self.info_hash and self.release_name so later we can remove from client if setting is enabled
if self.info_hash:
existing_release_names = app.RECENTLY_POSTPROCESSED.get(self.info_hash, [])
diff --git a/themes-default/slim/src/components/config-post-processing.vue b/themes-default/slim/src/components/config-post-processing.vue
index 6afac331b2..3c231d5f38 100644
--- a/themes-default/slim/src/components/config-post-processing.vue
+++ b/themes-default/slim/src/components/config-post-processing.vue
@@ -389,7 +389,8 @@ export default {
{ value: 'copy', text: 'Copy' },
{ value: 'move', text: 'Move' },
{ value: 'hardlink', text: 'Hard Link' },
- { value: 'symlink', text: 'Symbolic Link' }
+ { value: 'symlink', text: 'Symbolic Link' },
+ { value: 'keeplink', text: 'Keep Link' }
],
timezoneOptions: [
{ value: 'local', text: 'Local' },
diff --git a/themes-default/slim/test/specs/__snapshots__/config-post-processing.spec.js.snap b/themes-default/slim/test/specs/__snapshots__/config-post-processing.spec.js.snap
index 4e5fdd5771..84acb478b3 100644
--- a/themes-default/slim/test/specs/__snapshots__/config-post-processing.spec.js.snap
+++ b/themes-default/slim/test/specs/__snapshots__/config-post-processing.spec.js.snap
@@ -204,6 +204,11 @@ exports[`ConfigPostProcessing.test.js renders 1`] = `
>
Symbolic Link
+
diff --git a/themes-default/slim/views/home_postprocess.mako b/themes-default/slim/views/home_postprocess.mako
index 72caa571f4..61c4d740f3 100644
--- a/themes-default/slim/views/home_postprocess.mako
+++ b/themes-default/slim/views/home_postprocess.mako
@@ -31,13 +31,13 @@
|