Skip to main content

talklib

tests GitHub issues last-commit

A package to automate processing TL shows/segments and podcasts

talklib on PyPI

Skip to Examples

THIS README IS INTENDED TO ASSIST TL STAFF IN INSTALLING AND USING THIS PACKAGE

This package automates two categories of things:

  1. Shows/segments we receive from outside the TL
    • Shows and segments we receive via RSS feed
      • Shows such as New York Times, Wall Street Journal, etc.
      • Segments such as Health in a Heartbeat, Academic Minute, etc.
    • Segments we receive via "permalink"
      • Such as PNS, Cirrus, etc.
    • Segments downloaded locally ahead of time
      • Such as Sound Beat, Animal Airwaves, etc.
  2. TL Podcasts

Requirements

-Python

Use Python 3.10 or higher.

Make sure to select "add to PATH" during installation.

-FFmpeg

You need both FFmpeg & FFprobe installed on the PC and added to the PATH.

To repeat, this package will not work without FFmpeg and FFprobe.

FFmpeg and FFprobe should be two separate binaries.

The easiest way to install FFmpeg (and FFprobe) on Windows is with WinGet (you may need to run this in a terminal with Admin privileges):

winget install Gyan.FFmpeg

This should install both FFmpeg & FFprobe. After WinGet completes installation, restart your terminal and then test to ensure FFmpeg is installed:

ffmpeg -version

You should see some output from FFmpeg. If you see an error, it was not installed correctly.

-Twilio

Twilio is used for SMS and phone call notifications.

THIS IS NOT SOMETHING YOU NEED TO DOWNLOAD/INSTALL.

Access our TL Twilio info (token, etc.) by logging in to Twilio.

See below for how to disable Twilio.

-Environment Variables

This package uses Environment Variables to help with portability and keep sensitive info separated. The entire list of these is in the ev.py file. Make sure to set all of these on your PC(s). They are case-sensitive!

ONCE YOU SET/CHANGE/UPDATE ENVIRONMENT VARIABLES ON YOUR PC, YOU NEED TO RESTART WIREREADY


Installation

AFTER you have all of the above requirements, install the library:

  • Open a terminal/command prompt
  •   pip install talklib
    
  • Depending on your OS, instead of pip you may need to use pip3
  • This will install the package globally. If you're a TL user just trying to install the package for everyday use, that's likely what you want to do. If you want to install it locally (for testing, etc.), see the development section below.
  • If you already have it installed and need to update it to the newest version, run pip install --upgrade talklib

About WireReady

Before we begin, a general note:

We run most of our Python scripts via WireReady (WR)

  • The "Run" command in WR defaults to running from a different directory AND a different drive letter. This causes confusion.
  • WR also does not run .py files by default.
  • These are some of the reasons why we do not run .py files directly from WR.
  • Instead, we tell WR to run a Batch script (.bat file) which in turn will automatically run the Python script (.py file).
  • Ensure the Batch & Python scripts are in the same directory.
  • A sample .bat file (Example.bat) is included in the talking-library-misc repo (This is a private repo! Contact Shared Systems team to get access).
    • Download this file and place it in the same folder as your Python file.
    • Right-Click the file > select Properties > select Unblock so that it can be executed.
    • It is a best practice to give the .bat and .py files the same name, though it is not necessary.
  • PLEASE NOTE: the .bat file will run all Python files in the folder. This is one reason it is best to separate your Python files into different folders, each with its own .bat file.

Here is what an example directory structure should look like:

D:\wireready
    \Washington Post
        -WP.bat
        -WP.py

You would schedule WR to run the WP.bat file, which would automatically run the WP.py file.


Outside Shows/Segments Usage

Skip to Examples

TLShow is the main class to use.

Import the class to your script like this:

from talklib import TLShow

This is also fine:

from talklib.show import TLShow

Create an instance like this:

example = TLShow()

Available Attributes

here is a list of all the attributes, along with their type and whether they are required.

show

string

required

  • This is the name of the program
  • Mostly used for notifications, etc.

show_filename

string

required

  • the filename of the program
  • do NOT include a trailing dash - OR a file extension .wav. use the base name only

url

string

required for all RSS or permalink shows

is_local

boolean

required for "local" shows

  • tells the module whether this is a local show
  • must be set to True if it is a local show
  • default is False

local_file

string

required for "local" shows

  • path to the local file as such: D:\path\to\the\show.wav
  • you will probably not have a hardcoded path here. Usually, you will be running a short algorithm to determine the path. Please see the talking-library-misc repo for some examples (This is a private repo! Contact Shared Systems team to get access).

is_permalink

boolean

required for "permalink" shows

  • must be set to True for permalink shows
  • default is False

remove_yesterday

boolean

optional

  • whether or not you want to remove yesterday's files (if any exists)
  • if set to True, it will delete any file matching the show_filename attribute you set.
  • default is False.

include_date

boolean

optional

  • whether or not you want to include today's date in the filename
  • if set to True, the date will be appended as such: WP-MMDDYY.wav
  • if not set, or set to False, the resulting filename will be: WP.wav
  • Generally, for TL programs, if it is a daily show, like the New York Times, etc., you need the date in the filename, as this is what WireReady will match.
  • the default is False

