From 93ac8c34b08177dfadc44a6b93c2fdacd4192d43 Mon Sep 17 00:00:00 2001 From: VitaliyS Date: Thu, 6 Feb 2014 00:10:43 +0200 Subject: upd: kinopoisk.py --- data/locales/ru.txt | 33 ++++++++++----------------------- data/locales/ua.txt | 38 ++++++++++++++------------------------ plugins/kinopoisk.py | 28 ++++++++++++++-------------- 3 files changed, 38 insertions(+), 61 deletions(-) diff --git a/data/locales/ru.txt b/data/locales/ru.txt index 688a3d6..bc900e4 100644 --- a/data/locales/ru.txt +++ b/data/locales/ru.txt @@ -1,25 +1,9 @@ -# --------------------------------------------------------------------------- # -# # -# Russian locale (woman) for iSida Jabber Bot # -# Copyright (C) diSabler # -# # -# 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 . # -# # -# --------------------------------------------------------------------------- # +#--------------------------------------------- +# Autogenerate for locales +# (c) Disabler Production Lab. +#--------------------------------------------- # file: kernel.py -Unknown error! Неизвестная ошибка! Error! Ошибка! Got a fake iq answer! Получен фальшивый ответ на запрос! Warning! Exceeded the limit of sending the same commands. You to ignore for %s. Внимание! Превышен лимит отправки одинаковых команд. Вы в игноре %s. @@ -29,6 +13,7 @@ Fetched xhtml image: %s%s Получено xhtml изображение: %s%s Too many letters! Слишком многа букаф! whitelist белый список lock by hash блок по хешу +Unknown error! Неизвестная ошибка! off выкл Deny by hash lock! Ограничение по хешу клиента! /me detect bad stanza from %s /me смотрит на %s и думает: "Факин умник детектед!" @@ -652,7 +637,6 @@ Empty! Пусто! type %s, %s тип %s, %s Uptime: %s Аптайм: %s I can't do it Не получается... -Remote server not found Удалённый сервер не найден Ping from you %s sec. Пинг от тебя %s сек. Ping from %s %s sec. Пинг от %s %s сек. Unknown server answer! Неизвестный ответ сервера! @@ -779,7 +763,7 @@ Time from last change %s's karma is very small. Please wait %s Вы недавн Karma.\nkarma [show] nick\nkarma top+|- [count]\nFor change karma: nick: +1\nnick: -1 Карма участника.\nkarma [show] nick\nkarma top+|- [количество]\nДля изменения:\nnick: +1\nnick: -1 # file: plugins/kinopoisk.py -Search in www.kinopoisk.ru. Example:\nfilm [id] film_id\nfilm [search] film_name Поиск по www.kinopoisk.ru. Пример:\nfilm [id] film_id\nfilm [search] film_name +Search in www.kinopoisk.ru. Example:\nfilm film_name Поиск по www.kinopoisk.ru. Пример:\nfilm название фильма # file: plugins/known.py I know you as: Я видела тебя как: @@ -911,6 +895,7 @@ Payment required Запрещено внутренней политикой се Recipient unavailable Получатель недоступен Redirect Переадресация Registration required Требуется регистрация +Remote server not found Удалённый сервер не найден Remote server timeout Таймаут удалённого сервера Resource constraint Ограничение ресурсов Service unavailable Сервис недоступен @@ -918,6 +903,7 @@ Subscription required Требуется подписка Undefined condition Неопределенное состояние Unexpected request Неожиданный запрос Password required Требуется пароль +Forbidden Запрещено Members-only Только для постоянных участников Room now shows unavailable members. Комната показывает недоступных участников. Room now does not show unavailable members. Комната не показывает недоступных участников. @@ -1830,5 +1816,6 @@ Youtube settings Настройки youtube API settings Настройки API # write locale file: ru.txt -# total: 1500 +# total: 1479 # missed translations: 1 + diff --git a/data/locales/ua.txt b/data/locales/ua.txt index aab7397..853660c 100644 --- a/data/locales/ua.txt +++ b/data/locales/ua.txt @@ -1,25 +1,9 @@ -# --------------------------------------------------------------------------- # -# # -# Ukrainian locale (woman) for iSida Jabber Bot # -# Copyright (C) Vit@liy # -# # -# 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 . # -# # -# --------------------------------------------------------------------------- # +#--------------------------------------------- +# Autogenerate for locales +# (c) Disabler Production Lab. +#--------------------------------------------- # file: kernel.py -Unknown error! Невідома помилка! Error! Помилка! Got a fake iq answer! Отримано підроблену відповідь на запит! Warning! Exceeded the limit of sending the same commands. You to ignore for %s. Увага! Перевищено ліміт відправлення однакових команд. Ви в ігнорі %s. @@ -29,6 +13,7 @@ Fetched xhtml image: %s%s Отримано xhtml-зображення: %s%s Too many letters! Забагато літер! whitelist білий список lock by hash блок по хешу +Unknown error! Невідома помилка! off вимк Deny by hash lock! Обмеження по хешу клієнта! /me detect bad stanza from %s /me дивиться на %s і гадає: "Факін розумник детектед!" @@ -652,7 +637,6 @@ Empty! Пусто! type %s, %s тип %s, %s Uptime: %s Аптайм: %s I can't do it Не виходить... -Remote server not found Віддалений сервер не знайдено Ping from you %s sec. Пінг від тебе - %s сек. Ping from %s %s sec. Пінг від %s - %s сек. Unknown server answer! Невідома відповідь сервера @@ -779,7 +763,7 @@ Time from last change %s's karma is very small. Please wait %s Ви нещода Karma.\nkarma [show] nick\nkarma top+|- [count]\nFor change karma: nick: +1\nnick: -1 Карма учасника.\nkarma [show] nick\nkarma top+|- [кількість]\nДля зміни:\nnick: +1\nnick: -1 # file: plugins/kinopoisk.py -Search in www.kinopoisk.ru. Example:\nfilm [id] film_id\nfilm [search] film_name Пошук по www.kinopoisk.ru. Приклад:\nfilm [id] film_id\nfilm [search] film_name +Search in www.kinopoisk.ru. Example:\nfilm film_name Пошук по www.kinopoisk.ru. Приклад:\nfilm назва фільму # file: plugins/known.py I know you as: Я бачила тебе як: @@ -911,6 +895,7 @@ Payment required Заборонено внутрішньою політикою Recipient unavailable Отримувач не доступний Redirect Переадресація Registration required Потрібна реєстрація +Remote server not found Віддалений сервер не знайдено Remote server timeout Таймаут віддаленого сервера Resource constraint Обмеження ресурсів Service unavailable Сервіс недоступний @@ -918,6 +903,7 @@ Subscription required Потрібна підписка Undefined condition Невизначений стан Unexpected request Несподіваний запит Password required Потрібен пароль +Forbidden Заборонено Members-only Тільки для постійних учасників Room now shows unavailable members. Кімната показує недоступних учасників. Room now does not show unavailable members. Кімната не показує недоступних учасників. @@ -1266,6 +1252,10 @@ Soft update from VCS. М'яке поновлення із VCS. # file: plugins/sokr.py Abbreviations.\nExamples: sokr abbr, sokr 6 abbr, sokr 3-7 abbr Абревіатури. Приклади використання: sokr abbr, sokr 6 abbr, sokr 3-7 abbr +# file: plugins/sovm.py +Sign not found! Знак не знайдено! +Reconcilability between zodiac signs Сумісність знаків зодіаку + # file: plugins/spellcheck.py Spellchecker. Example: spell [uk|ru|en] sentence Перевірка орфографії. Приклад: spell [uk|ru|en] речення @@ -1826,6 +1816,6 @@ Youtube settings Налаштування Youtube API settings Налаштування API # write locale file: ua.txt -# total: 1500 -# missed translations: 2 +# total: 1479 +# missed translations: 3 diff --git a/plugins/kinopoisk.py b/plugins/kinopoisk.py index d6181f8..b4298d4 100644 --- a/plugins/kinopoisk.py +++ b/plugins/kinopoisk.py @@ -22,31 +22,31 @@ # --------------------------------------------------------------------------- # kinopoisk_error_string = '' -kinopoisk_error_regexp = '(.*?)

