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

Feature - RAAR record handler - Add effective recording duration #7

Merged

Conversation

paraenggu
Copy link
Member

The following PR enhances the RAAR record handler script, so that it adds the effective recording duration to the final file name.

Previously, rotter was configured to add a fixed duration of 60 minutes to every file name (%%FT%%H%%M%%S%%z_060.flac), regardless of the actual track duration.

rotter creates a new recording file at the start of the new hour. During the initial start or in case a recording fails, the recording file won't have a duration of 60 minutes. This PR addresses these edge-cases and ensures that the effective recording duration will be added to the final file name.

rotter will now be started without a fixed duration encoded into the file name. The record handler will then determine the recording duration with the help of ffprobe and add it to the recording file name in the ISO 8601 duration format in seconds.

For example, a one hour (3600 seconds) rotter recording file
/var/lib/rotter/raar/2019-11-30T170000+0100.flac will be renamed and moved to /var/tmp/raar/import/2019-11-30T170000+0100_PT3600S.flac waiting for the RAAR importer to pick it up.

This addresses #6

The duration of the recording will be added by the raar-record-handler,
which adds the effective track duration to the file name.
@coveralls
Copy link

coveralls commented Dec 1, 2019

Coverage Status

Coverage remained the same at 97.805% when pulling f1ed085 on paraenggu:feature/rrh-add-effective-recording-duration into 6206ff0 on radiorabe:master.

Copy link
Contributor

@codez codez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great otherwise, squash & merge!

echo "Duration of recording is ${duration} seconds (${ffprobeOutput})"
else
echo "Unable to determine duration of recording" >&2
duration="0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If nobody actively looks at stderr, theses errors will remain unnoticed. The filenames will contain a duration of zero seconds and therefore will not be imported by raar. So it is important to get a notification in Zabbix if this fails. Can zabbix_sender be used for this?
When a notification is received, an administrator could manually check the length of the recording and adjust the filename accordingly, so it would be imported in the next run.

Copy link
Member Author

@paraenggu paraenggu Dec 6, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed and force-pushed - thanks @codez

The recording file will now be skipped if the duration couldn't be determined. E.g. ffprobe exited with a non-zero exit status or the output doesn't look like an integer or float.

Skipping the recording file, won't trigger the existing zabbix_sender command which in turn won't send a successful recording notification to the monitoring system. Thus, the monitoring system will trigger an alarm, as it's missing the last successful recording notification timestamp.

The failed recording file is still available within the rotter recording directory for a later analysis.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Determine the recording duration with the help of ffprobe. Add the
rounded duration in seconds to the file name in the ISO 8601 duration
format.

For example, the original recording file name "2019-11-30T170000+0100.flac"
will be renamed to "2019-11-30T170000+0100_PT3600S.flac", whereas
3600 is the duration in seconds for this recording.

This implements radiorabe#6.
Updated the recording README with installation instructions for the
ffprobe command which is used for determining the recording duration.

Required for radiorabe#6.
@paraenggu paraenggu force-pushed the feature/rrh-add-effective-recording-duration branch from abe4f39 to f1ed085 Compare December 6, 2019 08:27
@paraenggu
Copy link
Member Author

paraenggu commented Dec 13, 2019

Hi @codez, is there anything left you would like me to change or can we merge this PR?

As soon as this has been merged, we should coordinate and plan the rollout to perform some live tests.

@codez
Copy link
Contributor

codez commented Dec 14, 2019

Everything looks good. I do not have that much time in the next couple of weeks. Would it be possible to rollout this version just for one recorder first, so we would always have a fallback available?

@codez codez merged commit 1a83875 into radiorabe:master Dec 22, 2019
@paraenggu paraenggu deleted the feature/rrh-add-effective-recording-duration branch December 22, 2019 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants