VideoHelp Forum




+ Reply to Thread
Results 1 to 5 of 5
  1. Just wondering, if someone could help troubleshoot my first Devine service?, currently only trying to fetch the Title metadata.

    Runs as per: devine -d dl --list-titles BLAZ b3a2691f

    Not sure why Devine will not list the titles? The dictionary paths as far as I know are correct.

    __init__.py as per:

    Code:
    import base64
    import json
    import re
    from typing import Union
    
    import click
    import requests
    
    from devine.core.constants import AnyTrack
    from devine.core.manifests import DASH
    from devine.core.service import Service
    from devine.core.titles import Episode, Movie, Movies, Series
    from devine.core.tracks import Chapters, Tracks
    
    
    class BLAZ(Service):
        """
        Service code for BLAZ
        
    
        
        """
    
        @staticmethod
        @click.command(name="BLAZ", short_help="https://watch.blaze.tv/series", help=__doc__)
        @click.argument("title", type=str)
        @click.option("-m", "--movie", is_flag=True, default=False, help="Title is a Movie.")
        @click.pass_context
        def cli(ctx, **kwargs):
            return BLAZ(ctx, **kwargs)
    
        def __init__(self, ctx, title: str, movie: bool):
            self.title = title
            self.is_movie = movie
    
            super().__init__(ctx)
    
            self.session.headers.update(
                {
                    "user-agent": self.config["browser"]["user-agent"],
                    
                    
                }
            )
    
        def get_titles(self) -> Union[Series]:
            if not self.is_movie:
                episodes = []
                
                while True:
                    series_metadata = self.session.get(f"https://v6-metadata-cf.simplestreamcdn.com/api/series/{self.title}-baf5-11ea-9b31-0626f8704156?key=6Pr3Uj2Fo3Ix7Rb9Ze9Ro4Ez2Eq7Sy&cc=GB&lang=en&platform=android").json()
    
                   
    
                    # Get the episode metadata by iterating through each episode
                    for episode in series_metadata['response']['series']['seasons'] [0]['tiles'] :
                        # Get the id
                        episode_id = episode ["series_id"]
    
                        # Get the show title
                        show_title = episode["series_title"]
    
                        # Get the season
                        episode_season = episode ["season"]
    
                        # Get the episode number
                        episode_number = episode["episode"]
    
                     
    
                        # Set a class for each episode
                        episode_class = Episode(
                            id_=episode_id,
                            title=show_title,
                            season=episode_season,
                            number=episode_number,
                            service=self.__class__,
                        )
    
                        # Append it to the list
                        episodes.append(episode_class)
    
                    
    
                return Series(episodes)
    
     
    
        def get_tracks(self, title: Union[Movie, Episode]) -> Tracks:
            mpd_info = self.session.get(self.config["endpoints"]["mpd_api"].format(id=title.id))
            mpd_url = mpd_info.json()["queue"][1]["url"]
            mpd_lang = mpd_info.json()["video"]["origin"]["language"]
    
            
    
        def get_chapters(self, *_, **__) -> Chapters:
            return Chapters()

    config YAML:

    Code:
    browser:
      user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.75 Safari/537.36
    
    Accept-Language: en-US,en;q=0.8

    Any help to resolve, much appreciated.
    Quote Quote  
  2. Feels Good Man 2nHxWW6GkN1l916N3ayz8HQoi's Avatar
    Join Date
    Jan 2024
    Location
    Pepe Island
    Search Comp PM
    There's something wrong with that while True of yours. There's no break statement to get you out of the infinite loop and you keep adding elements to "episodes". The only thing that can get you out is if something crashes.
    --[----->+<]>.++++++++++++.---.--------.
    [*drm mass downloader: widefrog*]~~~~~~~~~~~[*how to make your own mass downloader: guide*]
    Quote Quote  
  3. Here's a quick fix. It might have to be adjusted to fit all shows, who knows:

    Code:
    def get_titles(self) -> Union[Movies, Series]:
            if not self.is_movie:
                # Use params instead of long URL
                series_metadata = self.session.get(
                    f"https://v6-metadata-cf.simplestreamcdn.com/api/series/{self.title}-baf5-11ea-9b31-0626f8704156",
                    params={"key": "6Pr3Uj2Fo3Ix7Rb9Ze9Ro4Ez2Eq7Sy", "cc": "GB", "lang": "en", "platform": "android"},
                ).json()
                # Add check for failed request here
    
                # Get series data and use a list comprehension to get the seasons
                series = series_metadata["response"]["series"]
                seasons = [x.get("tiles", []) for x in series["seasons"]]
    
                # Use a list comprehension to store the Episode() objects in episodes
                episodes = [
                    Episode(
                        id_=episode.get("id"),
                        title=episode.get("series_title"),
                        season=int(episode.get("season", 0)), # Seasons need to be integers (numbers)
                        number=int(episode.get("episode", 0)), # Episode numbers need to be integers (numbers)
                        name=episode.get("title"),
                        # year=episode_year,
                        service=self.__class__,
                    )
                    for season in seasons
                    for episode in season
                ]
    
                return Series(episodes)
    Image
    [Attachment 81498 - Click to enlarge]
    Quote Quote  
  4. Originally Posted by stabbedbybrick View Post
    Here's a quick fix. It might have to be adjusted to fit all shows, who knows:

    Code:
    def get_titles(self) -> Union[Movies, Series]:
            if not self.is_movie:
                # Use params instead of long URL
                series_metadata = self.session.get(
                    f"https://v6-metadata-cf.simplestreamcdn.com/api/series/{self.title}-baf5-11ea-9b31-0626f8704156",
                    params={"key": "6Pr3Uj2Fo3Ix7Rb9Ze9Ro4Ez2Eq7Sy", "cc": "GB", "lang": "en", "platform": "android"},
                ).json()
                # Add check for failed request here
    
                # Get series data and use a list comprehension to get the seasons
                series = series_metadata["response"]["series"]
                seasons = [x.get("tiles", []) for x in series["seasons"]]
    
                # Use a list comprehension to store the Episode() objects in episodes
                episodes = [
                    Episode(
                        id_=episode.get("id"),
                        title=episode.get("series_title"),
                        season=int(episode.get("season", 0)), # Seasons need to be integers (numbers)
                        number=int(episode.get("episode", 0)), # Episode numbers need to be integers (numbers)
                        name=episode.get("title"),
                        # year=episode_year,
                        service=self.__class__,
                    )
                    for season in seasons
                    for episode in season
                ]
    
                return Series(episodes)
    Image
    [Attachment 81498 - Click to enlarge]
    Cheers stabbedbybrick, very helpful.

    Going forward, trying to modify a Devine service script from one provider to use with another, probably is not the best way to learn how Devine works.
    Quote Quote  
  5. Originally Posted by 2nHxWW6GkN1l916N3ayz8HQoi View Post
    There's something wrong with that while True of yours. There's no break statement to get you out of the infinite loop and you keep adding elements to "episodes". The only thing that can get you out is if something crashes.
    Thanks, for replying. All info is good to learn from.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!