platform fix

pull/1/head
DiMartinoXBMC 2015-06-23 23:00:27 +03:00
parent 30df420b4f
commit ca92203b75
33 changed files with 1835 additions and 1356 deletions

File diff suppressed because it is too large Load Diff

View File

@ -18,8 +18,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
'''
import time
import sys
import os
import urllib2
import urllib
@ -28,8 +26,8 @@ import re
import base64
from StringIO import StringIO
import gzip
from functions import file_decode, file_encode
from functions import file_decode, file_encode
from functions import magnet_alert
import xbmcvfs
@ -67,7 +65,6 @@ class AceStream:
print 'Error importing TSengine from ASCore. Exception: ' + str(e)
return
self.TSplayer = tsengine()
del tsengine
self.torrentFilesDirectory = torrentFilesDirectory
@ -115,7 +112,8 @@ class AceStream:
localFile.write(content)
localFile.close()
except Exception, e:
print 'Unable to save torrent file from "' + torrentUrl + '" to "' + torrentFile + '" in Torrent::saveTorrent' + '. Exception: ' + str(e)
print 'Unable to save torrent file from "' + torrentUrl + '" to "' + torrentFile + '" in Torrent::saveTorrent' + '. Exception: ' + str(
e)
return
if xbmcvfs.exists(torrentFile):
self.torrentFile = torrentFile

View File

@ -86,7 +86,6 @@ __license__ = "New-style BSD"
from sgmllib import SGMLParser, SGMLParseError
import codecs
import markupbase
import types
import re
import sgmllib
@ -1274,7 +1273,6 @@ class BeautifulStoneSoup(Tag, SGMLParser):
self.previous = o
self.currentTag.contents.append(o)
def _popToTag(self, name, inclusivePop=True):
"""Pops the tag stack up to and including the most recent
instance of the given tag. If inclusivePop is false, pops the tag
@ -1960,7 +1958,6 @@ class UnicodeDammit:
xml_encoding = sniffed_xml_encoding
return xml_data, xml_encoding, sniffed_xml_encoding
def find_codec(self, charset):
return self._codec(self.CHARSET_ALIASES.get(charset, charset)) \
or (charset and self._codec(charset.replace("-", ""))) \

View File

@ -18,7 +18,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
'''
import hashlib, sys
import hashlib
import sys
import Libtorrent
import AceStream
@ -27,7 +28,6 @@ import AceStream
class Torrent():
__settings__ = sys.modules["__main__"].__settings__
def __init__(self, storageDirectory='', torrentFile='', torrentFilesDirectory='torrents'):
self.get_torrent_client()
if self.player == 'libtorrent':

View File

@ -25,15 +25,16 @@ import urllib2
import hashlib
import re
import sys
from platform import get_platform
from StringIO import StringIO
import gzip
from functions import file_decode, file_encode, isSubtitle, DownloadDB
import xbmc
import xbmcgui
import xbmcvfs
import Localization
from platform_pulsar import get_platform
from functions import file_decode, file_encode, isSubtitle, DownloadDB
class Libtorrent:
torrentFile = None
@ -108,6 +109,7 @@ class Libtorrent:
try:
import libtorrent
print 'Imported libtorrent v' + libtorrent.version + ' from system'
except Exception, e:
print 'Error importing from system. Exception: ' + str(e)
@ -117,7 +119,9 @@ class Libtorrent:
'python_libtorrent', self.platform['system'])
sys.path.insert(0, dirname)
import libtorrent
print 'Imported libtorrent v' + libtorrent.version + ' from python_libtorrent.' + self.platform['system']
print 'Imported libtorrent v' + libtorrent.version + ' from python_libtorrent.' + self.platform[
'system']
except Exception, e:
print 'Error importing python_libtorrent.' + self.platform['system'] + '. Exception: ' + str(e)
pass
@ -127,7 +131,8 @@ class Libtorrent:
del libtorrent
except:
xbmcgui.Dialog().ok(Localization.localize('Python-Libtorrent Not Found'),
Localization.localize(self.platform["message"][0]),Localization.localize(self.platform["message"][1]))
Localization.localize(self.platform["message"][0]),
Localization.localize(self.platform["message"][1]))
return
self.storageDirectory = storageDirectory
@ -168,7 +173,8 @@ class Libtorrent:
localFile.write(content)
localFile.close()
except Exception, e:
print 'Unable to save torrent file from "' + torrentUrl + '" to "' + torrentFile + '" in Torrent::saveTorrent' + '. Exception: ' + str(e)
print 'Unable to save torrent file from "' + torrentUrl + '" to "' + torrentFile + '" in Torrent::saveTorrent' + '. Exception: ' + str(
e)
return
if xbmcvfs.exists(torrentFile):
try:
@ -180,14 +186,16 @@ class Libtorrent:
baseName = file_encode(os.path.basename(self.getFilePath()))
if not xbmcvfs.exists(self.torrentFilesPath):
xbmcvfs.mkdirs(self.torrentFilesPath)
newFile = self.torrentFilesPath+self.md5(baseName)+'.'+self.md5(torrentUrl)+'.torrent'# + '.'+ baseName
newFile = self.torrentFilesPath + self.md5(baseName) + '.' + self.md5(
torrentUrl) + '.torrent' # + '.'+ baseName
if not xbmcvfs.exists(newFile):
xbmcvfs.delete(newFile)
if not xbmcvfs.exists(newFile):
try:
xbmcvfs.rename(torrentFile, newFile)
except Exception, e:
print 'Unable to rename torrent file from "' + torrentFile + '" to "' + newFile + '" in Torrent::renameTorrent'+ '. Exception: ' + str(e)
print 'Unable to rename torrent file from "' + torrentFile + '" to "' + newFile + '" in Torrent::renameTorrent' + '. Exception: ' + str(
e)
return
self.torrentFile = newFile
if not self.torrentFileInfo:
@ -278,10 +286,10 @@ class Libtorrent:
return filelist
except:
xbmcgui.Dialog().ok(Localization.localize('Python-Libtorrent Not Found'),
Localization.localize(self.platform["message"][0]),Localization.localize(self.platform["message"][1]))
Localization.localize(self.platform["message"][0]),
Localization.localize(self.platform["message"][1]))
return
def getSubsIds(self, filename):
subs = []
for i in self.getContentList():
@ -320,7 +328,8 @@ class Libtorrent:
path = os.path.join(self.storageDirectory, title)
type = 'folder'
add=db.add(title, path, type, {'progress':0}, 'downloading', self.torrentFile, contentId, self.storageDirectory)
add = db.add(title, path, type, {'progress': 0}, 'downloading', self.torrentFile, contentId,
self.storageDirectory)
get = db.get(title)
if add or get[5] == 'stopped':
if get[5] == 'stopped':

