| 1 | #! /usr/bin/python |
| 2 | |
| 3 | # Copyright (C) 2023 Andrew Engelbrecht <andrew@fsf.org> |
| 4 | # |
| 5 | # This program is free software; you can redistribute it and/or modify |
| 6 | # it under the terms of the GNU General Public License as published by |
| 7 | # the Free Software Foundation; either version 2 of the License, or |
| 8 | # (at your option) any later version. |
| 9 | # |
| 10 | # This program is distributed in the hope that it will be useful, |
| 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | # GNU General Public License for more details. |
| 14 | # |
| 15 | # You should have received a copy of the GNU General Public License |
| 16 | # along with this program; if not, write to the Free Software |
| 17 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | |
| 19 | # converts a csv with speech / speaker info into HTML formatted links that |
| 20 | # point to audio recordings |
| 21 | |
| 22 | import csv |
| 23 | import re |
| 24 | |
| 25 | licenses = { |
| 26 | "https://creativecommons.org/licenses/by/4.0/": "CC BY 4.0", |
| 27 | "https://creativecommons.org/licenses/by-sa/4.0/": "CC BY-SA 4.0", |
| 28 | "https://www.gnu.org/licenses/fdl-1.3.en.html": "GFDL 1.3" } |
| 29 | |
| 30 | print('<ul>') |
| 31 | |
| 32 | with open('lp2023-video-import.csv', newline='') as csvfile: |
| 33 | spamreader = csv.reader(csvfile, delimiter=',', quotechar='"') |
| 34 | for row in spamreader: |
| 35 | license = "" |
| 36 | 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>') |
| 37 | |
| 38 | print('</ul>') |
| 39 | |