Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align with the M6 file and fix issue #576 #589

Merged
merged 2 commits into from Dec 6, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
91 changes: 17 additions & 74 deletions resources/lib/channels/be/rtlplaybe.py
Expand Up @@ -31,14 +31,10 @@
URL_ROOT = 'http://android.middleware.6play.fr/6play/v2/platforms/' \
'm6group_androidmob/services/%s/folders?limit=999&offset=0'


# URL_ALL_PROGRAMS_WEB = 'http://pc.middleware.6play.fr/6play/v2/platforms/' \
# 'm6group_web/services/rtlbe_rtl_play/programs?limit=100&offset=0&csa=6&firstLetter=a&with=rights'
URL_ALL_PROGRAMS = 'http://android.middleware.6play.fr/6play/v2/platforms/' \
'm6group_androidmob/services/rtlbe_rtl_play/programs' \
'?limit=999&offset=0&csa=6&firstLetter=%s&with=rights'



# Url to get catgory's programs
# e.g. Le meilleur patissier, La france à un incroyable talent, ...
# We get an id by program
Expand All @@ -55,18 +51,18 @@

# Url to get shows list
# e.g. Episode 1, Episode 2, ...
URL_VIDEOS = 'http://android.middleware.6play.fr/6play/v2/platforms/' \
'm6group_androidmob/services/rtlbe_rtl_play/programs/%s/videos?' \
URL_VIDEOS = 'http://chromecast.middleware.6play.fr/6play/v2/platforms/' \
'chromecast/services/rtlbe_rtl_play/programs/%s/videos?' \
'csa=6&with=clips,freemiumpacks&type=vi,vc,playlist&limit=999'\
'&offset=0&subcat=%s&sort=subcat'

URL_VIDEOS2 = 'https://android.middleware.6play.fr/6play/v2/platforms/' \
'm6group_androidmob/services/rtlbe_rtl_play/programs/%s/videos?' \
URL_VIDEOS2 = 'https://chromecast.middleware.6play.fr/6play/v2/platforms/' \
'chromecast/services/rtlbe_rtl_play/programs/%s/videos?' \
'csa=6&with=clips,freemiumpacks&type=vi&limit=999&offset=0'


URL_JSON_VIDEO = 'https://android.middleware.6play.fr/6play/v2/platforms/' \
'm6group_androidmob/services/rtlbe_rtl_play/videos/%s'\
URL_JSON_VIDEO = 'https://chromecast.middleware.6play.fr/6play/v2/platforms/' \
'chromecast/services/rtlbe_rtl_play/videos/%s'\
'?csa=6&with=clips,freemiumpacks'

URL_IMG = 'https://images.6play.fr/v1/images/%s/raw'
Expand All @@ -81,13 +77,13 @@
URL_API_KEY = 'https://www.rtlplay.be/client-%s.bundle.js'
# Id

URL_TOKEN_DRM = 'https://6play-users.6play.fr/v2/platforms/m6group_androidmob/services/rtlbe_rtl_play/users/%s/videos/%s/upfront-token'
URL_TOKEN_DRM = 'https://6play-users.6play.fr/v2/platforms/chromecast/services/rtlbe_rtl_play/users/%s/videos/%s/upfront-token'

# URL_LICENCE_KEY = 'https://lic.drmtoday.com/license-proxy-widevine/cenc/|Content-Type=&User-Agent=Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3041.0 Safari/537.36&Host=lic.drmtoday.com&Origin=https://www.6play.fr&Referer=%s&x-dt-auth-token=%s|R{SSM}|JBlicense'
URL_LICENCE_KEY = 'https://lic.drmtoday.com/license-proxy-widevine/cenc/|Content-Type=&User-Agent=Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3041.0 Safari/537.36&Host=lic.drmtoday.com&x-dt-auth-token=%s&x-customer-name=rtlbe|R{SSM}|JBlicense'
# Referer, Token

URL_LIVE_JSON = 'https://android.middleware.6play.fr/6play/v2/platforms/m6group_androidmob/services/rtlbe_rtl_play/live?channel=%s&with=service_display_images,nextdiffusion,extra_data'
URL_LIVE_JSON = 'https://chromecast.middleware.6play.fr/6play/v2/platforms/chromecast/services/rtlbe_rtl_play/live?channel=%s&with=service_display_images,nextdiffusion,extra_data'
# Chaine

DESIRED_QUALITY = Script.setting['quality']
Expand Down Expand Up @@ -117,66 +113,6 @@ def rtlplay_root(plugin, **kwargs):
item_post_treatment(item)
yield item

item = Listitem()
item.label = plugin.localize(30717)
item.art["thumb"] = get_item_media_path('channels/be/rtlplay.png')
item.art["fanart"] = get_item_media_path('channels/be/rtlplay_fanart.jpg')
item.set_callback(list_all_programs, 'rtl_play')
item_post_treatment(item)
yield item


@Route.register
def list_all_programs(plugin, item_id, **kwargs):

letters = ['@', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
'u', 'v', 'w', 'y', 'z']

for letter in letters:
item = Listitem()
item.label = plugin.localize(30717) + ' : ' + letter
item.art["thumb"] = get_item_media_path('channels/be/rtlplay.png')
item.art["fanart"] = get_item_media_path('channels/be/rtlplay_fanart.jpg')
item.set_callback(list_all_programs_by_letter, item_id, letter)
item_post_treatment(item)
yield item


@Route.register
def list_all_programs_by_letter(plugin, item_id, letter, **kwargs):

resp = urlquick.get(URL_ALL_PROGRAMS % letter,
headers={
'User-Agent': web_utils.get_random_ua(),
'x-customer-name': 'rtlbe'})
json_parser = json.loads(resp.text)

for array in json_parser:
item = Listitem()
program_title = array['title']
program_id = str(array['id'])
program_desc = array['description']
program_imgs = array['images']
program_img = ''
program_fanart = ''
for img in program_imgs:
if img['role'] == 'vignette':
external_key = img['external_key']
program_img = URL_IMG % (external_key)
elif img['role'] == 'carousel':
external_key = img['external_key']
program_fanart = URL_IMG % (external_key)

item.label = program_title
item.art['thumb'] = item.art['landscape'] = program_img
item.art['fanart'] = program_fanart
item.info['plot'] = program_desc
item.set_callback(list_program_categories,
item_id=item_id,
program_id=program_id)
item_post_treatment(item)
yield item


@Route.register
def list_categories(plugin, item_id, **kwargs):
Expand Down Expand Up @@ -511,7 +447,14 @@ def get_video_url(plugin,
for asset in video_assets:
if 'usp_dashcenc_h264' in asset["type"]:
item = Listitem()
item.path = asset['full_physical_path']
#GM Check if rtl_play is needed
dummy_req = urlquick.get(asset['full_physical_path'],
headers={'User-Agent': web_utils.get_random_ua()},
allow_redirects=False)
if 'location' in dummy_req.headers:
item.path = dummy_req.headers['location']
else:
item.path = asset['full_physical_path']
if 'http' in subtitle_url:
item.subtitles.append(subtitle_url)
item.label = get_selected_item_label()
Expand Down