From: will Date: Fri, 20 Sep 2024 20:31:54 +0000 (+0100) Subject: Added initial site X-Git-Url: https://git.ozva.co.uk/?a=commitdiff_plain;h=53d45587f5be3f2825fe45cce9ca4d34dc48f9a7;p=utter-news Added initial site --- 53d45587f5be3f2825fe45cce9ca4d34dc48f9a7 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ee88966 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +assets/ diff --git a/index.php b/index.php new file mode 100644 index 0000000..054cdf8 --- /dev/null +++ b/index.php @@ -0,0 +1,101 @@ + + + + + + +

Utter news authenticated upload

+

Next airtime: Loading...

+

Welcome to the Utter News upload page.

+

Here you will upload your recorded news to the playout system, automatically scheduling it.

+

Guide

+
    +
  1. Record your news voice over, make sure to do this somewhere as quiet as possible. This can even be done on your phone. Don't worry about leaving long pauses, the proccessing system will remove these automatically!
  2. +
  3. Pick your intro jingle, outro jingle and bed.
  4. +
  5. Upload the file from your device or recorder.
  6. +
  7. Click submit and it's done!'
  8. +
  9. Your news will playout at the next top-of-the-hour oppertunity*.
  10. +
+

*Note that between 22:00 and 02:00, this will be replaced by Spaceweather.

+

Supported file types

+

.wav, .mp3, .vorbis, .ogg, .aif

+

+ Note from will:
+ Just waiting on some idents from Jeremy, will hopefully give some more variety in the idents that can be picked! I'll also be building in .mp3 support soon...
+ Also if anything goes wrong pls let me know asap! +

+
+
+ Front ident + + +
+ +
+ Bed + + +
+ +
+ Back ident + + +
+
+
+

+

+"; + + $fileType = strtolower(pathinfo($_FILES["file"]["name"], PATHINFO_EXTENSION)); + $targetFile = "assets/upload." . $fileType; + $uploadOk = true; + + # remove the . to prevent sandbox escape + $frontId = str_replace(".", "", $_POST["frontId"]); + $bedId = str_replace(".", "", $_POST["bedId"]); + $backId = str_replace(".", "", $_POST["backId"]); + + if($fileType != "wav" && $fileType != "mp3" && $fileType != "ogg" && $fileType != "vorbis" && $fileType != "aif") { + echo "Only .wav and .mp3 files are currently allowed.
"; + $uploadOk = false; + } + + if (move_uploaded_file($_FILES["file"]["tmp_name"], $targetFile) and $uploadOk) { + echo "File successfully uploaded!
Processing...
"; + + # convert to wav if not already + if ($fileType != "wav") { + exec("sox assets/upload.$fileType assets/upload.wav"); + } + + $output=null; + $retval=null; + exec("./script.sh", $output, $retval); + $output = var_export($output, true); + if ($retval == "0") { + echo "Finished processing successfully.

"; + echo "
+
+ + diff --git a/script.sh b/script.sh new file mode 100755 index 0000000..ff226f8 --- /dev/null +++ b/script.sh @@ -0,0 +1,20 @@ +sox assets/upload.wav -c 1 -r 48k assets/temp.wav \ +norm -3 \ +silence -l 1 0.1 1% -1 2.0 1% \ +compand 0.01,1 -90,-90,-70,-70,-60,-20,0,0 -5 + +fadein=$((48000 * 1)) +fadeout=$((48000 * 4)) +padding=$((fadein + fadeout)) + +length=$(soxi -s assets/temp.wav) +length=$((length + padding)) + +sox assets/temp.wav assets/vox.wav pad "$fadein"s 0 +sox assets/bed_news.wav assets/temp.wav \ +trim 0s "$length"s \ +fade 0 -0 "$fadeout"s + +sox assets/front_news.wav "|sox -M assets/vox.wav assets/temp.wav -c 1 -t sox -" assets/back_news.wav assets/news.wav norm -3 + +exit 0 diff --git a/style.css b/style.css new file mode 100644 index 0000000..6990fa6 --- /dev/null +++ b/style.css @@ -0,0 +1,26 @@ +body { + --utter: #bd003a; + + font-family: sans-serif; + margin: 0; +} +body > *:not(h1) { + width: max(60%, 300px); + margin: 0 auto; +} +.utter { + color: var(--utter); +} +.green { + color: green; +} + +h1 { + text-align: center; + color: white; + background-color: var(--utter); +} +h2 { + text-align: center; + color: var(--utter); +}