Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename workflow, reduce duplicate season checks by using a set #144

Merged
merged 1 commit into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/validate-seasons.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Validate seasons
name: TVDB
on:
push:
branches:
- validateSeason # Remove after finalizing testing
- master
pull_request:
branches:
- master
Expand Down
8 changes: 4 additions & 4 deletions validate-tvdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ def validateShowSeasons(showName, seasonsToFind):
return errors

# Parse temp.yaml and validate shows/seasons against TVDB
def validateMappings():
def validateMappings(file="temp.yaml"):
errors = 0
with open("temp.yaml") as f:
with open(file) as f:
mappings = yaml.safe_load(f)
for show in sorted(mappings['entries'], key=lambda entry: (entry['title'], entry['seasons'])):
showName = show['title']
seasons = [s['season'] for s in show['seasons'] if 'season' in s]
print("Validating: " + showName + ": " + str(seasons))
seasons = set([s['season'] for s in show['seasons'] if 'season' in s])
print("Validating: " + showName + " - Seasons " + str(seasons))
errors += validateShowSeasons(showName, seasons)
return errors

Expand Down