Spaces:
Paused
Paused
GilangAlRusliadi commited on
Commit ·
8c0a5bc
1
Parent(s): 5160d6e
Trailer
Browse files- others.py +5 -4
- trailer.py +7 -12
others.py
CHANGED
|
@@ -276,6 +276,9 @@ def convert_videos(height, filename):
|
|
| 276 |
return output_file
|
| 277 |
|
| 278 |
def join_video(thumbnail_file, video_file):
|
|
|
|
|
|
|
|
|
|
| 279 |
|
| 280 |
# Tentukan jalur ke file audio yang akan digunakan untuk intro
|
| 281 |
audio_file = './sound.wav'
|
|
@@ -284,11 +287,9 @@ def join_video(thumbnail_file, video_file):
|
|
| 284 |
name = os.path.splitext(video_file)[0]
|
| 285 |
# Temukan file gambar yang sesuai
|
| 286 |
image_file = thumbnail_file
|
|
|
|
| 287 |
# Periksa apakah file gambar ada
|
| 288 |
-
if image_file:
|
| 289 |
-
output_dir = '/home/user/app/Hasil Join'
|
| 290 |
-
if not os.path.exists(output_dir):
|
| 291 |
-
os.makedirs(output_dir)
|
| 292 |
# Tentukan jalur ke file output
|
| 293 |
output_file = f'{output_dir}/{name}.mp4'
|
| 294 |
# Gunakan ffmpeg untuk membuat video 1 detik dari file gambar dan audio
|
|
|
|
| 276 |
return output_file
|
| 277 |
|
| 278 |
def join_video(thumbnail_file, video_file):
|
| 279 |
+
output_dir = '/home/user/app/Hasil Join'
|
| 280 |
+
if not os.path.exists(output_dir):
|
| 281 |
+
os.makedirs(output_dir)
|
| 282 |
|
| 283 |
# Tentukan jalur ke file audio yang akan digunakan untuk intro
|
| 284 |
audio_file = './sound.wav'
|
|
|
|
| 287 |
name = os.path.splitext(video_file)[0]
|
| 288 |
# Temukan file gambar yang sesuai
|
| 289 |
image_file = thumbnail_file
|
| 290 |
+
|
| 291 |
# Periksa apakah file gambar ada
|
| 292 |
+
if image_file:
|
|
|
|
|
|
|
|
|
|
| 293 |
# Tentukan jalur ke file output
|
| 294 |
output_file = f'{output_dir}/{name}.mp4'
|
| 295 |
# Gunakan ffmpeg untuk membuat video 1 detik dari file gambar dan audio
|
trailer.py
CHANGED
|
@@ -5,29 +5,24 @@ from others import *
|
|
| 5 |
|
| 6 |
def trailer(url):
|
| 7 |
# Set the path to the thumbnail directory
|
| 8 |
-
|
| 9 |
-
if not os.path.exists(
|
| 10 |
-
os.makedirs(
|
| 11 |
-
|
| 12 |
-
# Set the path to the video directory
|
| 13 |
-
video_dir = "/home/user/app/Hasil Download"
|
| 14 |
-
if not os.path.exists(thumbnail_dir):
|
| 15 |
-
os.makedirs(thumbnail_dir)
|
| 16 |
|
| 17 |
# Dapatkan variabel artis dan seri
|
| 18 |
actress, series, digits, video_url, thumbnail_url = get_video_info(url)
|
| 19 |
|
| 20 |
# Membuat judul video
|
| 21 |
judul = f"{series} {digits} - {actress}"
|
| 22 |
-
thumbnail_file = download_file(thumbnail_url, judul,
|
| 23 |
-
video_file = download_file(video_url, judul,
|
| 24 |
|
| 25 |
print("==================================================================================")
|
| 26 |
# Mengkonversi video
|
| 27 |
-
|
| 28 |
print("==================================================================================")
|
| 29 |
# Menggabungkan video
|
| 30 |
-
video_file = join_video(thumbnail_file,
|
| 31 |
print("==================================================================================")
|
| 32 |
|
| 33 |
video_info = "Series: {series}/n"
|
|
|
|
| 5 |
|
| 6 |
def trailer(url):
|
| 7 |
# Set the path to the thumbnail directory
|
| 8 |
+
directory = "/home/user/app/Trailer/Thumbnail"
|
| 9 |
+
if not os.path.exists(directory):
|
| 10 |
+
os.makedirs(directory)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
# Dapatkan variabel artis dan seri
|
| 13 |
actress, series, digits, video_url, thumbnail_url = get_video_info(url)
|
| 14 |
|
| 15 |
# Membuat judul video
|
| 16 |
judul = f"{series} {digits} - {actress}"
|
| 17 |
+
thumbnail_file = download_file(thumbnail_url, judul, directory)
|
| 18 |
+
video_file = download_file(video_url, judul, directory)
|
| 19 |
|
| 20 |
print("==================================================================================")
|
| 21 |
# Mengkonversi video
|
| 22 |
+
video_file = convert_videos(720, video_file)
|
| 23 |
print("==================================================================================")
|
| 24 |
# Menggabungkan video
|
| 25 |
+
video_file = join_video(thumbnail_file, video_file)
|
| 26 |
print("==================================================================================")
|
| 27 |
|
| 28 |
video_info = "Series: {series}/n"
|