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:
 * 1) !/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("") print(" "+line['Title']+" ") print("") print(" ") print(" ")

Alternative
Download the CSV data, cut it down to just the new data (whole file needed so google sheets will quote multiple entries in cell), then use the following script to generate SoftwareSummary template objects and link the manually uploaded files to them


 * 1) !/usr/bin/python3

import sys import csv

with open( str(sys.argv[1]), 'r' ) as theFile: reader = csv.DictReader(theFile) for line in reader: print("")