View File

@ -13,7 +13,6 @@ import xbmcvfs
import Localization
from functions import calculate, showMessage, clearStorage, DownloadDB, get_ids_video
ROOT = sys.modules["__main__"].__root__
RESOURCES_PATH = os.path.join(ROOT, 'resources')
TORRENT2HTTP_TIMEOUT = 20
@ -178,10 +177,12 @@ class TorrentPlayer(xbmc.Player):
def setup_torrent(self):
self.torrent.startSession()
upload_limit=self.__settings__.getSetting("upload_limit") if self.__settings__.getSetting("upload_limit")!="" else 0
upload_limit = self.__settings__.getSetting("upload_limit") if self.__settings__.getSetting(
"upload_limit") != "" else 0
if 0 < int(upload_limit):
self.torrent.setUploadLimit(int(upload_limit) * 1000000 / 8) # MBits/second
download_limit=self.__settings__.getSetting("download_limit") if self.__settings__.getSetting("download_limit")!="" else 0
download_limit = self.__settings__.getSetting("download_limit") if self.__settings__.getSetting(
"download_limit") != "" else 0
if 0 < int(download_limit):
self.torrent.setDownloadLimit(
int(download_limit) * 1000000 / 8) # MBits/second
@ -289,7 +290,8 @@ class TorrentPlayer(xbmc.Player):
if self.get("label") and self.episodeId == self.get("episodeId"):
label = urllib.unquote_plus(self.get("label"))
elif seasonId and self.episodeId and title:
label = '%s S%02dE%02d.%s (%s)' % (title, int(seasonId), int(self.episodeId), self.basename.split('.')[-1], self.basename)
label = '%s S%02dE%02d.%s (%s)' % (
title, int(seasonId), int(self.episodeId), self.basename.split('.')[-1], self.basename)
if seasonId and self.episodeId and label and title:
listitem = xbmcgui.ListItem(label, path=path)
@ -377,7 +379,8 @@ class TorrentPlayer(xbmc.Player):
self.seed(self.contentId)
self.seeding_status = True
# xbmc.sleep(7000)
if self.iterator == 100 and self.next_dl and not self.next_dling and isinstance(self.next_contentId, int) and self.next_contentId!=False:
if self.iterator == 100 and self.next_dl and not self.next_dling and isinstance(self.next_contentId,
int) and self.next_contentId != False:
showMessage(Localization.localize('Torrent Downloading'),
Localization.localize('Starting download next episode!'), forced=True)
self.torrent.stopSession()

4
cal.py
View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
import sys
import os, json, re
from BeautifulSoup import BeautifulSoup
import os
import re
ROOT = os.path.dirname(sys.modules["__main__"].sys.argv[0])
searcherObject = {}

View File

@ -1,13 +1,13 @@
# -*- coding: utf-8 -*-
import xbmcaddon
import xbmc, sys
from functions import getParameters, HistoryDB
import sys
import xbmcaddon
import xbmc
from functions import getParameters, HistoryDB
from resources.pyxbmct.addonwindow import *
from functions import Searchers
__settings__ = xbmcaddon.Addon(id='plugin.video.torrenter')
__language__ = __settings__.getLocalizedString
__version__ = __settings__.getAddonInfo('version')
@ -21,6 +21,7 @@ if len(sys.argv)>1:
else:
params = {}
class MyAddon(AddonDialogWindow):
def __init__(self, title=''):
super(MyAddon, self).__init__(title)

View File

