mirror of
https://github.com/Horhik/Instagram2Fedi.git
synced 2025-01-15 05:16:40 +00:00
add --use-docker option; add requimpments.txt
This commit is contained in:
parent
df66d02287
commit
6c6a87cbac
5
insta2fedi
Executable file
5
insta2fedi
Executable file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
echo "kek"
|
||||
echo $@
|
||||
python3 src/main.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!...')
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from colorama import Fore, Back, Style
|
||||
|
||||
def split_array(arr, size):
|
||||
|
|
17
src/main.py
17
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"]
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from colorama import Fore, Back, Style
|
||||
import requests
|
||||
import time
|
||||
|
|
Loading…
Reference in a new issue