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