Ejemplo n.º 1
0
def make_image_data(copy_page_id, access_token, type):
    choice = "y"
    parameters = None
    while (choice != "n"):
        os.system("clear")
        posts = get_post(copy_page_id,access_token,limit=1, parameters=parameters)
        for post in posts:
            try:
                message = format_message(post["message"])
                post_id = post["id"]
                lines = count_lines(message)
                title = get_title(message)
                file = post_id+".jpeg"
                data = {"title":title, "file":file, "fbid":post_id,'msg':message}
                data2 = {"fbid":post_id}
                status= db.write_data(data2)
                if status == True:
                    print(message)
                    choice_post = raw_input("\nPress Enter To post .... \nPress x to see next post\nCtrl + Z to Exit")
                    if choice_post !="x":
                        data1 = {"file":post_id, 'msg':message}
                        upload_image(data1)
                        data2 = {'p':1,'key':'65418897295aa863cb71ebdf3f36c73f',"file":file,"by":"Miku","title":title,"type":type}
                        upload_data(data2)
                        loggingmix.DEBUG("File : " +file+ "Created Sucessfully")

            except Exception as e:
                print e

        parameters = next_page(copy_page_id, access_token, limit=1, parameters=parameters)
Ejemplo n.º 2
0
def make_image_data(copy_page_id, access_token):
    choice = "y"
    parameters = None
    while (choice != "n"):
        os.system("clear")
        posts = get_post(copy_page_id,access_token,limit=1, parameters=parameters)
        for post in posts:
            try:
                message = format_message(post["message"])
                post_id = post["id"]
                lines = count_lines(message)
                title = get_title(message)
                file = post_id+".png"
                data = {"title":title, "filename":file, "fbid":post_id}
                status= db.write_data(data)
                if status == True:
                    print(post["message"])
                    choice_post = raw_input("\nPress Enter To post .... \nPress x to see next post\nCtrl + Z to Exit")
                    if choice_post !="x":
                        imagecreator.createImage(no_of_lines=lines, message=message, file=file , fbid= post_id, title=title)
            except Exception as e:
                print e

        parameters = next_page(copy_page_id, access_token, limit=1, parameters=parameters)