platform fix
parent
30df420b4f
commit
ca92203b75
1682
.idea/workspace.xml
1682
.idea/workspace.xml
File diff suppressed because it is too large
Load Diff
|
@ -18,8 +18,6 @@
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import time
|
|
||||||
import sys
|
|
||||||
import os
|
import os
|
||||||
import urllib2
|
import urllib2
|
||||||
import urllib
|
import urllib
|
||||||
|
@ -28,8 +26,8 @@ import re
|
||||||
import base64
|
import base64
|
||||||
from StringIO import StringIO
|
from StringIO import StringIO
|
||||||
import gzip
|
import gzip
|
||||||
from functions import file_decode, file_encode
|
|
||||||
|
|
||||||
|
from functions import file_decode, file_encode
|
||||||
from functions import magnet_alert
|
from functions import magnet_alert
|
||||||
import xbmcvfs
|
import xbmcvfs
|
||||||
|
|
||||||
|
@ -67,7 +65,6 @@ class AceStream:
|
||||||
print 'Error importing TSengine from ASCore. Exception: ' + str(e)
|
print 'Error importing TSengine from ASCore. Exception: ' + str(e)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
self.TSplayer = tsengine()
|
self.TSplayer = tsengine()
|
||||||
del tsengine
|
del tsengine
|
||||||
self.torrentFilesDirectory = torrentFilesDirectory
|
self.torrentFilesDirectory = torrentFilesDirectory
|
||||||
|
@ -115,7 +112,8 @@ class AceStream:
|
||||||
localFile.write(content)
|
localFile.write(content)
|
||||||
localFile.close()
|
localFile.close()
|
||||||
except Exception, e:
|
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
|
return
|
||||||
if xbmcvfs.exists(torrentFile):
|
if xbmcvfs.exists(torrentFile):
|
||||||
self.torrentFile = torrentFile
|
self.torrentFile = torrentFile
|
||||||
|
|
|
@ -86,7 +86,6 @@ __license__ = "New-style BSD"
|
||||||
from sgmllib import SGMLParser, SGMLParseError
|
from sgmllib import SGMLParser, SGMLParseError
|
||||||
import codecs
|
import codecs
|
||||||
import markupbase
|
import markupbase
|
||||||
import types
|
|
||||||
import re
|
import re
|
||||||
import sgmllib
|
import sgmllib
|
||||||
|
|
||||||
|
@ -1274,7 +1273,6 @@ class BeautifulStoneSoup(Tag, SGMLParser):
|
||||||
self.previous = o
|
self.previous = o
|
||||||
self.currentTag.contents.append(o)
|
self.currentTag.contents.append(o)
|
||||||
|
|
||||||
|
|
||||||
def _popToTag(self, name, inclusivePop=True):
|
def _popToTag(self, name, inclusivePop=True):
|
||||||
"""Pops the tag stack up to and including the most recent
|
"""Pops the tag stack up to and including the most recent
|
||||||
instance of the given tag. If inclusivePop is false, pops the tag
|
instance of the given tag. If inclusivePop is false, pops the tag
|
||||||
|
@ -1960,7 +1958,6 @@ class UnicodeDammit:
|
||||||
xml_encoding = sniffed_xml_encoding
|
xml_encoding = sniffed_xml_encoding
|
||||||
return xml_data, xml_encoding, sniffed_xml_encoding
|
return xml_data, xml_encoding, sniffed_xml_encoding
|
||||||
|
|
||||||
|
|
||||||
def find_codec(self, charset):
|
def find_codec(self, charset):
|
||||||
return self._codec(self.CHARSET_ALIASES.get(charset, charset)) \
|
return self._codec(self.CHARSET_ALIASES.get(charset, charset)) \
|
||||||
or (charset and self._codec(charset.replace("-", ""))) \
|
or (charset and self._codec(charset.replace("-", ""))) \
|
||||||
|
|
|
@ -18,7 +18,8 @@
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import hashlib, sys
|
import hashlib
|
||||||
|
import sys
|
||||||
|
|
||||||
import Libtorrent
|
import Libtorrent
|
||||||
import AceStream
|
import AceStream
|
||||||
|
@ -27,7 +28,6 @@ import AceStream
|
||||||
class Torrent():
|
class Torrent():
|
||||||
__settings__ = sys.modules["__main__"].__settings__
|
__settings__ = sys.modules["__main__"].__settings__
|
||||||
|
|
||||||
|
|
||||||
def __init__(self, storageDirectory='', torrentFile='', torrentFilesDirectory='torrents'):
|
def __init__(self, storageDirectory='', torrentFile='', torrentFilesDirectory='torrents'):
|
||||||
self.get_torrent_client()
|
self.get_torrent_client()
|
||||||
if self.player == 'libtorrent':
|
if self.player == 'libtorrent':
|
||||||
|
|
|
@ -25,15 +25,16 @@ import urllib2
|
||||||
import hashlib
|
import hashlib
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
from platform import get_platform
|
|
||||||
from StringIO import StringIO
|
from StringIO import StringIO
|
||||||
import gzip
|
import gzip
|
||||||
from functions import file_decode, file_encode, isSubtitle, DownloadDB
|
|
||||||
|
|
||||||
import xbmc
|
import xbmc
|
||||||
import xbmcgui
|
import xbmcgui
|
||||||
import xbmcvfs
|
import xbmcvfs
|
||||||
import Localization
|
import Localization
|
||||||
|
from platform_pulsar import get_platform
|
||||||
|
from functions import file_decode, file_encode, isSubtitle, DownloadDB
|
||||||
|
|
||||||
|
|
||||||
class Libtorrent:
|
class Libtorrent:
|
||||||
torrentFile = None
|
torrentFile = None
|
||||||
|
@ -108,6 +109,7 @@ class Libtorrent:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import libtorrent
|
import libtorrent
|
||||||
|
|
||||||
print 'Imported libtorrent v' + libtorrent.version + ' from system'
|
print 'Imported libtorrent v' + libtorrent.version + ' from system'
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
print 'Error importing from system. Exception: ' + str(e)
|
print 'Error importing from system. Exception: ' + str(e)
|
||||||
|
@ -117,7 +119,9 @@ class Libtorrent:
|
||||||
'python_libtorrent', self.platform['system'])
|
'python_libtorrent', self.platform['system'])
|
||||||
sys.path.insert(0, dirname)
|
sys.path.insert(0, dirname)
|
||||||
import libtorrent
|
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:
|
except Exception, e:
|
||||||
print 'Error importing python_libtorrent.' + self.platform['system'] + '. Exception: ' + str(e)
|
print 'Error importing python_libtorrent.' + self.platform['system'] + '. Exception: ' + str(e)
|
||||||
pass
|
pass
|
||||||
|
@ -127,7 +131,8 @@ class Libtorrent:
|
||||||
del libtorrent
|
del libtorrent
|
||||||
except:
|
except:
|
||||||
xbmcgui.Dialog().ok(Localization.localize('Python-Libtorrent Not Found'),
|
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
|
return
|
||||||
|
|
||||||
self.storageDirectory = storageDirectory
|
self.storageDirectory = storageDirectory
|
||||||
|
@ -168,7 +173,8 @@ class Libtorrent:
|
||||||
localFile.write(content)
|
localFile.write(content)
|
||||||
localFile.close()
|
localFile.close()
|
||||||
except Exception, e:
|
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
|
return
|
||||||
if xbmcvfs.exists(torrentFile):
|
if xbmcvfs.exists(torrentFile):
|
||||||
try:
|
try:
|
||||||
|
@ -180,14 +186,16 @@ class Libtorrent:
|
||||||
baseName = file_encode(os.path.basename(self.getFilePath()))
|
baseName = file_encode(os.path.basename(self.getFilePath()))
|
||||||
if not xbmcvfs.exists(self.torrentFilesPath):
|
if not xbmcvfs.exists(self.torrentFilesPath):
|
||||||
xbmcvfs.mkdirs(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):
|
if not xbmcvfs.exists(newFile):
|
||||||
xbmcvfs.delete(newFile)
|
xbmcvfs.delete(newFile)
|
||||||
if not xbmcvfs.exists(newFile):
|
if not xbmcvfs.exists(newFile):
|
||||||
try:
|
try:
|
||||||
xbmcvfs.rename(torrentFile, newFile)
|
xbmcvfs.rename(torrentFile, newFile)
|
||||||
except Exception, e:
|
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
|
return
|
||||||
self.torrentFile = newFile
|
self.torrentFile = newFile
|
||||||
if not self.torrentFileInfo:
|
if not self.torrentFileInfo:
|
||||||
|
@ -278,10 +286,10 @@ class Libtorrent:
|
||||||
return filelist
|
return filelist
|
||||||
except:
|
except:
|
||||||
xbmcgui.Dialog().ok(Localization.localize('Python-Libtorrent Not Found'),
|
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
|
return
|
||||||
|
|
||||||
|
|
||||||
def getSubsIds(self, filename):
|
def getSubsIds(self, filename):
|
||||||
subs = []
|
subs = []
|
||||||
for i in self.getContentList():
|
for i in self.getContentList():
|
||||||
|
@ -320,7 +328,8 @@ class Libtorrent:
|
||||||
path = os.path.join(self.storageDirectory, title)
|
path = os.path.join(self.storageDirectory, title)
|
||||||
type = 'folder'
|
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)
|
get = db.get(title)
|
||||||
if add or get[5] == 'stopped':
|
if add or get[5] == 'stopped':
|
||||||
if get[5] == 'stopped':
|
if get[5] == 'stopped':
|
||||||
|
|
13
Player.py
13
Player.py
|
@ -13,7 +13,6 @@ import xbmcvfs
|
||||||
import Localization
|
import Localization
|
||||||
from functions import calculate, showMessage, clearStorage, DownloadDB, get_ids_video
|
from functions import calculate, showMessage, clearStorage, DownloadDB, get_ids_video
|
||||||
|
|
||||||
|
|
||||||
ROOT = sys.modules["__main__"].__root__
|
ROOT = sys.modules["__main__"].__root__
|
||||||
RESOURCES_PATH = os.path.join(ROOT, 'resources')
|
RESOURCES_PATH = os.path.join(ROOT, 'resources')
|
||||||
TORRENT2HTTP_TIMEOUT = 20
|
TORRENT2HTTP_TIMEOUT = 20
|
||||||
|
@ -178,10 +177,12 @@ class TorrentPlayer(xbmc.Player):
|
||||||
|
|
||||||
def setup_torrent(self):
|
def setup_torrent(self):
|
||||||
self.torrent.startSession()
|
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):
|
if 0 < int(upload_limit):
|
||||||
self.torrent.setUploadLimit(int(upload_limit) * 1000000 / 8) # MBits/second
|
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):
|
if 0 < int(download_limit):
|
||||||
self.torrent.setDownloadLimit(
|
self.torrent.setDownloadLimit(
|
||||||
int(download_limit) * 1000000 / 8) # MBits/second
|
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"):
|
if self.get("label") and self.episodeId == self.get("episodeId"):
|
||||||
label = urllib.unquote_plus(self.get("label"))
|
label = urllib.unquote_plus(self.get("label"))
|
||||||
elif seasonId and self.episodeId and title:
|
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:
|
if seasonId and self.episodeId and label and title:
|
||||||
listitem = xbmcgui.ListItem(label, path=path)
|
listitem = xbmcgui.ListItem(label, path=path)
|
||||||
|
@ -377,7 +379,8 @@ class TorrentPlayer(xbmc.Player):
|
||||||
self.seed(self.contentId)
|
self.seed(self.contentId)
|
||||||
self.seeding_status = True
|
self.seeding_status = True
|
||||||
# xbmc.sleep(7000)
|
# 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'),
|
showMessage(Localization.localize('Torrent Downloading'),
|
||||||
Localization.localize('Starting download next episode!'), forced=True)
|
Localization.localize('Starting download next episode!'), forced=True)
|
||||||
self.torrent.stopSession()
|
self.torrent.stopSession()
|
||||||
|
|
4
cal.py
4
cal.py
|
@ -1,7 +1,7 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import sys
|
import sys
|
||||||
import os, json, re
|
import os
|
||||||
from BeautifulSoup import BeautifulSoup
|
import re
|
||||||
|
|
||||||
ROOT = os.path.dirname(sys.modules["__main__"].sys.argv[0])
|
ROOT = os.path.dirname(sys.modules["__main__"].sys.argv[0])
|
||||||
searcherObject = {}
|
searcherObject = {}
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import xbmcaddon
|
import sys
|
||||||
import xbmc, sys
|
|
||||||
from functions import getParameters, HistoryDB
|
|
||||||
|
|
||||||
|
import xbmcaddon
|
||||||
|
import xbmc
|
||||||
|
from functions import getParameters, HistoryDB
|
||||||
from resources.pyxbmct.addonwindow import *
|
from resources.pyxbmct.addonwindow import *
|
||||||
from functions import Searchers
|
from functions import Searchers
|
||||||
|
|
||||||
|
|
||||||
__settings__ = xbmcaddon.Addon(id='plugin.video.torrenter')
|
__settings__ = xbmcaddon.Addon(id='plugin.video.torrenter')
|
||||||
__language__ = __settings__.getLocalizedString
|
__language__ = __settings__.getLocalizedString
|
||||||
__version__ = __settings__.getAddonInfo('version')
|
__version__ = __settings__.getAddonInfo('version')
|
||||||
|
@ -21,6 +21,7 @@ if len(sys.argv)>1:
|
||||||
else:
|
else:
|
||||||
params = {}
|
params = {}
|
||||||
|
|
||||||
|
|
||||||
class MyAddon(AddonDialogWindow):
|
class MyAddon(AddonDialogWindow):
|
||||||
def __init__(self, title=''):
|
def __init__(self, title=''):
|
||||||
super(MyAddon, self).__init__(title)
|
super(MyAddon, self).__init__(title)
|
||||||
|
|
47
functions.py
47
functions.py
|
@ -19,7 +19,6 @@ import xbmcvfs
|
||||||
import Localization
|
import Localization
|
||||||
from resources.scrapers.scrapers import Scrapers
|
from resources.scrapers.scrapers import Scrapers
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from hashlib import md5
|
from hashlib import md5
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
@ -264,6 +263,7 @@ def calculate(full):
|
||||||
|
|
||||||
return repl_const
|
return repl_const
|
||||||
|
|
||||||
|
|
||||||
def getDirList(path, newl=None):
|
def getDirList(path, newl=None):
|
||||||
l = []
|
l = []
|
||||||
try:
|
try:
|
||||||
|
@ -396,6 +396,7 @@ def cutFolder(contentList, tdir=None):
|
||||||
else:
|
else:
|
||||||
return dirList, contentList
|
return dirList, contentList
|
||||||
|
|
||||||
|
|
||||||
def sweetpair(l):
|
def sweetpair(l):
|
||||||
from difflib import SequenceMatcher
|
from difflib import SequenceMatcher
|
||||||
|
|
||||||
|
@ -836,6 +837,7 @@ class TimeOut():
|
||||||
# Debug('[TimeOut]: '+str(to))
|
# Debug('[TimeOut]: '+str(to))
|
||||||
return to
|
return to
|
||||||
|
|
||||||
|
|
||||||
class ListDB:
|
class ListDB:
|
||||||
def __init__(self, version=1.0):
|
def __init__(self, version=1.0):
|
||||||
self.dbname = 'list' + '.db3'
|
self.dbname = 'list' + '.db3'
|
||||||
|
@ -1034,6 +1036,7 @@ class HistoryDB:
|
||||||
self.cur.close()
|
self.cur.close()
|
||||||
self.db.close()
|
self.db.close()
|
||||||
|
|
||||||
|
|
||||||
class Searchers():
|
class Searchers():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
@ -1341,6 +1344,7 @@ def fetchData(url, referer=None):
|
||||||
print " fetchData(" + url + ") exception: " + str(e)
|
print " fetchData(" + url + ") exception: " + str(e)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
def file_decode(filename):
|
def file_decode(filename):
|
||||||
if not __settings__.getSetting('delete_russian') == 'true':
|
if not __settings__.getSetting('delete_russian') == 'true':
|
||||||
try:
|
try:
|
||||||
|
@ -1349,18 +1353,21 @@ def file_decode(filename):
|
||||||
pass
|
pass
|
||||||
return filename
|
return filename
|
||||||
|
|
||||||
|
|
||||||
def file_encode(filename):
|
def file_encode(filename):
|
||||||
if not __settings__.getSetting('delete_russian') == 'true':
|
if not __settings__.getSetting('delete_russian') == 'true':
|
||||||
if sys.getfilesystemencoding() == 'mbcs' and isAsciiString(filename):
|
if sys.getfilesystemencoding() == 'mbcs' and isAsciiString(filename):
|
||||||
filename = filename.decode('cp1251').encode('utf-8')
|
filename = filename.decode('cp1251').encode('utf-8')
|
||||||
return filename
|
return filename
|
||||||
|
|
||||||
|
|
||||||
def isAsciiString(mediaName):
|
def isAsciiString(mediaName):
|
||||||
for index, char in enumerate(mediaName):
|
for index, char in enumerate(mediaName):
|
||||||
if ord(char) >= 128:
|
if ord(char) >= 128:
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def getParameters(parameterString):
|
def getParameters(parameterString):
|
||||||
commands = {}
|
commands = {}
|
||||||
splitCommands = parameterString[parameterString.find('?') + 1:].split('&')
|
splitCommands = parameterString[parameterString.find('?') + 1:].split('&')
|
||||||
|
@ -1373,6 +1380,7 @@ def getParameters(parameterString):
|
||||||
commands[name] = value
|
commands[name] = value
|
||||||
return commands
|
return commands
|
||||||
|
|
||||||
|
|
||||||
def isSubtitle(filename, filename2):
|
def isSubtitle(filename, filename2):
|
||||||
filename_if = filename[:len(filename) - len(filename.split('.')[-1]) - 1]
|
filename_if = filename[:len(filename) - len(filename.split('.')[-1]) - 1]
|
||||||
filename_if = filename_if.split('/')[-1].split('\\')[-1]
|
filename_if = filename_if.split('/')[-1].split('\\')[-1]
|
||||||
|
@ -1384,6 +1392,7 @@ def isSubtitle(filename, filename2):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def delete_russian(ok=False, action='delete'):
|
def delete_russian(ok=False, action='delete'):
|
||||||
i = 0
|
i = 0
|
||||||
if not ok:
|
if not ok:
|
||||||
|
@ -1393,7 +1402,8 @@ def delete_russian(ok=False, action='delete'):
|
||||||
if ok:
|
if ok:
|
||||||
fileList = {
|
fileList = {
|
||||||
'contenters': ['CXZ.py', 'FastTorrent.py', 'KinoPoisk.py', 'RiperAM.py'],
|
'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():
|
for path in fileList.keys():
|
||||||
|
@ -1418,6 +1428,7 @@ def delete_russian(ok=False, action='delete'):
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
class DownloadDB:
|
class DownloadDB:
|
||||||
def __init__(self, version=1.41):
|
def __init__(self, version=1.41):
|
||||||
self.name = 'download.db3'
|
self.name = 'download.db3'
|
||||||
|
@ -1426,26 +1437,32 @@ class DownloadDB:
|
||||||
def get_all(self):
|
def get_all(self):
|
||||||
self._connect()
|
self._connect()
|
||||||
try:
|
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:
|
except:
|
||||||
Debug('[DownloadDB]: DELETE ' + str(self.filename))
|
Debug('[DownloadDB]: DELETE ' + str(self.filename))
|
||||||
xbmcvfs.delete(self.filename)
|
xbmcvfs.delete(self.filename)
|
||||||
self._connect()
|
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()
|
x = self.cur.fetchall()
|
||||||
self._close()
|
self._close()
|
||||||
return x if x else None
|
return x if x else None
|
||||||
|
|
||||||
def get(self, title):
|
def get(self, title):
|
||||||
self._connect()
|
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()
|
x = self.cur.fetchone()
|
||||||
self._close()
|
self._close()
|
||||||
return x if x else None
|
return x if x else None
|
||||||
|
|
||||||
def get_byaddtime(self, addtime):
|
def get_byaddtime(self, addtime):
|
||||||
self._connect()
|
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()
|
x = self.cur.fetchone()
|
||||||
self._close()
|
self._close()
|
||||||
return x if x else None
|
return x if x else None
|
||||||
|
@ -1460,8 +1477,11 @@ class DownloadDB:
|
||||||
def add(self, title, path, type, info, status, torrent, ind, storage):
|
def add(self, title, path, type, info, status, torrent, ind, storage):
|
||||||
if not self.get(title):
|
if not self.get(title):
|
||||||
self._connect()
|
self._connect()
|
||||||
self.cur.execute('insert into downloads(addtime, title, path, type, jsoninfo, status, torrent, ind, lastupdate, storage)'
|
self.cur.execute(
|
||||||
' values(?,?,?,?,?,?,?,?,?,?)', (int(time.time()), decode(title), decode(path), type, json.dumps(info), status, decode(torrent), ind, int(time.time()), decode(storage)))
|
'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.db.commit()
|
||||||
self._close()
|
self._close()
|
||||||
return True
|
return True
|
||||||
|
@ -1474,7 +1494,9 @@ class DownloadDB:
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
self._connect()
|
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.db.commit()
|
||||||
self._close()
|
self._close()
|
||||||
|
|
||||||
|
@ -1542,6 +1564,7 @@ class DownloadDB:
|
||||||
self.cur.close()
|
self.cur.close()
|
||||||
self.db.close()
|
self.db.close()
|
||||||
|
|
||||||
|
|
||||||
def decode(string, ret=None):
|
def decode(string, ret=None):
|
||||||
try:
|
try:
|
||||||
string = string.decode('utf-8')
|
string = string.decode('utf-8')
|
||||||
|
@ -1552,6 +1575,7 @@ def decode(string, ret=None):
|
||||||
else:
|
else:
|
||||||
return string
|
return string
|
||||||
|
|
||||||
|
|
||||||
def unquote(string, ret=None):
|
def unquote(string, ret=None):
|
||||||
try:
|
try:
|
||||||
return urllib.unquote_plus(string)
|
return urllib.unquote_plus(string)
|
||||||
|
@ -1561,6 +1585,7 @@ def unquote(string, ret=None):
|
||||||
else:
|
else:
|
||||||
return string
|
return string
|
||||||
|
|
||||||
|
|
||||||
def itemScrap(item, kwarg):
|
def itemScrap(item, kwarg):
|
||||||
# Debug('[itemTVDB]:meta '+str(kwarg))
|
# Debug('[itemTVDB]:meta '+str(kwarg))
|
||||||
if 'title' in kwarg and kwarg['title']:
|
if 'title' in kwarg and kwarg['title']:
|
||||||
|
@ -1584,9 +1609,11 @@ def itemScrap(item, kwarg):
|
||||||
|
|
||||||
return item
|
return item
|
||||||
|
|
||||||
|
|
||||||
def get_ids_video(contentList):
|
def get_ids_video(contentList):
|
||||||
ids_video = []
|
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']
|
allowed_music_ext = ['mp3', 'flac', 'wma', 'ogg', 'm4a', 'aac', 'm4p', 'rm', 'ra']
|
||||||
for extlist in [allowed_video_ext, allowed_music_ext]:
|
for extlist in [allowed_video_ext, allowed_music_ext]:
|
||||||
for title, identifier in contentList:
|
for title, identifier in contentList:
|
||||||
|
|
64
platform.py
64
platform.py
|
@ -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()
|
|
|
@ -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()
|
|
@ -18,7 +18,10 @@
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import Content, re
|
import re
|
||||||
|
|
||||||
|
import Content
|
||||||
|
|
||||||
|
|
||||||
class EZTV(Content.Content):
|
class EZTV(Content.Content):
|
||||||
category_dict = {
|
category_dict = {
|
||||||
|
|
|
@ -18,18 +18,23 @@
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
'''
|
'''
|
||||||
import re
|
import re
|
||||||
|
|
||||||
import Content
|
import Content
|
||||||
from BeautifulSoup import BeautifulSoup
|
from BeautifulSoup import BeautifulSoup
|
||||||
|
|
||||||
|
|
||||||
class KickAssSo(Content.Content):
|
class KickAssSo(Content.Content):
|
||||||
category_dict = {
|
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'}]}),
|
' ': [{'name': ' ', 'url_after': '?field=seeders&sorder=desc'}]}),
|
||||||
'anime': ('Anime', '/anime/', {'page': '/anime/%d/', 'increase': 1, 'second_page': 2,
|
'anime': ('Anime', '/anime/', {'page': '/anime/%d/', 'increase': 1, 'second_page': 2,
|
||||||
' ': [{'name': ' ', 'url_after': '?field=seeders&sorder=desc'}]}),
|
' ': [{'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'}]}),
|
' ': [{'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'}]}),
|
' ': [{'name': ' ', 'url_after': '?field=seeders&sorder=desc'}]}),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,7 +104,8 @@ class KickAssSo(Content.Content):
|
||||||
info['infolink'] = self.baseurl + infolink
|
info['infolink'] = self.baseurl + infolink
|
||||||
size = self.unescape(self.stripHtml(size))
|
size = self.unescape(self.stripHtml(size))
|
||||||
date = self.unescape(self.stripHtml(date))
|
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((
|
contentList.append((
|
||||||
int(int(self.sourceWeight) * (int(num))),
|
int(int(self.sourceWeight) * (int(num))),
|
||||||
|
@ -118,7 +124,8 @@ class KickAssSo(Content.Content):
|
||||||
if not result:
|
if not result:
|
||||||
return None
|
return None
|
||||||
li = result.findAll('li')
|
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:
|
try:
|
||||||
img = result.find('a', {'class': 'movieCover'}).find('img').get('src')
|
img = result.find('a', {'class': 'movieCover'}).find('img').get('src')
|
||||||
movieInfo['poster'] = 'http:' + img
|
movieInfo['poster'] = 'http:' + img
|
||||||
|
@ -152,7 +159,8 @@ class KickAssSo(Content.Content):
|
||||||
if not 'plot' in info and 'Summary' in key:
|
if not 'plot' in info and 'Summary' in key:
|
||||||
info['plot'] = info[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 ['']:
|
if info.get(i) and info.get(i) not in ['']:
|
||||||
movieInfo['desc'] += color % (i, info.get(i))
|
movieInfo['desc'] += color % (i, info.get(i))
|
||||||
if i == 'Movie':
|
if i == 'Movie':
|
||||||
|
|
|
@ -17,32 +17,38 @@
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
'''
|
'''
|
||||||
import re
|
|
||||||
import Content
|
import Content
|
||||||
from BeautifulSoup import BeautifulSoup
|
from BeautifulSoup import BeautifulSoup
|
||||||
|
|
||||||
|
|
||||||
class SWESUB(Content.Content):
|
class SWESUB(Content.Content):
|
||||||
category_dict = {
|
category_dict = {
|
||||||
'tvshows': ('TV Shows', '/senaste-tv-serier/', {'page': '/senaste-tv-serier/?page=%d',
|
'tvshows': ('TV Shows', '/senaste-tv-serier/', {'page': '/senaste-tv-serier/?page=%d',
|
||||||
'increase': 1, 'second_page': 2, }),
|
'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',
|
'genre': {'genre': 'by Genre',
|
||||||
'action': ('Action', '/action/', {'page': '/action/?page=%d', 'increase': 1, 'second_page': 2, }),
|
'action': ('Action', '/action/', {'page': '/action/?page=%d', 'increase': 1, 'second_page': 2, }),
|
||||||
'adventure': ('Adventure', '/aventyr/', {'page': '/aventyr/?page=%d', 'increase': 1, 'second_page': 2,}),
|
'adventure': (
|
||||||
'animation': ('Animation', '/animerat/', {'page': '/animerat/?page=%d', 'increase': 1, 'second_page': 2,}),
|
'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, }),
|
'comedy': ('Comedy', '/komedi/', {'page': '/komedi/?page=%d', 'increase': 1, 'second_page': 2, }),
|
||||||
'crime': ('Crime', '/kriminal/', {'page': '/kriminal/?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, }),
|
'drama': ('Drama', '/drama/', {'page': '/drama/?page=%d', 'increase': 1, 'second_page': 2, }),
|
||||||
'family': ('Family', '/familj/', {'page': '/familj/?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, }),
|
'fantasy': ('Fantasy', '/fantasy/', {'page': '/fantasy/?page=%d', 'increase': 1, 'second_page': 2, }),
|
||||||
'horror': ('Horror', '/skrack/', {'page': '/skrack/?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, }),
|
'music': ('Music', '/dans/', {'page': '/dans/?page=%d', 'increase': 1, 'second_page': 2, }),
|
||||||
'musical': ('Musical', '/musikal/', {'page': '/musikal/?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, }),
|
'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, }),
|
'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, }),
|
'war': ('War', '/krig/', {'page': '/krig/?page=%d', 'increase': 1, 'second_page': 2, }),
|
||||||
'western': ('Western', '/western/', {'page': '/western/?page=%d', 'increase': 1, 'second_page': 2, }),
|
'western': ('Western', '/western/', {'page': '/western/?page=%d', 'increase': 1, 'second_page': 2, }),
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,8 +18,10 @@
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
'''
|
'''
|
||||||
import re
|
import re
|
||||||
|
|
||||||
import Content
|
import Content
|
||||||
|
|
||||||
|
|
||||||
class ThePirateBaySe(Content.Content):
|
class ThePirateBaySe(Content.Content):
|
||||||
category_dict = {
|
category_dict = {
|
||||||
'tvshows': ('TV Shows', '/browse/205', {'page': '/browse/208/%d', 'increase': 1, 'second_page': 1,
|
'tvshows': ('TV Shows', '/browse/205', {'page': '/browse/208/%d', 'increase': 1, 'second_page': 1,
|
||||||
|
|
|
@ -11,7 +11,10 @@
|
||||||
# PyXBMCt framework module
|
# PyXBMCt framework module
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import xbmc, xbmcgui, xbmcaddon
|
|
||||||
|
import xbmc
|
||||||
|
import xbmcgui
|
||||||
|
|
||||||
|
|
||||||
# _addon = xbmcaddon.Addon()
|
# _addon = xbmcaddon.Addon()
|
||||||
_images = os.path.join(os.path.dirname(__file__), 'textures', 'default')
|
_images = os.path.join(os.path.dirname(__file__), 'textures', 'default')
|
||||||
|
@ -82,6 +85,7 @@ class Label(xbmcgui.ControlLabel):
|
||||||
Example:
|
Example:
|
||||||
self.label = Label('Status', angle=45)
|
self.label = Label('Status', angle=45)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __new__(cls, *args, **kwargs):
|
def __new__(cls, *args, **kwargs):
|
||||||
return super(Label, cls).__new__(cls, -10, -10, 1, 1, *args, **kwargs)
|
return super(Label, cls).__new__(cls, -10, -10, 1, 1, *args, **kwargs)
|
||||||
|
|
||||||
|
@ -100,6 +104,7 @@ class FadeLabel(xbmcgui.ControlFadeLabel):
|
||||||
Example:
|
Example:
|
||||||
self.fadelabel = FadeLabel(textColor='0xFFFFFFFF')
|
self.fadelabel = FadeLabel(textColor='0xFFFFFFFF')
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __new__(cls, *args, **kwargs):
|
def __new__(cls, *args, **kwargs):
|
||||||
return super(FadeLabel, cls).__new__(cls, -10, -10, 1, 1, *args, **kwargs)
|
return super(FadeLabel, cls).__new__(cls, -10, -10, 1, 1, *args, **kwargs)
|
||||||
|
|
||||||
|
@ -117,6 +122,7 @@ class TextBox(xbmcgui.ControlTextBox):
|
||||||
Example:
|
Example:
|
||||||
self.textbox = TextBox(textColor='0xFFFFFFFF')
|
self.textbox = TextBox(textColor='0xFFFFFFFF')
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __new__(cls, *args, **kwargs):
|
def __new__(cls, *args, **kwargs):
|
||||||
return super(TextBox, cls).__new__(cls, -10, -10, 1, 1, *args, **kwargs)
|
return super(TextBox, cls).__new__(cls, -10, -10, 1, 1, *args, **kwargs)
|
||||||
|
|
||||||
|
@ -136,6 +142,7 @@ class Image(xbmcgui.ControlImage):
|
||||||
Example:
|
Example:
|
||||||
self.image = Image('d:\images\picture.jpg', aspectRatio=2)
|
self.image = Image('d:\images\picture.jpg', aspectRatio=2)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __new__(cls, *args, **kwargs):
|
def __new__(cls, *args, **kwargs):
|
||||||
return super(Image, cls).__new__(cls, -10, -10, 1, 1, *args, **kwargs)
|
return super(Image, cls).__new__(cls, -10, -10, 1, 1, *args, **kwargs)
|
||||||
|
|
||||||
|
@ -163,6 +170,7 @@ class Button(xbmcgui.ControlButton):
|
||||||
Example:
|
Example:
|
||||||
self.button = Button('Status', font='font14')
|
self.button = Button('Status', font='font14')
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __new__(cls, *args, **kwargs):
|
def __new__(cls, *args, **kwargs):
|
||||||
textures = {'focusTexture': os.path.join(_images, 'Button', 'KeyboardKey.png'),
|
textures = {'focusTexture': os.path.join(_images, 'Button', 'KeyboardKey.png'),
|
||||||
'noFocusTexture': os.path.join(_images, 'Button', 'KeyboardKeyNF.png')}
|
'noFocusTexture': os.path.join(_images, 'Button', 'KeyboardKeyNF.png')}
|
||||||
|
@ -202,6 +210,7 @@ class RadioButton(xbmcgui.ControlRadioButton):
|
||||||
Example:
|
Example:
|
||||||
self.radiobutton = RadioButton('Status', font='font14')
|
self.radiobutton = RadioButton('Status', font='font14')
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __new__(cls, *args, **kwargs):
|
def __new__(cls, *args, **kwargs):
|
||||||
if int(xbmc.getInfoLabel('System.BuildVersion')[:2]) >= 13:
|
if int(xbmc.getInfoLabel('System.BuildVersion')[:2]) >= 13:
|
||||||
textures = {'focusTexture': os.path.join(_images, 'RadioButton', 'MenuItemFO.png'),
|
textures = {'focusTexture': os.path.join(_images, 'RadioButton', 'MenuItemFO.png'),
|
||||||
|
@ -242,6 +251,7 @@ class Edit(xbmcgui.ControlEdit):
|
||||||
example:
|
example:
|
||||||
- self.edit = Edit('Status')
|
- self.edit = Edit('Status')
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __new__(cls, *args, **kwargs):
|
def __new__(cls, *args, **kwargs):
|
||||||
textures = {'focusTexture': os.path.join(_images, 'Edit', 'button-focus.png'),
|
textures = {'focusTexture': os.path.join(_images, 'Edit', 'button-focus.png'),
|
||||||
'noFocusTexture': os.path.join(_images, 'Edit', 'black-back2.png')}
|
'noFocusTexture': os.path.join(_images, 'Edit', 'black-back2.png')}
|
||||||
|
@ -272,6 +282,7 @@ class List(xbmcgui.ControlList):
|
||||||
Example:
|
Example:
|
||||||
self.cList = List('font14', space=5)
|
self.cList = List('font14', space=5)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __new__(cls, *args, **kwargs):
|
def __new__(cls, *args, **kwargs):
|
||||||
textures = {'buttonTexture': os.path.join(_images, 'List', 'MenuItemNF.png'),
|
textures = {'buttonTexture': os.path.join(_images, 'List', 'MenuItemNF.png'),
|
||||||
'buttonFocusTexture': os.path.join(_images, 'List', 'MenuItemFO.png')}
|
'buttonFocusTexture': os.path.join(_images, 'List', 'MenuItemFO.png')}
|
||||||
|
@ -293,6 +304,7 @@ class Slider(xbmcgui.ControlSlider):
|
||||||
Example:
|
Example:
|
||||||
self.slider = Slider()
|
self.slider = Slider()
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __new__(cls, *args, **kwargs):
|
def __new__(cls, *args, **kwargs):
|
||||||
textures = {'textureback': os.path.join(_images, 'Slider', 'osd_slider_bg.png'),
|
textures = {'textureback': os.path.join(_images, 'Slider', 'osd_slider_bg.png'),
|
||||||
'texture': os.path.join(_images, 'Slider', 'osd_slider_nibNF.png'),
|
'texture': os.path.join(_images, 'Slider', 'osd_slider_nibNF.png'),
|
||||||
|
@ -302,7 +314,6 @@ class Slider(xbmcgui.ControlSlider):
|
||||||
|
|
||||||
|
|
||||||
class _AbstractWindow(object):
|
class _AbstractWindow(object):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Top-level control window.
|
Top-level control window.
|
||||||
|
|
||||||
|
@ -525,7 +536,6 @@ class _AbstractWindow(object):
|
||||||
|
|
||||||
|
|
||||||
class _AddonWindow(_AbstractWindow):
|
class _AddonWindow(_AbstractWindow):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Top-level control window.
|
Top-level control window.
|
||||||
|
|
||||||
|
@ -574,8 +584,10 @@ class _AddonWindow(_AbstractWindow):
|
||||||
self.addControl(self.title_bar)
|
self.addControl(self.title_bar)
|
||||||
self.setAnimation(self.title_bar)
|
self.setAnimation(self.title_bar)
|
||||||
self.window_close_button = xbmcgui.ControlButton(-100, -100, 60, 30, '',
|
self.window_close_button = xbmcgui.ControlButton(-100, -100, 60, 30, '',
|
||||||
focusTexture=os.path.join(_images, 'AddonWindow', 'DialogCloseButton-focus.png'),
|
focusTexture=os.path.join(_images, 'AddonWindow',
|
||||||
noFocusTexture=os.path.join(_images, 'AddonWindow', 'DialogCloseButton.png'))
|
'DialogCloseButton-focus.png'),
|
||||||
|
noFocusTexture=os.path.join(_images, 'AddonWindow',
|
||||||
|
'DialogCloseButton.png'))
|
||||||
self.addControl(self.window_close_button)
|
self.addControl(self.window_close_button)
|
||||||
self.setAnimation(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.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_width = (self.width - 2 * (self.X_MARGIN + self.win_padding)) / self.columns
|
||||||
self.tile_height = (
|
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=''):
|
def setWindowTitle(self, title=''):
|
||||||
"""
|
"""
|
||||||
|
@ -632,8 +645,8 @@ class _AddonWindow(_AbstractWindow):
|
||||||
"""Get window title."""
|
"""Get window title."""
|
||||||
return self.title_bar.getLabel()
|
return self.title_bar.getLabel()
|
||||||
|
|
||||||
class _FullWindow(xbmcgui.Window):
|
|
||||||
|
|
||||||
|
class _FullWindow(xbmcgui.Window):
|
||||||
"""An abstract class to define window event processing."""
|
"""An abstract class to define window event processing."""
|
||||||
|
|
||||||
def onAction(self, action):
|
def onAction(self, action):
|
||||||
|
@ -659,7 +672,6 @@ class _FullWindow(xbmcgui.Window):
|
||||||
|
|
||||||
|
|
||||||
class _DialogWindow(xbmcgui.WindowDialog):
|
class _DialogWindow(xbmcgui.WindowDialog):
|
||||||
|
|
||||||
"""An abstract class to define window event processing."""
|
"""An abstract class to define window event processing."""
|
||||||
|
|
||||||
def onAction(self, action):
|
def onAction(self, action):
|
||||||
|
@ -718,8 +730,8 @@ class BlankDialogWindow(_DialogWindow, _AbstractWindow):
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class AddonFullWindow(_FullWindow, _AddonWindow):
|
|
||||||
|
|
||||||
|
class AddonFullWindow(_FullWindow, _AddonWindow):
|
||||||
"""
|
"""
|
||||||
Addon UI container with a solid background.
|
Addon UI container with a solid background.
|
||||||
Control window is displayed on top of the main background image - self.main_bg.
|
Control window is displayed on top of the main background image - self.main_bg.
|
||||||
|
|
|
@ -12,7 +12,6 @@ import xbmcgui
|
||||||
import Localization
|
import Localization
|
||||||
from net import HTTP
|
from net import HTTP
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from sqlite3 import dbapi2 as sqlite
|
from sqlite3 import dbapi2 as sqlite
|
||||||
except:
|
except:
|
||||||
|
|
|
@ -27,10 +27,8 @@ import math
|
||||||
import difflib
|
import difflib
|
||||||
|
|
||||||
import translit
|
import translit
|
||||||
import LOGGER as Log
|
|
||||||
from HTTP import *
|
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_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'
|
# 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'
|
ENCODING_PLEX = 'utf-8'
|
||||||
|
|
|
@ -32,6 +32,8 @@ import pluginsettings as S
|
||||||
import translit
|
import translit
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# MATCHER_MOVIE_DURATION = re.compile('\s*(\d+).*?', re.UNICODE | re.DOTALL)
|
# 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*\(\s*([\s\d]+)\s*\)', re.UNICODE | re.DOTALL)
|
||||||
# MATCHER_IMDB_RATING = re.compile('IMDb:\s*(\d+\.?\d*)\s?\((.*)\)', re.UNICODE)
|
# MATCHER_IMDB_RATING = re.compile('IMDb:\s*(\d+\.?\d*)\s?\((.*)\)', re.UNICODE)
|
||||||
|
@ -171,5 +173,3 @@ class PageParser:
|
||||||
results.append([itemKinoPoiskId, itemTitle, itemYear, itemScore])
|
results.append([itemKinoPoiskId, itemTitle, itemYear, itemScore])
|
||||||
|
|
||||||
return results
|
return results
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -22,8 +22,6 @@ Simple transliteration
|
||||||
# __url__ = "$URL: https://pythy.googlecode.com/svn/tags/pytils/0_2_2/pytils/translit.py $"
|
# __url__ = "$URL: https://pythy.googlecode.com/svn/tags/pytils/0_2_2/pytils/translit.py $"
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import sys
|
|
||||||
|
|
||||||
|
|
||||||
TRANSTABLE = (
|
TRANSTABLE = (
|
||||||
(u"'", u"'"),
|
(u"'", u"'"),
|
||||||
|
|
|
@ -11,7 +11,6 @@ import kinopoisk.LOGGER
|
||||||
import kinopoisk.pageparser
|
import kinopoisk.pageparser
|
||||||
import kinopoisk.common
|
import kinopoisk.common
|
||||||
|
|
||||||
|
|
||||||
GENRE = {
|
GENRE = {
|
||||||
'anime': 1750,
|
'anime': 1750,
|
||||||
'biography': 22,
|
'biography': 22,
|
||||||
|
@ -463,7 +462,8 @@ class KinoPoisk:
|
||||||
if len(data) == 3:
|
if len(data) == 3:
|
||||||
i = 0
|
i = 0
|
||||||
for mon in (
|
for mon in (
|
||||||
u'января', u'февраля', u'марта', u'апреля', u'мая', u'июня', u'июля', u'августа', u'сентября',
|
u'января', u'февраля', u'марта', u'апреля', u'мая', u'июня', u'июля', u'августа',
|
||||||
|
u'сентября',
|
||||||
u'октября', u'ноября', u'декабря'):
|
u'октября', u'ноября', u'декабря'):
|
||||||
i += 1
|
i += 1
|
||||||
if mon == data[1]:
|
if mon == data[1]:
|
||||||
|
|
|
@ -12,10 +12,8 @@ import itertools
|
||||||
|
|
||||||
import xbmc
|
import xbmc
|
||||||
import xbmcgui
|
import xbmcgui
|
||||||
import xbmcaddon
|
|
||||||
import xbmcvfs
|
import xbmcvfs
|
||||||
|
|
||||||
|
|
||||||
RE = {
|
RE = {
|
||||||
'content-disposition': re.compile('attachment;\sfilename="*([^"\s]+)"|\s')
|
'content-disposition': re.compile('attachment;\sfilename="*([^"\s]+)"|\s')
|
||||||
}
|
}
|
||||||
|
@ -34,7 +32,6 @@ class HTTP:
|
||||||
if not xbmcvfs.exists(self._dirname):
|
if not xbmcvfs.exists(self._dirname):
|
||||||
xbmcvfs.mkdir(self._dirname)
|
xbmcvfs.mkdir(self._dirname)
|
||||||
|
|
||||||
|
|
||||||
def fetch(self, request, **kwargs):
|
def fetch(self, request, **kwargs):
|
||||||
self.con, self.fd, self.progress, self.cookies, self.request = None, None, None, None, request
|
self.con, self.fd, self.progress, self.cookies, self.request = None, None, None, None, request
|
||||||
|
|
||||||
|
@ -74,7 +71,6 @@ class HTTP:
|
||||||
|
|
||||||
return self.response
|
return self.response
|
||||||
|
|
||||||
|
|
||||||
def _opener(self):
|
def _opener(self):
|
||||||
|
|
||||||
build = [urllib2.HTTPHandler()]
|
build = [urllib2.HTTPHandler()]
|
||||||
|
@ -101,7 +97,6 @@ class HTTP:
|
||||||
|
|
||||||
urllib2.install_opener(urllib2.build_opener(*build))
|
urllib2.install_opener(urllib2.build_opener(*build))
|
||||||
|
|
||||||
|
|
||||||
def _fetch(self):
|
def _fetch(self):
|
||||||
params = {} if self.request.params is None else self.request.params
|
params = {} if self.request.params is None else self.request.params
|
||||||
|
|
||||||
|
@ -141,7 +136,6 @@ class HTTP:
|
||||||
if self.request.cookies:
|
if self.request.cookies:
|
||||||
self.cookies.save(self.request.cookies)
|
self.cookies.save(self.request.cookies)
|
||||||
|
|
||||||
|
|
||||||
def _download(self):
|
def _download(self):
|
||||||
fd = open(self.request.download, 'wb')
|
fd = open(self.request.download, 'wb')
|
||||||
if self.request.progress:
|
if self.request.progress:
|
||||||
|
@ -173,7 +167,6 @@ class HTTP:
|
||||||
|
|
||||||
self.response.filename = self.request.download
|
self.response.filename = self.request.download
|
||||||
|
|
||||||
|
|
||||||
def _upload(self, upload, params):
|
def _upload(self, upload, params):
|
||||||
res = []
|
res = []
|
||||||
boundary = mimetools.choose_boundary()
|
boundary = mimetools.choose_boundary()
|
||||||
|
@ -209,7 +202,6 @@ class HTTP:
|
||||||
result.append('')
|
result.append('')
|
||||||
return boundary, '\r\n'.join(result)
|
return boundary, '\r\n'.join(result)
|
||||||
|
|
||||||
|
|
||||||
def _headers(self, raw):
|
def _headers(self, raw):
|
||||||
headers = {}
|
headers = {}
|
||||||
for line in raw.headers:
|
for line in raw.headers:
|
||||||
|
@ -221,7 +213,6 @@ class HTTP:
|
||||||
headers[tag] = value
|
headers[tag] = value
|
||||||
return headers
|
return headers
|
||||||
|
|
||||||
|
|
||||||
def _progress(self, read, size, name):
|
def _progress(self, read, size, name):
|
||||||
res = []
|
res = []
|
||||||
if size < 0:
|
if size < 0:
|
||||||
|
@ -304,4 +295,3 @@ class HTTPResponse:
|
||||||
else:
|
else:
|
||||||
args += ',body=None'
|
args += ',body=None'
|
||||||
return '%s(%s)' % (self.__class__.__name__, args)
|
return '%s(%s)' % (self.__class__.__name__, args)
|
||||||
|
|
||||||
|
|
|
@ -383,7 +383,6 @@ def get_unicode_from_response(r):
|
||||||
except TypeError:
|
except TypeError:
|
||||||
return r.content
|
return r.content
|
||||||
|
|
||||||
|
|
||||||
# The unreserved URI characters (RFC 3986)
|
# The unreserved URI characters (RFC 3986)
|
||||||
UNRESERVED_SET = frozenset(
|
UNRESERVED_SET = frozenset(
|
||||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
|
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
|
||||||
|
@ -519,6 +518,7 @@ def should_bypass_proxies(url):
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def get_environ_proxies(url):
|
def get_environ_proxies(url):
|
||||||
"""Return a dict of environment proxies."""
|
"""Return a dict of environment proxies."""
|
||||||
if should_bypass_proxies(url):
|
if should_bypass_proxies(url):
|
||||||
|
@ -600,7 +600,6 @@ def parse_header_links(value):
|
||||||
|
|
||||||
return links
|
return links
|
||||||
|
|
||||||
|
|
||||||
# Null bytes; no need to recreate these on each call to guess_json_utf
|
# Null bytes; no need to recreate these on each call to guess_json_utf
|
||||||
_null = '\x00'.encode('ascii') # encoding to ASCII for Python 3
|
_null = '\x00'.encode('ascii') # encoding to ASCII for Python 3
|
||||||
_null2 = _null * 2
|
_null2 = _null * 2
|
||||||
|
|
|
@ -3,12 +3,10 @@
|
||||||
|
|
||||||
import re
|
import re
|
||||||
# import xbmc, xbmcgui, xbmcplugin, xbmcvfs
|
# import xbmc, xbmcgui, xbmcplugin, xbmcvfs
|
||||||
import xbmcaddon
|
|
||||||
from tvdb import TvDb
|
from tvdb import TvDb
|
||||||
from tmdbs import TmDb
|
from tmdbs import TmDb
|
||||||
from kinopoisks import KinoPoisk
|
from kinopoisks import KinoPoisk
|
||||||
|
|
||||||
|
|
||||||
STATUS = {
|
STATUS = {
|
||||||
'moder': (40501, 'FFFF0000'),
|
'moder': (40501, 'FFFF0000'),
|
||||||
'check': (40502, 'FFFF0000'),
|
'check': (40502, 'FFFF0000'),
|
||||||
|
|
|
@ -21,9 +21,6 @@
|
||||||
import urllib
|
import urllib
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
|
||||||
import os
|
|
||||||
import time
|
|
||||||
|
|
||||||
import SearcherABC
|
import SearcherABC
|
||||||
|
|
||||||
|
|
|
@ -19,9 +19,7 @@
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import os
|
|
||||||
import urllib
|
import urllib
|
||||||
import tempfile
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import SearcherABC
|
import SearcherABC
|
||||||
|
@ -70,7 +68,8 @@ class T411FR(SearcherABC.SearcherABC):
|
||||||
|
|
||||||
def search(self, keyword):
|
def search(self, keyword):
|
||||||
filesList = []
|
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'
|
url += '&order=seeders&type=desc'
|
||||||
response = self.makeRequest(url, headers=self.headers)
|
response = self.makeRequest(url, headers=self.headers)
|
||||||
if None != response and 0 < len(response):
|
if None != response and 0 < len(response):
|
||||||
|
|
|
@ -19,9 +19,7 @@
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import os
|
|
||||||
import urllib
|
import urllib
|
||||||
import tempfile
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import SearcherABC
|
import SearcherABC
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
import urllib
|
import urllib
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
import urllib2
|
|
||||||
|
|
||||||
import SearcherABC
|
import SearcherABC
|
||||||
|
|
||||||
|
|
|
@ -19,9 +19,7 @@
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import os
|
|
||||||
import urllib
|
import urllib
|
||||||
import tempfile
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import SearcherABC
|
import SearcherABC
|
||||||
|
@ -64,7 +62,8 @@ class KinoZalTV(SearcherABC.SearcherABC):
|
||||||
|
|
||||||
def search(self, keyword):
|
def search(self, keyword):
|
||||||
filesList = []
|
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'),
|
headers = {('Origin', 'http://kinozal.tv'),
|
||||||
('User-Agent',
|
('User-Agent',
|
||||||
|
|
|
@ -1,10 +1,16 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import xbmcgui, Localization, sys, xbmc
|
import sys
|
||||||
|
|
||||||
|
import xbmcgui
|
||||||
|
import Localization
|
||||||
|
import xbmc
|
||||||
|
|
||||||
KEY_BUTTON_BACK = 275
|
KEY_BUTTON_BACK = 275
|
||||||
KEY_KEYBOARD_ESC = 61467
|
KEY_KEYBOARD_ESC = 61467
|
||||||
ACTION_PREVIOUS_MENU = 10
|
ACTION_PREVIOUS_MENU = 10
|
||||||
ACTION_NAV_BACK = 92
|
ACTION_NAV_BACK = 92
|
||||||
|
|
||||||
|
|
||||||
class DialogXml(xbmcgui.WindowXMLDialog):
|
class DialogXml(xbmcgui.WindowXMLDialog):
|
||||||
def onInit(self):
|
def onInit(self):
|
||||||
print "onInit(): Window Initialized"
|
print "onInit(): Window Initialized"
|
||||||
|
@ -22,7 +28,8 @@ class DialogXml(xbmcgui.WindowXMLDialog):
|
||||||
self.ratingint = int(self.movieInfo['rating'])
|
self.ratingint = int(self.movieInfo['rating'])
|
||||||
if (self.ratingint < 70):
|
if (self.ratingint < 70):
|
||||||
self.ratingcolor = 'red'
|
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 = self.getControl(1)
|
||||||
self.movie_label.setLabel(self.movieInfo['title'])
|
self.movie_label.setLabel(self.movieInfo['title'])
|
||||||
|
@ -66,12 +73,10 @@ class DialogXml(xbmcgui.WindowXMLDialog):
|
||||||
(sys.argv[0], action, self.link)
|
(sys.argv[0], action, self.link)
|
||||||
xbmc.executebuiltin(exec_str)
|
xbmc.executebuiltin(exec_str)
|
||||||
|
|
||||||
|
|
||||||
def onFocus(self, controlID):
|
def onFocus(self, controlID):
|
||||||
# print "onFocus(): control %i" % controlID
|
# print "onFocus(): control %i" % controlID
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def doModal(self, movieInfo, url):
|
def doModal(self, movieInfo, url):
|
||||||
self.movieInfo = movieInfo
|
self.movieInfo = movieInfo
|
||||||
self.link = url
|
self.link = url
|
||||||
|
|
|
@ -842,7 +842,7 @@ class AzureusConnection(AzureusLink):
|
||||||
raise NoEstablishedConnectionError
|
raise NoEstablishedConnectionError
|
||||||
|
|
||||||
from xml.dom.minidom import parseString
|
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.
|
# First step, convert the method data to XML.
|
||||||
xml_data = remote_method_call_as_xml(method_name, method_args,
|
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)
|
return dopal.utils.parse_azureus_version_string(az_version)
|
||||||
|
|
||||||
|
|
||||||
# Use of this name is deprecated, and this alias will be removed in later
|
# Use of this name is deprecated, and this alias will be removed in later
|
||||||
# versions of DOPAL.
|
# versions of DOPAL.
|
||||||
ReusableAzureusConnection = ExtendedAzureusConnection
|
ReusableAzureusConnection = ExtendedAzureusConnection
|
||||||
|
|
|
@ -22,7 +22,7 @@ from dopal.core import ExtendedAzureusConnection
|
||||||
from dopal.errors import AzMethodError, InvalidObjectIDError, \
|
from dopal.errors import AzMethodError, InvalidObjectIDError, \
|
||||||
RemoteMethodError, StaleObjectReferenceError, ConnectionlessObjectError, \
|
RemoteMethodError, StaleObjectReferenceError, ConnectionlessObjectError, \
|
||||||
NonRefreshableConnectionlessObjectError, MissingRemoteAttributeError, \
|
NonRefreshableConnectionlessObjectError, MissingRemoteAttributeError, \
|
||||||
NonRefreshableIncompleteObjectError, NonRefreshableObjectError
|
NonRefreshableObjectError
|
||||||
import dopal.utils
|
import dopal.utils
|
||||||
|
|
||||||
|
|
||||||
|
@ -487,7 +487,6 @@ class RemoteAttributesMixin(object):
|
||||||
text = "'%s' object has no attribute '%s'"
|
text = "'%s' object has no attribute '%s'"
|
||||||
raise AttributeError, text % (type(self).__name__, name)
|
raise AttributeError, text % (type(self).__name__, name)
|
||||||
|
|
||||||
|
|
||||||
def __setattr__(self, name, value):
|
def __setattr__(self, name, value):
|
||||||
if self.__protect_remote_attributes__ and not name.startswith('__'):
|
if self.__protect_remote_attributes__ and not name.startswith('__'):
|
||||||
if name in self.__remote_attribute_names__:
|
if name in self.__remote_attribute_names__:
|
||||||
|
|
|
@ -18,7 +18,6 @@ import xbmc
|
||||||
import xbmcgui
|
import xbmcgui
|
||||||
import xbmcvfs
|
import xbmcvfs
|
||||||
|
|
||||||
|
|
||||||
os.sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__))))
|
os.sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__))))
|
||||||
|
|
||||||
import dopal.main
|
import dopal.main
|
||||||
|
@ -51,7 +50,6 @@ class HTTP:
|
||||||
if not xbmcvfs.exists(self._dirname):
|
if not xbmcvfs.exists(self._dirname):
|
||||||
xbmcvfs.mkdir(self._dirname)
|
xbmcvfs.mkdir(self._dirname)
|
||||||
|
|
||||||
|
|
||||||
def fetch(self, request, **kwargs):
|
def fetch(self, request, **kwargs):
|
||||||
self.con, self.fd, self.progress, self.cookies, self.request = None, None, None, None, request
|
self.con, self.fd, self.progress, self.cookies, self.request = None, None, None, None, request
|
||||||
|
|
||||||
|
@ -91,7 +89,6 @@ class HTTP:
|
||||||
|
|
||||||
return self.response
|
return self.response
|
||||||
|
|
||||||
|
|
||||||
def _opener(self):
|
def _opener(self):
|
||||||
|
|
||||||
build = [urllib2.HTTPHandler()]
|
build = [urllib2.HTTPHandler()]
|
||||||
|
@ -118,7 +115,6 @@ class HTTP:
|
||||||
|
|
||||||
urllib2.install_opener(urllib2.build_opener(*build))
|
urllib2.install_opener(urllib2.build_opener(*build))
|
||||||
|
|
||||||
|
|
||||||
def _fetch(self):
|
def _fetch(self):
|
||||||
params = {} if self.request.params is None else self.request.params
|
params = {} if self.request.params is None else self.request.params
|
||||||
|
|
||||||
|
@ -163,7 +159,6 @@ class HTTP:
|
||||||
if self.request.cookies:
|
if self.request.cookies:
|
||||||
self.cookies.save(self.request.cookies)
|
self.cookies.save(self.request.cookies)
|
||||||
|
|
||||||
|
|
||||||
def _download(self):
|
def _download(self):
|
||||||
fd = open(self.request.download, 'wb')
|
fd = open(self.request.download, 'wb')
|
||||||
if self.request.progress:
|
if self.request.progress:
|
||||||
|
@ -195,7 +190,6 @@ class HTTP:
|
||||||
|
|
||||||
self.response.filename = self.request.download
|
self.response.filename = self.request.download
|
||||||
|
|
||||||
|
|
||||||
def _upload(self, upload, params):
|
def _upload(self, upload, params):
|
||||||
res = []
|
res = []
|
||||||
boundary = mimetools.choose_boundary()
|
boundary = mimetools.choose_boundary()
|
||||||
|
@ -231,7 +225,6 @@ class HTTP:
|
||||||
result.append('')
|
result.append('')
|
||||||
return boundary, '\r\n'.join(result)
|
return boundary, '\r\n'.join(result)
|
||||||
|
|
||||||
|
|
||||||
def _headers(self, raw):
|
def _headers(self, raw):
|
||||||
headers = {}
|
headers = {}
|
||||||
for line in raw.headers:
|
for line in raw.headers:
|
||||||
|
@ -243,7 +236,6 @@ class HTTP:
|
||||||
headers[tag] = value
|
headers[tag] = value
|
||||||
return headers
|
return headers
|
||||||
|
|
||||||
|
|
||||||
def _progress(self, read, size, name):
|
def _progress(self, read, size, name):
|
||||||
res = []
|
res = []
|
||||||
if size < 0:
|
if size < 0:
|
||||||
|
@ -942,7 +934,8 @@ class Deluge:
|
||||||
percent = int(x['progress'] * 100)
|
percent = int(x['progress'] * 100)
|
||||||
elif obj.get('file_progress') and len(obj['file_progress']) >= i:
|
elif obj.get('file_progress') and len(obj['file_progress']) >= i:
|
||||||
percent = int(obj['file_progress'][i] * 100)
|
percent = int(obj['file_progress'][i] * 100)
|
||||||
else:percent=0
|
else:
|
||||||
|
percent = 0
|
||||||
|
|
||||||
i += 1
|
i += 1
|
||||||
res.append([path, percent, x['index'], size])
|
res.append([path, percent, x['index'], size])
|
||||||
|
@ -967,10 +960,12 @@ class Deluge:
|
||||||
def add_url(self, torrent, dirname):
|
def add_url(self, torrent, dirname):
|
||||||
if re.match("^magnet\:.+$", torrent):
|
if re.match("^magnet\:.+$", torrent):
|
||||||
if self.action({'method': 'core.add_torrent_magnet', 'params': [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
|
return None
|
||||||
else:
|
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 None
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue