Skip to content

Edited Batch scipt with regex support#2

Open
NP-Gaming wants to merge 1 commit into
stinkybread:mainfrom
NP-Gaming:main
Open

Edited Batch scipt with regex support#2
NP-Gaming wants to merge 1 commit into
stinkybread:mainfrom
NP-Gaming:main

Conversation

@NP-Gaming
Copy link
Copy Markdown

Added an alternative batch script that uses regex to identify episode IDs (S00E00). This ensures reliable linking without requirement of same filenames.

This is a modified version of script provided by @stinkybread in #1 (comment).

This script should not be a replacement, but rather an addition to expand this project's functionality.

How does it work:

  1. Imports re library.
  2. This version of script differs that at start it loads list of video-files from both reference and foreign directory, not only reference. Then both lists are parsed using regex and saved into dictionaries as {Episode_ID : filename}, if there is same episode id detected multiple times, the script exits to prevent wrong matching of files.
  3. Using set intersection of sets created from dictionary keys (episode ids) creates a list of files that have a pair (i.e. are ready to be synced)
  4. Script proceeds as original

Few minor changes:

  • Skipped count is calculated as number of video-files in reference directory - number of pairs
  • For loop to sync all episodes has been adjusted to use intersected set as input, thus also initialization of ref_path, foreign_path and output_path was adjusted to match new structure. (output file still keeps the name of reference file)

Added an alternative batch script that uses regex to identify episode IDs (S00E00). This ensures reliable linking without requirement of same filenames.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant