Skip to content
This repository was archived by the owner on Jul 4, 2026. It is now read-only.
This repository was archived by the owner on Jul 4, 2026. It is now read-only.

Try to guess season from episode names if directory does not contain it #68

Description

@plotski
$ pythonbits 'any/existing/path/without/season/info' -c tv -f description
[...]
Traceback (most recent call last):
  File "/path/to/pythonBits/pythonbits/__main__.py", line 137, in main
    _main(Category, set_fields, get_fields)
  File "/path/to/pythonBits/pythonbits/__main__.py", line 113, in _main
    sub.show_fields(get_fields)
  File "/path/to/pythonBits/pythonbits/bb.py", line 51, in show_fields
    return super(BbSubmission, self).show_fields(
  File "/path/to/pythonBits/pythonbits/submission.py", line 236, in show_fields
    val = self[field]
  File "/path/to/pythonBits/pythonbits/submission.py", line 115, in __getitem__
    rv = field_renderer()
  File "/path/to/pythonBits/pythonbits/bb.py", line 633, in _render_description
    sections = [("Description", self['section_description']),
  File "/path/to/pythonBits/pythonbits/submission.py", line 115, in __getitem__
    rv = field_renderer()
  File "/path/to/pythonBits/pythonbits/bb.py", line 561, in _render_section_description
    summary = self['summary']
  File "/path/to/pythonBits/pythonbits/submission.py", line 115, in __getitem__
    rv = field_renderer()
  File "/path/to/pythonBits/pythonbits/bb.py", line 557, in _render_summary
    result = t.search(self['tv_specifier'])
  File "/path/to/pythonBits/pythonbits/submission.py", line 115, in __getitem__
    rv = field_renderer()
  File "/path/to/pythonBits/pythonbits/bb.py", line 249, in _render_tv_specifier
    return TvSpecifier(title, guess['season'],
KeyError: 'season'

This was fixed by my ugly confirmed_guess hack but is now an issue again after you
reverted it.

As you said in the PR comment, this can be fixed by explicitly mentioning the season in
the TITLE argument, but the exception above leaves the user hanging with no information
what went wrong and what to do.

Activity

  1. mueslo commented on Jun 1, 2020

    @mueslo
    Owner

    Sorry about that! Can you give example filenames for which this happens?

  2. plotski commented on Jun 1, 2020

    @plotski
    CollaboratorAuthor

    Use any path of an existing file or directory, it just can't contain any season
    information. This should reproduce the issue:

    $ touch foo
    $ pythonbits foo -c tv -f description
  3. mueslo commented on Jun 1, 2020

    @mueslo
    Owner

    Is this for miniseries? Why does your directory not contain the season? (kb.php?id=30)

    From README.md:

    In case the media title and type cannot be guessed from the path alone, you can explicitly specify them, e.g. pythonbits <path> "Doctor Who (2005) S06" or pythonbits <path> -c movie.

  4. added
    questionFurther information is requested
    more information neededMore information or details needed before this can be worked on
    and removed
    questionFurther information is requested
    on Jun 1, 2020
  5. plotski commented on Jun 1, 2020

    @plotski
    CollaboratorAuthor

    I pm'd you an example.

    Generally speaking, relying on user input is just asking for disaster. If the expected
    input is not there, software shouldn't just shrug and explode into the user's face. The
    least it should do is tell the user what's wrong and how to recover.

    I think "This doesn't make any sense, please confirm this input: ..." is the most
    user-friendly way, but throwing an error like Missing season (try providing the TITLE argument, e.g. "<auto-fill in source name here> S01") would also be acceptable.

  6. added
    enhancementNew feature or request
    and removed
    more information neededMore information or details needed before this can be worked on
    on Jun 3, 2020
  7. changed the title [-]KeyError: 'season'[/-] [+]Try to guess season from episode names if directory does not contain it[/+] on Jun 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions