clearer code for generating html audio list
authorAndrew Engelbrecht <andrew@fsf.org>
Tue, 1 Aug 2023 20:18:45 +0000 (16:18 -0400)
committerAndrew Engelbrecht <andrew@fsf.org>
Tue, 1 Aug 2023 20:18:45 +0000 (16:18 -0400)
index-generator.py

index 586bfa1607a51507fadd685dfe6125757cd5f6dc..b0832f6dfdb7f2c43c771efe9d0a61ba6fb3142d 100755 (executable)
@@ -32,8 +32,14 @@ print('<ul>')
 with open('lp2023-video-import.csv', newline='') as csvfile:
     spamreader = csv.reader(csvfile, delimiter=',', quotechar='"')
     for row in spamreader:
-        license = ""
-        print('<li><a href="GNUAV/lp2023_audio/lp2023-' + re.sub("[.]webm$", ".ogg", row[4]) + '">' + row[0] + ': ' + row[1] + '</a> (<a href="' + row[2] + '">' + licenses[row[2]] + '</a>)</li>')
+
+        authors = row[0]
+        description = row[1]
+        license_link = row[2]
+        license_name = licenses[row[2]]
+        audio_file = re.sub("[.]webm$", ".ogg", row[4])
+
+        print(' <li><a href="GNUAV/lp2023_audio/lp2023-{}">{}: {}</a> (<a href="{}">{}</a>)</li>'.format(audio_file, authors, description, license_link, license_name))
 
 print('</ul>')