コード例 #1
0
ファイル: test_plugin.py プロジェクト: andi3000/xbmcswift2
class TestParseRequest(TestCase):
    def setUp(self):
        name = "Hello XBMC"
        plugin_id = "plugin.video.helloxbmc"
        path = os.path.join(os.path.dirname(__file__), "data", "plugin", "addon.py")
        with preserve_cwd(os.path.dirname(path)):
            self.plugin = Plugin(name, plugin_id, path)

    def test_parse_request(self):
        with patch("xbmcswift2.plugin.Request") as MockRequest:
            sys.argv = ["plugin://plugin.video.helloxbmc", "0", "?"]
            self.plugin._parse_request()
            MockRequest.assert_called_with("plugin://plugin.video.helloxbmc?", "0")

    def test_parse_request_no_qs(self):
        with patch("xbmcswift2.plugin.Request") as MockRequest:
            sys.argv = ["plugin://plugin.video.helloxbmc", "0"]
            self.plugin._parse_request()
            MockRequest.assert_called_with("plugin://plugin.video.helloxbmc", "0")

    def test_parse_request_path_in_arg0(self):
        # Older versions of xbmc sometimes pass path in arg0
        with patch("xbmcswift2.plugin.Request") as MockRequest:
            sys.argv = ["plugin://plugin.video.helloxbmc/videos/", "0", "?foo=bar"]
            self.plugin._parse_request()
            MockRequest.assert_called_with("plugin://plugin.video.helloxbmc/videos/?foo=bar", "0")

    def test_parse_request_path_in_arg2(self):
        # Older versions of xbmc sometimes pass path in arg2
        with patch("xbmcswift2.plugin.Request") as MockRequest:
            sys.argv = ["plugin://plugin.video.helloxbmc", "0", "/videos/?foo=bar"]
            self.plugin._parse_request()
            MockRequest.assert_called_with("plugin://plugin.video.helloxbmc/videos/?foo=bar", "0")
コード例 #2
0
ファイル: test_plugin.py プロジェクト: dukavi/xbmcswift2
class TestParseRequest(TestCase):

    def setUp(self):
        name = 'Hello XBMC'
        plugin_id = 'plugin.video.helloxbmc'
        path = os.path.join(os.path.dirname(__file__), 'data', 'plugin', 'addon.py')
        with preserve_cwd(os.path.dirname(path)):
            self.plugin = Plugin(name, plugin_id, path)

    def test_parse_request(self):
        with patch('xbmcswift2.plugin.Request') as MockRequest:
            sys.argv = ['plugin://plugin.video.helloxbmc', '0', '?']
            self.plugin._parse_request()
            MockRequest.assert_called_with('plugin://plugin.video.helloxbmc?', '0')

    def test_parse_request_no_qs(self):
        with patch('xbmcswift2.plugin.Request') as MockRequest:
            sys.argv = ['plugin://plugin.video.helloxbmc', '0']
            self.plugin._parse_request()
            MockRequest.assert_called_with('plugin://plugin.video.helloxbmc', '0')

    def test_parse_request_path_in_arg0(self):
        # Older versions of xbmc sometimes pass path in arg0
        with patch('xbmcswift2.plugin.Request') as MockRequest:
            sys.argv = ['plugin://plugin.video.helloxbmc/videos/', '0', '?foo=bar']
            self.plugin._parse_request()
            MockRequest.assert_called_with('plugin://plugin.video.helloxbmc/videos/?foo=bar', '0')

    def test_parse_request_path_in_arg2(self):
        # Older versions of xbmc sometimes pass path in arg2
        with patch('xbmcswift2.plugin.Request') as MockRequest:
            sys.argv = ['plugin://plugin.video.helloxbmc', '0', '/videos/?foo=bar']
            self.plugin._parse_request()
            MockRequest.assert_called_with('plugin://plugin.video.helloxbmc/videos/?foo=bar', '0')
コード例 #3
0
ファイル: viewModes.py プロジェクト: moedje/kodi-repo-gaymods
	def display(self, showList):
		# Bold the already selected view mode
		orgList = showList[:]
		if self.currentMode and len(showList) > 2:
			# Convert current viewmode to an interger
			currentMode = int(self.currentMode)
			for key, value in self.viewModes.iteritems():
				# Check if current mode is found in viewModes
				if currentMode == value:
					# When found find its position in the list
					for count, i in enumerate(showList):
						# Check for required key
						if key == i:
							# Wen found, Bold and Indent the value
							showList[count] = "[B]-%s[/B]" % showList[count]
							break
					break
		
		# Display List to User
		ret = xbmcutil.Dialog.dialogSelect(plugin.get_setting(self.skin, "name"), showList)
		if ret >= 0:
			# Take action depending on response
			response = orgList[ret]
			if response.startswith(plugin.get_string(636)): self.askForViewID()
			elif response == plugin.get_string(571): plugin.set_setting("%s.%s.view" % (self.skin, self.mode), "")
			else: plugin.set_setting("%s.%s.view" % (self.skin, self.mode), str(self.viewModes[str(response)]))
コード例 #4
0
  def __init__(self):
    self.plugin = Plugin()
    self.plugin.register_module(menu.Module(), '')
    self.plugin.register_module(showlist.Module(), '')
    self.plugin.register_module(playlist.Module(), '')
    self.plugin.register_module(videolist.Module(), '')
    self.plugin.register_module(play.Module(), '')

    self.utils = Utils(self.plugin)
    self.utils.log_init()
コード例 #5
0
class Addon:
  def __init__(self):
    self.plugin = Plugin()
    self.plugin.register_module(menu.Module(), '')
    self.plugin.register_module(showlist.Module(), '')
    self.plugin.register_module(playlist.Module(), '')
    self.plugin.register_module(videolist.Module(), '')
    self.plugin.register_module(play.Module(), '')

    self.utils = Utils(self.plugin)
    self.utils.log_init()

  def run(self):
    try:
      self.plugin.run()
    except KeyboardInterrupt:
      pass
    except SystemExit:
      pass
    except:
      self.utils.handle_error()
