fixed scheduling bugs

This commit is contained in:
Moe Fwacky
2021-08-08 11:12:19 -07:00
committed by GitHub
parent cf391272c3
commit acba2712ba
2 changed files with 68 additions and 46 deletions

View File

@@ -41,7 +41,10 @@ def get_playing():
for runningPID in glob.glob(pids):
with open(runningPID) as f:
pid = f.readline()
playing = { runningPID : pid }
try:
playing = { runningPID : pid }
except:
playing = None
return playing
def get_last():
@@ -208,7 +211,14 @@ parser.add_argument('-u', '--updatedatabase',
args = parser.parse_args()
if args.channel:
print("STARTING CHANNEL "+args.channel)
print("CHECKING IF PSEUDO CHANNEL IS ALREADY RUNNING")
playing = get_playing()
try:
for channel, pid in playing.items():
print("STOPPING CHANNEL "+channel.replace('/running.pid','').split('_')[1])
stop_channel(channel, pid)
except:
print("NOTICE: Pseudo Channel Not Already Running, STARTING CHANNEL "+args.channel)
start_channel(args.channel)
if args.stop:
playing = get_playing()