diff options
| author | ivan-boikov <mail@ikboikov.net> | 2025-11-29 14:30:41 +0100 |
|---|---|---|
| committer | ivan-boikov <mail@ikboikov.net> | 2025-11-29 15:09:42 +0100 |
| commit | e92a364e05601c34312b5064bcfa333ff3c47771 (patch) | |
| tree | 0da9ce69e9ed49b99bff6c9a95b4cca9c0508bd2 | |
| parent | 467d5bdbfc101f9a7480bc1f5c5e602d5dba9472 (diff) | |
Delete mnamer symlink patch
| -rw-r--r-- | portage/portage/patches/media-video/mnamer/symlink.diff | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/portage/portage/patches/media-video/mnamer/symlink.diff b/portage/portage/patches/media-video/mnamer/symlink.diff deleted file mode 100644 index 7ebddd6..0000000 --- a/portage/portage/patches/media-video/mnamer/symlink.diff +++ /dev/null @@ -1,60 +0,0 @@ -diff --git a/mnamer/setting_store.py b/mnamer/setting_store.py -index 8981d33..29c1158 100644 ---- a/mnamer/setting_store.py -+++ b/mnamer/setting_store.py -@@ -217,6 +217,15 @@ class SettingStore: - help="--episode-format: set episode renaming format specification", - ).as_dict(), - ) -+ symlink: bool = dataclasses.field( -+ default=False, -+ metadata=SettingSpec( -+ action="store_true", -+ flags=["--symlink"], -+ group=SettingType.PARAMETER, -+ help="--symlink: leaves a trailing symlink", -+ ).as_dict(), -+ ) - - # directive attributes ----------------------------------------------------- - -diff --git a/mnamer/target.py b/mnamer/target.py -index cd9927e..f012eda 100644 ---- a/mnamer/target.py -+++ b/mnamer/target.py -@@ -2,6 +2,7 @@ from __future__ import annotations - - import datetime as dt - from os import path -+from os import symlink - from pathlib import Path - from shutil import move - from typing import Any, ClassVar, Type -@@ -242,7 +243,14 @@ class Target: - """Performs the action of renaming and/or moving a file.""" - destination_path = Path(self.destination).resolve() - destination_path.parent.mkdir(parents=True, exist_ok=True) -+ if path.islink(destination_path) == True: -+ print("Skipped symlink") -+ return - try: - move(str(self.source), destination_path) -+ if self._settings.symlink: -+ if path.islink(destination_path) == False: -+ symlink(destination_path, str(self.source)) -+ - except OSError: # pragma: no cover - raise MnamerException -diff --git a/mnamer/utils.py b/mnamer/utils.py -index 84df787..a77c4ed 100644 ---- a/mnamer/utils.py -+++ b/mnamer/utils.py -@@ -141,6 +141,8 @@ def is_subtitle(container: str | Path | None) -> bool: - return False - return str(container).endswith(tuple(SUBTITLE_CONTAINERS)) - -+def is_symlink(path: Path) -> str: -+ return os.path.islink(str(Path)) - - def get_session() -> requests_cache.CachedSession: - """Convenience function that returns request-cache session singleton.""" |
