Don't repeat profile update process in common to add/update
This commit is contained in:
parent
e888ee88da
commit
84b9859579
15
igmirror.py
15
igmirror.py
|
@ -55,15 +55,15 @@ def add_igaccount(acc_id):
|
|||
pixelfed_setpic(acc_id, data['graphql']['user']['profile_pic_url'])
|
||||
pixelfed_setinfo(acc_id, data['graphql']['user']['biography'],\
|
||||
data['graphql']['user']['external_url'])
|
||||
update_igaccount_async(acc_id)
|
||||
update_igaccount_async(acc_id, False)
|
||||
else:
|
||||
print('W| User "{}" already exists in local database'.format(acc_id))
|
||||
return 0
|
||||
|
||||
def update_igaccount_async(acc_id):
|
||||
threading.Thread(target=update_igaccount, args=(acc_id,)).start()
|
||||
def update_igaccount_async(acc_id, profileset=True):
|
||||
threading.Thread(target=update_igaccount, args=(acc_id, profileset,)).start()
|
||||
|
||||
def update_igaccount(acc_id):
|
||||
def update_igaccount(acc_id, profileset=True):
|
||||
# if account does not exist, we stop the mirroring process
|
||||
accfile = './db/accounts/{}'.format(acc_id)
|
||||
if not os.path.exists(accfile):
|
||||
|
@ -71,9 +71,10 @@ def update_igaccount(acc_id):
|
|||
return 1
|
||||
|
||||
data = getig_user_data(acc_id)
|
||||
pixelfed_setpic(acc_id, data['graphql']['user']['profile_pic_url'])
|
||||
pixelfed_setinfo(acc_id, data['graphql']['user']['biography'],\
|
||||
data['graphql']['user']['external_url'])
|
||||
if profileset:
|
||||
pixelfed_setpic(acc_id, data['graphql']['user']['profile_pic_url'])
|
||||
pixelfed_setinfo(acc_id, data['graphql']['user']['biography'],\
|
||||
data['graphql']['user']['external_url'])
|
||||
pixelfed_dlposts(acc_id, data['graphql']['user'])
|
||||
|
||||
def update_allaccounts_async():
|
||||
|
|
Loading…
Reference in New Issue