Skip to content

Commit

Permalink
add new pod: talk fast think smart
Browse files Browse the repository at this point in the history
  • Loading branch information
anig1scur committed Jul 7, 2024
1 parent 7e57f0f commit df67a7b
Show file tree
Hide file tree
Showing 139 changed files with 1,239 additions and 67 deletions.
Binary file removed fa.png
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed public/assets/sciam/audios/1307416.mp3
Binary file not shown.
Binary file removed public/assets/sciam/audios/1307432.mp3
Binary file not shown.
Binary file not shown.
Binary file added public/assets/tfts/logo.webp
Binary file not shown.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"title":"Quick Thinks: Tips for Speaking up in Virtual Meetings","url":"https://www.gsb.stanford.edu/insights/quick-thinks-tips-speaking-virtual-meetings","intro":["We've all been in the situation where you have something important to contribute to a meeting and you don't know how to insert your thoughts.","On this \u201cQuick Thinks\u201d episode of Think Fast, Talk Smart, podcast host Matt Abrahams offers the three ways to insert your ideas, either by paraphrasing, asking a question, or stating an emotion. He also outlines the \u201cWhat, So What, Now What\u201d framework and explains how to use this structure to communicate your ideas more effectively."],"transcript":[{"author":"Matt Abrahams","text":"We\u2019ve all been in the situation where you have something important to contribute to a meeting or a presentation and you just don\u2019t know how to insert your thoughts. How do I get my idea out there? And once I do, how do I make it clear and concise?"},{"author":"Matt Abrahams","text":"Today, I will explore specific techniques and tips you can use to be more effective when you need to contribute your ideas in a presentation or a meeting. My name is Matt Abrahams and I teach Strategic Communication at Stanford Graduate School of Business and welcome to a Quick Thinks episode of Think Fast, Talk Smart, the podcast."},{"author":"Matt Abrahams","text":"Based on the work I have done as a lecturer at Stanford GSB as well as in my consulting practice, there are some specific techniques and tools you can use to insert your ideas in a conversation, a meeting, or even a presentation."},{"author":"Matt Abrahams","text":"The three best tools that I am aware of are to start with a paraphrase. When somebody is speaking and you want to contribute, you can simply interject a paraphrase. Capture something that they\u2019ve said, it doesn\u2019t have to be a grand paraphrase where you say \u201cso what you\u2019re saying is\u2026\u201d You can just jump on a particular topic, like \u201cPricing!\u201d Paraphrasing is a polite way to get your point into a presentation or into a meeting."},{"author":"Matt Abrahams","text":"Another tool is to simply ask a question, so as somebody is speaking you might say, \u201cI have a question about that point.\u201d And that question can be one where it\u2019s presented in a polite, concerned way, or perhaps in a more direct way. So tone matters."},{"author":"Matt Abrahams","text":"The final way is to simple start with an emotion, \u201cThat concerns me\u201d or \u201cI\u2019m excited by.\u201d That emotion gives you permission to then follow up. By paraphrasing, asking a question, or stating an emotion, you can get the floor in an in-person or virtual communication situation."},{"author":"Matt Abrahams","text":"Now once you have that floor, you have to contribute. We know from our own personal experience that if we are unstructured, meandering and wandering, people aren\u2019t going to take away what we want them to. We must be clear and concise. The way we become clear and concise is by using some kind of message design or structure. And there are many, many that exist. Structure gives us a place to start, it gives us a place to end, it helps us connect our ideas together. My favorite structure for making contributions in meetings, conversations, and presentations is simply three questions: What, so what, now what. This gives you the guide, the map if you will, for what it is you need to say. You start with the what, \u201cWhat is it you\u2019re talking about,\u201d It could be a process, a product, a point of view."},{"author":"Matt Abrahams","text":"The So What is \u201cWhy is it important\u201d to the people you\u2019re speaking to, perhaps to the company, or even society at large."},{"author":"Matt Abrahams","text":"And then the Now What is what you want to come next, it could be action items, a follow-up meeting, a demonstration, but it is the action that follows. What, So What, Now What, is a super powerful structure that upon practicing and becoming comfortable with it can really help you construct your messages so that they are packaged well for your audience to understand. I encourage you to take these tools for inserting your ideas as well as the notion of message design through structure to help you be more effective in your communication."}],"audio":"https://content.production.cdn.art19.com/segment_lists/b3d0cdb6-3adf-46eb-bb94-3d130139c3fe/20200402-UXVpY2tUaGlua3NfU3RydWN0dXJlX0RyYWZ0Mi53YXY-44ec4ca6-3b5f-4e3c-a821-ae38ae7d5210.mp3","img":"https://www.gsb.stanford.edu/sites/default/files/styles/1630x_variable/public/tfts-key_logo_21.jpg.webp?itok=S-EaSW2x","authors":["Matt Abrahams"],"wave_peaks":[97,14897,12971,7783,4073,3912,1260,9529,13012,10829,6896,7330,4034,5708,5208,7942,5533,4555,2740,1046,84,2627,4641,8020,5092,2635,8993,8470,8872,8598,8216,4630,13174,9186,3909,4993,5228,2294,138,14614,9509,4413,122,5403,7123,5575,4492,6539,4680,97,206,7374,11663,12982,8125,5762,9983,5032,6205,4809,6072,4216,3913,2126,1147,4616,9285,6486,7637,8559,4227,6191,6948,2945,6406,4048,8149,7734,5134,2031,6102,5587,4291,2823,1823,483,586,780,17264,10467,8918,5388,1599,3853,13265,4624,6834,4337,4827,4811,2792,6644,5906,4793,3657,3199,2835,1212,20637,13825,7663,10809,5400,9258,7047,3834,2331,8117,8529,10092,9957,3324,11721,5985,5046,4817,3434,5057,3475,3347,2643,3263,3254,3348,3439,3485,14140,9098,10220,7195,4208,5509,9933,6098,4853,4970,5059,4735,9478,4739,4054,3457,3992,2514,2486,15572,8211,9189,5870,6485,4531,4627,5042,4597,1449,751,8665,11029,13313,9338,5310,3109,4835,4725,4657,3908,6858,5868,5783,3227,1768,388,9480,6729,13451,17854,4679,5523,8249,7158,4080,1405,6820,3993,5503,10206,11015,9476,8372,3568,1930,11577,9169,4826,4057,5824,2273,2875,3189,5545,10239,7162,6097,5394,10083,8646,11344,10309,8635,5393,6390,5774,5865,427,4767,11582,7918,8801,6488,7148,5188,5349,7362,5280,3342,3533,6904,9869,7665,5283,7511,4343,4962,10714,14492,3110,5099,9436,2541,10576,4189,3208,2597,283,1904,12301,9153,3687,8312,6453,3107,4107,7061,3713,2969,5925,3805,4605,4781,2607,3390,1809,603,613,180,11777,18764,4997,6267,8658,11015,7779,5825,7028,5798,3989,4555,4774,3734,3265,10139,7011,10373,8332,4993,1717,171,185,10389,11124,6110,262,7524,7266,9915,10839,9659,7987,4169,246,11473,10384,9985,5890,4413,7918,9631,103,2063,8916,8998,3577,11267,10623,11909,6515,5702,3353,4861,7569,4993,1946,341,231,110,14644,18693,6635,9645,9933,8831,14208,11707,4864,4024,2455,167,138,9678,8247,5456,1559,2266,8835,11873,7903,2987,203,15507,11242,4918,5952,5418,3500,4669,4432,2116,705,16263,13886,14069,9474,2422,9005,10158,7964,6581,1370,6417,6123,6393,6170,1748,5766,5277,7192,6023,5143,3685,5861,8414,9354,3280,6510,12023,4489,4511,825,7132,6523,3410,2263,2159,110,370,16223,10009,12069,7219,9253,12092,6002,3905,212,9985,14274,13514,8586,9899,5118,6460,6099,6343,9359,8749,10286,10037,4577,5246,7182,8842,8431,5084,1871,11389,3810,6721,5735,6224,5359,4607,3504,2640,1568,2433,12275,5246,6422,6244,3767,2858,668,9945,14334,3593,5008,4917,6376,5606,5813,5562,6444,7385,4156,5431,6753,4628,6765,2244,3687,2982,1600,526,13776,12996,11353,5593,9656,3047,1743,2553,163,14322,16903,6267,5457,4085,7409,4507,4300,4472,1730,8244,10277,7497,7662,4219,6054,2722,180,473,13619,15665,9286,7336,2384,471,8142,11850,8942,3001,4910,1649,2532,6457,7706,1440,127,156,7556,7860,4619,4685,3528,4835,7159,5540,4418,3186,1121,1027,3095,10243,147,96,10587,11269,3774,1421,7819,1291,204,100,93,96,15041,10221,7340,11126,11773,6985,10274,9668,3794,1999,557,10705,7908,3916,3572,2290,402,17347,10585,10440,2784,4493,8278,6635,7133,4450,4175,10347,12472,3309,8520,4840,7227,4948,4056,3861,450,91,187,289,13473,13007,4981,6896,6541,5428,4560,1047,8128,5141,5371,4044,1418,112,12225,5912,5578,5628,1047,9220,8534,9522,5255,3357,3543,630,113,10572,7920,7935,2838,757,7169,10015,5906,5498,4590,3633,2758,1840,3710,7400,3794,97,10635,13893,4773,1975,120,6286,9136,7324,4119,1237,11291,10944,8593,3946,1184,284,16652,7517,4812,4995,5061,4287,1644,395,1028,14408,7421,7409,3705,3233,3531,3798,4888,6488,3067,2358,6111,2664,389,14376,1103,8830,10348,15456,4601,4696,6136,6443,4423,4215,6287,6869,3067,272,3034,12638,7051,6240,2547,2180,10119,4860,5509,12142,3890,6372,4854,4000,2815,1922,2816,1663,126,120,477,11049,9968,12836,3141,7771,4002,3568,1650,7429,9807,8785,6544,2756,1242,11566,11525,8665,6034,6616,6671,6449,6075,5288,4687,5592,1591,5109,8589,5025,4930,4839,12514,4802,822,7197,5046,3067,2356,1313,1755,1009,212,429,1641,1130,1169,920,824,929,855,716,662,753,799,661,719,764,629,638,716,668,623,564,474,532,454,320,282,258,146,130,5,2,6,5,4],"fragments":[{"begin":"0.000","end":"15.480","lines":["We\u2019ve all been in the situation where you have something important to contribute to a meeting or a presentation and you just don\u2019t know how to insert your thoughts. How do I get my idea out there? And once I do, how do I make it clear and concise?"]},{"begin":"15.480","end":"40.840","lines":["Today, I will explore specific techniques and tips you can use to be more effective when you need to contribute your ideas in a presentation or a meeting. My name is Matt Abrahams and I teach Strategic Communication at Stanford Graduate School of Business and welcome to a Quick Thinks episode of Think Fast, Talk Smart, the podcast."]},{"begin":"40.840","end":"54.840","lines":["Based on the work I have done as a lecturer at Stanford GSB as well as in my consulting practice, there are some specific techniques and tools you can use to insert your ideas in a conversation, a meeting, or even a presentation."]},{"begin":"54.840","end":"82.680","lines":["The three best tools that I am aware of are to start with a paraphrase. When somebody is speaking and you want to contribute, you can simply interject a paraphrase. Capture something that they\u2019ve said, it doesn\u2019t have to be a grand paraphrase where you say \u201cso what you\u2019re saying is\u2026\u201d You can just jump on a particular topic, like \u201cPricing!\u201d Paraphrasing is a polite way to get your point into a presentation or into a meeting."]},{"begin":"82.680","end":"100.560","lines":["Another tool is to simply ask a question, so as somebody is speaking you might say, \u201cI have a question about that point.\u201d And that question can be one where it\u2019s presented in a polite, concerned way, or perhaps in a more direct way. So tone matters."]},{"begin":"100.560","end":"121.720","lines":["The final way is to simple start with an emotion, \u201cThat concerns me\u201d or \u201cI\u2019m excited by.\u201d That emotion gives you permission to then follow up. By paraphrasing, asking a question, or stating an emotion, you can get the floor in an in-person or virtual communication situation."]},{"begin":"121.720","end":"175.480","lines":["Now once you have that floor, you have to contribute. We know from our own personal experience that if we are unstructured, meandering and wandering, people aren\u2019t going to take away what we want them to. We must be clear and concise. The way we become clear and concise is by using some kind of message design or structure. And there are many, many that exist. Structure gives us a place to start, it gives us a place to end, it helps us connect our ideas together. My favorite structure for making contributions in meetings, conversations, and presentations is simply three questions: What, so what, now what. This gives you the guide, the map if you will, for what it is you need to say. You start with the what, \u201cWhat is it you\u2019re talking about,\u201d It could be a process, a product, a point of view."]},{"begin":"175.480","end":"183.680","lines":["The So What is \u201cWhy is it important\u201d to the people you\u2019re speaking to, perhaps to the company, or even society at large."]},{"begin":"183.680","end":"233.800","lines":["And then the Now What is what you want to come next, it could be action items, a follow-up meeting, a demonstration, but it is the action that follows. What, So What, Now What, is a super powerful structure that upon practicing and becoming comfortable with it can really help you construct your messages so that they are packaged well for your audience to understand. I encourage you to take these tools for inserting your ideas as well as the notion of message design through structure to help you be more effective in your communication."]}]}

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/components/WaveForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const WaveForm = forwardRef<WaveFormHandle, WaveFormProps>((props, ref) => {
wavesurfer.current?.seekTo((curTime + time) / duration);
},
seekTo(time: number) {
time = time <= 0 ? 1 : time;
time = time <= 0 ? 0.01 : time;
wavesurfer.current?.seekTo(time / wavesurfer.current?.getDuration() || 1);
},
onready(callback: () => void) {
Expand Down
6 changes: 4 additions & 2 deletions src/pages/Episode/list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ type Episode = {
export enum podType {
sixmins = '6mins',
sciam = 'sciam',
epod = 'epod'
epod = 'epod',
tfts = 'tfts',
}

export const FullNameMap = {
[podType.sixmins]: '6 Minutes English',
[podType.sciam]: 'Scientific American',
[podType.epod]: 'English Pod'
[podType.epod]: 'English Pod',
[podType.tfts]: 'Think Fast Talk Smart',
};


Expand Down
12 changes: 10 additions & 2 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import Header from '@/components/Header';
import { Link } from 'react-router-dom';
import SixMins from '@assets/6mins/logo.gif';
import Tfts from '@assets/tfts/logo.webp';
import Sciam from '@assets/sciam/logo.png';


Expand Down Expand Up @@ -40,8 +41,15 @@ const Index = () => {
return (
<div className='flex flex-col'>
<Header />
<div className="max-w-4xl mt-10">
<div className="flex flex-wrap gap-12">
<div className="mt-10">
<div className="flex flex-wrap gap-10">
<PodcastCard
href='/tfts'
title="Think fast talk smart"
description="Learn how to communicate more effectively in professional settings."
difficulty={ 4 }
logoUrl={ Tfts }
/>
<PodcastCard
href='/6mins'
title="6 Minutes English"
Expand Down
14 changes: 12 additions & 2 deletions src/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
}

.title {
@apply w-72 px-3 leading-8 text-ellipsis text-left text-nowrap overflow-hidden bg-black text-white rounded-lg;
@apply w-72 px-3 leading-8 text-ellipsis cursor-text text-left text-nowrap overflow-hidden bg-black text-white rounded-lg;
}

}
Expand All @@ -120,6 +120,10 @@
}
}

>div {
@apply pl-1;
}

input {
@apply text-left text-lg w-96 mr-2 font-medium border-b-2 border-black outline-none;

Expand Down Expand Up @@ -167,7 +171,7 @@
}

>div {
@apply text-xl break-words leading-8 pl-1;
@apply text-xl break-words leading-8;
}

.blank {
Expand Down Expand Up @@ -230,6 +234,12 @@
.info {
@apply flex flex-col gap-4 border-[3px] border-black rounded-lg p-4 text-lg;

.introduction {
>p {
@apply mb-2
}
}

h3 {
@apply text-4xl font-bold mb-3;
}
Expand Down
38 changes: 35 additions & 3 deletions src/tools/download_audio_and_extract_wave_peaks_and_fragments.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@

import aeneas.executetask
from aeneas.task import Task
from glob import glob


proxies = {}


SCRIPTS_DIR = "./public/assets/{}/scripts"
AUDIOS_DIR = "./public/assets/{}/audios"

Expand Down Expand Up @@ -59,6 +61,7 @@ def get_audio_peaks(file_path, chunk_size_ms=300):


def download_audio(url, file_path):
print(f"Downloading {url}")
response = requests.get(url, stream=True, proxies=proxies)
if response.status_code == 200:
with open(file_path, "wb+") as f:
Expand All @@ -73,7 +76,7 @@ def process_json_file(json_file_path, type):
with open(json_file_path, "r", encoding="utf-8") as f:
data = json.load(f)

audio_url = data.get("audio", [])
audio_url = data.get("audio")
file_name = json_file_path.split("/")[-1][:-5]
file_path = os.path.join(AUDIOS_DIR.format(type), f"{file_name}.mp3")

Expand All @@ -97,7 +100,6 @@ def process_json_file(json_file_path, type):

if data.get("fragments"):
print(f"{file_name} already has fragments data")
return
else:
try:
fragments = get_audio_fragment(
Expand All @@ -112,12 +114,42 @@ def process_json_file(json_file_path, type):
print(json_dumps_str, file=f)


def update_typescript_file(type):
episodes = []
json_files = sorted(glob(os.path.join(SCRIPTS_DIR.format(type), "*.json")))
for json_file in json_files:
print(f"Processing {json_file}")
with open(json_file, "r") as f:
episode_data = json.load(f)
episodes.append(
{
"id": os.path.basename(json_file)[:-5],
"title": episode_data.get("title", ""),
"img": episode_data.get("img", ""),
"url": episode_data.get("url", ""),
"audio": episode_data.get("audio", ""),
}
)

episodes = list(reversed(episodes))
ts_content = (
f"export const episodes = {json.dumps(episodes, indent=2)};\n"
f"export const episodeIds = {json.dumps([e['id'] for e in episodes], indent=2)};\n"
"export default episodes;"
)

with open("./src/utils/{}.ts".format(type), "w") as f:
f.write(ts_content)


def process_json_files_in_folder(type):
# update_typescript_file(type)
for root, _, files in os.walk(SCRIPTS_DIR.format(type)):
for file in files:
if file.endswith(".json"):
json_file_path = os.path.join(root, file)
print(f"Processing {json_file_path}")
process_json_file(json_file_path, type)


process_json_files_in_folder("6mins")
process_json_files_in_folder("tfts")
31 changes: 1 addition & 30 deletions src/tools/scientific_american_crawler.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,34 +87,6 @@ def process_and_save_podcast_data(json_data, output_folder):
with open(output_file_path, "w") as f:
json.dump(output_data, f, indent=2)


def update_typescript_file():
episodes = []
json_files = sorted(glob(os.path.join(OUTPUT_FOLDER, "*.json")))
for json_file in json_files:
with open(json_file, "r") as f:
episode_data = json.load(f)
episodes.append(
{
"id": os.path.basename(json_file)[:-5],
"title": episode_data.get("title", ""),
"img": episode_data.get("img", ""),
"url": episode_data.get("url", ""),
"audio": episode_data.get("audio", ""),
}
)

episodes = list(reversed(episodes))
ts_content = (
f"export const episodes = {json.dumps(episodes, indent=2)};\n"
f"export const episodeIds = {json.dumps([e['id'] for e in episodes], indent=2)};\n"
"export default episodes;"
)

with open("./src/utils/sciam.ts", "w") as f:
f.write(ts_content)


def main(page_limit=30):
page = 1
for _ in range(page_limit):
Expand All @@ -128,5 +100,4 @@ def main(page_limit=30):


if __name__ == "__main__":
# main()
update_typescript_file()
main()
28 changes: 1 addition & 27 deletions src/tools/six_mins_english_crawler.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,29 +160,6 @@ def extract_episode_urls():

return list(dict.fromkeys(urls))

def extract_ts():
bbc_6min_episodes = []
from glob import glob

jsons = glob("./public/assets/6mins/scripts/*.json")
jsons = sorted(jsons)
for j in jsons:
episode = {}
with open(j, "r") as f:
episode = json.load(f)
bbc_6min_episodes.append({
"id": j.split("/")[-1][:-5],
"title": episode.get("title", ""),
"img": episode.get("img", ""),
"url": episode.get("url", ""),
"audio": episode.get("audio", "")
})
with open("./src/utils/6min.ts", "w+") as f:
bbc_6min_episodes = list(reversed(bbc_6min_episodes))
f.write(f"export const episodes = {json.dumps(bbc_6min_episodes)};")
f.write(f"\nexport const episodeIds = {json.dumps([e['id'] for e in bbc_6min_episodes])};")
f.write(f"\nexport default episodes;")


def run():
urls = extract_episode_urls()
Expand All @@ -201,7 +178,4 @@ def run():


if __name__ == "__main__":
# 1. run
# run()
# 2. generate index.ts
extract_ts()
run()
Loading

0 comments on commit df67a7b

Please sign in to comment.