-
Notifications
You must be signed in to change notification settings - Fork 1
/
sortarte.pl
executable file
·54 lines (52 loc) · 1.2 KB
/
sortarte.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/perl
# Mar
# Sort arte files in geners
# v0.0.1
use strict;
use warnings;
my $ogfolder="/arte/stream"; # folder to store
my $url;
my $data;
my $folder="sortme";
my $s = 0;
my @liste = `ls $ogfolder/*meta.txt`;
#my @liste = "/arte/stream/20140511-TVGE1468-Karambolage.mp4.meta.txt";
foreach my $line (@liste)
{
print "\n\n#####\n";
# reset vars
$folder="sortme";
chomp ($line);
print "$line\n";
# get genre:Kurzfilm
$folder = `cat $line | grep "genre\\":" | sed 's/.*genre"://;s/,.*//;s/.*_//;s/"//'`;
chomp($folder);
print"==$folder==\n";
#exit;
if (! $folder || $folder =~ m/^{/ )
{
# TEST online genre status
$url = `cat $line | grep { | sed 's/.*VUP://;s/,.*//' | grep http`;
print "==$url==";
$url =~ s/ /-/g;
#exit ;
my $getl = `wget -qO- "$url" | grep content-metadata -A3 | grep "collapse in" -A3 | grep -v "<"`;
print "==$getl==";
chomp($getl);
$folder=$getl;
$folder=~s/\\//;
#print "i--$getl--a";
#exit;
if (! $folder )
{
print "failure at $line\n take sortme\n";
$folder="sortme";
}
}
chomp $folder;
`mkdir -p $ogfolder/$folder`;
my $name = $line ;
$name =~ s/\.meta\.txt//;
print "mv $name* $ogfolder/$folder/\n";
`mv $name* $ogfolder/$folder/`;
}