From 25acf325139cc0f7ce59406bc083258aa1e8bfee Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Wed, 25 May 2016 15:50:25 +0200 Subject: moved inspectors to test dir diff --git a/cba-inspect b/cba-inspect deleted file mode 100755 index 6eceeaf..0000000 --- a/cba-inspect +++ /dev/null @@ -1,96 +0,0 @@ -#!/usr/bin/perl -w -# -# -# rhautoimport -# -# Copyright (C) 2009-2016 Christian Pointner -# -# This file is part of rhautoimport. -# -# rhautoimport is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# any later version. -# -# rhautoimport is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with rhautoimport. If not, see . -# - -use strict; -use attributes; -use Date::Calc; -use XML::Feed; -use XML::Feed::Entry; -use XML::Feed::Content; -use XML::Feed::Enclosure; -use URI::URL; -use HTML::Entities; - -use lib '../rhrdlibs/lib/'; -use lib '/usr/local/share/rhautoimport/'; -use rhautoimport; - -use Data::Dumper::Simple; - -$XML::Feed::MULTIPLE_ENCLOSURES=1; - -if($#ARGV != 0) { - print "Usage: cba-inspect \n"; - exit 1; -} -my $RSS_URL = $ARGV[0] . "?c=Kfs2IoV2Wmd"; - -binmode(STDIN, ":utf8"); -binmode(STDOUT, ":utf8"); -binmode(STDERR, ":utf8"); - -my ($feed, $errstr) = rhautoimport::fetch_parse_rss($RSS_URL); -unless (defined $feed) { - print "Error fetching feed: $errstr\n"; - exit 1; -} - -my $uri = ""; -my $file = ""; -my $sum_title = ""; -my $sum_text = ""; - -my $i = 0; -for my $entry ($feed->entries) { - $i++; - next unless $entry->enclosure; - - $sum_title = decode_entities($entry->title); - $sum_text = decode_entities($entry->content->body); - my $broadcast_date = $entry->{'entry'}{'broadcastDate'}; - $broadcast_date = '' unless (defined $broadcast_date); - - print $sum_title . ":\n"; - print " Issued: " . $entry->issued . "\n"; - print " Broadcast: " . $broadcast_date . "\n"; - print " Files:\n"; - - my $j = 0; - for my $enclosure($entry->enclosure) { - $j++; - if($enclosure->type eq "audio/mpeg" || $enclosure->type eq "audio/ogg") { - my $orig_uri = $enclosure->url; - if($orig_uri =~ /^(.*)_cut(\.[^\.]+)$/) { - $orig_uri = $1 . $2; - } - $uri = new URI::URL($orig_uri); - my @path = $uri->path_components; - $file = $path[-1]; - - print " $j: (" . $enclosure->type . ", " . $enclosure->length . ") " . $file . "\n"; - } - } - print "\n"; -} - -exit 0; diff --git a/test/cba-inspect b/test/cba-inspect new file mode 100755 index 0000000..b8546bd --- /dev/null +++ b/test/cba-inspect @@ -0,0 +1,99 @@ +#!/usr/bin/perl -w +# +# +# rhautoimport +# +# Copyright (C) 2009-2016 Christian Pointner +# +# This file is part of rhautoimport. +# +# rhautoimport is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# any later version. +# +# rhautoimport is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with rhautoimport. If not, see . +# + +use strict; +use attributes; +use Date::Calc; +use XML::Feed; +use XML::Feed::Entry; +use XML::Feed::Content; +use XML::Feed::Enclosure; +use URI::URL; +use HTML::Entities; + +use lib '../../rhrdlibs/lib/'; +use lib '../'; +use rhautoimport; + +use Data::Dumper::Simple; + +$XML::Feed::MULTIPLE_ENCLOSURES=1; + +if($#ARGV != 0) { + print "Usage: cba-inspect \n"; + exit 1; +} +my $RSS_URL = $ARGV[0] . "?c=Kfs2IoV2Wmd"; + +binmode(STDIN, ":utf8"); +binmode(STDOUT, ":utf8"); +binmode(STDERR, ":utf8"); + +my ($feed, $errstr) = rhautoimport::fetch_parse_rss($RSS_URL); +unless (defined $feed) { + print "Error fetching feed: $errstr\n"; + exit 1; +} + +my $uri = ""; +my $file = ""; +my $sum_title = ""; +my $sum_text = ""; + +my $i = 0; +for my $entry ($feed->entries) { + $i++; + next unless $entry->enclosure; + + $sum_title = decode_entities($entry->title); + $sum_text = decode_entities($entry->content->body); + my $production_date = $entry->{'entry'}{'productionDate'}; + $production_date = '' unless (defined $production_date); + my $broadcast_date = $entry->{'entry'}{'broadcastDate'}; + $broadcast_date = '' unless (defined $broadcast_date); + + print $sum_title . ":\n"; + print " Issued: " . $entry->issued . "\n"; + print " Production: " . $production_date . "\n"; + print " Broadcast: " . $broadcast_date . "\n"; + print " Files:\n"; + + my $j = 0; + for my $enclosure($entry->enclosure) { + $j++; + if($enclosure->type eq "audio/mpeg" || $enclosure->type eq "audio/ogg") { + my $orig_uri = $enclosure->url; + if($orig_uri =~ /^(.*)_cut(\.[^\.]+)$/) { + $orig_uri = $1 . $2; + } + $uri = new URI::URL($orig_uri); + my @path = $uri->path_components; + $file = $path[-1]; + + print " $j: (" . $enclosure->type . ", " . $enclosure->length . ") " . $file . "\n"; + } + } + print "\n"; +} + +exit 0; diff --git a/test/rss-inspect b/test/rss-inspect new file mode 100755 index 0000000..3494e7c --- /dev/null +++ b/test/rss-inspect @@ -0,0 +1,96 @@ +#!/usr/bin/perl -w +# +# +# rhautoimport +# +# Copyright (C) 2009-2016 Christian Pointner +# +# This file is part of rhautoimport. +# +# rhautoimport is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# any later version. +# +# rhautoimport is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with rhautoimport. If not, see . +# + +use strict; +use attributes; +use Date::Calc; +use XML::Feed; +use XML::Feed::Entry; +use XML::Feed::Content; +use XML::Feed::Enclosure; +use URI::URL; +use HTML::Entities; + +use lib '../../rhrdlibs/lib/'; +use lib '../'; +use rhautoimport; + +use Data::Dumper::Simple; + +$XML::Feed::MULTIPLE_ENCLOSURES=1; + +if($#ARGV != 0) { + print "Usage: rss-inspect \n"; + exit 1; +} +my $RSS_URL = $ARGV[0]; + +binmode(STDIN, ":utf8"); +binmode(STDOUT, ":utf8"); +binmode(STDERR, ":utf8"); + +my ($feed, $errstr) = rhautoimport::fetch_parse_rss($RSS_URL); +unless (defined $feed) { + print "Error fetching feed: $errstr\n"; + exit 1; +} + +my $uri = ""; +my $file = ""; +my $sum_title = ""; +my $sum_text = ""; + +my $i = 0; +for my $entry ($feed->entries) { + $i++; + next unless $entry->enclosure; + + $sum_title = decode_entities($entry->title); + $sum_text = decode_entities($entry->content->body); + my $guid = $entry->{'entry'}{'guid'}; + $guid = '' unless (defined $guid); + + print $sum_title . ":\n"; + print " Issued: " . $entry->issued . "\n"; + print " guid: " . $guid. "\n"; + print " Files:\n"; + + my $j = 0; + for my $enclosure($entry->enclosure) { + $j++; + if($enclosure->type eq "audio/mpeg" || $enclosure->type eq "audio/ogg") { + my $orig_uri = $enclosure->url; + if($orig_uri =~ /^(.*)_cut(\.[^\.]+)$/) { + $orig_uri = $1 . $2; + } + $uri = new URI::URL($orig_uri); + my @path = $uri->path_components; + $file = $path[-1]; + + print " $j: (" . $enclosure->type . ", " . $enclosure->length . ") " . $file . "\n"; + } + } + print "\n"; +} + +exit 0; -- cgit v0.10.2