@ -19,7 +19,6 @@ import xbmcvfs
import Localization
from resources.scrapers.scrapers import Scrapers
try:
from hashlib import md5
except ImportError:
@ -264,6 +263,7 @@ def calculate(full):
return repl_const
def getDirList(path, newl=None):
l = []
try:
@ -396,6 +396,7 @@ def cutFolder(contentList, tdir=None):
else:
return dirList, contentList
def sweetpair(l):
from difflib import SequenceMatcher
@ -836,6 +837,7 @@ class TimeOut():
# Debug('[TimeOut]: '+str(to))
return to
class ListDB:
def __init__(self, version=1.0):
self.dbname = 'list' + '.db3'
@ -1034,6 +1036,7 @@ class HistoryDB:
self.cur.close()
self.db.close()
class Searchers():
def __init__(self):
pass
@ -1341,6 +1344,7 @@ def fetchData(url, referer=None):
print " fetchData(" + url + ") exception: " + str(e)
return
def file_decode(filename):
if not __settings__.getSetting('delete_russian') == 'true':
try:
@ -1349,18 +1353,21 @@ def file_decode(filename):
pass
return filename
def file_encode(filename):
if not __settings__.getSetting('delete_russian') == 'true':
if sys.getfilesystemencoding() == 'mbcs' and isAsciiString(filename):
filename = filename.decode('cp1251').encode('utf-8')
return filename
def isAsciiString(mediaName):
for index, char in enumerate(mediaName):
if ord(char) >= 128:
return False
return True
def getParameters(parameterString):
commands = {}
splitCommands = parameterString[parameterString.find('?') + 1:].split('&')
@ -1373,6 +1380,7 @@ def getParameters(parameterString):
commands[name] = value
return commands
def isSubtitle(filename, filename2):
filename_if = filename[:len(filename) - len(filename.split('.')[-1]) - 1]
filename_if = filename_if.split('/')[-1].split('\\')[-1]
@ -1384,6 +1392,7 @@ def isSubtitle(filename, filename2):
return True
return False
def delete_russian(ok=False, action='delete'):
i = 0
if not ok:
@ -1393,7 +1402,8 @@ def delete_russian(ok=False, action='delete'):
if ok:
fileList = {
'contenters': ['CXZ.py', 'FastTorrent.py', 'KinoPoisk.py', 'RiperAM.py'],
'searchers':['NNMClubRu.py','OpenSharing.py','RiperAM.py','RuTorOrg.py','RuTrackerOrg.py','TFileME.py']
'searchers': ['NNMClubRu.py', 'OpenSharing.py', 'RiperAM.py', 'RuTorOrg.py', 'RuTrackerOrg.py',
'TFileME.py']
}
for path in fileList.keys():
@ -1418,6 +1428,7 @@ def delete_russian(ok=False, action='delete'):
else:
return False
class DownloadDB:
def __init__(self, version=1.41):
self.name = 'download.db3'
@ -1426,26 +1437,32 @@ class DownloadDB:
def get_all(self):
self._connect()
try:
self.cur.execute('select addtime, title, path, type, jsoninfo, status, torrent, ind, lastupdate, storage from downloads order by addtime DESC')
self.cur.execute(
'select addtime, title, path, type, jsoninfo, status, torrent, ind, lastupdate, storage from downloads order by addtime DESC')
except:
Debug('[DownloadDB]: DELETE ' + str(self.filename))
xbmcvfs.delete(self.filename)
self._connect()
self.cur.execute('select addtime, title, path, type, jsoninfo, status, torrent, ind, lastupdate, storage from downloads order by addtime DESC')
self.cur.execute(
'select addtime, title, path, type, jsoninfo, status, torrent, ind, lastupdate, storage from downloads order by addtime DESC')
x = self.cur.fetchall()
self._close()
return x if x else None
def get(self, title):
self._connect()
self.cur.execute('select addtime, title, path, type, jsoninfo, status, torrent, ind, lastupdate, storage from downloads where title="' + decode(title) + '"')
self.cur.execute(
'select addtime, title, path, type, jsoninfo, status, torrent, ind, lastupdate, storage from downloads where title="' + decode(
title) + '"')
x = self.cur.fetchone()
self._close()
return x if x else None
def get_byaddtime(self, addtime):
self._connect()
self.cur.execute('select addtime, title, path, type, jsoninfo, status, torrent, ind, lastupdate, storage from downloads where addtime="' + str(addtime) + '"')
self.cur.execute(
'select addtime, title, path, type, jsoninfo, status, torrent, ind, lastupdate, storage from downloads where addtime="' + str(
addtime) + '"')
x = self.cur.fetchone()
self._close()
return x if x else None
@ -1460,8 +1477,11 @@ class DownloadDB:
def add(self, title, path, type, info, status, torrent, ind, storage):
if not self.get(title):
self._connect()
self.cur.execute('insert into downloads(addtime, title, path, type, jsoninfo, status, torrent, ind, lastupdate, storage)'
' values(?,?,?,?,?,?,?,?,?,?)', (int(time.time()), decode(title), decode(path), type, json.dumps(info), status, decode(torrent), ind, int(time.time()), decode(storage)))
self.cur.execute(
'insert into downloads(addtime, title, path, type, jsoninfo, status, torrent, ind, lastupdate, storage)'
' values(?,?,?,?,?,?,?,?,?,?)', (
int(time.time()), decode(title), decode(path), type, json.dumps(info), status, decode(torrent), ind,
int(time.time()), decode(storage)))
self.db.commit()
self._close()
return True
@ -1474,7 +1494,9 @@ class DownloadDB:
except:
pass
self._connect()
self.cur.execute('UPDATE downloads SET jsoninfo = "' + urllib.quote_plus(json.dumps(info)) + '", lastupdate='+str(int(time.time()))+' where title="' + title+'"')
self.cur.execute(
'UPDATE downloads SET jsoninfo = "' + urllib.quote_plus(json.dumps(info)) + '", lastupdate=' + str(
int(time.time())) + ' where title="' + title + '"')
self.db.commit()
self._close()
@ -1542,6 +1564,7 @@ class DownloadDB:
self.cur.close()
self.db.close()
def decode(string, ret=None):
try:
string = string.decode('utf-8')
@ -1552,6 +1575,7 @@ def decode(string, ret=None):
else:
return string
def unquote(string, ret=None):
try:
return urllib.unquote_plus(string)
@ -1561,6 +1585,7 @@ def unquote(string, ret=None):
else:
return string
def itemScrap(item, kwarg):
# Debug('[itemTVDB]:meta '+str(kwarg))
if 'title' in kwarg and kwarg['title']:
@ -1584,9 +1609,11 @@ def itemScrap(item, kwarg):
return item
def get_ids_video(contentList):
ids_video = []
allowed_video_ext=['avi','mp4','mkv','flv','mov','vob','wmv','ogm','asx','mpg','mpeg','avc','vp3','fli','flc','m4v','iso']
allowed_video_ext = ['avi', 'mp4', 'mkv', 'flv', 'mov', 'vob', 'wmv', 'ogm', 'asx', 'mpg', 'mpeg', 'avc', 'vp3',
'fli', 'flc', 'm4v', 'iso']
allowed_music_ext = ['mp3', 'flac', 'wma', 'ogg', 'm4a', 'aac', 'm4p', 'rm', 'ra']
for extlist in [allowed_video_ext, allowed_music_ext]:
for title, identifier in contentList:

View File

