mirror of https://gitlab.com/bashrc2/epicyon
Notification sounds
parent
88d4c8338d
commit
e492190721
34
daemon.py
34
daemon.py
|
@ -2719,7 +2719,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.YTReplacementDomain,
|
self.server.YTReplacementDomain,
|
||||||
self.server.showPublishedDateOnly,
|
self.server.showPublishedDateOnly,
|
||||||
self.server.peertubeInstances,
|
self.server.peertubeInstances,
|
||||||
self.server.allowLocalNetworkAccess)
|
self.server.allowLocalNetworkAccess,
|
||||||
|
self.server.themeName)
|
||||||
if hashtagStr:
|
if hashtagStr:
|
||||||
msg = hashtagStr.encode('utf-8')
|
msg = hashtagStr.encode('utf-8')
|
||||||
msglen = len(msg)
|
msglen = len(msg)
|
||||||
|
@ -2772,7 +2773,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.YTReplacementDomain,
|
self.server.YTReplacementDomain,
|
||||||
self.server.showPublishedDateOnly,
|
self.server.showPublishedDateOnly,
|
||||||
self.server.peertubeInstances,
|
self.server.peertubeInstances,
|
||||||
self.server.allowLocalNetworkAccess)
|
self.server.allowLocalNetworkAccess,
|
||||||
|
self.server.themeName)
|
||||||
if historyStr:
|
if historyStr:
|
||||||
msg = historyStr.encode('utf-8')
|
msg = historyStr.encode('utf-8')
|
||||||
msglen = len(msg)
|
msglen = len(msg)
|
||||||
|
@ -2862,7 +2864,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
showPublishedDateOnly,
|
showPublishedDateOnly,
|
||||||
self.server.defaultTimeline,
|
self.server.defaultTimeline,
|
||||||
self.server.peertubeInstances,
|
self.server.peertubeInstances,
|
||||||
allowLocalNetworkAccess)
|
allowLocalNetworkAccess,
|
||||||
|
self.server.themeName)
|
||||||
if profileStr:
|
if profileStr:
|
||||||
msg = profileStr.encode('utf-8')
|
msg = profileStr.encode('utf-8')
|
||||||
msglen = len(msg)
|
msglen = len(msg)
|
||||||
|
@ -5987,7 +5990,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.YTReplacementDomain,
|
self.server.YTReplacementDomain,
|
||||||
self.server.showPublishedDateOnly,
|
self.server.showPublishedDateOnly,
|
||||||
self.server.peertubeInstances,
|
self.server.peertubeInstances,
|
||||||
self.server.allowLocalNetworkAccess)
|
self.server.allowLocalNetworkAccess,
|
||||||
|
self.server.themeName)
|
||||||
if hashtagStr:
|
if hashtagStr:
|
||||||
msg = hashtagStr.encode('utf-8')
|
msg = hashtagStr.encode('utf-8')
|
||||||
msglen = len(msg)
|
msglen = len(msg)
|
||||||
|
@ -6950,7 +6954,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.YTReplacementDomain,
|
self.server.YTReplacementDomain,
|
||||||
self.server.showPublishedDateOnly,
|
self.server.showPublishedDateOnly,
|
||||||
self.server.peertubeInstances,
|
self.server.peertubeInstances,
|
||||||
self.server.allowLocalNetworkAccess)
|
self.server.allowLocalNetworkAccess,
|
||||||
|
self.server.themeName)
|
||||||
if deleteStr:
|
if deleteStr:
|
||||||
deleteStrLen = len(deleteStr)
|
deleteStrLen = len(deleteStr)
|
||||||
self._set_headers('text/html', deleteStrLen,
|
self._set_headers('text/html', deleteStrLen,
|
||||||
|
@ -7155,7 +7160,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
ytDomain,
|
ytDomain,
|
||||||
self.server.showPublishedDateOnly,
|
self.server.showPublishedDateOnly,
|
||||||
peertubeInstances,
|
peertubeInstances,
|
||||||
self.server.allowLocalNetworkAccess)
|
self.server.allowLocalNetworkAccess,
|
||||||
|
self.server.themeName)
|
||||||
msg = msg.encode('utf-8')
|
msg = msg.encode('utf-8')
|
||||||
msglen = len(msg)
|
msglen = len(msg)
|
||||||
self._set_headers('text/html', msglen,
|
self._set_headers('text/html', msglen,
|
||||||
|
@ -7242,7 +7248,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
ytDomain,
|
ytDomain,
|
||||||
self.server.showPublishedDateOnly,
|
self.server.showPublishedDateOnly,
|
||||||
peertubeInstances,
|
peertubeInstances,
|
||||||
self.server.allowLocalNetworkAccess)
|
self.server.allowLocalNetworkAccess,
|
||||||
|
self.server.themeName)
|
||||||
msg = msg.encode('utf-8')
|
msg = msg.encode('utf-8')
|
||||||
msglen = len(msg)
|
msglen = len(msg)
|
||||||
self._set_headers('text/html', msglen,
|
self._set_headers('text/html', msglen,
|
||||||
|
@ -7532,6 +7539,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
cssCache = self.server.cssCache
|
cssCache = self.server.cssCache
|
||||||
allowLocalNetworkAccess = \
|
allowLocalNetworkAccess = \
|
||||||
self.server.allowLocalNetworkAccess
|
self.server.allowLocalNetworkAccess
|
||||||
|
themeName = \
|
||||||
|
self.server.themeName
|
||||||
msg = \
|
msg = \
|
||||||
htmlIndividualPost(cssCache,
|
htmlIndividualPost(cssCache,
|
||||||
recentPostsCache,
|
recentPostsCache,
|
||||||
|
@ -7552,7 +7561,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
ytDomain,
|
ytDomain,
|
||||||
showPublishedDateOnly,
|
showPublishedDateOnly,
|
||||||
peertubeInstances,
|
peertubeInstances,
|
||||||
allowLocalNetworkAccess)
|
allowLocalNetworkAccess,
|
||||||
|
themeName)
|
||||||
msg = msg.encode('utf-8')
|
msg = msg.encode('utf-8')
|
||||||
msglen = len(msg)
|
msglen = len(msg)
|
||||||
self._set_headers('text/html', msglen,
|
self._set_headers('text/html', msglen,
|
||||||
|
@ -7656,6 +7666,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.peertubeInstances
|
self.server.peertubeInstances
|
||||||
allowLocalNetworkAccess = \
|
allowLocalNetworkAccess = \
|
||||||
self.server.allowLocalNetworkAccess
|
self.server.allowLocalNetworkAccess
|
||||||
|
themeName = \
|
||||||
|
self.server.themeName
|
||||||
msg = \
|
msg = \
|
||||||
htmlIndividualPost(self.server.cssCache,
|
htmlIndividualPost(self.server.cssCache,
|
||||||
recentPostsCache,
|
recentPostsCache,
|
||||||
|
@ -7676,7 +7688,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
ytDomain,
|
ytDomain,
|
||||||
showPublishedDateOnly,
|
showPublishedDateOnly,
|
||||||
peertubeInstances,
|
peertubeInstances,
|
||||||
allowLocalNetworkAccess)
|
allowLocalNetworkAccess,
|
||||||
|
themeName)
|
||||||
msg = msg.encode('utf-8')
|
msg = msg.encode('utf-8')
|
||||||
msglen = len(msg)
|
msglen = len(msg)
|
||||||
self._set_headers('text/html', msglen,
|
self._set_headers('text/html', msglen,
|
||||||
|
@ -14667,7 +14680,8 @@ def runDaemon(brochMode: bool,
|
||||||
httpd.maxFollowers,
|
httpd.maxFollowers,
|
||||||
httpd.allowLocalNetworkAccess,
|
httpd.allowLocalNetworkAccess,
|
||||||
httpd.peertubeInstances,
|
httpd.peertubeInstances,
|
||||||
verifyAllSignatures), daemon=True)
|
verifyAllSignatures,
|
||||||
|
httpd.themeName), daemon=True)
|
||||||
|
|
||||||
print('Creating scheduled post thread')
|
print('Creating scheduled post thread')
|
||||||
httpd.thrPostSchedule = \
|
httpd.thrPostSchedule = \
|
||||||
|
|
27
inbox.py
27
inbox.py
|
@ -158,7 +158,8 @@ def _inboxStorePostToHtmlCache(recentPostsCache: {}, maxRecentPosts: int,
|
||||||
allowDeletion: bool, boxname: str,
|
allowDeletion: bool, boxname: str,
|
||||||
showPublishedDateOnly: bool,
|
showPublishedDateOnly: bool,
|
||||||
peertubeInstances: [],
|
peertubeInstances: [],
|
||||||
allowLocalNetworkAccess: bool) -> None:
|
allowLocalNetworkAccess: bool,
|
||||||
|
themeName: str) -> None:
|
||||||
"""Converts the json post into html and stores it in a cache
|
"""Converts the json post into html and stores it in a cache
|
||||||
This enables the post to be quickly displayed later
|
This enables the post to be quickly displayed later
|
||||||
"""
|
"""
|
||||||
|
@ -176,6 +177,7 @@ def _inboxStorePostToHtmlCache(recentPostsCache: {}, maxRecentPosts: int,
|
||||||
httpPrefix, __version__, boxname, None,
|
httpPrefix, __version__, boxname, None,
|
||||||
showPublishedDateOnly,
|
showPublishedDateOnly,
|
||||||
peertubeInstances, allowLocalNetworkAccess,
|
peertubeInstances, allowLocalNetworkAccess,
|
||||||
|
themeName,
|
||||||
not isDM(postJsonObject),
|
not isDM(postJsonObject),
|
||||||
True, True, False, True)
|
True, True, False, True)
|
||||||
|
|
||||||
|
@ -1290,7 +1292,8 @@ def _receiveAnnounce(recentPostsCache: {},
|
||||||
personCache: {}, messageJson: {}, federationList: [],
|
personCache: {}, messageJson: {}, federationList: [],
|
||||||
debug: bool, translate: {},
|
debug: bool, translate: {},
|
||||||
YTReplacementDomain: str,
|
YTReplacementDomain: str,
|
||||||
allowLocalNetworkAccess: bool) -> bool:
|
allowLocalNetworkAccess: bool,
|
||||||
|
themeName: str) -> bool:
|
||||||
"""Receives an announce activity within the POST section of HTTPServer
|
"""Receives an announce activity within the POST section of HTTPServer
|
||||||
"""
|
"""
|
||||||
if messageJson['type'] != 'Announce':
|
if messageJson['type'] != 'Announce':
|
||||||
|
@ -1412,7 +1415,8 @@ def _receiveAnnounce(recentPostsCache: {},
|
||||||
updateSpeaker(baseDir, httpPrefix,
|
updateSpeaker(baseDir, httpPrefix,
|
||||||
nickname, domain, domainFull,
|
nickname, domain, domainFull,
|
||||||
postJsonObject, personCache,
|
postJsonObject, personCache,
|
||||||
translate, lookupActor)
|
translate, lookupActor,
|
||||||
|
themeName)
|
||||||
ttsFile = open(postFilename + '.tts', "w+")
|
ttsFile = open(postFilename + '.tts', "w+")
|
||||||
if ttsFile:
|
if ttsFile:
|
||||||
ttsFile.write('\n')
|
ttsFile.write('\n')
|
||||||
|
@ -2166,7 +2170,8 @@ def _inboxAfterInitial(recentPostsCache: {}, maxRecentPosts: int,
|
||||||
showPublishedDateOnly: bool,
|
showPublishedDateOnly: bool,
|
||||||
allowLocalNetworkAccess: bool,
|
allowLocalNetworkAccess: bool,
|
||||||
peertubeInstances: [],
|
peertubeInstances: [],
|
||||||
lastBounceMessage: []) -> bool:
|
lastBounceMessage: [],
|
||||||
|
themeName: str) -> bool:
|
||||||
""" Anything which needs to be done after initial checks have passed
|
""" Anything which needs to be done after initial checks have passed
|
||||||
"""
|
"""
|
||||||
actor = keyId
|
actor = keyId
|
||||||
|
@ -2245,7 +2250,8 @@ def _inboxAfterInitial(recentPostsCache: {}, maxRecentPosts: int,
|
||||||
federationList,
|
federationList,
|
||||||
debug, translate,
|
debug, translate,
|
||||||
YTReplacementDomain,
|
YTReplacementDomain,
|
||||||
allowLocalNetworkAccess):
|
allowLocalNetworkAccess,
|
||||||
|
themeName):
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: Announce accepted from ' + actor)
|
print('DEBUG: Announce accepted from ' + actor)
|
||||||
|
|
||||||
|
@ -2497,7 +2503,7 @@ def _inboxAfterInitial(recentPostsCache: {}, maxRecentPosts: int,
|
||||||
updateSpeaker(baseDir, httpPrefix,
|
updateSpeaker(baseDir, httpPrefix,
|
||||||
nickname, domain, domainFull,
|
nickname, domain, domainFull,
|
||||||
postJsonObject, personCache,
|
postJsonObject, personCache,
|
||||||
translate, None)
|
translate, None, themeName)
|
||||||
if not unitTest:
|
if not unitTest:
|
||||||
if debug:
|
if debug:
|
||||||
print('Saving inbox post as html to cache')
|
print('Saving inbox post as html to cache')
|
||||||
|
@ -2517,7 +2523,8 @@ def _inboxAfterInitial(recentPostsCache: {}, maxRecentPosts: int,
|
||||||
boxname,
|
boxname,
|
||||||
showPublishedDateOnly,
|
showPublishedDateOnly,
|
||||||
peertubeInstances,
|
peertubeInstances,
|
||||||
allowLocalNetworkAccess)
|
allowLocalNetworkAccess,
|
||||||
|
themeName)
|
||||||
if debug:
|
if debug:
|
||||||
timeDiff = \
|
timeDiff = \
|
||||||
str(int((time.time() - htmlCacheStartTime) *
|
str(int((time.time() - htmlCacheStartTime) *
|
||||||
|
@ -2618,7 +2625,8 @@ def runInboxQueue(recentPostsCache: {}, maxRecentPosts: int,
|
||||||
showPublishedDateOnly: bool,
|
showPublishedDateOnly: bool,
|
||||||
maxFollowers: int, allowLocalNetworkAccess: bool,
|
maxFollowers: int, allowLocalNetworkAccess: bool,
|
||||||
peertubeInstances: [],
|
peertubeInstances: [],
|
||||||
verifyAllSignatures: bool) -> None:
|
verifyAllSignatures: bool,
|
||||||
|
themeName: str) -> None:
|
||||||
"""Processes received items and moves them to the appropriate
|
"""Processes received items and moves them to the appropriate
|
||||||
directories
|
directories
|
||||||
"""
|
"""
|
||||||
|
@ -3111,7 +3119,8 @@ def runInboxQueue(recentPostsCache: {}, maxRecentPosts: int,
|
||||||
showPublishedDateOnly,
|
showPublishedDateOnly,
|
||||||
allowLocalNetworkAccess,
|
allowLocalNetworkAccess,
|
||||||
peertubeInstances,
|
peertubeInstances,
|
||||||
lastBounceMessage)
|
lastBounceMessage,
|
||||||
|
themeName)
|
||||||
if debug:
|
if debug:
|
||||||
pprint(queueJson['post'])
|
pprint(queueJson['post'])
|
||||||
|
|
||||||
|
|
|
@ -66,6 +66,17 @@ def _speakerPicospeaker(pitch: int, rate: int, systemLanguage: str,
|
||||||
os.system(speakerCmd)
|
os.system(speakerCmd)
|
||||||
|
|
||||||
|
|
||||||
|
def _playNotificationSound(soundFilename: str, player='ffplay') -> None:
|
||||||
|
"""Plays a sound
|
||||||
|
"""
|
||||||
|
if not os.path.isfile(soundFilename):
|
||||||
|
return
|
||||||
|
|
||||||
|
if player == 'ffplay':
|
||||||
|
os.system('ffplay ' + soundFilename +
|
||||||
|
' -autoexit -hide_banner -nodisp')
|
||||||
|
|
||||||
|
|
||||||
def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
|
def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
|
||||||
nickname: str, domain: str, port: int,
|
nickname: str, domain: str, port: int,
|
||||||
password: str, screenreader: str,
|
password: str, screenreader: str,
|
||||||
|
@ -73,6 +84,7 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
|
||||||
"""Runs the notifications and screen reader client,
|
"""Runs the notifications and screen reader client,
|
||||||
which announces new inbox items
|
which announces new inbox items
|
||||||
"""
|
"""
|
||||||
|
if screenreader:
|
||||||
if screenreader == 'espeak':
|
if screenreader == 'espeak':
|
||||||
print('Setting up espeak')
|
print('Setting up espeak')
|
||||||
from espeak import espeak
|
from espeak import espeak
|
||||||
|
@ -83,12 +95,65 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
|
||||||
print('Running ' + screenreader + ' for ' + nickname + '@' + domain)
|
print('Running ' + screenreader + ' for ' + nickname + '@' + domain)
|
||||||
|
|
||||||
prevSay = ''
|
prevSay = ''
|
||||||
|
prevDM = False
|
||||||
|
prevReply = False
|
||||||
|
prevCalendar = False
|
||||||
|
prevFollow = False
|
||||||
|
prevLike = ''
|
||||||
|
prevShare = False
|
||||||
|
dmSoundFilename = 'dm.ogg'
|
||||||
|
replySoundFilename = 'reply.ogg'
|
||||||
|
calendarSoundFilename = 'calendar.ogg'
|
||||||
|
followSoundFilename = 'follow.ogg'
|
||||||
|
likeSoundFilename = 'like.ogg'
|
||||||
|
shareSoundFilename = 'share.ogg'
|
||||||
|
player = 'ffplay'
|
||||||
while (1):
|
while (1):
|
||||||
session = createSession(proxyType)
|
session = createSession(proxyType)
|
||||||
speakerJson = \
|
speakerJson = \
|
||||||
getSpeakerFromServer(baseDir, session, nickname, password,
|
getSpeakerFromServer(baseDir, session, nickname, password,
|
||||||
domain, port, httpPrefix, True, __version__)
|
domain, port, httpPrefix, True, __version__)
|
||||||
if speakerJson:
|
if speakerJson:
|
||||||
|
if speakerJson.get('notify'):
|
||||||
|
soundsDir = 'theme/default/sounds'
|
||||||
|
if speakerJson['notify'].get('theme'):
|
||||||
|
soundsDir = \
|
||||||
|
'theme/' + speakerJson['notify']['theme'] + '/sounds'
|
||||||
|
if not os.path.isdir(soundsDir):
|
||||||
|
soundsDir = 'theme/default/sounds'
|
||||||
|
if dmSoundFilename:
|
||||||
|
if speakerJson['notify']['dm'] != prevDM:
|
||||||
|
_playNotificationSound(soundsDir + '/' +
|
||||||
|
dmSoundFilename, player)
|
||||||
|
elif replySoundFilename:
|
||||||
|
if speakerJson['notify']['reply'] != prevReply:
|
||||||
|
_playNotificationSound(soundsDir + '/' +
|
||||||
|
replySoundFilename, player)
|
||||||
|
elif calendarSoundFilename:
|
||||||
|
if speakerJson['notify']['calendar'] != prevCalendar:
|
||||||
|
_playNotificationSound(soundsDir + '/' +
|
||||||
|
calendarSoundFilename, player)
|
||||||
|
elif followSoundFilename:
|
||||||
|
if speakerJson['notify']['followRequests'] != prevFollow:
|
||||||
|
_playNotificationSound(soundsDir + '/' +
|
||||||
|
followSoundFilename, player)
|
||||||
|
elif likeSoundFilename:
|
||||||
|
if speakerJson['notify']['like'] != prevLike:
|
||||||
|
_playNotificationSound(soundsDir + '/' +
|
||||||
|
likeSoundFilename, player)
|
||||||
|
elif shareSoundFilename:
|
||||||
|
if speakerJson['notify']['share'] != prevShare:
|
||||||
|
_playNotificationSound(soundsDir + '/' +
|
||||||
|
shareSoundFilename, player)
|
||||||
|
|
||||||
|
prevDM = speakerJson['notify']['dm']
|
||||||
|
prevReply = speakerJson['notify']['reply']
|
||||||
|
prevCalendar = speakerJson['notify']['calendar']
|
||||||
|
prevFollow = speakerJson['notify']['followRequests']
|
||||||
|
prevLike = speakerJson['notify']['like']
|
||||||
|
prevShare = speakerJson['notify']['share']
|
||||||
|
|
||||||
|
if speakerJson.get('say'):
|
||||||
if speakerJson['say'] != prevSay:
|
if speakerJson['say'] != prevSay:
|
||||||
if speakerJson.get('name'):
|
if speakerJson.get('name'):
|
||||||
nameStr = speakerJson['name']
|
nameStr = speakerJson['name']
|
||||||
|
@ -103,7 +168,8 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
|
||||||
|
|
||||||
# say the speaker's name
|
# say the speaker's name
|
||||||
if screenreader == 'espeak':
|
if screenreader == 'espeak':
|
||||||
_speakerEspeak(espeak, pitch, rate, srange, nameStr)
|
_speakerEspeak(espeak, pitch, rate, srange,
|
||||||
|
nameStr)
|
||||||
elif screenreader == 'picospeaker':
|
elif screenreader == 'picospeaker':
|
||||||
_speakerPicospeaker(pitch, rate,
|
_speakerPicospeaker(pitch, rate,
|
||||||
systemLanguage, nameStr)
|
systemLanguage, nameStr)
|
||||||
|
@ -119,9 +185,11 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
|
||||||
sayStr = speakerJson['say'] + '. ' + \
|
sayStr = speakerJson['say'] + '. ' + \
|
||||||
speakerJson['imageDescription']
|
speakerJson['imageDescription']
|
||||||
# echo spoken text to the screen
|
# echo spoken text to the screen
|
||||||
|
imageDescription = \
|
||||||
|
html.unescape(speakerJson['imageDescription'])
|
||||||
print(html.unescape(nameStr) + ': ' +
|
print(html.unescape(nameStr) + ': ' +
|
||||||
html.unescape(speakerJson['say']) + '\n' +
|
html.unescape(speakerJson['say']) + '\n' +
|
||||||
html.unescape(speakerJson['imageDescription']))
|
imageDescription)
|
||||||
|
|
||||||
# speak the post content
|
# speak the post content
|
||||||
if screenreader == 'espeak':
|
if screenreader == 'espeak':
|
||||||
|
|
14
speaker.py
14
speaker.py
|
@ -269,7 +269,7 @@ def _speakerEndpointJson(displayName: str, summary: str,
|
||||||
postDM: bool, postReply: bool,
|
postDM: bool, postReply: bool,
|
||||||
followRequestsExist: bool,
|
followRequestsExist: bool,
|
||||||
likedBy: str, postCal: bool,
|
likedBy: str, postCal: bool,
|
||||||
postShare: bool) -> {}:
|
postShare: bool, themeName: str) -> {}:
|
||||||
"""Returns a json endpoint for the TTS speaker
|
"""Returns a json endpoint for the TTS speaker
|
||||||
"""
|
"""
|
||||||
speakerJson = {
|
speakerJson = {
|
||||||
|
@ -280,6 +280,7 @@ def _speakerEndpointJson(displayName: str, summary: str,
|
||||||
"detectedLinks": links,
|
"detectedLinks": links,
|
||||||
"id": postId,
|
"id": postId,
|
||||||
"notify": {
|
"notify": {
|
||||||
|
"theme": themeName,
|
||||||
"dm": postDM,
|
"dm": postDM,
|
||||||
"reply": postReply,
|
"reply": postReply,
|
||||||
"followRequests": followRequestsExist,
|
"followRequests": followRequestsExist,
|
||||||
|
@ -377,7 +378,8 @@ def getSSMLbox(baseDir: str, path: str,
|
||||||
def _postToSpeakerJson(baseDir: str, httpPrefix: str,
|
def _postToSpeakerJson(baseDir: str, httpPrefix: str,
|
||||||
nickname: str, domain: str, domainFull: str,
|
nickname: str, domain: str, domainFull: str,
|
||||||
postJsonObject: {}, personCache: {},
|
postJsonObject: {}, personCache: {},
|
||||||
translate: {}, announcingActor: str) -> {}:
|
translate: {}, announcingActor: str,
|
||||||
|
themeName: str) -> {}:
|
||||||
"""Converts an ActivityPub post into some Json containing
|
"""Converts an ActivityPub post into some Json containing
|
||||||
speech synthesis parameters.
|
speech synthesis parameters.
|
||||||
NOTE: There currently appears to be no standardized json
|
NOTE: There currently appears to be no standardized json
|
||||||
|
@ -475,13 +477,14 @@ def _postToSpeakerJson(baseDir: str, httpPrefix: str,
|
||||||
postDM, postReply,
|
postDM, postReply,
|
||||||
followRequestsExist,
|
followRequestsExist,
|
||||||
likedBy,
|
likedBy,
|
||||||
postCal, postShare)
|
postCal, postShare, themeName)
|
||||||
|
|
||||||
|
|
||||||
def updateSpeaker(baseDir: str, httpPrefix: str,
|
def updateSpeaker(baseDir: str, httpPrefix: str,
|
||||||
nickname: str, domain: str, domainFull: str,
|
nickname: str, domain: str, domainFull: str,
|
||||||
postJsonObject: {}, personCache: {},
|
postJsonObject: {}, personCache: {},
|
||||||
translate: {}, announcingActor: str) -> None:
|
translate: {}, announcingActor: str,
|
||||||
|
themeName: str) -> None:
|
||||||
""" Generates a json file which can be used for TTS announcement
|
""" Generates a json file which can be used for TTS announcement
|
||||||
of incoming inbox posts
|
of incoming inbox posts
|
||||||
"""
|
"""
|
||||||
|
@ -489,7 +492,8 @@ def updateSpeaker(baseDir: str, httpPrefix: str,
|
||||||
_postToSpeakerJson(baseDir, httpPrefix,
|
_postToSpeakerJson(baseDir, httpPrefix,
|
||||||
nickname, domain, domainFull,
|
nickname, domain, domainFull,
|
||||||
postJsonObject, personCache,
|
postJsonObject, personCache,
|
||||||
translate, announcingActor)
|
translate, announcingActor,
|
||||||
|
themeName)
|
||||||
speakerFilename = \
|
speakerFilename = \
|
||||||
baseDir + '/accounts/' + nickname + '@' + domain + '/speaker.json'
|
baseDir + '/accounts/' + nickname + '@' + domain + '/speaker.json'
|
||||||
saveJson(speakerJson, speakerFilename)
|
saveJson(speakerJson, speakerFilename)
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -31,7 +31,8 @@ def htmlConfirmDelete(cssCache: {},
|
||||||
YTReplacementDomain: str,
|
YTReplacementDomain: str,
|
||||||
showPublishedDateOnly: bool,
|
showPublishedDateOnly: bool,
|
||||||
peertubeInstances: [],
|
peertubeInstances: [],
|
||||||
allowLocalNetworkAccess: bool) -> str:
|
allowLocalNetworkAccess: bool,
|
||||||
|
themeName: str) -> str:
|
||||||
"""Shows a screen asking to confirm the deletion of a post
|
"""Shows a screen asking to confirm the deletion of a post
|
||||||
"""
|
"""
|
||||||
if '/statuses/' not in messageId:
|
if '/statuses/' not in messageId:
|
||||||
|
@ -72,6 +73,7 @@ def htmlConfirmDelete(cssCache: {},
|
||||||
YTReplacementDomain,
|
YTReplacementDomain,
|
||||||
showPublishedDateOnly,
|
showPublishedDateOnly,
|
||||||
peertubeInstances, allowLocalNetworkAccess,
|
peertubeInstances, allowLocalNetworkAccess,
|
||||||
|
themeName,
|
||||||
False, False, False, False, False)
|
False, False, False, False, False)
|
||||||
deletePostStr += '<center>'
|
deletePostStr += '<center>'
|
||||||
deletePostStr += \
|
deletePostStr += \
|
||||||
|
|
|
@ -30,7 +30,8 @@ def _htmlFrontScreenPosts(recentPostsCache: {}, maxRecentPosts: int,
|
||||||
YTReplacementDomain: str,
|
YTReplacementDomain: str,
|
||||||
showPublishedDateOnly: bool,
|
showPublishedDateOnly: bool,
|
||||||
peertubeInstances: [],
|
peertubeInstances: [],
|
||||||
allowLocalNetworkAccess: bool) -> str:
|
allowLocalNetworkAccess: bool,
|
||||||
|
themeName: str) -> str:
|
||||||
"""Shows posts on the front screen of a news instance
|
"""Shows posts on the front screen of a news instance
|
||||||
These should only be public blog posts from the features timeline
|
These should only be public blog posts from the features timeline
|
||||||
which is the blog timeline of the news actor
|
which is the blog timeline of the news actor
|
||||||
|
@ -71,6 +72,7 @@ def _htmlFrontScreenPosts(recentPostsCache: {}, maxRecentPosts: int,
|
||||||
showPublishedDateOnly,
|
showPublishedDateOnly,
|
||||||
peertubeInstances,
|
peertubeInstances,
|
||||||
allowLocalNetworkAccess,
|
allowLocalNetworkAccess,
|
||||||
|
themeName,
|
||||||
False, False, False, True, False)
|
False, False, False, True, False)
|
||||||
if postStr:
|
if postStr:
|
||||||
profileStr += postStr + separatorStr
|
profileStr += postStr + separatorStr
|
||||||
|
@ -159,7 +161,8 @@ def htmlFrontScreen(rssIconAtTop: bool,
|
||||||
YTReplacementDomain,
|
YTReplacementDomain,
|
||||||
showPublishedDateOnly,
|
showPublishedDateOnly,
|
||||||
peertubeInstances,
|
peertubeInstances,
|
||||||
allowLocalNetworkAccess) + licenseStr
|
allowLocalNetworkAccess,
|
||||||
|
theme) + licenseStr
|
||||||
|
|
||||||
# Footer which is only used for system accounts
|
# Footer which is only used for system accounts
|
||||||
profileFooterStr = ' </td>\n'
|
profileFooterStr = ' </td>\n'
|
||||||
|
|
|
@ -1139,6 +1139,7 @@ def individualPostAsHtml(allowDownloads: bool,
|
||||||
showPublishedDateOnly: bool,
|
showPublishedDateOnly: bool,
|
||||||
peertubeInstances: [],
|
peertubeInstances: [],
|
||||||
allowLocalNetworkAccess: bool,
|
allowLocalNetworkAccess: bool,
|
||||||
|
themeName: str,
|
||||||
showRepeats=True,
|
showRepeats=True,
|
||||||
showIcons=False,
|
showIcons=False,
|
||||||
manuallyApprovesFollowers=False,
|
manuallyApprovesFollowers=False,
|
||||||
|
@ -1307,7 +1308,8 @@ def individualPostAsHtml(allowDownloads: bool,
|
||||||
updateSpeaker(baseDir, httpPrefix,
|
updateSpeaker(baseDir, httpPrefix,
|
||||||
nickname, domain, domainFull,
|
nickname, domain, domainFull,
|
||||||
postJsonObject, personCache,
|
postJsonObject, personCache,
|
||||||
translate, postJsonObject['actor'])
|
translate, postJsonObject['actor'],
|
||||||
|
themeName)
|
||||||
ttsFile = open(announceFilename + '.tts', "w+")
|
ttsFile = open(announceFilename + '.tts', "w+")
|
||||||
if ttsFile:
|
if ttsFile:
|
||||||
ttsFile.write('\n')
|
ttsFile.write('\n')
|
||||||
|
@ -1684,7 +1686,8 @@ def htmlIndividualPost(cssCache: {},
|
||||||
YTReplacementDomain: str,
|
YTReplacementDomain: str,
|
||||||
showPublishedDateOnly: bool,
|
showPublishedDateOnly: bool,
|
||||||
peertubeInstances: [],
|
peertubeInstances: [],
|
||||||
allowLocalNetworkAccess: bool) -> str:
|
allowLocalNetworkAccess: bool,
|
||||||
|
themeName: str) -> str:
|
||||||
"""Show an individual post as html
|
"""Show an individual post as html
|
||||||
"""
|
"""
|
||||||
postStr = ''
|
postStr = ''
|
||||||
|
@ -1725,7 +1728,7 @@ def htmlIndividualPost(cssCache: {},
|
||||||
YTReplacementDomain,
|
YTReplacementDomain,
|
||||||
showPublishedDateOnly,
|
showPublishedDateOnly,
|
||||||
peertubeInstances,
|
peertubeInstances,
|
||||||
allowLocalNetworkAccess,
|
allowLocalNetworkAccess, themeName,
|
||||||
False, authorized, False, False, False)
|
False, authorized, False, False, False)
|
||||||
messageId = removeIdEnding(postJsonObject['id'])
|
messageId = removeIdEnding(postJsonObject['id'])
|
||||||
|
|
||||||
|
@ -1753,6 +1756,7 @@ def htmlIndividualPost(cssCache: {},
|
||||||
showPublishedDateOnly,
|
showPublishedDateOnly,
|
||||||
peertubeInstances,
|
peertubeInstances,
|
||||||
allowLocalNetworkAccess,
|
allowLocalNetworkAccess,
|
||||||
|
themeName,
|
||||||
False, authorized,
|
False, authorized,
|
||||||
False, False, False) + postStr
|
False, False, False) + postStr
|
||||||
|
|
||||||
|
@ -1783,6 +1787,7 @@ def htmlIndividualPost(cssCache: {},
|
||||||
showPublishedDateOnly,
|
showPublishedDateOnly,
|
||||||
peertubeInstances,
|
peertubeInstances,
|
||||||
allowLocalNetworkAccess,
|
allowLocalNetworkAccess,
|
||||||
|
themeName,
|
||||||
False, authorized,
|
False, authorized,
|
||||||
False, False, False)
|
False, False, False)
|
||||||
cssFilename = baseDir + '/epicyon-profile.css'
|
cssFilename = baseDir + '/epicyon-profile.css'
|
||||||
|
@ -1804,7 +1809,8 @@ def htmlPostReplies(cssCache: {},
|
||||||
YTReplacementDomain: str,
|
YTReplacementDomain: str,
|
||||||
showPublishedDateOnly: bool,
|
showPublishedDateOnly: bool,
|
||||||
peertubeInstances: [],
|
peertubeInstances: [],
|
||||||
allowLocalNetworkAccess: bool) -> str:
|
allowLocalNetworkAccess: bool,
|
||||||
|
themeName: str) -> str:
|
||||||
"""Show the replies to an individual post as html
|
"""Show the replies to an individual post as html
|
||||||
"""
|
"""
|
||||||
repliesStr = ''
|
repliesStr = ''
|
||||||
|
@ -1823,6 +1829,7 @@ def htmlPostReplies(cssCache: {},
|
||||||
showPublishedDateOnly,
|
showPublishedDateOnly,
|
||||||
peertubeInstances,
|
peertubeInstances,
|
||||||
allowLocalNetworkAccess,
|
allowLocalNetworkAccess,
|
||||||
|
themeName,
|
||||||
False, False, False, False, False)
|
False, False, False, False, False)
|
||||||
|
|
||||||
cssFilename = baseDir + '/epicyon-profile.css'
|
cssFilename = baseDir + '/epicyon-profile.css'
|
||||||
|
|
|
@ -66,7 +66,8 @@ def htmlProfileAfterSearch(cssCache: {},
|
||||||
showPublishedDateOnly: bool,
|
showPublishedDateOnly: bool,
|
||||||
defaultTimeline: str,
|
defaultTimeline: str,
|
||||||
peertubeInstances: [],
|
peertubeInstances: [],
|
||||||
allowLocalNetworkAccess: bool) -> str:
|
allowLocalNetworkAccess: bool,
|
||||||
|
themeName: str) -> str:
|
||||||
"""Show a profile page after a search for a fediverse address
|
"""Show a profile page after a search for a fediverse address
|
||||||
"""
|
"""
|
||||||
if hasUsersPath(profileHandle) or '/@' in profileHandle:
|
if hasUsersPath(profileHandle) or '/@' in profileHandle:
|
||||||
|
@ -300,6 +301,7 @@ def htmlProfileAfterSearch(cssCache: {},
|
||||||
YTReplacementDomain,
|
YTReplacementDomain,
|
||||||
showPublishedDateOnly,
|
showPublishedDateOnly,
|
||||||
peertubeInstances, allowLocalNetworkAccess,
|
peertubeInstances, allowLocalNetworkAccess,
|
||||||
|
themeName,
|
||||||
False, False, False, False, False)
|
False, False, False, False, False)
|
||||||
i += 1
|
i += 1
|
||||||
if i >= 20:
|
if i >= 20:
|
||||||
|
@ -804,7 +806,8 @@ def htmlProfile(rssIconAtTop: bool,
|
||||||
YTReplacementDomain,
|
YTReplacementDomain,
|
||||||
showPublishedDateOnly,
|
showPublishedDateOnly,
|
||||||
peertubeInstances,
|
peertubeInstances,
|
||||||
allowLocalNetworkAccess) + licenseStr
|
allowLocalNetworkAccess,
|
||||||
|
theme) + licenseStr
|
||||||
elif selected == 'following':
|
elif selected == 'following':
|
||||||
profileStr += \
|
profileStr += \
|
||||||
_htmlProfileFollowing(translate, baseDir, httpPrefix,
|
_htmlProfileFollowing(translate, baseDir, httpPrefix,
|
||||||
|
@ -856,7 +859,8 @@ def _htmlProfilePosts(recentPostsCache: {}, maxRecentPosts: int,
|
||||||
YTReplacementDomain: str,
|
YTReplacementDomain: str,
|
||||||
showPublishedDateOnly: bool,
|
showPublishedDateOnly: bool,
|
||||||
peertubeInstances: [],
|
peertubeInstances: [],
|
||||||
allowLocalNetworkAccess: bool) -> str:
|
allowLocalNetworkAccess: bool,
|
||||||
|
themeName: str) -> str:
|
||||||
"""Shows posts on the profile screen
|
"""Shows posts on the profile screen
|
||||||
These should only be public posts
|
These should only be public posts
|
||||||
"""
|
"""
|
||||||
|
@ -896,6 +900,7 @@ def _htmlProfilePosts(recentPostsCache: {}, maxRecentPosts: int,
|
||||||
showPublishedDateOnly,
|
showPublishedDateOnly,
|
||||||
peertubeInstances,
|
peertubeInstances,
|
||||||
allowLocalNetworkAccess,
|
allowLocalNetworkAccess,
|
||||||
|
themeName,
|
||||||
False, False, False, True, False)
|
False, False, False, True, False)
|
||||||
if postStr:
|
if postStr:
|
||||||
profileStr += postStr + separatorStr
|
profileStr += postStr + separatorStr
|
||||||
|
|
|
@ -527,7 +527,8 @@ def htmlHistorySearch(cssCache: {}, translate: {}, baseDir: str,
|
||||||
YTReplacementDomain: str,
|
YTReplacementDomain: str,
|
||||||
showPublishedDateOnly: bool,
|
showPublishedDateOnly: bool,
|
||||||
peertubeInstances: [],
|
peertubeInstances: [],
|
||||||
allowLocalNetworkAccess: bool) -> str:
|
allowLocalNetworkAccess: bool,
|
||||||
|
themeName: str) -> str:
|
||||||
"""Show a page containing search results for your post history
|
"""Show a page containing search results for your post history
|
||||||
"""
|
"""
|
||||||
if historysearch.startswith('!'):
|
if historysearch.startswith('!'):
|
||||||
|
@ -604,6 +605,7 @@ def htmlHistorySearch(cssCache: {}, translate: {}, baseDir: str,
|
||||||
showPublishedDateOnly,
|
showPublishedDateOnly,
|
||||||
peertubeInstances,
|
peertubeInstances,
|
||||||
allowLocalNetworkAccess,
|
allowLocalNetworkAccess,
|
||||||
|
themeName,
|
||||||
showIndividualPostIcons,
|
showIndividualPostIcons,
|
||||||
showIndividualPostIcons,
|
showIndividualPostIcons,
|
||||||
False, False, False)
|
False, False, False)
|
||||||
|
@ -626,7 +628,8 @@ def htmlHashtagSearch(cssCache: {},
|
||||||
YTReplacementDomain: str,
|
YTReplacementDomain: str,
|
||||||
showPublishedDateOnly: bool,
|
showPublishedDateOnly: bool,
|
||||||
peertubeInstances: [],
|
peertubeInstances: [],
|
||||||
allowLocalNetworkAccess: bool) -> str:
|
allowLocalNetworkAccess: bool,
|
||||||
|
themeName: str) -> str:
|
||||||
"""Show a page containing search results for a hashtag
|
"""Show a page containing search results for a hashtag
|
||||||
"""
|
"""
|
||||||
if hashtag.startswith('#'):
|
if hashtag.startswith('#'):
|
||||||
|
@ -778,6 +781,7 @@ def htmlHashtagSearch(cssCache: {},
|
||||||
allowLocalNetworkAccess,
|
allowLocalNetworkAccess,
|
||||||
showRepeats, showIcons,
|
showRepeats, showIcons,
|
||||||
manuallyApprovesFollowers,
|
manuallyApprovesFollowers,
|
||||||
|
themeName,
|
||||||
showPublicOnly,
|
showPublicOnly,
|
||||||
storeToCache)
|
storeToCache)
|
||||||
if postStr:
|
if postStr:
|
||||||
|
|
|
@ -723,6 +723,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
|
||||||
boxName != 'dm',
|
boxName != 'dm',
|
||||||
showIndividualPostIcons,
|
showIndividualPostIcons,
|
||||||
manuallyApproveFollowers,
|
manuallyApproveFollowers,
|
||||||
|
theme,
|
||||||
False, True)
|
False, True)
|
||||||
_logTimelineTiming(enableTimingLog,
|
_logTimelineTiming(enableTimingLog,
|
||||||
timelineStartTime, boxName, '12')
|
timelineStartTime, boxName, '12')
|
||||||
|
|
Loading…
Reference in New Issue