diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 788ce0d..6fa092e 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,7 +1,19 @@ - + + + + + + + + + + + + + @@ -33,11 +45,11 @@ - + - - + + @@ -49,76 +61,65 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - + + - - + + - - - + + + + + - - + + - - - - - - - - - - - - + + @@ -138,7 +139,7 @@ - + @@ -148,12 +149,118 @@ - + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -185,29 +292,33 @@ @@ -261,38 +372,6 @@ diff --git a/Content.py b/Content.py index b8f100a..a6d6e8f 100644 --- a/Content.py +++ b/Content.py @@ -35,6 +35,7 @@ class Content: searchIcon = '/icons/video.png' sourceWeight = 1 cookieJar = None + baseurl = '' def isLabel(self): return 'Should search on ruhunt?' @@ -42,6 +43,9 @@ class Content: def isPages(self): return False + def isSort(self): + return False + def isScrappable(self): return True @@ -54,11 +58,11 @@ class Content: category_dict = { 'sites': ('[B]by Site[/B]',), 'search': ('[B]Search[/B]',), - 'movies': ('Forieng Movies',), + 'movies': ('Movies',), 'rus_movies': ('Russian Movies',), 'tvshows': ('TV Shows',), 'cartoons': ('Cartoons',), - 'hot': ('Hot & New',), + 'hot': ('Most Recent',), 'top': ('Top All Time',), 'anime': ('Anime',), 'year': {'year': 'by Year', }, @@ -77,7 +81,7 @@ class Content: for y in range(2015, 1970, -1): category_dict['year'][str(y)] = (str(y), '/top/y/%s/' % str(y)) - def get_contentList(self, category, subcategory=None, page=None): + def get_contentList(self, category, subcategory=None, property=None): ''' Retrieve keyword from the input and return a list of tuples: filesList.append(( @@ -103,7 +107,13 @@ class Content: has_category = True return has_category - def get_url(self, category, subcategory, page, baseurl): + def get_url(self, category, subcategory, apps_property): + page=None + sort=None + if apps_property: + page=apps_property.get('page') + sort=apps_property.get('sort') + if not subcategory or subcategory == True or category == 'search': get = self.category_dict[category] else: @@ -111,13 +121,19 @@ class Content: if category == 'search': get = (get[0], get[1] % urllib.quote_plus(subcategory.encode('utf-8'))) - if not page or page == 1: - url = baseurl + get[1] - else: - property = self.get_property(category, subcategory) + property = self.get_property(category, subcategory) + if not page or page == 1: + url = self.baseurl + get[1] + elif property: page_url = property['page'] % (property['second_page'] + ((page - 2) * property['increase'])) - url = baseurl + str(page_url) + url = self.baseurl + str(page_url) + + if property and property.get('sort'): + sort_dict=property['sort'][sort] + if sort_dict.get('url_after'): + page_url = sort_dict['url_after'] + url = url + page_url return url diff --git a/Core.py b/Core.py index 163678c..977a360 100644 --- a/Core.py +++ b/Core.py @@ -637,13 +637,23 @@ class Core: subcategory = apps.get('subcategory') provider = apps.get('provider') page = apps.get('page') if apps.get('page') else 1 + sort = apps.get('sort') if apps.get('sort') else 0 + apps_property={'page':page, 'sort':sort} property = self.Content.get_property(category, subcategory) - contentList = self.Content.get_contentList(category, subcategory, page) + contentList = self.Content.get_contentList(category, subcategory, apps_property) 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) + if property and property.get('sort'): + if len(property.get('sort'))>sort+1: + apps['sort'] = int(sort) + 1 + else: + apps['sort'] = 0 + print str(apps['sort']) + self.drawItem('[COLOR FFFFFFFF][B]%s: %s[/B][/COLOR]' % (self.localize('Sort'), self.localize(property['sort'][apps['sort']]['name'])), 'openContent', + json.dumps(apps), isFolder=True) if mode == 'tracker': self.drawtrackerList(provider, contentList) @@ -653,6 +663,12 @@ class Core: view_style('drawcontentList') #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) + xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=True) def full_download(self, params={}): @@ -709,7 +725,7 @@ class Core: if self.Content.isPages() and self.Content.get_property(category, subcategory): for i in range(1, 5 if category!='year' else 2): - contentList = self.Content.get_contentList(category, subcategory, i) + contentList = self.Content.get_contentList(category, subcategory, {'page':i}) self.drawcontentList(contentList) if self.breakdown: break else: @@ -821,7 +837,7 @@ class Core: listitem = xbmcgui.ListItem(title, iconImage=img, thumbnailImage=img) listitem.setInfo(type='Video', infoLabels=info) if meta: - self.itemScrap(listitem, meta) + listitem=itemScrap(listitem, meta) if meta.get('icon'): search_url['img'] = meta.get('icon') if meta.get('info').get('title'): @@ -856,29 +872,6 @@ class Core: progressBar.close() if self.debug and 1 == debug: lockView('wide') - def itemScrap(self, item, kwarg): - # Debug('[itemTVDB]:meta '+str(kwarg)) - if 'title' in kwarg and kwarg['title']: - item.setLabel(kwarg['title']) - - if 'label' in kwarg and kwarg['label']: - item.setLabel2(kwarg['label']) - - if 'icon' in kwarg and kwarg['icon']: - item.setIconImage(kwarg['icon']) - - if 'thumbnail' in kwarg and kwarg['thumbnail']: - item.setThumbnailImage(kwarg['thumbnail']) - - if 'properties' in kwarg and kwarg['properties']: - for key, value in kwarg['properties'].iteritems(): - item.setProperty(key, str(value)) - - if 'info' in kwarg and kwarg['properties']: - item.setInfo(type='Video', infoLabels=kwarg['info']) - - return item - def drawtrackerList(self, provider, contentList): contentList = sorted(contentList, key=lambda x: x[0], reverse=True) for num, originaltitle, title, year, img, info in contentList: diff --git a/Localization.py b/Localization.py index 0e4f47b..3b373d8 100644 --- a/Localization.py +++ b/Localization.py @@ -123,7 +123,7 @@ dictionary = { 'TV Shows': 'Сериалы', 'Cartoons': 'Мультфильмы', 'Anime': 'Аниме', - 'Hot & New': 'Горячие Новинки', + 'Most Recent': 'Горячие Новинки', 'Top 250 Movies': 'Лучшие 250 фильмов', 'Top All Time': 'Лучшее за ВСЕ ВРЕМЯ', 'by Genre': 'по Жанру', @@ -152,7 +152,6 @@ dictionary = { 'War': 'Военные', 'Western': 'Вестерны', '[B]by Site[/B]': '[B]по Сайту[/B]', - 'Movies': 'Фильмы', 'Cartoons Series': 'Мультсериалы', 'Cartoons Short': 'Мультфильмы (короткометражки)', 'Male': 'Мужские', @@ -161,7 +160,7 @@ dictionary = { 'Next Page': 'Следующая Страница', 'Previous Page': 'Предыдущая Страница', 'Russian Movies': 'Отечественные Фильмы', - 'Forieng Movies': 'Зарубежные Фильмы', + 'Movies': 'Зарубежные Фильмы', 'Anime Film': 'Полнометражное Аниме', 'Anime Series': 'Аниме Сериалы', 'Can\'t download torrent, probably no seeds available.': 'Не могу скачать торрент, скорее всего нет доступных сидов.', @@ -224,6 +223,9 @@ dictionary = { 'Add to MyShows.ru':'Добавить в MyShows.ru', 'Return to MyShows.ru':'Вернуться в MyShows.ru', 'Search results:':'Результаты поиска:', + 'by Seeders':'по Сидам', + 'by Date':'по Дате', + 'Sort':'Сортировка', } } diff --git a/changelog.txt b/changelog.txt index 1e63696..f0234e7 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,11 @@ -[B]Version 2.1.2[/B] +[B]Version 2.1.4[/B] +[+] Списки Медиа: Сортировка + +[B]Version 2.1.4[/B] +[+] Ace Stream: баг-фиксы +[+] Восстановлена работа с MyShows.ru + +[B]Version 2.1.3[/B] [+] Поиск: Добавлен французский t411.me по просьбе Zombi [+] Множественные баг-фиксы diff --git a/functions.py b/functions.py index 4670371..dc682a1 100644 --- a/functions.py +++ b/functions.py @@ -1545,4 +1545,27 @@ def unquote(string, ret=None): if ret: return ret else: - return string \ No newline at end of file + return string + +def itemScrap(item, kwarg): + # Debug('[itemTVDB]:meta '+str(kwarg)) + if 'title' in kwarg and kwarg['title']: + item.setLabel(kwarg['title']) + + if 'label' in kwarg and kwarg['label']: + item.setLabel2(kwarg['label']) + + if 'icon' in kwarg and kwarg['icon']: + item.setIconImage(kwarg['icon']) + + if 'thumbnail' in kwarg and kwarg['thumbnail']: + item.setThumbnailImage(kwarg['thumbnail']) + + if 'properties' in kwarg and kwarg['properties']: + for key, value in kwarg['properties'].iteritems(): + item.setProperty(key, str(value)) + + if 'info' in kwarg and kwarg['properties']: + item.setInfo(type='Video', infoLabels=kwarg['info']) + + return item \ No newline at end of file diff --git a/resources/contenters/CXZ.py b/resources/contenters/CXZ.py index baec708..a8f316a 100644 --- a/resources/contenters/CXZ.py +++ b/resources/contenters/CXZ.py @@ -26,12 +26,12 @@ from BeautifulSoup import BeautifulSoup def make_category_dict(): category_dict = { - 'movies': ('Forieng Movies', '/films/fl_foreign_hight/?'), + 'movies': ('Movies', '/films/fl_foreign_hight/?'), 'rus_movies': ('Russian Movies', '/films/fl_our_hight/?'), 'tvshows': ('TV Shows', '/serials/fl_hight/?'), 'cartoons': ('Cartoons', '/cartoons/fl_hight/?'), 'anime': ('Anime', '/cartoons/cartoon_genre/anime/?'), - 'hot': ('Hot & New', '/films/fl_hight/?'), + 'hot': ('Most Recent', '/films/fl_hight/?'), 'top': ('Top 250 Movies', '/films/fl_hight/?sort=popularity&'), 'genre': {'genre': 'by Genre', 'action': ('Action', '/films/film_genre/bojevik/?'), @@ -110,9 +110,9 @@ class CXZ(Content.Content): def isScrappable(self): return True - def get_contentList(self, category, subcategory=None, page=None): + def get_contentList(self, category, subcategory=None, apps_property=None): contentList = [] - url = self.get_url(category, subcategory, page, self.baseurl) + url = self.get_url(category, subcategory, apps_property) response = self.makeRequest(url, headers=self.headers) diff --git a/resources/contenters/EZTV.py b/resources/contenters/EZTV.py index 87b9a6f..34a5cab 100644 --- a/resources/contenters/EZTV.py +++ b/resources/contenters/EZTV.py @@ -22,7 +22,7 @@ import Content, re class EZTV(Content.Content): category_dict = { - 'hot': ('Hot & New', '/', {'page': '/page_%d', 'increase': 1, 'second_page': 1}), + 'hot': ('Most Recent', '/', {'page': '/page_%d', 'increase': 1, 'second_page': 1}), } baseurl = "https://eztv.ch" @@ -52,9 +52,9 @@ class EZTV(Content.Content): def isSearchOption(self): return False - def get_contentList(self, category, subcategory=None, page=None): + def get_contentList(self, category, subcategory=None, apps_property=None): contentList = [] - url = self.get_url(category, subcategory, page, self.baseurl) + url = self.get_url(category, subcategory, apps_property) response = self.makeRequest(url, headers=self.headers) diff --git a/resources/contenters/FastTorrent.py b/resources/contenters/FastTorrent.py index 632713e..249af2c 100644 --- a/resources/contenters/FastTorrent.py +++ b/resources/contenters/FastTorrent.py @@ -32,7 +32,7 @@ class FastTorrent(Content.Content): 'cartoons': ('Cartoons', '/last-multfilm-torrent/', {'page': '/last-multfilm-torrent/%d.html', 'increase': 1, 'second_page': 2}), 'anime': ('Anime', '/anime/multfilm/', {'page': '/anime/multfilm/%d.html', 'increase': 1, 'second_page': 2}), - 'hot': ('Hot & New', '/new-films/', {'page': '/new-films/%d.html', 'increase': 1, 'second_page': 2}), + 'hot': ('Most Recent', '/new-films/', {'page': '/new-films/%d.html', 'increase': 1, 'second_page': 2}), 'genre': {'genre': 'by Genre', 'amime_series': ('Anime Series', '/anime-serialy/multfilm/', {'page': '/anime-serialy/multfilm/%d.html', 'increase': 1, 'second_page': 2}), @@ -66,20 +66,9 @@ class FastTorrent(Content.Content): def isPages(self): return True - def get_contentList(self, category, subcategory=None, page=None): + def get_contentList(self, category, subcategory=None, apps_property=None): contentList = [] - if not subcategory or subcategory == True: - get = self.category_dict[category] - else: - get = self.category_dict[category][subcategory] - - if not page or page == 1: - url = self.baseurl + get[1] - else: - property = self.get_property(category, subcategory) - - page_url = property['page'] % (property['second_page'] + ((page - 2) * property['increase'])) - url = self.baseurl + str(page_url) + url = self.get_url(category, subcategory, apps_property) response = self.makeRequest(url, headers=self.headers) diff --git a/resources/contenters/IMDB.py b/resources/contenters/IMDB.py index 6ca8696..8c0854f 100644 --- a/resources/contenters/IMDB.py +++ b/resources/contenters/IMDB.py @@ -27,13 +27,13 @@ from BeautifulSoup import BeautifulSoup class IMDB(Content.Content): category_dict = { - 'movies': ('Forieng Movies', '/search/title?languages=en|1&title_type=feature&sort=moviemeter,asc'), + 'movies': ('Movies', '/search/title?languages=en|1&title_type=feature&sort=moviemeter,asc'), 'rus_movies': ('Russian Movies', '/search/title?languages=ru|1&title_type=feature&sort=moviemeter,asc'), 'tvshows': ('TV Shows', '/search/title?count=100&title_type=tv_series,mini_series&ref_=gnr_tv_mp'), 'cartoons': ('Cartoons', '/search/title?genres=animation&title_type=feature&sort=moviemeter,asc'), 'anime': ('Anime', '/search/title?count=100&genres=animation&keywords=anime&num_votes=1000,&explore=title_type&ref_=gnr_kw_an'), - 'hot': ('Hot & New', '/search/title?count=100&title_type=feature%2Ctv_series%2Ctv_movie&ref_=nv_ch_mm_1'), + 'hot': ('Most Recent', '/search/title?count=100&title_type=feature%2Ctv_series%2Ctv_movie&ref_=nv_ch_mm_1'), 'top': ('Top 250 Movies', '/chart/top/'), 'search': ('[B]Search[/B]', '/find?q=%s&s=tt&ttype=ft'), 'year': {'year': 'by Year', }, @@ -93,9 +93,9 @@ class IMDB(Content.Content): def isScrappable(self): return True - def get_contentList(self, category, subcategory=None, page=None): + def get_contentList(self, category, subcategory=None, apps_property=None): contentList = [] - url = self.get_url(category, subcategory, page, self.baseurl) + url = self.get_url(category, subcategory, apps_property) response = self.makeRequest(url, headers=self.headers) diff --git a/resources/contenters/KickAssSo.py b/resources/contenters/KickAssSo.py index 1ed2a73..dce736f 100644 --- a/resources/contenters/KickAssSo.py +++ b/resources/contenters/KickAssSo.py @@ -22,10 +22,18 @@ import Content class KickAssSo(Content.Content): category_dict = { - 'hot': ('Hot & New', '/new/', {'page': '/new/%d/', 'increase': 1, 'second_page': 2}), - 'anime': ('Anime', '/anime/', {'page': '/anime/%d/', 'increase': 1, 'second_page': 2}), - 'tvshows': ('TV Shows', '/tv/', {'page': '/tv/%d/', 'increase': 1, 'second_page': 2}), - 'movies': ('Forieng Movies', '/movies/', {'page': '/movies/%d/', 'increase': 1, 'second_page': 2}), + 'hot': ('Most Recent', '/new/', {'page': '/new/%d/', 'increase': 1, 'second_page': 2, + 'sort':[{'name':'by Seeders', 'url_after':'?field=seeders&sorder=desc'}, + {'name':'by Date', 'url_after':'?field=time_add&sorder=desc'}]}), + 'anime': ('Anime', '/anime/', {'page': '/anime/%d/', 'increase': 1, 'second_page': 2, + 'sort':[{'name':'by Seeders', 'url_after':'?field=seeders&sorder=desc'}, + {'name':'by Date', 'url_after':'?field=time_add&sorder=desc'}]}), + 'tvshows': ('TV Shows', '/tv/', {'page': '/tv/%d/', 'increase': 1, 'second_page': 2, + 'sort':[{'name':'by Seeders', 'url_after':'?field=seeders&sorder=desc'}, + {'name':'by Date', 'url_after':'?field=time_add&sorder=desc'}]}), + 'movies': ('Movies', '/movies/', {'page': '/movies/%d/', 'increase': 1, 'second_page': 2, + 'sort':[{'name':'by Seeders', 'url_after':'?field=seeders&sorder=desc'}, + {'name':'by Date', 'url_after':'?field=time_add&sorder=desc'}]}), } baseurl = "http://kickass.so" @@ -52,12 +60,15 @@ class KickAssSo(Content.Content): def isPages(self): return True + def isSort(self): + return True + def isSearchOption(self): return False - def get_contentList(self, category, subcategory=None, page=None): + def get_contentList(self, category, subcategory=None, apps_property=None): contentList = [] - url = self.get_url(category, subcategory, page, self.baseurl) + url = self.get_url(category, subcategory, apps_property) response = self.makeRequest(url, headers=self.headers) diff --git a/resources/contenters/KinoPoisk.py b/resources/contenters/KinoPoisk.py index a4b9be0..5155e16 100644 --- a/resources/contenters/KinoPoisk.py +++ b/resources/contenters/KinoPoisk.py @@ -30,10 +30,10 @@ class KinoPoisk(Content.Content): 'tvshows': ('TV Shows', '/top/serial/list/'), 'cartoons': ('Cartoons', '/top/id_genre/14/'), 'search': ('[B]Search[/B]', '/s/type/film/list/1/find/%s/'), - 'movies': ('Forieng Movies', '/s/type/film/list/1/m_act[country]/1/m_act[type]/film/'), + 'movies': ('Movies', '/s/type/film/list/1/m_act[country]/1/m_act[type]/film/'), 'rus_movies': ('Russian Movies', '/s/type/film/list/1/m_act[country]/2/m_act[type]/film/'), 'anime': ('Anime', '/s/type/film/list/1/order/rating/m_act[genre][0]/1750/',), - 'hot': ('Hot & New', '/popular/'), + 'hot': ('Most Recent', '/popular/'), 'top': ('Top 250 Movies', '/top/'), 'genre': {'genre': 'by Genre', 'russia': ('Russia & USSR', '/top/rus/list/'), @@ -99,10 +99,10 @@ class KinoPoisk(Content.Content): def isScrappable(self): return True - def get_contentList(self, category, subcategory=None, page=None): + def get_contentList(self, category, subcategory=None, apps_property=None): socket.setdefaulttimeout(15) contentList = [] - url = self.get_url(category, subcategory, page, self.baseurl) + url = self.get_url(category, subcategory, apps_property) #print url response = self.makeRequest(url, headers=self.headers) diff --git a/resources/contenters/RiperAM.py b/resources/contenters/RiperAM.py index 74cd062..27b6a07 100644 --- a/resources/contenters/RiperAM.py +++ b/resources/contenters/RiperAM.py @@ -28,7 +28,7 @@ class RiperAM(Content.Content): #'tvshows':('TV Shows', '/top/serial/list/'), #'cartoons':('Cartoons', '/top/id_genre/14/'), #'anime':('Anime', '/search/title?count=100&genres=animation&keywords=anime&num_votes=1000,&explore=title_type&ref_=gnr_kw_an'), - 'hot': ('Hot & New', '/', {'page': '/portal.php?tp=%d', 'increase': 30, 'second_page': 30}), + 'hot': ('Most Recent', '/', {'page': '/portal.php?tp=%d', 'increase': 30, 'second_page': 30}), #'top':('Top 250 Movies', '/top/'), } @@ -60,9 +60,9 @@ class RiperAM(Content.Content): def isSearchOption(self): return False - def get_contentList(self, category, subcategory=None, page=None): + def get_contentList(self, category, subcategory=None, apps_property=None): contentList = [] - url = self.get_url(category, subcategory, page, self.baseurl) + url = self.get_url(category, subcategory, apps_property) response = self.makeRequest(url, headers=self.headers)