def analyse(): files = db.files session_name = files.session_name q= session_name==session.session_id s = db(q) rows = s.select() groups={} #group managment for r in rows: if r.groupname not in groups: groups[r.groupname]=[] tmpfile = {} tmpfile["filename"] = r.filename tmpfile["address"] = request.folder+"uploads/"+r.doc tmpfile2 = {} tmpfile2["name"] = "whole" tmpfile2["address"] = "no-address" tmpfile2["stats"] = {"group":"0"} groups[r.groupname].append(tmpfile) groups[r.groupname].append(tmpfile2) else: tmpfile = {} tmpfile["filename"] = r.filename tmpfile["address"] = request.folder+"uploads/"+r.doc groups[r.groupname].append(tmpfile) #for every group we go through the files values = groups.viewvalues() for g in values: for text in g: if (text["address"] != "no-address"): drama = Drama(text["address"]) text["bible_name"] = drama.get_bibl_title() text["name"] = drama.get_title() text["whole_stats"] = drama.get_stats() text["stats"] = text["whole_stats"]["major"] text["median"] = text["whole_stats"]["median_count"] text["average"] = text["whole_stats"]["average_count"] return dict(session_id=session.session_id,answer=groups)
#!/usr/bin/env python # -*- coding: utf-8 -*- from drama import Drama the_drama = Drama('files/stranitzky_tuerk.xml') #test the file properties. print the_drama.get_title() print the_drama.get_bibl_title() print the_drama.get_bibl_author() print the_drama.get_publish_data()["license"] print the_drama.get_creation_date()
#!/usr/bin/env python # -*- coding: utf-8 -*- from drama import Drama the_drama = Drama("files/newBosteDer_hochm_tiLibre.xml") # test the file properties. # print the_drama.get_title() # print the_drama.get_bibl_title() # print the_drama.get_bibl_author() # print the_drama.get_publish_data()["license"] # print the_drama.get_creation_date() print the_drama.get_fix_stage()