Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't check if folders are empty for move instead of copy #9950

Merged
merged 4 commits into from
Oct 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#### Improvements

#### Fixes
- Correctly delete folders with files for move method or if explicitly wanted ([9950](https://github.com/pymedusa/Medusa/pull/9950))

-----

Expand All @@ -17,7 +18,7 @@

#### Fixes
- Fix prowlarr provider id's being obfuscated in logs because of a bad log level. ([9857](https://github.com/pymedusa/Medusa/pull/9857))
- Fix postprocessing specials. ([9812](https://github.com/pymedusa/Medusa/pull/9812))
- Fix postprocessing specials. ([9812](https://github.com/pymedusa/Medusa/pull/9812))
- Fix storing a negative value in the UI as a search delay value ([9822](https://github.com/pymedusa/Medusa/pull/9822))

-----
Expand Down
9 changes: 3 additions & 6 deletions medusa/process_tv.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ def process(self, resource_name=None, force=False, is_priority=None, delete_on=F
self.log_and_output('Missed file: {missed_file}', level=logging.WARNING, **{'missed_file': missed_file})

if all([app.USE_TORRENTS, app.TORRENT_SEED_LOCATION,
self.process_method in ('hardlink', 'symlink', 'reflink', 'copy')]):
self.process_method in ('hardlink', 'symlink', 'reflink', 'keeplink', 'copy')]):
Copy link
Contributor Author

@medariox medariox Oct 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just added the keeplink because it is added here, meaning it would never get removed from the list otherwise.

if not self.nzb_name and all([app.USE_TORRENTS, app.TORRENT_SEED_LOCATION,
self.process_method in ('hardlink', 'symlink', 'reflink', 'keeplink', 'copy')]):
# 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, [])
existing_release_names.append(self.release_name or 'N/A')
app.RECENTLY_POSTPROCESSED[self.info_hash] = existing_release_names

for info_hash, release_names in list(iteritems(app.RECENTLY_POSTPROCESSED)):
if self.move_torrent(info_hash, release_names):
app.RECENTLY_POSTPROCESSED.pop(info_hash, None)
Expand All @@ -425,11 +425,8 @@ def _clean_up(self, path, proc_type, delete=False):
if self.unwanted_files:
self.delete_files(path, self.unwanted_files)

if all([not app.NO_DELETE or clean_folder, self.process_method in ('move', 'copy'),
os.path.normpath(path) != os.path.normpath(app.TV_DOWNLOAD_DIR)]):

check_empty = False if self.process_method == 'copy' else True
if self.delete_folder(path, check_empty=check_empty):
if not app.NO_DELETE and os.path.normpath(path) != os.path.normpath(app.TV_DOWNLOAD_DIR):
if self.delete_folder(path, check_empty=False):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this is what is really meant here... I may be wrong, but it makes most sense to me.

self.log_and_output('Deleted folder: {path}', level=logging.DEBUG, **{'path': path})

def should_process(self, path):
Expand Down