fixed some errors

This commit is contained in:
michael-grace 2020-11-04 00:09:42 +00:00
parent 51ae3033b9
commit ae5cea9c62
3 changed files with 12 additions and 11 deletions

View file

@ -13,6 +13,7 @@
"""
from typing import Dict
import os
class PlanObject:
_timeslotitemid: int = 0
@ -48,3 +49,9 @@ class PlanObject:
self._title = new_item["title"]
self._artist = new_item["artist"]
# Fix any OS specific / or \'s
if os.path.sep == "/":
self._filename = self.filename.replace("\\", '/')
else:
self._filename = self.filename.replace("/", '\\')

View file

@ -32,14 +32,14 @@ from plan import PlanObject
import os
import sys
os.environ['PYGAME_HIDE_SUPPORT_PROMPT'] = "hide"
from pygame import mixer
from mutagen.mp3 import MP3
from state_manager import StateManager
from helpers.os_environment import isMacOS
os.environ['PYGAME_HIDE_SUPPORT_PROMPT'] = "hide"
class Player():
state = None
@ -232,12 +232,6 @@ class Player():
def load(self, timeslotitemid: int):
if not self.isPlaying:
self.unload()
# Fix any OS specific / or \'s
if os.path.sep == "/":
filename = filename.replace("\\", '/')
else:
filename = filename.replace("/", '\\')
updated: bool = False
@ -317,7 +311,7 @@ class Player():
self.state.update("remaining", self.state.state["length"] - self.state.state["pos_true"])
if self.state.state["remaining"] == 0:
if self.state.state["remaining"] == 0 and self.state.state["loaded_item"]:
# Track has ended
print("Finished", self.state.state["loaded_item"].name)

View file

@ -153,12 +153,12 @@ def autoadvance(channel: int, state: int):
return ui_status()
@app.route("/player/<int:channel>/repeat/<state>")
def autoadvance(channel: int, state):
def repeat(channel: int, state):
channel_to_q[channel].put("REPEAT:" + state.upper())
return ui_status()
@app.route("/player/<int:channel>/playonload/<int:state>")
def autoadvance(channel: int, state: int):
def playonload(channel: int, state: int):
channel_to_q[channel].put("PLAYONLOAD:" + str(state))
return ui_status()