This commit is contained in:
flaskfarm
2022-10-17 21:32:53 +09:00
parent 2f97750ae7
commit a78ac3442e
5 changed files with 12 additions and 20 deletions

View File

@@ -1 +1 @@
VERSION="4.0.16" VERSION="4.0.17"

View File

@@ -15,9 +15,9 @@ logger = get_logger()
from .base.aes import SupportAES from .base.aes import SupportAES
from .base.discord import SupportDiscord from .base.discord import SupportDiscord
from .base.file import SupportFile from .base.file import SupportFile
from .base.sc import SupportSC
from .base.string import SupportString from .base.string import SupportString
from .base.sub_process import SupportSubprocess from .base.sub_process import SupportSubprocess
from .base.support_sc import SupportSC
from .base.telegram import SupportTelegram from .base.telegram import SupportTelegram
from .base.util import (AlchemyEncoder, SingletonClass, SupportUtil, from .base.util import (AlchemyEncoder, SingletonClass, SupportUtil,
default_headers, pt) default_headers, pt)

View File

@@ -10,27 +10,19 @@ from . import logger
class SupportSC: class SupportSC:
LIBRARY_LOADING = False LIBRARY_LOADING = False
"""
try: try:
if platform.system() == 'Linux': sys.path.append(os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'libsc'))
if (platform.platform().find('86') == -1 and platform.platform().find('64') == -1) or platform.platform().find('arch') != -1 or platform.platform().find('arm') != -1: import support.base.support_sc as support_sc
sys.path.insert(2, os.path.join(os.path.dirname(os.path.abspath(__file__)), 'lib', 'sc', 'LinuxArm'))
else:
sys.path.insert(2, os.path.join(os.path.dirname(os.path.abspath(__file__)), 'lib', 'sc', 'Linux'))
if platform.system() == 'Windows':
sys.path.append(os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'sc', 'Windows'))
import sc
LIBRARY_LOADING = True LIBRARY_LOADING = True
except: except:
pass pass
"""
@classmethod @classmethod
def encode(cls, text, mode=0): def encode(cls, text, mode=0):
try: try:
import sc import support.base.support_sc as support_sc
return sc.encode(text, mode) return support_sc.encode(text, mode)
except Exception as e: except Exception as e:
logger.error(f'Exception:{str(e)}') logger.error(f'Exception:{str(e)}')
logger.error(traceback.format_exc()) logger.error(traceback.format_exc())
@@ -40,16 +32,16 @@ class SupportSC:
@classmethod @classmethod
def decode(cls, text): def decode(cls, text):
try: try:
import sc import support.base.support_sc as support_sc
return sc.decode(text) return support_sc.decode(text)
except: except:
return None return None
@classmethod @classmethod
def load_module(cls, module_name, module_code): def load_module(cls, module_name, module_code):
try: try:
import sc import support.base.support_sc as support_sc
mod = sc.load_module(module_name, module_code) mod = support_sc.load_module(module_name, module_code)
sys.modules[mod] = mod sys.modules[mod] = mod
logger.warning(f"C-LOADING : {module_name}") logger.warning(f"C-LOADING : {module_name}")
return mod return mod
@@ -73,8 +65,8 @@ class SupportSC:
@classmethod @classmethod
def td(self, mediacode, ts, url): def td(self, mediacode, ts, url):
try: try:
import sc import support.base.support_sc as support_sc
ret = sc.td1(mediacode, str(ts), url).strip() ret = support_sc.td1(mediacode, str(ts), url).strip()
ret = re.sub('[^ -~]+', '', ret).strip() ret = re.sub('[^ -~]+', '', ret).strip()
return ret return ret
except: except: