mirror of
https://github.com/joshuaboniface/rffmpeg.git
synced 2026-01-23 02:24:03 +00:00
Fix ordering of statefile and its removal
This commit is contained in:
parent
d61a6c5bf3
commit
18b7acf562
1 changed files with 8 additions and 5 deletions
13
rffmpeg.py
13
rffmpeg.py
|
|
@ -131,7 +131,10 @@ def local_ffmpeg_fallback():
|
|||
stdout=stdout)
|
||||
returncode = p.returncode
|
||||
|
||||
os.remove(current_statefile)
|
||||
try:
|
||||
os.remove(current_statefile)
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
|
||||
logger("Finished rffmpeg {} (local failover mode) with return code {}".format(our_pid, returncode))
|
||||
exit(returncode)
|
||||
|
|
@ -187,14 +190,14 @@ def get_target_host():
|
|||
lowest_count = host_counts[host]
|
||||
target_host = host
|
||||
|
||||
if not target_host:
|
||||
logger('Failed to find a valid target host - using local fallback instead')
|
||||
local_ffmpeg_fallback()
|
||||
|
||||
# Write to our state file
|
||||
with open(current_statefile, 'a') as statefile:
|
||||
statefile.write(config['state_contents'].format(host=target_host) + '\n')
|
||||
|
||||
if not target_host:
|
||||
logger('Failed to find a valid target host - using local fallback instead')
|
||||
local_ffmpeg_fallback()
|
||||
|
||||
return target_host
|
||||
|
||||
def bad_host(target_host):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue