From f4385cf2da40d688c5139382567817070f5fe70f Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Sat, 6 Feb 2016 18:10:24 +0000 Subject: [PATCH] Move argument parsing into script --- lib/App/XMMS2/Notifier.pm | 10 ++-------- xmms2-notifier | 5 ++++- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/App/XMMS2/Notifier.pm b/lib/App/XMMS2/Notifier.pm index d04b638..f61a74a 100644 --- a/lib/App/XMMS2/Notifier.pm +++ b/lib/App/XMMS2/Notifier.pm @@ -7,18 +7,11 @@ our $VERSION = 0.001001; use Audio::XMMSClient 0.03; use Gtk2::Notify 0.05 -init,'xmms2-notifyd'; -use Getopt::Long; - use constant CONVERSION_SPECIFIERS => qw/bitrate date sample_format url id channels samplerate tracknr genre artist album title/; ################################################## -my $format = '$artist - $title'; - -GetOptions ( - "format=s" => \$format, -); - +my $format; my $xmms = Audio::XMMSClient->new('xmms2-notifyd'); my $notify = Gtk2::Notify->new(''); @@ -53,6 +46,7 @@ sub on_playback_status { } sub run { + $format = $_[0]; while (1) { last if ($xmms->connect); sleep 1 diff --git a/xmms2-notifier b/xmms2-notifier index 262d6b5..a4812ae 100755 --- a/xmms2-notifier +++ b/xmms2-notifier @@ -3,8 +3,11 @@ use v5.14; use warnings; use App::XMMS2::Notifier; +use Getopt::Long; -App::XMMS2::Notifier->run +my $format = '$artist - $title'; +GetOptions ("format=s" => \$format); +App::XMMS2::Notifier::run($format) __END__ -- 2.30.2