예제 #1
0
파일: utils.py 프로젝트: djbijo/salts
import xbmcvfs
import log_utils
import sys
import hashlib
import urlparse
import shutil
import urllib
from constants import *
from scrapers import *  # import all scrapers into this namespace
from addon.common.addon import Addon
from trakt_api import Trakt_API
from db_utils import DB_Connection

ADDON = Addon('plugin.video.salts')
ICON_PATH = os.path.join(ADDON.get_path(), 'icon.png')
SORT_FIELDS = [(SORT_LIST[int(ADDON.get_setting('sort1_field'))], SORT_SIGNS[ADDON.get_setting('sort1_order')]),
                (SORT_LIST[int(ADDON.get_setting('sort2_field'))], SORT_SIGNS[ADDON.get_setting('sort2_order')]),
                (SORT_LIST[int(ADDON.get_setting('sort3_field'))], SORT_SIGNS[ADDON.get_setting('sort3_order')]),
                (SORT_LIST[int(ADDON.get_setting('sort4_field'))], SORT_SIGNS[ADDON.get_setting('sort4_order')]),
                (SORT_LIST[int(ADDON.get_setting('sort5_field'))], SORT_SIGNS[ADDON.get_setting('sort5_order')])]

username = ADDON.get_setting('username')
password = ADDON.get_setting('password')
token = ADDON.get_setting('trakt_token')
use_https = ADDON.get_setting('use_https') == 'true'
trakt_timeout = int(ADDON.get_setting('trakt_timeout'))
list_size = int(ADDON.get_setting('list_size'))
last_check = datetime.datetime.fromtimestamp(0)

P_MODE = int(ADDON.get_setting('parallel_mode'))
if P_MODE == P_MODES.THREADS:
예제 #2
0
    os.makedirs(os.path.dirname(cookie_jar))
except OSError:
    pass

baseUrl = 'http://m.afdah.org'
url = addon.queries.get('url', '')
name = addon.queries.get('name', '')
year = addon.queries.get('year', '')
mode = addon.queries.get('mode', '')
img = addon.queries.get('img', '')
fanart = addon.queries.get('fanart', '')
imdb = addon.queries.get('imdb', '')
infol = addon.queries.get('infol', '')
cookie = addon.queries.get('cookie', '')

auto_play = addon.get_setting('autoplay')
def_quality = addon.get_setting('default_quality')

User_Agent = 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.89 Safari/537.36'

menu = [
    ('content', baseUrl, 'Movies'),
    ('content', baseUrl + '/most_viewed', 'Most Viewed'),
    ('content', baseUrl + '/recent_movies', 'Recent Movies'),
    ('year', baseUrl, 'By Year'),
    ('year', baseUrl, 'By Genre'),
    ('settings', baseUrl, ' Settings'),
]


def MAIN(menu):
예제 #3
0
            }, {'title': link[0]},
            img=img,
            fanart=fanart)
    addon.end_of_directory()