' def kinopoisk(type, jid, nick, text): - text=text.strip().split(' ', 1) - if len(text) == 2 and not text[0] in ['id', 'search'] or len(text) == 1: text = [' ', ' '.join(text)] - if text[0] == 'search' or text[0] == ' ' and not re.search('^\d+$', text[-1]): - query=urllib.quote(text[-1].encode('cp1251')) + text=text.strip() + if len(text) > 2: + query=urllib.quote(text.encode('cp1251')) data = html_encode(load_page('http://m.kinopoisk.ru/search/'+query)) if kinopoisk_error_string in data: msg = unhtml_hard(re.findall(kinopoisk_error_regexp,data,re.I+re.U+re.S)[0]) else: temp_urls = re.findall('(.+?)', data) if temp_urls: msg = L('Found:','%s/%s'%(jid,nick)) - for t_u in temp_urls: - msg += '\n%s - %s' % (t_u[0], t_u[1]) + for n, t_u in enumerate(temp_urls): + rs = '' + if n < 3: + try: + r = load_page('http://www.kinopoisk.ru/rating/%s.xml' % t_u[0]) + r = re.findall('>([\.\d]+?)<', r) + rs = ' (KP: %s / IMDB: %s)' % (r[0], r[1]) + except: + pass + msg += '\nhttp://www.kinopoisk.ru/film/%s/ - %s%s' % (t_u[0], t_u[1], rs) else: msg = L('Not found!','%s/%s'%(jid,nick)) - elif re.search('^\d+$', text[-1]): - data = html_encode(load_page('http://m.kinopoisk.ru/movie/'+text[-1])) - if kinopoisk_error_string in data: msg = unhtml_hard(re.findall(kinopoisk_error_regexp,data,re.I+re.U+re.S)[0]) - else: - tmp = unhtml_hard(re.search('

((?:.|\s)+?)', data).group(1)).split('\n') - msg = '\n'.join([i[0].upper()+i[1:] for i in tmp]) else: msg = L('What?','%s/%s'%(jid,nick)) send_msg(type,jid,nick,msg) global execute -execute = [(0, 'film', kinopoisk, 2, 'Search in www.kinopoisk.ru. Example:\nfilm [id] film_id\nfilm [search] film_name')] +execute = [(0, 'film', kinopoisk, 2, 'Search in www.kinopoisk.ru. Example:\nfilm film_name')] -- cgit v1.2.3