mirror of https://gitlab.com/bashrc2/epicyon
				
				
				
			Return lists
							parent
							
								
									351cb6ad14
								
							
						
					
					
						commit
						b1672fb9d5
					
				| 
						 | 
				
			
			@ -8,7 +8,7 @@ __status__ = "Production"
 | 
			
		|||
 | 
			
		||||
from pprint import pprint
 | 
			
		||||
import os
 | 
			
		||||
from utils import getFollowersOfPerson
 | 
			
		||||
from utils import getFollowersList
 | 
			
		||||
from utils import validNickname
 | 
			
		||||
from utils import domainPermitted
 | 
			
		||||
from utils import getDomainFromActor
 | 
			
		||||
| 
						 | 
				
			
			@ -118,9 +118,9 @@ def getMutualsOfPerson(baseDir: str,
 | 
			
		|||
    i.e. accounts which they follow and which also follow back
 | 
			
		||||
    """
 | 
			
		||||
    followers = \
 | 
			
		||||
        getFollowersOfPerson(baseDir, nickname, domain, 'followers.txt')
 | 
			
		||||
        getFollowersList(baseDir, nickname, domain, 'followers.txt')
 | 
			
		||||
    following = \
 | 
			
		||||
        getFollowersOfPerson(baseDir, nickname, domain, 'following.txt')
 | 
			
		||||
        getFollowersList(baseDir, nickname, domain, 'following.txt')
 | 
			
		||||
    mutuals = []
 | 
			
		||||
    for handle in following:
 | 
			
		||||
        if handle in followers:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										6
									
								
								posts.py
								
								
								
								
							
							
						
						
									
										6
									
								
								posts.py
								
								
								
								
							| 
						 | 
				
			
			@ -30,7 +30,7 @@ from session import postJsonString
 | 
			
		|||
from session import postImage
 | 
			
		||||
from webfinger import webfingerHandle
 | 
			
		||||
from httpsig import createSignedHeader
 | 
			
		||||
from utils import getFollowersOfPerson
 | 
			
		||||
from utils import getFollowersList
 | 
			
		||||
from utils import isEvil
 | 
			
		||||
from utils import removeIdEnding
 | 
			
		||||
from utils import siteIsActive
 | 
			
		||||
| 
						 | 
				
			
			@ -3338,9 +3338,9 @@ def getNonMutualsOfPerson(baseDir: str,
 | 
			
		|||
    i.e. accounts which follow you but you don't follow them
 | 
			
		||||
    """
 | 
			
		||||
    followers = \
 | 
			
		||||
        getFollowersOfPerson(baseDir, nickname, domain, 'followers.txt')
 | 
			
		||||
        getFollowersList(baseDir, nickname, domain, 'followers.txt')
 | 
			
		||||
    following = \
 | 
			
		||||
        getFollowersOfPerson(baseDir, nickname, domain, 'following.txt')
 | 
			
		||||
        getFollowersList(baseDir, nickname, domain, 'following.txt')
 | 
			
		||||
    nonMutuals = []
 | 
			
		||||
    for handle in following:
 | 
			
		||||
        if handle not in followers:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										19
									
								
								utils.py
								
								
								
								
							
							
						
						
									
										19
									
								
								utils.py
								
								
								
								
							| 
						 | 
				
			
			@ -19,6 +19,25 @@ from calendar import monthrange
 | 
			
		|||
from followingCalendar import addPersonToCalendar
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def getFollowersList(baseDir: str,
 | 
			
		||||
                     nickname: str, domain: str,
 | 
			
		||||
                     followFile='following.txt') -> []:
 | 
			
		||||
    """Returns a list of followers for the given account
 | 
			
		||||
    """
 | 
			
		||||
    filename = \
 | 
			
		||||
        baseDir + '/accounts/' + nickname + '@' + domain + '/' + followFile
 | 
			
		||||
 | 
			
		||||
    if not os.path.isfile(filename):
 | 
			
		||||
        return []
 | 
			
		||||
 | 
			
		||||
    with open(filename, "r") as f:
 | 
			
		||||
        lines = f.readlines()
 | 
			
		||||
        for i in range(len(lines)):
 | 
			
		||||
            lines[i] = lines[i].strip()
 | 
			
		||||
        return lines
 | 
			
		||||
    return []
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def getFollowersOfPerson(baseDir: str,
 | 
			
		||||
                         nickname: str, domain: str,
 | 
			
		||||
                         followFile='following.txt') -> []:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue