fix: fix bugs
This commit is contained in:
parent
361bfdb470
commit
6b7067a8d0
@ -167,7 +167,9 @@ class MediaChunkHolderManager(object):
|
|||||||
|
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
self.chunk_lru = collections.OrderedDict()
|
self.chunk_lru = collections.OrderedDict()
|
||||||
self.disk_chunk_cache = diskcache.Cache(f"{os.path.dirname(__file__)}/cache_media")
|
self.disk_chunk_cache = diskcache.Cache(
|
||||||
|
f"{os.path.dirname(__file__)}/cache_media", size_limit=MediaChunkHolderManager.MAX_CACHE_SIZE
|
||||||
|
)
|
||||||
self._restore_cache()
|
self._restore_cache()
|
||||||
|
|
||||||
def _restore_cache(self) -> None:
|
def _restore_cache(self) -> None:
|
||||||
@ -178,6 +180,8 @@ class MediaChunkHolderManager(object):
|
|||||||
self._set_media_chunk_index(holder.info)
|
self._set_media_chunk_index(holder.info)
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
logger.warning(f"restore, {err=},{traceback.format_exc()}")
|
logger.warning(f"restore, {err=},{traceback.format_exc()}")
|
||||||
|
while self.current_cache_size > self.MAX_CACHE_SIZE:
|
||||||
|
self._remove_pop_chunk()
|
||||||
|
|
||||||
def get_chunk_holder_by_info(self, info: ChunkInfo) -> MediaChunkHolder:
|
def get_chunk_holder_by_info(self, info: ChunkInfo) -> MediaChunkHolder:
|
||||||
holder = self.incompleted_chunk.get(info.id)
|
holder = self.incompleted_chunk.get(info.id)
|
||||||
|
@ -42,7 +42,7 @@ class TgFileSystemClient(object):
|
|||||||
# task should: (task_id, callabledFunc)
|
# task should: (task_id, callabledFunc)
|
||||||
task_queue: asyncio.Queue
|
task_queue: asyncio.Queue
|
||||||
task_id: int = 0
|
task_id: int = 0
|
||||||
me: Union[types.User, types.InputPeerUser]
|
me: Union[types.User, types.InputPeerUser] = None
|
||||||
# client config
|
# client config
|
||||||
client_param: configParse.TgToFileSystemParameter.ClientConfigPatameter
|
client_param: configParse.TgToFileSystemParameter.ClientConfigPatameter
|
||||||
|
|
||||||
|
@ -13,5 +13,7 @@ for v in backend_status["clients"]:
|
|||||||
|
|
||||||
if need_login:
|
if need_login:
|
||||||
import login
|
import login
|
||||||
|
login.loop()
|
||||||
else:
|
else:
|
||||||
import search
|
import search
|
||||||
|
search.loop()
|
||||||
|
@ -4,11 +4,11 @@ import os
|
|||||||
import streamlit as st
|
import streamlit as st
|
||||||
import qrcode
|
import qrcode
|
||||||
|
|
||||||
sys.path.append(os.getcwd() + "/../")
|
|
||||||
import configParse
|
|
||||||
import utils
|
import utils
|
||||||
import remote_api as api
|
import remote_api as api
|
||||||
|
|
||||||
|
@st.experimental_fragment
|
||||||
|
def loop():
|
||||||
url = api.login_client_by_qr_code_url()
|
url = api.login_client_by_qr_code_url()
|
||||||
|
|
||||||
if url is None or url == "":
|
if url is None or url == "":
|
||||||
|
@ -3,13 +3,11 @@ import os
|
|||||||
|
|
||||||
import streamlit as st
|
import streamlit as st
|
||||||
|
|
||||||
sys.path.append(os.getcwd() + "/../")
|
|
||||||
import configParse
|
|
||||||
import utils
|
import utils
|
||||||
import remote_api as api
|
import remote_api as api
|
||||||
|
|
||||||
param = configParse.get_TgToFileSystemParameter()
|
@st.experimental_fragment
|
||||||
|
def loop():
|
||||||
if 'page_index' not in st.session_state:
|
if 'page_index' not in st.session_state:
|
||||||
st.session_state.page_index = 1
|
st.session_state.page_index = 1
|
||||||
if 'force_skip' not in st.session_state:
|
if 'force_skip' not in st.session_state:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user