Exemplo n.º 1
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.º 2
0
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')
except:
    try: 
        import sqlite3
        from sqlite3 import dbapi2 as database
        addon.log('Loading sqlite3 as DB engine version: %s' % database.sqlite_version, 2)
    except Exception, e:
        print e
        from pysqlite2 import dbapi2 as database
        addon.log('pysqlite2 as DB engine', 2)
    DB = 'sqlite'

def make_dir(mypath, dirname):
Exemplo n.º 3
0
elif mode == 'googlesearch':
    GoogleSearch(url)
elif mode == 'resolver':
    urlresolver.display_settings()
elif mode == 'metahandlersettings':
    import metahandler
    metahandler.display_settings()
elif mode == 'refresh_meta':
    if video_type == VideoType_Movies:
        refresh_movie(title)
    elif video_type == VideoType_TV:
        Notify('small', 'Refresh TV Show', 'Feature not yet implemented','')
    elif video_type == VideoType_Season:
        season_refresh(title, imdb_id, season)
    elif video_type == VideoType_Episode:
        episode_refresh(title, imdb_id, season, episode)
elif mode == 'watch_mark':  
    if not metaget:
        metaget=metahandlers.MetaData()
    addon.log(video_type + ',' + title + ',' + imdb_id + ',' + season + ',' + episode)
    metaget.change_watched(video_type, title, imdb_id, season=season, episode=episode)
        
    xbmc.executebuiltin("Container.Refresh")
elif mode == 'universalsettings':    
    from universal import _common
    _common.addon.show_settings()

if not play and mode != 'resolver' and mode != 'metahandlersettings' and mode != 'universalsettings':
    addon.end_of_directory()
    search_url = ''
Exemplo n.º 4
0
from metahandler import metahandlers

addon = Addon('plugin.video.1channel', sys.argv)
try:
    DB_NAME = addon.get_setting('db_name')
    DB_USER = addon.get_setting('db_user')
    DB_PASS = addon.get_setting('db_pass')
    DB_ADDRESS = addon.get_setting('db_address')

    if  addon.get_setting('use_remote_db')=='true' and \
     DB_ADDRESS is not None and \
     DB_USER    is not None and \
     DB_PASS    is not None and \
     DB_NAME    is not None:
        import mysql.connector as database
        addon.log('Loading MySQL as DB engine')
        DB = 'mysql'
    else:
        addon.log('MySQL not enabled or not setup correctly')
        raise ValueError('MySQL not enabled or not setup correctly')
except:
    try:
        from sqlite3 import dbapi2 as database
        addon.log('Loading sqlite3 as DB engine')
    except:
        from pysqlite2 import dbapi2 as database
        addon.log('pysqlite2 as DB engine')
    DB = 'sqlite'
    db_dir = os.path.join(xbmc.translatePath("special://database"),
                          'onechannelcache.db')
Exemplo n.º 5
0
import time
import xbmc
import xbmcgui
from t0mm0.common.addon import Addon

SLEEP_MILLIS = 250
addon = Addon('script.module.playbackengine', sys.argv)
PROFILE_PATH = addon.get_profile()
DB_PATH = os.path.join(PROFILE_PATH, 'playbackengine.db')

if not os.path.isdir(PROFILE_PATH):
    os.makedirs(PROFILE_PATH)

try:
    from sqlite3 import dbapi2 as sqlite
    addon.log('Loading sqlite3 as DB engine')
except:
    from pysqlite2 import dbapi2 as sqlite
    addon.log('Loading pysqlite2 as DB engine')

def format_time(seconds):
    minutes,seconds = divmod(seconds, 60)
    if minutes > 60:
        hours,minutes = divmod(minutes, 60)
        return "%02d:%02d:%02d" % (hours, minutes, seconds)
    else:
        return "%02d:%02d" % (minutes, seconds)
        
class Player(xbmc.Player):
    '''
    This class provides a wrapper around the xbmc.Player object that allows for bookmarking capability.
Exemplo n.º 6
0
try:
    DB_NAME = addon.get_setting("db_name")
    DB_USER = addon.get_setting("db_user")
    DB_PASS = addon.get_setting("db_pass")
    DB_ADDRESS = addon.get_setting("db_address")

    if (
        addon.get_setting("use_remote_db") == "true"
        and DB_ADDRESS is not None
        and DB_USER is not None
        and DB_PASS is not None
        and DB_NAME is not None
    ):
        import mysql.connector as database

        addon.log("Loading MySQL as DB engine")
        DB = "mysql"
    else:
        addon.log("MySQL not enabled or not setup correctly")
        raise ValueError("MySQL not enabled or not setup correctly")
except:
    try:
        from sqlite3 import dbapi2 as database

        addon.log("Loading sqlite3 as DB engine")
    except:
        from pysqlite2 import dbapi2 as database

        addon.log("pysqlite2 as DB engine")
    DB = "sqlite"
    db_dir = os.path.join(xbmc.translatePath("special://database"), "onechannelcache.db")
addon_path = addon.get_path()
sys.path.append((os.path.split(addon_path))[0])

'''
   Use MySQL settings if applicable, else:
       Use SQLIte3 wherever possible, needed for newer versions of XBMC
       Keep pysqlite2 for legacy support
