major search update, external serachers

pull/1/head
DiMartinoXBMC 2015-07-01 23:15:29 +03:00
parent 502c33fe90
commit 40955a402f
13 changed files with 244 additions and 305 deletions

View File

@ -185,7 +185,7 @@ class Content:
return
else:
print '[makeRequest]: HTTP Error, e.code=' + str(e.code)
return
if response.info().get('Content-Encoding') == 'gzip':
buf = StringIO(response.read())
f = gzip.GzipFile(fileobj=buf)

101
Core.py
View File

@ -78,6 +78,8 @@ class Core:
def sectionMenu(self):
if self.__settings__.getSetting('plugin_name')!=self.__plugin__:
if self.__plugin__ == 'Torrenter v.2.3.0':
first_run_230(self.__settings__.getSetting('delete_russian')=='true')
if self.__settings__.getSetting('delete_russian')!='false':
not_russian=delete_russian(ok=self.__settings__.getSetting('delete_russian')=='true', action='delete')
if not_russian:
@ -124,16 +126,6 @@ class Core:
self.drawItem('full_download', 'full_download', image=self.ROOT + '/icons/magnet.png')
self.drawItem('test', 'test', image=self.ROOT + '/icons/magnet.png')
'''self.drawItem(self.localize('< Popular >'), 'getPopular', image=self.ROOT + '/icons/video.png')
self.drawItem(self.localize('< Ratings >'), 'getRatings', image=self.ROOT + '/icons/video.png')
self.drawItem(self.localize('< Recent Materials >'), 'recentMaterilas', image=self.ROOT + '/icons/video.png')
if self.__settings__.getSetting("auth"):
self.drawItem(self.localize('< Bookmarks >'), 'getBookmarks', image=self.ROOT + '/icons/bookmarks.png')
self.drawItem(self.localize('< History >'), 'getHistory', image=self.ROOT + '/icons/history.png')
self.drawItem(self.localize('< Logout >'), 'logoutUser', image=self.ROOT + '/icons/logout.png')
else:
self.drawItem(self.localize('< Login >'), 'loginUser', image=self.ROOT + '/icons/login.png')
self.drawItem(self.localize('< Register >'), 'registerUser', image=self.ROOT + '/icons/register.png')'''
if 'true' == self.__settings__.getSetting("keep_files"):
self.drawItem('< %s >' % self.localize('Clear Storage'), 'clearStorage', isFolder=True,
image=self.ROOT + '/icons/clear.png')
@ -279,6 +271,9 @@ class Core:
#self.DownloadStatus()
url='http://torcache.net/torrent/6698E0950DCD257A6B03AF2E8B068B7FF9D4619D.torrent?title=[kickass.to]game.of.thrones.season.2.720p.bluray.x264.shaanig'
#xbmc.executebuiltin('xbmc.RunPlugin("plugin://plugin.video.torrenter/?action=openTorrent&external=ThePirateBaySe&url=ThePirateBaySe%3A%3A'+urllib.quote_plus(url)+'&not_download_only=True")')
#print str(Searchers().list())
first_run_230(False)
def DownloadStatus(self, params={}):
db = DownloadDB()
@ -1232,10 +1227,11 @@ class Core:
if not url:
action = xbmcgui.Dialog()
url = action.browse(1, self.localize('Choose .torrent in video library'), 'video', '.torrent')
xbmc.executebuiltin(
'XBMC.ActivateWindow(%s)' % 'Videos,plugin://plugin.video.torrenter/?action=%s&url=%s'
% ('torrentPlayer', url))
return
if url:
xbmc.executebuiltin(
'XBMC.ActivateWindow(%s)' % 'Videos,plugin://plugin.video.torrenter/?action=%s&url=%s'
% ('torrentPlayer', url))
return
if url:
self.__settings__.setSetting("lastTorrentUrl", url)
torrent = Downloader.Torrent(self.userStorageDirectory, torrentFilesDirectory=self.torrentFilesDirectory)
@ -1382,14 +1378,7 @@ class Core:
classMatch = re.search('(\w+)::(.+)', url)
if classMatch:
searcher = classMatch.group(1)
if self.ROOT + os.sep + 'resources' + os.sep + 'searchers' not in sys.path:
sys.path.insert(0, self.ROOT + os.sep + 'resources' + os.sep + 'searchers')
try:
searcherObject = getattr(__import__(searcher), searcher)()
except Exception, e:
print 'Unable to use searcher: ' + searcher + ' at ' + self.__plugin__ + ' openTorrent(). Exception: ' + str(e)
return
url = searcherObject.getTorrentFile(classMatch.group(2))
url = Searchers().downloadWithSearcher(classMatch.group(2), searcher)
self.__settings__.setSetting("lastTorrentUrl", url)
if not_download_only:
if re.match("^http.+$", url):
@ -1403,10 +1392,7 @@ class Core:
self.__settings__.setSetting("lastTorrent", torrent.saveTorrent(url))
if silent != 'true':
if external:
myshows_items = []
myshows_files = []
myshows_sizes = {}
contentList = []
myshows_items, myshows_files, contentList, myshows_sizes = [], [], [], {}
for filedict in torrent.getContentList():
fileTitle = ''
if filedict.get('size'):
@ -1482,46 +1468,26 @@ class Core:
addtime=get("addtime")
if self.__settings__.getSetting('history')=='true':
HistoryDB().add(url)
try:
external = urllib.unquote_plus(get("external"))
except:
external = None
filesList = []
if None == get('isApi'):
progressBar = xbmcgui.DialogProgress()
progressBar.create(self.localize('Please Wait'), self.localize('Materials are loading now.'))
iterator = 0
external = unquote(get("external"))
searchersList = []
if not external or external == 'torrenterall':
if addtime:
providers=HistoryDB().get_providers(addtime)
if providers:
for searcher in providers:
searchersList.append(searcher + '.py')
searchersList.append(searcher)
if not addtime or not searchersList:
searchersList = Searchers().get_active()
elif external == 'torrenterone':
slist = Searchers().list()
ret = xbmcgui.Dialog().select(self.localize('Choose searcher:'), slist)
slist = Searchers().list().keys()
ret = xbmcgui.Dialog().select(self.localize('Choose searcher')+':', slist)
if ret > -1 and ret < len(slist):
external = slist[ret]
searchersList.append(external + '.py')
searchersList.append(external)
else:
searchersList.append(external + '.py')
for searcherFile in searchersList:
searcher = re.search('^(\w+)\.py$', searcherFile).group(1)
if searcher:
if None == get('isApi'):
progressBar.update(int(iterator), searcher)
iterator += 100 / len(searchersList)
filesList += self.searchWithSearcher(url, searcher)
if None == get('isApi') and progressBar.iscanceled():
progressBar.update(0)
progressBar.close()
return
if None == get('isApi'):
progressBar.update(0)
progressBar.close()
searchersList.append(external)
filesList=search(url, searchersList, get('isApi'))
if self.__settings__.getSetting('sort_search')=='true':
filesList = sorted(filesList, key=lambda x: x[0], reverse=True)
self.showFilesList(filesList, params)
@ -1530,18 +1496,6 @@ class Core:
xbmc.executebuiltin(
'xbmc.RunScript(%s,)' % os.path.join(ROOT, 'controlcenter.py'))
def searchWithSearcher(self, keyword, searcher):
filesList = []
if self.ROOT + os.sep + 'resources' + os.sep + 'searchers' not in sys.path:
sys.path.insert(0, self.ROOT + os.sep + 'resources' + os.sep + 'searchers')
try:
searcherObject = getattr(__import__(searcher), searcher)()
filesList = searcherObject.search(keyword)
except Exception, e:
print 'Unable to use searcher: ' + searcher + ' at ' + self.__plugin__ + ' searchWithSearcher(). Exception: ' + str(
e)
return filesList
def showFilesList(self, filesList, params={}):
get = params.get
external = unquote(get("external"), None)
@ -1661,28 +1615,17 @@ class Core:
dirname = self.__settings__.getSetting("torrent_dir")
get = params.get
try:
url = urllib.unquote_plus(get("url"))
except:
url = self.__settings__.getSetting("lastTorrent").decode('utf-8')
url = unquote(get("url"), self.__settings__.getSetting("lastTorrent").decode('utf-8'))
ind = get("ind")
if not ind:
self.__settings__.setSetting("lastTorrentUrl", url)
classMatch = re.search('(\w+)::(.+)', url)
if classMatch:
print str(dirname)+str(re.match("^magnet\:.+$", classMatch.group(2))==None)
if re.match("^magnet\:.+$", classMatch.group(2)) and dirname:
url=classMatch.group(2)
else:
searcher = classMatch.group(1)
if self.ROOT + os.sep + 'resources' + os.sep + 'searchers' not in sys.path:
sys.path.insert(0, self.ROOT + os.sep + 'resources' + os.sep + 'searchers')
try:
searcherObject = getattr(__import__(searcher), searcher)()
except Exception, e:
print 'Unable to use searcher: ' + searcher + ' at ' + self.__plugin__ + ' openTorrent(). Exception: ' + str(e)
return
url = searcherObject.getTorrentFile(classMatch.group(2))
url = Searchers().downloadWithSearcher(classMatch.group(2), searcher)
torrent = Downloader.Torrent(self.userStorageDirectory,
torrentFilesDirectory=self.torrentFilesDirectory)

