Skip to content

Commit

Permalink
Don't check if folders are empty for move instead of copy (#9950)
Browse files Browse the repository at this point in the history
* Don't check if folder are empty for move instead of copy

* Improve logic

* rm all()

* update changelog
  • Loading branch information
medariox authored Oct 15, 2021
1 parent c568173 commit 1e76ecd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
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')]):
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):
self.log_and_output('Deleted folder: {path}', level=logging.DEBUG, **{'path': path})

def should_process(self, path):
Expand Down

0 comments on commit 1e76ecd

Please sign in to comment.