elif mode[0] == 'get_sport_event':
    url = args['url'][0]
    title = args['title'][0]
    site = args['site'][0]
    img = args['img'][0]
    exec "from resources.lib.sources.live_sport import %s" % site
    info = eval(site + ".info()")
    source = eval(site + ".main()")
    events = source.links(url)

    autoplay = addon.get_setting('autoplay')
    if autoplay == 'false':
        for event in events:
            browser = 'plugin://plugin.program.chrome.launcher/?url=%s&mode=showSite&stopPlayback=no' % (
                event[0])
            context = [('Open in browser', 'RunPlugin(%s)' % browser)]
            addon.add_video_item(
                {
                    'mode': 'play_special_sport',
                    'url': event[0],
                    'title': title,
                    'img': img,
                    'site': site
                }, {'title': event[1]},
                img=img,
                fanart=fanart,
예제 #4
0
SearchAll = 'all'

VideoType_Movies = 'movie'
VideoType_TV = 'tvshow'
VideoType_Season = 'season'
VideoType_Episode = 'episode'

#################### Addon Settings ##################################


#Helper function to convert strings to boolean values
def str2bool(v):
    return v.lower() in ("yes", "true", "t", "1")


meta_setting = str2bool(addon.get_setting('use-meta'))

######################################################################


def icon_path(filename):
    return IconPath + filename


def get_html(page_url):

    html = net.http_GET(page_url).content

    import HTMLParser
    h = HTMLParser.HTMLParser()
    html = h.unescape(html)
예제 #5
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 datetime
import xbmcgui
import xbmc
from utils import i18n
from pw_scraper import PW_Scraper
from addon.common.addon import Addon
import utils

_1CH = Addon('plugin.video.1channel')
pw_scraper = PW_Scraper(_1CH.get_setting("username"), _1CH.get_setting("passwd"))

def get_adv_search_query(section):
    if section == 'tv':
        header_text = i18n('adv_tv_search')
    else:
        header_text = i18n('adv_movie_search')
    SEARCH_BUTTON = 200
    CANCEL_BUTTON = 201
    HEADER_LABEL = 100
    ACTION_PREVIOUS_MENU = 10
    ACTION_BACK = 92
    CENTER_Y = 6
    CENTER_X = 2
    now = datetime.datetime.now()
    # allowed values have to be list of strings
예제 #6
0
    addon.end_of_directory()




elif mode[0]=='get_sport_event':
    url = args['url'][0]
    title = args['title'][0]
    site = args['site'][0]
    img = args['img'][0]
    exec "from resources.lib.sources.live_sport import %s"%site
    info = eval(site+".info()")
    source = eval(site+".main()")
    events = source.links(url)

    autoplay = addon.get_setting('autoplay')
    if autoplay == 'false':
        for event in events:
            browser = 'plugin://plugin.program.chrome.launcher/?url=%s&mode=showSite&stopPlayback=no'%(event[0])
            context = [('Open in browser','RunPlugin(%s)'%browser)]
            addon.add_video_item({'mode': 'play_special_sport', 'url': event[0],'title':title, 'img': img,'site':site}, {'title': event[1]}, img=img, fanart=fanart, contextmenu_items=context)
        addon.end_of_directory()
    else:
        for event in events:
            import liveresolver
            try:
                resolved = liveresolver.resolve(event[0])
            except:
                resolved = None
            if resolved:
                player=xbmc.Player()
예제 #7
0
    xbmcgui.Dialog().ok("Total TV Import Failure", "Failed to import addon.common", "A component needed by Total TV is missing on your system", "Please visit www.tvaddons.ag for support")
###########################################################################################################################################################
###########################################################################################################################################################
###########################################################################################################################################################
my_addon = xbmcaddon.Addon()
params=urlparse.parse_qs(sys.argv[2][1:])
addonID=xbmcaddon.Addon().getAddonInfo("id")
db_dir = xbmc.translatePath("special://profile/addon_data/"+addonID)
db_path = os.path.join(db_dir, 'favourites.db')
if not os.path.exists(db_dir):
    os.makedirs(db_dir)
db=sqlite3.connect(db_path)
addon = Addon('plugin.video.totaltv', sys.argv)
AddonPath = addon.get_path()
IconPath = AddonPath + "/resources/icons/new/"
downloadPath = addon.get_setting('download_folder')
def icon_path(filename):
    return IconPath + filename
###########################################################################################################################################################
###########################################################################################################################################################
###########################################################################################################################################################
def setView(content, viewType):
	if content:
		xbmcplugin.setContent(int(sys.argv[1]), content)
def get_links(url):
    domain='http://www.watchfree.to'
    my_addon = xbmcaddon.Addon()

    html=read_url(url)
    soup=bs(html)
    links=re.compile('<a href="(.+?)" rel="nofollow" title=".+?" target="_blank">').findall(html)
예제 #8
0
print '--- Mode: ' + str(mode)
print '--- Play: ' + str(play)
print '--- URL: ' + str(url)
print '--- Video Type: ' + str(video_type)
print '--- Section: ' + str(section)
print '--- Title: ' + str(title)
print '--- Name: ' + str(name)
print '--- IMDB: ' + str(imdb_id)
print '--- Season: ' + str(season)
print '--- Episode: ' + str(episode)
print '---------------------------------------------------------------'

################### Global Constants #################################

#URLS
website_url = addon.get_setting('website_url')
if website_url == "Custom URL":
    custom_url = addon.get_setting('custom_url')
    if custom_url.endswith("/"):
        MainUrl = custom_url
    else:
        MainUrl = custom_url + "/"
else:
    MainUrl = website_url

SearchUrl = MainUrl + 'search/?q=%s&md=%s'
MovieUrl = MainUrl + "movies/"
TVUrl = MainUrl + "internet/"

#PATHS
AddonPath = addon.get_path()
예제 #9
0
                 os.path.mkdir(os.path.dirname(final_path))
         except Exception, e:
             try:
                 _addon.log('Failed to create directory %s' % final_path)
             except:
                 pass
             # if not xbmcvfs.exists(final_path):
             #temp disabled bc of change in .strm format. Reenable in next version
     try:
         file_desc = xbmcvfs.File(final_path, 'w')
         file_desc.write(strm_string)
         file_desc.close()
     except Exception, e:
         _addon.log('Failed to create .strm file: %s\n%s' % (final_path, e))
 elif video_type == 'movie':
     save_path = _addon.get_setting('movie-folder')
     save_path = xbmc.translatePath(save_path)
     strm_string = _addon.build_plugin_url({
         'mode': 'DocSubMenu',
         'dialog': '1',
         'movie_num': movie_num
     })
     if year: title = '%s (%s)' % (title, year)
     filename = filename_from_title(title, 'movie')
     title = re.sub(r'[^\w\-_\. ]', '_', title)
     final_path = os.path.join(save_path, title, filename)
     final_path = xbmc.makeLegalFilename(final_path)
     if not xbmcvfs.exists(os.path.dirname(final_path)):
         try:
             try:
                 xbmcvfs.mkdirs(os.path.dirname(final_path))
예제 #10
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 sys
import xbmcgui
import time
import xbmc
import os
import utils
from trans_utils import i18n
from trakt_api import Trakt_API
from addon.common.addon import Addon

_SALTS = Addon('plugin.video.salts', sys.argv)
ICON_PATH = os.path.join(_SALTS.get_path(), 'icon.png')
use_https = _SALTS.get_setting('use_https') == 'true'
trakt_timeout = int(_SALTS.get_setting('trakt_timeout'))


def get_pin():
    AUTH_BUTTON = 200
    LATER_BUTTON = 201
    NEVER_BUTTON = 202
    ACTION_PREVIOUS_MENU = 10
    ACTION_BACK = 92
    CENTER_Y = 6
    CENTER_X = 2

    class PinAuthDialog(xbmcgui.WindowXMLDialog):
        auth = False
예제 #11
0
파일: srt_scraper.py 프로젝트: djbijo/salts
import log_utils
from constants import VIDEO_TYPES
from constants import SRT_SOURCE
from addon.common.addon import Addon
from db_utils import DB_Connection

_SALTS = Addon('plugin.video.salts')
ADDON_PATH = _SALTS.get_path()
ICON_PATH = os.path.join(ADDON_PATH, 'icon.png')
MAX_RETRIES = 2
TEMP_ERRORS = [500, 502, 503, 504]
USER_AGENT = ("User-Agent:Mozilla/5.0 (Windows NT 6.2; WOW64)"
              "AppleWebKit/537.17 (KHTML, like Gecko)"
              "Chrome/24.0.1312.56")
BASE_URL = 'http://www.addic7ed.com'
BASE_PATH = _SALTS.get_setting('subtitle-folder')
db_connection = DB_Connection()

class SRT_Scraper():
    def __init__(self):
        pass

    def get_tvshow_id(self, title, year=None):
        match_title = title.lower()
        rows = db_connection.get_related_url(VIDEO_TYPES.TVSHOW, title, year, SRT_SOURCE)
        if rows:
            tvshow_id = rows[0][0]
            log_utils.log('Returning local tvshow id: |%s|%s|%s|' % (title, year, tvshow_id), xbmc.LOGDEBUG)
            return tvshow_id

        html = self.__get_cached_url(BASE_URL, 24)
예제 #12
0
파일: utils.py 프로젝트: MrGHLover/1Channel
import os
import re
import sys
import xbmc
import xbmcgui
import xbmcplugin

# from functools import wraps

from addon.common.addon import Addon

_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')
예제 #13
0
SearchTV = 'shows'
SearchAll = 'all'

VideoType_Movies = 'movie'
VideoType_TV = 'tvshow'
VideoType_Season = 'season'
VideoType_Episode = 'episode'


#################### Addon Settings ##################################

#Helper function to convert strings to boolean values
def str2bool(v):
  return v.lower() in ("yes", "true", "t", "1")
  
meta_setting = str2bool(addon.get_setting('use-meta'))

######################################################################

def icon_path(filename):
    return IconPath + filename
    
def get_html(page_url):
    
    html = net.http_GET(page_url).content
    
    import HTMLParser
    h = HTMLParser.HTMLParser()
    html = h.unescape(html)
    return html.encode('utf-8')
    
예제 #14
0
print '--- Mode: ' + str(mode)
print '--- Play: ' + str(play)
print '--- URL: ' + str(url)
print '--- Video Type: ' + str(video_type)
print '--- Section: ' + str(section)
print '--- Title: ' + str(title)
print '--- Name: ' + str(name)
print '--- IMDB: ' + str(imdb_id)
print '--- Season: ' + str(season)
print '--- Episode: ' + str(episode)
print '---------------------------------------------------------------'

################### Global Constants #################################

#URLS
website_url = addon.get_setting('website_url')
if website_url == "Custom URL":
    custom_url = addon.get_setting('custom_url')
    if custom_url.endswith("/"):
        MainUrl = custom_url
    else:
        MainUrl = custom_url + "/"
else:
    MainUrl = website_url

SearchUrl = MainUrl + 'search/?q=%s&md=%s'
MovieUrl = MainUrl + "movies/"
TVUrl = MainUrl + "internet/"

#PATHS
AddonPath = addon.get_path()
예제 #15
0
파일: default.py 프로젝트: bialagary/mw
                                url=url,
                                listitem=li,
                                isFolder=True)

    url = build_url({'mode': 'live_games'})
    li = xbmcgui.ListItem('Live Games ([COLOR orange]BETA[/COLOR])',
                          iconImage=icon_path('nba_games.jpg'))
    li.setArt({'fanart': '%s' % fanartt})
    xbmcplugin.addDirectoryItem(handle=addon_handle,
                                url=url,
                                listitem=li,
                                isFolder=True)

    for i in range(20):
        try:
            if (addon.get_setting('enable_favourite') != 'false'):
                team_list = get_teams()
                ind = int(addon.get_setting('favourite_team'))
                fav = team_list[ind][1]
                game, np = get_games(fav)
                game = game[0]

                title = game[0].encode('ascii', 'ignore')

                url = build_url({
                    'mode': 'game',
                    'foldername': '%s' % title,
                    'link': '%s' % game[1],
                    'img': '%s' % (game[2])
                })
                li = xbmcgui.ListItem('%s' % game[0], iconImage='%s' % game[2])
