zeitsprung package

Submodules

zeitsprung.base module

class zeitsprung.base.Base(verbose: bool = True)[source]

Bases: object

Base class for ‘zeitsprung-fm’ package classes.

zeitsprung.database module

class zeitsprung.database.SQLiteEngine(db_file: str, verbose: bool = True)[source]

Bases: zeitsprung.base.Base

Class to set up and access a SQLite database to store the data from the ‘zeitsprung.fm’ website.

create_connection() sqlite3.Connection[source]

Creates a connection object using the provided credentials in instance creation.

Returns

A object for connecting to the database.

Return type

Connection

insert_audio_row(row: list) None[source]

Inserts a record row into the ‘audio’ relation.

Parameters

row (list) – Values to insert.

Returns

Return type

None

insert_meta_row(row: list) None[source]

Inserts a record row into the ‘meta’ relation.

Parameters

row (list) – Values to insert.

Returns

Return type

None

query_all_audio() pandas.core.frame.DataFrame[source]

Queries the complete record from the ‘audio’ relation and parses it into a DataFrame object.

Returns

The audio table.

Return type

DataFrame

query_all_meta() pandas.core.frame.DataFrame[source]

Queries the complete record from the ‘meta’ relation and parses it into a DataFrame object.

Returns

The meta table.

Return type

DataFrame

query_last_episode_id() Optional[int][source]

Queries the last episode from the ‘meta’ relation.

Returns

The id of the last episode.

Return type

int or None

setup_schema() None[source]

Creates the schema with ‘meta’ and ‘audio’ relations in the ‘zeitsprung.db’ database.

Returns

Return type

None

zeitsprung.scraping module

class zeitsprung.scraping.Scraper(data_folder: str, update_interval: int = 86400, reset: bool = False, verbose: bool = True)[source]

Bases: zeitsprung.base.Base

Class for scraping and preprocessing the data from the ‘www.zeitsprung.fm’ website.

get_episode_audio(url: str) Optional[pydub.audio_segment.AudioSegment][source]

Downloads the audio of a specified episode.

Parameters

url (str) – URL to download the audio from.

Returns

The audio of the episode.

Return type

AudioSegment

get_episode_meta(i: int) Optional[list][source]

Gets the episodes meta data (title, description, publication and modified at date) and stores it to the database.

Parameters

i (int) – Number of the episode (i - 1).

Returns

List containing the meta data of the episode.

Return type

list

run() None[source]

Start the scraper, which will download the meta data and audio files of all not yet existing episodes in the database.

Returns

Return type

None

save_episode_audio(audio: pydub.audio_segment.AudioSegment, file_name: str) None[source]

Save the audio file of an episode and as ‘.wav’ file.

Parameters
  • audio (AudioSegment) – Audio file to save.

  • file_name (str) – File name with path, where the file should be saved to.

Returns

Return type

None

static search_key(key, dict_obj)[source]

Module contents

Top-level package for zeitsprung.