def get_page(self, page, source): if archive.page_exists(page): definition = archive.page_load(page) else: page_uri = site_prefix + '{0}/{1}.txt'.format(self.story, page) definition = urlopen(page_uri).readall() archive.save_page(page, definition) if page == '006009': return self._get_cascade() command, hash1, hash2, art, narration, next_pages = self._separated_sections(definition.splitlines()) # banner room, alt, img = stories.scratch_banner(page) if room: self._get_asset(site_prefix+'storyfiles/hs2/scratch/'+room) if img: self._get_other(site_prefix+'storyfiles/hs2/scraps/LEtext{0}.gif'.format(img+1)) # main images hidden_nexts = [] for line in art: hidden_nexts.extend(self._get_asset(line)) # inline images for line in narration: for match in re.findall(site_prefix+r'([^\?]*?)"', line): if not 'sweetbroandhellajeff' in match: self._get_asset(site_prefix+match) archive.gen_html(page, command[0], art, narration, next_pages, source) return map(lambda s: (s.strip(), page), next_pages + hidden_nexts)
def _get_cascade(self): prefix = 'http://uploads.ungrounded.net/userassets/3591000/3591093/' #alternatively: site_prefix/cascade/ files = ['cascade_loaderExt.swf', 'cascade_segment1.swf', 'cascade_segment2.swf', 'cascade_segment3.swf', 'cascade_segment4.swf', 'cascade_segment5.swf'] self._get_other(site_prefix + 'cascade/AC_RunActiveContent.js') for filename in filter(lambda segment: not archive.cascade_exists(segment), files): uri = prefix + filename data = urlopen(uri).readall() archive.save_cascade(prefix, filename, data) archive.gen_html('006009', '[S] Cascade', [], [''], ['006010'], '006008') return [('006010', '006009')]