本文整理汇总了Python中feedback.Feedback.add_item方法的典型用法代码示例。如果您正苦于以下问题:Python Feedback.add_item方法的具体用法?Python Feedback.add_item怎么用?Python Feedback.add_item使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类feedback.Feedback
的用法示例。
在下文中一共展示了Feedback.add_item方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: tracking_search
# 需要导入模块: from feedback import Feedback [as 别名]
# 或者: from feedback.Feedback import add_item [as 别名]
def tracking_search(self, number, company=''):
if number <= 0:
sys.exit('\033[33m[Error]\033[0m Tracking number must more than zero')
dataset = None
company = self._company_match(company)
if company:
url = 'http://m.kuaidi100.com/query?type=%s&postid=%s&id=1' % (company, number)
r = requests.get(url)
dataset = r.json()
if not self.is_terminal:
fb = Feedback()
if dataset['status'] == '200':
for step in dataset['data']:
time = step['time']
content = step['context'].replace(' ', '')
if self.is_terminal:
print '%s\t%s' % (time, content)
else:
arg = '%s %s' % (time, content)
fb.add_item(content, time, arg=arg, valid='no')
if not self.is_terminal:
print fb
else:
if self.is_terminal:
print '\033[33m[Error]\033[0m %s' % dataset['message']
else:
fb.add_item(dataset['message'], valid='no')
示例2: default_feedback
# 需要导入模块: from feedback import Feedback [as 别名]
# 或者: from feedback.Feedback import add_item [as 别名]
def default_feedback():
feedback = Feedback()
feedback.add_item(
"Write note: <PageNo> <Category> <Note...>",
"Save a note for a document.",
)
return feedback
示例3: anime_resource
# 需要导入模块: from feedback import Feedback [as 别名]
# 或者: from feedback.Feedback import add_item [as 别名]
def anime_resource(self, payload):
"""番组资源列表, 放送站点, 介绍链接, 下载地址"""
fb = Feedback()
for x in payload:
fb.add_item(
title=x['site'],
subtitle=' | '.join([x['name'], x['url']]), arg=x['url'])
print(fb)
示例4: update_json
# 需要导入模块: from feedback import Feedback [as 别名]
# 或者: from feedback.Feedback import add_item [as 别名]
def update_json(self):
self.write_json(self.archive_file, True)
fb = Feedback()
fb.add_item(
title='正在更新(/≥▽≤/)',
valid='no',
arg='update')
print(fb)
示例5: company_search
# 需要导入模块: from feedback import Feedback [as 别名]
# 或者: from feedback.Feedback import add_item [as 别名]
def company_search(self, company_name):
fb = Feedback()
company_codes = []
for company in self.companies:
if re.search(company_name, company['url']):
company = self._format_company_filter(company)
fb.add_item(company['title'], company['subtitle'], arg=company['arg'], valid='no', autocomplete=company['autocomplete'])
print fb
示例6: get_history
# 需要导入模块: from feedback import Feedback [as 别名]
# 或者: from feedback.Feedback import add_item [as 别名]
def get_history():
if isAvailable():
data = get_data("history&limit=10&type=downloaded")['data']
fb = Feedback()
for item in data:
resource = item['resource']
date = item['date']
fb.add_item(resource, date, resource)
print fb
示例7: search_movie
# 需要导入模块: from feedback import Feedback [as 别名]
# 或者: from feedback.Feedback import add_item [as 别名]
def search_movie(query):
data = get_data("movie.search" + "?q=" + urllib.quote(query))
fb = Feedback()
for movie in data['movies']:
movieTitle = movie['titles'][0]
movieYear = str(movie['year'])
identifier = movie['imdb']
fb.add_item(movieTitle, movieYear, identifier)
print fb
示例8: search_movie
# 需要导入模块: from feedback import Feedback [as 别名]
# 或者: from feedback.Feedback import add_item [as 别名]
def search_movie(query):
data = get_data("movie.search" + "?q=" + query)
fb = Feedback()
for movie in data["movies"]:
movieTitle = movie["titles"][0]
movieYear = str(movie["year"])
identifier = movie["imdb"]
fb.add_item(movieTitle, movieYear, identifier)
print fb
示例9: search_shows
# 需要导入模块: from feedback import Feedback [as 别名]
# 或者: from feedback.Feedback import add_item [as 别名]
def search_shows(query):
if isAvailable():
results = get_data("sb.searchtvdb&name=" + urllib.quote(query))['data']['results']
fb = Feedback()
for result in results:
show_name = result['name']
first_aired = "First aired: " + str(result['first_aired'])
tvdbid = str(result['tvdbid'])
fb.add_item(show_name, first_aired, tvdbid)
print fb
示例10: get_shows
# 需要导入模块: from feedback import Feedback [as 别名]
# 或者: from feedback.Feedback import add_item [as 别名]
def get_shows():
if isAvailable():
data = get_data("shows")['data']
fb = Feedback()
for key in data.keys():
show = data[key]
subtitle_text = "Next episode: " + show['next_ep_airdate']
if show['status'] == "Ended":
subtitle_text = "Ended"
fb.add_item(show['show_name'], subtitle_text, key)
print fb
示例11: get_user_timeline
# 需要导入模块: from feedback import Feedback [as 别名]
# 或者: from feedback.Feedback import add_item [as 别名]
def get_user_timeline():
with open ('setting.pickle','rb') as f:
setting = pickle.load(f)
client.set_access_token(setting['access_token'], setting['expires_in'])
data=client.statuses.home_timeline.get()
fb = Feedback()
for x in data.statuses:
fb.add_item(u'%s'%x.user.screen_name,
subtitle=x.text,
arg=str(x.user.id)+','+str(x.id),icon=u'24.png')
return fb
示例12: list_wanted_movies
# 需要导入模块: from feedback import Feedback [as 别名]
# 或者: from feedback.Feedback import add_item [as 别名]
def list_wanted_movies():
data = get_data("movie.list?status=active")
fb = Feedback()
if data['total'] > 0:
for movie in data['movies']:
movieTitle = movie['library']['titles'][0]['title']
movieYear = str(movie['library']['year'])
identifier = movie['library']['identifier']
fb.add_item(movieTitle, movieYear, identifier)
else:
fb.add_item("No movies on the wanted list")
print fb
示例13: list_droplets
# 需要导入模块: from feedback import Feedback [as 别名]
# 或者: from feedback.Feedback import add_item [as 别名]
def list_droplets():
data = get_data("droplets")
fb = Feedback()
if len(data['droplets']) > 0:
for droplet in data['droplets']:
name = droplet['name']
ip_address = droplet['ip_address']
#status = droplet['status']
fb.add_item(name, ip_address, ip_address)
else:
fb.add_item("No droplets")
print fb
示例14: week_list
# 需要导入模块: from feedback import Feedback [as 别名]
# 或者: from feedback.Feedback import add_item [as 别名]
def week_list(self, payload):
"""一周番组放送"""
fb = Feedback()
for x in payload:
fb.add_item(title=x['titleCN'],
subtitle=' | '.join([
self.week_format(x['weekDayCN']),
self.time_format(x['timeCN']),
' '.join(self.site(x['onAirSite']))]),
valid="no",
autocomplete=self.year + self.quarter +
'w' + str(self.week) + x['titleCN'])
print(fb)
示例15: get_soon_episodes
# 需要导入模块: from feedback import Feedback [as 别名]
# 或者: from feedback.Feedback import add_item [as 别名]
def get_soon_episodes():
if isAvailable():
data = get_data("future&type=soon")['data']['soon']
fb = Feedback()
for episode in data:
episode_name = episode['ep_name']
show_name = episode['show_name']
airs = episode['airs']
air_date = episode['airdate']
full_title = show_name + " - " + episode_name
full_subtitle = airs + " (" + air_date + ")"
fb.add_item(full_title, full_subtitle)
print fb