Skip to content
Open
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
2 changes: 1 addition & 1 deletion ATTRIBUTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ the string language (eg. `english`), and if not, this is simply `True`
- `senior`: bool, specifies if this showing is for senior citizens only
- `subtitled`: string or bool, specifies if the film is subtitled. If the language of the subtitling is known, this is
the string language (eg. `english`), and if not, this is simply `True`

- `kids`: this film is for kids, and adults must be accompanying a child
13 changes: 13 additions & 0 deletions src/showingpreviously/cinemas/picturehouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
SHOWING_URL_ID_PATTERN = re.compile(r'/movie-details/\d+/(?P<film_id>.+?)/(?P<slug>.+)')
SLUG_YEAR_PATTERN = re.compile(r'(?P<year>(?:18|19|20)\d{2})')
JS_TO_URL_PATTERN = re.compile(r'"(?P<film_link>https?://.+?)"')
DUBBED_LANGUAGE_PATTERN = re.compile(r'Please note, this screening features the Dubbed (?P<dub_language>.+?) version of the film')
SUBBED_LANGUAGE_PATTERN = re.compile(r'have (?P<sub_language>.+?) subtitles')


def get_showing_dates() -> str:
Expand Down Expand Up @@ -72,6 +74,8 @@ def get_film_year(film_link: str) -> str:

soup = BeautifulSoup(r.text, features='html.parser')
metadata = soup.find('div', {'class': 'directorDiv'})
if not metadata:
return UNKNOWN_FILM_YEAR
date = metadata.find('li', text='Release Date :').findNext('li').text
year = date[-4:]
return year
Expand Down Expand Up @@ -113,6 +117,13 @@ def get_attributes(attributes: [dict[str, any]]) -> dict[str, any]:
json_attributes['ad-trailer-free'] = True
elif attribute['attribute'] == 'Sub Cinema':
json_attributes['subtitled'] = True
language = SUBBED_LANGUAGE_PATTERN.search(attribute['description'])
if language:
json_attributes['subtitled'] = language.group('sub_language')
elif attribute['attribute'] == 'Dub Cinema':
language = DUBBED_LANGUAGE_PATTERN.search(attribute['description'])
if language:
json_attributes['language'] = language.group('dub_language')
elif attribute['attribute'] == 'LiveSat':
json_attributes['format'].append('Live')
elif attribute['attribute'] == 'Audio D':
Expand All @@ -125,6 +136,8 @@ def get_attributes(attributes: [dict[str, any]]) -> dict[str, any]:
json_attributes['format'].append('4K')
elif attribute['attribute'] == 'Toddler Ti':
json_attributes['carers-and-babies'] = True
Comment on lines 137 to 138
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be updated. Picturehouse has both a Watch with Baby and a Toddler Time category (in addition to the Kids' Club).

elif attribute['attribute'] == "Kids' Club":
json_attributes['kids'] = True
if len(json_attributes['format']) == 0:
del json_attributes['format']
return json_attributes
Expand Down