pigskin / kodi-gamepass

NFL Game Pass add-on for Kodi
Other
122 stars 83 forks source link

Nfl network #341

Closed kaileu closed 7 years ago

kaileu commented 7 years ago

This Code is not intended to beeing merged. This should Show the potential Workaround for https://github.com/aqw/xbmc-gamepass/issues/340.

The Problem is that NFL don't added some Seasons to the Program List. To recieve all Programs for a Season we have to iterate through all episodes inside a Season. If the Value of a Season is null ist the most current Season of the episode. (i hope also from the Football Season)

For a nice implementation we have to rewrite the Code in my opinion so this should be a "prove of concept"

But without the null episodes.

kaileu commented 7 years ago

for a better implementation my idea ist to save the episodes in parse_shows and in get_shows_episodes just iterate all saved episodes. The display_shows_episodes function has to be changed too of Course. But because of the lack of python skills i am running into Problems....

def parse_shows(self):
        """Dynamically parse the NFL Network shows into a dict."""
        cur_s_w = self.get_current_season_and_week()
        show_dict = {}
        episode_dict = {}
        url = self.config['modules']['API']['NETWORK_PROGRAMS']
        response = self.make_request(url, 'get')
        for show in response['modules']['programs']:
            season_dict = {}
            request_url = self.config['modules']['API']['NETWORK_EPISODES']
            episodes_url = request_url.replace(':seasonSlug/', '').replace(':tvShowSlug', show['slug'])
            episodes_data = self.make_request(episodes_url, 'get')['modules']['archive']['content']
            #for season in episodes_data:
            for episode in episodes_data:
                if not episode['season']:
                    season_name = cur_s_w['season']
                    season_id = 'season-' + season_name
                    season_dict[season_name] = season_id
                else:
                    season_name = episode['season'].replace('season-', '')
                    season_id = episode['season']
                    season_dict[season_name] = season_id
                episode_dict[show['title'],season_name,episode['title'],episode['videoId']]
                self.nfln_episodes.append(episode_dict)
                if season_name not in self.nfln_seasons:
                    self.nfln_seasons.append(season_name)
            show_dict[show['title']] = season_dict
        print "Test alle Folgen sind hier: " + episode_dict
        self.nfln_shows.update(show_dict)
aqw commented 7 years ago

@kaileu Thanks for the proof-of-concept. I used your latest code as a starting point. It's far from ideal, and someone else taking a whack at it is most welcome.

This entire issue is pretty ugly. Life would just be too simple if Game Pass actually returned quality information. :-/

---Alex