From dc2e757e6b00165764fd97d3a910d7831c7168aa Mon Sep 17 00:00:00 2001 From: samadhi-spice <128258751+samadhi-spice@users.noreply.github.com> Date: Sun, 19 Mar 2023 13:34:35 -0600 Subject: [PATCH 1/2] Update core.py --- orpheus/core.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/orpheus/core.py b/orpheus/core.py index bed2ee8..9c02bbb 100644 --- a/orpheus/core.py +++ b/orpheus/core.py @@ -404,4 +404,8 @@ def orpheus_core_download(orpheus_session: Orpheus, media_to_download, third_par else: raise Exception(f'\tUnknown media type "{mediatype}"') - if os.path.exists('temp'): shutil.rmtree('temp') \ No newline at end of file + if os.path.exists('temp'): + if not os.listdir('temp'): # Only if the temporary directory is empty + shutil.rmtree('temp') # Remove temporary directory + else: + print(f'=== The temporary folder is not empty ==={os.linesep}=== The temporary folder will not be deleted ==={os.linesep}=== Another instance of OrpheusDL is likely running ===') From bf09958d39da6e0c1cbfdfd8c319934db1aa1fc7 Mon Sep 17 00:00:00 2001 From: samadhi-spice <128258751+samadhi-spice@users.noreply.github.com> Date: Mon, 20 Mar 2023 10:32:25 -0600 Subject: [PATCH 2/2] Update core.py --- orpheus/core.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/orpheus/core.py b/orpheus/core.py index 9c02bbb..4ad9c63 100644 --- a/orpheus/core.py +++ b/orpheus/core.py @@ -404,8 +404,7 @@ def orpheus_core_download(orpheus_session: Orpheus, media_to_download, third_par else: raise Exception(f'\tUnknown media type "{mediatype}"') - if os.path.exists('temp'): - if not os.listdir('temp'): # Only if the temporary directory is empty + if os.path.isdir('temp') and not os.listdir('temp'): # Only if the temporary directory is empty shutil.rmtree('temp') # Remove temporary directory else: print(f'=== The temporary folder is not empty ==={os.linesep}=== The temporary folder will not be deleted ==={os.linesep}=== Another instance of OrpheusDL is likely running ===')