コード例 #6
0
  def __init__(self, addon_dir=None):
    self.addon_dir = addon_dir

    self.plugin = Plugin()
    self.plugin.register_module(menu.Module(), '')
    self.plugin.register_module(showlist.Module(), '')
    self.plugin.register_module(playlist.Module(), '')
    self.plugin.register_module(videolist.Module(), '')
    self.plugin.register_module(play.Module(), '')

    self.utils = Utils(self.plugin, addon_dir=self.addon_dir)
    self.utils.log_init()
コード例 #7
0
ファイル: viewModes.py プロジェクト: moedje/kodi-repo-gaymods
	def __init__(self, mode):
		# Create List for display
		showList = [] # [plugin.getstr(571)]
		self.mode = mode
		
		# Load in Skin Codes from Database
		jsonData = storageDB.SkinCodes()
		if self.skin in jsonData:
			# Fetch viewmodes for selected mode
			self.viewModes = self.filterCodes(jsonData[self.skin], mode)
			
			# Append each key of viewModes to show list
			for i in sorted(self.viewModes.keys()):
				showList.append(i)
		
		# Fetch Current Mode if set and Show to user under Custom Mode ID
		self.currentMode = currentMode = plugin.get_setting("%s.%s.view" % (self.skin, mode))
		if currentMode: showList.append("%s (%s)" % (plugin.get_string(636), currentMode))
		else: showList.append(plugin.get_string(636))
		
		# Display List
		self.display(showList)
コード例 #8
0
# -*- coding: utf-8 -*-
import os.path as path
import json
import re
import urllib
from urllib import quote_plus
import ssl
import requests
from unidecode import unidecode
#import WebUtils
import webutil as WebUtils
from xbmcswift2 import Plugin, xbmc, ListItem, download_page, clean_dict, SortMethod

plugin = Plugin()
ssl._create_default_https_context = ssl._create_unverified_context
__BASEURL__ = u'https://watchseries-online.pl'
__addondir__ = xbmc.translatePath(plugin.addon.getAddonInfo('path'))
__datadir__ = xbmc.translatePath('special://profile/addon_data/{0}/'.format(plugin.id))
__cookie__ = path.join(__datadir__, 'cookies.lwp')
__temp__ = path.join(__datadir__, 'temp/')
__resdir__ = path.join(__addondir__, 'resources')
__imgsearch__ = path.join(__resdir__, 'search.png')
__savedjson__ = path.join(xbmc.translatePath(plugin.addon.getAddonInfo('profile')), 'savedshows.json')
getWeb = WebUtils.CachedWebRequest(path.join(__datadir__, 'cookies.lwp'), __temp__)
#getWeb = WebUtils.BaseRequest(path.join(__datadir__, 'cookies.lwp'))


def loadsaved():
    sitems = []
    litems = []
    items = []
コード例 #9
0
ファイル: _header.py プロジェクト: Alwnikrotikz/xbmc-kg-ontv
    return s
    
def to_utf8(s):
    return _to_unicode(s).encode('utf-8')
    
def get_url_route(url):
    result = url.rsplit('/')
    del result[0:2]
    return result

import sys, os, platform, random, xbmc, xbmcaddon, xbmcgui

sys.path.append( os.path.join( to_utf8(xbmcaddon.Addon().getAddonInfo( 'path' )), 'resources', 'lib', 'libs') )

from xbmcswift2 import Plugin, actions
plugin = Plugin()

import CommonFunctions
common = CommonFunctions
common.dbg = False
common.dbglevel = 5


def asyncHTTP(url):
    import urllib2, threading

    class aynsHTTPHandler(urllib2.HTTPHandler):
        def http_response(self, req, response):
            return response

    o = urllib2.build_opener(aynsHTTPHandler())
コード例 #10
0
#

import string
from xbmcswift2 import Plugin, xbmc, xbmcgui
import SimpleDownloader
from resources.lib import scraper

STRINGS = {
    'page': 30000,
    'search': 30001,
    'download': 30020,
    'no_download_path': 30030,
    'set_now?': 30031
}

plugin = Plugin(addon_id='plugin.video.myvideo_de')


@plugin.route('/')
def show_categories():
    items = [{
        'label': category['title'],
        'path': plugin.url_for(
            endpoint='show_subcategories',
            path=category['path']
        )
    } for category in scraper.get_categories()]
    items.append({
        'label': _('search'),
        'path': plugin.url_for('video_search')}
    )
コード例 #11
0
from xbmcswift2 import Plugin, xbmc
from settings import SETTING_LANGUAGE_ID

plugin = Plugin()

if plugin.get_setting(SETTING_LANGUAGE_ID, converter=str) == "system": LANG = xbmc.getLanguage(xbmc.ISO_639_1,)
else: LANG = plugin.get_setting(SETTING_LANGUAGE_ID, converter=str)

def import_tmdb():
    """ Lazy import tmdb """
    import tmdbsimple
    __builtins__["tmdb"] = tmdbsimple
    
def import_tvdb():
    """ Lazy import tmdb """
    if 'tvdb' not in __builtins__:
        __builtins__['tvdb'] = create_tvdb()
    
def create_tvdb(language=LANG):
    from tvdb_api import Tvdb
    return Tvdb("0629B785CE550C8D", language=language, cache=plugin.storage_path)
コード例 #12
0
# -*- coding: utf-8 -*-
"""
  Dabdate - Korea Drama/TV Shows Streaming Service
"""
from xbmcswift2 import Plugin, actions
import xbmcvfs
import os
import json

plugin = Plugin()
_L = plugin.get_string

plugin_path = plugin.addon.getAddonInfo('path')
lib_path = os.path.join(plugin_path, 'resources', 'lib')
sys.path.append(lib_path)

