-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
189 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -129,6 +129,7 @@ dmypy.json | |
.pyre/ | ||
|
||
.vscode/ | ||
*.aac | ||
*.mp3 | ||
*.mp4 | ||
*.ogg | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from yaasr import get_all_streams | ||
from yaasr.recorder.stream import YStream | ||
|
||
|
||
def test_all_streams(): | ||
streams = get_all_streams() | ||
|
||
for stream in streams: | ||
ys = YStream(stream) | ||
ys.load() | ||
# it works ys.record(total_seconds=30, chunk_bytes_size=512, chunk_time_size=10) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,17 @@ | ||
import os | ||
|
||
|
||
__VERSION__ = '0.3.2' | ||
__VERSION__ = '0.3.3' | ||
BASE_FOLDER = os.path.dirname(__file__) | ||
STREAMS_FOLDER = os.path.join(BASE_FOLDER, "streams") | ||
|
||
|
||
def get_all_streams(): | ||
streams = [] | ||
for subdir, dirs, files in os.walk(STREAMS_FOLDER): | ||
for sdir in dirs: | ||
data_file = os.path.join(STREAMS_FOLDER, sdir, 'data.json') | ||
if os.path.isfile(data_file): | ||
streams.append(sdir) | ||
|
||
return streams |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Radio Bio Bio Santiago de Chile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
""" | ||
Iterate over priority domains and send data to server | ||
""" | ||
import argparse | ||
import json | ||
import logging.config | ||
from yaasr import get_all_streams | ||
from yaasr.recorder.stream import YStream | ||
|
||
|
||
def ls(test_streams=False): | ||
""" List all available streams """ | ||
# list all streams | ||
streams = get_all_streams() | ||
for stream in streams: | ||
ys = YStream(stream) | ||
ys.load() | ||
print(f'{stream}: {ys.streams[0]["url"]}') | ||
if test_streams: | ||
ys.record(total_seconds=30, chunk_bytes_size=512, chunk_time_size=1000) | ||
|
||
|
||
def info(stream): | ||
""" Shows stream info """ | ||
# list all streams | ||
ys = YStream(stream) | ||
ys.load() | ||
data = json.dumps(ys.data, indent=4) | ||
print(data) | ||
|
||
|
||
def record(stream, total_seconds=300, chunk_bytes_size=256, chunk_time_size=60): | ||
""" Shows stream info """ | ||
# list all streams | ||
ys = YStream(stream) | ||
ys.load() | ||
ys.record(total_seconds=total_seconds, chunk_bytes_size=chunk_bytes_size, chunk_time_size=chunk_time_size) | ||
|
||
|
||
def main(): | ||
logging.config.fileConfig('yaasr/log.conf') | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument('command', help='Command to run') | ||
parser.add_argument('--log_level', nargs='?', default='INFO', type=str) | ||
parser.add_argument('--stream', nargs='?', default=None, type=str) | ||
parser.add_argument('--total_seconds', nargs='?', default=300, type=int) | ||
parser.add_argument('--chunk_bytes_size', nargs='?', default=256, type=int) | ||
parser.add_argument('--chunk_time_size', nargs='?', default=60, type=int) | ||
|
||
args = parser.parse_args() | ||
|
||
if args.command == 'ls': | ||
return ls() | ||
elif args.command == 'test': | ||
return ls(test_stream=True) | ||
elif args.command == 'info': | ||
return info(stream=args.stream) | ||
elif args.command == 'record': | ||
return record( | ||
stream=args.stream, | ||
total_seconds=args.total_seconds, | ||
chunk_bytes_size=args.chunk_bytes_size, | ||
chunk_time_size=args.chunk_time_size) |