Skip to content

Commit

Permalink
Rename workflow, reduce duplicate season checks by using a set (#144)
Browse files Browse the repository at this point in the history
  • Loading branch information
evie-lau authored Oct 8, 2024
1 parent 79918db commit 99cfc9b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
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

0 comments on commit 99cfc9b

Please sign in to comment.