Compare commits

..

No commits in common. "0e7fb14a4232c561a6ea4eef397bdebfb5d35e1a" and "44626d8e50c5f9b56b3a474a0df11d1881dfacc7" have entirely different histories.

View File

@ -14,20 +14,6 @@ BasePath = ""
SourcePath = ""
SourceFolder = ""
def checkSeasonFolder(SourceFolder):
count = 0
for file in glob.glob(SourceFolder + "/*"):
if file.endswith(".mkv"):
logging.info(f"Found mkv file {file} in the folder: {SourceFolder}")
count += 1
if count > 1:
logging.info("Identified a Season folder")
return True
else:
logging.info("This is not a Season folder")
return False
def sendNotifications(title, message, priority):
resp = requests.post('https://gotify.rouggy.com/message?token=AKMj5SsZblmpAJ_', json={
"message": message,
@ -35,7 +21,6 @@ def sendNotifications(title, message, priority):
"title": title
})
try:
# Sonarr
EventType = os.environ.get('sonarr_eventtype')
@ -57,14 +42,12 @@ if BasePath not in PATH_LIST:
os.remove(SourcePath)
logging.debug(f"Removing file {SourcePath}")
for file in glob.glob(SourceFolder + "/*"):
if not file.endswith(".mkv"):
os.remove(file)
logging.debug(f"Removing file {file} from {SourceFolder}")
if not checkSeasonFolder(SourceFolder):
os.rmdir(SourceFolder)
logging.debug(f"Deleting folder {SourceFolder}")
os.remove(file)
logging.debug(f"Removing file {file} from {SourceFolder}")
os.rmdir(SourceFolder)
logging.debug(f"Deleting folder {SourceFolder}")
except:
logging.warning("Error while trying to delete the files")
pass
else:
try:
os.remove(SourcePath)