Exemplo n.º 1
0
	def __init__(self):
		global ADDON_ID
		global reg
		ADDON = Addon(ADDON_ID)
		self.data_root = ADDON.get_profile()
		if reg.getBoolSetting('cache_temp_custom_directory'):
			self.cache_root = reg.getSetting('cache_temp_directory')
		else:
			self.cache_root = os.path.join(xbmc.translatePath(self.data_root + 'cache'), '')
		print "Setting cache_root: %s" % self.cache_root
		self.mkdir(self.cache_root)

		if reg.getBoolSetting('cache_movie_custom_directory'):
			self.movie_root = reg.getSetting('cache_movie_directory')
		else:
			self.movie_root = os.path.join(xbmc.translatePath(self.data_root + 'cache/movies'), '')
		print "Setting movie_root: %s" % self.movie_root
		self.mkdir(self.movie_root)

		if reg.getBoolSetting('cache_tvshow_custom_directory'):
			self.tvshow_root = reg.getSetting('cache_tvshow_directory')
		else:
			self.tvshow_root = os.path.join(xbmc.translatePath(self.data_root + 'cache/tvshows'), '')	
		print "Setting tvshow_root: %s" % self.tvshow_root
		self.mkdir(self.tvshow_root)

		db_file = os.path.join(xbmc.translatePath(self.data_root), 'walter.db')
		sql_path = os.path.join(xbmc.translatePath(ROOT_PATH + '/resources/database'), '')
		self.DB = DatabaseClass(db_file, sql_path)
Exemplo n.º 2
0
def art(filename):
    adn = Addon("plugin.video.1channel", sys.argv)
    THEME_LIST = ["mikey1234", "Glossy_Black"]
    THEME = THEME_LIST[int(adn.get_setting("theme"))]
    THEME_PATH = os.path.join(adn.get_path(), "art", "themes", THEME)
    img = os.path.join(THEME_PATH, filename)
    return img
Exemplo n.º 3
0
 def get_addons_that_have_favorites(self):
 
     addons = []
 
     sql_select = "SELECT DISTINCT addon_id FROM favorites ORDER BY addon_id"
 
     self.dbcur.execute(sql_select)
 
     for matchedrow in self.dbcur.fetchall():
     
         match = dict(matchedrow)
         
         try:
             tmp_addon_id = match['addon_id']
             tmp_addon = Addon(tmp_addon_id)
             tmp_addon_name = tmp_addon.get_name()
             tmp_addon_img = tmp_addon.get_icon()                
             tmp_addon_fanart = tmp_addon.get_fanart() 
         except:
             tmp_addon_name = tmp_addon_id
             tmp_addon_img = ''          
             tmp_addon_fanart = ''
             pass
         
         tmp_addon_dtl = {'title' : tmp_addon_name, 'id' : tmp_addon_id, 'img':tmp_addon_img, 'fanart':tmp_addon_fanart}
         
         addons.append(tmp_addon_dtl)
         
     return addons
def art(file):
    adn = Addon('plugin.video.1channel', sys.argv)
    THEME_LIST = ['mikey1234','Glossy_Black']
    THEME = THEME_LIST[int(adn.get_setting('theme'))]
    THEME_PATH = os.path.join(adn.get_path(), 'art', 'themes', THEME)
    img = os.path.join(THEME_PATH, file)
    return img
Exemplo n.º 5
0
 def add_my_fav_directory(self, title='Favorites', img='', fanart='', item_mode='main'):
     if not self.sys_argv:
         common.addon.log_error('-' + HELPER + '- -' +'sys.argv not passed in Favorites __init__(); Favorites directory will not be created.')
         return
         
     try:
         tmp_addon_id = 'plugin.video.favorites'
         tmp_addon = Addon(tmp_addon_id)
         tmp_addon_name = tmp_addon.get_name()                
     except:
         common.addon.log_error('-' + HELPER + '- -' +'Favorites video plugin not installed; Favorites directory will not be created.')
         common.notify(self.addon_id, 'small', ' - My Favorites video addon required', 'Please install My Favorites video addon from The ONE\'s XBMC Addons Repository.', '10000')                
         return
         
     
     listitem = xbmcgui.ListItem(title, iconImage=img, thumbnailImage=img)
     listitem.setProperty('fanart_image', fanart)
     uni_fav = {
         'uni_fav_addon_id': self.addon_id,
         'uni_fav_mode': 'display',
         'uni_fav_item_mode': item_mode
         }
     
     params = self._build_params( {'mode':'browse', 'addon_id':self.addon_id, 'local':'true', 'item_mode':item_mode} )
     xbmcplugin.addDirectoryItem(handle=int(self.sys_argv[1]),url='plugin://plugin.video.favorites/'+params,isFolder=True,listitem=listitem)
Exemplo n.º 6
0
def RMOVIEMETA(meta_name):
    imdb_id = Addon.queries.get('imdb_id', '')
    r = re.split(r'480p|720p|xvid',meta_name,0,)
    name = re.findall(r'(.+?)\s[\d]{4}',r[0],flags=re.I)
    year = re.findall(r'([\d{4}])',r[0])
    print str(name)
    if len(name) >=1:
        name = name[0]
    name =''.join(name)
    year =''.join(year)
    metaget=metahandlers.MetaData()
    try:
        search_meta = metaget.search_movies(name)
    except:
        xbmc.executebuiltin("XBMC.Notification([COLOR red]Notice[/COLOR],Could not find correct MetaData,10000,os.path.join(art,'TVRnotify.png')")

        return

    if search_meta:
        movie_list = []
        for movie in search_meta:
            movie_list.append(movie['title'] + ' (' + str(movie['year']) + ')')
        dialog = xbmcgui.Dialog()
        index = dialog.select('Choose', movie_list)

        if index > -1:
            new_imdb_id = search_meta[index]['imdb_id']
            new_tmdb_id = search_meta[index]['tmdb_id']       
            meta = metaget.update_meta('movie', name, imdb_id=imdb_id, new_imdb_id=new_imdb_id, new_tmdb_id=new_tmdb_id, year=year)   
            xbmc.executebuiltin("Container.Refresh")
    else:
        msg = ['No matches found']
        Addon.show_ok_dialog(msg, 'Refresh Results')
Exemplo n.º 7
0
 def get_addons_that_have_watch_history(self):
 
     addons = []
 
     sql_select = "SELECT DISTINCT addon_id FROM watch_history ORDER BY addon_id"
 
     self.dbcur.execute(sql_select)
 
     for matchedrow in self.dbcur.fetchall():
     
         match = dict(matchedrow)
         
         try:
             tmp_addon_id = match['addon_id']
             tmp_addon = Addon(tmp_addon_id)
             tmp_addon_name = tmp_addon.get_name()
         except:
             tmp_addon_name = tmp_addon_id
             pass
         
         tmp_addon_dtl = {'title' : tmp_addon_name, 'id' : tmp_addon_id}
         
         addons.append(tmp_addon_dtl)
         
     return addons
Exemplo n.º 8
0
def proxpesquisa():
    from t0mm0.common.addon import Addon
    addon=Addon(addon_id)
    form_d=addon.load_data('temp.txt')
    ref_data = {'Accept':'*/*','Content-Type':'application/x-www-form-urlencoded','Host':'abelhas.pt','Origin':'http://abelhas.pt','Referer':url,'User-Agent':user_agent,'X-Requested-With':'XMLHttpRequest'}
    form_d['Page']= form_d['Page'] + 1
    endlogin=MainURL + 'action/SearchFiles/Results'
    net.set_cookies(cookies)
    conteudo= net.http_POST(endlogin,form_data=form_d,headers=ref_data).content.encode('latin-1','ignore')
    addon.save_data('temp.txt',form_d)
    pastas(MainURL + 'action/nada','coco',conteudo=conteudo)
Exemplo n.º 9
0
def PLAY(url,types,linkback,meta_name):
    infoLabels = GRABMETA(meta_name, types)
    stream_url = urlresolver.HostedMediaFile(url).resolve()
    if stream_url == False:
        Addon.log('Error while trying to resolve %s' % url)
        return VIDEOLINKS(linkback,types,'',meta_name,meta_name)
    meta_name = '[COLOR yellow]'+str(meta_name).replace('SEASON:',' ').replace('EPISODE:','x')+'[/COLOR]'
    liz=xbmcgui.ListItem(meta_name, iconImage= '', thumbnailImage=infoLabels['cover_url'])
    liz.setInfo( type="Video", infoLabels={ "Title": meta_name} )
    liz.setProperty("IsPlayable","true")
    xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=stream_url,isFolder=False,listitem=liz)#; Addon.resolve_url(stream_url)
    meta_name = str(meta_name).replace('[/COLOR]','').replace('[COLOR yellow]','')
    print meta_name
    xbmc.Player().play(stream_url,liz)
Exemplo n.º 10
0
def notify(addon_id, typeq, title, message, times, line2='', line3=''):
    addon_tmp = Addon(addon_id)
    if title == '' :
        title='[B]' + addon_tmp.get_name() + '[/B]'
    if typeq == 'small':
        if times == '':
           times='5000'
        smallicon= addon_tmp.get_icon()
        xbmc.executebuiltin("XBMC.Notification("+title+","+message+","+times+","+smallicon+")")
    elif typeq == 'big':
        dialog = xbmcgui.Dialog()
        dialog.ok(' '+title+' ', ' '+message+' ', line2, line3)
    else:
        dialog = xbmcgui.Dialog()
        dialog.ok(' '+title+' ', ' '+message+' ')    
Exemplo n.º 11
0
def Search():
    last_search = Addon.load_data('search')
    if not last_search: last_search = ''
    search_entered =''
    keyboard = xbmc.Keyboard(search_entered, '[B][I] SEARCH TV-REALEASE.NET TVShows[/B][/I]')
    last_search = last_search.replace('%20',' ')
    keyboard.setDefault(last_search)
    keyboard.doModal()
    if keyboard.isConfirmed():
        search_entered = keyboard.getText().replace(' ','%20')# sometimes you need to replace spaces with + or %20#
        Addon.save_data('search',search_entered)
    if search_entered == None or len(search_entered)<1:
        MAIN()
    else:
        url = base64.b64encode('http://www.tv-release.net/?s='+search_entered+'&cat=')
        Index(url, '')
Exemplo n.º 12
0
 def __init__(self, addon_id, sys_argv=''):
     
     #Check if a path has been set in the addon settings
     if common.db_path:
         self.path = xbmc.translatePath(common.db_path)
     else:
         self.path = xbmc.translatePath(common.default_path)
     
     self.addon_id = addon_id
     self.sys_argv = sys_argv
     self.cache_path = common.make_dir(self.path, '')
     self.addon = Addon(self.addon_id, self.sys_argv)
     
     self.db = os.path.join(self.cache_path, self.local_db_name)
     
     # connect to db at class init and use it globally
     if DB == 'mysql':
         class MySQLCursorDict(database.cursor.MySQLCursor):
             def _row_to_python(self, rowdata, desc=None):
                 row = super(MySQLCursorDict, self)._row_to_python(rowdata, desc)
                 if row:
                     return dict(zip(self.column_names, row))
                 return None
         self.dbcon = database.connect(common.db_name, common.db_user, common.db_pass, common.db_address, buffered=True, charset='utf8')
         self.dbcur = self.dbcon.cursor(cursor_class=MySQLCursorDict, buffered=True)
     else:
         self.dbcon = database.connect(self.db)
         self.dbcon.row_factory = database.Row # return results indexed by field names and not numbers so we can convert to dict
         self.dbcon.text_factory = str
         self.dbcur = self.dbcon.cursor()
             
     self._create_favorites_tables()
