diff --git a/app/server.js b/app/server.js index 52071f48..baccc8da 100644 --- a/app/server.js +++ b/app/server.js @@ -104,6 +104,11 @@ glob.globSync('Russell_County/Board_of_Supervisors/YouTube_Archive/**/*.info.jso matchBase: true, follow: true, }).pop(); + let subtitleURL = glob.globSync("*.en.vtt", { + cwd: path.join(__dirname, '..', 'public', directory), + matchBase: true, + follow: true, + }).pop(); const route = encodeURI(expressRoutePathFromFilePath(filePath)); let paths = filePath.substring(0, filePath.lastIndexOf(path.sep) > 0 ? filePath.lastIndexOf(path.sep) : filePath.length-1).split(path.sep); paths = paths.map((name, idx, aPaths) => { @@ -117,7 +122,7 @@ glob.globSync('Russell_County/Board_of_Supervisors/YouTube_Archive/**/*.info.jso console.log(`Setting route for ${route}`); app.get(route, async (req, res) => { let info = require(fullFilePath); - const renderData = { route, filePath, fullFilePath, req, paths, directory, videoURL, info }; + const renderData = { route, filePath, fullFilePath, req, paths, directory, videoURL, subtitleURL, info }; res.render("video-player", { h: helpers, ...renderData }); }); }); diff --git a/views/video-player.ejs b/views/video-player.ejs index d3e07865..41a0038e 100644 --- a/views/video-player.ejs +++ b/views/video-player.ejs @@ -34,7 +34,15 @@

<%= (typeof info.title !== 'undefined') ? info.title : "" %>

- +
<% } %>