From 4d251b94a3fa67ab1f198e1ffc95c7f701428bb9 Mon Sep 17 00:00:00 2001 From: Dima73 Date: Sat, 1 Oct 2016 00:34:56 +0300 Subject: [PATCH 1/4] [simplerss] update plugin -add ru.po -fix close if add new feed -add more options --- simplerss/CONTROL/control | 2 +- simplerss/meta/plugin_simplerss.xml | 4 +- simplerss/po/Makefile.am | 2 +- simplerss/po/ru.po | 168 ++++++++++++++++++++++++++++ simplerss/src/Makefile.am | 2 +- simplerss/src/RSSSetup.py | 55 +++++---- simplerss/src/RSSTickerView.py | 31 ++++- simplerss/src/__init__.py | 3 +- simplerss/src/plugin.py | 32 +++--- simplerss/src/rss.png | Bin 0 -> 1030 bytes 10 files changed, 248 insertions(+), 51 deletions(-) create mode 100644 simplerss/po/ru.po create mode 100644 simplerss/src/rss.png diff --git a/simplerss/CONTROL/control b/simplerss/CONTROL/control index 442e96905..84a5aaa5e 100644 --- a/simplerss/CONTROL/control +++ b/simplerss/CONTROL/control @@ -2,4 +2,4 @@ Package: enigma2-plugin-extensions-simplerss Version: 0.9-20071007-r0 Description: rss viewer for the enigma2 gui Maintainer: OpenPLi team -Depends: enigma2 (>= 2.6git20091014), python-twisted-web, python-codecs, python-xml, python-html, enigma2-plugin-extensions-mediadownloader +Depends: python-twisted-web, python-codecs, python-xml, python-html diff --git a/simplerss/meta/plugin_simplerss.xml b/simplerss/meta/plugin_simplerss.xml index b1d3bb340..7e3164cb6 100644 --- a/simplerss/meta/plugin_simplerss.xml +++ b/simplerss/meta/plugin_simplerss.xml @@ -7,8 +7,8 @@ SimpleRSS enigma2-plugin-extensions-simplerss RSS viewer - SimpleRSS allows reading RSS newsfeeds on your Dreambox. - + SimpleRSS allows reading RSS newsfeeds on your box. + diff --git a/simplerss/po/Makefile.am b/simplerss/po/Makefile.am index 9eb1b06f7..77c2b7d2e 100644 --- a/simplerss/po/Makefile.am +++ b/simplerss/po/Makefile.am @@ -1,3 +1,3 @@ PLUGIN = SimpleRSS -LANGS = de es it nl sr tr fa +LANGS = de es it nl sr tr fa ru include $(top_srcdir)/Rules-po.mak diff --git a/simplerss/po/ru.po b/simplerss/po/ru.po new file mode 100644 index 000000000..38ff99456 --- /dev/null +++ b/simplerss/po/ru.po @@ -0,0 +1,168 @@ +msgid "" +msgstr "" +"Project-Id-Version: RSSReader\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2009-07-29 01:13+0100\n" +"PO-Revision-Date: 2016-10-01 00:12+0300\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Poedit-SourceCharset: UTF-8\n" +"X-Generator: Poedit 1.8.9\n" +"Last-Translator: Dimitrij \n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" +"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" +"Language: ru_UA\n" + +msgid "RSS Reader" +msgstr "Просмотр RSS" + +msgid "New Items" +msgstr "Новые сообщения" + +msgid "Autoupdate" +msgstr "Автообновление" + +msgid "Feed URI" +msgstr "Адрес ленты" + +msgid "Simple RSS Reader Setup" +msgstr "Простое чтение RSS лент - настройки" + +msgid "Simple RSS Reader" +msgstr "Простое чтение RSS лент" + +msgid "Feed" +msgstr "Лента" + +msgid "New" +msgstr "Новая" + +msgid "Start automatically with Enigma2" +msgstr "Автозапуск" + +msgid "Keep running in background" +msgstr "Продолжать работу в фоновом режиме" + +msgid "Show new Messages as" +msgstr "Показывать новые сообщения как" + +msgid "Update Interval (min)" +msgstr "Интервал обновления (мин)" + +msgid "Fetch feeds from Google Reader?" +msgstr "Получать ленты из 'Google Reader'" + +msgid "Google Username" +msgstr "Имя пользователя Google" + +msgid "Google Password" +msgstr "Пароль Google" + +msgid "" +"Really delete this entry?\n" +"It cannot be recovered!" +msgstr "" +"Вы действительно хотите удалить эту запись?\n" +"Запись потом не может быть восстановлена!" + +msgid "" +"Error while parsing Feed, this usually means there is something wrong with " +"it." +msgstr "Ошибка при чтении фленты." + +msgid "" +"Update is being done in Background.\n" +"Contents will automatically be updated when it's done." +msgstr "" +"Обновление будет выполнено в фоновом режиме.\n" +"Контент будет автоматически обновлен." + +msgid "Found no Enclosure we can display." +msgstr "Не найдено вложений для показа." + +msgid "Entry %s/%s" +msgstr "Запись %s/%s" + +msgid "Enclosures" +msgstr "Вложений" + +msgid "Simple RSS Reader: %s" +msgstr "Простой просмотр RSS: %s" + +msgid "No such Item." +msgstr "Нет сообщений для показа." + +msgid "Feed is empty." +msgstr "Лента пустая." + +msgid "Entries" +msgstr "записей" + +msgid "Feed %s/%s" +msgstr "Лента %s/%s" + +msgid "Update Feed" +msgstr "Обновление ленты" + +msgid "What to do?" +msgstr "Что Вы хотите сделать?" + +msgid "New Items since last Auto-Update" +msgstr "Новые сообщения из последнего автообновления" + +msgid "Failed to login to Google Reader." +msgstr "Ошибочный логин в 'Google Reader'." + +msgid "Failed to get subscriptions from Google Reader." +msgstr "Не удалось получить подписки из 'Google Reader'." + +msgid "" +"Sorry, this type of feed is unsupported:\n" +"%s" +msgstr "" +"К сожалению, этот тип ленты не поддерживается:\n" +"%s" + +msgid "Received %d new news item(s)." +msgstr "Получено %d новых сообщений." + +msgid "Notification" +msgstr "Уведомление" + +msgid "Preview" +msgstr "Превью" + +msgid "Ticker" +msgstr "Бегущая строка" + +msgid "none" +msgstr "ничего" + +msgid "%d Feed(s) were added to configuration." +msgstr "%d лент был добавлено в конфигурацию." + +msgid "Subscribe Newsfeed..." +msgstr "Подписка фида новостей..." + +msgid "A simple to use RSS reader" +msgstr "Плагин для просмотра сообщений RSS" + +msgid "View RSS..." +msgstr "Просмотр RSS..." + +msgid "Unsupported Feed: %s" +msgstr "Лента не поддерживается" + +msgid "RSS-Reader" +msgstr "RSS-просмотр" + +msgid "Let's you view current RSS entries" +msgstr "Просмотр Ваших текущих RSS лент" + +msgid "Scroll speed (ms)" +msgstr "Скорость прокрутки (мс)" + +msgid "Show in extensions menu" +msgstr "Показать плагин в меню расширений" diff --git a/simplerss/src/Makefile.am b/simplerss/src/Makefile.am index d414c0978..b5694431f 100644 --- a/simplerss/src/Makefile.am +++ b/simplerss/src/Makefile.am @@ -1,4 +1,4 @@ installdir = $(libdir)/enigma2/python/Plugins/Extensions/SimpleRSS install_PYTHON = *.py -install_DATA = maintainer.info +install_DATA = maintainer.info rss.png diff --git a/simplerss/src/RSSSetup.py b/simplerss/src/RSSSetup.py index 68adee441..8e50a17c1 100644 --- a/simplerss/src/RSSSetup.py +++ b/simplerss/src/RSSSetup.py @@ -2,7 +2,7 @@ from . import _ from Screens.Screen import Screen -from Components.config import config, ConfigSubsection, ConfigEnableDisable, \ +from Components.config import config, ConfigSubsection, ConfigYesNo, \ ConfigText, getConfigListEntry from Components.ConfigList import ConfigListScreen from Components.Sources.StaticText import StaticText @@ -33,7 +33,7 @@ def __init__(self, session, id): }, -1) self.id = id - + self["VirtualKB"].setEnabled(True) self.onLayoutFinish.append(self.setCustomTitle) def setCustomTitle(self): @@ -44,6 +44,16 @@ def save(self): config.plugins.simpleRSS.feed.save() self.close() + def KeyText(self): + if self["config"].getCurrent() is not None: + if isinstance(self["config"].getCurrent()[1], ConfigText): + ConfigListScreen.KeyText(self) + + def keyCancel(self): + for x in self["config"].list: + x[1].cancel() + self.close() + class RSSSetup(ConfigListScreen, Screen): """Setup for SimpleRSS, quick-edit for Feed-URIs and settings present.""" skin = """ @@ -62,14 +72,9 @@ class RSSSetup(ConfigListScreen, Screen): def __init__(self, session, rssPoller = None): Screen.__init__(self, session) self.rssPoller = rssPoller - - self.createSetup() - config.plugins.simpleRSS.autostart.addNotifier(self.elementChanged, initial_call = False) - config.plugins.simpleRSS.enable_google_reader.addNotifier(self.elementChanged, initial_call = False) - - # Initialize ConfigListScreen + self.list = [] ConfigListScreen.__init__(self, self.list, session) - + self.createSetup() self["key_red"] = StaticText(_("Cancel")) self["key_green"] = StaticText(_("OK")) self["key_yellow"] = StaticText(_("New")) @@ -107,8 +112,12 @@ def createSetup(self): list.append(self.keep_running) # Append Last two config Elements + list.append(getConfigListEntry(_("Show new Messages as"), simpleRSS.update_notification)) + + if simpleRSS.update_notification.value == "ticker": + list.append(getConfigListEntry(_("Scroll speed (ms)"), simpleRSS.ticker_speed)) + list.extend(( - getConfigListEntry(_("Show new Messages as"), simpleRSS.update_notification), getConfigListEntry(_("Update Interval (min)"), simpleRSS.interval), getConfigListEntry(_("Fetch feeds from Google Reader?"), simpleRSS.enable_google_reader), )) @@ -119,10 +128,8 @@ def createSetup(self): getConfigListEntry(_("Google Password"), simpleRSS.google_password), )) + list.append(getConfigListEntry(_("Show in extensions menu"), simpleRSS.ext_menu)) self.list = list - - def elementChanged(self, instance): - self.createSetup() self["config"].setList(self.list) def notificationChanged(self, instance): @@ -163,11 +170,19 @@ def refresh(self): # TODO: anything to be done here? pass + def keyLeft(self): + ConfigListScreen.keyLeft(self) + self.createSetup() + + def keyRight(self): + ConfigListScreen.keyRight(self) + self.createSetup() + def new(self): l = config.plugins.simpleRSS.feed s = ConfigSubsection() s.uri = ConfigText(default="http://", fixed_size = False) - s.autoupdate = ConfigEnableDisable(default=True) + s.autoupdate = ConfigYesNo(default=True) id = len(l) l.append(s) @@ -183,7 +198,6 @@ def conditionalNew(self): else: config.plugins.simpleRSS.feedcount.value = id+1 self.createSetup() - self["config"].setList(self.list) def keySave(self): # Tell Poller to recreate List if present @@ -191,13 +205,14 @@ def keySave(self): self.rssPoller.triggerReload() ConfigListScreen.keySave(self) + def keyCancel(self): + for x in self["config"].list: + x[1].cancel() + self.close() + def abort(self): simpleRSS = config.plugins.simpleRSS - # Remove Notifier - simpleRSS.autostart.notifiers.remove(self.elementChanged) - simpleRSS.enable_google_reader.notifiers.remove(self.elementChanged) - # Handle ticker self.notificationChanged(simpleRSS.update_notification) @@ -211,7 +226,7 @@ def addFeed(address, auto = False): # Create new Item s = ConfigSubsection() s.uri = ConfigText(default="http://", fixed_size = False) - s.autoupdate = ConfigEnableDisable(default=True) + s.autoupdate = ConfigYesNo(default=True) # Set values s.uri.value = address diff --git a/simplerss/src/RSSTickerView.py b/simplerss/src/RSSTickerView.py index 81e365865..57fa16dae 100644 --- a/simplerss/src/RSSTickerView.py +++ b/simplerss/src/RSSTickerView.py @@ -5,6 +5,7 @@ from Components.Label import Label from enigma import eTimer +from Components.config import config class MovingLabel(Label): """Simple Label which allows to display badly scrolling text.""" @@ -40,7 +41,7 @@ def stopMoving(self): self.offset = 0 def startMoving(self): - self.moveTimer.start(125) + self.moveTimer.start(int(simpleRSS.ticker_speed.value)) def doMove(self): offset = self.offset + 1 @@ -69,13 +70,31 @@ def stopMoving(self): #pragma mark RSSTickerView from Screens.Screen import Screen +from enigma import getDesktop + +HD = False +FULLHD = False +if getDesktop(0).size().width() >= 1920: + FULLHD = True +elif getDesktop(0).size().width() >= 1280: + HD = True class RSSTickerView(Screen): - skin = """ - - - - """ + if FULLHD: + skin = """ + + + """ + elif HD: + skin = """ + + + """ + else: + skin = """ + + + """ def __init__(self, session): Screen.__init__(self, session) diff --git a/simplerss/src/__init__.py b/simplerss/src/__init__.py index 158dd3a8f..9339faca1 100644 --- a/simplerss/src/__init__.py +++ b/simplerss/src/__init__.py @@ -1,7 +1,6 @@ # -*- coding: utf-8 -*- from Components.Language import language -from Tools.Directories import resolveFilename, SCOPE_PLUGINS, SCOPE_LANGUAGE -from os import environ as os_environ +from Tools.Directories import resolveFilename, SCOPE_PLUGINS import gettext def localeInit(): diff --git a/simplerss/src/plugin.py b/simplerss/src/plugin.py index d9fc75d61..98ef1c247 100644 --- a/simplerss/src/plugin.py +++ b/simplerss/src/plugin.py @@ -1,11 +1,9 @@ # for localized messages from . import _ -from Components.config import config, ConfigSubsection, ConfigSubList, \ - ConfigEnableDisable, ConfigNumber, ConfigText, ConfigSelection, \ - ConfigYesNo, ConfigPassword - +from Components.config import config, ConfigSubsection, ConfigSubList, ConfigNumber, ConfigText, ConfigSelection, ConfigYesNo, ConfigPassword, ConfigInteger from Components.PluginComponent import plugins +from Plugins.Plugin import PluginDescriptor # Initialize Configuration config.plugins.simpleRSS = ConfigSubsection() @@ -19,16 +17,18 @@ ], default = "preview" ) +simpleRSS.ticker_speed = ConfigInteger(default = 125, limits = (30, 900)) simpleRSS.interval = ConfigNumber(default=15) simpleRSS.feedcount = ConfigNumber(default=0) -simpleRSS.autostart = ConfigEnableDisable(default=False) -simpleRSS.keep_running = ConfigEnableDisable(default=True) +simpleRSS.autostart = ConfigYesNo(default=False) +simpleRSS.keep_running = ConfigYesNo(default=True) +simpleRSS.ext_menu = ConfigYesNo(default=True) simpleRSS.feed = ConfigSubList() i = 0 while i < simpleRSS.feedcount.value: s = ConfigSubsection() s.uri = ConfigText(default="http://", fixed_size=False) - s.autoupdate = ConfigEnableDisable(default=True) + s.autoupdate = ConfigYesNo(default=True) simpleRSS.feed.append(s) i += 1 del s @@ -126,19 +126,19 @@ def checkFile(self, file): ( ScanPath(path = "", with_subdirs = False), ), - name = "RSS-Reader", + name = _("RSS-Reader"), description = _("Subscribe Newsfeed..."), openfnc = filescan_open, ) ] def Plugins(**kwargs): - from Plugins.Plugin import PluginDescriptor - return [ + lst = [ PluginDescriptor( - name = "RSS Reader", + name = _("RSS Reader"), description = _("A simple to use RSS reader"), where = PluginDescriptor.WHERE_PLUGINMENU, + icon="rss.png", fnc=main, needsRestart=False, ), @@ -147,16 +147,12 @@ def Plugins(**kwargs): fnc = autostart, needsRestart=False, ), - PluginDescriptor( - name = _("View RSS..."), - description = "Let's you view current RSS entries", - where = PluginDescriptor.WHERE_EXTENSIONSMENU, - fnc=main, - needsRestart=False, - ), PluginDescriptor( where = PluginDescriptor.WHERE_FILESCAN, fnc = filescan, needsRestart=False, ) ] + if config.plugins.simpleRSS.ext_menu.value: + lst.append(PluginDescriptor(name = _("View RSS..."), description = _("Let's you view current RSS entries"), where = PluginDescriptor.WHERE_EXTENSIONSMENU, fnc=main, needsRestart=False)) + return lst diff --git a/simplerss/src/rss.png b/simplerss/src/rss.png new file mode 100644 index 0000000000000000000000000000000000000000..0fc2f442a4018227e0936e29b2c09af5a7fd0daf GIT binary patch literal 1030 zcmV+h1o``kP)Px#7*I@9Mg02p@Z!tDXbs}Xp4*fxnP@V@p>$C%6|miw zYXATM6?8>dbW?9;ba!ELWdK1#L{nvDAW(8|AU1UWq)-3=010qNS#tmY3ljhU3ljkV znw%H_00UM@L_t(I%WaiGbDJ;_g{AR~&r*r$9m_d~s*rPu?0axTt|kQa-VXNP@7on% zXuC63meqcGi&iK?jHa#CLRxEcOCFiDA$0ldS|wJNSm$1>uCr(_n3kX98Df%(+{YE8 zdvA!TMkH&6c!(Y)enfY_M0Qu(d*|HuNyaEy&Gf^x&_ZTY{hB{dVWv{?I6~9TB`n+Jr!e(Y_C%oskD~yy)JXWaCWV#Jy@sDm&2@r?e5~wA$h? zrfQY+RolC)c(e9n@%re{HtwBi7YNnxsCU`^YkerUqM&nR(Yz@2@?&?)`0eZe-0>Cl+mxBy>)!Rg#$*k=_rU z?e_b2{ca6Fy*#E@$`uz^mXrsvb*@FSV+`ds6TRhVrHH(B~NdCPCCh{UZMphA6e`xKw4 zBY400oRG!$B4kwg{j;VIcT3sgBc@dsQJN81oy-j}S2@%M2)|68#zbmS&+f5ZUokQ? zXv6L1y^1^7%A&4Z*3eu!pu+4gLMI`F92bp06aE6LU zaK2JWqG7Q-B2Y=J9#s;q?mr0LGtX(%$e&3J}!}1l1-~uvUtv=t=y8 zL{mHnIR%wuL9Dgz{sM^^_n5rTE(;rj{D%ucP>q4;MR;MrwN#W$qlzWO8kJ&3two4| zNhtwx?TV%Gtcc**wFYAHZk#fzC{|Gv(2*A64|p{WmMWCjw*UYD07*qoM6N<$f^THr A!vFvP literal 0 HcmV?d00001 From 01c3cb03488b12dc84330c87d4be03f28415cc37 Mon Sep 17 00:00:00 2001 From: Dima73 Date: Sat, 1 Oct 2016 00:44:47 +0300 Subject: [PATCH 2/4] fix size full hd screen --- simplerss/src/RSSTickerView.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simplerss/src/RSSTickerView.py b/simplerss/src/RSSTickerView.py index 57fa16dae..6efc365f2 100644 --- a/simplerss/src/RSSTickerView.py +++ b/simplerss/src/RSSTickerView.py @@ -83,7 +83,7 @@ class RSSTickerView(Screen): if FULLHD: skin = """ - + """ elif HD: skin = """ From a57bbf0d68f5a19293c1a4e290a367a495920727 Mon Sep 17 00:00:00 2001 From: Dima73 Date: Sun, 2 Oct 2016 02:09:24 +0300 Subject: [PATCH 3/4] Add support fullhd -readd depends --- simplerss/CONTROL/control | 2 +- simplerss/po/ru.po | 3 + simplerss/src/RSSScreens.py | 159 ++++++++++++++++++++++++++------- simplerss/src/RSSSetup.py | 3 +- simplerss/src/RSSTickerView.py | 12 +-- simplerss/src/plugin.py | 5 +- 6 files changed, 144 insertions(+), 40 deletions(-) diff --git a/simplerss/CONTROL/control b/simplerss/CONTROL/control index 84a5aaa5e..75f08c563 100644 --- a/simplerss/CONTROL/control +++ b/simplerss/CONTROL/control @@ -2,4 +2,4 @@ Package: enigma2-plugin-extensions-simplerss Version: 0.9-20071007-r0 Description: rss viewer for the enigma2 gui Maintainer: OpenPLi team -Depends: python-twisted-web, python-codecs, python-xml, python-html +Depends: python-twisted-web, python-codecs, python-xml, python-html, enigma2-plugin-extensions-mediadownloader diff --git a/simplerss/po/ru.po b/simplerss/po/ru.po index 38ff99456..340e8b369 100644 --- a/simplerss/po/ru.po +++ b/simplerss/po/ru.po @@ -166,3 +166,6 @@ msgstr "Скорость прокрутки (мс)" msgid "Show in extensions menu" msgstr "Показать плагин в меню расширений" + +msgid "Scanner rss+xml or atom+xml" +msgstr "Авто сканирование rss+xml или atom+xml" diff --git a/simplerss/src/RSSScreens.py b/simplerss/src/RSSScreens.py index 6cc43d6c6..44058da74 100644 --- a/simplerss/src/RSSScreens.py +++ b/simplerss/src/RSSScreens.py @@ -15,6 +15,15 @@ from RSSList import RSSFeedList +from enigma import getDesktop + +HD = False +FULLHD = False +if getDesktop(0).size().width() >= 1920: + FULLHD = True +elif getDesktop(0).size().width() >= 1280: + HD = True + class RSSSummary(Screen): skin = """ @@ -102,12 +111,28 @@ def selectEnclosure(self, enclosures): class RSSEntryView(RSSBaseView): """Shows a RSS Item""" - - skin = """ - - - - """ + if FULLHD: + skin = """ + + + + + + """ + elif HD: + skin = """ + + + + + + """ + else: + skin = """ + + + + """ def __init__(self, session, data, feedTitle="", cur_idx=None, entries=None, parent=None): RSSBaseView.__init__(self, session, None, parent) @@ -143,7 +168,15 @@ def __init__(self, session, data, feedTitle="", cur_idx=None, entries=None, pare self.onLayoutFinish.append(self.setConditionalTitle) def setConditionalTitle(self): - self.setTitle(_("Simple RSS Reader: %s") % (self.feedTitle)) + text = self.feedTitle + num = 15 + if HD: + num = 90 + elif FULLHD: + num = 140 + if text and len(text) > num: + text = text[:num] + " ..." + self.setTitle(_("Simple RSS Reader: %s") % (text)) def updateInfo(self): if self.data: @@ -221,22 +254,60 @@ def selectEnclosure(self): class RSSFeedView(RSSBaseView): """Shows a RSS-Feed""" - - skin = """ - - - - - {"template": [ - MultiContentEntryText(pos=(0, 3), size=(460, 294), font=0, flags = RT_HALIGN_LEFT|RT_WRAP, text = 0) - ], - "fonts": [gFont("Regular", 22)], - "itemHeight": 50 - } - + if FULLHD: + skin = """ + + + + + + + + {"template": [ + MultiContentEntryText(pos=(0, 3), size=(1740, 430), font=0, flags = RT_HALIGN_LEFT|RT_WRAP, text = 0) + ], + "fonts": [gFont("Regular", 34)], + "itemHeight": 100 + } + + + + """ + elif HD: + skin = """ + + + + + + + + {"template": [ + MultiContentEntryText(pos=(0, 3), size=(1140, 430), font=0, flags = RT_HALIGN_LEFT|RT_WRAP, text = 0) + ], + "fonts": [gFont("Regular", 24)], + "itemHeight": 60 + } + + + + """ + else: + skin = """ + + + + + {"template": [ + MultiContentEntryText(pos=(0, 3), size=(460, 294), font=0, flags = RT_HALIGN_LEFT|RT_WRAP, text = 0) + ], + "fonts": [gFont("Regular", 22)], + "itemHeight": 50 + } + - - """ + + """ def __init__(self, session, feed=None, newItems=False, parent=None, rssPoller=None,id=None): RSSBaseView.__init__(self, session, rssPoller, parent) @@ -305,7 +376,15 @@ def pollCallback(self, id = None): self.updateInfo() def setConditionalTitle(self): - self.setTitle(_("Simple RSS Reader: %s") % (self.feed.title)) + num = 15 + if HD: + num = 90 + elif FULLHD: + num = 140 + text = self.feed.title + if text and len(text) > num: + text = text[:num] + " ..." + self.setTitle(_("Simple RSS Reader: %s") % (text)) def updateInfo(self): current_entry = self["content"].current @@ -388,13 +467,33 @@ def selectEnclosure(self): class RSSOverview(RSSBaseView): """Shows an Overview over all RSS-Feeds known to rssPoller""" - - skin = """ - - - - - """ + if FULLHD: + skin = """ + + + + + + + + """ + elif HD: + skin = """ + + + + + + + + """ + else: + skin = """ + + + + + """ def __init__(self, session, poller): RSSBaseView.__init__(self, session, poller) diff --git a/simplerss/src/RSSSetup.py b/simplerss/src/RSSSetup.py index 8e50a17c1..091bc5035 100644 --- a/simplerss/src/RSSSetup.py +++ b/simplerss/src/RSSSetup.py @@ -66,7 +66,7 @@ class RSSSetup(ConfigListScreen, Screen): - + """ def __init__(self, session, rssPoller = None): @@ -129,6 +129,7 @@ def createSetup(self): )) list.append(getConfigListEntry(_("Show in extensions menu"), simpleRSS.ext_menu)) + list.append(getConfigListEntry(_("Scanner rss+xml or atom+xml"), simpleRSS.filescan)) self.list = list self["config"].setList(self.list) diff --git a/simplerss/src/RSSTickerView.py b/simplerss/src/RSSTickerView.py index 6efc365f2..2b8a9e7ca 100644 --- a/simplerss/src/RSSTickerView.py +++ b/simplerss/src/RSSTickerView.py @@ -41,7 +41,7 @@ def stopMoving(self): self.offset = 0 def startMoving(self): - self.moveTimer.start(int(simpleRSS.ticker_speed.value)) + self.moveTimer.start(int(config.plugins.simpleRSS.ticker_speed.value)) def doMove(self): offset = self.offset + 1 @@ -82,18 +82,18 @@ def stopMoving(self): class RSSTickerView(Screen): if FULLHD: skin = """ - - + + """ elif HD: skin = """ - - + + """ else: skin = """ - + """ def __init__(self, session): diff --git a/simplerss/src/plugin.py b/simplerss/src/plugin.py index 98ef1c247..382d345dd 100644 --- a/simplerss/src/plugin.py +++ b/simplerss/src/plugin.py @@ -1,7 +1,7 @@ # for localized messages from . import _ -from Components.config import config, ConfigSubsection, ConfigSubList, ConfigNumber, ConfigText, ConfigSelection, ConfigYesNo, ConfigPassword, ConfigInteger +from Components.config import config, ConfigSubsection, ConfigSubList, ConfigNumber, ConfigText, ConfigSelection, ConfigYesNo, ConfigPassword, ConfigInteger, ConfigNothing from Components.PluginComponent import plugins from Plugins.Plugin import PluginDescriptor @@ -17,12 +17,13 @@ ], default = "preview" ) -simpleRSS.ticker_speed = ConfigInteger(default = 125, limits = (30, 900)) +simpleRSS.ticker_speed = ConfigInteger(default = 125, limits = (100, 900)) simpleRSS.interval = ConfigNumber(default=15) simpleRSS.feedcount = ConfigNumber(default=0) simpleRSS.autostart = ConfigYesNo(default=False) simpleRSS.keep_running = ConfigYesNo(default=True) simpleRSS.ext_menu = ConfigYesNo(default=True) +simpleRSS.filescan = ConfigNothing() simpleRSS.feed = ConfigSubList() i = 0 while i < simpleRSS.feedcount.value: From c891646d4e09c97c79f5e1f6e271deea42f2b4ce Mon Sep 17 00:00:00 2001 From: Dima73 Date: Mon, 3 Oct 2016 00:52:15 +0300 Subject: [PATCH 4/4] option scanner for automount usb - any name.rss --- simplerss/po/ru.po | 42 ++++++++++++++++++------ simplerss/src/RSSSetup.py | 21 +++++++----- simplerss/src/plugin.py | 67 +++++++++++++++++++++++++++++---------- 3 files changed, 96 insertions(+), 34 deletions(-) diff --git a/simplerss/po/ru.po b/simplerss/po/ru.po index 340e8b369..113adc578 100644 --- a/simplerss/po/ru.po +++ b/simplerss/po/ru.po @@ -3,7 +3,7 @@ msgstr "" "Project-Id-Version: RSSReader\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2009-07-29 01:13+0100\n" -"PO-Revision-Date: 2016-10-01 00:12+0300\n" +"PO-Revision-Date: 2016-10-03 00:38+0300\n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -11,8 +11,8 @@ msgstr "" "X-Poedit-SourceCharset: UTF-8\n" "X-Generator: Poedit 1.8.9\n" "Last-Translator: Dimitrij \n" -"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" -"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n" +"%100<10 || n%100>=20) ? 1 : 2);\n" "Language: ru_UA\n" msgid "RSS Reader" @@ -67,10 +67,8 @@ msgstr "" "Вы действительно хотите удалить эту запись?\n" "Запись потом не может быть восстановлена!" -msgid "" -"Error while parsing Feed, this usually means there is something wrong with " -"it." -msgstr "Ошибка при чтении фленты." +msgid "Error while parsing Feed, this usually means there is something wrong with it." +msgstr "Ошибка при парсинге ленты, обычно это означает, что с форматом ленты что то не так." msgid "" "Update is being done in Background.\n" @@ -153,7 +151,7 @@ msgid "View RSS..." msgstr "Просмотр RSS..." msgid "Unsupported Feed: %s" -msgstr "Лента не поддерживается" +msgstr "Лента не поддерживается: %s" msgid "RSS-Reader" msgstr "RSS-просмотр" @@ -167,5 +165,29 @@ msgstr "Скорость прокрутки (мс)" msgid "Show in extensions menu" msgstr "Показать плагин в меню расширений" -msgid "Scanner rss+xml or atom+xml" -msgstr "Авто сканирование rss+xml или atom+xml" +msgid "%d feed(s) added to configuration." +msgstr "%d лент(а) успешно добавлена в конфигурацию." + +msgid "Not found new feed(s)." +msgstr "Нет найденных новых лент." + +msgid "Read error %s" +msgstr "Ошибка чтения %s" + +msgid "Found %d feed(s)" +msgstr "Найдено %d лент" + +msgid "Close" +msgstr "Закрыть" + +msgid "Apply" +msgstr "Применить" + +msgid "< Create file any name.rss in USB device >" +msgstr "< Создайте файл любое имя.rss на USB флешке >" + +msgid "--- Scanner automount ---" +msgstr "--- Сканер авто монтирования ---" + +msgid "< and write feeds link column >" +msgstr "< и впишите адреса лент колонкой >" diff --git a/simplerss/src/RSSSetup.py b/simplerss/src/RSSSetup.py index 091bc5035..bc6bd84fc 100644 --- a/simplerss/src/RSSSetup.py +++ b/simplerss/src/RSSSetup.py @@ -7,6 +7,7 @@ from Components.ConfigList import ConfigListScreen from Components.Sources.StaticText import StaticText from Components.ActionMap import ActionMap +from Screens.MessageBox import MessageBox class RSSFeedEdit(ConfigListScreen, Screen): """Edit an RSS-Feed""" @@ -129,7 +130,9 @@ def createSetup(self): )) list.append(getConfigListEntry(_("Show in extensions menu"), simpleRSS.ext_menu)) - list.append(getConfigListEntry(_("Scanner rss+xml or atom+xml"), simpleRSS.filescan)) + list.append(getConfigListEntry(_("--- Scanner automount ---"), simpleRSS.filescan)) + list.append(getConfigListEntry(_("< Create file any name.rss in USB device >"), simpleRSS.filescan)) + list.append(getConfigListEntry(_("< and write feeds link column >"), simpleRSS.filescan)) self.list = list self["config"].setList(self.list) @@ -145,13 +148,13 @@ def notificationChanged(self, instance): tv.tickerView = None def delete(self): - from Screens.MessageBox import MessageBox - - self.session.openWithCallback( - self.deleteConfirm, - MessageBox, - _("Really delete this entry?\nIt cannot be recovered!") - ) + cur = self["config"].getCurrent() + if cur and cur[0] == _("Feed"): + self.session.openWithCallback( + self.deleteConfirm, + MessageBox, + _("Really delete this entry?\nIt cannot be recovered!") + ) def deleteConfirm(self, result): if result: @@ -236,4 +239,6 @@ def addFeed(address, auto = False): # Save l.append(s) l.save() + config.plugins.simpleRSS.feedcount.value = len(config.plugins.simpleRSS.feed) + config.plugins.simpleRSS.feedcount.save() diff --git a/simplerss/src/plugin.py b/simplerss/src/plugin.py index 382d345dd..0e415a7a5 100644 --- a/simplerss/src/plugin.py +++ b/simplerss/src/plugin.py @@ -4,6 +4,10 @@ from Components.config import config, ConfigSubsection, ConfigSubList, ConfigNumber, ConfigText, ConfigSelection, ConfigYesNo, ConfigPassword, ConfigInteger, ConfigNothing from Components.PluginComponent import plugins from Plugins.Plugin import PluginDescriptor +from Screens.MessageBox import MessageBox +from Screens.ChoiceBox import ChoiceBox +from Tools.BoundFunction import boundFunction +from RSSSetup import addFeed # Initialize Configuration config.plugins.simpleRSS = ConfigSubsection() @@ -93,23 +97,52 @@ def autostart(reason, **kwargs): rssPoller.shutdown() rssPoller = None +def filescan_chosen(session, feed, item): + if item and item[1] == "apply": + for i in range(config.plugins.simpleRSS.feedcount.value): + try: + if config.plugins.simpleRSS.feed[i].uri.value in feed: + for uri in feed: + if uri == config.plugins.simpleRSS.feed[i].uri.value: + feed.remove(uri) + except: + pass + if feed: + for uri in feed: + addFeed(uri) + session.open(MessageBox, _("%d feed(s) added to configuration.") % len(feed), type = MessageBox.TYPE_INFO, timeout = 5) + else: + session.open(MessageBox, _("Not found new feed(s)."), type = MessageBox.TYPE_INFO, timeout = 5) + # Filescan def filescan_open(item, session, **kwargs): - from RSSSetup import addFeed - - # Add earch feed - for each in item: - addFeed(each) - - from Screens.MessageBox import MessageBox - - # Display Message - session.open( - MessageBox, - _("%d Feed(s) were added to configuration.") % (len(item)), - type = MessageBox.TYPE_INFO, - timeout = 5 - ) + Len = len(item) + if Len: + file = item[0].path + if file.endswith(".rss"): + try: + menu = [(_("Apply"), "apply"), (_("Close"), "close")] + list = [] + f = open(file, "r") + all_lines = f.readlines() + for line in all_lines: + if line.startswith(("http://", "https://")) and not line.endswith("#"): + list.append(line) + f.close() + if list: + session.openWithCallback(boundFunction(filescan_chosen, session, list), ChoiceBox, _("Found %d feed(s)") % len(list), menu) + except: + session.open(MessageBox, _("Read error %s") % file, type = MessageBox.TYPE_INFO, timeout = 5) + else: + # Add earch feed + for each in item: + addFeed(each) + + # Display Message + session.open(MessageBox, _("%d Feed(s) were added to configuration.") % (Len), type = MessageBox.TYPE_INFO, timeout = 5) + +from mimetypes import add_type +add_type("application/x-feed-rss", ".rss") # Filescanner def filescan(**kwargs): @@ -118,11 +151,13 @@ def filescan(**kwargs): # Overwrite checkFile to detect remote files class RemoteScanner(Scanner): def checkFile(self, file): + if file.path.endswith(".rss"): + return True return file.path.startswith(("http://", "https://")) return [ RemoteScanner( - mimetypes = ("application/rss+xml", "application/atom+xml"), + mimetypes = ("application/rss+xml", "application/atom+xml", "application/x-feed-rss"), paths_to_scan = ( ScanPath(path = "", with_subdirs = False),