Skip to content

Commit

Permalink
Treat TV episode segments as integral children
Browse files Browse the repository at this point in the history
  • Loading branch information
dseomn committed Nov 19, 2023
1 parent dfdbce2 commit a64ea0c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
18 changes: 18 additions & 0 deletions rock_paper_sand/wikidata.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,19 @@ def _tv_episode_parent_classes(self) -> Set[wikidata_value.ItemRef]:
*self._tv_season_part_classes,
}

@functools.cached_property
def _tv_episode_segment_classes(self) -> Set[wikidata_value.ItemRef]:
return self._api.transitive_subclasses(
wikidata_value.Q_SEGMENT_OF_A_TELEVISION_EPISODE
)

@functools.cached_property
def _tv_episode_segment_parent_classes(self) -> Set[wikidata_value.ItemRef]:
return {
*self._tv_episode_parent_classes,
*self._tv_episode_classes,
}

@functools.cached_property
def _tv_pilot_classes(self) -> Set[wikidata_value.ItemRef]:
return self._api.transitive_subclasses(
Expand Down Expand Up @@ -599,6 +612,7 @@ def _unlikely_to_be_processed_classes(self) -> Set[wikidata_value.ItemRef]:
*self._tv_season_classes,
*self._tv_season_part_classes,
*self._tv_episode_classes,
*self._tv_episode_segment_classes,
*self._api.transitive_subclasses(
wikidata_value.Q_WEB_SERIES_SEASON
),
Expand Down Expand Up @@ -637,6 +651,10 @@ def _integral_child_classes(
self._tv_season_part_parent_classes,
self._tv_season_part_classes,
)
yield (
self._tv_episode_segment_parent_classes,
self._tv_episode_segment_classes,
)
yield (self._web_series_classes, self._web_series_child_classes)
yield (self._video_classes, self._video_classes)
yield (self._video_classes, self._music_classes)
Expand Down
3 changes: 3 additions & 0 deletions rock_paper_sand/wikidata_value.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ def human_readable_url_prefix(cls) -> str:
Q_PLACEHOLDER_NAME = _i("https://www.wikidata.org/wiki/Q1318274")
Q_PROLEPTIC_GREGORIAN_CALENDAR = _i("https://www.wikidata.org/wiki/Q1985727")
Q_RELEASE_GROUP = _i("https://www.wikidata.org/wiki/Q108346082")
Q_SEGMENT_OF_A_TELEVISION_EPISODE = _i(
"https://www.wikidata.org/wiki/Q29555881"
)
Q_TELEVISION_FILM = _i("https://www.wikidata.org/wiki/Q506240")
Q_TELEVISION_PILOT = _i("https://www.wikidata.org/wiki/Q653916")
Q_TELEVISION_SERIES = _i("https://www.wikidata.org/wiki/Q5398426")
Expand Down

0 comments on commit a64ea0c

Please sign in to comment.