def _setup_standard_directories(self): self._std_dirs = KStandardDirs() self.tmpdir_parent = path(str(self._std_dirs.findResourceDir("tmp", "/"))) self.datadir_parent = path(str(self._std_dirs.findResourceDir("data", "/"))) self.tmpdir = self.tmpdir_parent / "dosbox-pykde" self.datadir = self.datadir_parent / "dosbox-pykde" # we need this in dosbox object (for now) self.main_config_dir = self.datadir if not self.datadir.exists(): self.datadir.mkdir()
def start_a(self, attributes): if self._write_data and self.literal: self._data += '<a>' return attributes = dict(attributes) if '/downloadgame/' in attributes['href']: self.download_link = attributes['href'] print 'self.download_link', self.download_link self.gameid = int(os.path.basename(self.download_link)) print self.gameid if '/files/extras/' in attributes['href']: self.files.append(path(attributes['href']))
def set_game_downloaded(self, gameid): fname = path('%s-nogame' % self._htmlfilename(gameid)) os.remove(fname)
def is_game_downloaded(self, gameid): fname = path('%s-nogame' % self._htmlfilename(gameid)) if fname.exists(): return False else: return True