Skip to content

Commit

Permalink
Merge pull request #61 from techman83/cherry-pick_2015
Browse files Browse the repository at this point in the history
Cherry pick 2015
  • Loading branch information
techman83 committed Jan 29, 2015
2 parents 715f68d + 814bc2f commit c35b158
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 1 deletion.
2 changes: 1 addition & 1 deletion bin/station-sync.sh → bin/eventstreamr-sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ RECORD_BASE=$1
STORAGE_SERVER=$2
STORAGE_BASE=$3
ROOM=$4
DATE=$5

RATE_LIMIT_KBPS="10240"

while true; do
# don't run too frequently: rsync blips the CPU
sleep 60

DATE=`date +%Y%m%d`
RECORD_PATH="${RECORD_BASE}"

if [ -z "${ROOM}" ]; then
Expand Down
2 changes: 2 additions & 0 deletions lib/App/EventStreamr/Config.pm
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ has 'record_path' => ( is => 'rw', lazy => 1, default => sub { '/tmp/$room/$da
has 'run' => ( is => 'rw', lazy => 1, default => sub { '0' } );
has 'control' => ( is => 'rw' );
has 'stream' => ( is => 'rw' );
has 'sync' => ( is => 'rw' );
has 'pid' => ( is => 'ro', lazy => 1, builder => 1);
has 'log_level' => ( is => 'ro', default => sub { 'INFO, LOG1' } );
has 'mixer' => (
Expand Down Expand Up @@ -147,6 +148,7 @@ method _clean_config() {
backend => $self->backend,
roles => $self->roles,
stream => $self->stream,
sync => $self->sync,
mixer => $self->mixer,
control => $self->control,
devices => $self->devices,
Expand Down
23 changes: 23 additions & 0 deletions lib/App/EventStreamr/DVswitch/Sync.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package App::EventStreamr::DVswitch::Sync;
use Method::Signatures;
use Moo;
use namespace::clean;

# ABSTRACT: Sync

# VERSION: Generated by DZP::OurPkg:Version

=head1 SYNOPSIS
Manage Sync process.
=head1 DESCRIPTION
Manage all the configured devices designated to be
running as ingest roles.
=cut

extends 'App::EventStreamr::Sync';

1;
45 changes: 45 additions & 0 deletions lib/App/EventStreamr/Sync.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package App::EventStreamr::Sync;
use Method::Signatures;
use POSIX 'strftime';
use Moo;
use namespace::clean;

# ABSTRACT: An EventStreamr Sync Process

# VERSION: Generated by DZP::OurPkg:Version

=head1 SYNOPSIS
This manages the internal EventStreamr API
=head1 DESCRIPTION
This largely extends L<App::EventStreamr::Process>, provides
default cmds that can be overridden in the configuration.
=cut

extends 'App::EventStreamr::Process';

has 'cmd' => ( is => 'ro', lazy => 1, builder => 1 );
has 'id' => ( is => 'ro', default => sub { 'sync' } );
has 'type' => ( is => 'ro', default => sub { 'sync' } );

# TODO: This is horrible, we handle date stuff in a terrible way.
method _build_cmd() {
$self->{status}{$self->{id}}{date} = strftime "%Y-%m-%d", localtime;

$self->{status}{$self->{id}}{record_path} = $self->{config}{record_path};

my %cmd_vars = (
room => $self->{config}{room},
date => $self->{status}{$self->{id}}{date},
);

$self->{status}{$self->{id}}{record_path} =~ s/\$(\w+)/$cmd_vars{$1}/g;

# TODO: ... yucky. Improve this
return "eventstreamr-sync.sh $self->{status}{$self->{id}}{record_path} $self->{config}{sync}{host} $self->{config}{sync}{path} $self->{config}{room} $self->{status}{$self->{id}}{date}";
}

1;

0 comments on commit c35b158

Please sign in to comment.