« lib/Bb/Collaborate/Ultra/Session/Log/Attendee.pm
↑ Summary
lib/Bb/Collaborate/Ultra/Connection/Token.pm »
| 1 | use 5.10.1; | ||
| 2 | use warnings; use strict; | ||
| 3 | use Bb::Collaborate::Ultra; | ||
| 4 | use Bb::Collaborate::Ultra::Connection; | ||
| 5 | use Bb::Collaborate::Ultra::Session; | ||
| 6 | use Getopt::Long; | ||
| 7 | use Pod::Usage; | ||
| 8 | |||
| 9 | =head1 NAME | ||
| 10 | |||
| 11 | bb-collab-session-log - session log report for Blackboard Collaborate Ultra | ||
| 12 | |||
| 13 | =head1 SYNOPSIS | ||
| 14 | |||
| 15 | bb-collab-session-log --host=URL --issuer=USER --secret=PASS [query-opts] | ||
| 16 | |||
| 17 | =head2 Authentication Options | ||
| 18 | |||
| 19 | -h --host=<url> # hostname or web address | ||
| 20 | -u --issuer=<username> # issuer/username | ||
| 21 | -p --secret=<password> # secret/password | ||
| 22 | |||
| 23 | =head2 Query Options | ||
| 24 | |||
| 25 | --name=<session-name> # filter by session name | ||
| 26 | --session-id=<Id> # filter by session ID | ||
| 27 | --context-id=<Id> # filter by context ID | ||
| 28 | --user-id=<Id> # filter by user ID (select only | ||
| 29 | # sessions attended by this user_/ | ||
| 30 | |||
| 31 | =head2 Information | ||
| 32 | |||
| 33 | -? --help # print this help | ||
| 34 | -v --version # print version and exit | ||
| 35 | --dump=yaml # output created sessions as YAML | ||
| 36 | --debug # enable debugging | ||
| 37 | |||
| 38 | =head1 DESCRIPTION | ||
| 39 | |||
| 40 | Creates meetings on an Elluminate I<Live!> Manager (ELM) server. | ||
| 41 | |||
| 42 | =head1 SEE ALSO | ||
| 43 | |||
| 44 | perldoc Elive | ||
| 45 | |||
| 46 | http://search.cpan.org/dist/Elive | ||
| 47 | |||
| 48 | =cut | ||
| 49 | |||
| 50 | my %opt; | ||
| 51 | my $ok = GetOptions( | ||
| 52 | \%opt, | ||
| 53 | 'host|h=s', | ||
| 54 | 'issuer|username|u=s', | ||
| 55 | 'secret|password|p=s', | ||
| 56 | 'contextId|context-id=s', | ||
| 57 | 'sessionId|session-id=s', | ||
| 58 | 'userId|user-id=s', | ||
| 59 | 'name=s', | ||
| 60 | 'debug|d', | ||
| 61 | 'help|h|?', | ||
| 62 | 'version|v', | ||
| 63 | ); | ||
| 64 | |||
| 65 | my $host = delete $opt{host}; | ||
| 66 | my $issuer = delete $opt{issuer}; | ||
| 67 | my $secret = delete $opt{secret}; | ||
| 68 | my $debug = delete $opt{debug}; | ||
| 69 | my $help = delete $opt{help}; | ||
| 70 | my $version = delete $opt{version}; | ||
| 71 | |||
| 72 | pod2usage(0) if $help; | ||
| 73 | |||
| 74 | if ($version) { | ||
| 75 | print "Bb::Collaborate::Ultra v${Bb::Collaborate::Ultra::VERSION} (c) 2017\n"; | ||
| 76 | exit(0); | ||
| 77 | }; | ||
| 78 | |||
| 79 | pod2usage(2) | ||
| 80 | unless $ok && $host && $issuer && $secret; | ||
| 81 | |||
| 82 | my $connection = Bb::Collaborate::Ultra::Connection->new({ | ||
| 83 | host => $host, issuer => $issuer, secret => $secret, | ||
| 84 | }); | ||
| 85 | |||
| 86 | $connection->debug(1) if $debug; | ||
| 87 | |||
| 88 | my $context_id = "6812E6A3EA4072D1425FA583BF59C5CD"; | ||
| 89 | my @sessions = Bb::Collaborate::Ultra::Session->get($connection, \%opt); | ||
| 90 | for my $session (@sessions) { | ||
| 91 | my @logs = $session->logs; | ||
| 92 | if (@logs) { | ||
| 93 | say "Session: ". $session->name; | ||
| 94 | } | ||
| 95 | for my $log (@logs) { | ||
| 96 | say "\tOpened: " .(scalar localtime $log->opened); | ||
| 97 | for my $attendee ($log->attendees) { | ||
| 98 | my $first_join; | ||
| 99 | my $elapsed = 0; | ||
| 100 | for my $attendance (@{$attendee->attendance}) { | ||
| 101 | my $joined = $attendance->joined; | ||
| 102 | $first_join = $joined | ||
| 103 | if !$first_join || $first_join > $joined; | ||
| 104 | $elapsed += $attendance->left - $joined; | ||
| 105 | } | ||
| 106 | my $user_id = $attendee->externalUserId || $attendee->userId; | ||
| 107 | say sprintf("\tUser %s (%s) joined at %s, stayed %d minutes", $user_id, $attendee->displayName, (scalar localtime $first_join), $elapsed / 60); | ||
| 108 | if ($elapsed) { | ||
| 109 | } | ||
| 110 | } | ||
| 111 | say "\tClosed: " .(scalar localtime $log->closed); | ||
| 112 | } | ||
| 113 | } |