View File

@ -99,7 +99,18 @@ class SearcherABC:
encodedData = urllib.urlencode(data)
else:
encodedData = None
response = opener.open(url, encodedData)
try:
response = opener.open(url, encodedData)
except urllib2.HTTPError as e:
if e.code == 404:
print '[makeRequest]: Not Found! HTTP Error, e.code=' + str(e.code)
return
elif e.code in [503]:
print '[makeRequest]: Denied, HTTP Error, e.code=' + str(e.code)
return
else:
print '[makeRequest]: HTTP Error, e.code=' + str(e.code)
return
#self.cookieJar.extract_cookies(response, urllib2)
if response.info().get('Content-Encoding') == 'gzip':
buf = StringIO(response.read())

20
cal.py
View File

@ -1,20 +0,0 @@
# -*- coding: utf-8 -*-
import sys
import os
import re
ROOT = os.path.dirname(sys.modules["__main__"].sys.argv[0])
searcherObject = {}
searcher = 'KickAssSo'
if ROOT + os.sep + 'resources' + os.sep + 'contenters' not in sys.path:
sys.path.insert(0, ROOT + os.sep + 'resources' + os.sep + 'contenters')
searcherObject[searcher] = getattr(__import__(searcher), searcher)()
# print str(searcherObject[searcher].get_info('http://kickass.so/greys-anatomy-s11e09-hdtv-x264-lol-ettv-t10144556.html'))
x = '<a href="http://swesub.tv/action/">Action</a></li><li><a href="http://swesub.tv/animerat/">Animerat</a></li><li><a href="http://swesub.tv/dans/">Dans</a></li><li><a href="http://swesub.tv/dokumentar/">Dokumentär</a></li><li><a href="http://swesub.tv/drama/">Drama</a></li><li><a href="http://swesub.tv/familj/">Familj</a></li><li><a href="http://swesub.tv/fantasy/">Fantasy</a></li><li><a href="http://swesub.tv/komedi/">Komedi</a></li><li><a href="http://swesub.tv/krig/">Krig</a></li><li><a href="http://swesub.tv/kriminal/">Kriminal</a></li><li><a href="http://swesub.tv/musikal/">Musikal</a></li><li><a href="http://swesub.tv/romantik/">Romantik</a></li><li><a href="http://swesub.tv/sci-fi/">Sci-Fi</a></li><li><a href="http://swesub.tv/skrack/">Skräck</a></li><li><a href="http://swesub.tv/sport/">Sport</a></li><li><a href="http://swesub.tv/thriller/">Thriller</a></li><li><a href="http://swesub.tv/western/">Western</a></li><li><a href="http://swesub.tv/aventyr/">Äventyr</a></li>'
y = 'href="http://swesub.tv/(.+?)/">(.+?)<'
for u, t in re.findall(y, x):
# print ", '/"+u+"/', {'page': '/"+u+"/?page=%d', 'increase': 1, 'second_page': 2,}),"
print t

