mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-05 04:53:01 +00:00
feat: support watching symlinks in watchdogg.py
+ remove code for auto-adding ~/Home to root_dirs during populate
This commit is contained in:
+4
-39
@@ -26,31 +26,16 @@ class Populate:
|
||||
"""
|
||||
|
||||
def __init__(self) -> None:
|
||||
text = {
|
||||
"root_unset": "The root directory is not set. Trying to scan the default directory: %s",
|
||||
"default_not_exists": "The directory: %s does not exist. Please open the app in your web browser to set the root directory.",
|
||||
"no_tracks": "No tracks found in: %s. Please open the app in your web browser to set the root directory.",
|
||||
}
|
||||
|
||||
tracks = get_all_tracks()
|
||||
tracks = list(tracks)
|
||||
|
||||
dirs_to_scan = sdb.get_root_dirs()
|
||||
initial_dirs_count = len(dirs_to_scan)
|
||||
|
||||
def_dir = "~/Music"
|
||||
|
||||
if len(dirs_to_scan) == 0:
|
||||
log.warning(text["root_unset"], def_dir)
|
||||
print("...")
|
||||
|
||||
exists = os.path.exists(settings.MUSIC_DIR)
|
||||
|
||||
if not exists:
|
||||
log.warning(text["default_not_exists"], def_dir)
|
||||
return
|
||||
|
||||
dirs_to_scan = [settings.MUSIC_DIR]
|
||||
log.warning(
|
||||
"The root directory is not configured. Open the app in your web browser to configure."
|
||||
)
|
||||
return
|
||||
|
||||
try:
|
||||
if dirs_to_scan[0] == "$home":
|
||||
@@ -65,26 +50,6 @@ class Populate:
|
||||
|
||||
untagged = self.filter_untagged(tracks, files)
|
||||
|
||||
if initial_dirs_count == 0 and len(untagged) == 0:
|
||||
log.warning(text["no_tracks"], def_dir)
|
||||
return
|
||||
|
||||
if initial_dirs_count == 0 and len(untagged) > 0:
|
||||
log.info(
|
||||
"%sFound %s tracks 💪 %s",
|
||||
settings.TCOLOR.OKGREEN,
|
||||
len(untagged),
|
||||
settings.TCOLOR.ENDC,
|
||||
)
|
||||
log.info(
|
||||
"%s%s saved as the default root directory. 😶%s",
|
||||
settings.TCOLOR.OKGREEN,
|
||||
def_dir,
|
||||
settings.TCOLOR.ENDC,
|
||||
)
|
||||
sdb.add_root_dirs(dirs_to_scan)
|
||||
# return
|
||||
|
||||
if len(untagged) == 0:
|
||||
log.info("All clear, no unread files.")
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user