Exemplo n.º 13
0
def SEARCH(url):
    last_search = Addon.load_data('search')
    if not last_search: last_search = ''
    search_entered =''
    keyboard = xbmc.Keyboard(search_entered, '[B][I] SEARCH TV-REALEASE.NET TVShows[/B][/I]')
    last_search = last_search.replace('+',' ')
    keyboard.setDefault(last_search)
    keyboard.doModal()
    if keyboard.isConfirmed():
        search_entered = keyboard.getText().replace(' ','+')# sometimes you need to replace spaces with + or %20#
        Addon.save_data('search',search_entered)
    if search_entered == None or len(search_entered)<1:
        MAIN()
    else:
        url = 'http://tv-release.net/?s="%s"&cat='%(search_entered)
        types = None
        SEARCHRESULTS(url,types)
Exemplo n.º 14
0
 def add_my_history_directory(self, title='Watch History', img='', fanart=''):
     if not self.sys_argv:
         common.addon.log_error('-' + HELPER + '- -' +'sys.argv not passed in WatchHistory __init__(); Watch History directory will not be created.')
         return
         
     try:
         tmp_addon_id = 'plugin.video.watchhistory'
         tmp_addon = Addon(tmp_addon_id)
         tmp_addon_name = tmp_addon.get_name()                
     except:
         common.addon.log_error('-' + HELPER + '- -' +'Watch History video plugin not installed; Watch History directory will not be created.')
         common.notify(self.addon_id, 'small', ' - Watch History video addon required', 'Please install Watch History video addon from The ONE\'s XBMC Addons Repository.', '10000')                            
         return
     
     listitem = xbmcgui.ListItem(title, iconImage=img, thumbnailImage=img)
     listitem.setProperty('fanart_image', fanart)
     
     params = '?' + common.dict_to_paramstr( {'mode':'browse', 'addon_id':self.addon_id, 'local':'true'} )
     xbmcplugin.addDirectoryItem(handle=int(self.sys_argv[1]),url='plugin://plugin.video.watchhistory/'+params,isFolder=True,listitem=listitem)
Exemplo n.º 15
0
def resolve_mightyupload(url,referer):
    from resources.libs import jsunpack
    from t0mm0.common.addon import Addon
    addon = Addon('plugin.video.movie25', sys.argv)
    try:
        from t0mm0.common.net import Net as net
        html = net().http_GET(url).content
        addon.log_error('Mash Up: Resolve MightyUpload - Requesting GET URL: '+url)
        r = re.findall(r'name="(.+?)" value="?(.+?)"', html, re.I|re.M)
        post_data = {}
        for name, value in r:
            post_data[name] = value
        post_data['referer'] = referer
        headers={'Referer':referer}
        html = net().http_POST(url, post_data).content
        r = re.findall(r'<a href=\"(.+?)(?=\">Download the file</a>)', html)
        return r[0]
    except Exception, e:
        print 'Mash Up: Resolve MightyUpload Error - '+str(e)
        addon.show_small_popup('[B][COLOR green]Mash Up: MightyUpload Resolver[/COLOR][/B]','Error, Check XBMC.log for Details',
                               5000, elogo)
        return
Exemplo n.º 16
0
def CREATE_BOXSET(meta_name,url):
    boxset_path = os.path.join(Addon.get_profile(), 'boxset')
    boxset = os.path.join(boxset_path, meta_name)
    if os.path.exists(boxset_path) == False:
        os.makedirs(boxset_path)
    if os.path.exists(boxset) == False:
        os.makedirs(boxset)
    meta_name = meta_name.strip()
    url = 'http://tv-release.net/?s="%s"&cat='%(meta_name).replace(' ','+')
    html = GET_HTML(url)
    print 'CBS PATH: '+addon.getAddonInfo("path")
    print 'CBS DPATH: '+Addon.get_profile()
    print 'CBS BOXSET PATH: '+boxset_path
    print 'BOXSET NAME: '+boxset

    #-----------------------------------------------------------------------
    print 'Create Boxset MetaName: '+meta_name
    print 'Create Boxset url: '+url
    if re.search(r'\s[0-9]{4}\s[0-9]{2}\s[0-9]{2}\s',meta_name,flags=re.I):
        print 'YES: Meta_name: '+meta_name

    print 'meta_name2: '+meta_name
    print 'CBS URL: '+url
Exemplo n.º 17
0
def resolve_videto(url,referer):
    user_agent='Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3'
    from resources.libs import jsunpack
    from t0mm0.common.addon import Addon
    addon = Addon('plugin.video.movie25', sys.argv)
    try:
        from t0mm0.common.net import Net as net
        html = net(user_agent).http_GET(url).content
        addon.log_error('Mash Up: Resolve Vidto - Requesting GET URL: '+url)
        r = re.findall(r'<font class="err">File was removed</font>',html,re.I)
        if r:
            addon.log_error('Mash Up: Resolve Vidto - File Was Removed')
            xbmc.executebuiltin("XBMC.Notification(File Not Found,Vidto,2000)")
            return False
        if not r:
            r = re.findall(r'(eval\(function\(p,a,c,k,e,d\)\{while.+?flvplayer.+?)</script>'
                           ,html,re.M|re.DOTALL)
            if r:
                unpacked = jsunpack.unpack(r[0])#this is where it will error, not sure if resources,libs added to os path
                r = re.findall(r'label:"\d+p",file:"(.+?)"}',unpacked)
            if not r:
                r = re.findall('type="hidden" name="(.+?)" value="(.+?)">',html)
                post_data = {}
                for name, value in r:
                    post_data[name] = value
                post_data['usr_login'] = ''
                post_data['referer'] = referer
                addon.show_countdown(7, 'Please Wait', 'Resolving')
                headers={'Referer':referer}
                html = net(user_agent).http_POST(url,post_data,headers).content
                r = re.findall(r'(eval\(function\(p,a,c,k,e,d\)\{while.+?flvplayer.+?)</script>'
                               ,html,re.M|re.DOTALL)
                if r:
                    unpacked = jsunpack.unpack(r[0])
                    r = re.findall(r'label:"\d+p",file:"(.+?)"}',unpacked)
                if not r:
                    r = re.findall(r"var file_link = '(.+?)';",html)
        return r[0]
    except Exception, e:
        print 'Mash Up: Resolve Vidto Error - '+str(e)
        addon.show_small_popup('[B][COLOR green]Mash Up: Vidto Resolver[/COLOR][/B]','Error, Check XBMC.log for Details',
                               5000, elogo)
    def __init__(self):
        self.addon = Addon('plugin.video.craftsy', sys.argv)
        self.net = Net()

        self.logo = os.path.join(self.addon.get_path(), 'art','logo.jpg')

        self.profile_path = self.addon.get_profile()
        self.cookie_file = os.path.join(self.profile_path, 'craftsy.cookies')

        try:
            os.makedirs(os.path.dirname(self.cookie_file))
        except OSError:
            pass

        self.net.set_cookies(self.cookie_file)
        self.base_url = 'http://www.craftsy.com'
Exemplo n.º 19
0
import urllib, urllib2, re, cookielib, sys, xbmcplugin, xbmcgui, xbmcaddon, time, socket, string, os, shutil, stat
from t0mm0.common.addon import Addon

#SET DIRECTORIES
addon_id = 'plugin.video.movie25'
selfAddon = xbmcaddon.Addon(id=addon_id)
addon = Addon(addon_id)
datapath = addon.get_profile()
favpath = os.path.join(datapath, 'Favourites')
tvfav = os.path.join(favpath, 'Movies')
try:
    os.makedirs(tvfav)
except:
    pass
FavFile = os.path.join(tvfav, 'IWOFav')


def addFAVS(url, name, mode, thumb, plot, type):
    if open(FavFile, 'r').read().find(name) > 0:
        xbmc.executebuiltin(
            "XBMC.Notification([B][COLOR green]" + name +
            "[/COLOR][/B],[B]Already added to Favourites[/B],1000,"
            ")")
    else:
        open(FavFile, 'a').write(
            'url="%s",name="%s",mode="%s",thumb="%s",plot="%s",type="%s",' %
            (url, name, mode, thumb, plot, type))
        xbmc.executebuiltin("XBMC.Notification([B][COLOR green]" + name +
                            "[/COLOR][/B],[B]Added to Favourites[/B],1000,"
                            ")")
Exemplo n.º 20
0
try: import xbmc,xbmcplugin,xbmcgui,xbmcaddon
except:
     xbmc_imported = False
else:
     xbmc_imported = True


# global constants
USER_AGENT = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3'


#get path to me
addon = xbmcaddon.Addon()
alltube=addon.getAddonInfo('path')

_PLT = Addon('plugin.video.alltube', sys.argv)


def xbmcpath(path,filename):
     translatedpath = os.path.join(xbmc.translatePath( path ), ''+filename+'')
     return translatedpath

def _get_keyboard(default="", heading="", hidden=False):
        """ shows a keyboard and returns a value """
        keyboard = xbmc.Keyboard(default, heading, hidden)
        keyboard.doModal()
        if (keyboard.isConfirmed()):
                return unicode(keyboard.getText(), "utf-8")
        return default

def SEARCHVIDEOS(url):
Exemplo n.º 21
0
import urllib, urllib2, re, cookielib, string, urlparse, sys, os
import xbmc, xbmcgui, xbmcaddon, xbmcplugin
import urlresolver
from t0mm0.common.addon import Addon
from t0mm0.common.net import Net as net

addon_id = "plugin.video.movie25"
selfAddon = xbmcaddon.Addon(id=addon_id)
addon = Addon(addon_id)
datapath = addon.get_profile()
elogo = xbmc.translatePath("special://home/addons/plugin.video.movie25/resources/art/bigx.png")


class ResolverError(Exception):
    def __init__(self, value, value2):
        self.value = value
        self.value2 = value2

    def __str__(self):
        return repr(self.value, self.value2)


def resolve_url(url):
    stream_url = False
    if url:
        try:
            match = re.search("xoxv(.+?)xoxe(.+?)xoxc", url)
            if match:
                source = urlresolver.HostedMediaFile(host=match.group(1), media_id=match.group(2))
                if source:
                    stream_url = source.resolve()
Exemplo n.º 22
0
from t0mm0.common.net import Net
import HTMLParser

try:
    from sqlite3 import dbapi2 as sqlite
    print "Loading sqlite3 as DB engine"
except:
    from pysqlite2 import dbapi2 as sqlite
    print "Loading pysqlite2 as DB engine"

plugin = xbmcaddon.Addon(
    id=re.compile("plugin://(.+?)/").findall(sys.argv[0])[0])
DB = os.path.join(xbmc.translatePath("special://database"), 'extramina.db')
BASE_URL = 'http://www.extramina.in'
net = Net()
addon = Addon('plugin.video.extramina', sys.argv)

