podcast_newsletter / display_json.py
bpHigh's picture
Upload 5 files
ed050a6
raw
history blame
2.03 kB
import json
import os
def create_dict_from_json_files(filepath):
json_file = filepath
data_dict = {}
with open(filepath, 'r') as file:
podcast_info = json.load(file)
podcast_name = podcast_info['podcast_details']['podcast_title']
# Process the file data as needed
episode_title = podcast_info['podcast_details']['episode_title']
episode_image = podcast_info['podcast_details']['episode_image']
podcast_summary = podcast_info['podcast_summary']
podcast_guest = str(podcast_info['podcast_guest']['podcast_guest'])
podcast_guest_org = str(podcast_info['podcast_guest'].get('podcast_guest_org'))
podcast_guest_title = str(podcast_info['podcast_guest'].get('podcast_guest_title'))
podcast_guest_wikipedia = str(podcast_info['podcast_guest'].get('wikipedia_summary'))
podcast_highlights = str(podcast_info['podcast_highlights'])
podcast_key_moments = str(podcast_info['key_moments_and_key_topics'])
podcast_gpt_transcript = str(podcast_info['gpt_podcast_transcript'])
return podcast_name, episode_title, episode_image, podcast_summary, podcast_guest, podcast_guest_org, \
podcast_guest_title, podcast_guest_wikipedia, podcast_highlights, podcast_key_moments, \
podcast_gpt_transcript
def get_podcast(dropdown):
if dropdown=="In Machines We trust - MIT":
dropdown = "podcast-inmachineswetrust (1).json"
else:
dropdown = "podcast-twiml.json"
podcast_name, episode_title, episode_image, podcast_summary, podcast_guest, podcast_guest_org, \
podcast_guest_title, podcast_guest_wikipedia, podcast_highlights, podcast_key_moments, \
podcast_gpt_transcript = create_dict_from_json_files(dropdown)
return podcast_name, episode_title,episode_image, podcast_summary, podcast_guest, podcast_guest_org, \
podcast_guest_title, podcast_guest_wikipedia,podcast_highlights, podcast_key_moments, \
podcast_gpt_transcript