def bio_txt(self, url, name): url = self.bio_link % url r = cache.get(client.request, 168, url) try: born = client.parseDOM(r, 'time', ret='datetime')[0] except: born = '' try: died = client.parseDOM(r, 'time', ret='datetime')[1] except: died = '' try: bio = client.parseDOM(r, 'div', attrs={'class': r'soda odd'})[0] bio = client.parseDOM(bio, 'p')[0] bio = client.replaceHTMLCodes(bio) bio = six.ensure_str(bio, errors='ignore') bio = bio.replace('<br />', '[CR]') bio = re.sub(r'<.*?>', '', bio) except: bio = '' txt = '[B]Born:[/B] {0}[CR]{1}[CR]{2}'.format( born or 'N/A', '[B]Died:[/B] {}[CR]'.format(died) if died else '', bio or '[B]Biography:[/B] N/A') control.textViewer(text=txt, heading=name, monofont=False)
def get(): try: changelogfile = os.path.join(control.addonPath, 'changelog.txt') head = '[COLOR yellow]Prophet [/COLOR] -- Changelog --' control.textViewer(changelogfile, head) except: control.infoDialog('Error opening changelog', sound=True) log_utils.log('changeloglog_view_fail', 1)
def get(): try: changelogfile = os.path.join(control.addonPath, 'changelog.txt') head = 'TheOath -- Changelog --' control.textViewer(file=changelogfile, heading=head) except: control.infoDialog('Error opening changelog', sound=True) log_utils.log('changeloglog_view_fail', 1)
def bio_txt(self, id): try: url = self.bio_link % id r = cache.get(client.request, 168, url) r = utils.json_loads_as_str(r) txt = '[B]Born:[/B] {0}[CR]{1}[CR]{2}'.format( r['birthday'] or 'N/A', '[B]Died:[/B] {}[CR]'.format( r['deathday']) if r['deathday'] else '', r['biography'] or '[B]Biography:[/B] N/A') control.textViewer(text=txt, heading=r['name'], monofont=False) except: log_utils.log('bio_txt', 1) return
def view_log(): try: control.textViewer(log_file, log_file) except: control.infoDialog('Error opening log file', sound=True) log('log_view_fail', 1)