Skip to content

Commit

Permalink
New --update flag + bugfixes and improvements of output writing
Browse files Browse the repository at this point in the history
  • Loading branch information
allejok96 committed Mar 21, 2021
1 parent 839b1f1 commit 016bf0f
Show file tree
Hide file tree
Showing 4 changed files with 166 additions and 87 deletions.
13 changes: 13 additions & 0 deletions jwb-index
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ p.add_argument('--since', metavar='YYYY-MM-DD', dest='min_date',
p.add_argument('--sort',
choices=['newest', 'oldest', 'name', 'random'],
help='sort output')
p.add_argument('--update', action='store_true',
help='update existing categories with the latest videos (implies --append --latest --sort=newest)')
p.add_argument('positional_arguments', nargs='*', metavar='DIR|FILE|COMMAND',
help='where to send output (depends on mode)')

Expand All @@ -123,11 +125,22 @@ if s.print_category:
s.print_category = True
parse_broadcasting(s)
exit()

# Required arguments
if not (s.mode or s.download or s.download_subtitles or s.import_dir):
msg('please use --mode or --download')
exit(1)

# Implicit arguments
if s.update:
if s.mode != 'filesystem' and not s.mode.endswith('_tree') and not s.mode.endswith('_multi'):
msg("this mode does not support --update")
exit(1)
s.append = True
s.include_categories = ['LatestVideos']
if not s.sort:
s.sort = 'newest'

# Handle positional arguments depending on mode
# COMMAND [ARGS]
if s.mode == 'run':
Expand Down
3 changes: 2 additions & 1 deletion jwlib/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,10 @@ class Settings:
# Output stuff
append = False
clean_all_symlinks = False
update = False
mode = ''
safe_filenames = False
sort = 'none'
sort = ''

def __setattr__(self, key, value):
# This will raise an error if the attribute we are trying to set doesn't already exist
Expand Down
Loading

0 comments on commit 016bf0f

Please sign in to comment.