Browse Source

Make con-d-commands mode an alias of the corresponding format

master
JustAnotherArchivist 4 years ago
parent
commit
d3c00353da
1 changed files with 4 additions and 5 deletions
  1. +4
    -5
      archivebot-jobs

+ 4
- 5
archivebot-jobs View File

@@ -89,6 +89,10 @@ if args.mode == 'format' and not args.format:
if not args.sort:
args.sort = [parse_sort(defaultSort)]

if args.mode == 'con-d-commands':
args.mode = 'format'
args.format = '!con {jobid} {con}\n!d {jobid} {delay_min} {delay_max}'

# Retrieve
def fetch(url):
req = urllib.request.Request(url)
@@ -153,11 +157,6 @@ jobs = sorted(jobs, key = lambda job: tuple(job[column] if not descending else r
if args.mode == 'dashboard-regex':
print('^(' + '|'.join(re.escape(job['url']) for job in jobs) + ')$')
sys.exit(0)
elif args.mode == 'con-d-commands':
for job in jobs:
print(f'!con {job["jobid"]} {job["con"]}')
print(f'!d {job["jobid"]} {job["delay min"]} {job["delay max"]}')
sys.exit(0)
elif args.mode == 'format':
for job in jobs:
print(args.format.format(**{key.replace(' ', '_'): value for key, value in job.items()}))


Loading…
Cancel
Save