View File

@ -1,4 +1,9 @@
[B]Version 2.2.9[/B]
[B]Version 2.3.0[/B]
[+] Поиск: Поиск существенно ускорился, стал многопоточным (пока 3 потока одновременно)
[+] Поиск: Добавлена поддержка внешних серчеров с индивидуальными настройками (в стиле Pulsar)
[+] Обновлено окно Torrenter Global Control Center
[B]Version 2.2.9[/B]
[+] .torrent Проигрыватель: Теперь .torrent не теряется при обновлении окна Kodi
[+] Проигрыватель: Улучшенная настройка сессии из cherrytorrent
[+] Списки Медиа: Обновление баз на русском

View File

@ -22,6 +22,7 @@ import sys
import xbmcaddon
import xbmc
import xbmcgui
from functions import getParameters, HistoryDB
from resources.pyxbmct.addonwindow import *
from functions import Searchers
@ -211,7 +212,7 @@ class ControlCenter(AddonDialogWindow):
self.keys = self.dic.keys()
self.placed, self.button_columns, self.last_column_row = self.place()
self.setGeometry(700, 150 + 50 * self.button_columns, 3 + self.button_columns, 3)
self.setGeometry(850, 200 + 50 * self.button_columns, 4 + self.button_columns, 3)
self.set_info_controls()
self.set_active_controls()
self.set_navigation()
@ -260,22 +261,34 @@ class ControlCenter(AddonDialogWindow):
self.radiobutton_top[place[1]] = self.radiobutton[searcher]
self.radiobutton_bottom[place[1]] = self.radiobutton[searcher]
# Button
self.button_install = Button(__language__(30415))
self.placeControl(self.button_install, 2 + self.button_columns, 0)
self.connect(self.button_install, self.installSearcher)
# Button
self.button_openserchset = Button(__language__(30416))
self.placeControl(self.button_openserchset, 2 + self.button_columns, 1)
self.connect(self.button_openserchset, self.openSearcherSettings)
# Button
self.button_clearstor = Button(__language__(30417))
self.placeControl(self.button_clearstor, 2 + self.button_columns, 2)
self.connect(self.button_clearstor, self.clearStorage)
# Button
self.button_openset = Button(__language__(30413))
self.placeControl(self.button_openset, 2 + self.button_columns, 0)
# Connect control to close the window.
self.placeControl(self.button_openset, 3 + self.button_columns, 0)
self.connect(self.button_openset, self.openSettings)
# Button
self.button_utorrent = Button(__language__(30414))
self.placeControl(self.button_utorrent, 2 + self.button_columns, 1)
# Connect control to close the window.
self.placeControl(self.button_utorrent, 3 + self.button_columns, 1)
self.connect(self.button_utorrent, self.openUtorrent)
# Button
self.button_close = Button(__language__(30412))
self.placeControl(self.button_close, 2 + self.button_columns, 2)
# Connect control to close the window.
self.placeControl(self.button_close, 3 + self.button_columns, 2)
self.connect(self.button_close, self.close)
def set_navigation(self):
@ -284,7 +297,7 @@ class ControlCenter(AddonDialogWindow):
placed_keys = self.placed.keys()
for searcher in placed_keys:
buttons = [self.button_openset, self.button_utorrent, self.button_close]
buttons = [self.button_install, self.button_openserchset, self.button_clearstor]
place = self.placed[searcher]
if place[0] == 0:
@ -323,30 +336,65 @@ class ControlCenter(AddonDialogWindow):
ser = placed_keys[placed_values.index((place[0] + 1, place[1]))]
self.radiobutton[searcher].controlDown(self.radiobutton[ser])
self.button_openset.controlUp(self.radiobutton_bottom[0])
self.button_install.controlUp(self.radiobutton_bottom[0])
self.button_install.controlDown(self.button_openset)
self.button_install.controlLeft(self.button_clearstor)
self.button_install.controlRight(self.button_openserchset)
self.button_openserchset.controlUp(self.radiobutton_bottom[1])
self.button_openserchset.controlDown(self.button_utorrent)
self.button_openserchset.controlLeft(self.button_install)
self.button_openserchset.controlRight(self.button_clearstor)
self.button_clearstor.controlUp(self.radiobutton_bottom[2])
self.button_clearstor.controlDown(self.button_close)
self.button_clearstor.controlLeft(self.button_openserchset)
self.button_clearstor.controlRight(self.button_install)
self.button_openset.controlUp(self.button_install)
self.button_openset.controlDown(self.radiobutton_top[0])
self.button_openset.controlLeft(self.button_close)
self.button_openset.controlRight(self.button_utorrent)
self.button_utorrent.controlUp(self.radiobutton_bottom[1])
self.button_utorrent.controlUp(self.button_openserchset)
self.button_utorrent.controlDown(self.radiobutton_top[1])
self.button_utorrent.controlLeft(self.button_openset)
self.button_utorrent.controlRight(self.button_close)
self.button_close.controlUp(self.radiobutton_bottom[2])
self.button_close.controlUp(self.button_clearstor)
self.button_close.controlDown(self.radiobutton_top[2])
self.button_close.controlLeft(self.button_utorrent)
self.button_close.controlRight(self.button_openset)
# Set initial focus
self.setFocus(self.button_close)
def openSettings(self):
__settings__.openSettings()
def openSearcherSettings(self):
slist = Searchers().list('external').keys()
if len(slist)>0:
ret = xbmcgui.Dialog().select(__language__(30418), slist)
if ret > -1 and ret < len(slist):
sid = slist[ret]
Searcher=xbmcaddon.Addon(id='torrenter.searcher.'+sid)
Searcher.openSettings()
self.close()
else:
xbmcgui.Dialog().ok(__language__(30415), slist)
def installSearcher(self):
xbmc.executebuiltin('XBMC.ActivateWindow(Addonbrowser,addons://search/%s)' % ('Torrenter Searcher'))
self.close()
def openUtorrent(self):
xbmc.executebuiltin('ActivateWindow(Videos,plugin://plugin.video.torrenter/?action=uTorrentBrowser)')
self.close()
def clearStorage(self):
xbmc.executebuiltin('XBMC.RunPlugin(%s)' % ('plugin://plugin.video.torrenter/?action=%s') % 'clearStorage')
def slider_update(self):
# Update slider value label when the slider nib moves
try:

