def default_feedback():
    feedback = Feedback()
    feedback.add_item(
        "Write note: <PageNo> <Category> <Note...>",
        "Save a note for a document.",
    )
    return feedback
示例#2
0
 def __init__(self, args, task_id=None, xml_filename=None):
     parser = TestCaseParser()
     self.test_case_suites = parser.parse_from_csv(args)
     self.reporter = Reporter()
     self.feedback = Feedback(task_id)
     self.test_result = {}
     self.test_summary = {}
示例#3
0
    def __init__(self):

        # Get the apt cache
        self.cache = Cache()

        # Feedback module
        self.feedback = Feedback()
示例#4
0
 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)
示例#5
0
	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
0
 def __init__(self):
     self.feedback  = Feedback()
     
     # Configuration / workspace / projects / disabled projects
     self.config    = self._get_config()
     self.workspace = self._get_workspace()
     self.projects  = self._get_projects()
     self.disabled  = self._get_disabled()
    def get_feedback_pkt(self):

        fd_pkt = Feedback()
        fd_pkt.mode = self.mode
        fd_pkt.mcs = self.mcs
        fd_pkt.succ = self.succ
        fd_pkt.plen = self.rxv.length
        return fd_pkt
示例#8
0
 def update_json(self):
     self.write_json(self.archive_file, True)
     fb = Feedback()
     fb.add_item(
         title='正在更新(/≥▽≤/)',
         valid='no',
         arg='update')
     print(fb)
示例#9
0
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
示例#10
0
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
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
示例#12
0
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
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
示例#14
0
def search_shows(query):
    if isAvailable():
        results = get_data("sb.searchtvdb&name=" + 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
示例#15
0
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
def autocomplete(sect, pg, note):
    feedback = Feedback()
    add = lambda s: feedback.add_item(
        title='[%s] Write note' % s.title(), 
        subtitle="pg %s, Category: %s, \": %s...\"" % (pg, s, note[:20]), 
        arg='\\t'.join([s, pg, note])
    )
    [add(s) for s in SECTIONS if sect.lower() in s.lower()]
    add(sect)
    return feedback
示例#17
0
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
示例#18
0
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
示例#19
0
文件: plgrader.py 项目: niotie/plbank
 def __init__(self):
     try:
         self.pld= json.load(open("pl.json","r"))
     except Exception as e:
         self.fb = Feedback()
         self.fb.addFeedback( "# erreur de plateforme \n pl.json illissible\n")
         self.fb.success = True
         self.doOutput()
         sys.exit(1)
     self.fb =  Feedback()
     self.fb.success=True
示例#20
0
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
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
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
示例#23
0
 def __init__(self, org_name: str, location: str, title: str, artist: str):
     self.org_name: str = org_name.strip()
     self.location: str = location
     self.title: str = title.rstrip()
     self.artist_name: str = artist.rstrip()
     self.year: str = None
     self.file_format: str = None
     self.new_name: str = None
     self.feedback = Feedback()
     self.org_exists = os.path.exists(os.path.join(self.location))
     self._new_exists = False
     self.determine_format()
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
示例#25
0
 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)
示例#26
0
def oauth_with_code(query):
	code=query
	r = client.request_access_token(code)
	access_token = r.access_token 
	expires_in = r.expires_in 
	setting['access_token']=access_token
	setting['expires_in']=expires_in
	client.set_access_token(access_token, expires_in)
	save_setting()
	fb = Feedback()
	fb.add_item(u'go ',subtitle=u'go to weibo ',
	arg=u'完成新浪微博授权',icon=u'24.png')
	return fb
示例#27
0
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
示例#28
0
def get_jobs():
    data = get_data("qstatus")
    fb = Feedback()
    if len(data['jobs']) > 0:
        for job in data['jobs']:
            filename = job['filename']
            mb_left = job['mbleft']
            mb_total = job['mb']
            subtitle_text = mb_left + " / " + mb_total
            fb.add_item(filename, subtitle_text)
    else:
        fb.add_item("No current jobs")
    print fb
