def add_urls(self, urls): for x in urls: (title, link) = self.__create_link_tuple(x) if LinkService.is_acestream_link(link): self.ace_list.append((title, link)) elif LinkService.is_sopcast_link(link): self.sop_list.append((title, link))
def test_add_raw_urls(self): raw_urls = 'SOP_EX_1|sop://broker.sopcast.com:3912/26475,sop://broker.sopcast.com:3912/265589,ACE 1|acestream://ebace2db83260b4d6097f0a52e86b2aee3c3bba9,acestream://c389afdd68246467538cec05eace0ca6410e4bb4' expected_content = """\ ACE 1|acestream://ebace2db83260b4d6097f0a52e86b2aee3c3bba9|1|/storage/.kodi/addons/program.plexus/resources/art/acestream-menu-item.png ACE_01|acestream://c389afdd68246467538cec05eace0ca6410e4bb4|1|/storage/.kodi/addons/program.plexus/resources/art/acestream-menu-item.png SOP_01|sop://broker.sopcast.com:3912/265589|2|/storage/.kodi/addons/program.plexus/resources/art/sopcast_logo.jpg SOP_EX_1|sop://broker.sopcast.com:3912/26475|2|/storage/.kodi/addons/program.plexus/resources/art/sopcast_logo.jpg\ """ history_file = PlexusHistoryFile() links = LinkService.extract_links_from_string(raw_urls) history_file.add_urls(links) assert history_file.text == expected_content
def step_impl(context): context.links = LinkService.extract_links_from_url(context.url)
def step_impl(context): context.links = LinkService.extract_links_from_file(context.file_path)
def add_links_from_url(self, url): links = LinkService.extract_links_from_url(url) self.add_urls(links)
def add_links_from_file(self, path): links = LinkService.extract_links_from_file(path) self.add_urls(links)
def add_links_from_string(self, s): links = LinkService.extract_links_from_string(s) self.add_urls(links) pass
def add_links_from_html(self, html): links = LinkService.extract_links_from_html(html) self.add_urls(links)