add --use-docker option; add requimpments.txt

This commit is contained in:
root 2021-11-14 14:47:34 -05:00
parent df66d02287
commit 6c6a87cbac
5 changed files with 27 additions and 8 deletions

5
insta2fedi Executable file
View File

@ -0,0 +1,5 @@
#!/bin/sh
# -*- coding: utf-8 -*-
echo "kek"
echo $@
python3 src/main.py $@

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
from colorama import Fore, Back, Style
def process_arguments(args, defaults):
count = 1
@ -11,16 +12,18 @@ def process_arguments(args, defaults):
defaults["token"] = args[count + 1]
elif (args[count] == "--check-interval"):
defaults["check-interval"] = args[count + 1]
defaults["check-interval"] = int(args[count + 1])
elif (args[count] == "--post-interval"):
defaults["post-interval"] = args[count + 1]
defaults["post-interval"] = int(args[count + 1])
elif (args[count] == "--fetch-count"):
defaults["fetch-count"] = args[count + 1]
defaults["fetch-count"] = int(args[count + 1])
elif (args[count] == "--using-mastodon"):
elif (args[count] == "--use-mastodon"):
defaults["carousel-limit"] = int(args[count + 1])
elif (args[count] == "--use-docker"):
defaults["use-docker"] = args[count + 1]
else:
print(Fore.RED + '❗ -> Wrong Argument Name!...')

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
from colorama import Fore, Back, Style
def split_array(arr, size):

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
import os
import sys
import time
@ -11,9 +12,6 @@ from arguments import process_arguments
from network import get_new_posts
id_filename = "/app/already_posted.txt"
with open(id_filename, "a") as f:
f.write("\n")
print(sys.argv)
print("ARGUMENTS")
@ -24,13 +22,24 @@ default_settings = {
"check-interval": 3600,
"post-interval": 3600,
"fetch-count" : 10,
"carousel-limit": 4
"carousel-limit": 4,
"use-docker": True
}
settings = process_arguments(sys.argv, default_settings)
print(settings)
agree = [1, True, "true", "True", "yes", "Yes"]
if (agree.count(settings["use-docker"])):
id_filename = "/app/already_posted.txt"
else:
id_filename = "./already_posted.txt"
with open(id_filename, "a") as f:
f.write("\n")
fetched_user = settings["instagram-user"]
mastodon_instance = settings["instance"]
mastodon_token = settings["token"]

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
from colorama import Fore, Back, Style
import requests
import time