示例#29
0
def parse_data(data, showCVR):
    fb = Feedback()
    address = data['adresse'] + ", " + str(data['postnr']) + " " + data['by']
    name = data['navn']
    phone = ""
    mail = ""
    if showCVR:
        name = data['navn'] + " - " + str(data['cvr'])
    if 'telefon' in data:
        phone = " - Tlf: " + data['telefon']
    if 'email' in data:
        mail = " - Email: " + data['email']
    fb.add_item(name, address + phone + mail, str(data['cvr']))
    return fb
示例#30
0
def parse_data(data, showCVR):
    fb = Feedback()
    address = data['adresse'] + ", " + str(data['postnr']) + " " + data['by']
    name = data['navn']
    phone = ""
    mail = ""
    if showCVR:
        name = data['navn'] + " - " + str(data['cvr'])
    if 'telefon' in data:
            phone = " - Tlf: " + data['telefon']
    if 'email' in data:
        mail = " - Email: " + data['email']
    fb.add_item(name, address + phone + mail, str(data['cvr']))
    return fb
示例#31
0
def send_weibo(query):
	with open ('setting.pickle','rb') as f:
		setting = pickle.load(f)
	client.set_access_token(setting['access_token'], setting['expires_in'])
	result=''
	try:
		client.statuses.update.post(status=query)
		result=u'发送成功'
	except:
		result=u'发送失败'	
	fb = Feedback()
	fb.add_item(u'发送微博',subtitle=u'发送微博信息',
	arg=result,icon=u'24.png')
	return fb
示例#32
0
def get_history():
    data = get_data("history")['history']
    fb = Feedback()
    if len(data['slots']) > 0:
        for slot in data['slots']:
            name = slot['name']
            size = slot['size']
            status = slot['status']
            fail_message = slot['fail_message']
            subtitle_text = size + " | " + status + " | " + fail_message
            fb.add_item(name, subtitle_text)
    else:
        fb.add_item("History is empty")
    print fb
示例#33
0
文件: cvr.py 项目: Fogh/CVR-Alfred
def parse_data(data, showCVR):
    fb = Feedback()
    address = data['address'] + ", " + str(data['zipcode']) + " " + data['city']
    name = data['name']
    phone = ""
    mail = ""
    if showCVR:
        name = data['name'] + " - CVR: " + str(data['vat'])
    if 'phone' in data:
            phone = " - Tlf.: " + data['phone']
    if 'email' in data:
        mail = " - Email: " + data['email']
    fb.add_item(name, address + phone + mail, str(data['vat']))
    return fb
示例#34
0
	def companies_list(self):
		if not self.is_terminal: 
			fb = Feedback()

		for company in self.companies:
			if self.is_terminal:
				title = '%s [%s]' % (company['companyname'], company['tel'])
				subtitle = company['comurl']
				print '%s -> %s (%s)' % (company['companyname'], company['code'], company['url'])
			else: 
				company = self._format_company_filter(company)
				fb.add_item(company['title'], company['subtitle'], arg=company['arg'], valid='no', autocomplete=company['autocomplete'])

		if not self.is_terminal: 
			print fb
示例#35
0
文件: cvr.py 项目: Fogh/CVR-Alfred
def parse_data(data, showCVR):
    fb = Feedback()
    address = data['address'] + ", " + str(
        data['zipcode']) + " " + data['city']
    name = data['name']
    phone = ""
    mail = ""
    if showCVR:
        name = data['name'] + " - CVR: " + str(data['vat'])
    if 'phone' in data:
        phone = " - Tlf.: " + data['phone']
    if 'email' in data:
        mail = " - Email: " + data['email']
    fb.add_item(name, address + phone + mail, str(data['vat']))
    return fb
示例#36
0
 def __init__(self):
     
     # Get the apt cache
     self.cache = Cache()
     
     # Feedback module
     self.feedback = Feedback()
示例#37
0
 def __init__(self, name):
     
     # Service name
     self.name = name
     
     # Feedback handler
     self.feedback = Feedback(use_timestamp=True)