View File

@ -56,6 +56,8 @@ torrentFilesDirectory = 'torrents'
__addonpath__ = __settings__.getAddonInfo('path')
icon = __addonpath__ + '/icon.png'
debug = __settings__.getSetting("debug")
__version__ = __settings__.getAddonInfo('version')
__plugin__ = __settings__.getAddonInfo('name') + " v." + __version__
def clearStorage(userStorageDirectory):
@ -1065,13 +1067,30 @@ class Searchers():
def setBoolSetting(self, setting, bool=True):
__settings__.setSetting(setting, "true" if bool else "false")
def list(self):
searchersList = []
dirList = os.listdir(ROOT + os.sep + 'resources' + os.sep + 'searchers')
for searcherFile in dirList:
if re.match('^(\w+)\.py$', searcherFile):
searchersList.append(searcherFile.replace('.py', ''))
return searchersList
def list(self, only=None):
searchersDict = {}
if only!='external':
searchers_dir = os.path.join(ROOT, 'resources', 'searchers')
searchers_dirList=xbmcvfs.listdir(searchers_dir)[1]
for searcherFile in searchers_dirList:
if re.match('^(\w+)\.py$', searcherFile):
name=searcherFile.replace('.py', '')
searchersDict[name]={'name':name,
'path':searchers_dir,
'searcher':os.path.join(searchers_dir,name+'.py'),
'type':'local'}
if only!='local':
addons_dir = os.path.join(xbmc.translatePath('special://home'),'addons')
addons_dirsList = xbmcvfs.listdir(addons_dir)[0]
for searcherDir in addons_dirsList:
if re.match('^torrenter\.searcher\.(\w+)$', searcherDir):
name=searcherDir.replace('torrenter.searcher.', '')
path=os.path.join(addons_dir, searcherDir)
searchersDict[name]={'name':name,
'path':path,
'searcher':os.path.join(path,name+'.py'),
'type':'external'}
return searchersDict
def dic(self, providers=[]):
dic = {}
@ -1090,11 +1109,97 @@ class Searchers():
def get_active(self):
get_active = []
for searcher in self.list():
for searcher in self.list().iterkeys():
if self.old(searcher): get_active.append(searcher + '.py')
print 'Active Searchers: ' + str(get_active)
return get_active
def searchWithSearcher(self, keyword, searcher):
filesList = []
slist = Searchers().list()
if slist[searcher]['path'] not in sys.path:
sys.path.insert(0, slist[searcher]['path'])
print 'Added %s in sys.path' % (slist[searcher]['path'])
try:
searcherObject = getattr(__import__(searcher), searcher)()
filesList = searcherObject.search(keyword)
except Exception, e:
print 'Unable to use searcher: ' + searcher + ' at ' + __plugin__ + ' searchWithSearcher(). Exception: ' + str(
e)
return filesList
def downloadWithSearcher(self, url, searcher):
slist = Searchers().list()
if slist[searcher]['path'] not in sys.path:
sys.path.insert(0, slist[searcher]['path'])
print 'Added %s in sys.path' % (slist[searcher]['path'])
try:
searcherObject = getattr(__import__(searcher), searcher)()
url = searcherObject.getTorrentFile(url)
except Exception, e:
print 'Unable to use searcher: ' + searcher + ' at ' + __plugin__ + ' downloadWithSearcher(). Exception: ' + str(
e)
return url
def search(url, searchersList, isApi=None):
from threading import Thread
from Queue import Queue
num_threads = 3
queue = Queue()
result = {}
iterator, filesList, left_searchers = 0, [], []
timeout_multi=int(sys.modules["__main__"].__settings__.getSetting("timeout"))
wait_time=10+(10*timeout_multi)
left_searchers.extend(searchersList)
if not isApi:
progressBar = xbmcgui.DialogProgress()
progressBar.create(Localization.localize('Please Wait'), Localization.localize('Materials are loading now.'))
def search_one(i, q):
while True:
if not isApi and progressBar.iscanceled():
progressBar.update(0)
progressBar.close()
return
iterator=100*int(len(searchersList)-len(left_searchers))/len(searchersList)
if not isApi:
progressBar.update(int(iterator), join_list(left_searchers, replace='.py'))
searcherFile = q.get()
searcher=searcherFile.replace('.py','')
print "Thread %s: Searching at %s" % (i, searcher)
result[searcherFile]=Searchers().searchWithSearcher(url, searcher)
left_searchers.remove(searcherFile)
q.task_done()
for i in range(num_threads):
worker = Thread(target=search_one, args=(i, queue))
worker.setDaemon(True)
worker.start()
for searcherFile in searchersList:
queue.put(searcherFile, timeout=wait_time)
print "Main Thread Waiting"
queue.join()
print "Done"
if not isApi:
progressBar.update(0)
progressBar.close()
for k in result.keys():
filesList.extend(result[k])
return filesList
def join_list(l, char=', ', replace=''):
string=''
for i in l:
string+=i.replace(replace,'')+char
return string.rstrip(' ,')
class Contenters():
def __init__(self):
@ -1653,3 +1758,15 @@ def get_ids_video(contentList):
break
# print Debug('[get_ids_video]:'+str(ids_video))
return ids_video
def first_run_230(delete_russian):
ok = xbmcgui.Dialog().ok('< %s >' % Localization.localize('Torrenter Update 2.3.0'),
Localization.localize('I added custom searchers for Torrenter v2!'),
Localization.localize('Now you can use your login on trackers or write and install your own searcher!'))
if not delete_russian:
yes=xbmcgui.Dialog().yesno('< %s >' % Localization.localize('Torrenter Update 2.3.0'),
Localization.localize('Would you like to install %s from "MyShows.me Kodi Repo" in Programs section!') % 'RuTrackerOrg',
Localization.localize('Open installation window?'))
if yes:
xbmc.executebuiltin('XBMC.ActivateWindow(Addonbrowser,addons://search/%s)' % ('Torrenter Searcher'))

