예제 #1
0
 def valid_url(self, url, host):
     if common.has_addon('plugin.video.twitch'):
         if re.search(self.pattern, url, re.I):
             return not re.match(self.exclusion_pattern, url, re.I) or any(
                 host in domain.lower() for domain in self.domains)
     return False
예제 #2
0
파일: twitch.py 프로젝트: gitrazr/filmkodi
 def valid_url(self, url, host):
     if common.has_addon('plugin.video.twitch'):
         if re.search(self.pattern, url, re.I):
             return not re.match(self.exclusion_pattern, url, re.I) or any(host in domain.lower() for domain in self.domains)
     return False
예제 #3
0
 def _is_enabled(cls):
     if not common.has_addon('plugin.video.twitch'):
         return False
     return super(cls, cls)._is_enabled()
예제 #4
0
파일: twitch.py 프로젝트: gitrazr/filmkodi
 def _is_enabled(cls):
     if not common.has_addon('plugin.video.twitch'):
         return False
     return super(cls, cls)._is_enabled()
예제 #5
0
from urlresolver.plugins.lib.helpers import pick_source, parse_smil_source_list, get_hidden, append_headers
from constants import RESOLVER_DIRS, COOKIE_FILE, ICONS, MODES

try:
    from urlresolver.plugins.lib.helpers import add_packed_data

    get_packed_data = None
except ImportError:
    from urlresolver.plugins.lib.helpers import get_packed_data

    add_packed_data = None

socket.setdefaulttimeout(30)

RUNPLUGIN_EXCEPTIONS = []
dash_supported = common.has_addon('inputstream.adaptive')
inputstream_rtmp = common.has_addon('inputstream.rtmp')
inputstream_hls = common.has_addon('inputstream.hls')

user_cache_limit = int(kodi.get_setting('cache-expire-time'))
resolver_cache_limit = 0.11  # keep resolver caching to 10 > minutes > 5, resolved sources expire
cache.cache_enabled = user_cache_limit > 0


def get_url_with_headers(url, headers):
    if 'Accept-Encoding' in headers:
        del headers['Accept-Encoding']
    if 'Host' in headers:
        del headers['Host']
    parts = url.split('|')
    url = parts[0]
예제 #6
0
 def __init__(self):
     self.net = common.Net()
     self.dash_supported = common.has_addon('inputstream.adaptive')
예제 #7
0
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
    along with this program. If not, see <http://www.gnu.org/licenses/>.
"""

import re
from urlresolver import common
from urlresolver.resolver import UrlResolver, ResolverError

TWITCH_INSTALLED = common.has_addon('plugin.video.twitch')


class TwitchResolver(UrlResolver):
    name = 'twitch'
    domains = ['twitch.tv']
    pattern = 'https?://(?:www\.)?(twitch\.tv)/(.+?)(?:\?|$)'
    exclusion_pattern = '^https?://(?:www\.)?twitch\.tv/' \
                        '(?:directory|user|p|jobs|store|login|products|search|.+?/profile)' \
                        '(?:[?/].*)?$'

    def get_media_url(self, host, media_id):
        is_live = True if media_id.count('/') == 0 else False
        if is_live:
            return 'plugin://plugin.video.twitch/playLive/%s/-2/' % media_id
        else:
예제 #8
0
 def valid_url(self, url, host):
     if common.has_addon('plugin.video.twitch'):
         if re.search(self.pattern, url, re.I):
             return not re.match(self.exclusion_pattern, url,
                                 re.I) or self.name in host
     return False