git://git.camperquake.de
/
videosite.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Base: fix typo
[videosite.git]
/
libvideosite.pm
diff --git
a/libvideosite.pm
b/libvideosite.pm
index
38aba57
..
b53673c
100644
(file)
--- 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",
# 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);
#
$format = $outputprefix . shift(@text);
#
@@
-183,6
+183,9
@@
sub _recursive_hash_walk {
sub _colorpair {
my ($fg, $bg) = @_;
sub _colorpair {
my ($fg, $bg) = @_;
+ $fg = defined($fg)?$fg:'default';
+ $bg = defined($bg)?$bg:'default';
+
return $remote_api->{color}->($fg, $bg);
}
return $remote_api->{color}->($fg, $bg);
}
@@
-193,8
+196,8
@@
sub _init_config_item {
my $path = shift;
my $value = shift;
my $path = shift;
my $value = shift;
- unless(
$remote_api->{config_has}->
($path)) {
-
$remote_api->{config_set}->
($path, $value);
+ unless(
_config_has
($path)) {
+
_config_set
($path, $value);
}
}
}
}
@@
-336,7
+339,7
@@
sub _config_list_add {
@c = ();
}
@c = ();
}
- _debug("Adding %s to list %s", $item, join(".",
$path
));
+ _debug("Adding %s to list %s", $item, join(".",
@{$path}
));
unless(grep { $_ eq $item } @c) {
push(@c, $item);
};
unless(grep { $_ eq $item } @c) {
push(@c, $item);
};
@@
-356,7
+359,7
@@
sub _config_list_del {
return;
}
return;
}
- _debug("Removing %s from list %s", $item, join('.',
$path
));
+ _debug("Removing %s from list %s", $item, join('.',
@{$path}
));
@c = map { $item ne $_ } split(/\s*,\s*/, _config_get($path));
_config_set($path, join('.', @c));
@c = map { $item ne $_ } split(/\s*,\s*/, _config_get($path));
_config_set($path, join('.', @c));
@@
-373,7
+376,7
@@
sub _config_list_has {
return 0;
}
return 0;
}
- _debug("Checking for %s in list %s", $item, join('.',
$path
));
+ _debug("Checking for %s in list %s", $item, join('.',
@{$path}
));
return grep { $item eq $_ } split(/\s*,\s*/, _config_get($path));
}
return grep { $item eq $_ } split(/\s*,\s*/, _config_get($path));
}
@@
-384,7
+387,7
@@
sub _config_list_has {
sub _config_list_set {
my $path = shift;
sub _config_list_set {
my $path = shift;
- _debug("Replacing %s with (%s)", join('.',
$path
), join(",", @_));
+ _debug("Replacing %s with (%s)", join('.',
@{$path}
), join(",", @_));
_config_set($path, join(',', @_));
}
_config_set($path, join(',', @_));
}
@@
-727,7
+730,7
@@
sub _cmd_connector {
return;
}
return;
}
- unless (_config_list_has(['defined-connectors'])) {
+ unless (_config_list_has(['defined-connectors']
, $name
)) {
_io("Connector does not exist");
return;
}
_io("Connector does not exist");
return;
}
@@
-999,32
+1002,32
@@
sub check_for_link {
if ('download' eq _config_get(['mode'])) {
_io(
sprintf('%s>>> %sSaving %s%%s%s %s%%s',
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)) {
),
$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',
}
} 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 {
),
$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
}
# Remove the matched part from the message and try again (there may be