Hacker Public Radio

HPR3496: How I record HPR Episodes


Listen Later

https://gitlab.com/norrist/solocast
Sample script.txt
This is a sample script for solocast.
Separate the segments with a blank line
Bulleted lists are OK, but keep the items together by not skipping a line
- Item 1
- Item 2
### Markdown Formatting is OK
But the Formatting gets lost in the script
so you can write show notes in loosely formatted markdown
Don't have more than 1 blank line separating segments
solocast.py
#! /usr/bin/env python3
import click
import os
from shutil import which
script_file = "script.txt"
recording_directory_name = "Recordings"
recording_format = "wav"
script_segments = {}
def test_sox_exists():
try:
assert which("sox")
except AssertionError:
print("Cant find sox. Install sox somewhere in your path.")
exit(1)
def get_recording_file_name(slug):
return f"{recording_directory_name}/{slug}.{recording_format}"
def project_prep():
if not os.path.exists(recording_directory_name):
os.makedirs(recording_directory_name)
if not os.path.exists(f"{recording_directory_name}/Archive"):
os.makedirs(f"{recording_directory_name}/Archive")
def wait_for_input():
click.echo("*" * 40)
_ = input("Press ENTER to Continue")
def add_slug_text(slug, text):
script_segments[slug] = text
def recording_exists(slug):
if os.path.isfile(get_recording_file_name(slug)):
return True
return False
def noise_profile_missing():
if os.path.isfile(f"{recording_directory_name}/noise.prof"):
return False
return True
def truncate_audio(slug):
recording = get_recording_file_name(slug)
new_recording = f"{recording_directory_name}/{slug}-truncated.{recording_format}"
click.echo(f"truncating {recording}")
SOX_CMD = (
f"sox -V2 {recording} {new_recording} silence -l 1 0.1 .1% -1 1.0 .1% stat"
)
click.echo(SOX_CMD)
os.system(SOX_CMD)
os.system(
f" mv -v {recording} {recording_directory_name}/Archive/{slug}.{recording_format}"
)
os.rename(new_recording, recording)
review_audio(slug)
def play_audio(slug):
recording = get_recording_file_name(slug)
click.echo(f"Playing {recording}")
os.system(f"play {recording}")
review_audio(slug)
def delete_audio(slug):
recording = get_recording_file_name(slug)
os.remove(recording)
def review_audio(slug):
review_menu = ["(p)lay", "(a)ccept", "(r)eccord again", "(t)runcate"]
click.echo(slug)
for i in review_menu:
click.echo(i)
menu_action = input(">> ")
if menu_action == "p":
play_audio(slug)
elif menu_action == "a":
exit()
elif menu_action == "r":
delete_audio(slug)
find_and_record_next()
elif menu_action == "t":
truncate_audio(slug)
else:
review_audio(slug)
def record_audio(slug):
new_recording = get_recording_file_name(slug)
click.echo(f"Creating {new_recording}")
click.echo("press Enter to start then CRTL-C to quit")
wait_for_input()
os.system(f"rec {new_recording}")
def record_silent_audio():
silent_recording = f"{recording_directory_name}/silence.{recording_format}"
click.echo("RECORD 5 SECONDS OF SILENCE n" * 5)
click.echo("press Enter to start")
wait_for_input()
os.system(f"rec {silent_recording} trim 0 5")
os.system(
...more
View all episodesView all episodes
Download on the App Store

Hacker Public RadioBy Hacker Public Radio

  • 4.2
  • 4.2
  • 4.2
  • 4.2
  • 4.2

4.2

34 ratings


More shows like Hacker Public Radio

View all
The Changelog: Software Development, Open Source by Changelog Media

The Changelog: Software Development, Open Source

290 Listeners

Defensive Security Podcast - Malware, Hacking, Cyber Security & Infosec by Jerry Bell and Andrew Kalat

Defensive Security Podcast - Malware, Hacking, Cyber Security & Infosec

372 Listeners

LINUX Unplugged by Jupiter Broadcasting

LINUX Unplugged

268 Listeners

SANS Internet Stormcenter Daily Cyber Security Podcast (Stormcast) by Johannes B. Ullrich

SANS Internet Stormcenter Daily Cyber Security Podcast (Stormcast)

651 Listeners

Curious Cases by BBC Radio 4

Curious Cases

821 Listeners

The Strong Towns Podcast by Strong Towns

The Strong Towns Podcast

423 Listeners

Late Night Linux by The Late Night Linux Family

Late Night Linux

164 Listeners

Darknet Diaries by Jack Rhysider

Darknet Diaries

8,059 Listeners

Cybersecurity Today by Jim Love

Cybersecurity Today

179 Listeners

CISO Series Podcast by David Spark, Mike Johnson, and Andy Ellis

CISO Series Podcast

189 Listeners

TechCrunch Daily Crunch by TechCrunch

TechCrunch Daily Crunch

42 Listeners

Strict Scrutiny by Crooked Media

Strict Scrutiny

5,800 Listeners

2.5 Admins by The Late Night Linux Family

2.5 Admins

98 Listeners

Cyber Security Headlines by CISO Series

Cyber Security Headlines

139 Listeners

What the Hack? by DeleteMe

What the Hack?

228 Listeners