minor tweaks
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
list.txt
|
list.txt
|
||||||
rip.sh
|
rip.sh
|
||||||
|
debug.txt
|
||||||
output.mp4
|
output.mp4
|
||||||
|
|||||||
2
clean.sh
2
clean.sh
@ -1,5 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
rm list.txt rip.sh rm output.mp4
|
rm list.txt rip.sh rm output.mp4 debug.txt
|
||||||
rm -r ../out
|
rm -r ../out
|
||||||
mkdir ../out
|
mkdir ../out
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
import re
|
import re
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import os
|
import os
|
||||||
@ -17,17 +18,24 @@ file_names.sort()
|
|||||||
|
|
||||||
data = []
|
data = []
|
||||||
|
|
||||||
for f in file_names:
|
for i, f in enumerate(file_names):
|
||||||
file = open(path + f)
|
file = open(path + f)
|
||||||
for i, line in enumerate(file):
|
for i, line in enumerate(file):
|
||||||
if re.search(search, line):
|
if i%4 == 2 and re.search(search, line): # we only need to check lines which contain text, hence the first condition
|
||||||
data.append({'fname':f, 'beg':prev[0:8], 'end':prev[17:25], 'desc':line}) # get file name, time stamps and desciption
|
data.append({'fname':f, 'beg':prev[0:8], 'end':prev[17:25], 'desc':line}) # get file name, time stamps and desciption
|
||||||
prev = line # a line just before text is a timestamp
|
if i%4 == 1:
|
||||||
|
prev = line # a timestamp line
|
||||||
|
|
||||||
file_rip = open('rip.sh', 'w')
|
|
||||||
file_list = open('list.txt', 'w')
|
file_list = open('list.txt', 'w')
|
||||||
|
file_rip = open('rip.sh', 'w')
|
||||||
|
file_rip.write('#!/bin/bash\n')
|
||||||
for (i, d) in enumerate(data):
|
for (i, d) in enumerate(data):
|
||||||
name = d['fname'][:2] # get a name without an extension
|
name = d['fname'][:2] # get a name without an extension
|
||||||
outname ="../out/{}-{:0>2}.mp4".format(name, i)
|
outname ="../out/{}-{:0>2}.mp4".format(name, i)
|
||||||
file_list.write("file '{}'\n".format(outname))
|
file_list.write("file '{}'\n".format(outname))
|
||||||
file_rip .write('ffmpeg -ss {} -i ../original/{}.mp4 -to 00:00:12 -c copy {}\n'.format(d['beg'], name, outname))
|
file_rip .write('ffmpeg -ss {} -i ../original/{}.mp4 -to 00:00:12 -c copy {}\n'.format(d['beg'], name, outname))
|
||||||
|
|
||||||
|
|
||||||
|
file_debug = open('debug.txt', 'w')
|
||||||
|
for d in data:
|
||||||
|
file_debug.write('{}\t{}\t{}\t{}\n'.format(d['fname'][:2], d['beg'], d['end'], d['desc']))
|
||||||
|
|||||||
2
run.sh
2
run.sh
@ -3,6 +3,6 @@
|
|||||||
# TODO make it so the only data you need to feed the application
|
# TODO make it so the only data you need to feed the application
|
||||||
# is an URL of a youtube playlist/ video you want to edit
|
# is an URL of a youtube playlist/ video you want to edit
|
||||||
|
|
||||||
python gen-script.py
|
./gen-script.py
|
||||||
bash rip.sh
|
bash rip.sh
|
||||||
ffmpeg -f concat -safe 0 -i list.txt -c copy output.mp4 # splice all the clips
|
ffmpeg -f concat -safe 0 -i list.txt -c copy output.mp4 # splice all the clips
|
||||||
|
|||||||
Reference in New Issue
Block a user