check_if_above and check_if_below

number

optional

  • these are for checking whether the length of the program (in minutes!) falls outside a range
  • used strictly for notification purposes
  • if these are not set, the checks will not be run
  • again, these values are in minutes, not seconds
  • currently, if you set one of these, you must set both of them. All or nothing.

remove_source

boolean

optional

  • whether you want to remove/delete the original source file after processing
  • applies only to local shows
  • default is False

notifications

object

optional

  • this is its own object with the following attributes:
    • enable_all
    • syslog_enable
    • twilio_enable
    • email_enable
  • to disable all notifications, set enable_all to false like this: object.notifications.enable_all = False
  • to disable a particular one of these, set them like this: object.notifications.twilio_enable = False
  • default for all of them is True
  • more examples below

ffmpeg

object

  • this is its own object with various attributes. The ones you might want to change are breakaway and compression_level
    • breakaway

      • if you only want to convert/output the audio file up to a certain point, set this to the number of seconds at which point you want it to stop.
      • change it like this: object.ffmpeg.breakaway = 120. This will cut the audio at 2 minutes.
      • again, this number is in seconds (not minutes)
      • perhaps the only time you need to set this is for shows like PNS where there is an expected "breakaway" time.
      • default is to convert the entire file
    • compression_level

      • sets the level for FFmpeg's compression/normalization
      • this is the EBU R128 LUFS "integrated loudness" standard
      • change it like this: object.ffmpeg.compression_level = 18
      • the smaller the number, the more compression is applied (17 is more compressed than 18)
      • the max is 5 (do not set to 1, 2, 3, or 4)!
      • be careful with this!
      • default is 21

Examples

RSS Example

The minimum attributes you must set are show, show_filename, and url.

Here is an example script:

from talklib import TLShow

SD = TLShow(
    show = 'Skywalker Daily News',
    show_filename = 'SDN',
    url = 'https://somesite.org/sdn-feed.rss'
    )

SD.run()

Local Example

"Local" shows are shows whose files we already have downloaded ahead of time.

The minimum attributes you must set are: show, show_filename, is_local, and local_file.

Here is an example script:

from talklib import TLShow

MWB = TLShow(
    show = 'Magical World of Bees',
    show_filename = 'MWB',
    is_local = True,
    local_file = 'D:Production\path\to\the\file.wav'
    )

MWB.run()

Permalink Example

"Permalink" shows are shows whose audio URL does not change, E.G. PNS & Cirrus

The minimum attributes you must set are: show, show_filename, url, and is_permalink.

Here is an example script:

from talklib import TLShow

WK = TLShow(
    show = 'Who Knows',
    show_filename = 'WhoKnows',
    url = 'https://somesite.org/who-knows-static',
    is_permalink = True
    )

WK.run()

Misc. Examples

Here are some examples of how to access/modify certain attributes.

Disable Twilio

To disable Twilio notifications, simply add a line like this:

from talklib import TLShow

SD = TLShow(
    show = 'Skywalker Daily News',
    show_filename = 'SDN',
    url = 'https://somesite.org/sdn-feed.rss'
    )

SD.notifications.twilio_enable = False

SD.run()

Disable Notifications

To disable ALL notifications, add a line like this:

This will disable all notifications including syslog messages

from talklib import TLShow

SD = TLShow(
    show = 'Skywalker Daily News',
    show_filename = 'SDN',
    url = 'https://somesite.org/sdn-feed.rss'
    )

SD.notifications.enable_all = False

SD.run()

Adjust FFmpeg compression

To adjust the level of compression applied with FFmppeg, add a line like this:

from talklib import TLShow

SD = TLShow(
    show = 'Skywalker Daily News',
    show_filename = 'SDN',
    url = 'https://somesite.org/sdn-feed.rss'
    )

SD.ffmpeg.compression_level = 18

SD.run()

TL Podcasts Usage

Prerequisites

Before starting to podcast a new show, you must log in to the server, create a directory, and upload some files. The talklib CLI has several functions to help you with this. Run talklib --help in your terminal to see a list of these helper functions.

The directory should be named the same as the base name of the audio files for that show. For example, The Nashville Scene audio files are labelled as SceneMMDDYY. The directory name on the server should be scene in all lower-case.

You must also add two files to this directory: an RSS Feed and and an image.

The RSS feed should be named feed.xml. The image (the logo for the show) should be named image.jpg. You should update the template RSS feed file for each program. There are several default values such as Title that need to be changed. They are marked as such in the template.

Scripts

TLPod is the main class to use. Import the class to your script like this:

from talklib import TLPod

This is also fine:

from talklib.pod import TLPod

Examples

from talklib import TLPod

nyt = TLPod(
    display_name = "New York Times",
    filename_to_match = "nyt",
    )
nyt.run()

The default number of episodes allowed in a podcast feed at any given time is 5. To change that:

from talklib import TLPod

nyt = TLPod(
    display_name = "New York Times",
    filename_to_match = "nyt",
    max_episodes_in_feed = 7
    )
nyt.run()

