-
-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tweet images instead of text #94
Conversation
updated get_tweet() so that it returns a random tweet each time it is called from within a loop.
The program now gets a random tweet from get_tweet.py and prints it on a random image from img_bg. The function "run" takes "x" as a parameter and repeats the above mentioned process for x no of times.
The program uploads an image instead of the tweet. Another parameter could be passed to upload image WITH a tweet. It assumes that the generated images have the naming convention "post_{no}.png" and are all located in the same directory as the tweet.py file. It also assumes that there exists atleast 1 image with the above mentioned naming convention in the directory.
"No image exists in working directory" and infinite loop issue resolved. The program now scans and initializes the array "arr" containing image names and tweets every hr with 1 image from the array. get_img_random() is obsolete now, hence is commented out.
updated to include both, post_{no} and post_{no+'a'} files into the array `arr` containing filenames
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution. I'm excited to see this in production
Don't forget to follow the bot on Twitter to see the hard work you put in.
run() | ||
|
||
if __name__ == "__main__": | ||
main() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These 4 lines should be replaced with these 2 lines
if __name__ == "__main__":
run()
run()
already calls for main()
at line 88
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Thanks!
Solves #90
Changes made to get_tweet.py :
-updated get_tweet() so that it returns a random tweet each time it is called from within a loop. Before that it returned the same tweet if called from another script.
Changes made to generateImage.py :
-it now takes a random tweet from get_tweet.py and adds it on the images.
-default x and y co-ordinates changed so that the tweet appears in center of the image.
-could be imported into another script and used to generate an array of images via the "run(x)" function which generates x images with random tweets.
Changes made to tweet.py:
-The program uploads an image instead of the tweet. Another parameter could be passed to upload image WITH a tweet.
NOTE: It assumes that the generated images have the naming convention "post_{no}.png" and are all located in the same directory as the tweet.py file. It also assumes that there exists atleast 1 image with the above mentioned naming convention in the directory. If not, the script will enter an infinite loop when get_img_random() is called.