Пример #1
0
def filescan_open(item, session, **kwargs):
    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)
Пример #2
0
def filescan_open(item, session, **kwargs):
	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)
Пример #3
0
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)
Пример #4
0
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
	)
Пример #5
0
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)
Пример #6
0
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)