示例#38
0
def get_mail_by_date(connection):
    # print(date)
    # resp, msgs = myMail.search(None, 'FROM "Gandhi Rajan"')
    # _, msgs = myMail.search(None,'ALL')
    # print(f'{resp} -- {msgs}')

    # fetch mail by sender and date
    connection.select("Inbox")
    resp, msgs = connection.search(None, f'ON {date} FROM "Gandhi Rajan"')
    feedback_arr = []
    for msg_no in msgs[0].split():
        _, msg = myMail.fetch(msg_no, '(RFC822)')
        message = email.message_from_bytes(
            msg[0][1])  # Parse the raw email message in to a convenient object
        # print('\n')
        subject = message["subject"].split("|")
        # print(f'{len(subject)} -- {subject}')
        # sender = message["from"].split()[-1]
        if len(subject) == 5:
            pId = subject[0]
            name = subject[1]
            mail = subject[2]
            product = subject[3]
            review = subject[4]
            feedback = Feedback(pId, name, mail, product, review)
            feedback_arr.append(feedback)
    return feedback_arr
示例#39
0
 def __init__(self, args, task_id=None, xml_filename=None):
     parser = TestCaseParser()
     self.test_case_suites = parser.parse_from_csv(args)
     self.reporter = Reporter()
     self.feedback = Feedback(task_id)
     self.test_result = {}
     self.test_summary = {}
示例#40
0
 def queueFeedback(self, feedback):
     timeToIssue = 0
     if (self.delay):
         timeToIssue = time.time() + max(0, np.random.normal(self.delay_mean, self.delay_stdev))
     
     f = Feedback(feedback, timeToIssue)
     print("Should give feedback {} in {} at {}".format(f.count, f.timeToIssue - time.time(), time.time()))
     self.feedback.append(f)
示例#41
0
def feedback_to_user(errors, is_question):
    overall_feedback = ""
    for i, (word1, tag1, word2, tag2) in enumerate(errors):
        overall_feedback += "%d) " % (int(i) + 1)
        overall_feedback += Feedback.feedback(word1, tag1, word2, tag2,
                                              is_question)
        overall_feedback += "\n\n"

    return overall_feedback
示例#42
0
def show_options(arg):
    fb = Feedback()

    options = get_options()
    cur = get_resolution()
    for idx, option in enumerate(options):
        display = str(option[0]) + 'X' + str(option[1])
        val = '(' + str(option[0]) + ',' + str(option[1]) + ')'
        if cur[0] == option[0] and cur[1] == option[1]:
            sub = '**Current Resolution'
            valid = 'no'
        else:
            sub = 'Set Resolution'
            valid = 'yes'

        if arg == '' or arg in str(option[0]) or arg in str(option[1]):
            fb.add_item(display, sub, val, valid)

    print fb
示例#43
0
    def __init__(self, template=None):
        answers = get_answers()
        with open("student", "w+") as f:
            f.write(answers['answer'])
        try:
            self.pld = json.load(open("pl.json", "r"))

        except Exception as e:

            self.fb = Feedback(template)
            self.fb.adddiv("err",
                           "# erreur de plateforme \n pl.json illissible\n")
            self.fb.success = True
            self.fb.flags = "-Wall -ansi"
            self.doOutput()
            sys.exit(1)
        self.fb = Feedback(template)
        self.fb.success = True
        self.fb.flags = "-Wall -ansi"
示例#44
0
文件: cvr.py 项目: Fogh/CVR-Alfred
def lookup(query):
    fb = Feedback()
    if len(query) == 8 and query.isdigit():
        data = get_data(query)
        if 'error' in data:
            fb.add_item("Ugyldigt CVR-nummer")
        else:
            fb = parse_data(data, False)
    elif len(query) > 8 and query.isdigit():
        fb.add_item("CVR-nummeret er for langt", "CVR-numre er 8-cifret")
    elif len(query) < 8 and query.isdigit():
        fb.add_item("Indtast CVR-nummer")
    else:
        data = get_data(query)
        if 'error' in data and data['error'] == 'NOT_FOUND':
            fb.add_item(u"Din søgning gav intet resultat")
        else:
            fb = parse_data(data, True)
    print fb
