db.write_log_to_db(ac, log_message, "x") data_upload = {'pa': 'hinein', 'pb': ac.log_start, 'pc': ac.log_start, 'pd': db.ac_config_1[3], 'pe': db.ac_config_1[4], 'pf': db.ac_config_1[6], 'pg': db.ac_config_1[7]} # use this only for debugging!! #lib_cm.message_write_to_console(ac, u"data_upload" # + c_autor.encode('utf-8', 'ignore') + " " # + c_title.encode('utf-8', 'ignore')) data_upload_encoded = urllib.urlencode(data_upload) web = lib_cm.upload_data(ac, db, db.ac_config_1[5], data_upload_encoded) if web is None: db.write_log_to_db_a(ac, ac.app_errorslist[4], "x", "write_also_to_console") ac.app_counter_error += 1 return web if web[0:6] == "Fehler": db.write_log_to_db(ac, ac.app_errorslist[3], "x") db.write_log_to_db(ac, web, "x") return web def work_on_data_from_log(time_now, log_data, load_from): """extract data from logs"""
# urlencode kann fehler werfen, # wenn sonderzeichen nicht encodet werden können try: data_upload_encoded = urllib.urlencode(data_upload) except Exception, e: log_message = u"urlencode Error: %s" % str(e) db.write_log_to_db(ac, log_message, "x") log_message = u"urlencode Error Data " + c_autor + " " + c_title db.write_log_to_db_a(ac, log_message, "x", "write_also_to_console") log_message = u"Uebertragung auf Web-Server abgebrochen " db.write_log_to_db_a(ac, log_message, "x", "write_also_to_console") return None # uebertragen web = lib_cm.upload_data(ac, db, url, data_upload_encoded) if web is None: db.write_log_to_db_a(ac, ac.app_errorslist[2], "x", "write_also_to_console") return None lib_cm.message_write_to_console(ac, web) if web[0:6] == "Fehler": db.write_log_to_db(ac, u"web-script:" + web, "x") return None else: db.write_log_to_db(ac, u"Programmvorschau ab " + str(ac.time_target.hour).zfill(2) + " Uhr uebertragen", "i") return str(z)
# urlencode kann fehler werfen, # wenn sonderzeichen nicht encodet werden können try: data_upload_encoded = urllib.urlencode(data_upload) except Exception, e: log_message = u"urlencode Error: %s" % str(e) db.write_log_to_db(ac, log_message, "x") log_message = u"urlencode Error Data " + c_autor + " " + c_title db.write_log_to_db_a(ac, log_message, "x", "write_also_to_console") log_message = u"Uebertragung auf Web-Server abgebrochen " db.write_log_to_db_a(ac, log_message, "x", "write_also_to_console") return None # uebertragen web = lib_cm.upload_data(ac, db, url, data_upload_encoded) if web is None: db.write_log_to_db_a(ac, ac.app_errorslist[2], "x", "write_also_to_console") return None lib_cm.message_write_to_console(ac, web) if web[0:6] == "Fehler": db.write_log_to_db(ac, u"web-script:" + web, "x") return None else: db.write_log_to_db( ac, u"Programmvorschau ab " + str(ac.time_target.hour).zfill(2) + " Uhr uebertragen", "i") return str(z)