hello
test
echo test
import json, shlex, sys
from subprocess import Popen
caption = sys.argv[1]
image_caption = ""
if len(sys.argv) == 4:
image_caption = sys.argv[3]
social_media = sys.argv[2].split(',')
is_image = False
print(sys.argv)
# usage: do_social_media_post.py "<message/image>" twitter,mastodon,bluesky,facebook,instagram
if caption.endswith(('jpg', 'png', 'gif', 'jpeg')):
is_image = True
for site in social_media:
if is_image == False:
if site != "instagram":
command = "/opt/homebrew/bin/python3 /Users/sysadmin/Documents/social_media_bots/"+site+"/posters/"+site+"_text.py " + json.dumps(caption)
print(command)
proc = Popen(shlex.split(command)) #, shell=True)
proc.communicate()
else:
print("instagram does not support text posting")
else:
command = "/opt/homebrew/bin/python3 /Users/sysadmin/Documents/social_media_bots/"+site+"/posters/"+site+"_image.py " + json.dumps(caption) + " " + json.dumps(image_caption)
print(command)
proc = Popen(shlex.split(command)) #, shell=True)
proc.communicate()