예제 #16
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 datetime
import xbmcgui
import xbmc
from utils import i18n
from pw_scraper import PW_Scraper
from addon.common.addon import Addon
import utils

_1CH = Addon('plugin.video.1channel')
pw_scraper = PW_Scraper(_1CH.get_setting("username"),
                        _1CH.get_setting("passwd"))


def get_adv_search_query(section):
    if section == 'tv':
        header_text = i18n('adv_tv_search')
    else:
        header_text = i18n('adv_movie_search')
    SEARCH_BUTTON = 200
    CANCEL_BUTTON = 201
    HEADER_LABEL = 100
    ACTION_PREVIOUS_MENU = 10
    ACTION_BACK = 92
    CENTER_Y = 6
    CENTER_X = 2
예제 #17
0
     final_path = xbmc.makeLegalFilename(final_path)
     if not xbmcvfs.exists(os.path.dirname(final_path)):
         try:
             try: xbmcvfs.mkdirs(os.path.dirname(final_path))
             except: os.path.mkdir(os.path.dirname(final_path))
         except Exception, e:
             try: IW_addon.log('Failed to create directory %s' % final_path)
             except: pass
     try:
         file_desc = xbmcvfs.File(final_path, 'w')
         file_desc.write(strm_string)
         file_desc.close()
     except Exception, e:
         IW_addon.log('Failed to create .strm file: %s\n%s' % (final_path, e))
 elif video_type == 'movie':
     save_path = IW_addon.get_setting('movie-folder')
     save_path = xbmc.translatePath(save_path)
     strm_string = IW_addon.build_plugin_url(
         {'mode': 'DocSubMenu','dialog': '1', 'movie_num': movie_num})
     if year: title = '%s (%s)' % (title, year)
     filename = filename_from_title(title, 'movie')
     title = re.sub(r'[^\w\-_\. ]', '_', title)
     final_path = os.path.join(save_path, title, filename)
     final_path = xbmc.makeLegalFilename(final_path)
     if not xbmcvfs.exists(os.path.dirname(final_path)):
         try:
             try: xbmcvfs.mkdirs(os.path.dirname(final_path))
             except: os.path.mkdir(os.path.dirname(final_path))
         except Exception, e:
             try: IW_addon.log('Failed to create directory %s' % final_path)
             except: pass
