diff --git a/addon.xml b/addon.xml index 9e807f6..a3928c8 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@  - + diff --git a/changelog.txt b/changelog.txt index 3d91fa4..e6913c9 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,7 @@ -[B]Version 2.1.9[/B] +[B]Version 2.2.0[/B] +[+] Поиск: Добавлен BTDigg (magnet) + +[B]Version 2.1.9[/B] [+] Списки Медиа: Баг-фикс TMDB SSL, нижний переход на следующую страницу [+] Списки Медиа: Расширенная информация KickAssSo, EZTV [+] Списки Медиа: Добавлен ThePirateBay diff --git a/resources/searchers/BTDigg.py b/resources/searchers/BTDigg.py new file mode 100644 index 0000000..0219764 --- /dev/null +++ b/resources/searchers/BTDigg.py @@ -0,0 +1,69 @@ +# -*- coding: utf-8 -*- + +import urllib +import json +import sys + +import SearcherABC + + +class BTDigg(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/BTDigg.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://api.btdigg.org/api/private-c47ba652ee73735a/s02?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', 'https://eztv.it/'), ('Accept-encoding', 'gzip'), ] + response = self.makeRequest(url, headers=headers) + + if None != response and 0 < len(response): + #print response + dat = json.loads(response) + print str(dat) + for item in dat: + size = self.sizeConvert(item['size']) + seeds,leechers=0,0 + image = sys.modules["__main__"].__root__ + self.searchIcon + filesList.append(( + int(int(self.sourceWeight) * int(seeds)), + int(seeds), int(leechers), size, + self.unescape(self.stripHtml(item['name'])), + self.__class__.__name__ + '::' + item['magnet'], + image, + )) + return filesList \ No newline at end of file diff --git a/resources/searchers/icons/BTDigg.png b/resources/searchers/icons/BTDigg.png new file mode 100644 index 0000000..3ebe4e3 Binary files /dev/null and b/resources/searchers/icons/BTDigg.png differ