diff options
author | Rasmus Steinke <rasi@xssn.at> | 2017-09-23 17:34:28 +0200 |
---|---|---|
committer | Rasmus Steinke <rasi@xssn.at> | 2017-09-23 17:34:28 +0200 |
commit | 5ec053649f3893f1e4a2323ea83ffac014b40c9f (patch) | |
tree | 9feb8c1d29ba1df80a2fe7404cf9764cecb384d5 | |
parent | 94d05d5ae1b57f54c4a56cda636cf07e820e6dc5 (diff) | |
download | perl-app-clerk-5ec053649f3893f1e4a2323ea83ffac014b40c9f.tar.gz perl-app-clerk-5ec053649f3893f1e4a2323ea83ffac014b40c9f.tar.xz |
add config file support for rating_client
-rw-r--r-- | clerk.conf | 3 | ||||
-rwxr-xr-x | clerk_rating_client | 14 |
2 files changed, 15 insertions, 2 deletions
@@ -2,6 +2,9 @@ # MPD_HOST will override this mpd_host=localhost +# music root for rating_client +music_root=/mnt/Music + # define file paths database=PLACEHOLDER/.config/clerk/database.mpk tmux_config=PLACEHOLDER/.config/clerk/clerk.tmux diff --git a/clerk_rating_client b/clerk_rating_client index 9662745..fa4034b 100755 --- a/clerk_rating_client +++ b/clerk_rating_client @@ -5,6 +5,7 @@ use v5.10; use warnings; use Array::Utils qw(:all); #use DDP; +use Config::Simple; use File::Spec; use strict; use utf8; @@ -13,9 +14,18 @@ use File::Find; use Getopt::Std; use Net::MPD; -my $mpd_host = "tauron"; +my $config_file = $ENV{'HOME'} . "/.config/clerk/clerk.conf"; + +if ($ENV{CLERK_CONF}) { + $config_file = $ENV{CLERK_CONF}; +} + +my $cfg = new Config::Simple(filename=>"$config_file"); +my $general_cfg = $cfg->param(-block=>"General"); +my $mpd_host = $general_cfg->{mpd_host}; +my $music_root = $general_cfg->{music_root}; + my $mpd = Net::MPD->connect($ENV{MPD_HOST} // $mpd_host // 'localhost'); -my $music_root = "/mnt/raid/Audio/Rips"; sub main { my %options=(); |