From 3b16908085ed08ac70b1468357761c4307f31f07 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sat, 14 Apr 2018 15:15:53 +0200 Subject: manual_youtube --- odin/strm/cleanup_youtube | 0 odin/strm/download_youtube | 0 odin/strm/manual_youtube | 62 ++++++++++++++++++++++++++++++++++++++++++++++ odin/strm/rss_staggered | 0 odin/strm/send_kitty | 0 5 files changed, 62 insertions(+) mode change 100755 => 100644 odin/strm/cleanup_youtube mode change 100755 => 100644 odin/strm/download_youtube create mode 100644 odin/strm/manual_youtube mode change 100755 => 100644 odin/strm/rss_staggered mode change 100755 => 100644 odin/strm/send_kitty (limited to 'odin/strm') diff --git a/odin/strm/cleanup_youtube b/odin/strm/cleanup_youtube old mode 100755 new mode 100644 diff --git a/odin/strm/download_youtube b/odin/strm/download_youtube old mode 100755 new mode 100644 diff --git a/odin/strm/manual_youtube b/odin/strm/manual_youtube new file mode 100644 index 00000000..943ae5d4 --- /dev/null +++ b/odin/strm/manual_youtube @@ -0,0 +1,62 @@ +#!@perl@/bin/perl + +use utf8; +use strict; +use warnings; + +use Email::MIME; + +use Email::Date::Format qw(email_date); + +our $fromMail = "$ENV{'USER'}\@odin.asgard.yggdrasil"; +our $fromName = "manual"; + +my $i = 0; + +my @tags = (); +for (my $j = 0; $j < $#ARGV; $j++) +{ + next unless ($ARGV[$j] eq "--"); + + @tags = @ARGV[0 .. $j - 1]; + @ARGV = @ARGV[$j + 1 .. $#ARGV]; + last; +} + +# use Data::Dumper; +# print Dumper(@tags, @ARGV); +# exit 1; + +foreach my $url (@ARGV) +{ + my $title; + open(my $fh, '-|', "@youtubedl@/bin/youtube-dl --restrict-filenames --get-title --no-playlist -- '$url'") || die "Could not spawn youtube-dl"; + $title = <$fh>; + close($fh); + die "youtube-dl could not extract title" unless (defined($title)); + chomp($title); + + my $mail = Email::MIME->create( + header_str => [ + From => "$fromName <$fromMail>", + To => 'gkleen@odin.asgard.yggdrasil', + Subject => $title, + 'X-RSS-URL' => $url, + Date => email_date(time() + ($i++)) + ], + attributes => { + content_type => 'text/html', + encoding => '7bit', + charset => 'US-ASCII' + }, + body => "$title\n" + ); + + my @args = (); + push @args, (('junk') x 5); + push @args, @tags; + + open($fh, '|-', "rss_deliver", @args) || die "Could not spawn rss_deliver"; + print $fh $mail->as_string; + close($fh); +} diff --git a/odin/strm/rss_staggered b/odin/strm/rss_staggered old mode 100755 new mode 100644 diff --git a/odin/strm/send_kitty b/odin/strm/send_kitty old mode 100755 new mode 100644 -- cgit v1.2.3