From 7ca0962d94864a5c1d8ad8a23892accb9efc82e3 Mon Sep 17 00:00:00 2001 From: Alex 'AdUser' Z Date: Wed, 27 May 2015 19:28:19 +1000 Subject: [PATCH] - drop 'defaults' section from config --- twatch-lite | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/twatch-lite b/twatch-lite index a68304c..0eb9971 100755 --- a/twatch-lite +++ b/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 - -This is default values for each configured feed. - -=head3 C - -Use this field in RSS/ATOM entry as link to torrent file. For now, only acceptable value is 'link'. - -=head3 C - -Lookup this field in RSS/ATOM entry for wanted keywords. Acceptable values: 'body', 'title' (default). - =head2 Section C 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, C +=head3 C + +Lookup this field in RSS/ATOM entry for wanted keywords. Acceptable values: 'body', 'title' (default). + +=head3 C -Normally this options uses values from C 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