# Path: resources/lib/compat.py



import re
import sys
import zlib
import json
import time
import base64
import random
import uuid
import requests
import xml.etree.ElementTree as ET
import xbmcaddon
import subprocess
    from io import StringIO
    from StringIO import StringIO
from datetime import datetime
from resources.lib.compat import string_encoding
  from resources.lib.MSLMediaDrm import MSLMediaDrmCrypto as MSLHandler
  from resources.lib.MSLCrypto import MSLCrypto as MSLHandler
            # Only one subtitle representation per adaptationset
            downloadable = text_track['ttDownloadables']
            try:
              content_profile = next(iter(downloadable.keys()))
            except NameError:
              content_profile = downloadable.keys()[0]

            subtiles_adaption_set = ET.SubElement(
                period,
                'AdaptationSet',
                lang=text_track.get('language'),
                codecs='wvtt' if content_profile == 'webvtt-lssdh-ios8' else 'stpp',
                contentType='text',
                mimeType='text/vtt' if content_profile == 'webvtt-lssdh-ios8' else 'application/ttml+xml')
            role = ET.SubElement(
                subtiles_adaption_set,
                'Role',
                schemeIdUri = 'urn:mpeg:dash:role:2011',
                value = 'forced' if text_track.get('isForcedNarrative') else 'main')
            rep = ET.SubElement(
                subtiles_adaption_set,
                'Representation',
                nflxProfile=content_profile)

            try:
                base_url = next(iter(downloadable[content_profile]['downloadUrls'].values()))
            except NameError:
                base_url = downloadable[content_profile]['downloadUrls'].values()[0]
            ET.SubElement(rep, 'BaseURL').text = base_url


# Path: resources/lib/compat.py



# Path: resources/lib/MSLv2.py
import re
import sys
import zlib
import json
import time
import base64
import random
import uuid
import requests
import xml.etree.ElementTree as ET
import xbmcaddon
import subprocess
    from io import StringIO
    from StringIO import StringIO
from datetime import datetime
from resources.lib.compat import string_encoding
  from resources.lib.MSLMediaDrm import MSLMediaDrmCrypto as MSLHandler
  from resources.lib.MSLCrypto import MSLCrypto as MSLHandler

            # Only one subtitle representation per adaptationset
            downloadable = text_track['ttDownloadables']
            try:
              content_profile = next(iter(downloadable.keys()))
            except NameError:
              content_profile = downloadable.keys()[0]

            subtiles_adaption_set = ET.SubElement(
                period,
                'AdaptationSet',
                lang=text_track.get('language'),
                codecs='wvtt' if content_profile == 'webvtt-lssdh-ios8' else 'stpp',
                contentType='text',
                mimeType='text/vtt' if content_profile == 'webvtt-lssdh-ios8' else 'application/ttml+xml')
            role = ET.SubElement(
                subtiles_adaption_set,
                'Role',
                schemeIdUri = 'urn:mpeg:dash:role:2011',
                value = 'forced' if text_track.get('isForcedNarrative') else 'main')
            rep = ET.SubElement(
                subtiles_adaption_set,
                'Representation',
                nflxProfile=content_profile)

            try:
                base_url = next(iter(downloadable[content_profile]['downloadUrls'].values()))
            except NameError:
                base_url = downloadable[content_profile]['downloadUrls'].values()[0]
            ET.SubElement(rep, 'BaseURL').text = base_url


        xml = ET.tostring(root, encoding=string_encoding, method='xml')