本文整理汇总了Python中trackma.utils.show函数的典型用法代码示例。如果您正苦于以下问题:Python show函数的具体用法?Python show怎么用?Python show使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了show函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: search
def search(self, criteria):
self.check_credentials()
self.msg.info(self.name, "Searching for {}...".format(criteria))
param = {"q": criteria}
try:
data = self._request("GET", "/api/{}s/search".format(self.mediatype), get=param)
except ValueError:
# An empty document, without any JSON, is returned
# when there are no results.
return []
showlist = []
for item in data:
show = utils.show()
showid = item["id"]
show.update(
{
"id": showid,
"title": item["name"],
"aliases": [item["russian"]],
"type": item.get("kind", ""),
#'status': item[self.airing_str],
"status": 0,
"my_status": self.media_info()["status_start"],
"total": item[self.total_str],
"image": self.url + item["image"]["original"],
"image_thumb": self.url + item["image"]["preview"],
}
)
showlist.append(show)
return showlist
开发者ID:Birdulon,项目名称:trackma,代码行数:35,代码来源:libshikimori.py
示例2: fetch_list
def fetch_list(self):
self.check_credentials()
self.msg.info(self.name, 'Downloading list...')
param = {'access_token': self._get_userconfig('access_token')}
data = self._request("GET", "user/{0}/{1}list".format(self.userid, self.mediatype), get=param)
showlist = {}
airinglist = []
#with open('list', 'w') as f:
# json.dump(data, f, indent=2)
if not data["lists"]:
# No lists returned so no need to continue
return showlist
for remotelist in data["lists"].itervalues():
for item in remotelist:
if item['list_status'] not in self.media_info()['statuses']:
continue
show = utils.show()
showid = item[self.mediatype]['id']
show.update({
'id': showid,
'title': item[self.mediatype]['title_romaji'],
'aliases': [item[self.mediatype]['title_english']],
'type': item[self.mediatype]['type'],
'status': self.status_translate[item[self.mediatype][self.airing_str]],
'my_progress': self._c(item[self.watched_str]),
'my_status': item['list_status'],
'my_score': self._c(item['score']),
'total': self._c(item[self.mediatype][self.total_str]),
'image': item[self.mediatype]['image_url_lge'],
'image_thumb': item[self.mediatype]['image_url_med'],
'url': str("http://anilist.co/%s/%d" % (self.mediatype, showid)),
})
if show['status'] == 1:
airinglist.append(showid)
showlist[showid] = show
if self.mediatype == 'anime': # Airing data unavailable for manga
if len(airinglist) > 0:
browseparam = {'access_token': self._get_userconfig('access_token'),
'status': 'Currently Airing',
'airing_data': 'true',
'full_page': 'true'}
data = self._request("GET", "browse/anime", get=browseparam)
for item in data:
id = item['id']
if id in showlist and 'airing' in item:
if item['airing']:
showlist[id].update({
'next_ep_number': item['airing']['next_episode'],
'next_ep_time': item['airing']['time'],
})
return showlist
开发者ID:Logmytech,项目名称:trackma,代码行数:60,代码来源:libanilist.py
示例3: _parse_info
def _parse_info(self, item):
info = utils.show()
showid = item['id']
info.update({
'id': showid,
'title': item['title_romaji'],
'status': self.status_translate[item[self.airing_str]],
'image': item['image_url_lge'],
'url': str("http://anilist.co/%s/%d" % (self.mediatype, showid)),
'start_date': self._str2date(item.get('start_date')),
'end_date': self._str2date(item.get('end_date')),
'extra': [
('English', item.get('title_english')),
('Japanese', item.get('title_japanese')),
('Classification', item.get('classification')),
('Genres', item.get('genres')),
('Synopsis', item.get('description')),
('Type', item.get('type')),
('Average score', item.get('average_score')),
('Status', item.get(self.airing_str)),
('Start Date', item.get('start_date')),
('End Date', item.get('end_date')),
]
})
return info
开发者ID:Logmytech,项目名称:trackma,代码行数:25,代码来源:libanilist.py
示例4: search
def search(self, criteria):
self.check_credentials()
self.msg.info(self.name, "Searching for {}...".format(criteria))
param = {'access_token': self._get_userconfig('access_token')}
try:
data = self._request("GET", "{0}/search/{1}".format(self.mediatype, criteria), get=param)
except ValueError:
# An empty document, without any JSON, is returned
# when there are no results.
return []
showlist = []
for item in data:
show = utils.show()
showid = item['id']
show.update({
'id': showid,
'title': item['title_romaji'],
'aliases': [item['title_english']],
'type': item['type'],
'status': item[self.airing_str],
'my_status': self.media_info()['status_start'],
'total': item[self.total_str],
'image': item['image_url_lge'],
'image_thumb': item['image_url_med'],
'url': str("http://anilist.co/%s/%d" % (self.mediatype, showid)),
})
showlist.append( show )
return showlist
开发者ID:Logmytech,项目名称:trackma,代码行数:33,代码来源:libanilist.py
示例5: _parse_manga
def _parse_manga(self, root):
"""Converts an XML manga list to a dictionary"""
mangalist = dict()
for child in root.iter('manga'):
manga_id = int(child.find('series_mangadb_id').text)
if child.find('series_synonyms').text:
aliases = child.find('series_synonyms').text.lstrip('; ').split('; ')
else:
aliases = []
show = utils.show()
show.update({
'id': manga_id,
'title': child.find('series_title').text,
'aliases': aliases,
'my_progress': int(child.find('my_read_chapters').text),
'my_status': int(child.find('my_status').text),
'my_score': int(child.find('my_score').text),
'my_start_date': self._str2date( child.find('my_start_date').text ),
'my_finish_date': self._str2date( child.find('my_finish_date').text ),
'total': int(child.find('series_chapters').text),
'status': int(child.find('series_status').text),
'start_date': self._str2date( child.find('series_start').text ),
'end_date': self._str2date( child.find('series_end').text ),
'image': child.find('series_image').text,
'url': "http://myanimelist.net/manga/%d" % manga_id,
})
mangalist[manga_id] = show
return mangalist
开发者ID:EaterOA,项目名称:trackma,代码行数:29,代码来源:libmal.py
示例6: _parse_anime
def _parse_anime(self, root):
"""Converts an XML anime list to a dictionary"""
showlist = dict()
for child in root.iter('anime'):
show_id = int(child.find('series_animedb_id').text)
if child.find('series_synonyms').text:
aliases = child.find('series_synonyms').text.lstrip('; ').split('; ')
else:
aliases = []
show = utils.show()
show.update({
'id': show_id,
'title': child.find('series_title').text,
'aliases': aliases,
'my_progress': int(child.find('my_watched_episodes').text),
'my_status': int(child.find('my_status').text),
'my_score': int(child.find('my_score').text),
'my_start_date': self._str2date( child.find('my_start_date').text ),
'my_finish_date': self._str2date( child.find('my_finish_date').text ),
'my_tags': child.find('my_tags').text,
'total': int(child.find('series_episodes').text),
'status': int(child.find('series_status').text),
'start_date': self._str2date( child.find('series_start').text ),
'end_date': self._str2date( child.find('series_end').text ),
'image': child.find('series_image').text,
'url': "http://myanimelist.net/anime/%d" % show_id,
})
showlist[show_id] = show
return showlist
开发者ID:EaterOA,项目名称:trackma,代码行数:30,代码来源:libmal.py
示例7: _parse_info
def _parse_info(self, item):
info = utils.show()
showid = item['id']
info.update({
'id': showid,
'title': item['title']['userPreferred'],
'total': self._c(item[self.total_str]),
'aliases': self._get_aliases(item),
'type': self.type_translate[item['format']],
'status': self.status_translate[item['status']],
'image': item['coverImage']['large'],
'image_thumb': item['coverImage']['medium'],
'url': item['siteUrl'],
'start_date': self._dict2date(item.get('startDate')),
'end_date': self._dict2date(item.get('endDate')),
'extra': [
('English', item['title'].get('english')),
('Romaji', item['title'].get('romaji')),
('Japanese', item['title'].get('native')),
('Synonyms', item.get('synonyms')),
('Genres', item.get('genres')),
('Studios', [s['name'] for s in item['studios']['nodes']]),
('Synopsis', item.get('description')),
('Type', item.get('format')),
('Average score', item.get('averageScore')),
('Status', self.status_translate[item['status']]),
]
})
return info
开发者ID:z411,项目名称:trackma,代码行数:30,代码来源:libanilist.py
示例8: search
def search(self, criteria):
self.check_credentials()
self.msg.info(self.name, "Searching for {}...".format(criteria))
param = {'q': criteria}
try:
data = self._request("GET", "/api/{}s/search".format(self.mediatype), get=param)
except ValueError:
# An empty document, without any JSON, is returned
# when there are no results.
return []
showlist = []
for item in data:
show = utils.show()
showid = item['id']
show.update({
'id': showid,
'title': item['name'],
'aliases': [item['russian']],
'type': item.get('kind', ''),
#'status': item[self.airing_str],
'status': 0,
'my_status': self.media_info()['status_start'],
'total': item[self.total_str],
'image': self.url + item['image']['original'],
'image_thumb': self.url + item['image']['preview'],
})
showlist.append( show )
return showlist
开发者ID:ToostInc,项目名称:wmal-python,代码行数:33,代码来源:libshikimori.py
示例9: fetch_list
def fetch_list(self):
self.check_credentials()
self.msg.info(self.name, 'Downloading list...')
data = self._request("GET", "/api/users/{}/{}_rates".format(self.userid, self.mediatype))
showlist = {}
#with open('list', 'w') as f:
# json.dump(data, f, indent=2)
for item in data:
show = utils.show()
showid = item[self.mediatype]['id']
show.update({
'id': showid,
'my_id': item['id'],
'title': item[self.mediatype]['name'],
'aliases': [item[self.mediatype]['russian']],
#'type': item[self.mediatype]['type'],
#'status': self.status_translate[item[self.mediatype][self.airing_str]],
'my_id': item['id'],
'my_progress': item[self.watched_str],
'my_status': item['status'],
'my_score': item['score'],
'total': item[self.mediatype][self.total_str],
'url': self.url + item[self.mediatype]['url'],
'image': self.url + item[self.mediatype]['image']['original'],
'image_thumb': self.url + item[self.mediatype]['image']['preview'],
})
showlist[showid] = show
return showlist
开发者ID:ToostInc,项目名称:wmal-python,代码行数:34,代码来源:libshikimori.py
示例10: _parse_info
def _parse_info(self, item):
info = utils.show()
showid = item['id']
info.update({
'id': showid,
'title': item['title']['userPreferred'],
'status': self.status_translate[item['status']],
'image': item['coverImage']['large'],
'url': item['siteUrl'],
'start_date': self._dict2date(item.get('startDate')),
'end_date': self._dict2date(item.get('endDate')),
'extra': [
('English', item['title'].get('english')),
('Romaji', item['title'].get('romaji')),
('Japanese', item['title'].get('native')),
('Synonyms', item['title'].get('synonyms')),
#('Classification', item.get('classification')),
('Genres', item.get('genres')),
('Synopsis', item.get('description')),
('Type', item.get('format')),
('Average score', item.get('averageScore')),
('Status', self.status_translate[item['status']]),
#('Start Date', item.get('start_date')),
#('End Date', item.get('end_date')),
]
})
return info
开发者ID:anjandev,项目名称:trackma,代码行数:27,代码来源:libanilist.py
示例11: search
def search(self, criteria):
self.check_credentials()
self.msg.info(self.name, "Searching for {}...".format(criteria))
query = '''query ($query: String, $type: MediaType) {
Page {
media(search: $query, type: $type) {
id
title { userPreferred romaji english native }
coverImage { medium large }
format
averageScore
popularity
chapters episodes
status
isAdult
startDate { year month day }
endDate { year month day }
siteUrl
mediaListEntry { status progress score }
}
}
}'''
variables = {'query': urllib.parse.quote_plus(criteria), 'type': self.mediatype.upper()}
data = self._request(query, variables)['data']['Page']['media']
showlist = []
for media in data:
show = utils.show()
showid = media['id']
aliases = [a for a in (media['title']['romaji'], media['title']['english'], media['title']['native']) if a]
showdata = {
'id': showid,
'title': media['title']['userPreferred'],
'aliases': aliases,
'type': media['format'], # Need to reformat output
'status': self.status_translate[media['status']],
'total': self._c(media[self.total_str]),
'image': media['coverImage']['large'],
'image_thumb': media['coverImage']['medium'],
'url': media['siteUrl'],
}
if media['mediaListEntry']:
showdata['my_progress'] = self._c(media['mediaListEntry']['progress'])
showdata['my_status'] = media['mediaListEntry']['status']
showdata['my_score'] = self._c(media['mediaListEntry']['score'])
show.update({k:v for k,v in showdata.items() if v})
showlist.append(show)
return showlist
开发者ID:anjandev,项目名称:trackma,代码行数:50,代码来源:libanilist.py
示例12: fetch_list
def fetch_list(self):
self.check_credentials()
self.msg.info(self.name, "Downloading list...")
# Get a JSON list from API
response = self.opener.open(
"http://melative.com/api/library.json?user={0}&context_type={1}".format(self.username, self.mediatype)
)
data = json.load(response)
# Load data from the JSON stream into a parsed dictionary
statuses = self.media_info()["statuses_dict"]
itemlist = dict()
for record in data["library"]:
entity = record["entity"]
segment = record["segment"]
itemid = int(entity["id"])
# use appropiate number for the show state
_status = 0
for k, v in statuses.items():
if v.lower() == record["state"]:
_status = k
# use show length if available
try:
_total = int(entity["length"])
except TypeError:
_total = 0
# use show progress if needed
if self.mediatypes[self.mediatype]["has_progress"]:
_progress = int(segment["name"])
else:
_progress = 0
show = utils.show()
show["id"] = itemid
show["title"] = entity["aliases"][0].encode("utf-8")
show["my_status"] = _status
show["my_score"] = int(record["rating"] or 0)
show["my_progress"] = _progress
show["total"] = _total
show["image"] = entity["image_url"]
show["status"] = 0 # placeholder
itemlist[itemid] = show
return itemlist
开发者ID:Logmytech,项目名称:trackma,代码行数:49,代码来源:libmelative.py
示例13: fetch_list
def fetch_list(self):
self.check_credentials()
self.msg.info(self.name, 'Downloading list...')
# Get a JSON list from API
response = self.opener.open("http://melative.com/api/library.json?user={0}&context_type={1}".format(self.username, self.mediatype))
data = json.loads(response.read().decode('utf-8'))
# Load data from the JSON stream into a parsed dictionary
statuses = self.media_info()['statuses_dict']
itemlist = dict()
for record in data['library']:
entity = record['entity']
segment = record['segment']
itemid = int(entity['id'])
# use appropiate number for the show state
_status = 0
for k, v in statuses.items():
if v.lower() == record['state']:
_status = k
# use show length if available
try:
_total = int(entity['length'])
except TypeError:
_total = 0
# use show progress if needed
if self.mediatypes[self.mediatype]['has_progress']:
_progress = int(segment['name'])
else:
_progress = 0
show = utils.show()
show['id'] = itemid
show['title'] = entity['aliases'][0]
show['my_status'] = _status
show['my_score'] = int(record['rating'] or 0)
show['my_progress'] =_progress
show['total'] = _total
show['image'] = entity['image_url']
show['status'] = 0 #placeholder
itemlist[itemid] = show
return itemlist
开发者ID:Birdulon,项目名称:trackma,代码行数:47,代码来源:libmelative.py
示例14: _parse_info
def _parse_info(self, item):
info = utils.show()
info.update({
'id': item['id'],
'title': item['title_romaji'],
'status': self.status_translate[item[self.airing_str]],
'image': item['image_url_lge'],
'extra': [
('Description', item.get('description')),
('Genres', item.get('genres')),
('Classification', item.get('classification')),
('Status', item.get('airing_status')),
('Average score', item.get('average_score')),
('Japanese title', item.get('title_japanese')),
('English title', item.get('title_english')),
]
})
return info
开发者ID:AkiraTreize,项目名称:trackma,代码行数:18,代码来源:libanilist.py
示例15: _parse_info
def _parse_info(self, item):
info = utils.show()
info.update({
'id': item['id'],
'title': item['name'],
'status': 0,
'image': self.url + item['image']['original'],
'url': self.url + item['url'],
'extra': [
('Description', item.get('description')),
#('Genres', item.get('genres')),
('Type', item.get('kind').capitalize()),
('Average score', item.get('score')),
('Russian title', item.get('russian')),
('Japanese title', item.get('japanese')[0]),
('English title', item.get('english')),
]
})
return info
开发者ID:ToostInc,项目名称:wmal-python,代码行数:19,代码来源:libshikimori.py
示例16: _parse_info
def _parse_info(self, show):
info = utils.show()
alt_titles = []
if show['alternate_title'] is not None:
alt_titles.append(show['alternate_title'])
info.update({
'id': show['id'],
'title': show['title'] or show['alternate_title'] or "",
'status': self.status_translate[show['status']],
'image': show['cover_image'],
'url': show['url'],
'aliases': alt_titles,
'extra': [
('Alternate title', show['alternate_title']),
('Show type', show['show_type']),
('Synopsis', show['synopsis']),
('Status', show['status']),
]
})
return info
开发者ID:JeroenMathon,项目名称:trackma,代码行数:20,代码来源:libhb.py
示例17: _parse_info
def _parse_info(self, media):
info = utils.show()
attr = media['attributes']
#print(json.dumps(media, indent=2))
#raise NotImplementedError
if media['type'] == 'anime':
total = attr['episodeCount']
elif media['type'] == 'manga':
total = attr['chapterCount']
elif media['type'] == 'drama':
total = attr['episodeCount'] # TODO Unconfirmed
info.update({
'id': int(media['id']),
# TODO : Some shows actually don't have a canonicalTitle; this should be fixed in the future.
# For now I'm just picking the romaji title in these cases.
'title': attr['titles'].get('en_jp') or attr.get('canonicalTitle') or attr['titles'].get('en'),
'total': total or 0,
'image': attr['posterImage'] and attr['posterImage']['small'],
'image_thumb': attr['posterImage'] and attr['posterImage']['tiny'],
'start_date': self._str2date(attr['startDate']),
'end_date': self._str2date(attr['endDate']),
'url': "https://kitsu.io/{}/{}".format(self.mediatype, attr['slug']),
'aliases': list(filter(None, attr['titles'].values())),
'extra': [
('Synopsis', attr['synopsis']),
('Type', attr['subtype']),
]
})
# WORKAROUND: Shows with 1 episode (TVs, SPs, OVAs) end the same day they start
if total == 1:
info['end_date'] = info['start_date']
# WORKAROUND: Since there's no way to get the formal status,
# use the helper function to guess it.
info['status'] = self._guess_status(info['start_date'], info['end_date'])
return info
开发者ID:z411,项目名称:trackma,代码行数:41,代码来源:libkitsu.py
示例18: _parse_info
def _parse_info(self, item):
info = utils.show()
info.update(
{
"id": item["id"],
"title": item["name"],
"status": 0,
"image": self.url + item["image"]["original"],
"url": self.url + item["url"],
"extra": [
("Description", item.get("description")),
# ('Genres', item.get('genres')),
("Type", item.get("kind").capitalize()),
("Average score", item.get("score")),
("Russian title", item.get("russian")),
("Japanese title", item.get("japanese")[0]),
("English title", item.get("english")),
],
}
)
return info
开发者ID:Birdulon,项目名称:trackma,代码行数:21,代码来源:libshikimori.py
示例19: fetch_list
def fetch_list(self):
self.check_credentials()
self.msg.info(self.name, 'Downloading list...')
param = {'access_token': self._get_userconfig('access_token')}
data = self._request("GET", "user/{0}/{1}list".format(self.userid, self.mediatype), get=param)
showlist = {}
#with open('list', 'w') as f:
# json.dump(data, f, indent=2)
if not data["lists"]:
# No lists returned so no need to continue
return showlist
for remotelist in data["lists"].itervalues():
for item in remotelist:
if item['list_status'] not in self.media_info()['statuses']:
continue
show = utils.show()
showid = item[self.mediatype]['id']
show.update({
'id': showid,
'title': item[self.mediatype]['title_romaji'],
'aliases': [item[self.mediatype]['title_english']],
'type': item[self.mediatype]['type'],
'status': self.status_translate[item[self.mediatype][self.airing_str]],
'my_progress': self._c(item[self.watched_str]),
'my_status': item['list_status'],
'my_score': self._c(item['score']),
'total': self._c(item[self.mediatype][self.total_str]),
'image': item[self.mediatype]['image_url_lge'],
'image_thumb': item[self.mediatype]['image_url_med'],
})
showlist[showid] = show
return showlist
开发者ID:AkiraTreize,项目名称:trackma,代码行数:40,代码来源:libanilist.py
示例20: _parse_info
def _parse_info(self, item):
start_date = self._str2date(item['released'])
info = utils.show()
info.update({'id': item['id'],
'title': item['title'],
'image': item['image'],
'url': self._get_url(item['id']),
'start_date': self._str2date(item['released']),
'extra': [
('Original Name', item['original']),
('Released', item['released']),
('Languages', ','.join(item['languages'])),
('Original Language', ','.join(item['orig_lang'])),
('Platforms', ','.join(item['platforms'])),
('Aliases', item['aliases']),
('Length', item['length']),
('Description', item['description']),
('Links', item['links']),
]
})
return info
开发者ID:zJoul,项目名称:trackma,代码行数:22,代码来源:libvndb.py
注:本文中的trackma.utils.show函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论