コード例 #1
0
 def __init__(self, *args, **kwargs):
     self.ctrl_list = None
     self.return_value = None
     self.title = kwargs['title']
     self.list_data = kwargs['list_data']
     self.action_exitkeys_id = [
         ACTION_PREVIOUS_MENU, ACTION_PLAYER_STOP, ACTION_NAV_BACK
     ]
     if get_machine()[0:5] == 'armv7':
         xbmcgui.WindowXMLDialog.__init__(self)
     else:
         try:
             xbmcgui.WindowXMLDialog.__init__(self, *args, **kwargs)
         except Exception:  # pylint: disable=broad-except
             xbmcgui.WindowXMLDialog.__init__(self)
コード例 #2
0
    def __init__(self, *args, **kwargs):
        self.skip_to = kwargs['skip_to']
        self.label = kwargs['label']

        self.action_exitkeys_id = [
            ACTION_PREVIOUS_MENU, ACTION_PLAYER_STOP, ACTION_NAV_BACK,
            ACTION_NOOP
        ]

        if get_machine()[0:5] == 'armv7':
            xbmcgui.WindowXMLDialog.__init__(self)
        else:
            try:
                xbmcgui.WindowXMLDialog.__init__(self, *args, **kwargs)
            except Exception:  # pylint: disable=broad-except
                xbmcgui.WindowXMLDialog.__init__(self)
コード例 #3
0
 def __init__(self, *args, **kwargs):
     self.videoid = kwargs['videoid']
     self.track_id_jaw = kwargs['track_id_jaw']
     self.title = kwargs.get('title', '--')
     self.user_rating = kwargs.get('user_rating', 0)
     # Netflix user rating thumb values
     # 0 = No rated
     # 1 = thumb down
     # 2 = thumb up
     self.action_exitkeys_id = [
         ACTION_PREVIOUS_MENU, ACTION_PLAYER_STOP, ACTION_NAV_BACK
     ]
     if get_machine()[0:5] == 'armv7':
         xbmcgui.WindowXMLDialog.__init__(self)
     else:
         try:
             xbmcgui.WindowXMLDialog.__init__(self, *args, **kwargs)
         except Exception:  # pylint: disable=broad-except
             xbmcgui.WindowXMLDialog.__init__(self)
コード例 #4
0
 def __init__(self, *args, **kwargs):
     # Keep pin option, there is still some reference in the netflix code
     # self.current_pin = kwargs.get('pin')
     self.data = kwargs['data']
     self.rating_levels = kwargs['rating_levels']
     self.current_maturity = self.data['maturity']
     self.current_level_index = kwargs['current_level_index']
     self.profile_info = self.data['profileInfo']
     self.levels_count = len(self.rating_levels)
     self.status_base_desc = G.ADDON.getLocalizedString(30233)
     self.action_exitkeys_id = [ACTION_PREVIOUS_MENU,
                                ACTION_PLAYER_STOP,
                                ACTION_NAV_BACK]
     if get_machine()[0:5] == 'armv7':
         xbmcgui.WindowXMLDialog.__init__(self)
     else:
         try:
             xbmcgui.WindowXMLDialog.__init__(self, *args, **kwargs)
         except Exception:  # pylint: disable=broad-except
             xbmcgui.WindowXMLDialog.__init__(self)
コード例 #5
0
 def __init__(self, *args, **kwargs):
     self.current_pin = kwargs.get('pin')
     self.maturity_levels = kwargs['maturity_levels']
     self.maturity_names = kwargs['maturity_names']
     self.current_level = kwargs['current_level']
     self.levels_count = len(self.maturity_levels)
     self.maturity_level_edge = {
         0: g.ADDON.getLocalizedString(30108),
         self.levels_count - 1: g.ADDON.getLocalizedString(30107)
     }
     self.status_base_desc = g.ADDON.getLocalizedString(30233)
     self.action_exitkeys_id = [
         ACTION_PREVIOUS_MENU, ACTION_PLAYER_STOP, ACTION_NAV_BACK
     ]
     if get_machine()[0:5] == 'armv7':
         xbmcgui.WindowXMLDialog.__init__(self)
     else:
         try:
             xbmcgui.WindowXMLDialog.__init__(self, *args, **kwargs)
         except Exception:  # pylint: disable=broad-except
             xbmcgui.WindowXMLDialog.__init__(self)
