mirror of https://gitlab.com/bashrc2/epicyon
Don't notify about new shared items from accounts which you have blocked
parent
23e62dbeb4
commit
42762ef6bd
14
shares.py
14
shares.py
|
@ -40,6 +40,7 @@ from media import processMetaData
|
||||||
from filters import isFilteredGlobally
|
from filters import isFilteredGlobally
|
||||||
from siteactive import siteIsActive
|
from siteactive import siteIsActive
|
||||||
from content import getPriceFromString
|
from content import getPriceFromString
|
||||||
|
from blocking import isBlocked
|
||||||
|
|
||||||
|
|
||||||
def _loadDfcIds(baseDir: str, systemLanguage: str,
|
def _loadDfcIds(baseDir: str, systemLanguage: str,
|
||||||
|
@ -245,6 +246,7 @@ def _getshareTypeFromDfcId(dfcUri: str, dfcIds: {}) -> str:
|
||||||
|
|
||||||
|
|
||||||
def _indicateNewShareAvailable(baseDir: str, httpPrefix: str,
|
def _indicateNewShareAvailable(baseDir: str, httpPrefix: str,
|
||||||
|
nickname: str, domain: str,
|
||||||
domainFull: str) -> None:
|
domainFull: str) -> None:
|
||||||
"""Indicate to each account that a new share is available
|
"""Indicate to each account that a new share is available
|
||||||
"""
|
"""
|
||||||
|
@ -256,11 +258,16 @@ def _indicateNewShareAvailable(baseDir: str, httpPrefix: str,
|
||||||
newShareFile = accountDir + '/.newShare'
|
newShareFile = accountDir + '/.newShare'
|
||||||
if os.path.isfile(newShareFile):
|
if os.path.isfile(newShareFile):
|
||||||
continue
|
continue
|
||||||
nickname = handle.split('@')[0]
|
accountNickname = handle.split('@')[0]
|
||||||
|
# does this account block you?
|
||||||
|
if accountNickname != nickname:
|
||||||
|
if isBlocked(baseDir, accountNickname, domain,
|
||||||
|
nickname, domain, None):
|
||||||
|
continue
|
||||||
try:
|
try:
|
||||||
with open(newShareFile, 'w+') as fp:
|
with open(newShareFile, 'w+') as fp:
|
||||||
fp.write(httpPrefix + '://' + domainFull +
|
fp.write(httpPrefix + '://' + domainFull +
|
||||||
'/users/' + nickname + '/tlshares')
|
'/users/' + accountNickname + '/tlshares')
|
||||||
except BaseException:
|
except BaseException:
|
||||||
pass
|
pass
|
||||||
break
|
break
|
||||||
|
@ -347,7 +354,8 @@ def addShare(baseDir: str,
|
||||||
|
|
||||||
saveJson(sharesJson, sharesFilename)
|
saveJson(sharesJson, sharesFilename)
|
||||||
|
|
||||||
_indicateNewShareAvailable(baseDir, httpPrefix, domainFull)
|
_indicateNewShareAvailable(baseDir, httpPrefix,
|
||||||
|
nickname, domain, domainFull)
|
||||||
|
|
||||||
|
|
||||||
def expireShares(baseDir: str) -> None:
|
def expireShares(baseDir: str) -> None:
|
||||||
|
|
Loading…
Reference in New Issue