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
videosite-irssi: Fix typos in config conversion
[videosite.git]
/
libvideosite.pm
diff --git
a/libvideosite.pm
b/libvideosite.pm
index
bebc8a5
..
4252338
100644
(file)
--- a/
libvideosite.pm
+++ b/
libvideosite.pm
@@
-1,3
+1,12
@@
+# library to autodownload flash videos
+#
+# (c) 2007-2008 by Ralf Ertzinger <ralf@camperquake.de>
+# licensed under GNU GPL v2
+#
+# Based on youtube.pl by Christian Garbs <mitch@cgarbs.de>
+# which in turn is
+# based on trigger.pl by Wouter Coekaerts <wouter@coekaerts.be>
+
package libvideosite;
require Exporter;
package libvideosite;
require Exporter;
@@
-37,7
+46,8
@@
my $defaultconfig = {
'_immutable' => '1',
'schemas' => {},
}
'_immutable' => '1',
'schemas' => {},
}
- }
+ },
+ 'config-version' => '2',
};
#
};
#
@@
-130,11
+140,13
@@
sub _io {
my @text = @_;
my $format;
my @text = @_;
my $format;
+ @text = ('') unless(@text);
+
# 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);
#
@@
-171,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);
}
@@
-181,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);
}
}
}
}
@@
-987,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