pull/1/head
DiMartinoXBMC 2015-07-02 21:46:05 +03:00
parent 40955a402f
commit 47643458fd
5 changed files with 96 additions and 4 deletions

View File

@ -250,6 +250,10 @@ def localize(text):
'But you would have to do it by yourself, there is some info on github.com.':'Но придется это тебе делать самому, на гитхабе была инфа',
'It is NOT possible to compile python-libtorrent for iOS.':'Под iOS невозможно скомпилировать python-libtorrent',
'But you can use torrent-client control functions.':'Но все остальные функции кроме прямого стриминга с торрента работают.',
'I added custom searchers for Torrenter v2!':'Я добавил внешние серчеры для трекеров в стиле Pulsar!',
'Now you can use your login on trackers or write and install your own searcher!':'Теперь можно использовать свой логин или даже написать и установить свой серчер.',
'Would you like to install %s from "MyShows.me Kodi Repo" in Programs section?':'Хотите установить %s из "MyShows.me Kodi Repo" в Программах?',
'Open installation window?':'Открыть окно установки?',
},
'uk': {
'Seeds searching.': 'Йде пошук сідів.',

View File

@ -103,13 +103,13 @@ class SearcherABC:
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)
print self.__class__.__name__+' [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)
print self.__class__.__name__+' [makeRequest]: Denied, HTTP Error, e.code=' + str(e.code)
return
else:
print '[makeRequest]: HTTP Error, e.code=' + str(e.code)
print self.__class__.__name__+' [makeRequest]: HTTP Error, e.code=' + str(e.code)
return
#self.cookieJar.extract_cookies(response, urllib2)
if response.info().get('Content-Encoding') == 'gzip':

View File

@ -1766,7 +1766,7 @@ def first_run_230(delete_russian):
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('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

@ -0,0 +1,88 @@
# -*- 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 = "https://thepiratebay.mn/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