mirror of
https://gitea.phreedom.club/localhost_frssoft/funkwlmpv
synced 2024-11-18 21:23:01 +00:00
add depth arg
This commit is contained in:
parent
c1d53370b2
commit
50e7402c92
@ -15,6 +15,7 @@ parser.add_argument('-s', '--search')
|
|||||||
parser.add_argument('-t', '--tag')
|
parser.add_argument('-t', '--tag')
|
||||||
parser.add_argument('-i', '--instance')
|
parser.add_argument('-i', '--instance')
|
||||||
parser.add_argument('-r', '--recursion', type=int, default=0)
|
parser.add_argument('-r', '--recursion', type=int, default=0)
|
||||||
|
parser.add_argument('-d', '--depth', type=int, default=5)
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
if args.instance:
|
if args.instance:
|
||||||
instances = [args.instance]
|
instances = [args.instance]
|
||||||
@ -60,7 +61,7 @@ def search_tracks_on_instance(instance, tag='', query='', recursion=args.recursi
|
|||||||
recursion_limit = 0
|
recursion_limit = 0
|
||||||
while tracks['next']:
|
while tracks['next']:
|
||||||
try:
|
try:
|
||||||
if recursion_limit >= 5:
|
if recursion_limit >= args.depth:
|
||||||
break
|
break
|
||||||
new_tracks = requests.get(tracks['next']).json()
|
new_tracks = requests.get(tracks['next']).json()
|
||||||
tracks['results'] += new_tracks['results']
|
tracks['results'] += new_tracks['results']
|
||||||
|
Loading…
Reference in New Issue
Block a user