示例#1
0
import io
import time
import json
from future.moves.urllib.parse import urlencode
from base64 import b64decode

from datetime import datetime
from dateutil.parser import parse
from dateutil.tz import gettz, tzlocal

from resources.lib.lntv_config_backendless import lntvConfig
from resources.lib.lntv_channels import lntvChannels

addon = xbmcaddon.Addon()
plugin = Plugin()
plugin.name = addon.getAddonInfo("name")
user_agent = "Dalvik/2.1.0 (Linux; U; Android 5.1.1; AFTT Build/LVY48F)"
USER_DATA_DIR = xbmc.translatePath(addon.getAddonInfo("profile"))
ADDON_DATA_DIR = xbmc.translatePath(addon.getAddonInfo("path"))
RESOURCES_DIR = os.path.join(ADDON_DATA_DIR, "resources")
if not os.path.exists(USER_DATA_DIR):
    os.makedirs(USER_DATA_DIR)
app_config_file = os.path.join(USER_DATA_DIR, "config.json")
channel_list_file = os.path.join(USER_DATA_DIR, "channels.json")
live_list_file = os.path.join(USER_DATA_DIR, "live.json")
vod_list_file = os.path.join(USER_DATA_DIR, "vod.json")

cert_file = os.path.join(RESOURCES_DIR, "com.lnt.androidnettv.crt")
cert_key_file = os.path.join(RESOURCES_DIR, "com.lnt.androidnettv.key")

cache_time = int(addon.getSetting("cache_time") or "0")
示例#2
0
import traceback
import xbmc
import xbmcgui
import xbmcaddon
import xbmcplugin
from xbmcgui import ListItem
from requests import HTTPError
from lib import wimpy
from lib.wimpy.models import Album, Artist
from lib.wimpy import Quality
from routing import Plugin

addon = xbmcaddon.Addon()
plugin = Plugin()
plugin.name = addon.getAddonInfo('name')

_addon_id = addon.getAddonInfo('id')

config = wimpy.Config(
    api=wimpy.TIDAL_API if addon.getSetting('site') == '1' else wimpy.WIMP_API,
    quality=[Quality.lossless, Quality.high, Quality.low][int('0' + addon.getSetting('quality'))])

wimp = wimpy.Session(config=config)

is_logged_in = False
_session_id = addon.getSetting('session_id')
_country_code = addon.getSetting('country_code')
_user_id = addon.getSetting('user_id')
if _session_id and _country_code and _user_id:
    wimp.load_session(session_id=_session_id, country_code=_country_code, user_id=_user_id)
示例#3
0
import traceback
import xbmc
import xbmcgui
import xbmcaddon
import xbmcplugin
from xbmcgui import ListItem
from requests import HTTPError
from lib import tidalapi
from lib.tidalapi.models import Album, Artist
from lib.tidalapi import Quality
from routing import Plugin

addon = xbmcaddon.Addon()
plugin = Plugin()
plugin.name = addon.getAddonInfo('name')

_addon_id = addon.getAddonInfo('id')

config = tidalapi.Config(quality=[Quality.lossless, Quality.high, Quality.low][
    int('0' + addon.getSetting('quality'))])
session = tidalapi.Session(config=config)

is_logged_in = False
_session_id = addon.getSetting('session_id')
_country_code = addon.getSetting('country_code')
_user_id = addon.getSetting('user_id')
if _session_id and _country_code and _user_id:
    session.load_session(session_id=_session_id,
                         country_code=_country_code,
                         user_id=_user_id)
示例#4
0
import os
import traceback
import requests
import requests_cache
from datetime import timedelta
from base64 import b64decode, urlsafe_b64encode
from pyDes import des, PAD_PKCS5

try:
    from urllib.parse import quote_from_bytes as orig_quote
except ImportError:
    from urllib import quote as orig_quote

addon = xbmcaddon.Addon()
plugin = Plugin()
plugin.name = addon.getAddonInfo("name")
user_agent = "Dalvik/2.1.0 (Linux; U; Android 5.1.1; AFTS Build/LVY48F)"
player_user_agent = "mediaPlayerhttp/2.1 (Linux;Android 5.1) ExoPlayerLib/2.6.1"
USER_DATA_DIR = xbmc.translatePath(addon.getAddonInfo("profile")).decode("utf-8")  # !!
CACHE_TIME = int(addon.getSetting("cache_time"))
CACHE_FILE = os.path.join(USER_DATA_DIR, "cache")
expire_after = timedelta(hours=CACHE_TIME)

if not os.path.exists(USER_DATA_DIR):
    os.makedirs(USER_DATA_DIR)

s = requests_cache.CachedSession(CACHE_FILE, allowable_methods="POST", expire_after=expire_after, old_data_on_error=True)
s.hooks = {"response": lambda r, *args, **kwargs: r.raise_for_status()}
s.headers.update({"User-Agent": "USER-AGENT-tvtap-APP-V2"})
token_url = "http://tvtap.net/tvtap1/index_new.php?case=get_channel_link_with_token_tvtap"
list_url = "http://tvtap.net/tvtap1/index_new.php?case=get_all_channels"