summaryrefslogtreecommitdiff
path: root/kvmd/plugins/msd/otg/__init__.py
diff options
context:
space:
mode:
authorMaxim Devaev <[email protected]>2022-07-24 16:16:45 +0300
committerMaxim Devaev <[email protected]>2022-07-24 16:16:45 +0300
commit1055dadcb98b50c7ecbaa6604ec980f2a19c6ba8 (patch)
treec5b00dd6fd684ca8d67d188311a7598c6fee295c /kvmd/plugins/msd/otg/__init__.py
parent1564c6872739b64754ca548e5f58248465c31810 (diff)
msd: downloading status api
Diffstat (limited to 'kvmd/plugins/msd/otg/__init__.py')
-rw-r--r--kvmd/plugins/msd/otg/__init__.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/kvmd/plugins/msd/otg/__init__.py b/kvmd/plugins/msd/otg/__init__.py
index a98924ac..bc2b2f99 100644
--- a/kvmd/plugins/msd/otg/__init__.py
+++ b/kvmd/plugins/msd/otg/__init__.py
@@ -204,6 +204,8 @@ class Plugin(BaseMsd): # pylint: disable=too-many-instance-attributes
del storage["images"][name]["path"]
del storage["images"][name]["in_storage"]
+ storage["downloading"] = (self.__reader.get_state() if self.__reader else None)
+
if self.__writer:
# При загрузке файла показываем актуальную статистику вручную
storage["uploading"] = self.__writer.get_state()
@@ -343,7 +345,11 @@ class Plugin(BaseMsd): # pylint: disable=too-many-instance-attributes
if name not in self.__state.storage.images or not os.path.exists(path):
raise MsdUnknownImageError()
- self.__reader = await MsdImageReader(path, self.__read_chunk_size).open()
+ self.__reader = await MsdImageReader(
+ notifier=self.__notifier,
+ path=path,
+ chunk_size=self.__read_chunk_size,
+ ).open()
yield self.__reader.get_size()