コード例 #1
0
ファイル: makeGallery.py プロジェクト: ejegg/hostbot
		if (profile['image'] and profile['title']):
			profile['username'] = profile['title']
			featured_list.append(profile)
		else:
			pass
	return featured_list

def prepOutput(featured_list):
	first_subpage = params[params['subtype']]['first subpage']
	number_featured = params[params['subtype']]['number featured']
	featured_list = tools.addDefaults(featured_list)
	output = profiles.Profiles(params[params['subtype']]['output path'], settings = params) #stupid tocreate a new profile object here. and stupid to re-specify the path below
	i = first_subpage
	for f in featured_list:
		if i <= first_subpage + (number_featured - 1):
			f['profile'] = output.formatProfile(f)
			f['profile'] = f['profile'] + '\n' + params['header template']
			edit_summ = params['edit summary']
			output.publishProfile(f['profile'], params[params['subtype']]['output path'], edit_summ, sb_page = i)
			i += 1
		else:
				break

###MAIN
param = output_settings.Params()
params = param.getParams(sys.argv[1]) #pulls the type from the config
params['type'] = sys.argv[2] #workaround. type and subtype should be different
params['subtype'] = sys.argv[2]
tools = profiles.Toolkit()
makeGallery()
コード例 #2
0
        else:
            pass
    missing_profiles = [o['title'] for o in output if o not in profile_names]
    # 	print missing_profiles
    plist_sorted = sorted(profile_list,
                          key=lambda item: item['edits'],
                          reverse=True)
    plist_text = {'profiles': '\n'.join([x['text'] for x in plist_sorted])}
    formatted_profiles = profile_page.formatProfile(plist_text)
    edit_summ = params['edit summary'] % (params['type'], )
    profile_page.publishProfile(formatted_profiles,
                                params['output path'],
                                edit_summ,
                                edit_sec=1)


###MAIN###
conn = MySQLdb.connect(host=hb_config.host,
                       db=hb_config.dbname,
                       read_default_file=hb_config.defaultcnf,
                       use_unicode=True,
                       charset="utf8")
cursor = conn.cursor()
param = hb_output_settings.Params()
params = param.getParams(sys.argv[1])
params['type'] = sys.argv[1]
tools = hb_profiles.Toolkit()
rankProfiles()
cursor.close()
conn.close()
コード例 #3
0
ファイル: hb_toolkit.py プロジェクト: ejegg/hostbot
 def __init__(self):
     self.api_url = "https://en.wikipedia.org/w/api.php/"
     self.settings = hb_output_settings.Params()
     self.output_params = self.settings.getParams("th_invites")