mirror of https://gitlab.com/bashrc2/epicyon
Less indentation
parent
f41d52630b
commit
acabbc9220
59
migrate.py
59
migrate.py
|
@ -129,41 +129,42 @@ def _update_moved_handle(base_dir: str, nickname: str, domain: str,
|
||||||
following_filename = \
|
following_filename = \
|
||||||
acct_dir(base_dir, nickname, domain) + '/following.txt'
|
acct_dir(base_dir, nickname, domain) + '/following.txt'
|
||||||
if os.path.isfile(following_filename):
|
if os.path.isfile(following_filename):
|
||||||
|
following_handles = []
|
||||||
with open(following_filename, 'r', encoding='utf-8') as foll1:
|
with open(following_filename, 'r', encoding='utf-8') as foll1:
|
||||||
following_handles = foll1.readlines()
|
following_handles = foll1.readlines()
|
||||||
|
|
||||||
moved_to_handle = moved_to_nickname + '@' + moved_to_domain_full
|
moved_to_handle = moved_to_nickname + '@' + moved_to_domain_full
|
||||||
handle_lower = handle.lower()
|
handle_lower = handle.lower()
|
||||||
|
|
||||||
refollow_filename = \
|
refollow_filename = \
|
||||||
acct_dir(base_dir, nickname, domain) + '/refollow.txt'
|
acct_dir(base_dir, nickname, domain) + '/refollow.txt'
|
||||||
|
|
||||||
# unfollow the old handle
|
# unfollow the old handle
|
||||||
with open(following_filename, 'w+', encoding='utf-8') as foll2:
|
with open(following_filename, 'w+', encoding='utf-8') as foll2:
|
||||||
for follow_handle in following_handles:
|
for follow_handle in following_handles:
|
||||||
if follow_handle.strip("\n").strip("\r").lower() != \
|
if follow_handle.strip("\n").strip("\r").lower() != \
|
||||||
handle_lower:
|
handle_lower:
|
||||||
foll2.write(follow_handle)
|
foll2.write(follow_handle)
|
||||||
|
else:
|
||||||
|
handle_nickname = handle.split('@')[0]
|
||||||
|
handle_domain = handle.split('@')[1]
|
||||||
|
unfollow_account(base_dir, nickname, domain,
|
||||||
|
handle_nickname,
|
||||||
|
handle_domain,
|
||||||
|
debug, group_account, 'following.txt')
|
||||||
|
ctr += 1
|
||||||
|
print('Unfollowed ' + handle + ' who has moved to ' +
|
||||||
|
moved_to_handle)
|
||||||
|
|
||||||
|
# save the new handles to the refollow list
|
||||||
|
if os.path.isfile(refollow_filename):
|
||||||
|
with open(refollow_filename, 'a+',
|
||||||
|
encoding='utf-8') as refoll:
|
||||||
|
refoll.write(moved_to_handle + '\n')
|
||||||
else:
|
else:
|
||||||
handle_nickname = handle.split('@')[0]
|
with open(refollow_filename, 'w+',
|
||||||
handle_domain = handle.split('@')[1]
|
encoding='utf-8') as refoll:
|
||||||
unfollow_account(base_dir, nickname, domain,
|
refoll.write(moved_to_handle + '\n')
|
||||||
handle_nickname,
|
|
||||||
handle_domain,
|
|
||||||
debug, group_account, 'following.txt')
|
|
||||||
ctr += 1
|
|
||||||
print('Unfollowed ' + handle + ' who has moved to ' +
|
|
||||||
moved_to_handle)
|
|
||||||
|
|
||||||
# save the new handles to the refollow list
|
|
||||||
if os.path.isfile(refollow_filename):
|
|
||||||
with open(refollow_filename, 'a+',
|
|
||||||
encoding='utf-8') as refoll:
|
|
||||||
refoll.write(moved_to_handle + '\n')
|
|
||||||
else:
|
|
||||||
with open(refollow_filename, 'w+',
|
|
||||||
encoding='utf-8') as refoll:
|
|
||||||
refoll.write(moved_to_handle + '\n')
|
|
||||||
|
|
||||||
followers_filename = \
|
followers_filename = \
|
||||||
acct_dir(base_dir, nickname, domain) + '/followers.txt'
|
acct_dir(base_dir, nickname, domain) + '/followers.txt'
|
||||||
|
|
Loading…
Reference in New Issue