Browse Source

- drop 'defaults' section from config

master
Alex 'AdUser' Z 9 years ago
parent
commit
7ca0962d94
  1. 27
      twatch-lite

27
twatch-lite

@ -51,8 +51,6 @@ sub load_config {
or do { _log(fatal => "Can't load config: $@"); };
_log(debug => "Sanity checks for config file");
_log(fatal => "Missing section `defaults` in config file")
unless (exists $config->{defaults} and ref $config->{defaults} eq 'HASH');
_log(fatal => "Missing section `feeds` in config file")
unless (exists $config->{feeds} and ref $config->{feeds} eq 'ARRAY');
_log(warn => "'outdir' not set in config, using /tmp"), $config->{outdir} = '/tmp'
@ -71,9 +69,8 @@ sub load_config {
_log(fatal => "Empty 'matches' section in feed")
unless (scalar @{ $feed->{matches} });
foreach my $key (qw(use lookup)) {
$feed->{$key} //= $config->{defaults}->{$key};
}
$feed->{use} //= 'link';
$feed->{lookup} //= 'title';
# TODO: more
($feed->{hostname}) = ($feed->{url} =~ m{://([a-z0-9\.-]+)}oi);
}
@ -278,18 +275,6 @@ If set - will use http proxy, when fetching rss and torrent-files. Otherwise wil
If set to any non-empty value, will accept and send back cookies in http-requests. Default - unset.
=head2 Section C<defaults>
This is default values for each configured feed.
=head3 C<use>
Use this field in RSS/ATOM entry as link to torrent file. For now, only acceptable value is 'link'.
=head3 C<lookup>
Lookup this field in RSS/ATOM entry for wanted keywords. Acceptable values: 'body', 'title' (default).
=head2 Section C<feeds>
Configured feeds.
@ -306,9 +291,13 @@ If feed entry matches ANY keyword, torrent file will be downloaded and stored to
Matches list must contain at least one keyword. If you want all torrents from this feed, use '/.*/' regex keyword.
=head3 C<lookup>, C<use>
=head3 C<lookup>
Lookup this field in RSS/ATOM entry for wanted keywords. Acceptable values: 'body', 'title' (default).
=head3 C<use>
Normally this options uses values from C<defaults> section, but you may override them for each feed you want.
Use this field in RSS/ATOM entry as link to torrent file. For now, only acceptable value is 'link'.
=head1 SEE ALSO

Loading…
Cancel
Save