mirror of https://gitlab.com/bashrc2/epicyon
Remove extra newswire items
parent
7a01f422cf
commit
d1295a94f0
10
newswire.py
10
newswire.py
|
@ -733,7 +733,13 @@ def getDictFromNewswire(session, baseDir: str, domain: str,
|
||||||
# are there too many posts? If so then remove the oldest ones
|
# are there too many posts? If so then remove the oldest ones
|
||||||
noOfPosts = len(sortedResult.items())
|
noOfPosts = len(sortedResult.items())
|
||||||
if noOfPosts > maxNewswirePosts:
|
if noOfPosts > maxNewswirePosts:
|
||||||
for n in range(noOfPosts - maxNewswirePosts):
|
ctr = 0
|
||||||
sortedResult.pop()
|
removals = []
|
||||||
|
for dateStr, item in sortedResult.items():
|
||||||
|
ctr += 1
|
||||||
|
if ctr >= maxNewswirePosts:
|
||||||
|
removals.append(dateStr)
|
||||||
|
for r in removals:
|
||||||
|
sortedResult.pop(r)
|
||||||
|
|
||||||
return sortedResult
|
return sortedResult
|
||||||
|
|
Loading…
Reference in New Issue