'''
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('Metacontainers - Loading MySQLdb as DB engine', 2)
		DB = 'mysql'
	else:
		raise ValueError('MySQL not enabled or not setup correctly')
except:
	try: 
		from sqlite3 import dbapi2 as database
		addon.log('Metacontainers - Loading sqlite3 as DB engine', 2)
	except: 
		from pysqlite2 import dbapi2 as database
		addon.log('Metacontainers - pysqlite2 as DB engine', 2)
	DB = 'sqlite'

class MetaContainer:

	def __init__(self, path='special://profile/addon_data/script.module.metahandler'):
Exemplo n.º 8
0
        Returns:
            DICT of meta data found on TMDB
            Returns None when not found or error requesting page
        '''      
        url = "%s/%s?language=%s&api_key=%s&%s" % (self.url_prefix, method, self.lang, self.api_key, values)
        addon.log('Requesting TMDB : %s' % url, 0)
        try:
            meta = simplejson.loads(net.http_GET(url,{"Accept":"application/json"}).content)
        except Exception, e:
            addon.log("Error connecting to TMDB: %s " % e, 4)
            return None

        if meta == 'Nothing found.':
            return None
        else:
            addon.log('TMDB Meta: %s' % meta, 0)
            return meta


    def _convert_date(self, string, in_format, out_format):
        ''' Helper method to convert a string date to a given format '''
        strptime = lambda date_string, format: datetime(*(time.strptime(date_string, format)[0:6]))
        try:
            a = strptime(string, in_format).strftime(out_format)
        except Exception, e:
            addon.log('************* Error Date conversion failed: %s' % e, 4)
            return None
        return a
        
        
    def _upd_key(self, meta, key):
Exemplo n.º 9
0
        url = "%s/%s?language=%s&api_key=%s&%s" % (
            self.url_prefix, method, self.lang, self.api_key, values)
        addon.log('Requesting TMDB : %s' % url, 0)
        try:
            meta = simplejson.loads(
                net.http_GET(url, {
                    "Accept": "application/json"
                }).content)
        except Exception, e:
            addon.log("Error connecting to TMDB: %s " % e, 4)
            return None

        if meta == 'Nothing found.':
            return None
        else:
            addon.log('TMDB Meta: %s' % meta, 0)
            return meta

    def _convert_date(self, string, in_format, out_format):
        ''' Helper method to convert a string date to a given format '''
        strptime = lambda date_string, format: datetime(*(time.strptime(
            date_string, format)[0:6]))
        try:
            a = strptime(string, in_format).strftime(out_format)
        except Exception, e:
            addon.log('************* Error Date conversion failed: %s' % e, 4)
            return None
        return a

    def _upd_key(self, meta, key):
        ''' Helper method to check if a key exists and if it has valid data, returns True if key needs to be udpated with valid data '''
Exemplo n.º 10
0
_1CH = Addon('plugin.video.1channel', sys.argv)

try:
    DB_NAME = _1CH.get_setting('db_name')
    DB_USER = _1CH.get_setting('db_user')
    DB_PASS = _1CH.get_setting('db_pass')
    DB_ADDR = _1CH.get_setting('db_address')

    if _1CH.get_setting('use_remote_db') == 'true' and \
                    DB_ADDR is not None and \
                    DB_USER is not None and \
                    DB_PASS is not None and \
                    DB_NAME is not None:
        import mysql.connector as orm

        _1CH.log('Loading MySQL as DB engine')
        DB = 'mysql'
    else:
        _1CH.log('MySQL not enabled or not setup correctly')
        raise ValueError('MySQL not enabled or not setup correctly')
except:
    try:
        from sqlite3 import dbapi2 as orm

        _1CH.log('Loading sqlite3 as DB engine')
    except:
        from pysqlite2 import dbapi2 as orm

        _1CH.log('pysqlite2 as DB engine')
    DB = 'sqlite'
    __translated__ = xbmc.translatePath("special://database")
Exemplo n.º 11
0
            xbmcplugin.addDirectoryItem(int(sys.argv[1]), result['li_url'] , listitem,
                                        isFolder=False)
    xbmcplugin.endOfDirectory(int(sys.argv[1]))

waldo_mode     = addon.queries.get('waldo_mode',    '')
waldo_mod    = addon.queries.get('waldo_mod',   '')
waldo_path    = addon.queries.get('waldo_path',   '')
name     = addon.queries.get('name',    '')
vid_type     = addon.queries.get('vid_type',    '')
title    = addon.queries.get('title',   '')
year     = addon.queries.get('year',    '')
imdb     = addon.queries.get('imdb',    '')
tvdb     = addon.queries.get('tvdb',    '')
season   = addon.queries.get('season',  '')
episode  = addon.queries.get('episode', '')
function = addon.queries.get('function', 'callback')
kwargs   = addon.queries.get('kwargs',  '{}')
receiver = addon.queries.get('receiver','')

addon.log(addon.queries)
if not 'waldo_mode' in addon.queries:
    listIndexes()
elif waldo_mode=='ListIndexBrowsingOptions':
    ListIndexBrowsingOptions(waldo_mod, waldo_path)
elif waldo_mode=='GetAllResults':
    GetAllResults(vid_type,title,year,imdb,tvdb,season,episode)
elif waldo_mode=='ActivateCallback':
    ActivateCallback(function,kwargs, waldo_mod, waldo_path)
elif waldo_mode=='CallModule':
    receiver = import_module(receiver, fromlist=[INDEXES_PATH,PROVIDERS_PATH, waldo_path])
    receiver.callback(addon.queries)