@ -1,64 +0,0 @@
import xbmc
import sys
import os
def get_platform():
ret = {
"arch": sys.maxsize > 2**32 and "x64" or "x86",
}
if xbmc.getCondVisibility("system.platform.android"):
ret["os"] = "android"
if "arm" in os.uname()[4]:
ret["arch"] = "arm"
elif xbmc.getCondVisibility("system.platform.linux"):
ret["os"] = "linux"
if "arm" in os.uname()[4]:
ret["arch"] = "arm"
elif xbmc.getCondVisibility("system.platform.xbox"):
system_platform = "xbox"
ret["arch"] = ""
elif xbmc.getCondVisibility("system.platform.windows"):
ret["os"] = "windows"
elif xbmc.getCondVisibility("system.platform.osx"):
ret["os"] = "darwin"
elif xbmc.getCondVisibility("system.platform.ios"):
ret["os"] = "ios"
ret["arch"] = "arm"
ret["system"] = ''
ret["message"]=['','']
if ret["os"]=='windows':
ret["system"] = 'windows'
ret["message"]=['Windows has static compiled python-libtorrent included.',
'You should install "script.module.libtorrent" from "MyShows.me Kodi Repo"']
elif ret["os"] == "linux" and ret["arch"] == "x64":
ret["system"] = 'linux_x86_64'
ret["message"]=['Linux x64 has not static compiled python-libtorrent included.',
'You should install it by "sudo apt-get install python-libtorrent"']
elif ret["os"] == "linux" and ret["arch"] == "x86":
ret["system"] = 'linux_x86'
ret["message"]=['Linux has static compiled python-libtorrent included but it didn\'t work.',
'You should install it by "sudo apt-get install python-libtorrent"']
elif ret["os"] == "linux" and ret["arch"] == "arm":
ret["system"] = 'linux_arm'
ret["message"]=['As far as I know you can compile python-libtorrent for ARMv6-7.',
'You should search for "OneEvil\'s OpenELEC libtorrent" or use Ace Stream.']
elif ret["os"] == "android":
ret["system"] = 'android'
ret["message"]=['Please use install Ace Stream APK and choose it in Settings.',
'It is possible to compile python-libtorrent for Android, but I don\'t know how.']
elif ret["os"] == "darwin":
ret["system"] = 'darwin'
ret["message"]=['It is possible to compile python-libtorrent for OS X.',
'But you would have to do it by yourself, there is some info on github.com.']
elif ret["os"] == "ios":
ret["system"] = 'ios'
ret["message"]=['It is NOT possible to compile python-libtorrent for iOS.',
'But you can use torrent-client control functions.']
return ret
PLATFORM = get_platform()

65
platform_pulsar.py 100644
View File

@ -0,0 +1,65 @@
import sys
import os
import xbmc
def get_platform():
ret = {
"arch": sys.maxsize > 2 ** 32 and "x64" or "x86",
}
if xbmc.getCondVisibility("system.platform.android"):
ret["os"] = "android"
if "arm" in os.uname()[4]:
ret["arch"] = "arm"
elif xbmc.getCondVisibility("system.platform.linux"):
ret["os"] = "linux"
if "arm" in os.uname()[4]:
ret["arch"] = "arm"
elif xbmc.getCondVisibility("system.platform.xbox"):
system_platform = "xbox"
ret["arch"] = ""
elif xbmc.getCondVisibility("system.platform.windows"):
ret["os"] = "windows"
elif xbmc.getCondVisibility("system.platform.osx"):
ret["os"] = "darwin"
elif xbmc.getCondVisibility("system.platform.ios"):
ret["os"] = "ios"
ret["arch"] = "arm"
ret["system"] = ''
ret["message"] = ['', '']
if ret["os"] == 'windows':
ret["system"] = 'windows'
ret["message"] = ['Windows has static compiled python-libtorrent included.',
'You should install "script.module.libtorrent" from "MyShows.me Kodi Repo"']
elif ret["os"] == "linux" and ret["arch"] == "x64":
ret["system"] = 'linux_x86_64'
ret["message"] = ['Linux x64 has not static compiled python-libtorrent included.',
'You should install it by "sudo apt-get install python-libtorrent"']
elif ret["os"] == "linux" and ret["arch"] == "x86":
ret["system"] = 'linux_x86'
ret["message"] = ['Linux has static compiled python-libtorrent included but it didn\'t work.',
'You should install it by "sudo apt-get install python-libtorrent"']
elif ret["os"] == "linux" and ret["arch"] == "arm":
ret["system"] = 'linux_arm'
ret["message"] = ['As far as I know you can compile python-libtorrent for ARMv6-7.',
'You should search for "OneEvil\'s OpenELEC libtorrent" or use Ace Stream.']
elif ret["os"] == "android":
ret["system"] = 'android'
ret["message"] = ['Please use install Ace Stream APK and choose it in Settings.',
'It is possible to compile python-libtorrent for Android, but I don\'t know how.']
elif ret["os"] == "darwin":
ret["system"] = 'darwin'
ret["message"] = ['It is possible to compile python-libtorrent for OS X.',
'But you would have to do it by yourself, there is some info on github.com.']
elif ret["os"] == "ios":
ret["system"] = 'ios'
ret["message"] = ['It is NOT possible to compile python-libtorrent for iOS.',
'But you can use torrent-client control functions.']
return ret
PLATFORM = get_platform()

View File

