eracknaphobia / plugin.video.slingtv

GNU General Public License v3.0
2 stars 1 forks source link

Support multiple genres for channel #8

Closed drewvs closed 2 weeks ago

drewvs commented 3 weeks ago

Currently it looks like when the channels playlist is created it doesn't include all of the genres and defaults to "Sling TV".

I've been trying to figure out where this is done in the channels.py to create a PR but can't quite figure it out. An example of a channel with multiple genres:

"metadata": {
      "is_blacklisted": false,
      "restricted_devices": [],
      "language": "English",
      "thumbnail_cropped": null,
      "svod_allow_seek_past_furthest_pos": true,
      "default_schedule_image": null,
      "is_duplicate": false,
      "prg_svc_id": "416146796",
      "lookback_allow_seek_past_furthest_pos": true,
      "is_linear_channel": true,
      "is_free": false,
      "genre": [
        "Movies",
        "Black Entertainment",
        "Premium",
        "Entertainment"
      ],

This is nice to have so that I can hide/show or modify channel groups. It also allows you to filter on genres (like movies) so that the EPG only shows movie channels.

eracknaphobia commented 2 weeks ago

I believe the channels group is set by IPTV Manager in order to group them by addon, not sure if this can be altered.

xags commented 2 weeks ago

IPTV Manager looks to be just parsing the output. The older Sling addon from d21spike appears to set this properly:

#EXTINF:-1 tvg-id="f0111af39c5d4ff1b3ca6c57a27efcb5" tvg-name="MGM+_Drive-In" tvg-logo="http://p-img.movetv.com/cms/images/c4815598da8cb99ce6723a40dfc90d34292e54e3.png" group-title="Sling TV; Movies; Action & Thrillers",MGM+ Drive-In
#EXTINF:-1 tvg-id="a037e2a30fd249b98d09fbb56dfdeb3f" tvg-name="MGM+_Hits" tvg-logo="http://p-img.movetv.com/cms/images/240613cd6f1b0c2037777449e0186bb5668a87a5.png" group-title="Sling TV; Movies; Premium; Entertainment",MGM+ Hits
#EXTINF:-1 tvg-id="8686b39e8fa74b0daa8b0f80069c1ac1" tvg-name="MGM+_Marquee" tvg-logo="http://p-img.movetv.com/cms/images/59bc73c23b7c517de305e5a208e4d237a51b7d30.png" group-title="Sling TV; Movies; Premium; Entertainment",MGM+ Marquee

From d21spikes/your old repo it looks like maybe it's happening here but I can't figure out how to integrate it:

def channels(self, html):
        log('Guide Service: channels()')

        html.write('#EXTM3U\n'.encode())
        channels = self.getChannels()
        for channel_id, title, logo, url, genre in channels:
            html.write('\n'.encode())
            channel_info = '#EXTINF:-1 tvg-id="%s" tvg-name="%s"' % (channel_id, title.replace(' ', '_'))
            if logo is not None:
                channel_info += ' tvg-logo="%s"' % logo
            channel_info += ' group-title="Sling TV; %s",%s' % (genre.replace(',', ';'), title)
            html.write(('%s\n' % channel_info).encode())
            url = 'plugin://plugin.video.sling/?mode=play&url=%s' % url
            html.write(('%s\n' % url).encode())
            if self.Monitor.abortRequested():
                break
eracknaphobia commented 2 weeks ago

@xags IPTV Manager actually creates the files, which is what we used to do in the old addon.

Looks like it should be configurable.

image

drewvs commented 2 weeks ago

@eracknaphobia so the iptvmanager.py file that does the import needs to be modified? I see a portion of code within it that's commented out. I'll have to review when on a PC to see if I can change it to parse the groups from the metadata of I'm understanding you correctly. Thanks!

eracknaphobia commented 2 weeks ago

I should be able to add genres through the json i pass to IPTV Manager.

eracknaphobia commented 2 weeks ago

I've added the genres as is from sling but they are kind of a mess. Sometimes the genre is plural sometimes not. Sometimes they use & other times they use 'and'. It needs some work to be grouped better to make it useful IMO.

drewvs commented 2 weeks ago

This works perfect for me! I use IPTV simple to manage the groups and hide/edit the ones I want. Thanks a ton!