Skip to content

[Bug]: extract_srt_subtitles_to_files always adds files to pending tasks #444

Description

@WViiras

Describe the Bug

when no subtitle is present in a video, it will be recorded in .unmanic file as an empty string

{
  "extract_srt_subtitles_to_files": {
    "path/to/video.mp4": ""
  }
}

and when the plugin tests if it should run, it will evaluate an empty string to a False, causing the file to be added to the pending list again.

quick fix would be to distinguish between errors and an empty string as well

    try:
        already_extracted = directory_info.get('extract_srt_subtitles_to_files', os.path.basename(path))
    except NoSectionError as e:
        already_extracted = False
    except NoOptionError as e:
        already_extracted = False
    except Exception as e:
        already_extracted = False

    if already_extracted:
        logger.debug("File's srt subtitle streams were previously extracted with {}.".format(already_extracted))
        return True
    elif already_extracted == "":
        logger.debug("Plugin has previously run on this file and found no subtitle streams to extract.")
        return True

    return False

or to use the mapper in on_library_management_file_test

    mapper = PluginStreamMapper()
    mapper.set_settings(settings)
    mapper.set_probe(probe)

    if len(mapper.sub_streams) != 0:

Steps to Reproduce

  1. add extract_srt_subtitles_to_files plugin to library
  2. run on library
  3. wait for files to be processed
  4. run again
  5. all files will be processed again

Expected Behavior

file should not be processed again by the plugin

Screenshots

No response

Relevant Settings

No response

Version

0.0.11

Platform

  • docker

Relevant log output

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions