mirror of https://gitlab.com/bashrc2/epicyon
Use subdirectories for storing posts from notification client
parent
59b21129f2
commit
45fa303a4c
|
@ -294,7 +294,6 @@ def _readLocalBoxPost(boxName: str, index: int,
|
||||||
if not f.endswith('.json'):
|
if not f.endswith('.json'):
|
||||||
continue
|
continue
|
||||||
indexList.append(f)
|
indexList.append(f)
|
||||||
break
|
|
||||||
indexList.sort(reverse=True)
|
indexList.sort(reverse=True)
|
||||||
|
|
||||||
index -= 1
|
index -= 1
|
||||||
|
@ -359,7 +358,6 @@ def _showLocalBox(boxName: str,
|
||||||
if not f.endswith('.json'):
|
if not f.endswith('.json'):
|
||||||
continue
|
continue
|
||||||
index.append(f)
|
index.append(f)
|
||||||
break
|
|
||||||
if not index:
|
if not index:
|
||||||
sayStr = 'You have no ' + boxName + ' posts yet.'
|
sayStr = 'You have no ' + boxName + ' posts yet.'
|
||||||
_sayCommand(sayStr, sayStr, screenreader, systemLanguage, espeak)
|
_sayCommand(sayStr, sayStr, screenreader, systemLanguage, espeak)
|
||||||
|
@ -434,6 +432,32 @@ def _notificationNewDM(session, toHandle: str,
|
||||||
espeak)
|
espeak)
|
||||||
|
|
||||||
|
|
||||||
|
def _storeMessage(speakerJson: {}, boxName: str) -> None:
|
||||||
|
"""Stores a message in your home directory for later reading
|
||||||
|
"""
|
||||||
|
if not speakerJson.get('published'):
|
||||||
|
return
|
||||||
|
homeDir = str(Path.home())
|
||||||
|
if not os.path.isdir(homeDir + '/.config'):
|
||||||
|
os.mkdir(homeDir + '/.config')
|
||||||
|
if not os.path.isdir(homeDir + '/.config/epicyon'):
|
||||||
|
os.mkdir(homeDir + '/.config/epicyon')
|
||||||
|
msgDir = homeDir + '/.config/epicyon/' + boxName
|
||||||
|
if not os.path.isdir(msgDir):
|
||||||
|
os.mkdir(msgDir)
|
||||||
|
publishedYear = speakerJson['published'].split('-')[0]
|
||||||
|
yearDir = msgDir + '/' + publishedYear
|
||||||
|
if not os.path.isdir(yearDir):
|
||||||
|
os.mkdir(yearDir)
|
||||||
|
publishedMonth = speakerJson['published'].split('-')[1]
|
||||||
|
monthDir = yearDir + '/' + publishedMonth
|
||||||
|
if not os.path.isdir(monthDir):
|
||||||
|
os.mkdir(monthDir)
|
||||||
|
|
||||||
|
msgFilename = monthDir + '/' + speakerJson['published'] + '.json'
|
||||||
|
saveJson(speakerJson, msgFilename)
|
||||||
|
|
||||||
|
|
||||||
def _notificationNewDMbase(session, toHandle: str,
|
def _notificationNewDMbase(session, toHandle: str,
|
||||||
baseDir: str, nickname: str, password: str,
|
baseDir: str, nickname: str, password: str,
|
||||||
domain: str, port: int, httpPrefix: str,
|
domain: str, port: int, httpPrefix: str,
|
||||||
|
@ -551,23 +575,6 @@ def _notificationNewDMbase(session, toHandle: str,
|
||||||
_sayCommand(sayStr, sayStr, screenreader, systemLanguage, espeak)
|
_sayCommand(sayStr, sayStr, screenreader, systemLanguage, espeak)
|
||||||
|
|
||||||
|
|
||||||
def _storeMessage(speakerJson: {}, boxName: str) -> None:
|
|
||||||
"""Stores a message in your home directory for later reading
|
|
||||||
"""
|
|
||||||
if not speakerJson.get('published'):
|
|
||||||
return
|
|
||||||
homeDir = str(Path.home())
|
|
||||||
if not os.path.isdir(homeDir + '/.config'):
|
|
||||||
os.mkdir(homeDir + '/.config')
|
|
||||||
if not os.path.isdir(homeDir + '/.config/epicyon'):
|
|
||||||
os.mkdir(homeDir + '/.config/epicyon')
|
|
||||||
msgDir = homeDir + '/.config/epicyon/' + boxName
|
|
||||||
if not os.path.isdir(msgDir):
|
|
||||||
os.mkdir(msgDir)
|
|
||||||
msgFilename = msgDir + '/' + speakerJson['published'] + '.json'
|
|
||||||
saveJson(speakerJson, msgFilename)
|
|
||||||
|
|
||||||
|
|
||||||
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,
|
||||||
|
|
Loading…
Reference in New Issue