From 389f3386a809be62f1dfe8d7ef47b95ffba5c550 Mon Sep 17 00:00:00 2001 From: Eduardo Cueto Mendoza Date: Tue, 21 Jul 2020 10:07:19 -0600 Subject: [PATCH] Test files for ffmpeg --- ffmpeg.jl | 22 ++++++++++++++++++++++ remconf.jl | 24 ++++++++++++++++++++++++ testing_ffmpeg.jl | 18 ++++++++++++++++++ 3 files changed, 64 insertions(+) create mode 100644 ffmpeg.jl create mode 100644 remconf.jl create mode 100644 testing_ffmpeg.jl diff --git a/ffmpeg.jl b/ffmpeg.jl new file mode 100644 index 0000000..3646755 --- /dev/null +++ b/ffmpeg.jl @@ -0,0 +1,22 @@ +currentdir = pwd() +#videosinfolder = readdir(currentdir) + +reextension = r"(\.[^.]+)$" + +for (_,_,filesinfolders) in walkdir(currentdir) + for files in filesinfolders + extension = match(reextension,files) + if extension == nothing + println("Not a valid extension") + else + if extension.match == ".mkv" || extension.match == ".avi" + newfiles = replace(files, reextension => s".mp4") + run(`ffmpeg -i $files $newfiles`) + sleep(3) + run(`rm $files`) + else + println("No processing done file of type: $(extension.match)") + end + end + end +end diff --git a/remconf.jl b/remconf.jl new file mode 100644 index 0000000..a7f892b --- /dev/null +++ b/remconf.jl @@ -0,0 +1,24 @@ +currentdir = pwd() + +renotvalid = r"(^\._).+(\.[^.]+)$" +reextension = r"(\.[^.]+)$" + +for (root,_,filesinfolders) in walkdir(currentdir) + for files in filesinfolders + notvalid = match(renotvalid,files) + if notvalid != nothing + maybenotvalid = notvalid.captures + if any(x -> x=="._",maybenotvalid) && (any(x -> x==".mkv",maybenotvalid) || any(x -> x==".avi",maybenotvalid)) + println("File: $root/$files is not valid, removing") + sleep(2) + run(`rm $root/$files`) + end + end + extension = match(reextension,files) + if extension.match == ".rar" + println("this is a $files file removing") + sleep(2) + run(`rm $root/$files`) + end + end +end diff --git a/testing_ffmpeg.jl b/testing_ffmpeg.jl new file mode 100644 index 0000000..eb62f0b --- /dev/null +++ b/testing_ffmpeg.jl @@ -0,0 +1,18 @@ +currentdir = pwd() +#videosinfolder = readdir(currentdir) + +reextension = r"(\.[^.]+)$" + +for (root,foldersinfolders,filesinfolders) in walkdir(currentdir) + if !isempty(foldersinfolders) + for folder in foldersinfolders + println(root * "/" * folder * "/") + println(foldersinfolders) + println(filesinfolders) + #for file in filesinfolders + # pathtofiles = root * "/" * folder * "/" * file + # println(pathtofiles) + #end + end + end +end