Browse Source

Add atdash mode

master
JustAnotherArchivist 3 years ago
parent
commit
8e0cb30d0a
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      archivebot-jobs

+ 5
- 1
archivebot-jobs View File

@@ -105,12 +105,13 @@ parser.add_argument('--filter', '-f', nargs = 1, type = str, action = FilterActi
parser.add_argument('--ifilter', '-i', nargs = 1, type = str, action = FilterAction, dest = 'filter', help = 'Like --filter but case-insensitive')
parser.add_argument('--pyfilter', nargs = 1, type = str, action = FilterAction, dest = 'filter', help = 'A Python expression for filtering using the local variable `job`')
parser.add_argument('--sort', '-s', nargs = 1, type = str, action = SortAction, help = "Sort the table by a COLUMN (descending if preceded by '-'). This can be used multiple times to refine the sorting.")
parser.add_argument('--mode', choices = ('table', 'dashboard-regex', 'con-d-commands', 'format'), default = 'table', help = '\n'.join([
parser.add_argument('--mode', choices = ('table', 'dashboard-regex', 'con-d-commands', 'format', 'atdash'), default = 'table', help = '\n'.join([
'Output modes:',
' table: print a table of the matched jobs',
' dashboard-regex: compose a regular expression that can be used on the dashboard to actively watch the jobs matched by the filter',
' con-d-commands: print !con and !d commands for the current settings',
' format: print some output for each job, separated by newlines; this requires the --format option',
' atdash: print the URL for displaying the matched jobs on atdash',
]))
parser.add_argument('--no-colours', '--no-colors', action = 'store_true', help = "Don't colourise the last activity column if it's been a while. (Table mode only)")
parser.add_argument('--no-table', action = 'store_true', help = 'Raw output without feeding through column(1); columns are separated by tabs. (Table mode only)')
@@ -200,6 +201,9 @@ elif args.mode == 'format':
for job in jobs:
print(args.format.format(**{key.replace(' ', '_'): value for key, value in job.items()}))
sys.exit(0)
elif args.mode == 'atdash':
print('https://atdash.meo.ws/d/nipgvEwmk/archivebot?orgId=1&' + '&'.join(f'var-ident={job["jobid"]}' for job in jobs))
sys.exit(0)

# Renderers
def render_date(ts, coloured = False):


Loading…
Cancel
Save