fixed case of CPL play
This commit is contained in:
@@ -168,3 +168,4 @@ cython_debug/
|
||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||
#.idea/
|
||||
|
||||
dcpservers.json
|
||||
|
||||
+4
-4
@@ -39,7 +39,7 @@ class SMSMessageWrapper(BaseModel, Generic[V]):
|
||||
path: ClassVar[List[str]]
|
||||
params: ClassVar[Dict[str, str]] = {}
|
||||
|
||||
MessageHeader: MessageHeaderWrapper
|
||||
MessageHeader: Optional[MessageHeaderWrapper] = None
|
||||
MessageBody: Optional[V] = None
|
||||
|
||||
class DCPInfoWrapper(BaseModel):
|
||||
@@ -76,8 +76,8 @@ class ShowStatusDetailWrapper(BaseModel):
|
||||
ElapsedTime: int
|
||||
TotalDuration: int
|
||||
CurrentEventTitle: Optional[str] = None
|
||||
CurrentEventId: UUID
|
||||
CurrentEventType: str
|
||||
CurrentEventId: Optional[UUID] = None
|
||||
CurrentEventType: Optional[str] = None
|
||||
IsStoppedByMalfunction: bool
|
||||
RewindTimeList: List[int]
|
||||
MalfunctionTime: int
|
||||
@@ -257,7 +257,7 @@ class CommandBodyWrapper(MessageBodyWrapper):
|
||||
class AddImportJob(SMSMessageWrapper):
|
||||
path = ['content', 'dcp', 'command']
|
||||
|
||||
MessageHeader: MessageHeaderWrapper = MessageHeaderWrapper (
|
||||
MessageHeader: Optional[MessageHeaderWrapper] = MessageHeaderWrapper (
|
||||
Id=-1,
|
||||
Type="Command",
|
||||
Source="LSM-100v2"
|
||||
|
||||
+4
-8
@@ -67,19 +67,15 @@ def on_command(client: mqtt_client.Client, userdata: Any, msg: mqtt_client.MQTTM
|
||||
Value=f"ftp://{user_pswd}@{this_server.host}:{this_server.port}/{dir_name}"
|
||||
)
|
||||
)
|
||||
rv: Dict = projector.post(
|
||||
error_response: ErrorResponse = projector.post(
|
||||
path=ingest_command.path,
|
||||
data=xmltodict.unparse(
|
||||
SMSMessage(
|
||||
SMSMessage=ingest_command
|
||||
).model_dump(), indent=1)
|
||||
data=SMSMessage(SMSMessage=ingest_command)
|
||||
)
|
||||
error_response = ErrorResponse.model_validate(rv['SMSMessage'])
|
||||
if not error_response.MessageBody:
|
||||
LOGGER.warning("Invalid error response: [%s]", rv)
|
||||
LOGGER.warning("Invalid error response: [%s]", error_response.model_dump_json())
|
||||
return
|
||||
if error_response.MessageBody.ErrorResponse.Code != 100:
|
||||
LOGGER.error("Unable to ingest Title: [%s]", dir_name)
|
||||
LOGGER.error("Unable to ingest Title [%s]: [%s]", dir_name, error_response.MessageBody.ErrorResponse.Message)
|
||||
else:
|
||||
LOGGER.info("Started ingest of Title: [%s] from [%s]", dir_name, this_server.name)
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ from os import getcwd
|
||||
from typing import Any, Dict, List, Type, TypeVar
|
||||
|
||||
import xmltodict
|
||||
from commands import SMSMessageWrapper
|
||||
from commands import SMSMessageWrapper, SMSMessage, ErrorResponse
|
||||
from requests.auth import HTTPBasicAuth
|
||||
|
||||
T = TypeVar("T", bound=SMSMessageWrapper)
|
||||
@@ -26,7 +26,7 @@ class ProjectorConnection():
|
||||
self.password = password
|
||||
self.auth = HTTPBasicAuth(username=self.username, password=self.password)
|
||||
|
||||
def post(self, path: List[str], params: Dict[str, str] | None = None, data: str | None = None) -> Dict[str, Any]:
|
||||
def post(self, path: List[str], data: SMSMessage, params: Dict[str, str] | None = None) -> ErrorResponse:
|
||||
response: requests.Response = requests.post(
|
||||
url=f"https://{self.ip}/{"/".join(path)}",
|
||||
params=params,
|
||||
@@ -37,12 +37,13 @@ class ProjectorConnection():
|
||||
allow_redirects=False,
|
||||
timeout=5,
|
||||
verify=False,
|
||||
data=data
|
||||
data=xmltodict.unparse(data.model_dump(), indent=1)
|
||||
)
|
||||
response.raise_for_status()
|
||||
if response.status_code == 200: # HTTP ok response
|
||||
return xmltodict.parse(response.text.replace("%2F", "/").replace("%3A", ":")) # Common containert for all messages
|
||||
return {}
|
||||
rv: Dict[str, Any] = xmltodict.parse(response.text.replace("%2F", "/").replace("%3A", ":")) # Common containert for all messages
|
||||
return ErrorResponse.model_validate(rv['SMSMessage'])
|
||||
return ErrorResponse()
|
||||
|
||||
def get(self, path: List[str], params: Dict[str, str] | None = None) -> Dict[str, Any]:
|
||||
response: requests.Response = requests.get(
|
||||
|
||||
Reference in New Issue
Block a user