View File

@ -57,5 +57,10 @@
<string id="30412">Close</string>
<string id="30413">Open Settings</string>
<string id="30414">Torrent Client Browser</string>
<string id="30415">Install Trackers</string>
<string id="30416">Trackers Settings</string>
<string id="30417">Clear Storage</string>
<string id="30418">Choose searcher</string>
<string id="30419">You don't have external searcher. Please install it first.</string>
</strings>

View File

@ -57,6 +57,9 @@
<string id="30412">Закрыть</string>
<string id="30413">Открыть Настройки</string>
<string id="30414">Браузер Торрент-клиента</string>
<string id="30146">Статус Плагина</string>
<string id="30415">Установить Трекеры</string>
<string id="30416">Настройки Трекеров</string>
<string id="30417">Очистить хранилище</string>
<string id="30418">Выберите трекер</string>
<string id="30419">У вас нет внешних серчеров. Пожалуйста, сначало установите их.</string>
</strings>

View File

@ -58,4 +58,9 @@
<string id="30413">Відкрити налаштування</string>
<string id="30414">Браузер торрент-клієнта</string>
<string id="30146">Статус плагіна</string>
<string id="30415">Установить Трекеры</string>
<string id="30416">Настройки Трекеров</string>
<string id="30417">Очистити сховище</string>
<string id="30418">Оберіть трекер</string>
<string id="30419">У вас нет внешних серчеров. Пожалуйста, сначало установите их.</string>
</strings>