예제 #18
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 sys
import xbmcgui
import time
import xbmc
import os
import utils
from trans_utils import i18n
from trakt_api import Trakt_API
from addon.common.addon import Addon

_SALTS = Addon('plugin.video.salts', sys.argv)
ICON_PATH = os.path.join(_SALTS.get_path(), 'icon.png')
use_https = _SALTS.get_setting('use_https') == 'true'
trakt_timeout = int(_SALTS.get_setting('trakt_timeout'))

def get_pin():
    AUTH_BUTTON = 200
    LATER_BUTTON = 201
    NEVER_BUTTON = 202
    ACTION_PREVIOUS_MENU = 10
    ACTION_BACK = 92
    CENTER_Y = 6
    CENTER_X = 2
    
    class PinAuthDialog(xbmcgui.WindowXMLDialog):
        auth = False
        
        def onInit(self):
예제 #19
0
import xbmcvfs
import log_utils
import sys
import hashlib
import urlparse
import shutil
import urllib
from constants import *
from scrapers import *  # import all scrapers into this namespace
from addon.common.addon import Addon
from trakt_api import Trakt_API
from db_utils import DB_Connection

ADDON = Addon('plugin.video.salts')
ICON_PATH = os.path.join(ADDON.get_path(), 'icon.png')
SORT_FIELDS = [(SORT_LIST[int(ADDON.get_setting('sort1_field'))],
                SORT_SIGNS[ADDON.get_setting('sort1_order')]),
               (SORT_LIST[int(ADDON.get_setting('sort2_field'))],
                SORT_SIGNS[ADDON.get_setting('sort2_order')]),
               (SORT_LIST[int(ADDON.get_setting('sort3_field'))],
                SORT_SIGNS[ADDON.get_setting('sort3_order')]),
               (SORT_LIST[int(ADDON.get_setting('sort4_field'))],
                SORT_SIGNS[ADDON.get_setting('sort4_order')]),
               (SORT_LIST[int(ADDON.get_setting('sort5_field'))],
                SORT_SIGNS[ADDON.get_setting('sort5_order')])]

