summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xfrikanalen/bin/update_frikanalen-cron.sh19
-rwxr-xr-xfrikanalen/bin/update_video_diff.pl20
2 files changed, 28 insertions, 11 deletions
diff --git a/frikanalen/bin/update_frikanalen-cron.sh b/frikanalen/bin/update_frikanalen-cron.sh
index 27ea602..bda8094 100755
--- a/frikanalen/bin/update_frikanalen-cron.sh
+++ b/frikanalen/bin/update_frikanalen-cron.sh
@@ -8,19 +8,20 @@ echo "###### `date` #####"
echo "Updating meta.xml"
> $htmldir/meta.xml
-c=0
-while true ; do
- c=$(expr $c + 1 )
- echo "Take $c"
+#c=0
+# c=$(expr $c + 1 )
+# echo "Take $c"
$bindir/update_meta_xml.pl $htmldir/meta_new.xml
+ if [ ! -f $htmldir/meta_new.xml ]
+ then
+ echo "Failed to download new metadata file. "
+ exit 1
+ fi
# Verify a successfull download
- if [ "$(wc -l < $htmldir/meta_new.xml)" -lt 50 ]; then
+ if [ "$(wc -l $htmldir/meta_new.xml|awk '{print $1}')" -lt 50 ]; then
sleep 30
else
mv $htmldir/meta_new.xml $htmldir/meta.xml
- break
+ $bindir/update_video_diff.pl
fi
-done
-
-$bindir/update_video_diff.pl
diff --git a/frikanalen/bin/update_video_diff.pl b/frikanalen/bin/update_video_diff.pl
index 3d24efa..d2833de 100755
--- a/frikanalen/bin/update_video_diff.pl
+++ b/frikanalen/bin/update_video_diff.pl
@@ -9,7 +9,7 @@
#
# http://wiki.nuug.no/grupper/video/pubfrikanalen
-use Data::Dumper;
+#use Data::Dumper;
use XML::Simple;
my $localvideo_dir = '/data/video/frikanalen';
my $localthumbs_dir = '/data/video/frikanalen/thumbs';
@@ -18,6 +18,7 @@ my $meta = XMLin("$localvideo_dir/meta.xml");
# Make sure convert is in the path
$ENV{PATH} = $ENV{PATH} . ":/usr/local/bin";
+print " Local videos $#localvideos\n";
&get_new_vids;
###### Functions #######
@@ -33,7 +34,7 @@ sub get_new_vids {
unless ( -f "$localvideo_dir/$file_id.ogv") {
print "Fetching video $file_id \n" if $ARGV[0] eq "debug";
if ($meta->{$metaid}->{'VideoOgvUri'} =~ /^http:/) {
- &get_http_vid($meta->{$metaid}->{'VideoOgvUri'},$file_id);
+ get_scp_vid($meta->{$metaid}->{'VideoOgvUri'},$file_id);
}
} else {
print "$file_id is here\n" if $ARGV[0] eq "debug";
@@ -71,3 +72,18 @@ sub get_mms_vid {
$r = `mplayer -dumpstream -dumpfile "$localvideo_dir/$file_id.wmv" $url > /dev/null 2>&1`;
}
}
+
+# Ny metode for å komme rundt ikke-fungerende ur'er mot frontent.frikanalen.tv
+# Jarle 2012-04-19
+
+sub get_scp_vid {
+ my $url = shift;
+ my $file_id = shift;
+ $url =~ /^http:\/\/frontend\.frikanalen\.tv\/media\/(.+)$/;
+ my $src_path = $1;
+ my $ssh_loc = 'jarle@borch.frikanalen.no:/mnt/media/';
+ my $ssh_id_file = '/home/jarle/.ssh/id_tx_fk';
+ print "Getting $file_id.ogv\n";
+ `/usr/bin/scp -q -i $ssh_id_file $ssh_loc$src_path $localvideo_dir/$file_id.ogv`;
+}
+