示例#45
0
def main(args):
    if os.path.exists('city.txt'):
        CITY = file('city.txt', 'r').read().strip('\r\n \t')

    region = urllib.quote(CITY)
    feeds = Feedback()

    if len(args) == 2:  # 有参数的才进行分析
        if '到' in args[1] or '去' in args[1]:  # 调用导航的API来做操作
            if '到' in args[1]:
                location = args[1].split('到')
            elif '去' in args[1]:
                location = args[1].split('去')

            map_url = '%s/direction?origin=%s&destination=%s&mode=transit&region=%s&output=html&src=alfredapp.baidumap.search' % (
                API_URL_BASE, urllib.quote(
                    location[0]), urllib.quote(location[1]), region)
            feeds.add_item(title=unicode(args[1], 'utf-8'),
                           subtitle=unicode(CITY, 'utf-8'),
                           valid='YES',
                           arg=map_url,
                           icon='icon.png')
        else:
            query = urllib.quote(args[1])

            result = json.load(
                urllib2.urlopen(
                    '%s/place/v2/search?&q=%s&region=%s&output=json&ak=%s' %
                    (API_URL_BASE, query, region, AK)))

            if result['status'] == 0:
                for i in result['results']:
                    name = i.get('name', '搜索不到结果')
                    address = i.get('address', '')
                    uid = i.get('uid', '')

                    map_url = '%s/?newmap=1&s=inf%%26uid%%3D%s%%26wd%%3D%s' % (
                        MAP_URL_BASE, uid, name)

                    feeds.add_item(title=name,
                                   subtitle=address,
                                   valid='YES',
                                   arg=map_url,
                                   icon='icon.png')
            else:
                feeds.add_item(title=u'内容未找到',
                               subtitle=u'输入内容有误',
                               valid='no',
                               arg=MAP_URL_BASE,
                               icon='icon.png')

        print(feeds)  # 最终输出结果
    return
示例#46
0
def show_options(arg):
	fb = Feedback()

	options = get_options()
	cur = get_resolution()
	for idx, option in enumerate(options):
		display = str(option[0]) + 'X' + str(option[1])
		val = '(' + str(option[0]) + ',' + str(option[1]) + ')'
		if cur[0] == option[0] and cur[1] == option[1]:
			sub = '**Current Resolution'
			valid = 'no'
		else:
			sub = 'Set Resolution'
			valid = 'yes'

		if arg == '' or arg in str(option[0]) or arg in str(option[1]):
			fb.add_item(display, sub, val, valid)

	print fb
示例#47
0
def feedback():
    if request.method == 'POST':
        #此处text获得是html内容,含有html标签
        text = request.form.get("Feedback")
        checkbox = request.form.getlist("Checkbox")
        #后端进一步验证表单,以保证数据可靠性
        if not text or not checkbox:
            flash("请保证输入完整!")
            return redirect(url_for("feedback"))

        #发送html格式邮件
        email(text)
        #将反馈类型存入redis
        re_set.to_set(lis=checkbox)
        #将列表转为字符串存进数据库
        checkbox = ','.join(checkbox)
        #将html格式过滤为只含反馈文本内容的字符串
        text_filter = re.compile('>.*?<')
        text = ''.join(re.findall(text_filter,
                                  text)).replace('>', '').replace('<', '')

        if current_user.is_authenticated:
            username = current_user.username
            feedback = Feedback(username=username,
                                text=text,
                                category=checkbox)
        else:
            #游客反馈时,不存入用户名
            feedback = Feedback(text=text, category=checkbox)

        db.session.add(feedback)
        db.session.commit()
        flash("感谢您的反馈!")
        return redirect(url_for("index"))
    typelist = []
    for each in re_set.con.zrevrange(re_set.name,
                                     0,
                                     re_set.con.zcard(re_set.name) + 1,
                                     withscores=False):
        typelist.append(each.decode())

    return render_template('feedback.html', typelist=typelist)