コード例 #6
0
    def _load_manifest(self, viewable_id, esn):
        cache_identifier = esn + '_' + unicode(viewable_id)
        try:
            # The manifest must be requested once and maintained for its entire duration
            manifest = G.CACHE.get(CACHE_MANIFESTS, cache_identifier)
            expiration = int(manifest['expiration'] / 1000)
            if (expiration - time.time()) < 14400:
                # Some devices remain active even longer than 48 hours, if the manifest is at the limit of the deadline
                # when requested by am_stream_continuity.py / events_handler.py will cause problems
                # if it is already expired, so we guarantee a minimum of safety ttl of 4h (14400s = 4 hours)
                raise CacheMiss()
            if LOG.level == LOG.LEVEL_VERBOSE:
                LOG.debug('Manifest for {} obtained from the cache',
                          viewable_id)
                # Save the manifest to disk as reference
                common.save_file_def('manifest.json',
                                     json.dumps(manifest).encode('utf-8'))
            return manifest
        except CacheMiss:
            pass

        isa_addon = xbmcaddon.Addon('inputstream.adaptive')
        hdcp_override = isa_addon.getSettingBool('HDCPOVERRIDE')
        hdcp_4k_capable = common.is_device_4k_capable(
        ) or G.ADDON.getSettingBool('enable_force_hdcp')

        hdcp_version = []
        if not hdcp_4k_capable and hdcp_override:
            hdcp_version = ['1.4']
        if hdcp_4k_capable and hdcp_override:
            hdcp_version = ['2.2']

        LOG.info('Requesting manifest for {} with ESN {} and HDCP {}',
                 viewable_id,
                 common.censure(esn) if G.ADDON.getSetting('esn') else esn,
                 hdcp_version)

        profiles = enabled_profiles()
        from pprint import pformat
        LOG.info('Requested profiles:\n{}', pformat(profiles, indent=2))

        params = {
            'type':
            'standard',
            'viewableId': [viewable_id],
            'profiles':
            profiles,
            'flavor':
            'PRE_FETCH',
            'drmType':
            'widevine',
            'drmVersion':
            25,
            'usePsshBox':
            True,
            'isBranching':
            False,
            'isNonMember':
            False,
            'isUIAutoPlay':
            False,
            'useHttpsStreams':
            True,
            'imageSubtitleHeight':
            1080,
            'uiVersion':
            G.LOCAL_DB.get_value('ui_version', '', table=TABLE_SESSION),
            'uiPlatform':
            'SHAKTI',
            'clientVersion':
            G.LOCAL_DB.get_value('client_version', '', table=TABLE_SESSION),
            'desiredVmaf':
            'plus_lts',  # phone_plus_exp can be used to mobile, not tested
            'supportsPreReleasePin':
            True,
            'supportsWatermark':
            True,
            'supportsUnequalizedDownloadables':
            True,
            'showAllSubDubTracks':
            False,
            'titleSpecificData': {
                unicode(viewable_id): {
                    'unletterboxed': True
                }
            },
            'videoOutputInfo': [{
                'type': 'DigitalVideoOutputDescriptor',
                'outputType': 'unknown',
                'supportedHdcpVersions': hdcp_version,
                'isHdcpEngaged': hdcp_override
            }],
            'preferAssistiveAudio':
            False
        }

        if 'linux' in common.get_system_platform(
        ) and 'arm' in common.get_machine():
            # 24/06/2020 To get until to 1080P resolutions under arm devices (ChromeOS), android excluded,
            #   is mandatory to add the widevine challenge data (key request) to the manifest request.
            # Is not possible get the key request from the default_crypto, is needed to implement
            #   the wv crypto (used for android) but currently InputStreamAdaptive support this interface only
            #   under android OS.
            # As workaround: Initially we pass an hardcoded challenge data needed to play the first video,
            #   then when ISA perform the license callback we replace it with the fresh license challenge data.
            params['challenge'] = self.manifest_challenge

        endpoint_url = ENDPOINTS[
            'manifest'] + '?reqAttempt=1&reqPriority=0&reqName=prefetch/manifest'
        manifest = self.msl_requests.chunked_request(
            endpoint_url,
            self.msl_requests.build_request_data('/manifest', params),
            esn,
            disable_msl_switch=False)
        if LOG.level == LOG.LEVEL_VERBOSE:
            # Save the manifest to disk as reference
            common.save_file_def('manifest.json',
                                 json.dumps(manifest).encode('utf-8'))
        # Save the manifest to the cache to retrieve it during its validity
        expiration = int(manifest['expiration'] / 1000)
        G.CACHE.add(CACHE_MANIFESTS,
                    cache_identifier,
                    manifest,
                    expires=expiration)
        return manifest
