mirror of https://gitlab.com/bashrc2/epicyon
Improve handling of the first follow
parent
c47a046c95
commit
b54c9e52f7
16
utils.py
16
utils.py
|
@ -356,7 +356,6 @@ def followPerson(baseDir: str, nickname: str, domain: str,
|
||||||
|
|
||||||
if not os.path.isdir(baseDir + '/accounts'):
|
if not os.path.isdir(baseDir + '/accounts'):
|
||||||
os.mkdir(baseDir + '/accounts')
|
os.mkdir(baseDir + '/accounts')
|
||||||
followAdded = False
|
|
||||||
handleToFollow = followNickname + '@' + followDomain
|
handleToFollow = followNickname + '@' + followDomain
|
||||||
filename = baseDir + '/accounts/' + handle + '/' + followFile
|
filename = baseDir + '/accounts/' + handle + '/' + followFile
|
||||||
if os.path.isfile(filename):
|
if os.path.isfile(filename):
|
||||||
|
@ -372,12 +371,17 @@ def followPerson(baseDir: str, nickname: str, domain: str,
|
||||||
followFile.write(handleToFollow + '\n' + content)
|
followFile.write(handleToFollow + '\n' + content)
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: follow added')
|
print('DEBUG: follow added')
|
||||||
followAdded = True
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print('WARN: Failed to write entry to follow file ' +
|
print('WARN: Failed to write entry to follow file ' +
|
||||||
filename + ' ' + str(e))
|
filename + ' ' + str(e))
|
||||||
|
else:
|
||||||
|
# first follow
|
||||||
|
if debug:
|
||||||
|
print('DEBUG: creating new following file to follow ' +
|
||||||
|
handleToFollow)
|
||||||
|
with open(filename, 'w+') as followfile:
|
||||||
|
followfile.write(handleToFollow + '\n')
|
||||||
|
|
||||||
if followAdded:
|
|
||||||
# Default to adding new follows to the calendar.
|
# Default to adding new follows to the calendar.
|
||||||
# Possibly this could be made optional
|
# Possibly this could be made optional
|
||||||
if followFile == 'following.txt':
|
if followFile == 'following.txt':
|
||||||
|
@ -387,12 +391,6 @@ def followPerson(baseDir: str, nickname: str, domain: str,
|
||||||
followNickname, followDomain)
|
followNickname, followDomain)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
if debug:
|
|
||||||
print('DEBUG: creating new following file to follow ' + handleToFollow)
|
|
||||||
with open(filename, 'w+') as followfile:
|
|
||||||
followfile.write(handleToFollow + '\n')
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
def locatePost(baseDir: str, nickname: str, domain: str,
|
def locatePost(baseDir: str, nickname: str, domain: str,
|
||||||
postUrl: str, replies=False) -> str:
|
postUrl: str, replies=False) -> str:
|
||||||
|
|
Loading…
Reference in New Issue