예제 #1
0
# Author: moedje (Roman V. M. SimplePlugin/example framework)
# Created on: 27.08.2017
# License: GPL v.3 https://www.gnu.org/copyleft/gpl.html
import sys, json, os, re, simpleutils
import xbmc, xbmcgui
from urllib import quote_plus
from simpleplugin import Plugin, Params
from operator import itemgetter

plugin = Plugin()   # Get the plugin url in plugin:// notation.
_url = sys.argv[0]  # Get the plugin handle as an integer number.
_handle = int(sys.argv[1])
__addondir__ = xbmc.translatePath(plugin.addon.getAddonInfo('path'))
__resources__ = os.path.join(__addondir__, 'resources/')
__next__ = os.path.join(__resources__, "next.png")
__filtersex__ = plugin.get_setting('filterorientation')
__sortby__ = plugin.get_setting('sortby')

VIDEOS = json.load(file(os.path.join(__resources__, 'tags.json')))
webreq = simpleutils.CachedWebRequest(cookiePath=os.path.join(xbmc.translatePath('special://profile'), 'addon_data/', plugin.id))
revidblock = re.compile(ur'<div id="(video_.*?)</p></div>', re.DOTALL)
revidparts = re.compile(ur'video_([\d]+).*? src="(.*?)".*?href="(.*?)".*?itle="(.*?)".*?"duration">[\(](.+?)[\)]</span',re.DOTALL)


def parsepageforvideos(html):
    matches = revidblock.findall(html)
    listitems = []
    for vidhtml in matches:
        vmatches = revidparts.findall(vidhtml)
        if vmatches is not None:
            for vidid, img, link, title, length in vmatches:
예제 #2
0
        list_item = xbmcgui.ListItem(label=video['name'])
        # Set additional info for the list item.
        list_item.setInfo('video', {'title': video['name'], 'genre': video['genre']})
        # Set graphics (thumbnail, fanart, banner, poster, landscape etc.) for the list item.
        # Here we use the same image for all items for simplicity's sake.
        # In a real-life plugin you need to set each image accordingly.
        list_item.setArt({'thumb': video['thumb'], 'icon': video['thumb'], 'fanart': video['thumb']})
        # Set 'IsPlayable' property to 'true'.
        # This is mandatory for playable items!
        list_item.setProperty('IsPlayable', 'true')
        # Create a URL for a plugin recursive call.
        # Example: plugin://plugin.video.example/?action=play&video=http://www.vidsplay.com/wp-content/uploads/2017/04/crab.mp4
        url = get_url(action='play', video=video['video'])
        # Add the list item to a virtual Kodi folder.
        # is_folder = False means that this item won't open any sub-list.
        is_folder = False
        # Add our item to the Kodi virtual folder listing.
        xbmcplugin.addDirectoryItem(_handle, url, list_item, is_folder)
    # Add a sort method for the virtual folder items (alphabetically, ignore articles)
    xbmcplugin.addSortMethod(_handle, xbmcplugin.SORT_METHOD_LABEL_IGNORE_THE)
    # Finish creating a virtual folder.
    xbmcplugin.endOfDirectory(_handle)

'''

if __name__ == '__main__':
    __filtersex__ = plugin.get_setting('filterorientation')
    __sortby__ = plugin.get_setting('sortby')
    __period__ = plugin.get_setting('period')
    plugin.run()  # Start plugin
예제 #3
0
import re
from urllib import quote_plus, unquote, urlencode
from urlparse import parse_qs, urlparse
from xml.etree import ElementTree

import requests

import xbmc
from xbmcplugin import setContent
from resources.lib.api import Streamy, fetchapi, torapi
from resources.lib.notify import OverlayText
from simpleplugin import Plugin

app = Plugin()
streamy = Streamy(app.get_setting('server'))


def search_ui():
    keyboard = xbmc.Keyboard('', 'Search')
    keyboard.doModal()
    if keyboard.isConfirmed():
        return keyboard.getText()


def search_trailer(title):
    title = quote_plus(title)
    return 'Container.Update(plugin://plugin.video.youtube/kodion/search/query/?q={})'.format(
        title)