|
|
|
|
@ -1,13 +1,12 @@ |
|
|
|
|
import os |
|
|
|
|
import random |
|
|
|
|
import traceback |
|
|
|
|
from datetime import datetime |
|
|
|
|
from getopt import GetoptError, getopt |
|
|
|
|
from sys import argv |
|
|
|
|
from sys import argv, exit |
|
|
|
|
from time import sleep |
|
|
|
|
|
|
|
|
|
import arangodb |
|
|
|
|
from arangodb import db |
|
|
|
|
from arangodb import db, write_report, backup |
|
|
|
|
from classes import Profile, User |
|
|
|
|
from helpers import sleep_, write_error |
|
|
|
|
from scrapers import profile_picture_reactions |
|
|
|
|
@ -20,13 +19,10 @@ from scrapers import profile_picture_reactions |
|
|
|
|
if __name__ == "__main__": |
|
|
|
|
print() |
|
|
|
|
|
|
|
|
|
# Säkerställ att arbetsmappen är samma som den där scriptet ligger |
|
|
|
|
os.chdir(os.path.dirname(__file__)) |
|
|
|
|
|
|
|
|
|
# Argument och alternativ |
|
|
|
|
argv = argv[1:] |
|
|
|
|
try: |
|
|
|
|
opts, args = getopt(argv, "m:u:o:", ["mode=", "users=", "other="]) |
|
|
|
|
opts, args = getopt(argv, "bm:u:o:", ['backup=',"mode=", "users=", "other="]) |
|
|
|
|
for o, a in opts: |
|
|
|
|
if o in ["-u", "--user"]: |
|
|
|
|
users = [ |
|
|
|
|
@ -35,6 +31,11 @@ if __name__ == "__main__": |
|
|
|
|
] |
|
|
|
|
if o in ["-o", "--other"]: |
|
|
|
|
url_other_picture = a |
|
|
|
|
if o in ['-b', '--backup']: |
|
|
|
|
while True: |
|
|
|
|
backup(db) |
|
|
|
|
sleep(21600) |
|
|
|
|
|
|
|
|
|
# mode_nr används för hur ofta profile ska roteras |
|
|
|
|
if o in ["-m", "--mode"]: |
|
|
|
|
mode = a |
|
|
|
|
@ -97,6 +98,7 @@ if __name__ == "__main__": |
|
|
|
|
for user in users: |
|
|
|
|
# Set för kollade bilder och kollade medlemmar |
|
|
|
|
all_pictures = set([doc["_key"] for doc in db.collection("pictures").all()]) |
|
|
|
|
all_pictures_start = all_pictures.copy() |
|
|
|
|
members_checked = arangodb.checked_members() |
|
|
|
|
|
|
|
|
|
if user.username not in members_checked:# Hämta reaktioner för den första användaren LÄGG TILL NOT IN MEMBERS_CHECKED |
|
|
|
|
@ -178,11 +180,7 @@ if __name__ == "__main__": |
|
|
|
|
pass |
|
|
|
|
|
|
|
|
|
# Ladda in nya användare att kolla |
|
|
|
|
print("\nVem vill du kolla upp?") |
|
|
|
|
user_input = input(">>> ") |
|
|
|
|
if user_input in ['exit', '', 'ingen']: |
|
|
|
|
for profile in profiles: |
|
|
|
|
profile.unused() |
|
|
|
|
break |
|
|
|
|
else: |
|
|
|
|
users = [User(str(i).strip()) for i in user_input.split(",")] |
|
|
|
|
write_report(users, list(all_pictures.difference(all_pictures_start))) |
|
|
|
|
exit() |