##### Queries ##########
mode = addon.queries['mode']
url = addon.queries.get('url', None)
content = addon.queries.get('content', None)
query = addon.queries.get('query', None)
listitem = addon.queries.get('listitem', None)
startPage = addon.queries.get('startPage', None)
numOfPages = addon.queries.get('numOfPages', None)


def GetTitles(url, startPage='1', numOfPages='1'):  # Get Movie Titles
    print 'extramina get Movie Titles Menu %s' % url

    # handle paging
Exemplo n.º 23
0
import HTMLParser

try:
    from sqlite3 import dbapi2 as sqlite
    print "Loading sqlite3 as DB engine"
except:
    from pysqlite2 import dbapi2 as sqlite
    print "Loading pysqlite2 as DB engine"

addon_id = 'plugin.video.ddlvalley'
plugin = xbmcaddon.Addon(id=addon_id)

DB = os.path.join(xbmc.translatePath("special://database"), 'ddlvalley.db')
BASE_URL = 'http://www.ddlvalley.eu/'
net = Net()
addon = Addon('plugin.video.ddlvalley', sys.argv)

#PATHS
AddonPath = addon.get_path()
IconPath = AddonPath + "/icons/"
FanartPath = AddonPath + "/icons/"

##### Queries ##########
mode = addon.queries['mode']
url = addon.queries.get('url', None)
content = addon.queries.get('content', None)
query = addon.queries.get('query', None)
startPage = addon.queries.get('startPage', None)
numOfPages = addon.queries.get('numOfPages', None)
listitem = addon.queries.get('listitem', None)
urlList = addon.queries.get('urlList', None)
Exemplo n.º 24
0
import os
import re
import sys
import xbmc
import xbmcgui

# from functools import wraps

from t0mm0.common.addon import Addon

addon = Addon('plugin.video.1channel', sys.argv)


def format_label_tvshow(info):
    if 'premiered' in info:
        year = info['premiered'][:4]
    else:
        year = ''
    title = info['title']
    label = addon.get_setting('format-tvshow')
    # label = label.replace('{t}', title)
    # label = label.replace('{y}', year)
    # label = label.replace('{ft}', format_tvshow_title(title))
    # label = label.replace('{fy}', format_tvshow_year(year))

    label = re.sub('\{t\}', title, label)
    label = re.sub('\{y\}', year, label)
    label = re.sub('\{ft\}', format_tvshow_title(title), label)
    label = re.sub('\{fy\}', format_tvshow_year(year), label)
    return label
Exemplo n.º 25
0
"""
    metahandler XBMC Addon
    Copyright (C) 2012 Eldorado

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    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/>.
"""

import os
from t0mm0.common.addon import Addon
import xbmc
import xbmcaddon
import xbmcgui
import xbmcplugin

addon = Addon('script.module.metahandler')
addon_path = addon.get_path()
profile_path = addon.get_profile()
settings_file = os.path.join(addon_path, 'resources', 'settings.xml')
Exemplo n.º 26
0
import re
import urlresolver
import urllib2
import xbmc, xbmcaddon, xbmcplugin, xbmcgui

from t0mm0.common.addon import Addon
from t0mm0.common.net import Net
from bs4 import BeautifulSoup

addon_id = 'plugin.video.watchwrestling'

net = Net(user_agent='Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.72 Safari/537.36')
headers = {
    'Accept'    :   'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8'
    }
addon = Addon(addon_id, sys.argv)

BASEURL = addon.get_setting("srcweb")

#PATHS
AddonPath = addon.get_path()
IconPath = os.path.join(AddonPath, 'icons')

from universal import _common as univ_common
from universal import watchhistory, playbackengine

mode = addon.queries['mode']
url = addon.queries.get('url', '')
title = addon.queries.get('title', 'Watch Wrestling ( watchwrestling.ch )')
img = addon.queries.get('img', os.path.join(IconPath, 'icon.jpg'))
section = addon.queries.get('section', '')
Exemplo n.º 27
0
from t0mm0.common.addon import Addon
if 64 - 64: i11iIiiIii
import datetime
import time
OO0o = Net()
if 81 - 81: Iii1I1 + OO0O0O % iiiii % ii1I - ooO0OO000o
ii11i = 'plugin.video.notfilmon'
oOooOoO0Oo0O = xbmcaddon.Addon(id=ii11i)
if 10 - 10: IIiI1I11i11
#Global Constants
ooOO00oOo = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3'
OOOo0 = 'http://www.filmon.com/channel/'
Oooo000o = 'http://dl.dropbox.com/u/129714017/hubmaintenance/'
IiIi11iIIi1Ii = 'http://static.filmon.com/couch/channels/'
Oo0O = settings.res()
IiI = Addon('plugin.video.notfilmon', sys.argv)
ooOo = IiI.get_profile()
Oo = os.path.join(ooOo, 'cookies')
OO0o = Net()
o0O = 'http://www.filmon.com/ajax/login'
IiiIII111iI = oOooOoO0Oo0O.getSetting('user')
IiII = oOooOoO0Oo0O.getSetting('pass')
iI1Ii11111iIi = {'password': IiII, 'email': IiiIII111iI, 'remember': 1}
i1i1II = {
    'Host': 'www.filmon.com',
    'Origin': 'http://www.filmon.com',
    'Referer': 'http://www.filmon.com/user/login',
    'X-Requested-With': 'XMLHttpRequest'
}
O0oo0OO0 = OO0o.http_POST(o0O, iI1Ii11111iIi, i1i1II)
I1i1iiI1 = os.path.join(Oo, "FilmOn.lwp")
Exemplo n.º 28
0
            'addon_id': self.addon_id,
            'local': 'true',
            'item_mode': item_mode
        })
        xbmcplugin.addDirectoryItem(handle=int(self.sys_argv[1]),
                                    url='plugin://plugin.video.favorites/' +
                                    params,
                                    isFolder=True,
                                    listitem=listitem)


if sys.argv and len(
        sys.argv) >= 4 and sys.argv[3] == 'script.module.universal.favorites':

    sys.argv[0] = 'script.module.universal'
    addon_fav = Addon('script.module.universal', sys.argv)

    addon_id = addon_fav.queries.pop('uni_fav_addon_id')
    fav_mode = addon_fav.queries.pop('uni_fav_mode')
    item_mode = addon_fav.queries.pop('uni_fav_item_mode', 'main')
    title = addon_fav.queries.pop('uni_fav_title', '')
    fmtd_title = addon_fav.queries.pop('uni_fav_fmtd_title', title)
    url = addon_fav.queries.pop('uni_fav_url', '')
    section_title = addon_fav.queries.pop('uni_fav_section_title', '')
    section_addon_title = addon_fav.queries.pop('uni_fav_section_addon_title',
                                                '')
    sub_section_title = addon_fav.queries.pop('uni_fav_sub_section_title', '')
    sub_section_addon_title = addon_fav.queries.pop(
        'uni_fav_sub_section_addon_title', '')
    img = addon_fav.queries.pop('uni_fav_img', '')
    fanart = addon_fav.queries.pop('uni_fav_fanart', '')
Exemplo n.º 29
0
from htmlentitydefs import name2codepoint as n2cp
import HTMLParser

try:
    from sqlite3 import dbapi2 as sqlite
    print "Loading sqlite3 as DB engine"
except:
    from pysqlite2 import dbapi2 as sqlite
    print "Loading pysqlite2 as DB engine"

addon_id = 'plugin.video.dfmalaystream'
plugin = xbmcaddon.Addon(id=addon_id)
#DB = os.path.join(xbmc.translatePath("special://database"), 'dfv.db')
BASE_URL = 'http://selangit.org/master'
net = Net()
addon = Addon('plugin.video.dfmalaystream', sys.argv)

###### PATHS ###########
AddonPath = addon.get_path()
IconPath = AddonPath + "/icons/"
FanartPath = AddonPath + "/icons/"

##### Queries ##########
mode = addon.queries['mode']
url = addon.queries.get('url', None)
content = addon.queries.get('content', None)
query = addon.queries.get('query', None)
startPage = addon.queries.get('startPage', None)
numOfPages = addon.queries.get('numOfPages', None)
listitem = addon.queries.get('listitem', None)
urlList = addon.queries.get('urlList', None)
Exemplo n.º 30
0
from t0mm0.common.addon import Addon

date_format = "%m/%d/%Y"
addonInfo = xbmcaddon.Addon().getAddonInfo
addon = xbmcaddon.Addon(addonInfo("id"))
addonFolder = addon.getAddonInfo('path')
definicoes = xbmcaddon.Addon().getSetting
artFolder = os.path.join(addonFolder, 'resources', 'img')
fanart = os.path.join(addonFolder, 'fanart.jpg')
skin = 'v1'
alerta = xbmcgui.Dialog().ok
select = xbmcgui.Dialog().select
simNao = xbmcgui.Dialog().yesno
mensagemprogresso = xbmcgui.DialogProgress()
teclado = xbmc.Keyboard
pastaDados = Addon(addonInfo("id")).get_profile().decode("utf-8")
headers = {
    'User-Agent':
    'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:43.0) Gecko/20100101 Firefox/43.0',
    'Accept-Charset': 'utf-8;q=0.7,*;q=0.7',
    'Content-Type': 'application/json'
}
dataHoras = datetime.now()
API = base64.urlsafe_b64decode('aHR0cDovL21wYXBpLm1sLw==')
API_SITE = base64.urlsafe_b64decode('aHR0cDovL21wYXBpLm1sL2FwaS8=')
SITE = base64.urlsafe_b64decode('aHR0cDovL21ycGlyYWN5LmdxLw==')

try:
    import ssl
    context = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
except:
Exemplo n.º 31
0
import urllib, urllib2, re, string, urlparse, sys,   os
import xbmc, xbmcgui, xbmcaddon, xbmcplugin, HTMLParser
from resources.libs import main
from t0mm0.common.addon import Addon

addon_id = 'plugin.video.movie25'
selfAddon = xbmcaddon.Addon(id=addon_id)
addon = Addon(addon_id, sys.argv)

    
art = main.art
error_logo = art+'/bigx.png'

try:
    import urllib, urllib2, re, string, urlparse, sys, os
    
    from t0mm0.common.net import Net
    from metahandler import metahandlers
    from sqlite3 import dbapi2 as database
    from universal import playbackengine, watchhistory
    import urlresolver
except Exception, e:
    addon.log_error(str(e))
    addon.show_small_popup('MashUP: tubePLUS','Failed To Import Modules', 5000, error_logo)
    addon.show_ok_dialog(['Failed To Import Modules','Please Post Logfile In MashUP Forum @','http://www.xbmchub.com'],
                          'MashUP: TV-Release')
net = Net()
BASE_URL = 'http://www.tubeplus.me/'
wh = watchhistory.WatchHistory(addon_id)

Exemplo n.º 32
0
import urllib,urllib2,re,xbmcplugin,xbmcgui,urlresolver,sys,xbmc,xbmcaddon,os,random,urlparse
from t0mm0.common.addon import Addon
from metahandler import metahandlers

