Skip to content

Instantly share code, notes, and snippets.

@renini
Created February 29, 2024 20:06
Show Gist options
  • Save renini/ab6b6295923a216866abc56a0a7eef1a to your computer and use it in GitHub Desktop.
Save renini/ab6b6295923a216866abc56a0a7eef1a to your computer and use it in GitHub Desktop.
import json
# Sample JSON data
json_data = [
{
"summary": "this is the summary 1",
"title": "this is the title 1",
"year": "2024",
"video": "1.mp4",
"subtitle": "1.vtt"
},
{
"summary": "this is the summary 2",
"title": "this is the title 2",
"year": "2024",
"video": "2.mp4",
"subtitle": "2.vtt"
},
{
"summary": "this is the summary 3",
"title": "this is the title 3",
"year": "2024",
"video": "3.mp4",
"subtitle": "3.vtt"
}
]
def process_video(video_file):
# Your video processing logic here
print(f"Processing video: {video_file}")
def process_subtitle(subtitle_file):
# Your subtitle processing logic here
print(f"Processing subtitle: {subtitle_file}")
# Iterate over each item in the JSON data
for item in json_data:
title = item["title"]
video_file = item["video"]
subtitle_file = item["subtitle"]
print(f"Title: {title}")
print(f"Year: {item['year']}")
print(f"Summary: {item['summary']}")
process_video(video_file)
process_subtitle(subtitle_file)
print("\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment