32 lines
651 B
Python
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
|