コード例 #7
0
def _save_system_info():
    # Ask to save to a file
    filename = 'NFSystemInfo.txt'
    path = ui.show_browse_dialog(
        common.get_local_string(30603) + ' - ' + filename)
    if not path:
        return
    # This collect the main data to allow verification checks for problems
    data = 'Netflix add-on version: ' + G.VERSION
    data += '\nDebug logging level: ' + LOG.level
    data += '\nSystem platform: ' + common.get_system_platform()
    data += '\nMachine architecture: ' + common.get_machine()
    data += '\nUser agent string: ' + common.get_user_agent()
    data += '\n\n' + '#### Widevine info ####\n'
    if common.get_system_platform() == 'android':
        data += '\nSystem ID: ' + G.LOCAL_DB.get_value(
            'drm_system_id', '--not obtained--', TABLE_SESSION)
        data += '\nSecurity level: ' + G.LOCAL_DB.get_value(
            'drm_security_level', '--not obtained--', TABLE_SESSION)
        data += '\nHDCP level: ' + G.LOCAL_DB.get_value(
            'drm_hdcp_level', '--not obtained--', TABLE_SESSION)
        wv_force_sec_lev = G.LOCAL_DB.get_value('widevine_force_seclev',
                                                WidevineForceSecLev.DISABLED,
                                                TABLE_SESSION)
        data += '\nForced security level setting is: ' + wv_force_sec_lev
    else:
        try:
            from ctypes import (CDLL, c_char_p)
            cdm_lib_file_path = _get_cdm_file_path()
            try:
                lib = CDLL(cdm_lib_file_path)
                data += '\nLibrary status: Correctly loaded'
                try:
                    lib.GetCdmVersion.restype = c_char_p
                    data += '\nVersion: ' + lib.GetCdmVersion().decode('utf-8')
                except Exception:  # pylint: disable=broad-except
                    # This can happen if the endpoint 'GetCdmVersion' is changed
                    data += '\nVersion: Reading error'
            except Exception as exc:  # pylint: disable=broad-except
                # This should not happen but currently InputStream Helper does not perform any verification checks on
                # downloaded and installed files, so if due to an problem it installs a CDM for a different architecture
                # or the files are corrupted, the user can no longer play videos and does not know what to do
                data += '\nLibrary status: Error loading failed'
                data += '\n>>> It is possible that is installed a CDM of a wrong architecture or is corrupted'
                data += '\n>>> Suggested solutions:'
                data += '\n>>> - Restore a previous version of Widevine library from InputStream Helper add-on settings'
                data += '\n>>> - Report the problem to the GitHub of InputStream Helper add-on'
                data += '\n>>> Error details: {}'.format(exc)
        except Exception as exc:  # pylint: disable=broad-except
            data += '\nThe data could not be obtained. Error details: {}'.format(
                exc)
    data += '\n\n' + '#### ESN ####\n'
    esn = get_esn() or '--not obtained--'
    data += '\nUsed ESN: ' + common.censure(esn) if len(esn) > 50 else esn
    data += '\nWebsite ESN: ' + (get_website_esn() or '--not obtained--')
    data += '\nAndroid generated ESN: ' + (generate_android_esn()
                                           or '--not obtained--')
    if common.get_system_platform() == 'android':
        data += '\n\n' + '#### Device system info ####\n'
        try:
            import subprocess
            info = subprocess.check_output(['/system/bin/getprop'
                                            ]).decode('utf-8')
            data += '\n' + info
        except Exception as exc:  # pylint: disable=broad-except
            data += '\nThe data could not be obtained. Error: {}'.format(exc)
    data += '\n'
    try:
        common.save_file(common.join_folders_paths(path, filename),
                         data.encode('utf-8'))
        ui.show_notification('{}: {}'.format(xbmc.getLocalizedString(35259),
                                             filename))  # 35259=Saved
    except Exception as exc:  # pylint: disable=broad-except
        LOG.error('save_file error: {}', exc)
        ui.show_notification('Error! Try another path')