Skip to main content

Build status Pypi py version GitHub All Releases GitHub Issues GitHub PR Licence Last Commit

Yet Another Audio Stream Recorder

Audio stream recorded and static DB for radio stations.
Why? Because other tools are (probably, is not clear) not availabe to use.

Install

Install with pip

pip install yaasr

Usage

From Python

Save predefined audio locally

Load a pre-defined stream and save 5 audio chunks of 60 seconds

from yaasr.recorder.stream import YStream

ys = YStream('radio-universidad-cordoba-argentina')
ys.load()
ys.record(total_seconds=300, chunk_bytes_size=1024, chunk_time_size=60)

You will see new audio files at your local folder

Save custom audio locally

Load a custom stream and save 5 audio chunks of 60 seconds

from yaasr.recorder.stream import YStream

""" test custom stream """
ys = YStream(stream_name='my-custom-stream')
ys.destination_folder = 'some-path/my-chunks-folder'
ys.title = 'My radio title'
ys.short_name = 'my-radio'

# list of stream (if first fails the second should be used)
ys.streams = [
    {'url': 'https://my-radio.org/stream'}
]

ys.record(total_seconds=300, chunk_bytes_size=1024, chunk_time_size=5)

You will see new audio files at some-path/my-chunks-folder folder

Upload to Google Cloud Storage

from yaasr.recorder.stream import YStream
from yaasr.processors.audio.reduce import reformat
from yaasr.processors.archive.google_cloud import upload_to_google_cloud_storage

# os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = "google-cloud-storage-credential.json"
ys = YStream('radio-universidad-cordoba-argentina')
ys.load()

# post-processors (you can combine or create new processors)
ys.post_process_functions = [
    {
        'fn': reformat,
        'params': {
            'audio_format': 'mp3',
            'mono': True,
            'delete_on_success': True
        }
    },
    {
        'fn': upload_to_google_cloud_storage,
        'params': {
            'bucket_name': 'parlarispa-radio',
            'delete_on_success': True
        }
    }
]
ys.record(total_seconds=300, chunk_bytes_size=1024, chunk_time_size=60)

google-cloud-storage-list google-cloud-storage-element

Upload audio chunks using ssh

Post process audio to MP3 16Khz and upload via ssh the result cleaning local files after the process

from yaasr.recorder.stream import YStream
from yaasr.processors.audio.reduce import reformat
from yaasr.processors.archive.ssh import upload_ssh


ys = YStream('radio-universidad-cordoba-argentina')
ys.load()

# post-processors (you can combine or create new processors)
ys.post_process_functions = [
    {
        'fn': reformat,
        'params': {
            'audio_format': 'mp3',
            'delete_on_success': True
        }
    },
    {
        'fn': upload_ssh,
        'params': {
            'host': 'myhost.com',
            'user': 'username',
            'password': 'mypass',
            'destination_folder': '/home/username/audios/',
            'port': 901,
            'delete_on_success': True
        }
    }
]
ys.record(total_seconds=300, chunk_bytes_size=1024, chunk_time_size=60)

ssh files

Usage from command line

List all available streams

$ yaasr ls
radio-bio-bio-santiago-chile: https://unlimited4-us.dps.live/biobiosantiago/aac/icecast.audio
radio-universidad-cordoba-argentina: https://sp4.colombiatelecom.com.co:10995/stream

Info about a stream

$ yaasr info --stream radio-bio-bio-santiago-chile
{
    "title": "Bio Bio Santiago de Chile",
    "web": "https://vivo.biobiochile.cl/player/",
    "streams": [
        {
            "url": "https://unlimited4-us.dps.live/biobiosantiago/aac/icecast.audio",
            "extension": "aac"
        }
    ]
}

Record a stream

$ yaasr record \
    --stream radio-bio-bio-santiago-chile \
    --total_seconds 90 \
    --chunk_bytes_size 512 \
    --chunk_time_size 30

2021-02-14 18:27:20,382 - yaasr.recorder.stream - INFO - Attempt to record from https://unlimited4-us.dps.live/biobiosantiago/aac/icecast.audio
2021-02-14 18:27:21,244 - yaasr.recorder.stream - INFO - Recording from https://unlimited4-us.dps.live/biobiosantiago/aac/icecast.audio
2021-02-14 18:27:56,923 - yaasr.recorder.stream - INFO - 2021-02-14 18:27:56.923239 Elapsed 0:00:35.679521 Finish chunk 1274
2021-02-14 18:27:56,924 - yaasr.recorder.stream - INFO - Chunk finished
2021-02-14 18:28:27,132 - yaasr.recorder.stream - INFO - 2021-02-14 18:28:27.131768 Elapsed 0:01:05.888050 Finish chunk 1981
2021-02-14 18:28:27,132 - yaasr.recorder.stream - INFO - Chunk finished
2021-02-14 18:28:51,294 - yaasr.recorder.stream - INFO - Finish recording 2021-02-14 18:28:51.294881
2021-02-14 18:28:51,295 - yaasr.recorder.stream - INFO - Chunk finished

More docs

Metadata

Release files for yaasr 0.4.13

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

Source distribution (sdist)

Source distribution for yaasr 0.4.13
File Size Uploaded Provenance
yaasr-0.4.13.tar.gz 13.0 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 41.0 kB

Release files / yaasr-0.4.13.tar.gz

Download URL yaasr-0.4.13.tar.gz
Size 13.0 kB
Tags Source
SHA-256 checksum
How to use checksums
6534475f528b47aa8f2e6505b2c6e1b1cdf8f99428a6ea7973e684be11f623a7
BLAKE2b-256 checksum
How to use checksums
648b19fbdb69cff485afc69be7a78c8c97ba1f61dd0a50caf7f333404bb3261e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

Release files / yaasr-0.4.13-py3-none-any.whl

Download URL yaasr-0.4.13-py3-none-any.whl
Size 27.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7bab4a4f72f7ac476dac008c73adedb598eeaf67b14d2403260848f475713201
BLAKE2b-256 checksum
How to use checksums
f2b418e82fccb661055433cd9aca7f81da8560e8f68a543302a6a8428268e66f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

Security for yaasr 0.4.13

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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