Commit b5fc735f by murtaugh

end of attempt with export csv ... backing off

parent 105c9330
......@@ -3,18 +3,21 @@ trim=$(orig:%.orig.jpg=%.trim.jpg)
trim: $(trim)
sample/sample.csv: csv/mim.normalized.csv
sample.csv: csv/export_mim.csv
# head -n 101 $< > $@
scripts/csvrandom.py --rows 100 $< $@
sampleimages: sample/sample.csv
sampleimages: sample.csv
scripts/csvcopy.py $<
%.trim.jpg: %.orig.jpg
convert $< -gravity South -crop 0x0+0+25 $@
sample/sample.json: sample/sample.csv scripts/csv2sortable.py
sample.json: sample.csv scripts/csv2sortable.py
scripts/csv2sortable.py $< > $@
sample/poster.pdf: sample/sample.json scripts/orderings.poster.py
poster.pdf: sample.json scripts/orderings.poster.py
scripts/orderings.poster.py $< --output $@
sample/exif.json:
exiftool -FileModifyDate --json
......@@ -18,10 +18,15 @@ X inventory... a sortable (JSON) structure ?!..
]
X name(s) ??!!
* year
* dimensions
x year
x dimensions
* EXIF filemodifydate
NEED to use museum data / files, not scrapes! (which is maybe better anyway!)
(bad idea... after some time trying to reunite the data ... FRUSTRATION and little gain)
DECISION: evt make a separate viz of file exif with images / disconnected.
Return to previous version.
* contours
* gradient
......@@ -29,4 +34,9 @@ X name(s) ??!!
* text
* RGB
Rerun on larger selection
\ No newline at end of file
* parse year ...
* deal with empty values
Rerun on larger selection
Talk about "empty" or exceptional values ??? .... leave space on margins ???
\ No newline at end of file
......@@ -35,6 +35,7 @@ ap = argparse.ArgumentParser("csv to json sortable")
ap.add_argument("src")
ap.add_argument("--inputpath", default="/media/murtaugh/DIVERSIONSX/2016/DIVERSIONS/scrape/mim/")
ap.add_argument("--outputpath", default="sample")
ap.add_argument("--imagepath", default="/media/murtaugh/DIVERSIONSX/2016/DIVERSIONS/Diversies/Images/MIM_Instr_Africains/")
args = ap.parse_args()
output = []
......@@ -42,22 +43,30 @@ with open(args.src) as f:
for row in DictReader(f):
# print (row, file=sys.stderr)
item = {}
ipath = row['image']
item['id'] = row['image']
ipath = row['Image standard']
ipath = ipath.split("\\")[-1]
ipfull = os.path.join(args.imagepath, ipath)
if os.path.exists(ipfull):
print ("found image {0}".format(path), file=sys.stderr)
item['id'] = ipath
else:
print ("missing image {0}".format(ipath), file=sys.stderr)
item['id'] = ipath
base, ext = os.path.splitext(ipath)
item['img'] = base + ".trim.jpg"
item['inventory'] = row['inventoryNb']
item['name'] = row['objectName']
item['title'] = row['objectTitle']
item['dating'] = row['dating']
isize = int(row['image_filesize'])
item['image_filesize'] = {
'value': isize,
'label': humanize_bytes(isize)
}
item['dimensions'] = {
'value': (pfl(row.get('d0')), pfl(row.get('d1')), pfl(row.get('d2'))),
'label': row.get('dlabel')
}
# item['img'] = base + ".trim.jpg"
item['N° d_inventaire'] = row['N° d_inventaire']
item['name'] = row['Nom de l_objet']
#item['title'] = row['objectTitle']
# item['dating'] = row['dating']
# isize = int(row['image_filesize'])
# item['image_filesize'] = {
# 'value': isize,
# 'label': humanize_bytes(isize)
# }
# item['dimensions'] = {
# 'value': (pfl(row.get('d0')), pfl(row.get('d1')), pfl(row.get('d2'))),
# 'label': row.get('dlabel')
# }
output.append(item)
print (json.dumps(output, indent=2))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment