Add files via upload

This commit is contained in:
Andrey 2021-10-15 19:31:47 +04:00 committed by GitHub
parent 61460b2f74
commit 27c3bea52e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 24 additions and 12 deletions

View file

@ -1,10 +1,13 @@
import re import re
import lxml.html import lxml.html
from typing import Any, Dict, List from typing import Any, Dict, List, Optional
from typing import TYPE_CHECKING
from . import atserver
from . import atconnect from . import atconnect
if TYPE_CHECKING:
from atserver import AternosServer
OPT_PLAYERS = 'max-players' OPT_PLAYERS = 'max-players'
OPT_GAMEMODE = 'gamemode' OPT_GAMEMODE = 'gamemode'
OPT_DIFFICULTY = 'difficulty' OPT_DIFFICULTY = 'difficulty'
@ -72,7 +75,7 @@ FLAG_PROP_TYPE = 1
class AternosConfig: class AternosConfig:
def __init__(self, atserv:atserver.AternosServer) -> None: def __init__(self, atserv:'AternosServer') -> None:
self.atserv = atserv self.atserv = atserv

View file

@ -1,16 +1,19 @@
import lxml.html import lxml.html
from typing import Union from typing import Union
from typing import TYPE_CHECKING
from . import atserver
from . import atconnect from . import atconnect
if TYPE_CHECKING:
from atserver import AternosServer
FTYPE_FILE = 0 FTYPE_FILE = 0
FTYPE_DIR = 1 FTYPE_DIR = 1
class AternosFile: class AternosFile:
def __init__( def __init__(
atserv:atserver.AternosServer, self, atserv:'AternosServer',
path:str, name:str, ftype:int=FTYPE_FILE, path:str, name:str, ftype:int=FTYPE_FILE,
size:Union[int,float]=0, dlallowed:bool=False) -> None: size:Union[int,float]=0, dlallowed:bool=False) -> None:
@ -96,5 +99,5 @@ class AternosFile:
return self._size return self._size
@property @property
def dlallowed(self): def dlallowed(self) -> bool:
return self._dlallowed return self._dlallowed

View file

@ -1,13 +1,16 @@
import lxml.html import lxml.html
from typing import Optional, Union, List from typing import Optional, Union, List
from typing import TYPE_CHECKING
from . import atserver
from . import atconnect from . import atconnect
from . import atfile from . import atfile
if TYPE_CHECKING:
from atserver import AternosServer
class AternosFileManager: class AternosFileManager:
def __init__(atserv:atserver.AternosServer) -> None: def __init__(self, atserv:'AternosServer') -> None:
self.atserv = atserv self.atserv = atserv
@ -49,7 +52,7 @@ class AternosFileManager:
if len(dlbutton) > 0: if len(dlbutton) > 0:
dlallowed = True dlallowed = True
fullpath = f.xpath('/@data-path')[0] fullpath = f.xpath('/@data-path')
filepath = fullpath[:fullpath.rfind('/')] filepath = fullpath[:fullpath.rfind('/')]
filename = fullpath[fullpath.rfind('/'):] filename = fullpath[fullpath.rfind('/'):]
files.append( files.append(

View file

@ -1,12 +1,15 @@
import lxml.html import lxml.html
from typing import List from typing import List
from typing import TYPE_CHECKING
from . import atserver
from . import atconnect from . import atconnect
if TYPE_CHECKING:
from atserver import AternosServer
class AternosPlayersList: class AternosPlayersList:
def __init__(self, lst:str, atserv:atserver.AternosServer) -> None: def __init__(self, lst:str, atserv:'AternosServer') -> None:
self.atserv = atserv self.atserv = atserv
self.lst = lst self.lst = lst

View file

@ -40,7 +40,7 @@ class AternosServer:
self._info = json.loads( self._info = json.loads(
re.search( re.search(
r'var\s*lastStatus\s*=\s*({.*})', r'var\s*lastStatus\s*=\s*({.*})',
servtree.head.text servtree.head.text_content()
)[1] )[1]
) )