ASMRManager 2.3.0__tar.gz → 2.3.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/PKG-INFO +11 -4
  2. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/README.md +9 -2
  3. asmrmanager-2.3.2/asmrmanager/_version.py +1 -0
  4. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/cli/core.py +1 -1
  5. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/cli/pl.py +1 -0
  6. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/cli/play.py +1 -0
  7. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/cli/utils.py +10 -1
  8. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/common/rj_parse.py +1 -1
  9. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/filemanager/manager.py +12 -9
  10. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/filemanager/resources/config.example.toml +15 -8
  11. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/spider/downloader.py +53 -25
  12. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/pyproject.toml +2 -2
  13. asmrmanager-2.3.0/asmrmanager/_version.py +0 -1
  14. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/LICENSE +0 -0
  15. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/__init__.py +0 -0
  16. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/__main__.py +0 -0
  17. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/cli/dl.py +0 -0
  18. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/cli/file.py +0 -0
  19. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/cli/hold.py +0 -0
  20. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/cli/info.py +0 -0
  21. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/cli/main.py +0 -0
  22. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/cli/query.py +0 -0
  23. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/cli/review.py +0 -0
  24. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/cli/sql.py +0 -0
  25. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/cli/view.py +0 -0
  26. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/cli/which.py +0 -0
  27. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/common/__init__.py +0 -0
  28. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/common/browse_params.py +0 -0
  29. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/common/download_params.py +0 -0
  30. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/common/fileconverter.py +0 -0
  31. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/common/output.py +0 -0
  32. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/common/parse_filter.py +0 -0
  33. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/common/select.py +0 -0
  34. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/common/types.py +0 -0
  35. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/common/vtt2lrc.py +0 -0
  36. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/config.py +0 -0
  37. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/database/__init__.py +0 -0
  38. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/database/database.py +0 -0
  39. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/database/engine.py +0 -0
  40. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/database/manage.py +0 -0
  41. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/database/orm_type.py +0 -0
  42. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/database/q_func.py +0 -0
  43. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/database/utils/__init__.py +0 -0
  44. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/database/utils/add2db.py +0 -0
  45. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/database/utils/uuid_sqlite.py +0 -0
  46. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/filemanager/__init__.py +0 -0
  47. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/filemanager/appdirs_.py +0 -0
  48. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/filemanager/exceptions.py +0 -0
  49. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/filemanager/file_zipper.py +0 -0
  50. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/filemanager/resources/sqls.example/circle_name.sql +0 -0
  51. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/filemanager/resources/sqls.example/score.sql +0 -0
  52. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/filemanager/resources/sqls.example/search.sql +0 -0
  53. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/filemanager/resources/sqls.example/tags.sql +0 -0
  54. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/filemanager/resources/sqls.example/test.sql +0 -0
  55. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/filemanager/resources/sqls.example/vas.sql +0 -0
  56. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/filemanager/utils.py +0 -0
  57. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/logger/__init__.py +0 -0
  58. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/lrcplayer/__init__.py +0 -0
  59. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/lrcplayer/lrcparse.py +0 -0
  60. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/lrcplayer/main.css +0 -0
  61. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/lrcplayer/main.py +0 -0
  62. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/lrcplayer/player/base.py +0 -0
  63. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/lrcplayer/player/mpdplayer.py +0 -0
  64. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/lrcplayer/player/pygameplayer.py +0 -0
  65. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/spider/__init__.py +0 -0
  66. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/spider/asmrapi.py +0 -0
  67. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/spider/interface.py +0 -0
  68. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/spider/playlist.py +0 -0
  69. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/spider/utils/IDMHelper.py +0 -0
  70. {asmrmanager-2.3.0 → asmrmanager-2.3.2}/asmrmanager/spider/utils/aria2_downloader.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ASMRManager
3
- Version: 2.3.0
3
+ Version: 2.3.2
4
4
  Summary: download, manage and play the voices on asmr.one
5
5
  Keywords: asmr,downloader,music,player,manager,cli,tui,commandline,terminal
6
6
  Author-Email: SLQY <sqiyel@gmail.com>
@@ -13,7 +13,7 @@ Requires-Dist: click>=8.1.3
13
13
  Requires-Dist: colorlog>=6.7.0
14
14
  Requires-Dist: pylrc==0.1.2
15
15
  Requires-Dist: rich>=13.0.0
16
- Requires-Dist: SQLAlchemy==2.0.10
16
+ Requires-Dist: SQLAlchemy==2.0.36
17
17
  Requires-Dist: textual==0.26.0
18
18
  Requires-Dist: mutagen>=1.46.0
