mai2: fix movies

This commit is contained in:
Hay1tsme 2023-06-25 19:10:34 -04:00
parent 0c6d9a36ce
commit e3d38dacde
3 changed files with 33 additions and 4 deletions

View File

@ -36,7 +36,7 @@ class Mai2Base:
"rebootEndTime": "2020-01-01 07:59:59.0",
"movieUploadLimit": 100,
"movieStatus": 1,
"movieServerUri": self.old_server + "movie",
"movieServerUri": self.old_server + "api/movie" if self.game_config.uploads.movies else "movie",
"deliverServerUri": self.old_server + "deliver/" if self.can_deliver and self.game_config.deliver.enable else "",
"oldServerUri": self.old_server + "old",
"usbDlServerUri": self.old_server + "usbdl/" if self.can_deliver and self.game_config.deliver.udbdl_enable else "",

View File

@ -41,8 +41,37 @@ class Mai2DeliverConfig:
self.__config, "mai2", "server", "content_folder", default=""
)
class Mai2UploadsConfig:
def __init__(self, parent: "Mai2Config") -> None:
self.__config = parent
@property
def photos(self) -> bool:
return CoreConfig.get_config_field(
self.__config, "mai2", "uploads", "photos", default=False
)
@property
def photos_dir(self) -> str:
return CoreConfig.get_config_field(
self.__config, "mai2", "uploads", "photos_dir", default=""
)
@property
def movies(self) -> bool:
return CoreConfig.get_config_field(
self.__config, "mai2", "uploads", "movies", default=False
)
@property
def movies_dir(self) -> str:
return CoreConfig.get_config_field(
self.__config, "mai2", "uploads", "movies_dir", default=""
)
class Mai2Config(dict):
def __init__(self) -> None:
self.server = Mai2ServerConfig(self)
self.deliver = Mai2DeliverConfig(self)
self.uploads = Mai2UploadsConfig(self)

View File

@ -113,7 +113,7 @@ class Mai2Servlet:
if url_path.lower() == "ping":
return zlib.compress(b'{"returnCode": "1"}')
elif url_path.startswith("movie/"):
elif url_path.startswith("api/movie/"):
self.logger.info(f"Movie data: {url_path} - {request.content.getvalue()}")
return b""
@ -215,8 +215,8 @@ class Mai2Servlet:
self.logger.info(f"v{version} GET {url_path}")
url_split = url_path.split("/")
if url_split[0] == "movie":
if url_split[1] == "moviestart":
if (url_split[0] == "api" and url_split[1] == "movie") or url_split[0] == "movie":
if url_split[2] == "moviestart":
return json.dumps({"moviestart":{"status":"OK"}}).encode()
if url_split[0] == "old":