username = ADDON.get_setting('username')
password = ADDON.get_setting('password')
token = ADDON.get_setting('trakt_token')
use_https = ADDON.get_setting('use_https') == 'true'
trakt_timeout = int(ADDON.get_setting('trakt_timeout'))
예제 #20
0
파일: default.py 프로젝트: jas0npc/kodi
    os.makedirs(os.path.dirname(cookie_jar))
except OSError:
    pass

baseUrl = 'http://m.afdah.org'
url = addon.queries.get('url', '')
name = addon.queries.get('name', '')
year = addon.queries.get('year', '')
mode = addon.queries.get('mode', '')
img = addon.queries.get('img', '')
fanart = addon.queries.get('fanart', '')
imdb = addon.queries.get('imdb', '')
infol = addon.queries.get('infol', '')
cookie = addon.queries.get('cookie', '')

auto_play = addon.get_setting('autoplay')
def_quality = addon.get_setting('default_quality')

User_Agent = 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.89 Safari/537.36'



menu = [
    ( 'content', baseUrl, 'Movies'),
    ( 'content', baseUrl+'/most_viewed', 'Most Viewed'),
    ( 'content', baseUrl+'/recent_movies', 'Recent Movies'),
    ( 'year', baseUrl, 'By Year'),
    ( 'year', baseUrl, 'By Genre'),
    ( 'search', baseUrl, '[COLOR blue][B]SEARCH[/B][/COLOR]'),
    ( 'settings', baseUrl, ' Settings'),
    ]
