/usr/bin/lyricue_remote is in lyricue 4.0.13.isreally.4.0.12-0ubuntu1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | #!/usr/bin/env perl
#****** lyricue_remote/setup
# NAME
# Setup section
# DESCRIPTION
# Loads required modules, sets some global variables,
# and other global things
# SOURCE
#
#
# Modules we use.
#
use strict;
use warnings;
use POSIX;
use IO::Socket::INET;
my $profile = "Default";
if ($ARGV[0]) {
foreach (0 .. (@ARGV - 1)) {
if ($ARGV[$_] eq "-v") {
print "Lyricue Remote\n";
exit;
} elsif ($ARGV[$_] eq "-p") {
$profile = $ARGV[$_ + 1];
$ARGV[$_ + 1] = "";
} elsif ($ARGV[$_] eq "-h") {
print "\nUsage: lyricue_remote <-v> <-s> <command>\n\n";
print "\t-v: Prints Lyricue version information & exits\n";
print "\t-p profile: Sets the profile to send messsages to\n";
print "\tcommand: Can be any of next_page, prev_page, next_song, prev_song,\n";
print "\t next_point, blank, osd, close or custom\n";
print "\t If custom then the next 3 arguments will be sent without parsing\n";
print "\t to the server\n";
exit;
} elsif ($ARGV[$_] eq "") {
# ignore
} elsif ($ARGV[$_] eq "next_page") {
update_display("display", "next_page", "");
} elsif ($ARGV[$_] eq "next_song") {
update_display("display", "next_song", "");
} elsif ($ARGV[$_] eq "prev_page") {
update_display("display", "prev_page", "");
} elsif ($ARGV[$_] eq "prev_song") {
update_display("display", "prev_song", "");
} elsif ($ARGV[$_] eq "blank") {
update_display("blank", "", "");
} elsif ($ARGV[$_] eq "next_point") {
update_display("next_point", "", "");
} elsif ($ARGV[$_] eq "close") {
system("pkill -f lyricue_display");
system("pkill -9 -f lyricue_display");
} elsif ($ARGV[$_] eq "osd") {
my $osd = "";
if ($ARGV[$_+1]) {
$osd = $ARGV[$_+1];
$osd =~ s/:/#SEMI#/g;
$osd =~ s/\n/#BREAK#/g;
}
update_display("osd",$ARGV[$_+2], $osd);
} elsif ($ARGV[$_] eq "custom") {
update_display($ARGV[$_+1],$ARGV[$_+2],$ARGV[$_+3]);
exit;
}
}
}
#***
#****f* lyricue_remote/update_display
# NAME
# update_display --
# SYNOPSIS
# update_display ($command, $primary, $secondary)
# FUNCTION
# Open a connection the the server and send a command. Status is returned
# INPUTS
# $command - Command to send
# $primary - First parameter to send
# $secondary - Second parameter to send
# OUTPUT
# Updated display
# SOURCE
#
sub update_display {
my ($command, $primary, $secondary) = @_;
if (!defined($secondary)) {
$secondary = "";
}
if (!defined($primary)) {
$primary = "";
}
my @lines = split("\n",`mysql -s -N -ulyric lyricDb -e 'SELECT host FROM status WHERE type LIKE "%normal%" OR type LIKE "%simple%" OR type LIKE "%headless%"'`);
foreach my $entry (@lines) {
my ($hostname,$port) = split(":", $entry,2);
if ( my $server = IO::Socket::INET->new(
Proto => "tcp",
PeerAddr => $hostname,
PeerPort => $port
)) {
print $server $command . ":" . $primary . ":" . $secondary . "\n";
if (defined(my $status = <$server>)) {
print $status;
}
close($server);
}
}
}
#***
|