X-Git-Url: https://git.camperquake.de/gitweb.cgi?a=blobdiff_plain;f=libvideosite.pm;h=4252338b081b0e934294b7a743b337a9b5b2fbc3;hb=ac08a598f6a09beeb1e1ea5f7508a338cf7d5c1c;hp=ace6f81268eab5e1e73c7393e8078c8ed950e983;hpb=eb0fdb599af0e844cf3fe15773e3e2a3ecf0ff21;p=videosite.git diff --git a/libvideosite.pm b/libvideosite.pm index ace6f81..4252338 100644 --- a/libvideosite.pm +++ b/libvideosite.pm @@ -145,8 +145,8 @@ sub _io { # This will define the outputprefix once, so we don't have # do do this every time. $outputprefix = sprintf("%svideosite: %s", - $remote_api->{color}->('magenta'), - $remote_api->{color}->()) unless(defined($outputprefix)); + _colorpair('magenta'), + _colorpair()) unless(defined($outputprefix)); $format = $outputprefix . shift(@text); # @@ -183,6 +183,9 @@ sub _recursive_hash_walk { sub _colorpair { my ($fg, $bg) = @_; + $fg = defined($fg)?$fg:'default'; + $bg = defined($bg)?$bg:'default'; + return $remote_api->{color}->($fg, $bg); } @@ -999,32 +1002,32 @@ sub check_for_link { if ('download' eq _config_get(['mode'])) { _io( sprintf('%s>>> %sSaving %s%%s%s %s%%s', - $remote_api->{color}->('*red'), - $remote_api->{color}->(), - $remote_api->{color}->('*yellow'), - $remote_api->{color}->(), - $remote_api->{color}->('*green'), + _colorpair('*red'), + _colorpair(), + _colorpair('*yellow'), + _colorpair(), + _colorpair('*green'), ), $m->{'SOURCE'}, $m->{'TITLE'} ); unless($getter->get($m)) { - _io(sprintf('%s>>> FAILED', $remote_api->{color}->('*red'))); + _io(sprintf('%s>>> FAILED', _colorpair('*red'))); } } elsif ('display' eq _config_get(['mode'])) { _io( sprintf('%s>>> %sSaw %s%%s%s %s%%s', - $remote_api->{color}->('*magenta'), - $remote_api->{color}->(), - $remote_api->{color}->('*yellow'), - $remote_api->{color}->(), - $remote_api->{color}->('*green') + _colorpair('*magenta'), + _colorpair(), + _colorpair('*yellow'), + _colorpair(), + _colorpair('*green') ), $m->{'SOURCE'}, $m->{'TITLE'} ); } else { - _io(sprintf('%s>>> Invalid operation mode', $remote_api->{color}->('*red'))); + _io(sprintf('%s>>> Invalid operation mode', _colorpair('*red'))); } # Remove the matched part from the message and try again (there may be