19
19
  Requires-Dist: appdirs>=1.4.4
@@ -170,7 +170,7 @@ pip install ASMRManager[依赖]
170
170
  另外本工具提供基于 `trogon` 的可视化命令行界面,在安装`tui`依赖后使用 `asmr tui` 即可打开。
171
171
 
172
172
  ## 命令行补全
173
- 仅适用于Linux,详情可参考[官方文档](https://click.palletsprojects.com/en/8.1.x/shell-completion)。
173
+ 仅支持 Bash/Fish/Zsh,详情可参考[官方文档](https://click.palletsprojects.com/en/8.1.x/shell-completion)。
174
174
  ```shell
175
175
  # fish
176
176
  _ASMR_COMPLETE=fish_source asmr > ~/.config/fish/completions/asmr.fish
@@ -213,7 +213,7 @@ asmr dl get 300015443 # 本项目存储VJ与BJ所使用的ID("3" + 8位VJ号
213
213
  检查下载目录下文件是否下载完全(只验证文件存在,不保证文件完整性)
214
214
  ```shell
215
215
  asmr file check
216
- asmr file check --list | xargs asmr dl get --force # 重新下载所有不完整的文件,以linux shell为例
216
+ asmr file check --list | xargs asmr dl get --force # 重新下载所有不完整的文件,以bash shell为例
217
217
  ```
218
218
 
219
219
  将下载的文件转移到存储目录(STORAGE_PATH),并执行相应文件格式转换(详情见config.toml的before_store字段)
@@ -239,6 +239,13 @@ asmr query 治愈 --limit 3 --raw | jq .[].id | xargs -n1 asmr info # 输出为j
239
239
  1. 获取下载文件后:检查文件的名称和路径,如果不符合filename_filters里指定的规则,则跳过下载。可以通过`--ignore-name`来强制下载。
240
240
  1. 添加下载任务时:如果检测到本地有同名文件,则跳过该文件的下载。可以通过`--replace`来强制覆盖存在的文件。
241
241
 
242
+ ## 多线程下载相关
243
+ 由于网站对下载并无相关限制,因此没必要设置过高的线程数,一般来说单文件1~2即可。
244
+ 对于 `IDM` 设置方法如下:
245
+ ![IDM](./assets/IDM.png)
246
+
247
+ 对于 `aria2` 修改配置 `max-connection-per-server = 2` 即可:
248
+
242
249
  ## 其他
243
250
 
244
251
  感谢 <https://asmr.one>丰富了我的夜生活。
@@ -128,7 +128,7 @@ pip install ASMRManager[依赖]
128
128
  另外本工具提供基于 `trogon` 的可视化命令行界面,在安装`tui`依赖后使用 `asmr tui` 即可打开。
129
129
 
130
130
  ## 命令行补全
131
- 仅适用于Linux,详情可参考[官方文档](https://click.palletsprojects.com/en/8.1.x/shell-completion)。
131
+ 仅支持 Bash/Fish/Zsh,详情可参考[官方文档](https://click.palletsprojects.com/en/8.1.x/shell-completion)。
132
132
  ```shell
133
133
  # fish
134
134
  _ASMR_COMPLETE=fish_source asmr > ~/.config/fish/completions/asmr.fish
@@ -171,7 +171,7 @@ asmr dl get 300015443 # 本项目存储VJ与BJ所使用的ID("3" + 8位VJ号
171
171
  检查下载目录下文件是否下载完全(只验证文件存在,不保证文件完整性)
172
172
  ```shell
173
173
  asmr file check
174
- asmr file check --list | xargs asmr dl get --force # 重新下载所有不完整的文件,以linux shell为例
174
+ asmr file check --list | xargs asmr dl get --force # 重新下载所有不完整的文件,以bash shell为例
175
175
  ```
176
176
 
177
177
  将下载的文件转移到存储目录(STORAGE_PATH),并执行相应文件格式转换(详情见config.toml的before_store字段)
@@ -197,6 +197,13 @@ asmr query 治愈 --limit 3 --raw | jq .[].id | xargs -n1 asmr info # 输出为j
197
197
  1. 获取下载文件后:检查文件的名称和路径,如果不符合filename_filters里指定的规则,则跳过下载。可以通过`--ignore-name`来强制下载。
198
198
  1. 添加下载任务时:如果检测到本地有同名文件,则跳过该文件的下载。可以通过`--replace`来强制覆盖存在的文件。
199
199
 
200
+ ## 多线程下载相关
201
+ 由于网站对下载并无相关限制,因此没必要设置过高的线程数,一般来说单文件1~2即可。
202
+ 对于 `IDM` 设置方法如下:
203
+ ![IDM](./assets/IDM.png)
204
+
205
+ 对于 `aria2` 修改配置 `max-connection-per-server = 2` 即可:
206
+
200
207
  ## 其他
201
208
 
202
209
  感谢 <https://asmr.one>丰富了我的夜生活。
@@ -0,0 +1 @@
1
+ __version__ = "2.3.2"
@@ -155,7 +155,7 @@ def browse_param_options(f):
155
155
  )
156
156
  wrapper_common_options.__doc__ += """
157
157
 
158
- nsfw will only show the full age ASMRs
158
+ --order=nsfw will only show the full age ASMRs
159
159
 
160
160
  for other --order values, you can refer to the website for
161
161
  explicit meaning
@@ -99,6 +99,7 @@ def create(
99
99
  @click.command()
100
100
  @click.argument("pl_id", type=PLID(), callback=pl_preprocess_cb)
101
101
  def show(pl_id: uuid.UUID):
102
+ """show asmrs in the playlist"""
102
103
  pl = create_playlist()
103
104
  pl.run(pl.show(pl_id))
104
105
 
@@ -9,6 +9,7 @@ from asmrmanager.logger import logger
9
9
  @click.pass_context
10
10
  @rj_argument("local")
11
11
  def play(ctx: click.Context, source_id: LocalSourceID):
12
+ """play asmr with a simple TUI"""
12
13
  from asmrmanager.filemanager.utils import folder_chooser
13
14
 
14
15
  """play an asmr in the terminal"""
@@ -63,13 +63,22 @@ def convert(
63
63
  or vtt_path.with_suffix("").with_suffix(".lrc").exists()
64
64
  )
65
65
  vtt_path.unlink()
66
- elif mode in ("mp3", "flac"):
66
+ elif mode == "flac":
67
67
  from asmrmanager.common.fileconverter import convert_audio_format
68
68
 
69
69
  for wav_path in path.rglob("*.wav"):
70
70
  convert_audio_format(wav_path, mode)
71
71
  assert wav_path.with_suffix(f".{mode}").exists()
72
72
  wav_path.unlink()
73
+ elif mode == "mp3":
74
+ from asmrmanager.common.fileconverter import convert_audio_format
75
+
76
+ for src_path in path.rglob("*.*"):
77
+ if src_path.is_dir() or src_path.suffix not in [".flac", ".wav"]:
78
+ continue
79
+ convert_audio_format(src_path, mode)
80
+ assert src_path.with_suffix(f".{mode}").exists()
81
+ src_path.unlink()
73
82
 
74
83
 
75
84
  utils.add_command(migrate)
@@ -1,6 +1,6 @@
1
1
  from typing import Iterable, List
2
2
 
3
- from .types import LocalSourceID, RemoteSourceID, SourceID, SourceName
3
+ from .types import LocalSourceID, SourceID, SourceName
4
4
 
5
5
 
6
6
  def source2id(source: str) -> SourceID | None:
@@ -8,13 +8,15 @@ from typing import (
8
8
  Literal,
9
9
  NamedTuple,
10
10
  Set,
11
- Tuple,
12
- overload,
13
11
  )
14
12
 
15
13
  import toml
16
14
 
17
- from asmrmanager.common.rj_parse import id2source_name, source_name2id
15
+ from asmrmanager.common.rj_parse import (
16
+ id2source_name,
17
+ source_name2id,
18
+ source2id,
19
+ )
18
20
  from asmrmanager.common.types import (
19
21
  LocalSourceID,
20
22
  PlayListItem,
@@ -140,7 +142,6 @@ class FileManager:
140
142
  hook: Callable[[Path], None] | None = None,
141
143
  ):
142
144
  """sync download path and storage path"""
143
- # TODO 换用fcp实现?
144
145
  assert self.could_store()
145
146
  rj_name = id2source_name(source_id)
146
147
  if not os.path.exists(self.download_path / rj_name):
@@ -211,10 +212,12 @@ class FileManager:
211
212
  self, replace=True, hook: Callable[[Path], None] | None = None
212
213
  ):
213
214
  for file in os.listdir(self.download_path):
214
- source_id = source_name2id(SourceName(file))
215
- if source_id is None:
215
+ if not (self.download_path / file).is_dir():
216
+ continue
217
+ if source2id(file) is None:
216
218
  logger.warning(f"Ignore invalid file {file} in download path")
217
219
  continue
220
+ source_id = source_name2id(SourceName(file))
218
221
  self.store(source_id, replace=replace, hook=hook)
219
222
 
220
223
  def could_view(self):
@@ -280,11 +283,11 @@ class FileManager:
280
283
  logger.error("Invalid path")
281
284
  return []
282
285
 
283
- for name in p.iterdir():
284
- rj_id = source_name2id(SourceName(name.name))
286
+ for item in p.iterdir():
287
+ rj_id = source2id(item.name)
285
288
  if rj_id is None:
286
289
  continue
287
- yield rj_id
290
+ yield LocalSourceID(rj_id)
288
291
 
289
292
  def zip_file(self, src: Path, dst: Path):
290
293
  from asmrmanager.filemanager.file_zipper import zip_chosen_folder
@@ -49,11 +49,14 @@ player = 'pygame'
49
49
  # 将path 下的所有<from_>类型的文件转化为<to>类型,
50
50
  # 对convert函数的封装,其余细节与convert无异。
51
51
 
52
- before_store = '''
53
- convert_all('vtt', 'lrc')
54
- convert_all('wav', 'mp3')
55
- convert_all('flac', 'mp3')
56
- ''''
52
+ # 例如下面的配置会将将所有的vtt文件转化为lrc文件,wav文件转化为mp3文件,flac文件转化为mp3文件
53
+ # before_store = '''
54
+ # convert_all('vtt', 'lrc')
55
+ # convert_all('wav', 'mp3')
56
+ # convert_all('flac', 'mp3')
57
+ # ''''
58
+
59
+ before_store = ''
57
60
 
58
61
 
59
62
  # 如使用aria2请配置此项,否则请忽略
@@ -77,7 +80,7 @@ secret = ""
77
80
 
78
81
  # 示例:过滤所有的SE(不完全)
79
82
  [[filename_filters]]
80
- regex = '(効果音|SE|SE|BGM|音效)([な無无×][し]?|cut|切除|カット)'
83
+ regex = '(効果音|SE|SE|BGM|音效)[ ]?([な無无×][し]?|cut|切除|カット|オフ|off)'
81
84
 
82
85
  [[filename_filters]]
83
86
  regex = '([無无×]|不含|NO[ _]?)(効果音|SE|SE|BGM|音效)'
@@ -96,6 +99,10 @@ disable_when_nothing_to_download = true
96
99
  regex = '反転.*\.wav$'
97
100
  range = "file"
98
101
 
102
+ # 过滤壁纸文件
103
+ [[filename_filters]]
104
+ regex = "壁紙|桌布|壁纸"
105
+
99
106
  [playlist_aliases]
100
107
  # 这里可以自定义列表的别名
101
108
  # 左侧为别名,右侧为对应uuid或列表的名字,例如
@@ -103,8 +110,8 @@ range = "file"
103
110
  # 别名1 = 列表名1
104
111
  # 在创建列表时,列表名是可以重复的,因此如果右侧填列表名的话,
105
112
  # 请确认列表名的唯一性,否则将自动选取第一个符合的列表名。
106
- liked = '__SYS_PLAYLIST_LIKED' # 我喜欢的 的列表别名
107
- marked = '__SYS_PLAYLIST_MARKED' # 我标记的 的列表别名
113
+ liked = '__SYS_PLAYLIST_LIKED' # 我喜欢的 的列表别名
114
+ marked = '__SYS_PLAYLIST_MARKED' # 我标记的 的列表别名
108
115
 
109
116
  [mpd_config]
110
117
  # 这里的配置是客户端的配置
@@ -1,38 +1,59 @@
1
+ from importlib import import_module
1
2
  import json
2
3
  from pathlib import Path
3
- from typing import Any, Callable, Dict, List, Literal, TypeVar
4
+ from typing import (
5
+ Any,
6
+ Callable,
7
+ Dict,
8
+ List,
9
+ Literal,
10
+ NamedTuple,
11
+ TYPE_CHECKING,
12
+ TypeVar,
13
+ )
14
+ import typing
4
15
 
5
16
  import asyncstdlib
6
17
 
7
- from asmrmanager.common.types import RemoteSourceID
8
-
9
- T = TypeVar("T", bound="ASMRDownloadAPI")
10
-
11
-
12
18
  from asmrmanager.common.rj_parse import id2source_name, source_name2id
19
+ from asmrmanager.common.types import RemoteSourceID
13
20
  from asmrmanager.config import Aria2Config
21
+ from asmrmanager.filemanager.manager import FileManager
14
22
  from asmrmanager.logger import logger
15
23
  from asmrmanager.spider.asmrapi import ASMRAPI
16
24
 
17
- try:
18
- IDMHELPER_EXIST = True
19
- from .utils.IDMHelper import IDMHelper
20
- except (ImportError, ModuleNotFoundError):
21
- IDMHELPER_EXIST = False
25
+ T = TypeVar("T", bound="ASMRDownloadAPI")
26
+
27
+
28
+ if TYPE_CHECKING:
29
+ from .utils.IDMHelper import IDMHelper as _IDMHelper
30
+ from .utils.aria2_downloader import Aria2Downloader as _Aria2Downloader
22
31
 
23
32
  try:
24
- ARIA2_EXIST = True
25
- from .utils.aria2_downloader import Aria2Downloader
26
- except (ImportError, ModuleNotFoundError):
27
- ARIA2_EXIST = False
33
+ IDMHelper = typing.cast(
34
+ "type[_IDMHelper]",
35
+ import_module(".utils.IDMHelper", "asmrmanager.spider").IDMHelper,
36
+ )
37
+ # except (ImportError, ModuleNotFoundError):
38
+ except Exception as _:
39
+ # __IDMHELPER_EXIST = False
40
+ IDMHelper = None
28
41
 
29
- from typing import NamedTuple, TYPE_CHECKING
30
42
 
31
- from asmrmanager.filemanager.manager import FileManager
43
+ try:
44
+ # __ARIA2_EXIST = True
45
+ # from .utils.aria2_downloader import Aria2Downloader
46
+ Aria2Downloader = typing.cast(
47
+ "type[_Aria2Downloader]",
48
+ import_module(
49
+ ".utils.aria2_downloader", "asmrmanager.spider"
50
+ ).Aria2Downloader,
51
+ )
52
+ # except (ImportError, ModuleNotFoundError):
53
+ except Exception as _:
54
+ # __ARIA2_EXIST = False
55
+ Aria2Downloader = None
32
56
 
33
- if TYPE_CHECKING:
34
- from .utils.IDMHelper import IDMHelper
35
- from .utils.aria2_downloader import Aria2Downloader
36
57
 
37
58
  fm = FileManager.get_fm()
38
59
 
@@ -70,13 +91,20 @@ class ASMRDownloadAPI(ASMRAPI):
70
91
  else self.download_by_aria2
71
92
  )
72
93
 
73
- if ARIA2_EXIST:
74
- assert Aria2Downloader
75
- # 不默认使用配置文件中的proxy,可以在aria2.conf中自行添加all-proxy配置
76
- self.aria2_downloader = Aria2Downloader(None)
77
94
  self.aria2_config = aria2_config
78
95
  self.download_method = download_method
79
96
 
97
+ if self.download_method == "aria2":
98
+ assert (
99
+ Aria2Downloader is not None
100
+ ), "You have `download_method = aria2` configured, but failed to import corresponding class: Aria2Downloader"
101
+ # 不默认使用配置文件中的proxy,可以在aria2.conf中自行添加all-proxy配置
102
+ self.aria2_downloader = Aria2Downloader(None)
103
+ else:
104
+ assert (
105
+ IDMHelper is not None
106
+ ), "You have `download_method = idm` configured, but failed to import corresponding class: IDMHelper"
107
+
80
108
  async def download(
81
109
  self,
82
110
  voice_id: RemoteSourceID,
@@ -167,7 +195,7 @@ class ASMRDownloadAPI(ASMRAPI):
167
195
  ) -> bool:
168
196
  """the save path + file should not exist,
169
197
  and the filename should be legal"""
170
- assert IDMHELPER_EXIST and IDMHelper
198
+ assert IDMHelper is not None
171
199
  m = IDMHelper(url, str(save_path.absolute()), file_name, 3)
172
200
  res = m.send_link_to_idm()
173
201
  if res != 0:
@@ -23,7 +23,7 @@ dependencies = [
23
23
  "colorlog>=6.7.0",
24
24
  "pylrc==0.1.2",
25
25
  "rich>=13.0.0",
26
- "SQLAlchemy==2.0.10",
26
+ "SQLAlchemy==2.0.36",
27
27
  "textual==0.26.0",
28
28
  "mutagen>=1.46.0",
29
29
  "appdirs>=1.4.4",
@@ -33,7 +33,7 @@ dependencies = [
33
33
  ]
34
34
  requires-python = ">=3.10"
35
35
  readme = "README.md"
36
- version = "2.3.0"
36
+ version = "2.3.2"
37
37
 
38
38
  [project.license]
39
39
  text = "MIT"
@@ -1 +0,0 @@
1
- __version__ = "2.3.0"
File without changes