예제 #21
0
        )
    addon.end_of_directory()


elif mode[0] == "get_sport_event":

    url = args["url"][0]
    title = args["title"][0]
    site = args["site"][0]
    img = args["img"][0]
    exec "from resources.lib.sources.live_sport import %s" % site
    info = eval(site + ".info()")
    source = eval(site + ".main()")
    events = source.links(url)

    autoplay = addon.get_setting("autoplay")
    if autoplay == "false":
        for event in events:
            browser = "plugin://plugin.program.chrome.launcher/?url=%s&mode=showSite&stopPlayback=no" % (event[0])
            context = [("Open in browser", "RunPlugin(%s)" % browser)]
            addon.add_video_item(
                {"mode": "play_special_sport", "url": event[0], "title": title, "img": img, "site": site},
                {"title": event[1]},
                img=img,
                fanart=fanart,
                contextmenu_items=context,
            )
        addon.end_of_directory()
    else:
        for event in events:
            import liveresolver
예제 #22
0
#### Constants & initialization
buggalo.SUBMIT_URL = 'http://buggalo.tvaddons.ag/submit.php'                    # Official XBMC error report generator
ADDON_NAME = 'plugin.video.XBMCKaraoke'                                         # Addon namespace
__addon__ = xbmcaddon.Addon(ADDON_NAME)                                         # Initializing addon properties
__t0mm0addon__ = Addon(ADDON_NAME, sys.argv)                                    # Initializing addon properties
__language__ = __addon__.getLocalizedString


__addonname__   = __addon__.getAddonInfo('name')                                # Humanly readable addon name
PATH = xbmc.translatePath(__addon__.getAddonInfo('path')).decode('utf-8')       # Path where the addon resides (needs absolute paths)
TEMP_DL_DIR =  'tempdl'                                                         # Temp download directory. No write permissions in special://temp so using folder inside the addon
jsonurl = 'http://api.xbmckaraoke.com/'                                         # PHP JSON website (database)
url = None                                                                      # Standard value
donotloaddir = 0                                                                # Standard value

THEME = __t0mm0addon__.get_setting('theme')                                     # Theme settings
THEME_PATH = os.path.join(PATH, 'art', 'themes', THEME)                         # Theme dir





def getConfigInfo():
    try:
        _json = utils.loadJsonFromUrl(jsonurl + "config.php?version=" + __addon__.getAddonInfo('version'))
        if _json == None:
            xbmcgui.Dialog().ok(__addonname__, ' ', __language__(70111))
            return
        filename = _json[0]['full_file_name']
        urlname = _json[0]['url_name']
        
예제 #23
0
import log_utils
from constants import VIDEO_TYPES
from constants import SRT_SOURCE
from addon.common.addon import Addon
from db_utils import DB_Connection

_SALTS = Addon('plugin.video.salts')
ADDON_PATH = _SALTS.get_path()
ICON_PATH = os.path.join(ADDON_PATH, 'icon.png')
MAX_RETRIES = 2
TEMP_ERRORS = [500, 502, 503, 504]
USER_AGENT = ("User-Agent:Mozilla/5.0 (Windows NT 6.2; WOW64)"
              "AppleWebKit/537.17 (KHTML, like Gecko)"
              "Chrome/24.0.1312.56")
BASE_URL = 'http://www.addic7ed.com'
BASE_PATH = _SALTS.get_setting('subtitle-folder')
db_connection = DB_Connection()