To disable ALL notifications, add a line like this:

This will disable all notifications including syslog messages (terminal print statements will not be disabled)

from talklib import TLPod

nyt = TLPod(
    display_name = "New York Times",
    filename_to_match = "nyt",
    )
nyt.notifications.notify.enable_all = False
nyt.run()

If the name of the corresponding directory on the server is different from the filename_to_match value, adjust for that like this:

from talklib import TLPod

nyt = TLPod(
    display_name = "New York Times",
    filename_to_match = "nyt",
    bucket_folder = "newyorktimes"
    )
nyt.run()

This will match audio files that start with nyt, and will upload the files to the server directory called newyorktimes.


Development

  • Clone this repository

    git clone https://github.com/Nashville-Public-Library/talklib.git
    
  • cd into the folder in the terminal or open the folder in your IDE

    cd talklib
    
  • Create a virtual environment

    py -m venv venv
    
    • depending on your OS, instead of py you may need to use python or python3
  • Activate virtual environment

    • On Windows:
    venv\Scripts\activate
    
    • On Mac:
    source venv/bin/activate
    

    [IMPORTANT] If done correctly, you should see (venv) in the terminal. Don't run the rest of these commands unless you see (venv) in the terminal.

  • Update pip

    py -m pip install --upgrade pip
    
    • depending on your OS, instead of pip you may need to run pip3
  • Install the package into your virtual environment

    pip install -e .
    
  • Run Pytest

    pytest
    
    • to see code coverage, use this instead
    pytest --cov=talklib
    
    • The tests can take a while to run. Watch the terminal output for progress.
    • If the tests fail, you may have installed something incorrectly.
    • You must be connected to the internet to run the tests.
    • To update the version on PyPI, you must increment the version number in pyproject.toml

Release files for talklib 3.7.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for talklib 3.7.4
File Size Uploaded
talklib-3.7.4.tar.gz 30.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for talklib 3.7.4
File Interpreter ABI Platform
talklib-3.7.4-py3-none-any.whl Python 3 none any Details

Total release size: 56.2 kB

Release files / talklib-3.7.4.tar.gz

Download URL talklib-3.7.4.tar.gz
Size 30.1 kB
Tags Source
SHA-256 checksum
How to use checksums
818be78f6e3733a5802580ec045d3b8aba375888dc048725f3ad7d1007b2182e
BLAKE2b-256 checksum
How to use checksums
f24db11814106c34b17a8a26b4b2679b322c59e429e916ff142a8041243b0795
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 31, 2026.

Transparency log

Release files / talklib-3.7.4-py3-none-any.whl

Download URL talklib-3.7.4-py3-none-any.whl
Size 26.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bf9ebc33648529935aa0f7b3f97c07bedbe7170749909a32d6b60eea8cbc703b
BLAKE2b-256 checksum
How to use checksums
d6e741c81c5dfa9978abf208f7ac4f544debb9cb87191704068d188f7da12ceb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 31, 2026.

Transparency log

Release history Release notifications | RSS feed

3.7.8

2 release files

3.7.7

2 release files

3.7.6

2 release files

3.7.5

2 release files

This release

3.7.4 This release

2 release files

3.7.3

2 release files

3.7.2

2 release files

3.7.1

2 release files

3.6.4

2 release files

3.6.3

2 release files

3.6.2

2 release files

3.6.1

2 release files

3.6.0

2 release files

3.5.11

2 release files

3.5.10

2 release files

3.5.9

2 release files

3.5.8

2 release files

3.5.7

2 release files

3.5.6

2 release files

3.5.5

2 release files

3.5.4

2 release files

3.5.3

2 release files

3.5.2

2 release files

3.5.1

2 release files

3.5.0

2 release files

3.4.6

2 release files

3.4.5

2 release files

3.4.3

2 release files

3.4.2

2 release files

3.4.1

2 release files

3.4.0

2 release files

3.3.1

2 release files

3.3.0

2 release files

3.2.3

2 release files

3.2.2

2 release files

3.2.1

2 release files

3.2.0

2 release files

3.1.0

2 release files

3.0.0

2 release files

2.2.1

2 release files

2.2.0

2 release files

2.1.6

2 release files

2.1.5

2 release files

2.1.4

2 release files

2.1.3

2 release files

2.1.2

2 release files

2.1.1

2 release files

2.1.0

2 release files

2.0.7

2 release files

2.0.6

2 release files

2.0.5

2 release files

2.0.4

2 release files

2.0.3

2 release files

2.0.2

2 release files

2.0.1

2 release files

1.4.0

2 release files

1.3.6

2 release files

1.3.5

2 release files

1.3.4

2 release files

1.3.3

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.4

2 release files

1.2.3

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.28

2 release files

1.0.27

2 release files

1.0.26

2 release files

1.0.25

2 release files

1.0.24

2 release files

1.0.23

2 release files

1.0.22

2 release files

1.0.21

2 release files

1.0.20

2 release files

1.0.19

2 release files

1.0.18

2 release files

1.0.17

2 release files

1.0.16

2 release files

1.0.12

2 release files

1.0.11

2 release files

1.0.10

2 release files

1.0.9

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page