mirror of https://gitlab.com/bashrc2/epicyon
Option to show shared for today
parent
5cd8854a48
commit
0e5753147e
16
shares.py
16
shares.py
|
@ -725,7 +725,7 @@ def outboxUndoShareUpload(baseDir: str, httpPrefix: str,
|
||||||
def sharesCatalogAccountEndpoint(baseDir: str, httpPrefix: str,
|
def sharesCatalogAccountEndpoint(baseDir: str, httpPrefix: str,
|
||||||
nickname: str, domain: str,
|
nickname: str, domain: str,
|
||||||
domainFull: str,
|
domainFull: str,
|
||||||
path: str) -> {}:
|
path: str, today: bool) -> {}:
|
||||||
"""Returns the endpoint for the shares catalog of a particular account
|
"""Returns the endpoint for the shares catalog of a particular account
|
||||||
See https://github.com/datafoodconsortium/ontology
|
See https://github.com/datafoodconsortium/ontology
|
||||||
"""
|
"""
|
||||||
|
@ -746,6 +746,9 @@ def sharesCatalogAccountEndpoint(baseDir: str, httpPrefix: str,
|
||||||
"DFC:supplies": []
|
"DFC:supplies": []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
currDate = datetime.datetime.utcnow()
|
||||||
|
currDateStr = currDate.strftime("%Y-%m-%d")
|
||||||
|
|
||||||
sharesFilename = acctDir(baseDir, nickname, domain) + '/shares.json'
|
sharesFilename = acctDir(baseDir, nickname, domain) + '/shares.json'
|
||||||
if not os.path.isfile(sharesFilename):
|
if not os.path.isfile(sharesFilename):
|
||||||
return endpoint
|
return endpoint
|
||||||
|
@ -758,6 +761,9 @@ def sharesCatalogAccountEndpoint(baseDir: str, httpPrefix: str,
|
||||||
continue
|
continue
|
||||||
if '#' not in item['dfcId']:
|
if '#' not in item['dfcId']:
|
||||||
continue
|
continue
|
||||||
|
if today:
|
||||||
|
if not item['published'].startswith(currDateStr):
|
||||||
|
continue
|
||||||
|
|
||||||
expireDate = datetime.datetime.fromtimestamp(item['durationSec'])
|
expireDate = datetime.datetime.fromtimestamp(item['durationSec'])
|
||||||
expireDateStr = expireDate.strftime("%Y-%m-%dT%H:%M:%SZ")
|
expireDateStr = expireDate.strftime("%Y-%m-%dT%H:%M:%SZ")
|
||||||
|
@ -783,7 +789,7 @@ def sharesCatalogAccountEndpoint(baseDir: str, httpPrefix: str,
|
||||||
|
|
||||||
def sharesCatalogEndpoint(baseDir: str, httpPrefix: str,
|
def sharesCatalogEndpoint(baseDir: str, httpPrefix: str,
|
||||||
domainFull: str,
|
domainFull: str,
|
||||||
path: str) -> {}:
|
path: str, today: bool) -> {}:
|
||||||
"""Returns the endpoint for the shares catalog for the instance
|
"""Returns the endpoint for the shares catalog for the instance
|
||||||
See https://github.com/datafoodconsortium/ontology
|
See https://github.com/datafoodconsortium/ontology
|
||||||
"""
|
"""
|
||||||
|
@ -803,6 +809,9 @@ def sharesCatalogEndpoint(baseDir: str, httpPrefix: str,
|
||||||
"DFC:supplies": []
|
"DFC:supplies": []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
currDate = datetime.datetime.utcnow()
|
||||||
|
currDateStr = currDate.strftime("%Y-%m-%d")
|
||||||
|
|
||||||
for subdir, dirs, files in os.walk(baseDir + '/accounts'):
|
for subdir, dirs, files in os.walk(baseDir + '/accounts'):
|
||||||
for acct in dirs:
|
for acct in dirs:
|
||||||
if not isAccountDir(acct):
|
if not isAccountDir(acct):
|
||||||
|
@ -824,6 +833,9 @@ def sharesCatalogEndpoint(baseDir: str, httpPrefix: str,
|
||||||
continue
|
continue
|
||||||
if '#' not in item['dfcId']:
|
if '#' not in item['dfcId']:
|
||||||
continue
|
continue
|
||||||
|
if today:
|
||||||
|
if not item['published'].startswith(currDateStr):
|
||||||
|
continue
|
||||||
|
|
||||||
expireDate = \
|
expireDate = \
|
||||||
datetime.datetime.fromtimestamp(item['durationSec'])
|
datetime.datetime.fromtimestamp(item['durationSec'])
|
||||||
|
|
Loading…
Reference in New Issue