@ -18,7 +18,10 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
'''
import Content, re
import re
import Content
class EZTV(Content.Content):
category_dict = {

View File

@ -18,18 +18,23 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
'''
import re
import Content
from BeautifulSoup import BeautifulSoup
class KickAssSo(Content.Content):
category_dict = {
'hot': ('Most Recent', '/new/?field=seeders&sorder=desc', {'page': '/new/%d/?field=seeders&sorder=desc', 'increase': 1, 'second_page': 2,
'hot': ('Most Recent', '/new/?field=seeders&sorder=desc',
{'page': '/new/%d/?field=seeders&sorder=desc', 'increase': 1, 'second_page': 2,
' ': [{'name': ' ', 'url_after': '?field=seeders&sorder=desc'}]}),
'anime': ('Anime', '/anime/', {'page': '/anime/%d/', 'increase': 1, 'second_page': 2,
' ': [{'name': ' ', 'url_after': '?field=seeders&sorder=desc'}]}),
'tvshows': ('TV Shows', '/tv/?field=seeders&sorder=desc', {'page': '/tv/%d/?field=seeders&sorder=desc', 'increase': 1, 'second_page': 2,
'tvshows': ('TV Shows', '/tv/?field=seeders&sorder=desc',
{'page': '/tv/%d/?field=seeders&sorder=desc', 'increase': 1, 'second_page': 2,
' ': [{'name': ' ', 'url_after': '?field=seeders&sorder=desc'}]}),
'movies': ('Movies', '/movies/?field=seeders&sorder=desc', {'page': '/movies/%d/?field=seeders&sorder=desc', 'increase': 1, 'second_page': 2,
'movies': ('Movies', '/movies/?field=seeders&sorder=desc',
{'page': '/movies/%d/?field=seeders&sorder=desc', 'increase': 1, 'second_page': 2,
' ': [{'name': ' ', 'url_after': '?field=seeders&sorder=desc'}]}),
}
@ -99,7 +104,8 @@ class KickAssSo(Content.Content):
info['infolink'] = self.baseurl + infolink
size = self.unescape(self.stripHtml(size))
date = self.unescape(self.stripHtml(date))
info['plot'] = info['title']+'\r\n[I](%s) [S/L: %s/%s] [/I]\r\nAge: %s' % (size, seeds, leechers, date)
info['plot'] = info['title'] + '\r\n[I](%s) [S/L: %s/%s] [/I]\r\nAge: %s' % (
size, seeds, leechers, date)
contentList.append((
int(int(self.sourceWeight) * (int(num))),
@ -118,7 +124,8 @@ class KickAssSo(Content.Content):
if not result:
return None
li = result.findAll('li')
info,movieInfo={'Cast':''},{'desc':'','poster':'','title':'','views':'0','rating':'50','kinopoisk':''}
info, movieInfo = {'Cast': ''}, {'desc': '', 'poster': '', 'title': '', 'views': '0', 'rating': '50',
'kinopoisk': ''}
try:
img = result.find('a', {'class': 'movieCover'}).find('img').get('src')
movieInfo['poster'] = 'http:' + img
@ -152,7 +159,8 @@ class KickAssSo(Content.Content):
if not 'plot' in info and 'Summary' in key:
info['plot'] = info[key]
for i in ['Movie','TV Show','Release date','Original run','Episode','Air date','Genres','Language','Director','Writers','Cast','Original run','IMDb rating','AniDB rating']:
for i in ['Movie', 'TV Show', 'Release date', 'Original run', 'Episode', 'Air date', 'Genres', 'Language',
'Director', 'Writers', 'Cast', 'Original run', 'IMDb rating', 'AniDB rating']:
if info.get(i) and info.get(i) not in ['']:
movieInfo['desc'] += color % (i, info.get(i))
if i == 'Movie':

View File

@ -17,32 +17,38 @@
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 Content
from BeautifulSoup import BeautifulSoup
class SWESUB(Content.Content):
category_dict = {
'tvshows': ('TV Shows', '/senaste-tv-serier/', {'page': '/senaste-tv-serier/?page=%d',
'increase': 1, 'second_page': 2, }),
'movies': ('Movies', '/senaste-filmer/'),#, {'page': '/senaste-filmer/?page=%d', 'increase': 1, 'second_page': 2,}),
'movies': ('Movies', '/senaste-filmer/'),
# , {'page': '/senaste-filmer/?page=%d', 'increase': 1, 'second_page': 2,}),
'genre': {'genre': 'by Genre',
'action': ('Action', '/action/', {'page': '/action/?page=%d', 'increase': 1, 'second_page': 2, }),
'adventure': ('Adventure', '/aventyr/', {'page': '/aventyr/?page=%d', 'increase': 1, 'second_page': 2,}),
'animation': ('Animation', '/animerat/', {'page': '/animerat/?page=%d', 'increase': 1, 'second_page': 2,}),
'adventure': (
'Adventure', '/aventyr/', {'page': '/aventyr/?page=%d', 'increase': 1, 'second_page': 2, }),
'animation': (
'Animation', '/animerat/', {'page': '/animerat/?page=%d', 'increase': 1, 'second_page': 2, }),
'comedy': ('Comedy', '/komedi/', {'page': '/komedi/?page=%d', 'increase': 1, 'second_page': 2, }),
'crime': ('Crime', '/kriminal/', {'page': '/kriminal/?page=%d', 'increase': 1, 'second_page': 2, }),
'documentary': ('Documentary', '/dokumentar/', {'page': '/dokumentar/?page=%d', 'increase': 1, 'second_page': 2,}),
'documentary': (
'Documentary', '/dokumentar/', {'page': '/dokumentar/?page=%d', 'increase': 1, 'second_page': 2, }),
'drama': ('Drama', '/drama/', {'page': '/drama/?page=%d', 'increase': 1, 'second_page': 2, }),
'family': ('Family', '/familj/', {'page': '/familj/?page=%d', 'increase': 1, 'second_page': 2, }),
'fantasy': ('Fantasy', '/fantasy/', {'page': '/fantasy/?page=%d', 'increase': 1, 'second_page': 2, }),
'horror': ('Horror', '/skrack/', {'page': '/skrack/?page=%d', 'increase': 1, 'second_page': 2, }),
'music': ('Music', '/dans/', {'page': '/dans/?page=%d', 'increase': 1, 'second_page': 2, }),
'musical': ('Musical', '/musikal/', {'page': '/musikal/?page=%d', 'increase': 1, 'second_page': 2, }),
'romance': ('Romance', '/romantik/', {'page': '/romantik/?page=%d', 'increase': 1, 'second_page': 2,}),
'romance': (
'Romance', '/romantik/', {'page': '/romantik/?page=%d', 'increase': 1, 'second_page': 2, }),
'sci_fi': ('Sci-Fi', '/sci-fi/', {'page': '/sci-fi/?page=%d', 'increase': 1, 'second_page': 2, }),
'sport': ('Sport', '/sport/', {'page': '/sport/?page=%d', 'increase': 1, 'second_page': 2, }),
'thriller': ('Thriller', '/thriller/', {'page': '/thriller/?page=%d', 'increase': 1, 'second_page': 2,}),
'thriller': (
'Thriller', '/thriller/', {'page': '/thriller/?page=%d', 'increase': 1, 'second_page': 2, }),
'war': ('War', '/krig/', {'page': '/krig/?page=%d', 'increase': 1, 'second_page': 2, }),
'western': ('Western', '/western/', {'page': '/western/?page=%d', 'increase': 1, 'second_page': 2, }),
}

View File

@ -18,8 +18,10 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
'''
import re
import Content
class ThePirateBaySe(Content.Content):
category_dict = {
'tvshows': ('TV Shows', '/browse/205', {'page': '/browse/208/%d', 'increase': 1, 'second_page': 1,

View File

@ -11,7 +11,10 @@
# PyXBMCt framework module
import os
import xbmc, xbmcgui, xbmcaddon
import xbmc
import xbmcgui
# _addon = xbmcaddon.Addon()
_images = os.path.join(os.path.dirname(__file__), 'textures', 'default')
@ -82,6 +85,7 @@ class Label(xbmcgui.ControlLabel):
Example:
self.label = Label('Status', angle=45)
"""
def __new__(cls, *args, **kwargs):
return super(Label, cls).__new__(cls, -10, -10, 1, 1, *args, **kwargs)
@ -100,6 +104,7 @@ class FadeLabel(xbmcgui.ControlFadeLabel):
Example:
self.fadelabel = FadeLabel(textColor='0xFFFFFFFF')
"""
def __new__(cls, *args, **kwargs):
return super(FadeLabel, cls).__new__(cls, -10, -10, 1, 1, *args, **kwargs)
@ -117,6 +122,7 @@ class TextBox(xbmcgui.ControlTextBox):
Example:
self.textbox = TextBox(textColor='0xFFFFFFFF')
"""
def __new__(cls, *args, **kwargs):
return super(TextBox, cls).__new__(cls, -10, -10, 1, 1, *args, **kwargs)
@ -136,6 +142,7 @@ class Image(xbmcgui.ControlImage):
Example:
self.image = Image('d:\images\picture.jpg', aspectRatio=2)
"""
def __new__(cls, *args, **kwargs):
return super(Image, cls).__new__(cls, -10, -10, 1, 1, *args, **kwargs)
@ -163,6 +170,7 @@ class Button(xbmcgui.ControlButton):
Example:
self.button = Button('Status', font='font14')
"""
def __new__(cls, *args, **kwargs):
textures = {'focusTexture': os.path.join(_images, 'Button', 'KeyboardKey.png'),
'noFocusTexture': os.path.join(_images, 'Button', 'KeyboardKeyNF.png')}
@ -202,6 +210,7 @@ class RadioButton(xbmcgui.ControlRadioButton):
Example:
self.radiobutton = RadioButton('Status', font='font14')
"""
def __new__(cls, *args, **kwargs):
if int(xbmc.getInfoLabel('System.BuildVersion')[:2]) >= 13:
textures = {'focusTexture': os.path.join(_images, 'RadioButton', 'MenuItemFO.png'),
@ -242,6 +251,7 @@ class Edit(xbmcgui.ControlEdit):
example:
- self.edit = Edit('Status')
"""
def __new__(cls, *args, **kwargs):
textures = {'focusTexture': os.path.join(_images, 'Edit', 'button-focus.png'),
'noFocusTexture': os.path.join(_images, 'Edit', 'black-back2.png')}
@ -272,6 +282,7 @@ class List(xbmcgui.ControlList):
Example:
self.cList = List('font14', space=5)
"""
def __new__(cls, *args, **kwargs):
textures = {'buttonTexture': os.path.join(_images, 'List', 'MenuItemNF.png'),
'buttonFocusTexture': os.path.join(_images, 'List', 'MenuItemFO.png')}
@ -293,6 +304,7 @@ class Slider(xbmcgui.ControlSlider):
Example:
self.slider = Slider()
"""
def __new__(cls, *args, **kwargs):
textures = {'textureback': os.path.join(_images, 'Slider', 'osd_slider_bg.png'),
'texture': os.path.join(_images, 'Slider', 'osd_slider_nibNF.png'),
@ -302,7 +314,6 @@ class Slider(xbmcgui.ControlSlider):
class _AbstractWindow(object):
"""
Top-level control window.
@ -525,7 +536,6 @@ class _AbstractWindow(object):
class _AddonWindow(_AbstractWindow):
"""
Top-level control window.
@ -574,8 +584,10 @@ class _AddonWindow(_AbstractWindow):
self.addControl(self.title_bar)
self.setAnimation(self.title_bar)
self.window_close_button = xbmcgui.ControlButton(-100, -100, 60, 30, '',
focusTexture=os.path.join(_images, 'AddonWindow', 'DialogCloseButton-focus.png'),
noFocusTexture=os.path.join(_images, 'AddonWindow', 'DialogCloseButton.png'))
focusTexture=os.path.join(_images, 'AddonWindow',
'DialogCloseButton-focus.png'),
noFocusTexture=os.path.join(_images, 'AddonWindow',
'DialogCloseButton.png'))
self.addControl(self.window_close_button)
self.setAnimation(self.window_close_button)
@ -616,7 +628,8 @@ class _AddonWindow(_AbstractWindow):
self.grid_y = self.y + self.Y_MARGIN + self.Y_SHIFT + self.HEADER_HEIGHT + self.win_padding
self.tile_width = (self.width - 2 * (self.X_MARGIN + self.win_padding)) / self.columns
self.tile_height = (
self.height - self.HEADER_HEIGHT - self.Y_SHIFT - 2 * (self.Y_MARGIN + self.win_padding))/self.rows
self.height - self.HEADER_HEIGHT - self.Y_SHIFT - 2 * (
self.Y_MARGIN + self.win_padding)) / self.rows
def setWindowTitle(self, title=''):
"""
@ -632,8 +645,8 @@ class _AddonWindow(_AbstractWindow):
"""Get window title."""
return self.title_bar.getLabel()
class _FullWindow(xbmcgui.Window):
class _FullWindow(xbmcgui.Window):
"""An abstract class to define window event processing."""
def onAction(self, action):
@ -659,7 +672,6 @@ class _FullWindow(xbmcgui.Window):
class _DialogWindow(xbmcgui.WindowDialog):
"""An abstract class to define window event processing."""
def onAction(self, action):
@ -718,8 +730,8 @@ class BlankDialogWindow(_DialogWindow, _AbstractWindow):
"""
pass
class AddonFullWindow(_FullWindow, _AddonWindow):
class AddonFullWindow(_FullWindow, _AddonWindow):
"""
Addon UI container with a solid background.
Control window is displayed on top of the main background image - self.main_bg.

View File

@ -12,7 +12,6 @@ import xbmcgui
import Localization
from net import HTTP
try:
from sqlite3 import dbapi2 as sqlite
except:

View File

@ -27,10 +27,8 @@ import math
import difflib
import translit
import LOGGER as Log
from HTTP import *
USER_AGENT = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22'
# USER_AGENT = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/534.51.22 (KHTML, like Gecko) Version/5.1.1 Safari/534.51.22'
ENCODING_PLEX = 'utf-8'

View File

@ -32,6 +32,8 @@ import pluginsettings as S
import translit
# MATCHER_MOVIE_DURATION = re.compile('\s*(\d+).*?', re.UNICODE | re.DOTALL)
# MATCHER_IMDB_RATING = re.compile('IMDb:\s*(\d+\.?\d*)\s*\(\s*([\s\d]+)\s*\)', re.UNICODE | re.DOTALL)
# MATCHER_IMDB_RATING = re.compile('IMDb:\s*(\d+\.?\d*)\s?\((.*)\)', re.UNICODE)
@ -171,5 +173,3 @@ class PageParser:
results.append([itemKinoPoiskId, itemTitle, itemYear, itemScore])
return results

View File

@ -22,8 +22,6 @@ Simple transliteration
# __url__ = "$URL: https://pythy.googlecode.com/svn/tags/pytils/0_2_2/pytils/translit.py $"
import re
import sys
TRANSTABLE = (
(u"'", u"'"),

View File

@ -11,7 +11,6 @@ import kinopoisk.LOGGER
import kinopoisk.pageparser
import kinopoisk.common
GENRE = {
'anime': 1750,
'biography': 22,
@ -463,7 +462,8 @@ class KinoPoisk:
if len(data) == 3:
i = 0
for mon in (
u'января', u'февраля', u'марта', u'апреля', u'мая', u'июня', u'июля', u'августа', u'сентября',
u'января', u'февраля', u'марта', u'апреля', u'мая', u'июня', u'июля', u'августа',
u'сентября',
u'октября', u'ноября', u'декабря'):
i += 1
if mon == data[1]:

View File

@ -12,10 +12,8 @@ import itertools
import xbmc
import xbmcgui
import xbmcaddon
import xbmcvfs
RE = {
'content-disposition': re.compile('attachment;\sfilename="*([^"\s]+)"|\s')
}
@ -34,7 +32,6 @@ class HTTP:
if not xbmcvfs.exists(self._dirname):
xbmcvfs.mkdir(self._dirname)
def fetch(self, request, **kwargs):
self.con, self.fd, self.progress, self.cookies, self.request = None, None, None, None, request
@ -74,7 +71,6 @@ class HTTP:
return self.response
def _opener(self):
build = [urllib2.HTTPHandler()]
@ -101,7 +97,6 @@ class HTTP:
urllib2.install_opener(urllib2.build_opener(*build))
def _fetch(self):
params = {} if self.request.params is None else self.request.params
@ -141,7 +136,6 @@ class HTTP:
if self.request.cookies:
self.cookies.save(self.request.cookies)
def _download(self):
fd = open(self.request.download, 'wb')
if self.request.progress:
@ -173,7 +167,6 @@ class HTTP:
self.response.filename = self.request.download
def _upload(self, upload, params):
res = []
boundary = mimetools.choose_boundary()
@ -209,7 +202,6 @@ class HTTP:
result.append('')
return boundary, '\r\n'.join(result)
def _headers(self, raw):
headers = {}
for line in raw.headers:
@ -221,7 +213,6 @@ class HTTP:
headers[tag] = value
return headers
def _progress(self, read, size, name):
res = []
if size < 0:
@ -304,4 +295,3 @@ class HTTPResponse:
else:
args += ',body=None'
return '%s(%s)' % (self.__class__.__name__, args)

View File

@ -383,7 +383,6 @@ def get_unicode_from_response(r):
except TypeError:
return r.content
# The unreserved URI characters (RFC 3986)
UNRESERVED_SET = frozenset(
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
@ -519,6 +518,7 @@ def should_bypass_proxies(url):
return False
def get_environ_proxies(url):
"""Return a dict of environment proxies."""
if should_bypass_proxies(url):
@ -600,7 +600,6 @@ def parse_header_links(value):
return links
# Null bytes; no need to recreate these on each call to guess_json_utf
_null = '\x00'.encode('ascii') # encoding to ASCII for Python 3
_null2 = _null * 2

View File

@ -3,12 +3,10 @@
import re
# import xbmc, xbmcgui, xbmcplugin, xbmcvfs
import xbmcaddon
from tvdb import TvDb
from tmdbs import TmDb
from kinopoisks import KinoPoisk
STATUS = {
'moder': (40501, 'FFFF0000'),
'check': (40502, 'FFFF0000'),

View File

@ -21,9 +21,6 @@
import urllib
import re
import sys
import tempfile
import os
import time
import SearcherABC

View File

@ -19,9 +19,7 @@
'''
import re
import os
import urllib
import tempfile
import sys
import SearcherABC
@ -70,7 +68,8 @@ class T411FR(SearcherABC.SearcherABC):
def search(self, keyword):
filesList = []
url='http://www.t411.io/torrents/search/?search=%s' % urllib.quote_plus(keyword.decode('utf-8').encode('cp1251'))
url = 'http://www.t411.io/torrents/search/?search=%s' % urllib.quote_plus(
keyword.decode('utf-8').encode('cp1251'))
url += '&order=seeders&type=desc'
response = self.makeRequest(url, headers=self.headers)
if None != response and 0 < len(response):

View File

@ -19,9 +19,7 @@
'''
import re
import os
import urllib
import tempfile
import sys
import SearcherABC

View File

@ -21,7 +21,6 @@
import urllib
import re
import sys
import urllib2
import SearcherABC

View File

@ -19,9 +19,7 @@
'''
import re
import os
import urllib
import tempfile
import sys
import SearcherABC
@ -64,7 +62,8 @@ class KinoZalTV(SearcherABC.SearcherABC):
def search(self, keyword):
filesList = []
url='http://kinozal.tv/browse.php?s=%s&g=0&c=0&v=0&d=0&w=0&t=1&f=0' % urllib.quote_plus(keyword.decode('utf-8').encode('cp1251'))
url = 'http://kinozal.tv/browse.php?s=%s&g=0&c=0&v=0&d=0&w=0&t=1&f=0' % urllib.quote_plus(
keyword.decode('utf-8').encode('cp1251'))
headers = {('Origin', 'http://kinozal.tv'),
('User-Agent',

View File

@ -1,10 +1,16 @@
# -*- coding: utf-8 -*-
import xbmcgui, Localization, sys, xbmc
import sys
import xbmcgui
import Localization
import xbmc
KEY_BUTTON_BACK = 275
KEY_KEYBOARD_ESC = 61467
ACTION_PREVIOUS_MENU = 10
ACTION_NAV_BACK = 92
class DialogXml(xbmcgui.WindowXMLDialog):
def onInit(self):
print "onInit(): Window Initialized"
@ -22,7 +28,8 @@ class DialogXml(xbmcgui.WindowXMLDialog):
self.ratingint = int(self.movieInfo['rating'])
if (self.ratingint < 70):
self.ratingcolor = 'red'
self.view_label.setLabel(color % ('blue', localize('Rating:'))+color % (self.ratingcolor, self.movieInfo['rating']))
self.view_label.setLabel(
color % ('blue', localize('Rating:')) + color % (self.ratingcolor, self.movieInfo['rating']))
self.movie_label = self.getControl(1)
self.movie_label.setLabel(self.movieInfo['title'])
@ -66,12 +73,10 @@ class DialogXml(xbmcgui.WindowXMLDialog):
(sys.argv[0], action, self.link)
xbmc.executebuiltin(exec_str)
def onFocus(self, controlID):
# print "onFocus(): control %i" % controlID
pass
def doModal(self, movieInfo, url):
self.movieInfo = movieInfo
self.link = url

View File

@ -842,7 +842,7 @@ class AzureusConnection(AzureusLink):
raise NoEstablishedConnectionError
from xml.dom.minidom import parseString
from dopal.xmlutils import normalise_xml_structure, get_text_content
from dopal.xmlutils import normalise_xml_structure
# First step, convert the method data to XML.
xml_data = remote_method_call_as_xml(method_name, method_args,
@ -1018,7 +1018,6 @@ class ExtendedAzureusConnection(AzureusConnection):
return dopal.utils.parse_azureus_version_string(az_version)
# Use of this name is deprecated, and this alias will be removed in later
# versions of DOPAL.
ReusableAzureusConnection = ExtendedAzureusConnection

View File

@ -22,7 +22,7 @@ from dopal.core import ExtendedAzureusConnection
from dopal.errors import AzMethodError, InvalidObjectIDError, \
RemoteMethodError, StaleObjectReferenceError, ConnectionlessObjectError, \
NonRefreshableConnectionlessObjectError, MissingRemoteAttributeError, \
NonRefreshableIncompleteObjectError, NonRefreshableObjectError
NonRefreshableObjectError
import dopal.utils
@ -487,7 +487,6 @@ class RemoteAttributesMixin(object):
text = "'%s' object has no attribute '%s'"
raise AttributeError, text % (type(self).__name__, name)
def __setattr__(self, name, value):
if self.__protect_remote_attributes__ and not name.startswith('__'):
if name in self.__remote_attribute_names__:

View File

@ -18,7 +18,6 @@ import xbmc
import xbmcgui
import xbmcvfs
os.sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__))))
import dopal.main
@ -51,7 +50,6 @@ class HTTP:
if not xbmcvfs.exists(self._dirname):
xbmcvfs.mkdir(self._dirname)
def fetch(self, request, **kwargs):
self.con, self.fd, self.progress, self.cookies, self.request = None, None, None, None, request
@ -91,7 +89,6 @@ class HTTP:
return self.response
def _opener(self):
build = [urllib2.HTTPHandler()]
@ -118,7 +115,6 @@ class HTTP:
urllib2.install_opener(urllib2.build_opener(*build))
def _fetch(self):
params = {} if self.request.params is None else self.request.params
@ -163,7 +159,6 @@ class HTTP:
if self.request.cookies:
self.cookies.save(self.request.cookies)
def _download(self):
fd = open(self.request.download, 'wb')
if self.request.progress:
@ -195,7 +190,6 @@ class HTTP:
self.response.filename = self.request.download
def _upload(self, upload, params):
res = []
boundary = mimetools.choose_boundary()
@ -231,7 +225,6 @@ class HTTP:
result.append('')
return boundary, '\r\n'.join(result)
def _headers(self, raw):
headers = {}
for line in raw.headers:
@ -243,7 +236,6 @@ class HTTP:
headers[tag] = value
return headers
def _progress(self, read, size, name):
res = []
if size < 0:
@ -942,7 +934,8 @@ class Deluge:
percent = int(x['progress'] * 100)
elif obj.get('file_progress') and len(obj['file_progress']) >= i:
percent = int(obj['file_progress'][i] * 100)
else:percent=0
else:
percent = 0
i += 1
res.append([path, percent, x['index'], size])
@ -967,10 +960,12 @@ class Deluge:
def add_url(self, torrent, dirname):
if re.match("^magnet\:.+$", torrent):
if self.action({'method': 'core.add_torrent_magnet', 'params': [torrent,
{'download_path': dirname}],"id":3}) is None:
{'download_path': dirname}],
"id": 3}) is None:
return None
else:
if self.action({"method": "core.add_torrent_url", "params":[torrent, {'download_path': dirname}],"id":3}) is None:
if self.action({"method": "core.add_torrent_url", "params": [torrent, {'download_path': dirname}],
"id": 3}) is None:
return None
return True