示例#48
0
def main(args):
    global CITY, AK, API_URL_BASE, MAP_URL_BASE
    init_env()

    region = urllib.quote(CITY)

    if len(args) == 2:
        query = urllib.quote(args[1])
        # query = urllib.quote('天安门')

        result = json.load(
            urllib2.urlopen(
                '%s?keywords=%s&city=%s&output=json&key=%s&extensions=all' %
                (API_URL_BASE, query, region, AK)))
        feeds = Feedback()

        if result['status'] == '1':
            if result['count'] == '0':
                if urllib.quote('到') in query or urllib.quote('去') in query:
                    map_url = MAP_URL_BASE % (query, region)
                    feeds.add_item(title=args[1],
                                   subtitle=u"搜索规划路径",
                                   valid='YES',
                                   arg=map_url,
                                   icon='icon.png')
            else:
                for i in result['pois']:
                    name = i.get('name', u'搜索不到结果')
                    address = i.get('address', '')

                    if urllib.quote('到') in query or urllib.quote(
                            '去') in query:
                        map_url = MAP_URL_BASE % (query, region)
                    else:
                        map_url = MAP_URL_BASE % (name, region)

                    feeds.add_item(title=name,
                                   subtitle=address,
                                   valid='YES',
                                   arg=map_url,
                                   icon='icon.png')
        else:
            feeds.add_item(title=u'内容未找到',
                           subtitle=u'输入内容有误',
                           valid='no',
                           arg=MAP_URL_BASE,
                           icon='icon.png')

        print(feeds)
    return
示例#49
0
	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')
示例#50
0
def lookup(query):
    fb = Feedback()
    if len(query) == 8 and query.isdigit():
        data = get_data(query)
        if 'error' in data:
            fb.add_item("Ugyldigt CVR-nummer")
        else:
            fb = parse_data(data, False)
    elif len(query) > 8 and query.isdigit():
        fb.add_item("CVR-nummeret er for langt", "CVR-numre er 8-cifret")
    elif len(query) < 8 and query.isdigit():
        fb.add_item("Indtast CVR-nummer")
    else:
        data = get_data(name=query)
        fb = parse_data(data, True)
    print fb
示例#51
0
    def prepare_feedback(self):
        """
        Preparation for feedback file to be called before running tests
        Create path if needed
        Delete old file if needed
        Write initial information
        """
        log.info("Enter")

        if self.feedback:

            # Create path if needed
            path = self.path + "/" + self.name + "/runs/" + str(self.run)
            p = Path(path)
            try:
                p.mkdir(parents=True)
            except:
                log.debug("path already created")

            # Delete old feedback file if needed
            if os.path.isfile(self.feedback):
                log.debug("delete old feedback file")
                os.remove(self.feedback)

            # Write initial lines
            log.debug("feedback required on file={}".format(self.feedback))
            self._FB = Feedback(filename=path + "/" + self.feedback,
                                debug=self.debug)
            self._FB.delete()
            self._FB.write(key="playbook_path", value=self.path)
            self._FB.write(key="playbook", value=self.name)
            self._FB.write(key="run", value=self.run)
            self._FB.write(key="start_time", value=(int(time.time())))

        else:
            log.debug("no feedback required")
示例#52
0
class FeedbackTestCase(unittest.TestCase):

    # Always run before any test
    def setUp(self):
        self.fdb = Feedback(filename='tests/feedback.log', debug=True)

    def test10_delete1(self):
        self.fdb.delete()

    def test20_delete2(self):
        self.fdb.delete()

    #@unittest.skip  # no reason needed
    def test30_write(self):
        self.fdb.write(key='mykey', value='myvalue')

    def test40_delete2(self):
        self.fdb.delete()
示例#53
0
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
示例#54
0
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
示例#55
0
def get_jobs():
    data = get_data("qstatus")
    fb = Feedback()
    if len(data['jobs']) > 0:
        for job in data['jobs']:
            filename = job['filename']
            mb_left = job['mbleft']
            mb_total = job['mb']
            subtitle_text = mb_left + " / " + mb_total
            fb.add_item(filename, subtitle_text)
    else:
        fb.add_item("No current jobs")
    print fb