class SRT_Scraper():
    def __init__(self):
        pass

    def get_tvshow_id(self, title, year=None):
        match_title = title.lower()
        rows = db_connection.get_related_url(VIDEO_TYPES.TVSHOW, title, year,
                                             SRT_SOURCE)
        if rows:
            tvshow_id = rows[0][0]
            log_utils.log(
                'Returning local tvshow id: |%s|%s|%s|' %
예제 #24
0
파일: utils.py 프로젝트: MrGHLover/1Channel
import os
import re
import sys
import xbmc
import xbmcgui
import xbmcplugin

# from functools import wraps

from addon.common.addon import Addon

_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')
예제 #25
0
net = Net()
addon = Addon('plugin.video.solarmovie', sys.argv)

try:
    from metahandler import metahandlers
except:
    print 'Failed to import script.module.metahandler'
    xbmcgui.Dialog().ok("PFTV Import Failure", "Failed to import Metahandlers", "A component needed by PFTV is missing on your system", "Please visit www.xbmchub.com for support")


DB = os.path.join(addon.get_profile(), 'solarmovie.db')
BASE_URL = 'http://www.solarmovie.so'


enableMeta = True
if addon.get_setting('enableMeta') == 'false':
        enableMeta = False

GENRES = ['Action', 'Adventure', 'Animation', 'Biography', 'Comedy', 
          'Crime', 'Documentary', 'Drama', 'Family', 'Fantasy', 'Film-Noir', 'Game-Show'
          'History', 'Horror', 'Music', 'Musical', 
          'Mystery', 'News', 'Reality-TV', 'Romance', 'Sci-Fi', 'Short', 'Sport', 'Talk-Show'
          'Thriller', 'War', 'Western']

##### Queries ##########
mode = addon.queries['mode']
url = addon.queries.get('url', None)
section = addon.queries.get('section', None)
img = addon.queries.get('img', None)
genre = addon.queries.get('genre', None)
year = addon.queries.get('year', None)
예제 #26
0
파일: utils.py 프로젝트: SNAPflix/salts
import xbmcvfs
import log_utils
import sys
import hashlib
import urlparse
import shutil
import urllib
from constants import *
from scrapers import * # import all scrapers into this namespace
from addon.common.addon import Addon
from trakt_api import Trakt_API
from db_utils import DB_Connection

ADDON = Addon('plugin.video.salts')
ICON_PATH = os.path.join(ADDON.get_path(), 'icon.png')
SORT_FIELDS =  [(SORT_LIST[int(ADDON.get_setting('sort1_field'))], SORT_SIGNS[ADDON.get_setting('sort1_order')]),
                (SORT_LIST[int(ADDON.get_setting('sort2_field'))], SORT_SIGNS[ADDON.get_setting('sort2_order')]),
                (SORT_LIST[int(ADDON.get_setting('sort3_field'))], SORT_SIGNS[ADDON.get_setting('sort3_order')]),
                (SORT_LIST[int(ADDON.get_setting('sort4_field'))], SORT_SIGNS[ADDON.get_setting('sort4_order')]),
                (SORT_LIST[int(ADDON.get_setting('sort5_field'))], SORT_SIGNS[ADDON.get_setting('sort5_order')])]

username=ADDON.get_setting('username')
password=ADDON.get_setting('password')
use_https=ADDON.get_setting('use_https')=='true'
trakt_timeout=int(ADDON.get_setting('trakt_timeout'))

P_MODE = int(ADDON.get_setting('parallel_mode'))
if P_MODE == P_MODES.THREADS:
    import threading
    from Queue import Queue, Empty
elif P_MODE == P_MODES.PROCESSES:
예제 #27
0
addon = Addon('plugin.video.solarmovie', sys.argv)

try:
    from metahandler import metahandlers
except:
    print 'Failed to import script.module.metahandler'
    xbmcgui.Dialog().ok(
        "PFTV Import Failure", "Failed to import Metahandlers",
        "A component needed by PFTV is missing on your system",
        "Please visit www.xbmchub.com for support")

DB = os.path.join(addon.get_profile(), 'solarmovie.db')
BASE_URL = 'http://www.solarmovie.so'

enableMeta = True
if addon.get_setting('enableMeta') == 'false':
    enableMeta = False

GENRES = [
    'Action', 'Adventure', 'Animation', 'Biography', 'Comedy', 'Crime',
    'Documentary', 'Drama', 'Family', 'Fantasy', 'Film-Noir', 'Game-Show'
    'History', 'Horror', 'Music', 'Musical', 'Mystery', 'News', 'Reality-TV',
    'Romance', 'Sci-Fi', 'Short', 'Sport', 'Talk-Show'
    'Thriller', 'War', 'Western'
]

##### Queries ##########
mode = addon.queries['mode']
url = addon.queries.get('url', None)
section = addon.queries.get('section', None)
img = addon.queries.get('img', None)