Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -47,13 +47,21 @@ def dl(inp,img):
|
|
| 47 |
#os.system(f'yt-dlp "{inp}" --trim-filenames 160 -o "{uid}/{inp_out}.mp4" -S res,mp4 --recode mp4')
|
| 48 |
os.system(f'yt-dlp --skip-download --write-subs --write-auto-subs --sub-lang en --sub-format ttml --convert-subs srt "{inp}" -o "{uid}/{inp_out}"')
|
| 49 |
f = open(f"{uid}/{inp_out}.en.srt")
|
| 50 |
-
ft=f.
|
| 51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
#out = f"{uid}/{inp_out}.mp4"
|
| 53 |
#capture = cv2.VideoCapture(out)
|
| 54 |
#fps = capture.get(cv2.CAP_PROP_FPS)
|
| 55 |
#capture.release()
|
| 56 |
-
out=f'{
|
| 57 |
except Exception as e:
|
| 58 |
print(e)
|
| 59 |
out = None
|
|
|
|
| 47 |
#os.system(f'yt-dlp "{inp}" --trim-filenames 160 -o "{uid}/{inp_out}.mp4" -S res,mp4 --recode mp4')
|
| 48 |
os.system(f'yt-dlp --skip-download --write-subs --write-auto-subs --sub-lang en --sub-format ttml --convert-subs srt "{inp}" -o "{uid}/{inp_out}"')
|
| 49 |
f = open(f"{uid}/{inp_out}.en.srt")
|
| 50 |
+
ft=f.readlines()
|
| 51 |
+
line_fin=""
|
| 52 |
+
line_out=""
|
| 53 |
+
for line in ft:
|
| 54 |
+
if "<" in line:
|
| 55 |
+
line_out = line.split(">",1)[1].split("<",1)[0]
|
| 56 |
+
else:
|
| 57 |
+
line_out = line
|
| 58 |
+
line_fin+=line_out
|
| 59 |
+
#print(ft)
|
| 60 |
#out = f"{uid}/{inp_out}.mp4"
|
| 61 |
#capture = cv2.VideoCapture(out)
|
| 62 |
#fps = capture.get(cv2.CAP_PROP_FPS)
|
| 63 |
#capture.release()
|
| 64 |
+
out=f'{line_fin}'
|
| 65 |
except Exception as e:
|
| 66 |
print(e)
|
| 67 |
out = None
|