Skip to content

Commit 95b2d5c

Browse files
committed
web-add: remove --fs default
1 parent eae7a48 commit 95b2d5c

File tree

3 files changed

+21
-28
lines changed

3 files changed

+21
-28
lines changed

library/createdb/av.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ def munge_av_tags(args, media) -> dict:
148148
format_.pop("format_long_name", None)
149149
format_.pop("nb_programs", None)
150150
format_.pop("nb_streams", None)
151+
format_.pop("nb_stream_groups", None)
151152
format_.pop("probe_score", None)
152153
format_.pop("start_time", None)
153154
format_.pop("filename", None)

library/createdb/web_add.py

Lines changed: 12 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,6 @@ def parse_args(action, **kwargs):
5959
args = parser.parse_intermixed_args()
6060
arggroups.args_post(args, parser, create_db=action == consts.SC.web_add)
6161

62-
if not args.profiles:
63-
args.profiles = [DBType.filesystem]
64-
6562
if args.sizes:
6663
args.sizes = sql_utils.parse_human_to_lambda(nums.human_to_bytes, args.sizes)
6764

@@ -73,6 +70,10 @@ def parse_args(action, **kwargs):
7370
web.requests_session(args) # prepare requests session
7471
arggroups.selenium_post(args)
7572

73+
74+
if not args.profiles:
75+
args.profiles = []
76+
7677
return args
7778

7879

@@ -123,23 +124,6 @@ def add_basic_metadata(args, m):
123124
m["time_deleted"] = consts.now()
124125
with suppress(TimeoutError):
125126
m["type"] = file_utils.mimetype(m["path"])
126-
else:
127-
extension = m["path"].rsplit(".", 1)[-1].lower()
128-
if (
129-
args.scan_all_files
130-
or (DBType.video in args.profiles and extension in consts.VIDEO_EXTENSIONS)
131-
or (DBType.audio in args.profiles and extension in consts.AUDIO_ONLY_EXTENSIONS)
132-
or (DBType.text in args.profiles and extension in consts.TEXTRACT_EXTENSIONS)
133-
or (DBType.image in args.profiles and extension in consts.IMAGE_EXTENSIONS)
134-
):
135-
with suppress(TimeoutError):
136-
try:
137-
web_stats = web.stat(m["path"])
138-
if web_stats:
139-
m["size"] = web_stats.st_size
140-
m["time_modified"] = web_stats.st_mtime
141-
except FileNotFoundError:
142-
m["time_deleted"] = consts.now()
143127

144128
if getattr(args, "hash", False):
145129
# TODO: use head_foot_stream
@@ -214,13 +198,14 @@ def spider(args, paths: list):
214198
media = [consolidate_media(args, k) | (v or {}) for k, v in new_paths.items()]
215199
new_media_count += len(media)
216200

217-
with concurrent.futures.ThreadPoolExecutor(max_workers=args.threads) as executor:
218-
gen_media = (f.result() for f in [executor.submit(add_basic_metadata, args, m) for m in media])
219-
for i, m in enumerate(gen_media):
220-
media[i] = m
221-
printing.print_overwrite(
222-
f"Pages to scan {len(paths)} link scan: {new_media_count} new [{len(known_paths)} known]; basic metadata {i + 1} of {len(media)}"
223-
)
201+
if DBType.filesystem in args.profiles or args.hash:
202+
with concurrent.futures.ThreadPoolExecutor(max_workers=args.threads) as executor:
203+
gen_media = (f.result() for f in [executor.submit(add_basic_metadata, args, m) for m in media])
204+
for i, m in enumerate(gen_media):
205+
media[i] = m
206+
printing.print_overwrite(
207+
f"Pages to scan {len(paths)} link scan: {new_media_count} new [{len(known_paths)} known]; basic metadata {i + 1} of {len(media)}"
208+
)
224209
if media:
225210
add_media(args, media)
226211

library/usage.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1545,11 +1545,18 @@ def play(action) -> str:
15451545
[ 91.0 .. 100.0] [141] ∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎
15461546
"""
15471547

1548-
web_add = """library web-add [(--filesystem) | --video | --audio | --image | --text] DATABASE URL ...
1548+
web_add = """library web-add [--filesystem | --video | --audio | --image | --text] DATABASE URL ...
15491549
15501550
Scan open directories
15511551
1552+
library web-add open_dir.db http://1.1.1.1/
1553+
library web-add open_dir.db --filesystem http://1.1.1.1/
15521554
library web-add open_dir.db --video http://1.1.1.1/
1555+
library web-add open_dir.db --filesystem --video http://1.1.1.1/
1556+
1557+
Filtering the extra metadata scan by size requires using the --filesystem profile
1558+
1559+
library web-add open_dir.db --filesystem --size +50MiB --video http://1.1.1.1/
15531560
15541561
Re-scan using a different profile
15551562

0 commit comments

Comments
 (0)