Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix recording #3

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions app/recorders/tunein.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ async def _grab(self):

# append to file
logger.debug(f'Grabbing segment: {segment.timestamp}')
working_dir = Path('/data/MSNBC/')
working_dir = Path('/volume2/docker/RadioRecorder/MSNBC/')
working_dir.mkdir(parents=True, exist_ok=True)
path = working_dir.joinpath(filename)
async with aiofiles.open(path, 'ab') as file:
Expand Down Expand Up @@ -179,12 +179,14 @@ def _get_sleep_time(self, lines: [str]) -> int:
:return: sleep time, which determines how long to wait between starting the next iteration
"""

available_duration = None
for line in lines:
if line.startswith('#EXT-X-COM-TUNEIN-AVAIL-DUR:'):
try:
available_duration = float(line.replace('#EXT-X-COM-TUNEIN-AVAIL-DUR:', ''))
except ValueError:
pass
break
return available_duration * 4 // 5 if available_duration else self.DEFAULT_SLEEP_TIME
return 60

# available_duration = None
# for line in lines:
# if line.startswith('#EXT-X-COM-TUNEIN-AVAIL-DUR:'):
# try:
# available_duration = float(line.replace('#EXT-X-COM-TUNEIN-AVAIL-DUR:', ''))
# except ValueError:
# pass
# break
# return available_duration * 4 // 5 if available_duration else self.DEFAULT_SLEEP_TIME