This repository has been archived on 2023-12-18. You can view files and clone it, but cannot push or open issues or pull requests.
ArrDeleteFiles/Lidarr/delete_files.py
2022-06-05 11:25:23 +07:00

32 lines
651 B
Python

#!/usr/bin/python3
import requests
import os
import shutil
PATH_LIST = ["Music"]
lidarrBasePath = ""
lidarrSourcePath = ""
lidarrMP3Folder = ""
try:
# lidarr
lidarrEventType = os.environ.get('lidarr_eventtype')
lidarrSourcePath = os.environ.get('lidarr_moviefile_sourcepath')
# Get the folder name of the file to check if movie/serie is inside a folder or not
lidarrMP3Folder = os.path.dirname(lidarrSourcePath)
lidarrBasePath = os.path.basename(lidarrMP3Folder)
except:
print("Cannot get env variables")
if lidarrBasePath not in PATH_LIST:
try:
shutil.rmtree(lidarrMP3Folder)
except:
pass