addon_id = 'plugin.video.movieshd'
selfAddon = xbmcaddon.Addon(id=addon_id)
datapath= xbmc.translatePath(selfAddon.getAddonInfo('profile'))
metaget = metahandlers.MetaData(preparezip=False)
addon = Addon(addon_id, sys.argv)
fanart = xbmc.translatePath(os.path.join('special://home/addons/' + addon_id , 'fanart.jpg'))
icon = xbmc.translatePath(os.path.join('special://home/addons/' + addon_id, 'icon.png'))
artpath = xbmc.translatePath(os.path.join('special://home/addons/' + addon_id + '/resources/art/'))
metaset = selfAddon.getSetting('enable_meta')

def CATEGORIES():
        addDir2('Featured','http://movieshd.eu/movies/category/featured',1,icon,'',fanart)
        addDir2('Recently Added','http://movieshd.eu/?filtre=date&cat=0',1,icon,'',fanart)
        addDir2('Most Viewed','http://movieshd.eu/?display=tube&filtre=views',1,icon,'',fanart)
        addDir2('Bollywood','http://movieshd.eu/bollywood/',1,icon,'',fanart) 
        addDir2('Genres','url',2,icon,'',fanart)
        addDir2('Years','http://movieshd.eu/year/',5,icon,'',fanart)
        addDir2('Search','url',3,icon,'',fanart)
        addLink('[COLOR blue]Twitter[/COLOR] Feed','url',4,icon,fanart)
        xbmc.executebuiltin('Container.SetViewMode(50)')

def BOLLYWOOD():
        addDir2('Featured','url',7,icon,'',fanart)
        addDir2('Recently Added','url',7,icon,'',fanart)
        addDir2('Action','url',7,icon,'',fanart)
        addDir2('Comedy ','url',7,icon,'',fanart)
        addDir2('Romance','url',7,icon,'',fanart)
Exemplo n.º 33
0
import HTMLParser

try:
	from sqlite3 import dbapi2 as sqlite
	print "Loading sqlite3 as DB engine"
except:
	from pysqlite2 import dbapi2 as sqlite
	print "Loading pysqlite2 as DB engine"

addon_id = 'plugin.video.rlslog'
plugin = xbmcaddon.Addon(id=addon_id)

DB = os.path.join(xbmc.translatePath("special://database"), 'rlslog.db')
BASE_URL = 'http://www.rlslog.net'
net = Net()
addon = Addon('plugin.video.rlslog', sys.argv)
showAllParts = True
showPlayAll = True

if plugin.getSetting('showAllParts') == 'false':
        showAllParts = False

if plugin.getSetting('showPlayAll') == 'false':
        showPlayAll = False

##### Queries ##########
mode = addon.queries['mode']
url = addon.queries.get('url', None)
content = addon.queries.get('content', None)
query = addon.queries.get('query', None)
startPage = addon.queries.get('startPage', None)
Exemplo n.º 34
0
import urllib, urllib2, re, cookielib, urlresolver, sys, os
import xbmc, xbmcgui, xbmcaddon, xbmcplugin
from resources.libs import main
import string

#CouchTuner - by Kasik04a 2013.

from t0mm0.common.addon import Addon
from resources.universal import playbackengine, watchhistory

addon_id = 'plugin.video.couchtuner'
selfAddon = xbmcaddon.Addon(id=addon_id)
addon = Addon('plugin.video.couchtuner', sys.argv)
art = main.art
base_url = 'http://www.couchtuner.me/'
wh = watchhistory.WatchHistory('plugin.video.couchtuner')


