def clean_up(): """ Perform any script cleanup that is required here. """ nzbid = nzb.get_nzb_id() # Remove the state file. update_filepath = get_update_filepath(nzbid) if os.path.isfile(update_filepath): os.remove(update_filepath) if SCRIPT_STATE == "Debug": # Check if the script path has no other files and delete it. # NOTE: We can't blindly remove the directory because there might be # other instances waiting for their retries and need the state. tempdir = nzb.get_script_tempfolder(SCRIPT_NAME) if len(os.path.listdir(tempdir)) == 0: os.rmdirs(tempdir)
def clean_up(): """ Perform any script cleanup that is required here. """ nzbid = nzb.get_nzb_id() # Remove the state file. update_filepath = get_update_filepath(nzbid) if os.path.isfile(update_filepath): os.remove(update_filepath) if SCRIPT_STATE == 'Debug': # Check if the script path has no other files and delete it. # NOTE: We can't blindly remove the directory because there might be # other instances waiting for their retries and need the state. tempdir = nzb.get_script_tempfolder(SCRIPT_NAME) if len(os.path.listdir(tempdir)) == 0: os.rmdirs(tempdir)
def get_temp_path(): return nzb.get_script_tempfolder(SCRIPT_NAME)