From 9fcfad9104119a6e638ee653a9553793c2e3a0a4 Mon Sep 17 00:00:00 2001 From: Quentin Gibeaux Date: Wed, 16 Jan 2019 12:22:08 +0100 Subject: [PATCH] fix path --- config/example.json | 12 -- config/lav-20190108.json | 27 ----- config/lav-20190115.json | 12 -- scripts/make-all-podcasts.pl | 148 ------------------------- scripts/make-metadata-image-podcast.sh | 50 --------- 5 files changed, 249 deletions(-) delete mode 100644 config/example.json delete mode 100644 config/lav-20190108.json delete mode 100644 config/lav-20190115.json delete mode 100755 scripts/make-all-podcasts.pl delete mode 100755 scripts/make-metadata-image-podcast.sh diff --git a/config/example.json b/config/example.json deleted file mode 100644 index a9257c1..0000000 --- a/config/example.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "short_date" : "AAAAMMDD", - "long_date" : "DD MMMM AAAA", - "ffmpeg_bin" : "./FFmpeg/ffmpeg", - "chapters" : [ - { - "start_timestamp" : "HH:MM:SS", - "end_timestamp" : "HH:MM:SS", - "short_chapter_name" : "" - } - ] -} diff --git a/config/lav-20190108.json b/config/lav-20190108.json deleted file mode 100644 index b421a3b..0000000 --- a/config/lav-20190108.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "short_date" : "20190108", - "long_date" : "8 janvier 2019", - "ffmpeg_bin" : "./FFmpeg/ffmpeg", - "chapters" : [ - { - "start_timestamp" : "0:03:09", - "end_timestamp" : "0:18:45", - "short_chapter_name" : "chronique-transcriptions" - }, - { - "start_timestamp" : "00:18:45", - "end_timestamp" : "01:11:01", - "short_chapter_name" : "dinsic-etalab" - }, - { - "start_timestamp" : "01:11:01", - "end_timestamp" : "01:23:38", - "short_chapter_name" : "logiciel-caisse" - }, - { - "start_timestamp" : "01:23:38", - "end_timestamp" : "01:29:58", - "short_chapter_name" : "annonces" - } - ] -} diff --git a/config/lav-20190115.json b/config/lav-20190115.json deleted file mode 100644 index 1f8d79b..0000000 --- a/config/lav-20190115.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "short_date" : "20190115", - "long_date" : "15 janvier 2019", - "ffmpeg_bin" : "./FFmpeg/ffmpeg", - "chapters" : [ - { - "start_timestamp" : "00:16:27", - "end_timestamp" : "01:29:40", - "short_chapter_name" : "CADA" - } - ] -} diff --git a/scripts/make-all-podcasts.pl b/scripts/make-all-podcasts.pl deleted file mode 100755 index f7bac0c..0000000 --- a/scripts/make-all-podcasts.pl +++ /dev/null @@ -1,148 +0,0 @@ -#!/usr/bin/perl - -use strict; -use Getopt::Long; -use JSON; -use Data::Dumper; - -my ($help,$config,$verbose,$dryrun); -my $meta_data_script = "./make-metadata-image-podcast.sh"; - -my $verbose; -GetOptions ("help" => \$help, - "config=s" => \$config, - "verbose" => \$verbose, - "dryrun" => \$dryrun); - -if($help) { - usage(); -} elsif( not $config ) { - print " /!\\ Missing config arg\n\n"; - usage(); -} - -sub usage { - print < - }; - - my $json = JSON->new; - my $data = $json->decode($json_text); - - return $data; -} - -sub process { - my ($config,$verbose,$dryrun)=@_; - my $data = read_config($config); - - my $short_date = $data->{short_date}; - my $long_date = $data->{long_date}; - my $source_name = "libre-a-vous-$short_date"; - my $title = "Libre à vous ! du $long_date sur Cause Commune"; - my $ffmpeg_bin = $data->{ffmpeg_bin}; - for my $chapter (values @{$data->{chapters}}) { - my $start = $chapter->{start_timestamp}; - my $end = $chapter->{end_timestamp}; - my $short_chapter_name = $chapter->{short_chapter_name}; - - # cutting chapter - my $command = "$ffmpeg_bin -y -i $source_name.ogg -vn -acodec copy -ss \"$start\" -to \"$end\" $source_name-$short_chapter_name.ogg"; - if($dryrun) { - print "$command\n"; - } else { - my @ret = `$command`; - if($?) { - print "Error while cutting $short_chapter_name\n"; - if($verbose) { - print Dumper @ret; - print Dumper $data; - return 0; - } - } - } - - # putting metadata - my $url = "https://media.april.org/audio/radio-cause-commune/libre-a-vous/emissions/$short_date/$source_name-$short_chapter_name.ogg"; - my $command = "$meta_data_script -s \"$source_name-$short_chapter_name.ogg\" -d \"output.ogg\" -u \"$url\" -t \"$title\" -p \"$ffmpeg_bin\""; - if($dryrun) { - print "$command\n"; - } else { - my @ret = `$command`; - if($?) { - print "Error while setting metadata in $short_chapter_name\n"; - if($verbose) { - print Dumper @ret; - print Dumper $data; - return 0; - } - } - } - - my $command = "mv output.ogg $source_name-$short_chapter_name.ogg"; - if($dryrun) { - print "$command\n"; - } else { - my @ret = `$command`; - if($?) { - print "Error while renaming $short_chapter_name\n"; - if($verbose) { - print Dumper @ret; - print Dumper $data; - return 0; - } - } - } - } - - # putting metadata in main podcast - my $url = "https://media.april.org/audio/radio-cause-commune/libre-a-vous/emissions/$short_date/$source_name.ogg"; - my $command = "$meta_data_script -s \"$source_name.ogg\" -d \"output.ogg\" -u \"$url\" -t \"$title\" -p \"$ffmpeg_bin\""; - if($dryrun) { - print "$command\n"; - } else { - my @ret = `$command`; - if($?) { - print "Error while setting metadata in $source_name\n"; - if($verbose) { - print Dumper @ret; - print Dumper $data; - return 0; - } - } - } - my $command = "mv output.ogg $source_name.ogg"; - if($dryrun) { - print "$command\n"; - } else { - my @ret = `$command`; - if($?) { - print "Error while renaming $source_name\n"; - if($verbose) { - print Dumper @ret; - print Dumper $data; - return 0; - } - } - } -} - -process($config,$verbose,$dryrun); diff --git a/scripts/make-metadata-image-podcast.sh b/scripts/make-metadata-image-podcast.sh deleted file mode 100755 index 2c180e4..0000000 --- a/scripts/make-metadata-image-podcast.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash - -usage() { echo "$0 -s source_file -d destination_file -u http://... -t \"title\" -p path/to/ffmpeg/binary"; exit 0; } -[ $# -eq 0 ] && usage -while getopts "s:d:u:t:p:h" arg; do - case $arg in - s) - source=${OPTARG} - ;; - d) - destination=${OPTARG} - ;; - u) - url=${OPTARG} - ;; - t) - title=${OPTARG} - ;; - p) - FFmpegBin=${OPTARG} - ;; - h | *) # Display help. - usage - exit 0 - ;; - esac -done - -if [ ! -f $source ]; then - echo "File $source does not exist" - usage - exit 1 -fi -if [ ! -f "$FFmpegBin" ]; then - echo "$FFmpegBin is not executable" - usage - exit 1 -fi - -image="image-pour-etiqueter-podcast.jpg" -fichiertemp="$(command mktemp -t "tmp.XXXXXXXXXX.ogg")" - -(echo -en ";FFMETADATA1\nMETADATA_BLOCK_PICTURE=";(i=${image};t=3;m="image/jpeg";eval "w=`identify-im6 "$i"|awk '{g=$3;sub("x"," h=",g);print g;d=$5;gsub(/-.*/,"",d);print " d=" d}'`"; echo -en "\x00\x00\x00\x$(printf '%02x' $t)\x00\x00\x00\x$(printf '%02x' `echo -n "$m"|wc -c`)$m\x00\x00\x00\x00$(printf '%08x' $w|sed 's/../\\x&/g')$(printf '%08x' $h|sed 's/../\\x&/g')$(printf '%08x' $d|sed 's/../\\x&/g')\x00\x00\x00\xff$(printf '%08x' `stat -c '%s' "$i"`|sed 's/../\\x&/g')";cat "$i")|base64 --wrap=0) > i.meta - -${FFmpegBin} -y -i ${source} -acodec copy -map 0:0 -map_metadata -1 -metadata title="${title}" -metadata copyright="Diffusée selon les termes d’au moins une des licences suivantes : licence Art libre version 1.3 ou ultérieure http://artlibre.org/licence/lal/, licence Creative Commons By Sa version 2.0 ou ultérieure http://creativecommons.org/licenses/by-sa/2.0/fr/ et licence GNU FDL version 1.3 ou ultérieure http://www.gnu.org/licenses/fdl-1.3.html" -metadata artist="April - Cause Commune" -metadata contact="${url}" ${fichiertemp} - -${FFmpegBin} -y -i ${fichiertemp} -i i.meta -acodec copy -map 0:0 -map_metadata 1 ${destination} - -rm ${fichiertemp} -rm i.meta