feat(JOYNAT): add age bypass option

This commit is contained in:
2026-03-02 00:41:11 +01:00
parent dae8c5b081
commit 49a14161cf

View File

@@ -34,12 +34,14 @@ class JOYNAT(Service):
@staticmethod @staticmethod
@click.command(name="JOYN", short_help="https://joyn.at", help=__doc__) @click.command(name="JOYN", short_help="https://joyn.at", help=__doc__)
@click.argument("title", type=str) @click.argument("title", type=str)
@click.option("--age-bypass", is_flag=True, default=False, help="Download age gated videos with a rating of 16 years old or above.")
@click.pass_context @click.pass_context
def cli(ctx: click.Context, **kwargs: Any) -> JOYNAT: def cli(ctx: click.Context, **kwargs: Any) -> JOYNAT:
return JOYNAT(ctx, **kwargs) return JOYNAT(ctx, **kwargs)
def __init__(self, ctx: click.Context, title: str): def __init__(self, ctx: click.Context, title: str, age_bypass: bool = False):
self.title = title self.title = title
self.age_bypass = age_bypass
super().__init__(ctx) super().__init__(ctx)
@@ -209,6 +211,11 @@ class JOYNAT(Service):
self.log.error("Invalid movie_data data received.") self.log.error("Invalid movie_data data received.")
raise ValueError("Invalid movie_data data received from Joyn service.") raise ValueError("Invalid movie_data data received from Joyn service.")
min_age = movie_data.get('ageRating', {}).get('minAge', 0) if movie_data.get('ageRating') else 0
if min_age >= 16 and not self.age_bypass:
self.log.warning(f"Skipping '{movie_data.get('title')}' due to age rating ({min_age}+). Use --age-bypass to download.")
return Movies([])
return Movies( return Movies(
[ [
Movie( Movie(
@@ -258,6 +265,11 @@ class JOYNAT(Service):
self.log.error("Invalid episode data received.") self.log.error("Invalid episode data received.")
raise ValueError("Invalid episode data received from Joyn service.") raise ValueError("Invalid episode data received from Joyn service.")
min_age = episode.get('ageRating', {}).get('minAge', 0) if episode.get('ageRating') else 0
if min_age >= 16 and not self.age_bypass:
self.log.warning(f"Skipping episode '{episode.get('title')}' due to age rating ({min_age}+). Use --age-bypass to download.")
continue
episodes.append( episodes.append(
Episode( Episode(
id_=episode['id'], id_=episode['id'],
@@ -294,6 +306,11 @@ class JOYNAT(Service):
self.log.error("Invalid episode_data data received.") self.log.error("Invalid episode_data data received.")
raise ValueError("Invalid episode_data data received from Joyn service.") raise ValueError("Invalid episode_data data received from Joyn service.")
min_age = episode_data.get('ageRating', {}).get('minAge', 0) if episode_data.get('ageRating') else 0
if min_age >= 16 and not self.age_bypass:
self.log.warning(f"Skipping episode '{episode_data['title']}' due to age rating ({min_age}+). Use --age-bypass to download.")
return Series([])
return Series( return Series(
[ [
Episode( Episode(