mirror of https://gitlab.com/bashrc2/epicyon
Merge branch 'main' of ssh://code.freedombone.net:2222/bashrc/epicyon into main
commit
8256c67c5e
|
|
@ -406,7 +406,7 @@ python3 epicyon.py --speaker yournickname@yourdomain
|
|||
Or if you have [picospeaker](https://gitlab.com/ky1e/picospeaker) installed:
|
||||
|
||||
``` bash
|
||||
python3 epicyon.py --screenreader picospeaker --notify yournickname@yourdomain
|
||||
python3 epicyon.py --notifyShowNewPosts --screenreader picospeaker --notify yournickname@yourdomain
|
||||
```
|
||||
|
||||
You can also use the **--password** option to provide the password. This will then stay running and incoming posts will be announced as they arrive.
|
||||
|
|
|
|||
|
|
@ -300,6 +300,12 @@ parser.add_argument("--noKeyPress",
|
|||
type=str2bool, nargs='?',
|
||||
const=True, default=False,
|
||||
help="Notification daemon does not wait for keypresses")
|
||||
parser.add_argument("--notifyShowNewPosts",
|
||||
dest='notifyShowNewPosts',
|
||||
type=str2bool, nargs='?',
|
||||
const=True, default=False,
|
||||
help="Notification client shows/speaks new posts " +
|
||||
"as they arrive")
|
||||
parser.add_argument("--noapproval", type=str2bool, nargs='?',
|
||||
const=True, default=False,
|
||||
help="Allow followers without approval")
|
||||
|
|
@ -1870,6 +1876,7 @@ if args.notifications:
|
|||
args.notificationType,
|
||||
args.noKeyPress,
|
||||
storeInboxPosts,
|
||||
args.notifyShowNewPosts,
|
||||
args.debug)
|
||||
sys.exit()
|
||||
|
||||
|
|
|
|||
|
|
@ -277,8 +277,9 @@ def _notificationNewPost(session,
|
|||
|
||||
def _readLocalBoxPost(boxName: str, index: int,
|
||||
systemLanguage: str,
|
||||
screenreader: str, espeak) -> None:
|
||||
screenreader: str, espeak) -> {}:
|
||||
"""Reads a post from the given timeline
|
||||
Returns the speaker json
|
||||
"""
|
||||
homeDir = str(Path.home())
|
||||
if not os.path.isdir(homeDir + '/.config'):
|
||||
|
|
@ -300,7 +301,7 @@ def _readLocalBoxPost(boxName: str, index: int,
|
|||
if index <= 0:
|
||||
index = 0
|
||||
if len(indexList) <= index:
|
||||
return
|
||||
return None
|
||||
|
||||
publishedYear = indexList[index].split('-')[0]
|
||||
publishedMonth = indexList[index].split('-')[1]
|
||||
|
|
@ -343,6 +344,7 @@ def _readLocalBoxPost(boxName: str, index: int,
|
|||
_sayCommand(content, messageStr, screenreader,
|
||||
systemLanguage, espeak,
|
||||
nameStr, gender)
|
||||
return speakerJson
|
||||
|
||||
|
||||
def _showLocalBox(boxName: str,
|
||||
|
|
@ -596,6 +598,7 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
|
|||
notificationType: str,
|
||||
noKeyPress: bool,
|
||||
storeInboxPosts: bool,
|
||||
showNewPosts: bool,
|
||||
debug: bool) -> None:
|
||||
"""Runs the notifications and screen reader client,
|
||||
which announces new inbox items
|
||||
|
|
@ -630,6 +633,15 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
|
|||
sayStr = '/q or /quit to exit'
|
||||
_sayCommand(sayStr, sayStr, screenreader,
|
||||
systemLanguage, espeak)
|
||||
|
||||
currTimeline = ''
|
||||
currInboxIndex = 0
|
||||
if showNewPosts:
|
||||
currInboxIndex = 0
|
||||
_showLocalBox('inbox',
|
||||
screenreader, systemLanguage, espeak,
|
||||
currInboxIndex, 10)
|
||||
currTimeline = 'inbox'
|
||||
print('')
|
||||
keyPress = _waitForKeypress(2, debug)
|
||||
|
||||
|
|
@ -658,8 +670,6 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
|
|||
personCache = {}
|
||||
currDMIndex = 0
|
||||
currSentIndex = 0
|
||||
currInboxIndex = 0
|
||||
currTimeline = ''
|
||||
while (1):
|
||||
session = createSession(proxyType)
|
||||
speakerJson = \
|
||||
|
|
@ -765,6 +775,7 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
|
|||
else:
|
||||
content = '🔓 ' + messageStr
|
||||
|
||||
if showNewPosts:
|
||||
# say the speaker's name
|
||||
_sayCommand(nameStr, nameStr, screenreader,
|
||||
systemLanguage, espeak,
|
||||
|
|
@ -777,6 +788,7 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
|
|||
systemLanguage, espeak,
|
||||
nameStr, gender)
|
||||
|
||||
# store incoming post
|
||||
if encryptedMessage:
|
||||
speakerJson['content'] = content
|
||||
speakerJson['say'] = messageStr
|
||||
|
|
@ -869,8 +881,10 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
|
|||
postIndexStr = keyPress.split('read ')[1]
|
||||
if postIndexStr.isdigit():
|
||||
postIndex = int(postIndexStr)
|
||||
speakerJson = \
|
||||
_readLocalBoxPost(currTimeline, postIndex,
|
||||
systemLanguage, screenreader, espeak)
|
||||
systemLanguage, screenreader,
|
||||
espeak)
|
||||
print('')
|
||||
elif keyPress == 'reply' or keyPress == 'r':
|
||||
if speakerJson.get('id'):
|
||||
|
|
@ -930,8 +944,8 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
|
|||
espeak)
|
||||
print('')
|
||||
elif keyPress == 'like':
|
||||
if nameStr and gender and messageStr:
|
||||
sayStr = 'Liking post by ' + nameStr
|
||||
if speakerJson.get('id'):
|
||||
sayStr = 'Liking post by ' + speakerJson['name']
|
||||
_sayCommand(sayStr, sayStr,
|
||||
screenreader,
|
||||
systemLanguage, espeak)
|
||||
|
|
@ -944,8 +958,8 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
|
|||
False, __version__)
|
||||
print('')
|
||||
elif keyPress == 'unlike' or keyPress == 'undo like':
|
||||
if nameStr and gender and messageStr:
|
||||
sayStr = 'Undoing like of post by ' + nameStr
|
||||
if speakerJson.get('id'):
|
||||
sayStr = 'Undoing like of post by ' + speakerJson['name']
|
||||
_sayCommand(sayStr, sayStr,
|
||||
screenreader,
|
||||
systemLanguage, espeak)
|
||||
|
|
@ -961,9 +975,8 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
|
|||
keyPress == 'boost' or
|
||||
keyPress == 'retweet'):
|
||||
if speakerJson.get('id'):
|
||||
if nameStr and gender and messageStr:
|
||||
postId = speakerJson['id']
|
||||
sayStr = 'Announcing post by ' + nameStr
|
||||
sayStr = 'Announcing post by ' + speakerJson['name']
|
||||
_sayCommand(sayStr, sayStr,
|
||||
screenreader,
|
||||
systemLanguage, espeak)
|
||||
|
|
|
|||
Loading…
Reference in New Issue