View File

@ -1,90 +0,0 @@
# -*- coding: utf-8 -*-
'''
Torrenter plugin for XBMC
Copyright (C) 2012 Vadim Skorba
vadim.skorba@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
'''
import urllib
import re
import sys
import SearcherABC
class OldPirateBay(SearcherABC.SearcherABC):
'''
Weight of source with this searcher provided.
Will be multiplied on default weight.
Default weight is seeds number
'''
sourceWeight = 1
'''
Relative (from root directory of plugin) path to image
will shown as source image at result listing
'''
searchIcon = '/resources/searchers/icons/OldPirateBay3.png'
'''
Flag indicates is this source - magnet links source or not.
Used for filtration of sources in case of old library (setting selected).
Old libraries won't to convert magnet as torrent file to the storage
'''
@property
def isMagnetLinkSource(self):
return False
'''
Main method should be implemented for search process.
Receives keyword and have to return dictionary of proper tuples:
filesList.append((
int(weight),# Calculated global weight of sources
int(seeds),# Seeds count
str(title),# Title will be shown
str(link),# Link to the torrent/magnet
str(image),# Path/URL to image shown at the list
))
'''
def search(self, keyword):
self.timeout(10)
filesList = []
url = "http://oldpiratebay.org/search.php?q=%s" % (urllib.quote_plus(keyword))
headers = [('User-Agent',
'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 YaBrowser/14.10.2062.12061 Safari/537.36'),
('Referer', 'http://opensharing.org/'), ('Accept-encoding', 'gzip'), ]
response = self.makeRequest(url, headers=headers)
if None != response and 0 < len(response):
#print response
dat = re.compile(
r'''<a href="/torrent/.+?">(.+?)</a>.+?<a class=".+?" href="(.+?)" title="TORRENT LINK">.+?<td .+?>(.+?)</td><td class=".+?">(.+?)</td><td class=".+?">(.+?)</td><td .+?>(.+?)</td></tr>''',
re.DOTALL).findall(response)
for (title, link, age, size, seeds, leechers) in dat:
torrentTitle = title #"%s [S\L: %s\%s]" % (title, seeds, leechers)
size = self.unescape(self.stripHtml(size))
image = sys.modules["__main__"].__root__ + self.searchIcon
link = self.unescape(link)
filesList.append((
int(int(self.sourceWeight) * int(seeds)),
int(seeds), int(leechers), size,
self.unescape(self.stripHtml(torrentTitle)),
self.__class__.__name__ + '::' + link,
image,
))
return filesList

