Ticket #5319: myth_time_zone.pl

File myth_time_zone.pl, 826 bytes (added by sphery <mtdean@…>, 12 years ago)

Replaces myth_timezone.pl

Line 
1#!/usr/bin/perl -w
2#
3# Queries the timezone on the MythTV master backend
4#
5# Automatically detects database settings.
6#
7
8# Includes
9    use DBI;
10    use Getopt::Long;
11    use MythTV;
12
13# Some variables we'll use here
14    our ($usage);
15    our $BACKEND_SEP_rx = qr/\[\]:\[\]/;
16
17# Load the cli options
18    GetOptions('usage|help|h'                  => \$usage
19              );
20
21# Print usage
22    if ($usage) {
23        print <<EOF;
24$0 usage:
25
26options:
27
28--help
29
30    Show this help text.
31
32EOF
33        exit;
34    }
35
36# Connect to mythbackend
37    my $Myth = new MythTV();
38
39# Query the timezone
40    my $response = $Myth->backend_command('QUERY_TIME_ZONE');
41
42    my ($id, $offset, $time) = split($BACKEND_SEP_rx, $response);
43
44    print("Current Timezone Information\n      id: $id\n  ".
45          "offset: $offset\n    time: $time\n");
46
47