新增忽略目录的环境变量
This commit is contained in:
parent
c22fc99235
commit
881c34bcb5
@ -95,6 +95,7 @@ class Config:
|
|||||||
) # "bilisearch:" or "ytsearch:"
|
) # "bilisearch:" or "ytsearch:"
|
||||||
ffmpeg_location: str = os.getenv("XIAOMUSIC_FFMPEG_LOCATION", "./ffmpeg/bin")
|
ffmpeg_location: str = os.getenv("XIAOMUSIC_FFMPEG_LOCATION", "./ffmpeg/bin")
|
||||||
active_cmd: str = os.getenv("XIAOMUSIC_ACTIVE_CMD", "play,random_play")
|
active_cmd: str = os.getenv("XIAOMUSIC_ACTIVE_CMD", "play,random_play")
|
||||||
|
exclude_dirs: str = os.getenv("XIAOMUSIC_EXCLUDE_DIRS", "@eadir")
|
||||||
|
|
||||||
def __post_init__(self) -> None:
|
def __post_init__(self) -> None:
|
||||||
if self.proxy:
|
if self.proxy:
|
||||||
|
@ -62,6 +62,7 @@ class XiaoMusic:
|
|||||||
self.search_prefix = config.search_prefix
|
self.search_prefix = config.search_prefix
|
||||||
self.ffmpeg_location = config.ffmpeg_location
|
self.ffmpeg_location = config.ffmpeg_location
|
||||||
self.active_cmd = config.active_cmd.split(",")
|
self.active_cmd = config.active_cmd.split(",")
|
||||||
|
self.exclude_dirs = set(config.exclude_dirs.split(","))
|
||||||
|
|
||||||
# 下载对象
|
# 下载对象
|
||||||
self.download_proc = None
|
self.download_proc = None
|
||||||
@ -347,6 +348,7 @@ class XiaoMusic:
|
|||||||
self._all_music = {}
|
self._all_music = {}
|
||||||
all_music_by_dir = {}
|
all_music_by_dir = {}
|
||||||
for root, dirs, filenames in os.walk(self.music_path):
|
for root, dirs, filenames in os.walk(self.music_path):
|
||||||
|
dirs[:] = [d for d in dirs if d not in self.exclude_dirs]
|
||||||
self.log.debug("root:%s dirs:%s music_path:%s", root, dirs, self.music_path)
|
self.log.debug("root:%s dirs:%s music_path:%s", root, dirs, self.music_path)
|
||||||
dir_name = os.path.basename(root)
|
dir_name = os.path.basename(root)
|
||||||
if self.music_path == root:
|
if self.music_path == root:
|
||||||
|
Loading…
Reference in New Issue
Block a user