script for generating HTML for LP ogg files
authorAndrew Engelbrecht <andrew@fsf.org>
Tue, 1 Aug 2023 18:13:44 +0000 (14:13 -0400)
committerAndrew Engelbrecht <andrew@fsf.org>
Tue, 1 Aug 2023 18:13:44 +0000 (14:13 -0400)
index-generator.py [new file with mode: 0755]

diff --git a/index-generator.py b/index-generator.py
new file mode 100755 (executable)
index 0000000..0cd867b
--- /dev/null
@@ -0,0 +1,39 @@
+#! /usr/bin/python
+
+#    Copyright (C) 2023 Andrew Engelbrecht <andrew@fsf.org>
+#
+#    This program is free software; you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation; either version 2 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program; if not, write to the Free Software
+#    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+
+# converts a csv with speech / speaker info into HTML formatted links that
+# point to audio recordings
+
+import csv
+import re
+
+licenses = {
+        "https://creativecommons.org/licenses/by/4.0/": "CC BY 4.0",
+        "https://creativecommons.org/licenses/by-sa/4.0/": "CC BY-SA 4.0",
+        "https://www.gnu.org/licenses/fdl-1.3.en.html": "GFDL 1.3" }
+
+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/' + re.sub("[.]webm$", ".ogg", row[4]) + '">' + row[0] + ': ' + row[1] + '</a> (<a href="' + row[2] + '">' + licenses[row[2]] + '</a>)</li>')
+
+print('</ul>')
+