diff --git a/insta2fedi b/insta2fedi new file mode 100755 index 0000000..02a3c86 --- /dev/null +++ b/insta2fedi @@ -0,0 +1,5 @@ +#!/bin/sh +# -*- coding: utf-8 -*- +echo "kek" +echo $@ +python3 src/main.py $@ diff --git a/src/arguments.py b/src/arguments.py index 3e2afe1..958d2ad 100644 --- a/src/arguments.py +++ b/src/arguments.py @@ -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!...') diff --git a/src/converters.py b/src/converters.py index cd86475..bd9a6c1 100644 --- a/src/converters.py +++ b/src/converters.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- from colorama import Fore, Back, Style def split_array(arr, size): diff --git a/src/main.py b/src/main.py index 24c04b1..1268b6c 100644 --- a/src/main.py +++ b/src/main.py @@ -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"] diff --git a/src/network.py b/src/network.py index b9ca47b..de34511 100644 --- a/src/network.py +++ b/src/network.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- from colorama import Fore, Back, Style import requests import time