def NewRelease(url):
    link = main.OPEN_URL(url)
    link = link.replace('\r', '').replace('\n', '').replace('\t', '').replace(
        '&nbsp;', '').replace('&#8211;', ' - ')
    match = re.compile(
        'class="tvbox">.+?<a href="([^"]*?)" title="Watch([^"]*?)Online" ><span style="background-image: url[(]([^"]*?)[)]" class.+?'
    ).findall(link)
    if match:
        dialogWait = xbmcgui.DialogProgress()
        ret = dialogWait.create('Please wait until Show list is cached.')
        totalLinks = len(match)
        loadedLinks = 0
        remaining_display = 'Episodes loaded :: [B]' + str(
Exemplo n.º 35
0
import os
import string
import sys
import re
import urlresolver
import xbmc, xbmcaddon, xbmcplugin, xbmcgui

from t0mm0.common.addon import Addon
from t0mm0.common.net import Net

from metahandler import metahandlers

addon_id='plugin.video.kamerdb'
addon = Addon(addon_id, sys.argv)
version = '1.0.0'

net = Net()

#Common Cache
import xbmcvfs
dbg = False # Set to false if you don't want debugging

#Common Cache
try:
  import StorageServer
except:
  import storageserverdummy as StorageServer
cache = StorageServer.StorageServer('plugin.video.kamerdb')

################### Global Constants #################################
Exemplo n.º 36
0
import urllib, urllib2, re, xbmcplugin, xbmcgui, sys, xbmc, xbmcaddon, os, random, urlparse, time, net
from t0mm0.common.addon import Addon
from metahandler import metahandlers
net = net.Net()
addon_id = 'plugin.video.xmovies8'
selfAddon = xbmcaddon.Addon(id=addon_id)
datapath = xbmc.translatePath(selfAddon.getAddonInfo('profile'))
metaget = metahandlers.MetaData(preparezip=False)
addon = Addon(addon_id, sys.argv)
fanart = xbmc.translatePath(
    os.path.join('special://home/addons/' + addon_id, 'fanart.jpg'))
icon = xbmc.translatePath(
    os.path.join('special://home/addons/' + addon_id, 'icon.png'))
metaset = selfAddon.getSetting('enable_meta')

def CATEGORIES():
    #addDir2('Cinema Movies','http://xmovies8.tv/cinema-movies/page/1',1,icon,'',fanart)
    addDir2('New Movies', 'http://xmovies8.tv/new/page/1', 1, icon, '', fanart)
    addDir2('HD Movies', 'http://xmovies8.tv/movie-quality/hd/page/1', 1, icon,
            '', fanart)
    addDir2('Movies By Year', 'http://xmovies8.tv/', 2, icon, '', fanart)
    addDir2('Movies By Genre', 'http://xmovies8.tv/', 4, icon, '', fanart)
    addDir2('Search', 'URL', 3, icon, '', fanart)
    xbmc.executebuiltin('Container.SetViewMode(50)')

def GETYEARS(url):
    link = open_url(url)
    link = link.replace('\n', '').replace('  ', '')
    match = re.compile('<a href="(.+?)">(.+?)</a>').findall(link)
    for url, name in match:
Exemplo n.º 37
0
cookie_path = os.path.join(datapath, 'cookies')
cookie_jar = os.path.join(cookie_path, "karaokantalive")

if os.path.exists(datapath)==False:
    os.mkdir(datapath) 
if ADDON.getSetting('sfenable') == True:
    os.makedirs(sfdownloads)
if ADDON.getSetting('visitor_ga')=='':
    from random import randint
    ADDON.setSetting('visitor_ga',str(randint(0, 0x7fffffff)))
    
K_db='http://xtyrepo.me/xunitytalk/addons/plugin.video.MikeysKaraoke/Karaoke.db'
updatetxt='http://xtyrepo.me/xunitytalk/addons/plugin.video.MikeysKaraoke/update.txt'


addon = Addon('plugin.video.MikeysKaraoke',sys.argv)
art= "%s/KaraokeArt/"%local.getAddonInfo("path")
from sqlite3 import dbapi2 as database
db_dir = os.path.join(xbmc.translatePath("special://database"), 'Karaoke.db')


def OPEN_URL(url):
    req = urllib2.Request(url)
    req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
    response = urllib2.urlopen(req)
    link=response.read()
    response.close()
    return link


def Update():
Exemplo n.º 38
0
import os
import re
import sys
import urllib
import urllib2
import HTMLParser
from t0mm0.common.net import Net
from t0mm0.common.addon import Addon

addon = Addon('plugin.video.1channel', sys.argv)
BASE_URL = addon.get_setting('domain')
if (tfalse(addon.get_setting("enableDomain"))==True) and (len(addon.get_setting("customDomain")) > 10):
	BASE_URL=addon.get_setting("customDomain")
display_name = 'PrimeWire'#'1Channel'
required_addons = []
tag = '1Ch'


def get_settings_xml():
    return False


def get_results(vid_type, title, year, imdb, tvdb, season, episode):
    if vid_type == 'movie':
        return Search('movies', title, imdb)
    elif vid_type == 'tvshow':
        return _get_tvshows(title, year, imdb, tvdb)
    elif vid_type == 'season':
        return _get_season(title, year, imdb, tvdb, season)
    elif vid_type == 'episode':
        return _get_episodes(title, year, imdb, tvdb, season, episode)
Exemplo n.º 39
0
import threading
from resources.lib.modules import client
from resources.lib.modules import control
from resources.lib.modules import cache
from resources.lib.modules import search
from resources.lib.modules import view
from resources.lib.modules import dom_parser as dom
from t0mm0.common.addon import Addon
from t0mm0.common.net import Net


addon_id = 'plugin.video.releaseBB'
plugin = xbmcaddon.Addon(id=addon_id)
DB = os.path.join(xbmc.translatePath("special://database"), 'cache.db')
net = Net()
addon = Addon('plugin.video.releaseBB', sys.argv)

reload(sys)
sys.setdefaultencoding("utf-8")

##### Queries ##########
mode = addon.queries['mode']
url = addon.queries.get('url', None)
content = addon.queries.get('content', None)
query = addon.queries.get('query', None)
startPage = addon.queries.get('startPage', None)
numOfPages = addon.queries.get('numOfPages', None)
listitem = addon.queries.get('listitem', None)
urlList = addon.queries.get('urlList', None)
section = addon.queries.get('section', None)
title = addon.queries.get('title', None)
Exemplo n.º 40
0
from teh_tools 		import *
from config 			import *


#import stream_hulu as mHulu
#from stream_hulu import *
#from stream_hulu import main as mHulu

##### /\ ##### Imports #####
### ############################################################################################################
### ############################################################################################################
### ############################################################################################################
__plugin__=ps('__plugin__'); __authors__=ps('__authors__'); __credits__=ps('__credits__'); _addon_id=ps('_addon_id'); _domain_url=ps('_domain_url'); _database_name=ps('_database_name'); _plugin_id=ps('_addon_id')
_database_file=os.path.join(xbmc.translatePath("special://database"),ps('_database_name')+'.db'); 
### 
_addon=Addon(ps('_addon_id'), sys.argv); addon=_addon; _plugin=xbmcaddon.Addon(id=ps('_addon_id')); cache=StorageServer.StorageServer(ps('_addon_id'))
### ############################################################################################################
### ############################################################################################################
### ############################################################################################################
##### Paths #####
### # ps('')
_addonPath	=xbmc.translatePath(_plugin.getAddonInfo('path'))
_artPath		=xbmc.translatePath(os.path.join(_addonPath,ps('_addon_path_art')))
_datapath 	=xbmc.translatePath(_addon.get_profile()); _artIcon		=_addon.get_icon(); _artFanart	=_addon.get_fanart()
##### /\ ##### Paths #####
##### Important Functions with some dependencies #####
def art(f,fe=ps('default_art_ext')): return xbmc.translatePath(os.path.join(_artPath,f+fe)) ### for Making path+filename+ext data for Art Images. ###
def artMF(f,fe=ps('default_art_ext')): return xbmc.translatePath(os.path.join(_addonPath,f+fe)) ### 
##### /\ ##### Important Functions with some dependencies #####
##### Settings #####
_setting={}; _setting['enableMeta']	=	_enableMeta			=tfalse(addst("enableMeta"))
Exemplo n.º 41
0
try:
    import json
except ImportError:
    import simplejson as json

try:
  import StorageServer
except:
  import storageserverdummy as StorageServer

BASE_URL = "http://www.tubetamil.com/"
MOVIE_URL = "http://tamilgun.com/categories/new-movies/"
HD_MOVIE_URL = "http://tamilgun.com/categories/hd-movies/"
net = Net()
addonId = 'plugin.video.oliyumoliyum'
addon = Addon( addonId, sys.argv )
addonPath = xbmc.translatePath( addon.get_path() )
resPath = os.path.join( addonPath, 'resources' )
tvxmlFile = os.path.join( resPath, 'livetv.xml' )
radioxmlFile = os.path.join( resPath, 'liveradio.xml' )
iconPath = os.path.join( resPath, 'images' )

cache = StorageServer.StorageServer( addonId )
cache.dbg = True

def getImgPath( icon ):
   icon = icon + '.png'
   imgPath = os.path.join( iconPath, icon )
   if os.path.exists( imgPath ):
      return imgPath
   else:
Exemplo n.º 42
0
import urllib2
import re, string
import os
from urlparse import urlparse
from t0mm0.common.addon import Addon
from t0mm0.common.net import Net
net = Net()

try:
    import json
except:
    import simplejson as json


##### XBMC  ##########
addon = Addon('plugin.video.tgun', sys.argv)
xaddon = xbmcaddon.Addon(id='plugin.video.tgun')
datapath = addon.get_profile()


##### Paths ##########
cookie_path = os.path.join(datapath, 'cookies')
cookie_jar = os.path.join(cookie_path, "cookiejar.lwp")
if os.path.exists(cookie_path) == False:
    os.makedirs(cookie_path)

##### Queries ##########
play = addon.queries.get('play', None)
mode = addon.queries['mode']
page_num = addon.queries.get('page_num', None)
url = addon.queries.get('url', None)
import urllib, urllib2, re, xbmcplugin, xbmcgui, sys, xbmc, xbmcaddon, os, random, urlparse, urlresolver
from t0mm0.common.addon import Addon
from t0mm0.common.net import Net as net
addon_id = 'plugin.video.erotik'
selfAddon = xbmcaddon.Addon(id=addon_id)
addon = Addon(addon_id, sys.argv)
fanart = xbmc.translatePath(
    os.path.join('special://home/addons/' + addon_id, 'fanart.jpg'))
icon = xbmc.translatePath(
    os.path.join('special://home/addons/' + addon_id, 'icon.PNG'))
base = 'http://www.ero-tik.com/index.html'

def CATEGORIES():
    req = urllib2.Request(base)
    req.add_header(
        'User-Agent',
        'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3'
    )
    response = urllib2.urlopen(req)
    link = response.read()
    response.close()
    addDir2('[COLOR gold]New Videos[/COLOR]', base, 1, icon, '', fanart)
    match = re.compile('<li class=""><a href="(.+?)" class="">(.+?)</a></li>'
                       ).findall(link)[:19]
    mk = 1
    for url, cat in match:
        addDir2(cat, url, 2, icon, '', fanart)

def GETMOVIES(url, name):
    req = urllib2.Request(url)
Exemplo n.º 44
0
import time
import xbmc
import net
import server
import config
import shutil
import unicodedata
import xbmc
import base64

from t0mm0.common.addon import Addon
from metahandler import metahandlers

addon_id = 'plugin.video.pld-cleaner'
selfAddon = xbmcaddon.Addon(id=addon_id)
addon = Addon(addon_id, sys.argv)
fanart = xbmc.translatePath(os.path.join('special://home/addons/' + addon_id , 'fanart.jpg'))
iconlm = xbmc.translatePath(os.path.join('special://home/addons/' + addon_id, 'iconlm.png'))
iconhdm = xbmc.translatePath(os.path.join('special://home/addons/' + addon_id, 'iconhdm.png'))
iconts = xbmc.translatePath(os.path.join('special://home/addons/' + addon_id, 'iconts.png'))
icons = xbmc.translatePath(os.path.join('special://home/addons/' + addon_id, 'icons.png'))
icon = xbmc.translatePath(os.path.join('special://home/addons/' + addon_id, 'icon.png'))
Decode = base64.decodestring

destmw1dir = xbmc.translatePath('special://home/userdata/addon_data/plugin.video.pld-cleaner/')

metaset = selfAddon.getSetting('enable_meta')

plugin_handle = int(sys.argv[1])

mysettings = xbmcaddon.Addon(id = 'plugin.video.pld-cleaner')
Exemplo n.º 45
0
class Favorites:

    local_db_name = 'favorites.db'

    def __init__(self, addon_id, sys_argv=''):

        #Check if a path has been set in the addon settings
        if common.db_path:
            self.path = xbmc.translatePath(common.db_path)
        else:
            self.path = xbmc.translatePath(common.default_path)

        self.addon_id = addon_id
        self.sys_argv = sys_argv
        self.cache_path = common.make_dir(self.path, '')
        self.addon = Addon(self.addon_id, self.sys_argv)

        self.db = os.path.join(self.cache_path, self.local_db_name)

        # connect to db at class init and use it globally
        if DB == 'mysql':

            class MySQLCursorDict(database.cursor.MySQLCursor):
                def _row_to_python(self, rowdata, desc=None):
                    row = super(MySQLCursorDict,
                                self)._row_to_python(rowdata, desc)
                    if row:
                        return dict(zip(self.column_names, row))
                    return None

            self.dbcon = database.connect(database=common.db_name,
                                          user=common.db_user,
                                          password=common.db_pass,
                                          host=common.db_address,
                                          buffered=True,
                                          charset='utf8')
            self.dbcur = self.dbcon.cursor(cursor_class=MySQLCursorDict,
                                           buffered=True)
        else:
            self.dbcon = database.connect(self.db)
            self.dbcon.row_factory = database.Row  # return results indexed by field names and not numbers so we can convert to dict
            self.dbcon.text_factory = str
            self.dbcur = self.dbcon.cursor()

        self._create_favorites_tables()

    def __del__(self):
        ''' Cleanup db when object destroyed '''
        try:
            self.dbcur.close()
            self.dbcon.close()
        except:
            pass

    def _create_favorites_tables(self):

        sql_create = "CREATE TABLE IF NOT EXISTS favorites ("\
                            "addon_id TEXT,"\
                            "section_title TEXT,"\
                            "section_addon_title TEXT,"\
                            "sub_section_title TEXT,"\
                            "sub_section_addon_title TEXT,"\
                            "hash_title TEXT,"\
                            "title TEXT,"\
                            "fmtd_title TEXT,"\
                            "url TEXT,"\
                            "infolabels TEXT,"\
                            "image_url TEXT,"\
                            "fanart_url TEXT,"\
                            "isfolder TEXT,"\
                            "isplayable TEXT,"\
                            "UNIQUE(addon_id, section_title, sub_section_title, hash_title)"\
                            ");"
        if DB == 'mysql':
            sql_create = sql_create.replace("addon_id TEXT",
                                            "addon_id VARCHAR(100)")
            sql_create = sql_create.replace("hash_title TEXT",
                                            "hash_title VARCHAR(32)")
            sql_create = sql_create.replace(",title TEXT",
                                            ",title VARCHAR(225)")
            sql_create = sql_create.replace("section_title TEXT",
                                            "section_title VARCHAR(100)")
            sql_create = sql_create.replace("sub_section_title TEXT",
                                            "sub_section_title VARCHAR(100)")
            sql_create = sql_create.replace("isfolder TEXT",
                                            "isfolder VARCHAR(5)")
            sql_create = sql_create.replace("isplayable TEXT",
                                            "isplayable VARCHAR(5)")
            self.dbcur.execute(sql_create)
            try:
                self.dbcur.execute(
                    'CREATE INDEX favindex on favorites (addon_id, section_title, sub_section_title, hash_title);'
                )
            except:
                pass
            try:
                self.dbcur.execute(
                    'CREATE INDEX favsrtindex on favorites (addon_id, title);')
            except:
                pass
        else:
            self.dbcur.execute(sql_create)
            self.dbcur.execute(
                'CREATE INDEX IF NOT EXISTS favindex on favorites (addon_id, section_title, sub_section_title, hash_title);'
            )
            self.dbcur.execute(
                'CREATE INDEX IF NOT EXISTS favsrtindex on favorites (addon_id, section_title, sub_section_title, title);'
            )

        common.addon.log(
            '-' + HELPER + '- -' + 'Table watch_history initialized', 0)

    def _is_already_in_favorites(self,
                                 addon_id,
                                 section_title,
                                 section_addon_title,
                                 sub_section_title,
                                 sub_section_addon_title,
                                 title,
                                 item_mode='main'):

        item_column_section = ''
        item_column_sub_section = ''
        val_section = ''
        val_sub_section = ''
        if item_mode == 'main':
            item_column_section = 'section_title'
            val_section = section_title
            item_column_sub_section = 'sub_section_title'
            val_sub_section = sub_section_title
        elif item_mode == 'addon':
            item_column_section = 'section_addon_title'
            val_section = section_addon_title
            item_column_sub_section = 'sub_section_addon_title'
            val_sub_section = sub_section_addon_title

        hash_title = hashlib.md5(title).hexdigest()

        row_exists = True
        try:
            sql_select = ''
            if DB == 'mysql':
                sql_select = "SELECT title FROM favorites WHERE addon_id = %s AND " + item_column_section + " = %s AND " + item_column_sub_section + " = %s AND hash_title = %s "
            else:
                sql_select = "SELECT title FROM favorites WHERE addon_id = ? AND " + item_column_section + " = ? AND " + item_column_sub_section + " = ? AND hash_title = ? "
            self.dbcur.execute(
                sql_select,
                (addon_id, val_section, val_sub_section, hash_title))
            matchedrow = self.dbcur.fetchall()[0]
        except:
            row_exists = False

        return row_exists

    def is_already_in_favorites(self,
                                section_title,
                                section_addon_title,
                                sub_section_title,
                                sub_section_addon_title,
                                title,
                                item_mode='main'):
        return self._is_already_in_favorites(self.addon_id,
                                             section_title,
                                             section_addon_title,
                                             sub_section_title,
                                             sub_section_addon_title,
                                             title,
                                             item_mode=item_mode)

    def add_item_to_db(self, title, fmtd_title, url, section_title,
                       section_addon_title, sub_section_title,
                       sub_section_addon_title, infolabels, img, fanart,
                       is_playable, is_folder):
        if url.find('&favorite=true'):
            url = url.replace('&favorite=true', '')
        elif url.find('?favorite=true&'):
            url = url.replace('?favorite=true&', '?')

        hash_title = hashlib.md5(title).hexdigest()

        sql_insert = ''
        if self.is_already_in_favorites(section_title, section_addon_title,
                                        sub_section_title,
                                        sub_section_addon_title,
                                        title) == True:
            #common.notify(self.addon_id, 'small', '', 'Item: ' + fmtd_title + ' - already exists in Favorites.', '8000')
            common.notify(self.addon_id, 'small', '[B]' + fmtd_title + '[/B]',
                          '[B]Already exists in Favorites.[/B]', '8000')
        else:
            if DB == 'mysql':
                sql_insert = "INSERT INTO favorites(addon_id, hash_title, title, fmtd_title, url, section_title, section_addon_title, sub_section_title, sub_section_addon_title, infolabels, image_url, fanart_url, isfolder, isplayable ) VALUES(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)"
            else:
                sql_insert = "INSERT INTO favorites(addon_id, hash_title, title, fmtd_title, url, section_title, section_addon_title, sub_section_title, sub_section_addon_title, infolabels, image_url, fanart_url, isfolder, isplayable ) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"

            if infolabels:
                infolabels = common.encode_dict(infolabels)

            common.addon.log(
                '-' + HELPER + '- -' +
                '%s: %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s' %
                (sql_insert, self.addon_id, hash_title, title, fmtd_title, url,
                 section_title, section_addon_title, sub_section_title,
                 sub_section_addon_title, str(infolabels), img, fanart,
                 common.bool2str(is_folder), common.bool2str(is_playable)), 2)

            try:
                self.dbcur.execute(
                    sql_insert,
                    (self.addon_id, hash_title, title, fmtd_title, url,
                     section_title, section_addon_title, sub_section_title,
                     sub_section_addon_title, str(infolabels), img, fanart,
                     common.bool2str(is_folder), common.bool2str(is_playable)))
                self.dbcon.commit()
                #common.notify(self.addon_id, 'small', '', 'Item: ' + fmtd_title + ' - added successfully to Favorites.', '8000')
                common.notify(self.addon_id, 'small',
                              '[B]' + fmtd_title + '[/B]',
                              '[B]Added to Favorites.[/B]', '8000')
            except:
                #common.notify(self.addon_id, 'small', '', 'Item: ' + fmtd_title + ' - unable to add to Favorites.', '8000')
                common.notify(self.addon_id, 'small',
                              '[B]' + fmtd_title + '[/B]',
                              '[B]Unable to add to Favorites.[/B]', '8000')
                pass

    def delete_item_from_db(self,
                            title,
                            fmtd_title,
                            section_title,
                            section_addon_title,
                            sub_section_title,
                            sub_section_addon_title,
                            item_mode='main'):

        hash_title = hashlib.md5(title).hexdigest()

        item_column_section = ''
        item_column_sub_section = ''
        if item_mode == 'main':
            item_column_section = 'section_title'
            item_column_sub_section = 'sub_section_title'
        elif item_mode == 'addon':
            item_column_section = 'section_addon_title'
            item_column_sub_section = 'sub_section_addon_title'

        sql_delete = ''
        if DB == 'mysql':
            sql_delete = "DELETE FROM favorites WHERE addon_id = %s AND " + item_column_section + " = %s AND " + item_column_sub_section + " = %s AND hash_title = %s"
        else:
            sql_delete = "DELETE FROM favorites WHERE addon_id = ? AND " + item_column_section + " = ? AND " + item_column_sub_section + " = ? AND hash_title = ?"

        common.addon.log(
            '-' + HELPER + '- -' + '%s: %s, %s, %s, %s' %
            (sql_delete, self.addon_id, section_title, sub_section_title,
             hash_title), 2)

        try:
            self.dbcur.execute(
                sql_delete,
                (self.addon_id, section_title, sub_section_title, hash_title))
            self.dbcon.commit()
            #common.notify(self.addon_id, 'small', '', 'Item: ' + fmtd_title + ' - removed successfully from Favorites.', '8000')
            common.notify(self.addon_id, 'small', '[B]' + fmtd_title + '[/B]',
                          '[B]Removed from Favorites.[/B]', '8000')
        except:
            #common.notify(self.addon_id, 'small', '', 'Item: ' + fmtd_title + ' - unable to remove from Favorites.', '8000')
            common.notify(self.addon_id, 'small', '[B]' + fmtd_title + '[/B]',
                          '[B]Unable to remove from Favorites.[/B]', '8000')
            pass

    def build_url(self, queries):
        return self.addon.build_plugin_url(queries)

    def add_item(self,
                 title,
                 url,
                 fmtd_title='',
                 section_title='Misc.',
                 section_addon_title='',
                 sub_section_title='',
                 sub_section_addon_title='',
                 infolabels='',
                 img='',
                 fanart='',
                 is_playable=False,
                 is_folder=False):

        if not fmtd_title: fmtd_title = title
        if not section_addon_title: section_addon_title = section_title
        if not sub_section_addon_title:
            sub_section_addon_title = sub_section_title

        uni_fav = {
            'uni_fav_addon_id': self.addon_id,
            'uni_fav_mode': 'add',
            'uni_fav_title': title,
            'uni_fav_fmtd_title': fmtd_title,
            'uni_fav_url': url,
            'uni_fav_section_title': section_title,
            'uni_fav_section_addon_title': section_addon_title,
            'uni_fav_sub_section_title': sub_section_title,
            'uni_fav_sub_section_addon_title': sub_section_addon_title,
            'uni_fav_img': img,
            'uni_fav_fanart': fanart,
            'uni_fav_is_playable': common.bool2str(is_playable),
            'uni_fav_is_folder': common.bool2str(is_folder)
        }

        uni_fav_add_script = 'XBMC.RunScript(%s, %s, %s, "%s")' % (
            self._get_script_path(), self.sys_argv[1],
            self._build_params(
                uni_fav, infolabels), 'script.module.universal.favorites')

        return uni_fav_add_script

    def add_video_item(self,
                       title,
                       url,
                       fmtd_title='',
                       section_title='',
                       section_addon_title='',
                       sub_section_title='',
                       sub_section_addon_title='',
                       infolabels='',
                       img='',
                       fanart='',
                       is_playable=False):
        return self.add_item(title,
                             url,
                             fmtd_title=fmtd_title,
                             section_title=section_title,
                             section_addon_title=section_addon_title,
                             sub_section_title=sub_section_title,
                             sub_section_addon_title=sub_section_addon_title,
                             infolabels=infolabels,
                             img=img,
                             fanart=fanart,
                             is_playable=is_playable)

    def add_directory(self,
                      title,
                      url,
                      fmtd_title='',
                      section_title='',
                      section_addon_title='',
                      sub_section_title='',
                      sub_section_addon_title='',
                      infolabels='',
                      img='',
                      fanart=''):
        return self.add_item(title,
                             url,
                             fmtd_title=fmtd_title,
                             section_title=section_title,
                             section_addon_title=section_addon_title,
                             sub_section_title=sub_section_title,
                             sub_section_addon_title=sub_section_addon_title,
                             infolabels=infolabels,
                             img=img,
                             fanart=fanart,
                             is_folder=True)

    def delete_item(self,
                    title,
                    fmtd_title='',
                    item_mode='main',
                    section_title='Misc.',
                    section_addon_title='',
                    sub_section_title='',
                    sub_section_addon_title=''):

        if not fmtd_title: fmtd_title = title
        if not section_addon_title: section_addon_title = section_title
        if not sub_section_addon_title:
            sub_section_addon_title = sub_section_title

        uni_fav = {
            'uni_fav_addon_id': self.addon_id,
            'uni_fav_mode': 'delete',
            'uni_fav_item_mode': item_mode,
            'uni_fav_title': title,
            'uni_fav_fmtd_title': fmtd_title,
            'uni_fav_section_title': section_title,
            'uni_fav_section_addon_title': section_addon_title,
            'uni_fav_sub_section_title': sub_section_title,
            'uni_fav_sub_section_addon_title': sub_section_addon_title
        }

        uni_fav_add_script = 'XBMC.RunScript(%s, %s, %s, "%s")' % (
            self._get_script_path(), self.sys_argv[1],
            self._build_params(uni_fav), 'script.module.universal.favorites')

        return uni_fav_add_script

    def _get_script_path(self):
        return os.path.join(common.addon.get_path(), 'lib', 'universal',
                            'favorites.py')

    def _build_params(self, uni_fav, infolabels=''):

        uni_fav_ps = '?' + common.dict_to_paramstr(uni_fav)

        if infolabels:
            uni_fav_ps = uni_fav_ps + '&' + common.dict_to_paramstr(infolabels)

        return uni_fav_ps

    def get_sub_sections(self,
                         section_title,
                         addon_id='all',
                         item_mode='main'):
        sections = []

        item_column_section = ''
        item_column_sub_section = ''
        if item_mode == 'main':
            item_column_section = 'section_title'
            item_column_sub_section = 'sub_section_title'
        elif item_mode == 'addon':
            item_column_section = 'section_addon_title'
            item_column_sub_section = 'sub_section_addon_title'

        if DB == 'mysql':
            params_var = "%s"
        else:
            params_var = "?"

        params = []

        sql_select = "SELECT DISTINCT " + item_column_sub_section + " FROM favorites"

        whereadded = False
        if addon_id != 'all':
            params.append(addon_id)
            sql_select = sql_select + ' WHERE addon_id = ' + params_var
            whereadded = True

        if whereadded == False:
            sql_select = sql_select + ' WHERE '
            whereadded = True
        else:
            sql_select = sql_select + ' AND '

        params.append(section_title)
        sql_select = sql_select + item_column_section + " = " + params_var + " AND " + item_column_sub_section + " != '' ORDER BY " + item_column_sub_section + " ASC"

        params = tuple(params)

        common.addon.log(
            '-' + HELPER + '- -' + sql_select + ":" +
            (" %s," * len(params)) % params, 2)

        self.dbcur.execute(sql_select, params)

        for matchedrow in self.dbcur.fetchall():

            match = dict(matchedrow)

            item = {'title': match[item_column_sub_section]}

            sections.append(item)

        return sections

    def get_main_sections(self, addon_id='all', item_mode='main'):
        sections = []
        item_column_section = ''
        if item_mode == 'main':
            item_column_section = 'section_title'
        elif item_mode == 'addon':
            item_column_section = 'section_addon_title'

        if DB == 'mysql':
            params_var = "%s"
        else:
            params_var = "?"

        params = []

        sql_select = "SELECT DISTINCT " + item_column_section + " FROM favorites"

        whereadded = False
        if addon_id != 'all':
            params.append(addon_id)
            sql_select = sql_select + ' WHERE addon_id = ' + params_var
            whereadded = True

        sql_select = sql_select + " ORDER BY " + item_column_section + " ASC"

        params = tuple(params)

        common.addon.log(
            '-' + HELPER + '- -' + sql_select + ":" +
            (" %s," * len(params)) % params, 2)

        self.dbcur.execute(sql_select, params)

        for matchedrow in self.dbcur.fetchall():

            match = dict(matchedrow)

            item = {'title': match[item_column_section]}

            sections.append(item)

        return sections

    def get_favorites(self,
                      section_title='all',
                      sub_section_title='all',
                      addon_id='all',
                      item_mode='main'):

        favorites = []

        item_column_section = ''
        item_column_sub_section = ''
        if item_mode == 'main':
            item_column_section = 'section_title'
            item_column_sub_section = 'sub_section_title'
        elif item_mode == 'addon':
            item_column_section = 'section_addon_title'
            item_column_sub_section = 'sub_section_addon_title'

        if DB == 'mysql':
            params_var = "%s"
        else:
            params_var = "?"

        try:
            import json
        except:
            import simplejson as json

        params = []

        sql_select = "SELECT * FROM favorites"

        whereadded = False
        if addon_id != 'all':
            params.append(addon_id)
            sql_select = sql_select + ' WHERE addon_id = ' + params_var
            whereadded = True

        if section_title != 'all':
            params.append(section_title)
            if whereadded == False:
                sql_select = sql_select + ' WHERE '
                whereadded = True
            else:
                sql_select = sql_select + ' AND '
            sql_select = sql_select + item_column_section + " = " + params_var

            if sub_section_title != 'all':
                params.append(sub_section_title)
                sql_select = sql_select + " AND " + item_column_sub_section + " = " + params_var

        sql_select = sql_select + " ORDER BY title ASC"

        params = tuple(params)

        common.addon.log(
            '-' + HELPER + '- -' + sql_select + ":" +
            (" %s," * len(params)) % params, 2)

        self.dbcur.execute(sql_select, params)

        for matchedrow in self.dbcur.fetchall():

            match = dict(matchedrow)

            infolabels = {}
            if match['infolabels']:
                infolabels = json.loads(
                    re.sub(
                        r",\s*(\w+)", r", '\1'",
                        re.sub(r"\{(\w+)",
                               r"{'\1'", match['infolabels'].replace(
                                   '\\', '\\\\'))).replace("'", '"'))
            infolabels['title'] = match['fmtd_title']

            item = {
                'addon_id': match['addon_id'],
                'section_title': match['section_title'],
                'sub_section_title': match['sub_section_title'],
                'section_addon_title': match['section_addon_title'],
                'sub_section_addon_title': match['sub_section_addon_title'],
                'title': match['title'],
                'fmtd_title': match['fmtd_title'],
                'url': match['url'],
                'infolabels': common.decode_dict(infolabels),
                'image_url': match['image_url'],
                'fanart_url': match['fanart_url'],
                'isplayable': match['isplayable'],
                'isfolder': match['isfolder']
            }

            favorites.append(item)

        return favorites

    def get_my_favorites(self,
                         section_title='all',
                         sub_section_title='all',
                         item_mode='main'):
        return self.get_favorites(section_title=section_title,
                                  sub_section_title=sub_section_title,
                                  addon_id=self.addon_id,
                                  item_mode=item_mode)

    def get_my_main_sections(self, item_mode='main'):
        return self.get_main_sections(addon_id=self.addon_id,
                                      item_mode=item_mode)

    def get_my_sub_sections(self, section_title, item_mode='main'):
        return self.get_sub_sections(section_title,
                                     addon_id=self.addon_id,
                                     item_mode=item_mode)

    def get_addons_that_have_favorites(self):

        addons = []

        sql_select = "SELECT DISTINCT addon_id FROM favorites ORDER BY addon_id"

        self.dbcur.execute(sql_select)

        for matchedrow in self.dbcur.fetchall():

            match = dict(matchedrow)

            try:
                tmp_addon_id = match['addon_id']
                tmp_addon = Addon(tmp_addon_id)
                tmp_addon_name = tmp_addon.get_name()
                tmp_addon_img = tmp_addon.get_icon()
                tmp_addon_fanart = tmp_addon.get_fanart()
            except:
                tmp_addon_name = tmp_addon_id
                tmp_addon_img = ''
                tmp_addon_fanart = ''
                pass

            tmp_addon_dtl = {
                'title': tmp_addon_name,
                'id': tmp_addon_id,
                'img': tmp_addon_img,
                'fanart': tmp_addon_fanart
            }

            addons.append(tmp_addon_dtl)

        return addons

    def add_my_fav_directory(self,
                             title='Favorites',
                             img='',
                             fanart='',
                             item_mode='main'):
        if not self.sys_argv:
            common.addon.log_error(
                '-' + HELPER + '- -' +
                'sys.argv not passed in Favorites __init__(); Favorites directory will not be created.'
            )
            return

        try:
            tmp_addon_id = 'plugin.video.favorites'
            tmp_addon = Addon(tmp_addon_id)
            tmp_addon_name = tmp_addon.get_name()
        except:
            common.addon.log_error(
                '-' + HELPER + '- -' +
                'Favorites video plugin not installed; Favorites directory will not be created.'
            )
            common.notify(
                self.addon_id, 'small', ' - My Favorites video addon required',
                'Please install My Favorites video addon from The ONE\'s XBMC Addons Repository.',
                '10000')
            return

        listitem = xbmcgui.ListItem(title, iconImage=img, thumbnailImage=img)
        listitem.setProperty('fanart_image', fanart)
        uni_fav = {
            'uni_fav_addon_id': self.addon_id,
            'uni_fav_mode': 'display',
            'uni_fav_item_mode': item_mode
        }

        params = self._build_params({
            'mode': 'browse',
            'addon_id': self.addon_id,
            'local': 'true',
            'item_mode': item_mode
        })
        xbmcplugin.addDirectoryItem(handle=int(self.sys_argv[1]),
                                    url='plugin://plugin.video.favorites/' +
                                    params,
                                    isFolder=True,
                                    listitem=listitem)
Exemplo n.º 46
0
import urlresolver
from t0mm0.common.addon import Addon
from t0mm0.common.net import Net
import HTMLParser

try:
    from sqlite3 import dbapi2 as sqlite
    print "Loading sqlite3 as DB engine"
except:
    from pysqlite2 import dbapi2 as sqlite
    print "Loading pysqlite2 as DB engine"

DB = os.path.join(xbmc.translatePath("special://database"), 'oneddl.db')
BASE_URL = 'http://www.oneddl.eu'
net = Net()
addon = Addon('plugin.video.oneddl', sys.argv)

##### Queries ##########
mode = addon.queries['mode']
url = addon.queries.get('url', None)
section = addon.queries.get('section', None)
query = addon.queries.get('query', None)
startPage = addon.queries.get('startPage', None)
numOfPages = addon.queries.get('numOfPages', None)
listitem = addon.queries.get('listitem', None)
dialog = xbmcgui.Dialog()


def GetTitles(section, url, startPage='1', numOfPages='1'):  # Get Movie Titles
    print 'oneddl get Movie Titles Menu %s' % url
Exemplo n.º 47
0
    
'''

import os    
import datetime
import sys
import xbmc
import xbmcvfs
import re

from t0mm0.common.addon import Addon

addon_identifier = 'script.module.watchhistory'
addon = None
if len(sys.argv) < 2:
    addon = Addon(addon_identifier)
else:
    addon = Addon(addon_identifier, sys.argv)
addon_path = addon.get_path()

try:
    if  addon.get_setting('use_remote_db')=='true' and   \
        addon.get_setting('db_address') is not None and  \
        addon.get_setting('db_user') is not None and     \
        addon.get_setting('db_pass') is not None and     \
        addon.get_setting('db_name') is not None:
        import mysql.connector as database
        addon.log('Loading MySQLdb as DB engine', 2)
        DB = 'mysql'
    else:
        raise ValueError('MySQL not enabled or not setup correctly')
Exemplo n.º 48
0
import urllib, urllib2, re, cookielib, urlresolver, sys, os, string
import xbmc, xbmcgui, xbmcaddon, xbmcplugin
import main
import base64
from t0mm0.common.addon import Addon
from BeautifulSoup import BeautifulSoup

### The DareTv by Kasik. (2014) ###

base_url = 'http://www.thedarewall.com/tv'
addon_id = 'plugin.video.daretv'
selfAddon = xbmcaddon.Addon(id=addon_id)
addon = Addon('plugin.video.daretv', sys.argv)
art = main.art
AZ_DIRECTORIES = (ltr for ltr in string.ascii_uppercase)


############################################################### TV SECTION  #############################################################################################################################################################
def TVIndex(url):  #################  TV Index #################
    link = main.OPEN_URL(url)
    link = link.replace('\r', '').replace('\n', '').replace('\t', '').replace(
        '&nbsp;', '').replace('\\', '')
    match = re.findall(
        'src="http://www.thedarewall.com/tv/templates/svarog/timthumb.php[?]src=([^"]*)&amp;w=[^"]*&amp;h=[^"]*&amp;zc=1" alt=" " style="[^"]*"/>            </a>                        </div>                <h5>                                <a class="link" href="([^"]*)" title="([^"]*)">[^"]*</a>                </h5><p class="left">([^"]*)</p>',
        link)
    dialogWait = xbmcgui.DialogProgress()
    ret = dialogWait.create('Please wait until Show list is cached.')
    totalLinks = len(match)
    loadedLinks = 0
    remaining_display = 'Latest Episodes Loaded :: [B]' + str(
        loadedLinks) + ' / ' + str(totalLinks) + '[/B].'
Exemplo n.º 49
0
# along with rdio-xbmc.  If not, see <http://www.gnu.org/licenses/>.

import sys
import os
import inspect
import time
import random
import urllib
import xbmcplugin
import xbmcgui
from t0mm0.common.addon import Addon
import rdiocommon


ADDON_ID = 'plugin.audio.rdio'
addon = Addon(ADDON_ID, argv=sys.argv)
sys.path.append(os.path.join(addon.get_path(), 'resources', 'lib'))

from rdioxbmc import RdioApi, RdioAuthenticationException


class XbmcRdioOperation:
  _TYPE_ALBUM = 'a'
  _TYPE_ARTIST = 'r'
  _TYPE_PLAYLIST = 'p'
  _TYPE_USER = '******'
  _TYPE_TRACK = 't'
  _TYPE_ALBUM_IN_COLLECTION = 'al'
  _TYPE_ARTIST_IN_COLLECTION = 'rl'

  _PAGE_SIZE_ALBUMS = 100
Exemplo n.º 50
0
import os
import re
import sys
import xbmc
import xbmcgui

from t0mm0.common.addon import Addon

pluginId = 'plugin.video.aob'
addon = Addon(pluginId, sys.argv)


class HelpBox:
    # constants
    WINDOW = 10147
    CONTROL_LABEL = 1
    CONTROL_TEXTBOX = 5

    def __init__(self, *args, **kwargs):
        # activate the text viewer window
        xbmc.executebuiltin("ActivateWindow(%d)" % (self.WINDOW, ))
        # get window
        self.win = xbmcgui.Window(self.WINDOW)
        # give window time to initialize
        xbmc.sleep(1000)
        self.setControls()

    def setControls(self):
        # set heading
        heading = "Release [COLOR dodgerblue][B]HUB[/B][/COLOR] v%s" % (
            addon.get_version())
Exemplo n.º 51
0
    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 os    
from t0mm0.common.addon import Addon
import xbmc
import xbmcvfs
import xbmcgui
import config

plugin_id = config.plugin_id
skin_id = config.skin_id


addon = Addon(plugin_id)
addon_path = addon.get_path()

default_path = 'special://profile/addon_data/'+plugin_id+'/'
db_path = os.path.join(xbmc.translatePath("special://database"), 'myvideolibrary')


use_remote_db = addon.get_setting('use_remote_db')
db_address = addon.get_setting('db_address')
db_port = addon.get_setting('db_port')
if db_port: db_address = '%s:%s' %(db_address,db_port)
db_user = addon.get_setting('db_user')
db_pass = addon.get_setting('db_pass')
db_name = addon.get_setting('db_name')

Exemplo n.º 52
0
import urllib, urllib2, re, xbmcplugin, xbmcgui, urlresolver, sys, xbmc, xbmcaddon, os, urlparse
from t0mm0.common.addon import Addon
from metahandler import metahandlers
addon_id = 'plugin.video.filmdictator'
selfAddon = xbmcaddon.Addon(id=addon_id)
addon = Addon(addon_id, sys.argv)
ADDON2 = xbmcaddon.Addon(id='plugin.video.filmdictator')
fanart = xbmc.translatePath(
    os.path.join('special://home/addons/' + addon_id, 'fanart.jpg'))
icon = xbmc.translatePath(
    os.path.join('special://home/addons/' + addon_id, 'icon.png'))
metaset = selfAddon.getSetting('enable_meta')

def CATEGORIES():
    addDir2('Recently Added', 'http://filmdictator.com/?filtre=date&cat=0', 1,
            icon, '', fanart)
    addDir2('Recommended Movies',
            'http://filmdictator.com/?filtre=random&cat=0', 1, icon, '',
            fanart)
    addDir2('Most Popular', 'http://filmdictator.com/?filtre=views&cat=0', 1,
            icon, '', fanart)
    addDir2('Movies By Category', 'http://filmdictator.com/categories/', 4,
            icon, '', fanart)
    addDir2('Search', 'url', 3, icon, '', fanart)
    xbmc.executebuiltin('Container.SetViewMode(50)')

def GETMOVIES(url, name):
    metaset = selfAddon.getSetting('enable_meta')
    link = open_url(url)
    match = re.compile('<a href="(.+?)" title="(.+?)">').findall(link)
Exemplo n.º 53
0
    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
import string
import sys
from t0mm0.common.addon import Addon
from t0mm0.common.net import Net
import urlresolver
import os,xbmc

addon = Addon('plugin.video.t0mm0.test', sys.argv)
net = Net()

logo = os.path.join(xbmc.translatePath(addon.get_path()), 'art','logo.jpg')

base_url = 'http://tubeplus.me'

mode = addon.queries['mode']
play = addon.queries.get('play', None)

if play:
    stream_url = urlresolver.resolve(play)
    addon.resolve_url(stream_url)

elif mode == 'resolver_settings':
    urlresolver.display_settings()
Exemplo n.º 54
0
# Credits: Daledude, WestCoast13
# Awesome efficient lightweight code.
# last modified 19 March 2011
# added support for TVDB search for show, seasons, episodes
# also searches imdb (using http://www.imdbapi.com/) for missing info in movies or tvshows

import simplejson
import urllib, re
from datetime import datetime
import time
from t0mm0.common.net import Net
from t0mm0.common.addon import Addon
net = Net()
addon = Addon('script.module.metahandler')


class TMDB(object):
    '''
    This class performs TMDB and IMDB lookups.
    
    First call is made to TMDB by either IMDB ID or Name/Year depending on what is supplied. If movie is not found
    or if there is data missing on TMDB, another call is made to IMDB to fill in the missing information.       
    '''
    def __init__(self,
                 api_key='b91e899ce561dd19695340c3b26e0a02',
                 view='json',
                 lang='en'):
        #view = yaml json xml
        self.view = view
        self.lang = lang
        self.api_key = api_key
Exemplo n.º 55
0
try:
    import json
except ImportError:
    import simplejson as json

try:
  import StorageServer
except:
  import storageserverdummy as StorageServer

BASE_URL = "http://www.flyinhd.com"
LANGS = [ 'tamil', 'hindi', 'telugu' ]

addonId = 'plugin.video.flyinhd'
addon = Addon( addonId, sys.argv )
addonPath = xbmc.translatePath( addon.get_profile() )
cookiePath = os.path.join( addonPath, 'cookies' )
cookieFile = os.path.join( cookiePath, "cookies.txt" )

net = Net()
if not os.path.exists(cookiePath):
   os.makedirs(cookiePath)
else:
   net.set_cookies( cookieFile )

cache = StorageServer.StorageServer( addonId )
cache.dbg = True
cache.dbglevel = 10

def parseMoviePage( lang ):
Exemplo n.º 56
0
import urllib, urllib2, re, cookielib, urlresolver, os, sys
import xbmc, xbmcgui, xbmcaddon, xbmcplugin
from resources.libs import main

#Mash Up - by Mash2k3 2012.

from t0mm0.common.addon import Addon
from resources.universal import playbackengine, watchhistory

addon_id = 'plugin.video.movie25'
selfAddon = xbmcaddon.Addon(id=addon_id)
addon = Addon('plugin.video.movie25', sys.argv)
art = main.art
wh = watchhistory.WatchHistory('plugin.video.movie25')


def LISTTV2(murl):
    #xbmc.executebuiltin("XBMC.Notification(Please Wait!,Collecting Source Data,7000)")
    if murl == 'movintv':
        main.addDir('Search Movie1k', 'www.movie1k.org', 132,
                    art + '/search.png')
        #urllist=main.OPENURL('http://www.movie1k.ag/category/tv-show/')+main.OPENURL('http://www.movie1k.ag/category/tv-show/page/2/')+main.OPENURL('http://www.movie1k.ag/category/tv-show/page/3/')+main.OPENURL('http://www.movie1k.ag/category/tv-show/page/4/')+main.OPENURL('http://www.movie1k.ag/category/tv-show/page/5/')
        urllist = main.batchOPENURL(
            ('http://www.movie1k.ag/category/tv-show/',
             'http://www.movie1k.ag/category/tv-show/page/2/',
             'http://www.movie1k.ag/category/tv-show/page/3/',
             'http://www.movie1k.ag/category/tv-show/page/4/',
             'http://www.movie1k.ag/category/tv-show/page/5/'))
    elif murl == 'movin':
        #urllist=main.OPENURL('http://www.movie1k.ag/category/hindi-movies/')+main.OPENURL('http://www.movie1k.ag/category/hindi-movies/page/2/')+main.OPENURL('http://www.movie1k.ag/category/hindi-movies/page/3/')+main.OPENURL('http://www.movie1k.ag/category/hindi-movies/page/4/')+main.OPENURL('http://www.movie1k.ag/category/hindi-movies/page/5/')+main.OPENURL('http://www.movie1k.ag/category/hindi-movies/page/6/')+main.OPENURL('http://www.movie1k.ag/category/hindi-movies/page/7/')
        urllist = main.batchOPENURL(
Exemplo n.º 57
0
import time

from t0mm0.common.addon import Addon
from t0mm0.common.net import Net
from tempmeta import metahandlers
from tempmeta import metacontainers
from tempmeta import metapacks

try:
	from sqlite3 import dbapi2 as sqlite
	print "Loading sqlite3 as DB engine"
except:
	from pysqlite2 import dbapi2 as sqlite
	print "Loading pysqlite2 as DB engine"

ADDON = Addon('plugin.video.1channel', sys.argv)
DB = os.path.join(xbmc.translatePath("special://database"), 'onechannelcache.db')
META_ON = ADDON.get_setting('use-meta')
AZ_DIRECTORIES = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y', 'Z']
BASE_URL = 'http://www.1channel.ch'
USER_AGENT = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3'
GENRES = ['Action', 'Adventure', 'Animation', 'Biography', 'Comedy', 
          'Crime', 'Documentary', 'Drama', 'Family', 'Fantasy', 'Game-Show', 
          'History', 'Horror', 'Japanese', 'Korean', 'Music', 'Musical', 
          'Mystery', 'Reality-TV', 'Romance', 'Sci-Fi', 'Short', 'Sport', 
          'Talk-Show', 'Thriller', 'War', 'Western', 'Zombies']

prepare_zip = False
metaget=metahandlers.MetaData(preparezip=prepare_zip)

if not os.path.isdir(ADDON.get_profile()):
Exemplo n.º 58
0
    print "Loading sqlite3 as DB engine"
except:
    from pysqlite2 import dbapi2 as sqlite
    print "Loading pysqlite2 as DB engine"

prepare_zip = False
metaget = metahandlers.MetaData(preparezip=prepare_zip)

addon_id = 'plugin.video.oneclickmoviez'
plugin = xbmcaddon.Addon(id=addon_id)

DB = os.path.join(xbmc.translatePath("special://database"),
                  'oneclickmoviez.db')
BASE_URL = 'http://oneclickmoviez.com/'
net = Net()
addon = Addon('plugin.video.oneclickmoviez', sys.argv)

hideAdult = True
autoPlay = True
enableMeta = True

if plugin.getSetting('hideAdult') == 'false':
    hideAdult = False

if plugin.getSetting('autoPlay') == 'false':
    autoPlay = False

if plugin.getSetting('enableMeta') == 'false':
    enableMeta = False

##### Queries ##########
Exemplo n.º 59
0
from htmlentitydefs import name2codepoint as n2cp
import HTMLParser

try:
        from sqlite3 import dbapi2 as sqlite
        print "Loading sqlite3 as DB engine"
except:
        from pysqlite2 import dbapi2 as sqlite
        print "Loading pysqlite2 as DB engine"

addon_id = 'plugin.video.dfmalaystream'
plugin = xbmcaddon.Addon(id=addon_id)
#DB = os.path.join(xbmc.translatePath("special://database"), 'dfv.db')
BASE_URL = 'http://malaystream.zapto.org'
net = Net()
addon = Addon('plugin.video.dfmalaystream', sys.argv)

###### PATHS ###########
AddonPath = addon.get_path()
IconPath = AddonPath + "/icons/"
FanartPath = AddonPath + "/icons/"

##### Queries ##########
mode = addon.queries['mode']
url = addon.queries.get('url', None)
content = addon.queries.get('content', None)
query = addon.queries.get('query', None)
startPage = addon.queries.get('startPage', None)
numOfPages = addon.queries.get('numOfPages', None)
listitem = addon.queries.get('listitem', None)
urlList = addon.queries.get('urlList', None)
Exemplo n.º 60
0
def utf8decode(html):
    try:
        html1 = html.decode('utf-8','ignore')
        return html1
    except:
        print "Unicode error"
        return html

common = CommonFunctions
common.plugin = "veetv"

common.dbg = True # Default
common.dbglevel = 3 # Default

addon = Addon('plugin.video.t0mm0.test', sys.argv)
net = Net()

logo = os.path.join(addon.get_path(), 'art','logo.jpg')

base_url = 'http://tubeplus.me'

mode = addon.queries['mode']
play = addon.queries.get('play', None)

if play:
    url = addon.queries.get('url', '')
    
    #add resolve url for giaitri.com
    site = addon.queries.get('site', '')
    if site.find("giaitricom")>=0: