Skip to content

Commit f6d21ea

Browse files
committed
db_media mam_search arg_utils
1 parent 5e0852b commit f6d21ea

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

xklb/db_media.py

+2
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,8 @@ def get_sibling_media(args, media):
382382
new_media.append(d)
383383
media = new_media
384384

385+
# TODO: all-if>10, each-if=10
386+
385387
return media
386388

387389

xklb/scratch/mam_search.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ def parse_args():
2323
parser.add_argument("--musicology", action="store_true")
2424
parser.add_argument("--radio", action="store_true")
2525

26+
parser.add_argument("--search-in", default='torrents')
27+
2628
parser.add_argument("--cookie", required=True)
2729
parser.add_argument("--cookies", help="path to a Netscape formatted cookies file")
2830
parser.add_argument("--cookies-from-browser", metavar="BROWSER[+KEYRING][:PROFILE][::CONTAINER]")
@@ -36,7 +38,6 @@ def parse_args():
3638
log.info(objects.dict_filter_bool(args.__dict__))
3739
return args
3840

39-
4041
def get_page(args, query_data):
4142
import pandas as pd
4243

@@ -100,7 +101,7 @@ def mam_search():
100101
"description": args.description,
101102
},
102103
"searchType": "all", # fl-VIP, fl, VIP, all
103-
"searchIn": "torrents",
104+
"searchIn": args.search_in,
104105
"browseFlagsHideVsShow": 0,
105106
"cat": [],
106107
"sortType": "dateDesc",

xklb/utils/arg_utils.py

+15
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import operator
12
import argparse, random, sys
23
from ast import literal_eval
34
from pathlib import Path
@@ -218,3 +219,17 @@ def override_config(parser, extractor_config, args):
218219
overridden_args = {k: v for k, v in args.__dict__.items() if default_args.get(k) != v}
219220
args_env = argparse.Namespace(**{**default_args, **extractor_config, **overridden_args})
220221
return args_env
222+
223+
ops = {
224+
'<': operator.lt,
225+
'<=': operator.le,
226+
'==': operator.eq,
227+
'!=': operator.ne,
228+
'>=': operator.ge,
229+
'>': operator.gt
230+
}
231+
232+
def cmp(arg1, op, arg2):
233+
operation = ops.get(op)
234+
return operation(arg1, arg2)
235+

0 commit comments

Comments
 (0)