View File

@ -65,10 +65,10 @@ class RuTorOrg(SearcherABC.SearcherABC):
filesList = []
self.timeout(5)
#print 'strating Rutor'
url = "http://zerkalo-rutor.org/search/0/0/100/2/%s" % urllib.quote_plus(keyword)
url = "http://anti-tor.org/search/0/0/100/2/%s" % urllib.quote_plus(keyword)
headers = [('User-Agent',
'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 YaBrowser/14.10.2062.12061 Safari/537.36'),
('Referer', 'http://zerkalo-rutor.org'), ('Accept-encoding', 'gzip'),
('Referer', 'http://anti-tor.org'), ('Accept-encoding', 'gzip'),
('Cookie', str(sys.modules["__main__"].__settings__.getSetting("rutor-auth")))]
response = self.makeRequest(url, headers=headers)
@ -83,7 +83,7 @@ class RuTorOrg(SearcherABC.SearcherABC):
sys.modules["__main__"].__settings__.setSetting("rutor-auth", cookie)
headers = [('User-Agent',
'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 YaBrowser/14.10.2062.12061 Safari/537.36'),
('Referer', 'http://zerkalo-rutor.org'), ('Accept-encoding', 'gzip'),
('Referer', 'http://anti-tor.org'), ('Accept-encoding', 'gzip'),
('Cookie', str(sys.modules["__main__"].__settings__.getSetting("rutor-auth")))]
response = self.makeRequest(url, headers=headers)
@ -97,7 +97,7 @@ class RuTorOrg(SearcherABC.SearcherABC):
for (link, title, size, seeds, leechers) in dat:
torrentTitle = title.strip() #"%s [S\L: %s\%s]" % (title, seeds, leechers)
size = size.replace('&nbsp;', ' ')
if link[0]=='/': link='http://zerkalo-rutor.org'+link
if link[0]=='/': link='http://anti-tor.org'+link
image = sys.modules["__main__"].__root__ + self.searchIcon
filesList.append((
int(int(self.sourceWeight) * int(seeds)),

View File

@ -1,88 +0,0 @@
# -*- coding: utf-8 -*-
'''
Torrenter plugin for XBMC
Copyright (C) 2012 Vadim Skorba
vadim.skorba@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
'''
import urllib
import re
import sys
import SearcherABC
class ThePirateBaySe(SearcherABC.SearcherABC):
'''
Weight of source with this searcher provided.
Will be multiplied on default weight.
Default weight is seeds number
'''
sourceWeight = 1
'''
Relative (from root directory of plugin) path to image
will shown as source image at result listing
'''
searchIcon = '/resources/searchers/icons/thepiratebay.se.png'
'''
Flag indicates is this source - magnet links source or not.
Used for filtration of sources in case of old library (setting selected).
Old libraries won't to convert magnet as torrent file to the storage
'''
@property
def isMagnetLinkSource(self):
return True
'''
Main method should be implemented for search process.
Receives keyword and have to return dictionary of proper tuples:
filesList.append((
int(weight),# Calculated global weight of sources
int(seeds),# Seeds count
str(title),# Title will be shown
str(link),# Link to the torrent/magnet
str(image),# Path/URL to image shown at the list
))
'''
def search(self, keyword):
filesList = []
url = "http://thepiratebay.se/search/%s/0/99/200" % (urllib.quote_plus(keyword))
response = self.makeRequest(url)
if None != response and 0 < len(response):
# print response
dat = re.compile(
r'<div class="detName">.+?">(.+?)</a>.+?<a href="(.+?)".+?<font class="detDesc">Uploaded .+?, Size (.+?), .+?</font>.+?<td align="right">(\d+?)</td>.+?<td align="right">(\d+?)</td>',
re.DOTALL).findall(response)
for (title, link, size, seeds, leechers) in dat:
torrentTitle = title # "%s [S\L: %s\%s]" % (title, seeds, leechers)
size = size.replace('&nbsp;', ' ')
image = sys.modules["__main__"].__root__ + self.searchIcon
if not re.match('^https?\://.+', link) and not re.match('^magnet\:.+', link):
link = re.search('^(https?\://.+?)/.+', url).group(1) + link
filesList.append((
int(int(self.sourceWeight) * int(seeds)),
int(seeds), int(leechers), size,
self.unescape(self.stripHtml(torrentTitle)),
self.__class__.__name__ + '::' + link,
image,
))
return filesList