From 730d1bf4921b7989ba6a966107bbbd84b11af863 Mon Sep 17 00:00:00 2001 From: DiMartinoXBMC Date: Sat, 4 Jul 2015 18:53:45 +0300 Subject: [PATCH] fixes --- Core.py | 3 ++- addon.xml | 2 +- changelog.txt | 6 ++++- functions.py | 50 +++++++++++++++++------------------- resources/contenters/IMDB.py | 6 ++--- 5 files changed, 34 insertions(+), 33 deletions(-) diff --git a/Core.py b/Core.py index 92cfc10..779ede6 100644 --- a/Core.py +++ b/Core.py @@ -274,7 +274,6 @@ class Core: #print str(Searchers().list()) first_run_230(False) - def DownloadStatus(self, params={}): db = DownloadDB() get = params.get @@ -1568,6 +1567,8 @@ class Core: ] title = self.titleMake(seeds, leechers, size, title) + #print image + if self.open_option==0: self.drawItem(title, 'openTorrent', link_dict, image, contextMenu=contextMenu, replaceMenu=False) elif self.open_option==1: diff --git a/addon.xml b/addon.xml index ba700c5..1f8ffb6 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@  - + diff --git a/changelog.txt b/changelog.txt index 7cc4b36..0b7abab 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,8 @@ -[B]Version 2.3.0[/B] +[B]Version 2.3.1[/B] +[+] Загрузка: Исправлена ошибка удаления базы данных +[+] Списки Медиа: Исправлен IMDB TOP 250 + +[B]Version 2.3.0[/B] [+] Поиск: Поиск существенно ускорился, стал многопоточным (пока 3 потока одновременно) [+] Поиск: Добавлена поддержка внешних серчеров с индивидуальными настройками (в стиле Pulsar) [+] Обновлено окно Torrenter Global Control Center diff --git a/functions.py b/functions.py index beed8f5..9d56909 100644 --- a/functions.py +++ b/functions.py @@ -1109,7 +1109,7 @@ class Searchers(): def get_active(self): get_active = [] - for searcher in self.list().iterkeys(): + for searcher in self.list().keys(): if self.old(searcher): get_active.append(searcher + '.py') print 'Active Searchers: ' + str(get_active) return get_active @@ -1559,48 +1559,44 @@ class DownloadDB: def get_all(self): self._connect() - try: - self.cur.execute( - 'select addtime, title, path, type, jsoninfo, status, torrent, ind, lastupdate, storage from downloads order by addtime DESC') - except: - Debug('[DownloadDB]: DELETE ' + str(self.filename)) - xbmcvfs.delete(self.filename) - self._connect() - self.cur.execute( - 'select addtime, title, path, type, jsoninfo, status, torrent, ind, lastupdate, storage from downloads order by addtime DESC') + self._execute( + 'select addtime, title, path, type, jsoninfo, status, torrent, ind, lastupdate, storage from downloads order by addtime DESC') x = self.cur.fetchall() self._close() return x if x else None def get(self, title): self._connect() - try: - self.cur.execute( - 'select addtime, title, path, type, jsoninfo, status, torrent, ind, lastupdate, storage from downloads where title="' + decode( - title) + '"') - except: - Debug('[DownloadDB]: DELETE ' + str(self.filename)) - xbmcvfs.delete(self.filename) - self._connect() - self.cur.execute( - 'select addtime, title, path, type, jsoninfo, status, torrent, ind, lastupdate, storage from downloads where title="' + decode( - title) + '"') + self._execute( + 'select addtime, title, path, type, jsoninfo, status, torrent, ind, lastupdate, storage from downloads where title="' + decode( + title) + '"') x = self.cur.fetchone() self._close() return x if x else None def get_byaddtime(self, addtime): self._connect() - self.cur.execute( + self._execute( 'select addtime, title, path, type, jsoninfo, status, torrent, ind, lastupdate, storage from downloads where addtime="' + str( addtime) + '"') x = self.cur.fetchone() self._close() return x if x else None + def _execute(self, sql): + try: + self.cur.execute(sql) + except: + self._close() + Debug('[DownloadDB]: DELETE ' + str(self.filename)) + xbmcvfs.delete(self.filename) + self._connect() + self.cur.execute(sql) + + def get_status(self, title): self._connect() - self.cur.execute('select status from downloads where title="' + decode(title) + '"') + self._execute('select status from downloads where title="' + decode(title) + '"') x = self.cur.fetchone() self._close() return x[0] if x else None @@ -1625,7 +1621,7 @@ class DownloadDB: except: pass self._connect() - self.cur.execute( + self._execute( 'UPDATE downloads SET jsoninfo = "' + urllib.quote_plus(json.dumps(info)) + '", lastupdate=' + str( int(time.time())) + ' where title="' + title + '"') self.db.commit() @@ -1633,19 +1629,19 @@ class DownloadDB: def update_status(self, addtime, status): self._connect() - self.cur.execute('UPDATE downloads SET status = "' + status + '" where addtime="' + str(addtime) + '"') + self._execute('UPDATE downloads SET status = "' + status + '" where addtime="' + str(addtime) + '"') self.db.commit() self._close() def delete(self, addtime): self._connect() - self.cur.execute('delete from downloads where addtime="' + str(addtime) + '"') + self._execute('delete from downloads where addtime="' + str(addtime) + '"') self.db.commit() self._close() def clear(self): self._connect() - self.cur.execute('delete from downloads') + self._execute('delete from downloads') self.db.commit() self._close() diff --git a/resources/contenters/IMDB.py b/resources/contenters/IMDB.py index 8c0854f..ca7e675 100644 --- a/resources/contenters/IMDB.py +++ b/resources/contenters/IMDB.py @@ -187,14 +187,14 @@ class IMDB(Content.Content): def topmode(self, response): contentList = [] Soup = BeautifulSoup(response) - result = Soup.findAll('tr', {'class': ['odd', 'even']}) + result = Soup.findAll('tr')[1:251] for tr in result: #main tdtitle = tr.find('td', 'titleColumn') - num = tdtitle.find('span', {'name': 'ir'}).text.rstrip('.') + num = tr.find('span', {'name': 'rk'}).get('data-value').rstrip('.') originaltitle = None title = tdtitle.find('a').text - year = tdtitle.find('span', {'name': 'rd'}).text.rstrip(')').lstrip('(') + year = tdtitle.find('span', {'class': 'secondaryInfo'}).text.rstrip(')').lstrip('(') tdposter = tr.find('td', 'posterColumn') img = self.biggerImg(tdposter.find('img').get('src'))