diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2018-04-14 15:15:53 +0200 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2018-04-14 15:15:53 +0200 |
commit | 3b16908085ed08ac70b1468357761c4307f31f07 (patch) | |
tree | e0182beb7d4b9f3e5976fe859fd280092935c3f0 /odin/strm | |
parent | 3d5b157d230d9711e16d8c20499d86cfdd7bd569 (diff) | |
download | nixos-3b16908085ed08ac70b1468357761c4307f31f07.tar nixos-3b16908085ed08ac70b1468357761c4307f31f07.tar.gz nixos-3b16908085ed08ac70b1468357761c4307f31f07.tar.bz2 nixos-3b16908085ed08ac70b1468357761c4307f31f07.tar.xz nixos-3b16908085ed08ac70b1468357761c4307f31f07.zip |
manual_youtube
Diffstat (limited to 'odin/strm')
-rw-r--r--[-rwxr-xr-x] | odin/strm/cleanup_youtube | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | odin/strm/download_youtube | 0 | ||||
-rw-r--r-- | odin/strm/manual_youtube | 62 | ||||
-rw-r--r--[-rwxr-xr-x] | odin/strm/rss_staggered | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | odin/strm/send_kitty | 0 |
5 files changed, 62 insertions, 0 deletions
diff --git a/odin/strm/cleanup_youtube b/odin/strm/cleanup_youtube index 2d91fe1f..2d91fe1f 100755..100644 --- a/odin/strm/cleanup_youtube +++ b/odin/strm/cleanup_youtube | |||
diff --git a/odin/strm/download_youtube b/odin/strm/download_youtube index 77172c87..77172c87 100755..100644 --- a/odin/strm/download_youtube +++ b/odin/strm/download_youtube | |||
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 @@ | |||
1 | #!@perl@/bin/perl | ||
2 | |||
3 | use utf8; | ||
4 | use strict; | ||
5 | use warnings; | ||
6 | |||
7 | use Email::MIME; | ||
8 | |||
9 | use Email::Date::Format qw(email_date); | ||
10 | |||
11 | our $fromMail = "$ENV{'USER'}\@odin.asgard.yggdrasil"; | ||
12 | our $fromName = "manual"; | ||
13 | |||
14 | my $i = 0; | ||
15 | |||
16 | my @tags = (); | ||
17 | for (my $j = 0; $j < $#ARGV; $j++) | ||
18 | { | ||
19 | next unless ($ARGV[$j] eq "--"); | ||
20 | |||
21 | @tags = @ARGV[0 .. $j - 1]; | ||
22 | @ARGV = @ARGV[$j + 1 .. $#ARGV]; | ||
23 | last; | ||
24 | } | ||
25 | |||
26 | # use Data::Dumper; | ||
27 | # print Dumper(@tags, @ARGV); | ||
28 | # exit 1; | ||
29 | |||
30 | foreach my $url (@ARGV) | ||
31 | { | ||
32 | my $title; | ||
33 | open(my $fh, '-|', "@youtubedl@/bin/youtube-dl --restrict-filenames --get-title --no-playlist -- '$url'") || die "Could not spawn youtube-dl"; | ||
34 | $title = <$fh>; | ||
35 | close($fh); | ||
36 | die "youtube-dl could not extract title" unless (defined($title)); | ||
37 | chomp($title); | ||
38 | |||
39 | my $mail = Email::MIME->create( | ||
40 | header_str => [ | ||
41 | From => "$fromName <$fromMail>", | ||
42 | To => 'gkleen@odin.asgard.yggdrasil', | ||
43 | Subject => $title, | ||
44 | 'X-RSS-URL' => $url, | ||
45 | Date => email_date(time() + ($i++)) | ||
46 | ], | ||
47 | attributes => { | ||
48 | content_type => 'text/html', | ||
49 | encoding => '7bit', | ||
50 | charset => 'US-ASCII' | ||
51 | }, | ||
52 | body => "<a href=\"$url\">$title</a>\n" | ||
53 | ); | ||
54 | |||
55 | my @args = (); | ||
56 | push @args, (('junk') x 5); | ||
57 | push @args, @tags; | ||
58 | |||
59 | open($fh, '|-', "rss_deliver", @args) || die "Could not spawn rss_deliver"; | ||
60 | print $fh $mail->as_string; | ||
61 | close($fh); | ||
62 | } | ||
diff --git a/odin/strm/rss_staggered b/odin/strm/rss_staggered index 54bbd1a3..54bbd1a3 100755..100644 --- a/odin/strm/rss_staggered +++ b/odin/strm/rss_staggered | |||
diff --git a/odin/strm/send_kitty b/odin/strm/send_kitty index a294d84c..a294d84c 100755..100644 --- a/odin/strm/send_kitty +++ b/odin/strm/send_kitty | |||