vidmap = None
import dabdate
vidmap_path = plugin.get_setting('vidmap_path', str)
print vidmap_path
if vidmap_path:
    try:
        f = xbmcvfs.File(vidmap_path)
        vidmap = json.load(f)
        f.close()
        plugin.log.info("direct play is enabled with "+vidmap_path)
    except:
        vidmap = None

qualcode = {
    ''        :'1',     # default
コード例 #13
0
#
# 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, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
#
from xbmcswift2 import Plugin


# global declarations
# plugin stuff
plugin = Plugin()


class PluginInformation:
    name = plugin.name
    version = plugin.addon.getAddonInfo('version')


# settings stuff
languages = ['fr', 'de', 'en', 'es', 'pl']
qualities = ['SQ', 'EQ', 'HQ']

# defaults to fr
language = plugin.get_setting('lang', choices=languages) or languages[0]
# defaults to SQ
quality = plugin.get_setting('quality', choices=qualities) or qualities[0]
コード例 #14
0
ファイル: comm.py プロジェクト: macmisu/xbmc-addons-chinese
# comm.py
import xbmc, sys, json, urllib2, gzip, time, os
import httplib, ssl
import socket
import HTMLParser

from StringIO import StringIO
from zhcnkbd import Keyboard

__cwd__ = os.path.dirname(__file__)
__lib__ = xbmc.translatePath(os.path.join(__cwd__, 'lib'))
sys.path.append(__lib__)
sys.path.append(xbmc.translatePath(os.path.join(__lib__, 'nova')))

from xbmcswift2 import Plugin
plugin = Plugin()
setthumbnail = plugin.get_storage('setthumbnail')
setthumbnail['set'] = False

moviepoint = plugin.get_storage('moviepoint')
searchvalues = plugin.get_storage('searchvalues')

colors = {
    'dir': 'FF9966',
    'video': 'FF0033',
    'bt': '33FF00',
    'audio': '66CCCC',
    'subtitle': '505050',
    'image': '99CC33',
    'back': '0099CC',
    'next': 'CCCCFF',
コード例 #15
0
ファイル: plugin.py プロジェクト: revho6/KODI-Popcorn-Time
#!/usr/bin/python
from xbmcswift2 import Plugin

plugin = Plugin()
コード例 #16
0
from xbmcswift2 import Plugin, xbmcgui
from resources.lib.abc_base import BaseForum
from resources.lib.sites import *
import resources.lib.util as util
from operator import itemgetter
import resources.lib.structure as s
import resources.lib.sites.live as live

bookmark_storage = 'my_bookmarks'
temp_storage = 'temp_storage'
livestream_xml_url = 'livestream_xml_url'

plugin = Plugin()

STRINGS = {
    'url_resolver_settings': 30100,
    'live_streams': 30016,
    'try_again': 30020,
    'site_unavailable': 30021,
    'is_unavailable': 30022,
    'try_again_later': 30023,
    'channel_xml_fail': 30024,
    'no_episodes': 30026,
    'no_valid_links': 30027,
    'cannot_play': 30028,
    'choose_source': 30029,
    'bookmarks': 30110,
    'add_bookmark': 30111,
    'remove_bookmark': 30112,
    'no_bookmarks': 30113,
    'bookmark_success': 30114,
コード例 #17
0
ファイル: addon.py プロジェクト: tjamieg/repository.kodinerds
#    You should have received a copy of the GNU General Public License
#    along with this program. If not, see <http://www.gnu.org/licenses/>.
#

from datetime import datetime
import time
from string import ascii_lowercase, digits
import json
import requests
import urllib
from xbmcswift2 import Plugin, xbmc, xbmcgui
from resources.lib.api import DokuMonsterApi, NetworkError

PER_PAGE = 50

plugin = Plugin()
api = DokuMonsterApi(default_count=PER_PAGE)

STRINGS = {
    'topics': 30001,
    'new_docus': 30002,
    'tags': 30003,
    'all': 30004,
    'top_docus': 30005,
    'search': 30006,
    'network_error': 30200
}


class DialogSelect(xbmcgui.WindowXMLDialog):
    def __init__(self, *args, **kwargs):
コード例 #18
0
import os
import sys
import traceback
from cStringIO import StringIO

from xbmcswift2 import Plugin

plugin = Plugin()


@plugin.route('/')
def index():
    return [
        {
            'label': _(30200),
            'path': plugin.url_for('library')
        },
        {
            'label': _(30201),
            'path': plugin.url_for('search')
        },
        {
            'label': _(30202),
            'path': plugin.url_for('discover')
        },
        {
            'label': _(30203),
            'path': plugin.url_for('recent')
        },
    ]
コード例 #19
0
from xbmcswift2 import xbmc, xbmcgui, Plugin
from resources.lib.mubi import Mubi

PLUGIN_NAME = 'MUBI'
PLUGIN_ID = 'plugin.video.mubi'

plugin = Plugin(PLUGIN_NAME, PLUGIN_ID, __file__)

if not plugin.get_setting("username"):
    plugin.open_settings()

mubi = Mubi()
mubi.login(plugin.get_setting("username", unicode),
           plugin.get_setting("password", unicode))


@plugin.route('/')
def index():
    films = mubi.now_showing()
    items = [{
        'label': film.title,
        'is_playable': True,
        'path': plugin.url_for('play_film', identifier=film.mubi_id),
        'thumbnail': film.artwork,
        'info': film.metadata._asdict()
    } for film in films]
    return items


@plugin.route('/play/<identifier>')
def play_film(identifier):
コード例 #20
0
ファイル: addon.py プロジェクト: leopheard/WordsMatter
from xbmcswift2 import Plugin, xbmcgui
from resources.lib import mainaddon

plugin = Plugin()
url1 = "https://feed.pippa.io/public/shows/5b4e5428e97154a553e14cc0"
@plugin.route('/')
def main_menu():
    items = [
        {
            'label': plugin.get_string(30001), 
            'path': plugin.url_for('episodes1'),
            'thumbnail': "https://is2-ssl.mzstatic.com/image/thumb/Podcasts113/v4/58/36/2b/58362b43-be3f-5b56-3287-a8b87746471d/mza_5028375880808334192.jpeg/600x600bb.jpg"},
        {
            'label': plugin.get_string(30000),
            'path': plugin.url_for('episodes'),
            'thumbnail': "https://is2-ssl.mzstatic.com/image/thumb/Podcasts113/v4/58/36/2b/58362b43-be3f-5b56-3287-a8b87746471d/mza_5028375880808334192.jpeg/600x600bb.jpg"},
    ]
    return items

@plugin.route('/episodes1/'
def episodes1():
    soup1 = mainaddon.get_soup1(url1)
    playable_podcast1 = mainaddon.get_playable_podcast1(soup1)
    items = mainaddon.compile_playable_podcast1(playable_podcast1)
    return items
@plugin.route('/episodes/')
def episodes():
    soup1 = mainaddon.get_soup1(url1)
    playable_podcast = mainaddon.get_playable_podcast(soup1)
    items = mainaddon.compile_playable_podcast(playable_podcast)
    return items
コード例 #21
0
import re
import random
import hashlib
 




def unescape(string):
    string = urllib2.unquote(string).decode('utf8')
    quoted = HTMLParser.HTMLParser().unescape(string).encode('utf-8')
    #转成中文
    return re.sub(r'%u([a-fA-F0-9]{4}|[a-fA-F0-9]{2})', lambda m: unichr(int(m.group(1), 16)), quoted)


plugin = Plugin()



apikey = plugin.get_storage('apikey',TTL=30)
xbbxmp4 = plugin.get_storage('xbbxmp4',TTL=60)
headers = {'user-agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.122 Safari/537.36'}
mheaders = {'user-agent' : 'Mozilla/5.0 (Linux; Android 10; Z832 Build/MMB29M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.116 Mobile Safari/537.36'}

@plugin.cached(TTL=10)
def get_hash():
    hashurl = 'https://weibomiaopai.com/online-video-download-helper/bilibili'
    rec = requests.get(hashurl,headers=headers)
    rec.encoding = 'utf-8'
    rte = rec.text
    str1 = rte.find('var freeservice=')
コード例 #22
0
ファイル: addon.py プロジェクト: D3X/plugin.audio.rmfon
#    the Free Software Foundation, either version 3 of the License, or
#    (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/>.
#
from xbmcswift2 import Plugin
from resources.lib.api import Api, ApiError


plugin = Plugin()
api = Api(logger=plugin.log)


@plugin.route('/')
def show_root_menu():
    items = [
        {
            'label': station.name,
            'path': plugin.url_for('play', api_id=station.api_id),
        }
        for station in api.get_stations()
    ]
    return plugin.finish(items)

コード例 #23
0
import os, os.path, stat
import urllib, urllib2, urlparse
import time, datetime
#datetime.datetime.strptime("2016", "%Y")
import threading
import json
import subprocess
import sqlite3
import collections
import socket
from rpc import RPC
import threading

ADDON = xbmcaddon.Addon()

plugin = Plugin()


def addon_id():
    return xbmcaddon.Addon().getAddonInfo('id')


def log(v):
    xbmc.log(repr(("[plugin.video.addon.recorder]", v)), xbmc.LOGERROR)


#log(sys.argv)


def get_icon_path(icon_name):
    if plugin.get_setting('user.icons') == "true":
コード例 #24
0
ファイル: old_addon.py プロジェクト: moedje/kodi-repo-gaymods
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os.path as path
import json
import re
import urllib
from urllib import quote_plus
import ssl
import requests
from unidecode import unidecode
import webutil as WebUtils
from xbmcswift2 import Plugin, xbmc, ListItem, download_page, clean_dict, SortMethod

plugin = Plugin()
ssl._create_default_https_context = ssl._create_unverified_context
__BASEURL__ = u'https://watchseries-online.pl'
__addondir__ = xbmc.translatePath(plugin.addon.getAddonInfo('path'))
__datadir__ = xbmc.translatePath('special://profile/addon_data/{0}/'.format(plugin.id))
__cookie__ = path.join(__datadir__, 'cookies.lwp')
__temp__ = path.join(__datadir__, 'temp/')
__resdir__ = path.join(__addondir__, 'resources')
__imgsearch__ = path.join(__resdir__, 'search.png')
__savedjson__ = path.join(xbmc.translatePath(plugin.addon.getAddonInfo('profile')), 'savedshows.json')
getWeb = WebUtils.CachedWebRequest(path.join(__datadir__, 'cookies.lwp'), __temp__)
#getWeb = WebUtils.BaseRequest(path.join(__datadir__, 'cookies.lwp'))


def loadsaved():
    sitems = []
    litems = []
    items = []
コード例 #25
0
import os
import random
import re
import requests
import sqlite3
import time
import xbmc, xbmcaddon, xbmcvfs, xbmcgui
import xbmcplugin

# This is a throwaway variable to deal with a python bug
try:
    throwaway = datetime.datetime.strptime('20110101', '%Y%m%d')
except:
    pass

plugin = Plugin()
big_list_view = False


def log2(v):
    xbmc.log(repr(v))


def log(v):
    xbmc.log(re.sub(',', ',\n', repr(v)), xbmc.LOGERROR)


def get_icon_path(icon_name):
    addon_path = xbmcaddon.Addon().getAddonInfo("path")
    return os.path.join(addon_path, 'resources', 'img', icon_name + ".png")
コード例 #26
0
from xbmcswift2 import Plugin
import xbmc,xbmcaddon,xbmcvfs,xbmcgui
import re

import requests

import resources.lib.pytz
from resources.lib.pytz import timezone
import datetime


plugin = Plugin()

def log2(v):
    xbmc.log(repr(v))

def log(v):
    xbmc.log(re.sub(',',',\n',repr(v)))
    
def get_tvdb_id(name):
    tvdb_url = "http://thetvdb.com//api/GetSeries.php?seriesname=%s" % name
    r = requests.get(tvdb_url)
    tvdb_html = r.text
    tvdb_id = ''
    tvdb_match = re.search(r'<seriesid>(.*?)</seriesid>', tvdb_html, flags=(re.DOTALL | re.MULTILINE))
    if tvdb_match:
        tvdb_id = tvdb_match.group(1)
    return tvdb_id
  
@plugin.route('/play/<channel>/<title>/<season>/<episode>')
def play(channel,title,season,episode):
コード例 #27
0
# -*- coding: utf-8 -*-
import sys, os, xbmc
from xbmcswift2 import Plugin
from resources.lib.classes import *
from resources.lib.assets import *

reload(sys)
sys.setdefaultencoding('utf8')
plugin = Plugin('plugin.video.bgcameras')


#plugin entry screen camera categories
@plugin.route('/')
def index():
    items = [{
        'label': "%s (%s)" % (cat.name, cat.count),
        'path': plugin.url_for('show_category', category_id=cat.id),
        'is_playable': False
    } for cat in get_categories()]
    return items


#Display cameras for the provided category
@plugin.route('/categories/<category_id>/')
def show_category(category_id):
    items = []
    cams = get_cameras(category_id)
    for cam in cams:
        if cam.stream != '':
            path = cam.stream
        elif cam.stream_rtsp != '':
コード例 #28
0
#    the Free Software Foundation, either version 3 of the License, or
#    (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/>.
#

from xbmcswift2 import Plugin
from resources.lib.api import NetzkinoApi, NetworkError

plugin = Plugin()
api = NetzkinoApi()


@plugin.route('/')
def show_categories():
    categories = api.get_categories()
    items = [{
        'label': item['title'],
        'path': plugin.url_for(
            endpoint='show_movies',
            category_id=str(item['id'])
        )
    } for item in categories]
    return plugin.finish(items)
コード例 #29
0
from xbmcswift2 import Plugin, xbmc
import xbmcgui

Strings = {'no-station-notification': 30700}

if __name__ == '__main__':
    plugin = Plugin()
    my_stations = plugin.get_storage('my_stations.json', file_format='json')
    found = False

    if plugin.get_setting('autostart', bool):
        for station in my_stations.values():
            if 'autostart' in station:
                found = True
                plugin.log.info("Play startup radio station: %s" %
                                station['name'])
                listitem = xbmcgui.ListItem(station['name'])
                listitem.setArt({'thumb': station['thumbnail']})
                listitem.setRating("radio.de",
                                   float(station.get('rating', '0.0')))
                listitem.setInfo(
                    'music', {
                        'title': station['name'],
                        'genre': station['genre'],
                        'size': station['bitrate'],
                        'comment': station['current_track']
                    })
                xbmc.Player().play(item=station['stream_url'],
                                   listitem=listitem)

        if not found:
コード例 #30
0
ファイル: default.py プロジェクト: c0ns0le/YCBuilds
import xbmc
import xbmcaddon
import xbmcgui
import datetime
import urlparse
import urllib2
import re
import HTMLParser
import codecs

# The following modules require an import entry in the addon.xml.
import urlresolver.types
from xbmcswift2 import Plugin
from bs4 import BeautifulSoup

plugin = Plugin()

MYNAME = "Movie4k.to"
CACHE_TTL = 360 # 6 hours
THUMBNAIL_PATH = os.path.join( plugintools.get_runtime_path() , "resources" , "img" )
FANART = os.path.join( plugintools.get_runtime_path() , "fanart.jpg" )
FORUM_URL = 'http://forums.tvaddons.ag'
plugintools.module_log_enabled = (plugintools.get_setting("debug")=="true")
plugintools.http_debug_log_enabled = (plugintools.get_setting("debug")=="true")
HOSTERS_BLACKLIST = [] # ["filenuke", "divxstage", "streamclou", "xvidstage", "rapidvideo"]

if plugintools.get_setting("use_anonymizer_site")=="true":
    ANON_URL = 'http://anonymouse.org/cgi-bin/anon-www.cgi/'
    MAIN_URL = ANON_URL + 'http://www.movie4k.to/'
elif plugintools.get_setting("use_alternative_site_url")=="true":
    MAIN_URL = plugintools.get_setting("alternative_site_url")
コード例 #31
0
ファイル: addon.py プロジェクト: quangpham/plugin.video.some
import urllib2
from xbmcswift2 import Plugin
from resources.lib.academicearth.api import AcademicEarth
from StringIO import StringIO

try:
    import json
except:
    import simplejson as json

plugin = Plugin()


def httpgetjson(url):
    response = urllib2.urlopen(url)
    return json.load(response)


def format_menu_item(item):
    _item = {}
    _item['label'] = item['label']

    if item.get('is_playable'):
        _item['is_playable'] = item['is_playable']

    if item.get('path'):
        _item['path'] = item['path']

    if item.get('youtube_id'):
        _item[
            'path'] = "plugin://plugin.video.youtube/?action=play_video&videoid=" + item[
コード例 #32
0
ファイル: main.py プロジェクト: Inter95/tutvguia
            params[key] = value.replace("'", "")
    # settings.debug(params)
    opciones = re.search("var options =(.*?);", data, re.DOTALL).group(1).replace("{", "").replace("}", "") + ": ''"
    params1 = {}
    for item in opciones.split("\n"):
        if item.strip() != "":
            key, value = item.strip()[:-1].split(':')
            params1[key] = value.replace("'", "")
    # settings.debug(params1)
    urlPage = re.search('url: "(.*?)"', data).group(1)
    return urlPage, params, params1["totalPages"]


##INITIALISATION
storage = Storage(settings.storageName, type="dict", eval=True)
plugin = Plugin()
isLogin = False
# Getting the cookies from cache
cookies = plugin.get_storage('cookies', TTL=5)
if settings.value["user"] == "" or settings.value["password"] == "":
    settings.dialog.ok(settings.cleanName, "Por favor, suministre su usuario y clave")
    settings.settings.openSettings()
    settings = Settings()

if len(cookies.items()) < 2:
    settings.log("Asking the new credentials")
    browser.get(settings.value["urlAddress"] + "/")
    goodSpider()
    params = {"user": settings.value["user"],
              "password": settings.value["password"]}
    browser.post(settings.value["urlAddress"] + "/ajax/login_check_user.php", data={"user": settings.value["user"]})
コード例 #33
0
ファイル: addon.py プロジェクト: Gemini88/addons
#    the Free Software Foundation, either version 3 of the License, or
#    (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/>.
#

from xbmcswift2 import Plugin, xbmc
from resources.lib.api import ShoutcastApi, NetworkError

plugin = Plugin()
api = ShoutcastApi('sh1t7hyn3Kh0jhlV')
my_stations = plugin.get_storage('my_stations.json', file_format='json')

STRINGS = {
    'all': 30000,
    'top500_stations': 30001,
    'browse_by_genre': 30002,
    'my_stations': 30003,
    'search_station': 30004,
    'search_current_track': 30005,
    'add_to_my_stations': 30010,
    'remove_from_my_stations': 30011,
    'network_error': 30200
}
コード例 #34
0
ファイル: addon.py プロジェクト: jelly/xbmc-coursera
import cookielib
import urllib2
import urllib
import json
import re

from course_utils import login_to_class, get_syllabus_url, parse_syllabus
from courseraLogin import login, saveCJ
import datetime
import time

##############################
DEBUG = False
CACHE_TIME = 24 * 60
##############################
plugin = Plugin()
##############################
if DEBUG:
	plugin.log.setLevel(level=logging.DEBUG)
##############################

def isSettingsBad(username, password):
	return username is None or password is None or username == "" or password == ""

def loadSavedCookies(cookies_raw):
	cookies = []
	for cookie in cookies_raw:
		cookies.append(cookielib.Cookie(**cookie))
		
	cj = cookielib.CookieJar()
	for cookie in cookies:
コード例 #35
0
ファイル: addon.py プロジェクト: wljcom/dkodi
from xbmcswift2 import Plugin, xbmcgui
from resources.lib.api import SiteApi


plugin = Plugin()
api = SiteApi()


@plugin.cached_route("/")
def index():
    """
    Get movie categories
    """
    plugin.log.debug("Get category menu")

    c = api.get_menu_category()

    items = [
        {
            "label": item["label"],
            "path": plugin.url_for("browse_category", menuid=item.get("pk", "0"), page=1, url=item["url"]),
        }
        for item in c
    ]

    return items


@plugin.cached_route("/<menuid>/page/<page>")
def browse_category(menuid, page="1"):
    """
コード例 #36
0
#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/>.

from xbmcswift2 import Plugin
import xbmc, xbmcgui
import sys

from resources.drundoo import drundoo

plugin = Plugin()
my_drundoo = drundoo(plugin.get_setting('username'),plugin.get_setting('password'))


@plugin.route('/')
def index():
    
    items = [{'label':'Live', 'path':plugin.url_for('live')},
             {'label':'Timeshift', 'path':plugin.url_for('time')},
             {'label':'Playlist', 'path':plugin.url_for('playlist')},
             {'label':'ZAPIS', 'path':plugin.url_for('zapis')}
            ]
        
    return items

######################################
コード例 #37
0
#!/usr/bin/python
# -*- coding: utf8 -*-

from xbmcswift2 import Plugin, xbmc
from json import loads
from bigmovie import BigMovie

plugin = Plugin()
Bigmovie = BigMovie()
HISTORY = plugin.get_storage('history')


def colorize(label, color):
    return "[COLOR %s]" % color + label + "[/COLOR]"


def setSettingByRPC(key, value):
    """Set Kodi Setting by JSON-RPC

    Args:
        key (TYPE): Description
        value (TYPE): Description

    Returns:
        TYPE: Description
    """
    result = xbmc.executeJSONRPC(
        '{"jsonrpc":"2.0", "method":"Settings.SetSettingValue", "params":{"setting":"%s", "value":%s}, "id":1}'
        % (key, value))
    result = loads(result)
    return result
コード例 #38
0
    Reddit Music
    ~~~~~~~~~~~~

    An XBMC addon for watching and listenting to music found on a variety of
    subreddits.

    :copyright: (c) 2012 by Jonathan Beluch
    :license: GPLv3, see LICENSE.txt for more details.
'''
import operator
from xbmcswift2 import Plugin
from resources.lib.subreddits import subreddits
from resources.lib import mediahosts, playlists, reddit


plugin = Plugin()
plugin.register_module(playlists.playlists, '/playlists')
red = reddit.Reddit(user_agent='XBMC')


STRINGS = {
    'browse_subreddits': 30010,
    'my_playlists': 30011,
    'add_to_playlist': 30012,
}


def _(string_id):
    return plugin.get_string(STRINGS[string_id])

コード例 #39
0
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/>  
'''

from xbmcswift2 import Plugin, xbmcaddon, xbmc, xbmcgui
import urlfetch
from BeautifulSoup import BeautifulSoup
import json, re

xbmcplugin = Plugin()
__mysettings__ = xbmcaddon.Addon(id='plugin.video.hieuhien.vn.itv.fptplay')
__homeUrl__ = 'http://fptplay.net/livetv'

reg = {
    'User-agent':
    'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20100101 Firefox/15.0.1',
    'Content-type': 'application/x-www-form-urlencoded',
    'X-Requested-With': 'XMLHttpRequest',
    'Referer': 'http://fptplay.net'
}


@xbmcplugin.route('/')
def main():
    channel = []
コード例 #40
0
#!/usr/bin/python
# -*- coding: utf-8 -*-

import xbmc
from xbmcswift2 import Plugin
import xbmcaddon
import os
import pickle
import xbmcgui

plugin = Plugin()


def get_stations():
    filename = os.path.join(
        xbmcaddon.Addon(plugin.id).getAddonInfo('path'), 'resources',
        'stations.pickle')
    src = open(filename, 'r')
    try:
        streams = pickle.load(src)
    finally:
        src.close()

    return streams


postaje = get_stations()


@plugin.route('/')
def index():
コード例 #41
0
#!/usr/bin/python
# -*- coding: utf-8 -*-
from converter import JsonListItemConverter
from functools import wraps
from twitch import TwitchTV, TwitchVideoResolver, Keys, TwitchException
from xbmcswift2 import Plugin  #@UnresolvedImport
import sys

ITEMS_PER_PAGE = 20
LINE_LENGTH = 60

PLUGIN = Plugin()
CONVERTER = JsonListItemConverter(PLUGIN, LINE_LENGTH)
TWITCHTV = TwitchTV()


def managedTwitchExceptions(func):
    @wraps(func)
    def wrapper(*args, **kwargs):
        try:
            return func(*args, **kwargs)
        except TwitchException as error:
            handleTwitchException(error)

    return wrapper


def handleTwitchException(exception):
    codeTranslations = {
        TwitchException.NO_STREAM_URL: 32004,
        TwitchException.STREAM_OFFLINE: 32002,
コード例 #42
0
ファイル: default.py プロジェクト: G4RL1N/Twitch.tv-on-XBMC
# -*- coding: utf-8 -*-
from converter import JsonListItemConverter
from functools import wraps
from twitch import TwitchTV, TwitchVideoResolver, Keys, TwitchException
from xbmcswift2 import Plugin  # @UnresolvedImport
import urllib2, json, sys

ITEMS_PER_PAGE = 20
LINE_LENGTH = 60

PLUGIN = Plugin()
CONVERTER = JsonListItemConverter(PLUGIN, LINE_LENGTH)
TWITCHTV = TwitchTV(PLUGIN.log)


def managedTwitchExceptions(func):
    @wraps(func)
    def wrapper(*args, **kwargs):
        try:
            return func(*args, **kwargs)
        except TwitchException as error:
            handleTwitchException(error)
    return wrapper


def handleTwitchException(exception):
    codeTranslations = {TwitchException.NO_STREAM_URL   : 30023,
                        TwitchException.STREAM_OFFLINE  : 30021,
                        TwitchException.HTTP_ERROR      : 30020,
                        TwitchException.JSON_ERROR      : 30027}
    code = exception.code
コード例 #43
0
from xbmcswift2 import Plugin, xbmcgui
import resources.lib.util as util
from resources.lib.abc_base import BaseI4M
from resources.lib.sites import *
import urllib


plugin = Plugin()


STRINGS = {
    'url_resolver_settings': 30100,
    'try_again': 30050,
    'site_unavailable': 30051,
    'is_unavailable': 30052,
    'try_again_later': 30053,
    'no_valid_links': 30057,
    'cannot_play': 30058,
    'no_search_terms': 30060,
    'video_url_not_found': 30061,
    'unresolvable_link': 30062
}


def _(string_id):
    if string_id in STRINGS:
        return plugin.get_string(STRINGS[string_id])
    else:
        plugin.log.warning('String is missing: %s' % string_id)
        return string_id
コード例 #44
0
ファイル: addon.py プロジェクト: BRY82/plugin.program.iarl
from xbmcswift2 import Plugin
import xbmcplugin
from resources.lib.util import scape_xml_headers
from resources.lib.util import getParserFilePath
from resources.lib.util import parse_xml_romfile

# xbmcswift2 determines the content type from 'content.game.internet.arcive'.split('.')[1],
# but only for 'video', 'audio' and 'music' so we need to manually specify it (TODO: patch xbmcswift2)
plugin = Plugin(info_type='game') 

iarl_setting_clean_list = plugin.get_setting('iarl_setting_clean_list', bool)

@plugin.route('/') #Start Page
def index():
    items = []
    emu_info = scape_xml_headers() #Find all xml dat files and get the header info

    for ii in range(0,len(emu_info['emu_name'])):
        items.append({ 
            'label' : emu_info['emu_name'][ii],
            'path': plugin.url_for('get_rom_page', category_id=emu_info['emu_name'][ii]),
            'info_type': 'folder',
            'icon': emu_info['emu_logo'][ii],
            'thumbnail' : emu_info['emu_thumb'][ii],
            'info' : {
                'FolderPath': emu_info['emu_baseurl'][ii]
            },
            'properties' : {
                'fanart_image': emu_info['emu_fanart'][ii],
                'banner' : emu_info['emu_banner'][ii],
                'clearlogo': emu_info['emu_logo'][ii]
コード例 #45
0
#!/usr/bin/python
# coding=utf-8
import urllib, requests, re, json, os, uuid, random
from xbmcswift2 import Plugin, xbmc, xbmcgui, xbmcaddon

requests.packages.urllib3.disable_warnings()
oo000 = Plugin()
if 9 - 9: Ii.o0o00Oo0O - iI11I1II1I1I


def oooo():
    iIIii1IIi = requests.get(
        "https://docs.google.com/spreadsheets/d/13VzQebjGYac5hxe1I-z1pIvMiNB0gSG7oWJlFHWnqsA/export?format=tsv&gid=126722574"
    )
    o0OO00 = iIIii1IIi.text.strip().splitlines()
    random.shuffle(o0OO00)
    return o0OO00
    if 78 - 78: i11i.oOooOoO0Oo0O


@oo000.route('/play/<args_json>')
def iI1(args_json={}):
    i1I11i = json.loads(args_json)
    OoOoOO00(
        "[Play] %s" % (i1I11i["title"].encode("utf8") if "title" in i1I11i else
                       "Unknow Title"), '/play/%s/%s' %
        (i1I11i["url"],
         json.dumps(i1I11i["payloads"]) if "payloads" in i1I11i else "{}"))
    I11i = xbmcgui.DialogProgress()
    I11i.create('HPlus.vn',
                'Đang tải, Xin quý khách vui lòng đợi trong giây lát...')
コード例 #46
0
ファイル: addon.py プロジェクト: bialagary/mw
#    (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/>.
#

from xbmcswift2 import Plugin, xbmc
from resources.lib.api import \
    ItunesPodcastApi, NetworkError, NoEnclosureException

plugin = Plugin()
api = ItunesPodcastApi()
my_podcasts = plugin.get_storage('my_podcasts.json', file_format='json')

STRINGS = {
    'all': 30000,
    'browse_by_genre': 30002,
    'show_my_podcasts': 30003,
    'search_podcast': 30004,
    'video': 30005,
    'audio': 30006,
    'add_to_my_podcasts': 30010,
    'remove_from_my_podcasts': 30011,
    'network_error': 30200,
    'no_media_found': 30007,
}
コード例 #47
0
import xbmc
import xbmcaddon
import xbmcgui
import datetime
import urlparse
import urllib2
import re
import HTMLParser
import codecs

# The following modules require an import entry in the addon.xml.
import urlresolver.types
from xbmcswift2 import Plugin
from bs4 import BeautifulSoup

plugin = Plugin()

MYNAME = "Movie4k.to"
CACHE_TTL = 360  # 6 hours
THUMBNAIL_PATH = os.path.join(plugintools.get_runtime_path(), "resources",
                              "img")
FANART = os.path.join(plugintools.get_runtime_path(), "fanart.jpg")
FORUM_URL = 'http://forums.tvaddons.ag'
plugintools.module_log_enabled = (plugintools.get_setting("debug") == "true")
plugintools.http_debug_log_enabled = (
    plugintools.get_setting("debug") == "true")
HOSTERS_BLACKLIST = [
]  # ["filenuke", "divxstage", "streamclou", "xvidstage", "rapidvideo"]

if plugintools.get_setting("use_alternative_site_url") == "true":
    MAIN_URL = plugintools.get_setting("alternative_site_url")
コード例 #48
0
ファイル: addon.py プロジェクト: JacobZy/plugin.video.fytv
import gzip
import base64
import time
import urllib
import urllib2
import httplib
from StringIO import StringIO
from xbmcswift2 import xbmc
from xbmcswift2 import Plugin
from xbmcswift2 import xbmcgui
try:
    from ChineseKeyboard import Keyboard
except:
    from xbmc import Keyboard

plugin = Plugin()
dialog = xbmcgui.Dialog()
filters = plugin.get_storage('ftcache', TTL=1440)
epcache = plugin.get_storage('epcache', TTL=1440)

baseurl = r'http://www.fuyin.tv'

@plugin.route('/')
def showcatalog():
    """
    show catalog list
    """
    if baseurl in epcache:
       return epcache[baseurl]
    result = _http(baseurl)
    catastr = re.search(r'<div class="nav".*?<ul>(.*?)</ul>',
コード例 #49
0
# -*- coding: utf-8 -*-
import os
import re
import sys
import json
import gzip
import urllib2
import httplib
from StringIO import StringIO
from xbmcswift2 import xbmc
from xbmcswift2 import Plugin
from xbmcswift2 import xbmcgui
from collections_backport import OrderedDict
from zhcnkbd import Keyboard

plugin = Plugin()
dialog = xbmcgui.Dialog()
filters = plugin.get_storage('ftcache', TTL=1440)
epcache = plugin.get_storage('epcache', TTL=1440)


@plugin.route('/')
def showcatalog():
    """
    show catalog list
    """
    url = 'http://www.youku.com/v/'
    if url in epcache: return epcache[url]
    result = _http(url)
    catastr = re.search(r'yk-filter-panel">(.*?)yk-filter-handle', result,
                        re.S)
コード例 #50
0
    ~~~~~~~~~~~~~~~

    An XBMC addon for watching documentaries found on
    http://documentary.net/.

    :copyright: (c) 2012 by Jonathan Beluch
    :license: GPLv3, see LICENSE.txt for more details.
'''
from operator import itemgetter
from xbmcswift2 import Plugin, SortMethod
from resources.lib.api import  get_categories, get_category_posts


PLUGIN_NAME = 'Documentary.net'
PLUGIN_ID = 'plugin.video.documentary.net'
plugin = Plugin(PLUGIN_NAME, PLUGIN_ID, __file__)


def video_url(host, video_id):
    '''This addon uses the youtube and vimeo addons for playback of certain
    items. This functions returns the playable URL given a host and a video_id.
    '''
    ptns = {
        'youtube': 'plugin://plugin.video.youtube/?action=play_video&videoid=%s',
        'vimeo': 'plugin://plugin.video.vimeo/?action=play_video&videoid=%s',
    }
    if host in ptns.keys():
        return ptns[host] % video_id
    return None

コード例 #51
0
    An XBMC addon for watching uzg 
    :license: GPLv3, see LICENSE.txt for more details.
    
    based on: https://github.com/jbeluch/plugin.video.documentary.net
    Uitzendinggemist(NPO) / uzg = Made by Bas Magre (Opvolger)
    
'''
from xbmcswift2 import Plugin, SortMethod
import resources.lib.uzg
import time
import xbmcplugin

PLUGIN_NAME = 'schooltv'
PLUGIN_ID = 'plugin.video.schooltv'
plugin = Plugin(PLUGIN_NAME, PLUGIN_ID, __file__)

uzg = resources.lib.uzg.Uzg()

@plugin.route('/')
def index():    
    items = [{
        'path': plugin.url_for(item['functie'], type=item['type']),
        'label': item['label']        
    } for item in uzg.get_overzicht()]       
    return items
    
@plugin.route('/leeftijdkeuze')
def leeftijdkeuze():
    items = [{
        'path': plugin.url_for('show_leeftijd', leeftijdint=item['leeftijdint']),