File size: 2,028 Bytes
ed050a6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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