www
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
import os, json, glob, logging
|
||||
|
||||
ARCH = "archives/"
|
||||
EXP = "selection/"
|
||||
sel = os.path.join(EXP, "tm-selection.js")
|
||||
|
||||
def find(li, url):
|
||||
|
||||
d = os.path.join(ARCH, li)
|
||||
|
||||
if not os.path.isdir(d):
|
||||
logging.warning("Invalid archive path: " + d)
|
||||
return None
|
||||
|
||||
dir_files = [f for f in glob.glob(os.path.join(d, "*.json"))]
|
||||
|
||||
for f in dir_files:
|
||||
with open(f) as fp:
|
||||
dj = json.load(fp)
|
||||
for t in dj['threads']:
|
||||
if t['url'] == url:
|
||||
return t
|
||||
|
||||
return None
|
||||
|
||||
def construct():
|
||||
|
||||
dump = {}
|
||||
|
||||
with open(sel) as f:
|
||||
d = json.load(f)
|
||||
|
||||
for k, v in d.items():
|
||||
dump[k] = []
|
||||
for i in v:
|
||||
m = find(i['list'], i['url'])
|
||||
if m is not None:
|
||||
m['list'] = i['list']
|
||||
dump[k].append(m)
|
||||
|
||||
fout = os.path.join(EXP, "tm-selection-dump.js")
|
||||
|
||||
with open(fout, 'w+', encoding='utf-8') as f:
|
||||
json.dump(dump, f, ensure_ascii=False, indent=4)
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
construct()
|
||||
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"net.art": [
|
||||
{
|
||||
"list": "crumb",
|
||||
"url": "https://www.jiscmail.ac.uk/cgi-bin/webadmin?A2=ind1406&L=new-media-curating&F=&S=&P=15160"
|
||||
}
|
||||
],
|
||||
"end2end": [],
|
||||
"new media art": [
|
||||
{
|
||||
"list": "nettime-l",
|
||||
"url": "https://nettime.org/Lists-Archives/nettime-l-0905/msg00038.html"
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user