Fix logging for remove, fix windows paths.

This commit is contained in:
Matthew Stratford 2021-05-11 23:52:34 +01:00
parent 0b5bdcb59c
commit ac6db2a623

View file

@ -1,5 +1,5 @@
from helpers.state_manager import StateManager from helpers.state_manager import StateManager
from helpers.os_environment import resolve_external_file_path from helpers.os_environment import isWindows, resolve_external_file_path
from typing import List from typing import List
from setproctitle import setproctitle from setproctitle import setproctitle
from multiprocessing import current_process, Queue from multiprocessing import current_process, Queue
@ -43,6 +43,10 @@ class FileManager:
for channel in range(channel_count): for channel in range(channel_count):
try: try:
message = channel_from_q[channel].get_nowait() message = channel_from_q[channel].get_nowait()
except Exception:
continue
try:
#source = message.split(":")[0] #source = message.split(":")[0]
command = message.split(":",2)[1] command = message.split(":",2)[1]
@ -66,6 +70,9 @@ class FileManager:
files = [f for f in os.listdir(path) if os.path.isfile(os.path.join(path, f))] files = [f for f in os.listdir(path) if os.path.isfile(os.path.join(path, f))]
for file in files: for file in files:
if isWindows():
filepath = path+"\\"+file
else:
filepath = path+"/"+file filepath = path+"/"+file
self.logger.log.info("Removing file {} on new show load.".format(filepath)) self.logger.log.info("Removing file {} on new show load.".format(filepath))
os.remove(filepath) os.remove(filepath)
@ -90,7 +97,7 @@ class FileManager:
last_known_show_plan[channel] = show_plan last_known_show_plan[channel] = show_plan
except Exception: except Exception:
pass self.logger.log.exception("Failed to handle message {} on channel {}.".format(message, channel))
# Right, let's have a quick check in the status for shows without filenames, to preload them. # Right, let's have a quick check in the status for shows without filenames, to preload them.