2022-06-05 11:32:56 +07:00
|
|
|
#!/home/rouggy/Scripts/ArrDeleteFiles/.venv/bin/python3
|
2022-06-05 11:25:23 +07:00
|
|
|
import sys
|
|
|
|
import os
|
|
|
|
|
|
|
|
book = {}
|
|
|
|
|
2023-02-15 11:13:48 +07:00
|
|
|
PATH_LIST = ["EBooks"]
|
|
|
|
|
2022-06-05 11:25:23 +07:00
|
|
|
try:
|
|
|
|
book = {
|
|
|
|
"EventType": os.environ.get('readarr_eventtype'),
|
|
|
|
"AuthorId": os.environ.get('readarr_author_id'),
|
|
|
|
"AuthorName": os.environ.get('readarr_author_name'),
|
|
|
|
"AuthorPath": os.environ.get('readarr_author_path'),
|
|
|
|
"AuthorGrid": os.environ.get('readarr_author_grid'),
|
|
|
|
"BookId": os.environ.get('readarr_book_id'),
|
|
|
|
"BookTitle": os.environ.get('readarr_book_title'),
|
|
|
|
"BookGrid": os.environ.get('readarr_book_grid'),
|
|
|
|
"BookReleaseDate": os.environ.get('readarr_book_releasedate'),
|
|
|
|
"DownloadClient": os.environ.get('readarr_download_client'),
|
|
|
|
"DownloadId": os.environ.get('readarr_download_id'),
|
|
|
|
"AddedBookPath": os.environ.get('readarr_addedbookpaths'),
|
|
|
|
"DeletedPath": os.environ.get('readarr_deletedpaths')
|
|
|
|
}
|
|
|
|
except:
|
|
|
|
print("Cannot get env variables")
|
|
|
|
|
|
|
|
for key, value in book.items():
|
|
|
|
with open('/home/rouggy/Scripts/Readarr/log.txt', 'a') as f:
|
|
|
|
f.write(f"{key}: {value}")
|
|
|
|
f.write('\n')
|
|
|
|
f.close()
|
|
|
|
|
2023-02-15 11:13:48 +07:00
|
|
|
if radarrBasePath not in PATH_LIST:
|
|
|
|
try:
|
|
|
|
os.remove(radarrSourcePath)
|
|
|
|
os.rmdir(radarrMovieFolder)
|
|
|
|
except:
|
|
|
|
pass
|
|
|
|
else:
|
|
|
|
try:
|
|
|
|
os.remove(radarrSourcePath)
|
|
|
|
except:
|
|
|
|
pass
|