{"id":16930358,"url":"https://github.com/avdata99/yaasr","last_synced_at":"2025-04-11T18:32:04.710Z","repository":{"id":54492978,"uuid":"338662308","full_name":"avdata99/yaasr","owner":"avdata99","description":"Yet another audio stream recorder","archived":false,"fork":false,"pushed_at":"2021-04-29T12:15:53.000Z","size":465,"stargazers_count":2,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-03T09:21:29.044Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/avdata99.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-02-13T20:21:50.000Z","updated_at":"2023-07-04T15:28:11.000Z","dependencies_parsed_at":"2022-08-13T17:40:38.308Z","dependency_job_id":null,"html_url":"https://github.com/avdata99/yaasr","commit_stats":null,"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avdata99%2Fyaasr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avdata99%2Fyaasr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avdata99%2Fyaasr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avdata99%2Fyaasr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/avdata99","download_url":"https://codeload.github.com/avdata99/yaasr/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248458611,"owners_count":21107114,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-13T20:41:30.384Z","updated_at":"2025-04-11T18:32:04.689Z","avatar_url":"https://github.com/avdata99.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Build status](https://github.com/avdata99/yaasr/workflows/Build/badge.svg?branch=main)\n[![Pypi py version](https://img.shields.io/pypi/pyversions/yaasr)](https://pypi.org/project/yaasr/)\n[![GitHub All Releases](https://img.shields.io/github/downloads/avdata99/yaasr/total)](https://github.com/avdata99/yaasr/releases)\n[![GitHub Issues](https://img.shields.io/github/issues/avdata99/yaasr)](https://github.com/avdata99/yaasr/issues)\n[![GitHub PR](https://img.shields.io/github/issues-pr/avdata99/yaasr)](https://github.com/avdata99/yaasr/pulls)\n[![Licence](https://img.shields.io/github/license/avdata99/yaasr)](https://github.com/avdata99/yaasr/blob/main/LICENSE)\n[![Last Commit](https://img.shields.io/github/last-commit/avdata99/yaasr)](https://github.com/avdata99/yaasr/commits/main)\n\n# Yet Another Audio Stream Recorder\n\nAudio stream recorded and static DB for radio stations.  \n**Why?** Because other tools are (probably, [is not clear](https://github.com/mgaitan/radiocut_downloader/pull/18#issuecomment-526191324)) not availabe to use.\n\n## Install\n\nInstall with pip\n\n```\npip install yaasr\n```\n\n## Usage\n\n### From Python\n\n#### Save predefined audio locally\n\nLoad a pre-defined stream and save 5 audio chunks of 60 seconds\n\n```python\nfrom yaasr.recorder.stream import YStream\n\nys = YStream('radio-universidad-cordoba-argentina')\nys.load()\nys.record(total_seconds=300, chunk_bytes_size=1024, chunk_time_size=60)\n```\n\nYou will see new audio files at your local folder\n\n#### Save custom audio locally\n\nLoad a custom stream and save 5 audio chunks of 60 seconds\n\n```python\nfrom yaasr.recorder.stream import YStream\n\n\"\"\" test custom stream \"\"\"\nys = YStream(stream_name='my-custom-stream')\nys.destination_folder = 'some-path/my-chunks-folder'\nys.title = 'My radio title'\nys.short_name = 'my-radio'\n\n# list of stream (if first fails the second should be used)\nys.streams = [\n    {'url': 'https://my-radio.org/stream'}\n]\n\nys.record(total_seconds=300, chunk_bytes_size=1024, chunk_time_size=5)\n```\n\nYou will see new audio files at `some-path/my-chunks-folder` folder\n\n#### Upload to Google Cloud Storage\n\n```python\nfrom yaasr.recorder.stream import YStream\nfrom yaasr.processors.audio.reduce import reformat\nfrom yaasr.processors.archive.google_cloud import upload_to_google_cloud_storage\n\n# os.environ[\"GOOGLE_APPLICATION_CREDENTIALS\"] = \"google-cloud-storage-credential.json\"\nys = YStream('radio-universidad-cordoba-argentina')\nys.load()\n\n# post-processors (you can combine or create new processors)\nys.post_process_functions = [\n    {\n        'fn': reformat,\n        'params': {\n            'audio_format': 'mp3',\n            'mono': True,\n            'delete_on_success': True\n        }\n    },\n    {\n        'fn': upload_to_google_cloud_storage,\n        'params': {\n            'bucket_name': 'parlarispa-radio',\n            'delete_on_success': True\n        }\n    }\n]\nys.record(total_seconds=300, chunk_bytes_size=1024, chunk_time_size=60)\n```\n\n![google-cloud-storage-list](docs/img/google-cloud-storage-list.png)\n![google-cloud-storage-element](docs/img/google-cloud-storage-element.png)\n\n#### Upload audio chunks using ssh\n\nPost process audio to MP3 16Khz and upload via ssh the result cleaning local files after the process\n\n```python\nfrom yaasr.recorder.stream import YStream\nfrom yaasr.processors.audio.reduce import reformat\nfrom yaasr.processors.archive.ssh import upload_ssh\n\n\nys = YStream('radio-universidad-cordoba-argentina')\nys.load()\n\n# post-processors (you can combine or create new processors)\nys.post_process_functions = [\n    {\n        'fn': reformat,\n        'params': {\n            'audio_format': 'mp3',\n            'delete_on_success': True\n        }\n    },\n    {\n        'fn': upload_ssh,\n        'params': {\n            'host': 'myhost.com',\n            'user': 'username',\n            'password': 'mypass',\n            'destination_folder': '/home/username/audios/',\n            'port': 901,\n            'delete_on_success': True\n        }\n    }\n]\nys.record(total_seconds=300, chunk_bytes_size=1024, chunk_time_size=60)\n```\n\n![ssh files](docs/img/sshed.png)\n\n### Usage from command line\n\nList all available streams\n\n```\n$ yaasr ls\nradio-bio-bio-santiago-chile: https://unlimited4-us.dps.live/biobiosantiago/aac/icecast.audio\nradio-universidad-cordoba-argentina: https://sp4.colombiatelecom.com.co:10995/stream\n```\n\nInfo about a stream\n\n```\n$ yaasr info --stream radio-bio-bio-santiago-chile\n{\n    \"title\": \"Bio Bio Santiago de Chile\",\n    \"web\": \"https://vivo.biobiochile.cl/player/\",\n    \"streams\": [\n        {\n            \"url\": \"https://unlimited4-us.dps.live/biobiosantiago/aac/icecast.audio\",\n            \"extension\": \"aac\"\n        }\n    ]\n}\n```\n\nRecord a stream\n\n```\n$ yaasr record \\\n    --stream radio-bio-bio-santiago-chile \\\n    --total_seconds 90 \\\n    --chunk_bytes_size 512 \\\n    --chunk_time_size 30\n\n2021-02-14 18:27:20,382 - yaasr.recorder.stream - INFO - Attempt to record from https://unlimited4-us.dps.live/biobiosantiago/aac/icecast.audio\n2021-02-14 18:27:21,244 - yaasr.recorder.stream - INFO - Recording from https://unlimited4-us.dps.live/biobiosantiago/aac/icecast.audio\n2021-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\n2021-02-14 18:27:56,924 - yaasr.recorder.stream - INFO - Chunk finished\n2021-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\n2021-02-14 18:28:27,132 - yaasr.recorder.stream - INFO - Chunk finished\n2021-02-14 18:28:51,294 - yaasr.recorder.stream - INFO - Finish recording 2021-02-14 18:28:51.294881\n2021-02-14 18:28:51,295 - yaasr.recorder.stream - INFO - Chunk finished\n```\n\n### More docs\n\n - Add recording task to [supervisor](docs/run-with-supervisor.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Favdata99%2Fyaasr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Favdata99%2Fyaasr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Favdata99%2Fyaasr/lists"}