From 1311d40ba56ad0f16a835f2d5162ff1c45b80f0e Mon Sep 17 00:00:00 2001 From: DiMartinoXBMC Date: Sun, 22 Feb 2015 15:13:53 +0300 Subject: [PATCH] swesub update, phrase, next page fix --- Core.py | 14 +++- changelog.txt | 9 ++- resources/contenters/CXZ.py | 3 + resources/contenters/SWESUB.py | 104 +++++++++++++++++++++++++ resources/language/English/strings.xml | 1 + resources/language/Russian/strings.xml | 1 + resources/settings.xml | 1 + 7 files changed, 129 insertions(+), 4 deletions(-) create mode 100644 resources/contenters/SWESUB.py diff --git a/Core.py b/Core.py index 36dba2f..7283cfd 100644 --- a/Core.py +++ b/Core.py @@ -662,8 +662,6 @@ class Core: #if not self.debug: view_style('drawcontentList') if property and property.get('page'): - apps['page'] = page + 1 - #print str(apps) self.drawItem('[COLOR FFFFFFFF][B]%s[/B][/COLOR]' % self.localize('Next Page'), 'openContent', json.dumps(apps), isFolder=True) @@ -887,7 +885,10 @@ class Core: url=info.get('link')[0] else: url=info.get('link') - link = {'url': '%s::%s' % (provider, url), 'thumbnail': img} + if not '::' in url: + link = {'url': '%s::%s' % (provider, url), 'thumbnail': img} + else: + link = {'url': url, 'thumbnail': img} elif self.contenterObject[provider].isLabel(): link = {'url': '%s::%s' % (provider, urllib.quote_plus(label)), 'thumbnail': img} @@ -972,6 +973,13 @@ class Core: if get('original_title'): options.append( '%s S%2dE%2d' % (get('original_title'), int(get('season')), int(get('episode')))) + search_phrase=self.__settings__.getSetting('search_phrase') + if search_phrase!='': + x=[] + x.extend(options) + for title in x: + options.append(title+' '+search_phrase) + for title in options: try: title=title.encode('utf-8') diff --git a/changelog.txt b/changelog.txt index 2afc220..3d91fa4 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,11 @@ -[B]Version 2.1.6[/B] +[B]Version 2.1.9[/B] +[+] Списки Медиа: Баг-фикс TMDB SSL, нижний переход на следующую страницу +[+] Списки Медиа: Расширенная информация KickAssSo, EZTV +[+] Списки Медиа: Добавлен ThePirateBay +[+] Списки Медиа: Добавлен SWESUB +[+] Списки Медиа: Дополнительная фраза в вариантах поиска + +[B]Version 2.1.6[/B] [+] Списки Медиа: Окно информации (пока только KickAssSo). Спасибо evgen_dev [+] История Поиска: Перенос в начало списка при повторном поиске diff --git a/resources/contenters/CXZ.py b/resources/contenters/CXZ.py index a8f316a..fa4b456 100644 --- a/resources/contenters/CXZ.py +++ b/resources/contenters/CXZ.py @@ -101,6 +101,9 @@ class CXZ(Content.Content): def isLabel(self): return False + def isInfoLink(self): + return False + def isPages(self): return True diff --git a/resources/contenters/SWESUB.py b/resources/contenters/SWESUB.py new file mode 100644 index 0000000..fcb973c --- /dev/null +++ b/resources/contenters/SWESUB.py @@ -0,0 +1,104 @@ +# -*- 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 . +''' +import re +import Content +from BeautifulSoup import BeautifulSoup + +class SWESUB(Content.Content): + category_dict = { + 'tvshows': ('TV Shows', '/senaste-tv-serier/', {'page': '/senaste-tv-serier/?page=%d', + 'increase': 1, 'second_page': 2,}), + 'movies': ('Movies', '/filmer/', {'page': '/filmer/?page=%d', 'increase': 1, 'second_page': 2,}), + } + + baseurl = "http://swesub.tv" + 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://swesub.tv/'), ('Accept-Encoding', 'gzip')] + ''' + Weight of source with this searcher provided. + Will be multiplied on default weight. + Default weight is seeds number + ''' + sourceWeight = 1 + + def isLabel(self): + return True + + def isScrappable(self): + return False + + def isInfoLink(self): + return True + + def isPages(self): + return True + + def isSort(self): + return False + + def isSearchOption(self): + return False + + def get_contentList(self, category, subcategory=None, apps_property=None): + contentList = [] + url = self.get_url(category, subcategory, apps_property) + + response = self.makeRequest(url, headers=self.headers) + response=response.decode('iso-8859-1') + + if None != response and 0 < len(response): + if category: + contentList = self.mode(response) + #print str(contentList) + return contentList + + def mode(self, response): + contentList = [] + num = 51 + Soup = BeautifulSoup(response) + result = Soup.findAll('article', {'class':'box'}) + #print str(result) + for article in result: + #main + info = {} + num = num - 1 + original_title = None + year = 0 + + div=article.find('div', {'class':'box-img'}) + title=div.find('img').get('alt') + img=div.find('img').get('src') + link=div.find('a').get('href').replace(self.baseurl,'').replace('.html','') + + #info + + info['label'] = info['title'] = self.unescape(title) + info['link'] = '%s::%s' % ('Nyaa', self.baseurl+'/downloads'+link+'/') + info['infolink']=self.baseurl+link+'.html' + + info['plot'] = article.find('div',{'class':'item-content'}).text + + contentList.append(( + int(int(self.sourceWeight) * (int(num))), + original_title, title, int(year), img, info, + )) + return contentList \ No newline at end of file diff --git a/resources/language/English/strings.xml b/resources/language/English/strings.xml index 773b348..44c51df 100644 --- a/resources/language/English/strings.xml +++ b/resources/language/English/strings.xml @@ -37,6 +37,7 @@ Download via Torrent-client Download via Python-Libtorrent Sort search results by seeds + Custom search option phrase Interface P2P Network Advanced diff --git a/resources/language/Russian/strings.xml b/resources/language/Russian/strings.xml index 023ba85..ae9f45f 100644 --- a/resources/language/Russian/strings.xml +++ b/resources/language/Russian/strings.xml @@ -37,6 +37,7 @@ Скачать Торрент-клиентом Скачать Python-Libtorrent Сортировать поиск по количеству раздающих + Дополнительная фраза в вариантах поиска Интерфейс P2P Сеть Дополнительные diff --git a/resources/settings.xml b/resources/settings.xml index 86a74b2..04da69b 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -59,6 +59,7 @@ label="30025" default="1" /> +