[add] series CLI - manually add entities to series database#1856
[add] series CLI - manually add entities to series database#1856
Conversation
Implements a new CLI subcommand, `series add <entity_id> [<entity_id> ...] [--quality <quality_string>] [--not_downloaded]`. This can replace manual injection tasks.
liiight
left a comment
There was a problem hiding this comment.
Great stuff, this pr uses existing tools to solve an annoying issue. I like it
| entity_ids = options.entity_id | ||
| quality = options.quality | ||
| downloaded = not options.not_downloaded | ||
| series_name = series_name.replace(r'\!', '!') |
There was a problem hiding this comment.
Isn't this being done in series name normalizer?
There was a problem hiding this comment.
Doesn't look like it, no.
TRANSLATE_MAP = {ord(u'&'): u' and '}
for char in u'\'\\':
TRANSLATE_MAP[ord(char)] = u''
for char in u'_./-,[]():':
TRANSLATE_MAP[ord(char)] = u' '
def normalize_series_name(name):
"""Returns a normalized version of the series name."""
name = name.lower()
name = name.replace('&', ' and ')
name = name.translate(TRANSLATE_MAP) # Replaced some symbols with spaces
name = u' '.join(name.split())
return name
There was a problem hiding this comment.
Maybe it should then, dunno. This doesn't feel right here
There was a problem hiding this comment.
I dunno I just copied from begin :P
flexget/plugins/cli/series.py
Outdated
| help='Episode or season entity ID(s) to add') | ||
| addshow_parser.add_argument('--quality', default=None, metavar='<quality>', | ||
| help='Quality string to be stored for all entity ID(s)') | ||
| addshow_parser.add_argument('--not-downloaded', action='store_true', dest='not_downloaded', |
There was a problem hiding this comment.
What's the use case of adding a not downloaded entry?
There was a problem hiding this comment.
Maybe if you're using it in a perverse way to track what you want to get by inputting undownloaded stuff? I know that sounds weird. I just figured since it was capable of displaying undownloaded releases, we should allow them to be added, but I don't have a solid use case in mind.
flexget/plugins/filter/series.py
Outdated
| """ | ||
| name_to_parse = '{} {}'.format(series.name, identifier) | ||
| if quality: | ||
| name_to_parse = '{} {} {}'.format(series.name, identifier, quality) |
There was a problem hiding this comment.
Probably can depend on the previous formatting here, no biggie
There was a problem hiding this comment.
You mean just pass quality straight to store_parser instead of appending it to the string to be parsed?
There was a problem hiding this comment.
I meant string concatenate quality to previously formatted name:
name_to_parse += ' {}'.format(quality) `FLEXGET_SERIES_ADD_QUALITY` can be used to set a default quality string.
Motivation for changes:
Provide a better way to inject episodes and season packs into the series database.
Detailed changes:
Implements a new CLI subcommand:
<entity_id>: One or more entity IDs recognized by FlexGet, either episodes or season packs.--quality <quality_string>: Set quality for all entities (otherwise will be shown as 'None' inseries show <series_name>). Accepts any string that the series parser will recognize as a quality string.Implemented feature requests: