Software Collection/gen
This is the code and process used to generate the Software Collection page's HTML.
Preparing CSV
The CSV file from the Google sheet and folder of photos from the form need to be downloaded. You will need to add the file names to the CSV as the drive links aren't usable outside of Google. Currently all file names must sequentially match form responses and the sheet data cannot be reordered for the following responses to work.
Generate a list of the photo files in the folder:
unzip *.zip cd photos echo "Photo" >> ../photos.txt ls >> ../photos.txt cd ..
Prep the data CSV and file list then make a merged CSV:
cat Collection\ -\ Big\ Box\ Software.csv | tr "\r" " " > collection.csv while read line; do echo ",\"$line\"" >> photos.csv; done < photos.txt paste -d " " collection.csv photos.csv > db.csv
HTML Generation
With the final CSV made pass it as a parameter to the following python script to generate the HTML for the page:
#!/usr/bin/python3 import sys import csv print("This is a list of software in my collection. I do not own the respective copyright's to the original artwork, photos are for refrence only. Feel free to use the photo, with consideration of the original copyright holders, if you need refrence material as well.") with open( str(sys.argv[1]), 'r' ) as theFile: reader = csv.DictReader(theFile) for line in reader: print("<div class=\"inline-thing\">") print("<h2>"+line['Title']+"</h2>") print("[[File:"+line['Photo']+"|150px|left]]") print("<table class=\"wikitable\">") print("<tr><td>Box Year:</td><td>"+line['Year']+"</td></tr>") print("<tr><td>Platform(s):</td><td>"+line['Platform']+"</td></tr>") print("<tr><td>Media Format:</td><td>"+line['Media Format']+"</td></tr>") print("<tr><td>UPC:</td><td>"+line['UPC']+"</td></tr>") print("<tr><td>Notes Other:</td><td>"+line['Notes: Other']+"</td></tr>") print("<tr><td>Box Condition:</td><td>"+line['Box Condition']+"</td></tr>") print("<tr><td>Notes Condition:</td><td>"+line['Notes: Condition']+"</td></tr>") print("</table>") print("</div>")