<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:base="https://robinbakker.nl">
  <title>Robin Bakker&#39;s blog posts</title>
  <subtitle>I might write about anything ~ but mostly web dev stuff</subtitle>
  <link href="https://robinbakker.nl/feed.xml" rel="self"/>
  <link href="https://robinbakker.nl"/>
  <updated>2023-05-18T00:00:00Z</updated>
  <id>https://robinbakker.nl</id>
  <author>
    <name>Robin Bakker</name>
  </author>
    <entry>
      <title>From audio to text with AI</title>
      <link href="https://robinbakker.nl/en/blog/podcast-summary/"/>
      <updated>2023-05-18T00:00:00Z</updated>
      <id>https://robinbakker.nl/en/blog/podcast-summary/</id>
      <content xml:lang="en" type="html">&lt;p&gt;Podcasts have become very popular in recent years. More and more people are listening to their favorite shows while on the go, exercising or just relaxing at home. But how could you keep up to date with all these popular podcasts without having to listen to them directly?
That was the question I asked myself as I looked into the use of AI technology in web projects. Summarizing is something chatbots like ChatGPT can do very well &lt;sup class=&quot;footnote-ref&quot;&gt;&lt;a href=&quot;https://robinbakker.nl/en/blog/podcast-summary/#fn1&quot; id=&quot;fnref1&quot;&gt;[1]&lt;/a&gt;&lt;/sup&gt;. So why not with podcasts? I was already working with podcast data for my other hobby projects &lt;a href=&quot;https://1tuner.com/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;1tuner.com&lt;/a&gt; and &lt;a href=&quot;https://topzender.nl/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;topzender.nl&lt;/a&gt;, so I already had the basic data. The first step was to automatically transcribe (convert audio to text) podcast episodes.&lt;/p&gt;
&lt;div class=&quot;svg-wrapper skipcast-openai-logo&quot;&gt;&lt;svg viewBox=&quot;0 0 1180 320&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m367.44 153.84c0 52.32 33.6 88.8 80.16 88.8s80.16-36.48 80.16-88.8-33.6-88.8-80.16-88.8-80.16 36.48-80.16 88.8zm129.6 0c0 37.44-20.4 61.68-49.44 61.68s-49.44-24.24-49.44-61.68 20.4-61.68 49.44-61.68 49.44 24.24 49.44 61.68z&quot;&gt;&lt;/path&gt;&lt;path d=&quot;m614.27 242.64c35.28 0 55.44-29.76 55.44-65.52s-20.16-65.52-55.44-65.52c-16.32 0-28.32 6.48-36.24 15.84v-13.44h-28.8v169.2h28.8v-56.4c7.92 9.36 19.92 15.84 36.24 15.84zm-36.96-69.12c0-23.76 13.44-36.72 31.2-36.72 20.88 0 32.16 16.32 32.16 40.32s-11.28 40.32-32.16 40.32c-17.76 0-31.2-13.2-31.2-36.48z&quot;&gt;&lt;/path&gt;&lt;path d=&quot;m747.65 242.64c25.2 0 45.12-13.2 54-35.28l-24.72-9.36c-3.84 12.96-15.12 20.16-29.28 20.16-18.48 0-31.44-13.2-33.6-34.8h88.32v-9.6c0-34.56-19.44-62.16-55.92-62.16s-60 28.56-60 65.52c0 38.88 25.2 65.52 61.2 65.52zm-1.44-106.8c18.24 0 26.88 12 27.12 25.92h-57.84c4.32-17.04 15.84-25.92 30.72-25.92z&quot;&gt;&lt;/path&gt;&lt;path d=&quot;m823.98 240h28.8v-73.92c0-18 13.2-27.6 26.16-27.6 15.84 0 22.08 11.28 22.08 26.88v74.64h28.8v-83.04c0-27.12-15.84-45.36-42.24-45.36-16.32 0-27.6 7.44-34.8 15.84v-13.44h-28.8z&quot;&gt;&lt;/path&gt;&lt;path d=&quot;m1014.17 67.68-65.28 172.32h30.48l14.64-39.36h74.4l14.88 39.36h30.96l-65.28-172.32zm16.8 34.08 27.36 72h-54.24z&quot;&gt;&lt;/path&gt;&lt;path d=&quot;m1163.69 68.18h-30.72v172.32h30.72z&quot;&gt;&lt;/path&gt;&lt;path d=&quot;m297.06 130.97c7.26-21.79 4.76-45.66-6.85-65.48-17.46-30.4-52.56-46.04-86.84-38.68-15.25-17.18-37.16-26.95-60.13-26.81-35.04-.08-66.13 22.48-76.91 55.82-22.51 4.61-41.94 18.7-53.31 38.67-17.59 30.32-13.58 68.54 9.92 94.54-7.26 21.79-4.76 45.66 6.85 65.48 17.46 30.4 52.56 46.04 86.84 38.68 15.24 17.18 37.16 26.95 60.13 26.8 35.06.09 66.16-22.49 76.94-55.86 22.51-4.61 41.94-18.7 53.31-38.67 17.57-30.32 13.55-68.51-9.94-94.51zm-120.28 168.11c-14.03.02-27.62-4.89-38.39-13.88.49-.26 1.34-.73 1.89-1.07l63.72-36.8c3.26-1.85 5.26-5.32 5.24-9.07v-89.83l26.93 15.55c.29.14.48.42.52.74v74.39c-.04 33.08-26.83 59.9-59.91 59.97zm-128.84-55.03c-7.03-12.14-9.56-26.37-7.15-40.18.47.28 1.3.79 1.89 1.13l63.72 36.8c3.23 1.89 7.23 1.89 10.47 0l77.79-44.92v31.1c.02.32-.13.63-.38.83l-64.41 37.19c-28.69 16.52-65.33 6.7-81.92-21.95zm-16.77-139.09c7-12.16 18.05-21.46 31.21-26.29 0 .55-.03 1.52-.03 2.2v73.61c-.02 3.74 1.98 7.21 5.23 9.06l77.79 44.91-26.93 15.55c-.27.18-.61.21-.91.08l-64.42-37.22c-28.63-16.58-38.45-53.21-21.95-81.89zm221.26 51.49-77.79-44.92 26.93-15.54c.27-.18.61-.21.91-.08l64.42 37.19c28.68 16.57 38.51 53.26 21.94 81.94-7.01 12.14-18.05 21.44-31.2 26.28v-75.81c.03-3.74-1.96-7.2-5.2-9.06zm26.8-40.34c-.47-.29-1.3-.79-1.89-1.13l-63.72-36.8c-3.23-1.89-7.23-1.89-10.47 0l-77.79 44.92v-31.1c-.02-.32.13-.63.38-.83l64.41-37.16c28.69-16.55 65.37-6.7 81.91 22 6.99 12.12 9.52 26.31 7.15 40.1zm-168.51 55.43-26.94-15.55c-.29-.14-.48-.42-.52-.74v-74.39c.02-33.12 26.89-59.96 60.01-59.94 14.01 0 27.57 4.92 38.34 13.88-.49.26-1.33.73-1.89 1.07l-63.72 36.8c-3.26 1.85-5.26 5.31-5.24 9.06l-.04 89.79zm14.63-31.54 34.65-20.01 34.65 20v40.01l-34.65 20-34.65-20z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Whisper&lt;/strong&gt;&lt;br /&gt;
In September 2022, &lt;a href=&quot;https://openai.com/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;OpenAI&lt;/a&gt; made Whisper open source. Whisper is an automatic speech recognition system that can convert audio to text. There were already many variants based on the original code on Github. I saw that the &lt;a href=&quot;https://github.com/ggerganov/whisper.cpp&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;C/C++ port of Whisper&lt;/a&gt; served as the basis for many projects. I just wasn&#39;t sure how I could use it.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Chatting with Bing&lt;/strong&gt;&lt;br /&gt;
AI to the rescue! I had just gained access to the new Bing chat, so decided to query it. 😃 I was given a 10-step guide from downloading from the Github repository to running the generated executable in a Powershell script. What a revelation. Of course, I could have searched this just fine on my own, but the speed and super specific handling of my question at that point was incredible - like suddenly stepping into the future of internet search.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Powershell scripting&lt;/strong&gt;&lt;br /&gt;
I had no experience with Powershell scripts before starting this project, but I could ask the Bing chat to do this as well. Soon I had a script running that downloaded the latest episodes of the Apple top-10 podcasts list. Then I used &lt;a href=&quot;https://ffmpeg.org/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;ffmpeg&lt;/a&gt; to convert each mp3 file to a low-fi wav file so Whisper could work with it.
The first Dutch podcast I tried became an English text. So to my surprise, it was instantly translated into pretty good sounding English sentences!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Whisper parameters&lt;/strong&gt;&lt;br /&gt;
You can give Whisper parameters to indicate, for example, which model to load and what language the audio recording is in. I ended up working with the &amp;quot;small&amp;quot; model, which returns quite a lot of errors, but is acceptable in terms of performance and results.
Those &amp;quot;errors&amp;quot; can be seen in some sentences, in strange dialects or unclear speech. But it is most common with names (of people, places, companies, etc.). A funny example of this from the intro of the podcast &amp;quot;Weer een dag&amp;quot; by Marcel van Roosmalen and Gijs Groenteman:&lt;/p&gt;
&lt;p&gt;&lt;picture&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://robinbakker.nl/assets/img/scheisse-585w.webp&quot; sizes=&quot;100vw&quot; /&gt;&lt;img src=&quot;https://robinbakker.nl/assets/img/scheisse-585w.jpeg&quot; alt=&quot;Intro text of the podcast &#39;Weer een dag&#39;&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; class=&quot;article-image&quot; width=&quot;585&quot; height=&quot;85&quot; /&gt;&lt;/picture&gt;
&lt;em&gt;Scheisse Groentemann… 😄&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;On my lightweight Windows server, transcribing does work quite slowly. But I found out that I could use ffmpeg to speed up the audio another 1.5x, which made transcribing slightly faster as well.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Summarize&lt;/strong&gt;&lt;br /&gt;
AI language models can summarize well. You can&#39;t access ChatGPT or Bing directly via code, but there are several APIs available. Although the OpenAI API is not free, the &amp;quot;gpt-3.5-turbo&amp;quot; model can be used inexpensively. For a few dollars, you can make a huge number of calls. And if you set the monthly limit to, say, $5, you can experiment quite a bit without the danger of accidentally overspending 😀.&lt;/p&gt;
&lt;p&gt;Calling the API is actually similar to using a normal chatbot. Only this one doesn&#39;t have such a good memory. If you want to make a call, you have to provide the chat history yourself. However, you can still provide a &amp;quot;system prompt&amp;quot; for instructions in advance. For example, you can indicate that you want to receive results in Dutch only.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Limitations&lt;/strong&gt;&lt;br /&gt;
However, you can&#39;t just send in an entire chunk of text and have it summarized... There is a limit per prompt. However, you can split texts into pieces of up to 3000 characters, for example. It is recommended to split on whole sentences. For each piece of text I ask for a summary, and those separate summaries I paste back together. From the pasted result I then ask again for a nice summary. This is obviously not ideal and you may lose context, but generally the results for a podcast summary are fine.
What&#39;s funny is that the errors in the transcriptions are actually largely corrected in summarizing. Sometimes I looked at a transcription that I couldn&#39;t understand so quickly. Then the summary was very clear afterwards. 😄&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Writing style&lt;/strong&gt;&lt;br /&gt;
For the website, I wanted summaries in different writing styles. For example, in the prompt I would write; &amp;quot;Can you summarize the following text for an 8-year-old: [text]&amp;quot;. I now create summaries in the styles &amp;quot;News&amp;quot;, &amp;quot;Kids&amp;quot;, &amp;quot;Cynical&amp;quot; and &amp;quot;Gossip&amp;quot;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The perfect prompt&lt;/strong&gt;&lt;br /&gt;
For the news version, I wanted to adopt the &lt;a href=&quot;https://www.axios.com/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Axios.com&lt;/a&gt; writing style (see also the &lt;a href=&quot;https://www.axios.com/smart-brevity&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Smart Brevity book&lt;/a&gt;). My approach was to start with a catchy title, followed by a list of the three most important points, ending with a brief explanation of why this matters. This also pretty much became the prompt. And it gave good results, but strangely not always the same results (different lengths, different bullet points, etc).
Finally I came to the idea of asking for it in Markdown format. So after the prompt I ask for this exact format:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;### Catchy title
- Important point
- Important point
- Important point

Why this matters:
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This approach works very well because it allows you to really force the result into the desired format. And you can also easily integrate Markdown on a web site.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Website&lt;/strong&gt;&lt;br /&gt;
Based on the data, I could now start rendering the podcast episodes. I chose &lt;a href=&quot;https://astro.build/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Astro&lt;/a&gt;, because I expected to create a static website. And Astro also allows you to (re)use Preact components, which I thought would also come in handy for this project.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://skipcast.nl/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;&lt;div class=&quot;svg-wrapper skipcast-logo&quot;&gt;&lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; width=&quot;3125.185&quot; height=&quot;671.216&quot; style=&quot;isolation:isolate&quot; viewBox=&quot;-235.944 275.294 2343.889 503.412&quot;&gt;
&lt;defs&gt;
&lt;linearGradient id=&quot;a&quot; x1=&quot;-.136&quot; x2=&quot;1.161&quot; y1=&quot;.921&quot; y2=&quot;.153&quot;&gt;
&lt;stop offset=&quot;0%&quot; style=&quot;stop-color:#5a99ff&quot;&gt;&lt;/stop&gt;
&lt;stop offset=&quot;100%&quot; style=&quot;stop-color:#a742ff&quot;&gt;&lt;/stop&gt;
&lt;/linearGradient&gt;
&lt;/defs&gt;
&lt;path d=&quot;m-143.696 297.32 279.151-21.724c55.024-4.282 103.173 36.915 107.455 91.94l21.724 279.157c4.282 55.025-36.914 103.175-91.938 107.457l-279.151 21.724c-55.024 4.282-103.173-36.915-107.455-91.94l-21.724-279.157c-4.282-55.025 36.914-103.175 91.938-107.457Z&quot; style=&quot;stroke:none;fill:url(#a);stroke-miterlimit:10&quot;&gt;&lt;/path&gt;
&lt;path fill=&quot;#FFF&quot; d=&quot;m134.082 490.286-50.619-24.689-89.499-43.651c-7.44-3.629-13.013.129-12.435 8.388l4.512 64.524-40.254-19.633-89.499-43.652c-7.441-3.629-13.014.13-12.436 8.388l6.946 99.334 6.946 99.334c.578 8.259 6.619 11.205 13.482 6.576l82.553-55.683 37.13-25.044 4.512 64.524c.578 8.259 6.619 11.205 13.482 6.576l82.553-55.683 46.69-31.493 4.914 70.276c.577 8.259 7.751 14.495 16.01 13.917l26.92-1.882c8.259-.578 14.495-7.751 13.917-16.01l-13.892-198.668c-.577-8.259-7.751-14.495-16.01-13.917L143.085 404c-8.259.578-14.495 7.751-13.917 16.01l4.914 70.276Z&quot;&gt;&lt;/path&gt;
&lt;linearGradient id=&quot;b&quot; x1=&quot;-.136&quot; x2=&quot;1.161&quot; y1=&quot;.921&quot; y2=&quot;.153&quot; gradientTransform=&quot;matrix(1722.387 0 0 416.146 385.558 362.56)&quot; gradientUnits=&quot;userSpaceOnUse&quot;&gt;
&lt;stop offset=&quot;0%&quot; style=&quot;stop-color:#5a99ff&quot;&gt;&lt;/stop&gt;
&lt;stop offset=&quot;100%&quot; style=&quot;stop-color:#a742ff&quot;&gt;&lt;/stop&gt;
&lt;/linearGradient&gt;
&lt;path fill=&quot;url(#b)&quot; d=&quot;M606.511 589.168q0 29.949-16.022 52.149t-44.924 33.091q-28.901 10.89-69.532 10.89-47.122 0-86.287-15.917v-82.307q18.849 13.822 41.678 22.305 22.828 8.482 42.515 8.482 14.87 0 23.038-5.341 8.168-5.34 8.168-15.603 0-7.33-4.084-12.88-4.084-5.55-12.357-10.367-8.273-4.817-30.682-13.194-72.464-27.855-72.464-90.057 0-43.562 33.09-69.637 33.091-26.074 88.8-26.074 15.708 0 28.902 1.256 13.195 1.257 23.981 3.142 10.785 1.885 30.263 7.12v76.444q-37.908-20.734-74.559-20.734-15.079 0-24.294 5.655-9.215 5.654-9.215 15.498 0 9.424 7.435 15.603 7.435 6.178 31.101 16.021 46.703 18.849 66.076 41.259 19.373 22.409 19.373 53.196Zm265.772 90.895h-99.481L725.051 569.9h-.838v110.163h-89.219V362.56h89.219v203.78h.838l43.352-100.738h100.529l-58.013 98.225 61.364 116.236Zm111.419-272.265q0 18.849-13.718 30.578-13.718 11.728-36.128 11.728-21.781 0-35.708-12.147-13.928-12.147-13.928-30.159 0-18.43 13.509-29.844 13.509-11.414 36.127-11.414 22.41 0 36.128 11.414t13.718 29.844Zm-5.236 272.265h-89.219V465.602h89.219v214.461Zm284.83-113.723q0 35.185-11.937 62.202-11.938 27.017-33.719 41.887-21.781 14.869-49.008 14.869-37.698 0-57.175-27.435h-.838v120.843H1021.4V465.602h89.219v29.111h.838q10.681-16.126 27.645-25.236 16.964-9.111 38.536-9.111 41.468 0 63.563 27.645 22.095 27.646 22.095 78.329Zm-90.475 2.722q0-20.315-7.854-31.834-7.854-11.518-24.19-11.518-14.241 0-23.037 12.147-8.797 12.147-8.797 33.3v4.189q0 20.315 7.54 32.462 7.54 12.147 22.619 12.147 16.126 0 24.923-13.299 8.796-13.299 8.796-37.594Zm300.747 38.955v65.972q-8.587 5.026-27.017 8.168-18.43 3.141-42.515 3.141-33.928 0-60.631-13.717-26.703-13.718-41.363-38.432-14.661-24.713-14.661-55.5 0-36.86 15.603-63.144t44.505-40.211q28.902-13.928 67.019-13.928 20.943 0 37.593 2.723 16.65 2.722 21.467 6.283v69.532q-6.702-5.236-19.268-9.215t-23.247-3.979q-26.179 0-39.688 12.461-13.508 12.461-13.508 35.08 0 22.2 13.299 34.452 13.299 12.252 36.546 12.252 24.923 0 45.866-11.938Zm236.033 72.046h-81.47v-32.672h-.838q-21.362 37.907-65.343 37.907-30.368 0-47.542-18.011-17.174-18.011-17.174-48.17 0-63.249 77.7-73.302l53.197-6.911q0-10.472-9.425-17.174-9.424-6.702-25.341-6.702-36.023 0-76.025 20.525V477.54q17.383-7.54 43.562-12.357 26.18-4.817 44.819-4.817 54.663 0 79.271 23.352 24.609 23.352 24.609 78.014v118.331Zm-134.248-72.883q0 8.796 5.55 14.45 5.55 5.655 15.813 5.655 14.032 0 22.723-10.472 8.692-10.471 8.692-26.807v-8.168l-30.159 4.189q-22.619 3.769-22.619 21.153Zm348.708 1.675q0 36.442-27.75 56.442-27.75 20.001-77.386 20.001-14.451 0-35.708-2.932-21.258-2.932-34.662-7.12v-62.621q39.583 17.592 66.182 17.592 26.179 0 26.179-13.613 0-5.655-6.074-9.32-6.073-3.665-31.834-12.252-28.483-9.005-41.468-23.875-12.985-14.87-12.985-38.745 0-33.301 26.494-52.673 26.493-19.373 74.454-19.373 28.064 0 59.479 8.168v60.108q-13.194-5.655-28.902-9.425-15.708-3.77-26.389-3.77-8.796 0-14.032 2.932-5.236 2.932-5.236 8.168 0 6.074 5.655 9.844 5.655 3.77 22.619 9.005 32.881 9.634 47.123 24.714 14.241 15.079 14.241 38.745Zm183.883 6.492v61.784q-6.073 2.932-19.896 5.55-13.822 2.617-33.3 2.617-37.279 0-58.327-20.524-21.048-20.525-21.048-58.432v-78.957h-33.719v-61.783h33.719v-42.096l87.962-24.295v66.391h44.609v61.783h-44.609v64.296q0 28.274 22.409 28.274 10.472 0 22.2-4.608Z&quot;&gt;&lt;/path&gt;
&lt;/svg&gt;&lt;/div&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The website runs at &lt;a href=&quot;https://vercel.com/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Vercel&lt;/a&gt;. Via the @astrojs/vercel adapter you can therefore easily turn on page statistics.
After a podcast episode is processed, a &amp;quot;deploy hook&amp;quot; is called which refreshes the website.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;POM Telegram community&lt;/strong&gt;&lt;br /&gt;
I regularly listen to the &lt;a href=&quot;https://pom.show/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Dutch podcast POM&lt;/a&gt; - about media and technology. There is a related &lt;a href=&quot;https://pom.community/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;group chat in Telegram&lt;/a&gt;, where, for example, in the &amp;quot;Artificial Intelligence&amp;quot; channel many cool links and tips are shared. But also experiments from other listeners. For example, Jan created an Axios-style news website (&lt;a href=&quot;https://www.inhetkort.xyz/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://www.inhetkort.xyz&lt;/a&gt;) and Frank a completely &lt;a href=&quot;https://1tuner.com/podcast/beyond-the-screen/aHR0cHM6Ly9mZWVkcy50cmFuc2lzdG9yLmZtL2JleW9uZC10aGUtc2NyZWVuLTg1ZDg3ZWYzLWRjYzYtNDg5NC1iMjI2LTQxYWNkM2U3ZmRiMg==&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;AI-generated podcast&lt;/a&gt; using his own voice. So really 🤯. I also shared &lt;a href=&quot;http://skipcast.nl/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;skipcast.nl&lt;/a&gt; there and not long after, &lt;a href=&quot;https://twitter.com/AlexanderNL/status/1654425839566561282&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;someone shared that on Twitter&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;But even better, Skipcast ended up making it into the &lt;a href=&quot;https://robinbakker.nl/en/blog/podcast-summary/(https://share.podimo.com/play/episode/1c6e9037-53da-464e-a9ef-dd23e63bd90a/timestamp/2358?creatorId=1bd2d592-e31f-42a3-ac55-1fe40c92ecd9&amp;amp;key=UwRLg6r8r0OE)&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;podcast itself&lt;/a&gt;! 🤗🎉🎉&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=gBPxej3XCUE&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;&lt;picture&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://robinbakker.nl/assets/img/skipcast-youtube-pom-240w.webp 240w, https://robinbakker.nl/assets/img/skipcast-youtube-pom-320w.webp 320w, https://robinbakker.nl/assets/img/skipcast-youtube-pom-480w.webp 480w&quot; sizes=&quot;100vw&quot; /&gt;&lt;img src=&quot;https://robinbakker.nl/assets/img/skipcast-youtube-pom-240w.jpeg&quot; alt=&quot;Watch the snippet from the podcast on YouTube&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; class=&quot;article-image&quot; width=&quot;480&quot; height=&quot;270&quot; srcset=&quot;https://robinbakker.nl/assets/img/skipcast-youtube-pom-240w.jpeg 240w, https://robinbakker.nl/assets/img/skipcast-youtube-pom-320w.jpeg 320w, https://robinbakker.nl/assets/img/skipcast-youtube-pom-480w.jpeg 480w&quot; sizes=&quot;100vw&quot; /&gt;&lt;/picture&gt;&lt;/a&gt;
&lt;em&gt;The clip can also be found &lt;a href=&quot;https://www.youtube.com/watch?v=gBPxej3XCUE&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;on YouTube&lt;/a&gt; (Dutch)&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;What&#39;s next?&lt;/strong&gt;&lt;br /&gt;
I actually wanted to get the highlights from the transcripts and then provide quick access to those specific podcast snippets. Maybe I&#39;ll explore that idea further.
Another question on Twitter was whether it could also be sent via email. Some kind of personal overview would also be nice, of course.
As long as it stays fun, I&#39;m still going to tinker with it. But it could also well be that I will set up another little AI experiment 🤓.&lt;/p&gt;
&lt;hr class=&quot;footnotes-sep&quot; /&gt;
&lt;section class=&quot;footnotes&quot;&gt;
&lt;ol class=&quot;footnotes-list&quot;&gt;
&lt;li id=&quot;fn1&quot; class=&quot;footnote-item&quot;&gt;&lt;p&gt;By the way, ChatGPT can also write an introduction quite well, as you might have noticed. 😜 &lt;a href=&quot;https://robinbakker.nl/en/blog/podcast-summary/#fnref1&quot; class=&quot;footnote-backref&quot;&gt;↩︎&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/section&gt;
</content>
    </entry>
    <entry>
      <title>Van audio naar tekst met AI</title>
      <link href="https://robinbakker.nl/blog/podcast-samenvatting/"/>
      <updated>2023-05-18T00:00:00Z</updated>
      <id>https://robinbakker.nl/blog/podcast-samenvatting/</id>
      <content xml:lang="nl" type="html">&lt;p&gt;Podcasts zijn de afgelopen jaren enorm populair geworden. Steeds meer mensen luisteren naar hun favoriete shows terwijl ze onderweg zijn, aan het sporten zijn of gewoon thuis ontspannen. Maar hoe zou je nu op de hoogte kunnen blijven van al die populaire podcasts, zonder er direct naar te hoeven luisteren?&lt;br /&gt;
Dat was de vraag die ik me stelde toen ik me verdiepte in het gebruik van AI/KI technologie in web projecten. Samenvatten is iets wat chatbots zoals ChatGPT heel goed kunnen &lt;sup class=&quot;footnote-ref&quot;&gt;&lt;a href=&quot;https://robinbakker.nl/blog/podcast-samenvatting/#fn1&quot; id=&quot;fnref1&quot;&gt;[1]&lt;/a&gt;&lt;/sup&gt;. Dus waarom niet met podcasts? Ik werkte al met podcastgegevens voor mijn andere hobbyprojecten &lt;a href=&quot;https://1tuner.com/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;1tuner.com&lt;/a&gt; en &lt;a href=&quot;https://topzender.nl/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;topzender.nl&lt;/a&gt;, dus de basisgegevens had ik al. De eerste stap was het automatisch transcriberen (het omzetten van audio naar tekst) van podcastafleveringen.&lt;/p&gt;
&lt;div class=&quot;svg-wrapper skipcast-openai-logo&quot;&gt;&lt;svg viewBox=&quot;0 0 1180 320&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m367.44 153.84c0 52.32 33.6 88.8 80.16 88.8s80.16-36.48 80.16-88.8-33.6-88.8-80.16-88.8-80.16 36.48-80.16 88.8zm129.6 0c0 37.44-20.4 61.68-49.44 61.68s-49.44-24.24-49.44-61.68 20.4-61.68 49.44-61.68 49.44 24.24 49.44 61.68z&quot;&gt;&lt;/path&gt;&lt;path d=&quot;m614.27 242.64c35.28 0 55.44-29.76 55.44-65.52s-20.16-65.52-55.44-65.52c-16.32 0-28.32 6.48-36.24 15.84v-13.44h-28.8v169.2h28.8v-56.4c7.92 9.36 19.92 15.84 36.24 15.84zm-36.96-69.12c0-23.76 13.44-36.72 31.2-36.72 20.88 0 32.16 16.32 32.16 40.32s-11.28 40.32-32.16 40.32c-17.76 0-31.2-13.2-31.2-36.48z&quot;&gt;&lt;/path&gt;&lt;path d=&quot;m747.65 242.64c25.2 0 45.12-13.2 54-35.28l-24.72-9.36c-3.84 12.96-15.12 20.16-29.28 20.16-18.48 0-31.44-13.2-33.6-34.8h88.32v-9.6c0-34.56-19.44-62.16-55.92-62.16s-60 28.56-60 65.52c0 38.88 25.2 65.52 61.2 65.52zm-1.44-106.8c18.24 0 26.88 12 27.12 25.92h-57.84c4.32-17.04 15.84-25.92 30.72-25.92z&quot;&gt;&lt;/path&gt;&lt;path d=&quot;m823.98 240h28.8v-73.92c0-18 13.2-27.6 26.16-27.6 15.84 0 22.08 11.28 22.08 26.88v74.64h28.8v-83.04c0-27.12-15.84-45.36-42.24-45.36-16.32 0-27.6 7.44-34.8 15.84v-13.44h-28.8z&quot;&gt;&lt;/path&gt;&lt;path d=&quot;m1014.17 67.68-65.28 172.32h30.48l14.64-39.36h74.4l14.88 39.36h30.96l-65.28-172.32zm16.8 34.08 27.36 72h-54.24z&quot;&gt;&lt;/path&gt;&lt;path d=&quot;m1163.69 68.18h-30.72v172.32h30.72z&quot;&gt;&lt;/path&gt;&lt;path d=&quot;m297.06 130.97c7.26-21.79 4.76-45.66-6.85-65.48-17.46-30.4-52.56-46.04-86.84-38.68-15.25-17.18-37.16-26.95-60.13-26.81-35.04-.08-66.13 22.48-76.91 55.82-22.51 4.61-41.94 18.7-53.31 38.67-17.59 30.32-13.58 68.54 9.92 94.54-7.26 21.79-4.76 45.66 6.85 65.48 17.46 30.4 52.56 46.04 86.84 38.68 15.24 17.18 37.16 26.95 60.13 26.8 35.06.09 66.16-22.49 76.94-55.86 22.51-4.61 41.94-18.7 53.31-38.67 17.57-30.32 13.55-68.51-9.94-94.51zm-120.28 168.11c-14.03.02-27.62-4.89-38.39-13.88.49-.26 1.34-.73 1.89-1.07l63.72-36.8c3.26-1.85 5.26-5.32 5.24-9.07v-89.83l26.93 15.55c.29.14.48.42.52.74v74.39c-.04 33.08-26.83 59.9-59.91 59.97zm-128.84-55.03c-7.03-12.14-9.56-26.37-7.15-40.18.47.28 1.3.79 1.89 1.13l63.72 36.8c3.23 1.89 7.23 1.89 10.47 0l77.79-44.92v31.1c.02.32-.13.63-.38.83l-64.41 37.19c-28.69 16.52-65.33 6.7-81.92-21.95zm-16.77-139.09c7-12.16 18.05-21.46 31.21-26.29 0 .55-.03 1.52-.03 2.2v73.61c-.02 3.74 1.98 7.21 5.23 9.06l77.79 44.91-26.93 15.55c-.27.18-.61.21-.91.08l-64.42-37.22c-28.63-16.58-38.45-53.21-21.95-81.89zm221.26 51.49-77.79-44.92 26.93-15.54c.27-.18.61-.21.91-.08l64.42 37.19c28.68 16.57 38.51 53.26 21.94 81.94-7.01 12.14-18.05 21.44-31.2 26.28v-75.81c.03-3.74-1.96-7.2-5.2-9.06zm26.8-40.34c-.47-.29-1.3-.79-1.89-1.13l-63.72-36.8c-3.23-1.89-7.23-1.89-10.47 0l-77.79 44.92v-31.1c-.02-.32.13-.63.38-.83l64.41-37.16c28.69-16.55 65.37-6.7 81.91 22 6.99 12.12 9.52 26.31 7.15 40.1zm-168.51 55.43-26.94-15.55c-.29-.14-.48-.42-.52-.74v-74.39c.02-33.12 26.89-59.96 60.01-59.94 14.01 0 27.57 4.92 38.34 13.88-.49.26-1.33.73-1.89 1.07l-63.72 36.8c-3.26 1.85-5.26 5.31-5.24 9.06l-.04 89.79zm14.63-31.54 34.65-20.01 34.65 20v40.01l-34.65 20-34.65-20z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Whisper&lt;/strong&gt;&lt;br /&gt;
In september 2022 maakte &lt;a href=&quot;https://openai.com/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;OpenAI&lt;/a&gt; Whisper open source. Whisper is een automatisch spraakherkenningssysteem dat audio kan omzetten naar tekst. Er stonden al veel varianten gebaseerd op de oorspronkelijke code op Github. Ik zag dat de &lt;a href=&quot;https://github.com/ggerganov/whisper.cpp&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;C/C++ port van Whisper&lt;/a&gt; als basis diende voor veel projecten. Ik wist alleen niet goed hoe ik dit zou kunnen gebruiken.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Chatten met Bing&lt;/strong&gt;&lt;br /&gt;
AI to the rescue! Ik had net toegang gekregen tot de nieuwe &lt;a href=&quot;https://www.bing.com/search?q=Bing+AI&amp;amp;showconv=1&amp;amp;FORM=hpcodx&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Bing chat&lt;/a&gt;, dus besloot ‘m te bevragen. 😃 Ik kreeg een 10-stappenplan vanaf het downloaden van de Github repository tot het draaien van de gegenereerde executable in een Powershell script. Wat een openbaring. Dit had ik natuurlijk ook prima zelf kunnen zoeken, maar de snelheid en super specifieke afhandeling van mijn vraag was op dat moment ongelooflijk - alsof je ineens in de toekomst van zoeken op internet was gestapt.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Powershell scripting&lt;/strong&gt;&lt;br /&gt;
Ik had geen ervaring met Powershell scripts voordat ik dit project begon, maar dit kon ik de Bing chat ook vragen. Al snel had ik een script draaien waarmee de laatste afleveringen van de Apple top-10 podcasts lijst werden gedownload. Vervolgens gebruikte ik &lt;a href=&quot;https://ffmpeg.org/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;ffmpeg&lt;/a&gt; om elk mp3-bestand om te zetten naar een low-fi wav-bestand, zodat Whisper ermee aan de slag kon.&lt;br /&gt;
De eerste Nederlandse podcast die ik deed werd een Engelse tekst. Tot mijn verbazing was het dus direct vertaald in vrij goed lopende Engelstalige zinnen!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Whisper parameters&lt;/strong&gt;&lt;br /&gt;
Je kunt Whisper parameters meegeven om bijvoorbeeld aan te geven welk model ingeladen moet worden en in welke taal de audio-opname is. Uiteindelijk werkte ik met het “small” model, wat nog best veel foutjes teruggeeft, maar qua performance en resultaat acceptabel is.&lt;br /&gt;
Die “foutjes” zie je terug in sommige zinnen, bij vreemde spreektaal of typetjes (iemand die plat Arnhems praat). Maar het komt het meest voor bij namen (van personen, plaatsen, bedrijven, etc.). Een leuk voorbeeld hiervan uit het intro van de podcast “Weer een dag” van Marcel van Roosmalen en Gijs Groenteman:&lt;/p&gt;
&lt;p&gt;&lt;picture&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://robinbakker.nl/assets/img/scheisse-585w.webp&quot; sizes=&quot;100vw&quot; /&gt;&lt;img src=&quot;https://robinbakker.nl/assets/img/scheisse-585w.jpeg&quot; alt=&quot;Intro tekst van de podcast &#39;Weer een dag&#39;&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; class=&quot;article-image&quot; width=&quot;585&quot; height=&quot;85&quot; /&gt;&lt;/picture&gt;
&lt;em&gt;Scheisse Groentemann… 😄&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Op mijn lichtgewicht Windows servertje werkt het transcriberen wel vrij traag. Maar ik kwam erachter dat ik met ffmpeg de audio nog 1.5x kon versnellen, waardoor het transcriberen ook iets sneller ging.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Samenvatten&lt;/strong&gt;&lt;br /&gt;
AI taalmodellen kunnen goed samenvatten. ChatGPT of Bing kun je niet direct aanroepen, maar er zijn verschillende API&#39;s beschikbaar. Hoewel de OpenAI API niet gratis is, kan het “gpt-3.5-turbo” model goedkoop worden gebruikt. Voor een paar dollar kun je enorm veel aanroepen doen. En als je de maandlimiet instelt op bijvoorbeeld 5 dollar, dan kun je flink experimenteren zonder het gevaar dat je per ongeluk teveel uitgeeft. 😀&lt;/p&gt;
&lt;p&gt;De aanroep van de API is eigenlijk vergelijkbaar met het gebruik van een normale chatbot. Alleen heeft deze niet zo’n goed geheugen. Als je een gesprek wilt voeren moet je zelf de chathistorie meegeven. Je kunt wel nog vooraf een “system prompt” geven voor instructies vooraf. Zo kun je bijvoorbeeld aangeven dat je resultaten uitsluitend in het Nederlands wilt ontvangen.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Beperkingen&lt;/strong&gt;&lt;br /&gt;
Je kunt echter niet zomaar een hele lap tekst insturen en daar een samenvatting van laten maken… Er is een limiet per prompt. Je kunt teksten wel opsplitsen in stukken van bijvoorbeeld maximaal 3000 tekens. Een tip is om te splitsen op hele zinnen. Per stuk tekst vraag ik om een samenvatting, en die losse samenvattingen plak ik weer aan elkaar. Van het geplakte resultaat vraag ik dan nog eens om een mooie samenvatting. Dit is uiteraard niet ideaal en je verliest mogelijk context, maar over het algemeen zijn de resultaten voor een podcast samenvatting prima.&lt;br /&gt;
Grappig is dat de foutjes in de transcripties eigenlijk grotendeels worden verbeterd bij het samenvatten. Soms keek ik naar een transcriptie waar ik zo snel geen kaas van kon maken. De samenvatting was dan vervolgens heel helder. 😄&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Schrijfstijl&lt;/strong&gt;&lt;br /&gt;
Voor de website wilde ik samenvattingen in verschillende schrijfstijlen. In de prompt schrijf ik dan bijvoorbeeld; “Kun je de volgende tekst samenvatten voor een 8-jarige: [tekst]”. Ik maak nu samenvattingen in de stijlen &amp;quot;Nieuws&amp;quot;, &amp;quot;Kids&amp;quot;, &amp;quot;Cynisch&amp;quot; en &amp;quot;Roddels&amp;quot;. De stijl &amp;quot;Teleshopping&amp;quot; heb ik laten vallen, die gaf het minst leuke resultaat.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;De perfecte prompt&lt;/strong&gt;&lt;br /&gt;
Voor de nieuwsvariant wilde ik de &lt;a href=&quot;https://www.axios.com/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Axios.com&lt;/a&gt; schrijfstijl aanhouden (zie ook het &lt;a href=&quot;https://www.axios.com/smart-brevity&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Smart Brevity boek&lt;/a&gt;). Mijn benadering was om te beginnen met een pakkende titel, gevolgd door een opsomming van de drie belangrijkste punten, afgesloten met een korte uitleg over waarom dit belangrijk is. Dit werd ook zo ongeveer de prompt. En het gaf goede resultaten, maar vreemd genoeg niet altijd hetzelfde resultaat (verschillende lengtes, andere opsommingen, etc).&lt;br /&gt;
Uiteindelijk kwam ik tot het idee om het in het Markdown-formaat te vragen. Dus na de prompt vraag ik om dit exacte formaat:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;### Korte pakkende zin
- Belangrijk punt
- Belangrijk punt
- Belangrijk punt

Waarom dit ertoe doet:
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Deze aanpak werkt erg goed, omdat je hiermee het resultaat echt kunt dwingen in het gewenste formaat. En je kunt Markdown op een website ook makkelijk integreren.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Website&lt;/strong&gt;&lt;br /&gt;
Op basis van de data kon ik nu de podcastafleveringen gaan afbeelden. Ik koos voor &lt;a href=&quot;https://astro.build/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Astro&lt;/a&gt;, omdat ik verwachtte een statische website te kunnen maken. En met Astro kun je ook Preact componenten (her)gebruiken, wat mij voor dit project ook wel handig leek.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://skipcast.nl/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;&lt;div class=&quot;svg-wrapper skipcast-logo&quot;&gt;&lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; width=&quot;3125.185&quot; height=&quot;671.216&quot; style=&quot;isolation:isolate&quot; viewBox=&quot;-235.944 275.294 2343.889 503.412&quot;&gt;
&lt;defs&gt;
&lt;linearGradient id=&quot;a&quot; x1=&quot;-.136&quot; x2=&quot;1.161&quot; y1=&quot;.921&quot; y2=&quot;.153&quot;&gt;
&lt;stop offset=&quot;0%&quot; style=&quot;stop-color:#5a99ff&quot;&gt;&lt;/stop&gt;
&lt;stop offset=&quot;100%&quot; style=&quot;stop-color:#a742ff&quot;&gt;&lt;/stop&gt;
&lt;/linearGradient&gt;
&lt;/defs&gt;
&lt;path d=&quot;m-143.696 297.32 279.151-21.724c55.024-4.282 103.173 36.915 107.455 91.94l21.724 279.157c4.282 55.025-36.914 103.175-91.938 107.457l-279.151 21.724c-55.024 4.282-103.173-36.915-107.455-91.94l-21.724-279.157c-4.282-55.025 36.914-103.175 91.938-107.457Z&quot; style=&quot;stroke:none;fill:url(#a);stroke-miterlimit:10&quot;&gt;&lt;/path&gt;
&lt;path fill=&quot;#FFF&quot; d=&quot;m134.082 490.286-50.619-24.689-89.499-43.651c-7.44-3.629-13.013.129-12.435 8.388l4.512 64.524-40.254-19.633-89.499-43.652c-7.441-3.629-13.014.13-12.436 8.388l6.946 99.334 6.946 99.334c.578 8.259 6.619 11.205 13.482 6.576l82.553-55.683 37.13-25.044 4.512 64.524c.578 8.259 6.619 11.205 13.482 6.576l82.553-55.683 46.69-31.493 4.914 70.276c.577 8.259 7.751 14.495 16.01 13.917l26.92-1.882c8.259-.578 14.495-7.751 13.917-16.01l-13.892-198.668c-.577-8.259-7.751-14.495-16.01-13.917L143.085 404c-8.259.578-14.495 7.751-13.917 16.01l4.914 70.276Z&quot;&gt;&lt;/path&gt;
&lt;linearGradient id=&quot;b&quot; x1=&quot;-.136&quot; x2=&quot;1.161&quot; y1=&quot;.921&quot; y2=&quot;.153&quot; gradientTransform=&quot;matrix(1722.387 0 0 416.146 385.558 362.56)&quot; gradientUnits=&quot;userSpaceOnUse&quot;&gt;
&lt;stop offset=&quot;0%&quot; style=&quot;stop-color:#5a99ff&quot;&gt;&lt;/stop&gt;
&lt;stop offset=&quot;100%&quot; style=&quot;stop-color:#a742ff&quot;&gt;&lt;/stop&gt;
&lt;/linearGradient&gt;
&lt;path fill=&quot;url(#b)&quot; d=&quot;M606.511 589.168q0 29.949-16.022 52.149t-44.924 33.091q-28.901 10.89-69.532 10.89-47.122 0-86.287-15.917v-82.307q18.849 13.822 41.678 22.305 22.828 8.482 42.515 8.482 14.87 0 23.038-5.341 8.168-5.34 8.168-15.603 0-7.33-4.084-12.88-4.084-5.55-12.357-10.367-8.273-4.817-30.682-13.194-72.464-27.855-72.464-90.057 0-43.562 33.09-69.637 33.091-26.074 88.8-26.074 15.708 0 28.902 1.256 13.195 1.257 23.981 3.142 10.785 1.885 30.263 7.12v76.444q-37.908-20.734-74.559-20.734-15.079 0-24.294 5.655-9.215 5.654-9.215 15.498 0 9.424 7.435 15.603 7.435 6.178 31.101 16.021 46.703 18.849 66.076 41.259 19.373 22.409 19.373 53.196Zm265.772 90.895h-99.481L725.051 569.9h-.838v110.163h-89.219V362.56h89.219v203.78h.838l43.352-100.738h100.529l-58.013 98.225 61.364 116.236Zm111.419-272.265q0 18.849-13.718 30.578-13.718 11.728-36.128 11.728-21.781 0-35.708-12.147-13.928-12.147-13.928-30.159 0-18.43 13.509-29.844 13.509-11.414 36.127-11.414 22.41 0 36.128 11.414t13.718 29.844Zm-5.236 272.265h-89.219V465.602h89.219v214.461Zm284.83-113.723q0 35.185-11.937 62.202-11.938 27.017-33.719 41.887-21.781 14.869-49.008 14.869-37.698 0-57.175-27.435h-.838v120.843H1021.4V465.602h89.219v29.111h.838q10.681-16.126 27.645-25.236 16.964-9.111 38.536-9.111 41.468 0 63.563 27.645 22.095 27.646 22.095 78.329Zm-90.475 2.722q0-20.315-7.854-31.834-7.854-11.518-24.19-11.518-14.241 0-23.037 12.147-8.797 12.147-8.797 33.3v4.189q0 20.315 7.54 32.462 7.54 12.147 22.619 12.147 16.126 0 24.923-13.299 8.796-13.299 8.796-37.594Zm300.747 38.955v65.972q-8.587 5.026-27.017 8.168-18.43 3.141-42.515 3.141-33.928 0-60.631-13.717-26.703-13.718-41.363-38.432-14.661-24.713-14.661-55.5 0-36.86 15.603-63.144t44.505-40.211q28.902-13.928 67.019-13.928 20.943 0 37.593 2.723 16.65 2.722 21.467 6.283v69.532q-6.702-5.236-19.268-9.215t-23.247-3.979q-26.179 0-39.688 12.461-13.508 12.461-13.508 35.08 0 22.2 13.299 34.452 13.299 12.252 36.546 12.252 24.923 0 45.866-11.938Zm236.033 72.046h-81.47v-32.672h-.838q-21.362 37.907-65.343 37.907-30.368 0-47.542-18.011-17.174-18.011-17.174-48.17 0-63.249 77.7-73.302l53.197-6.911q0-10.472-9.425-17.174-9.424-6.702-25.341-6.702-36.023 0-76.025 20.525V477.54q17.383-7.54 43.562-12.357 26.18-4.817 44.819-4.817 54.663 0 79.271 23.352 24.609 23.352 24.609 78.014v118.331Zm-134.248-72.883q0 8.796 5.55 14.45 5.55 5.655 15.813 5.655 14.032 0 22.723-10.472 8.692-10.471 8.692-26.807v-8.168l-30.159 4.189q-22.619 3.769-22.619 21.153Zm348.708 1.675q0 36.442-27.75 56.442-27.75 20.001-77.386 20.001-14.451 0-35.708-2.932-21.258-2.932-34.662-7.12v-62.621q39.583 17.592 66.182 17.592 26.179 0 26.179-13.613 0-5.655-6.074-9.32-6.073-3.665-31.834-12.252-28.483-9.005-41.468-23.875-12.985-14.87-12.985-38.745 0-33.301 26.494-52.673 26.493-19.373 74.454-19.373 28.064 0 59.479 8.168v60.108q-13.194-5.655-28.902-9.425-15.708-3.77-26.389-3.77-8.796 0-14.032 2.932-5.236 2.932-5.236 8.168 0 6.074 5.655 9.844 5.655 3.77 22.619 9.005 32.881 9.634 47.123 24.714 14.241 15.079 14.241 38.745Zm183.883 6.492v61.784q-6.073 2.932-19.896 5.55-13.822 2.617-33.3 2.617-37.279 0-58.327-20.524-21.048-20.525-21.048-58.432v-78.957h-33.719v-61.783h33.719v-42.096l87.962-24.295v66.391h44.609v61.783h-44.609v64.296q0 28.274 22.409 28.274 10.472 0 22.2-4.608Z&quot;&gt;&lt;/path&gt;
&lt;/svg&gt;&lt;/div&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;De website draait bij &lt;a href=&quot;https://vercel.com/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Vercel&lt;/a&gt;, via de @astrojs/vercel adapter kun je dan ook eenvoudig paginastatistieken aanzetten.&lt;br /&gt;
Nadat een podcastaflevering is verwerkt, wordt een &amp;quot;deploy hook&amp;quot; aangeroepen waardoor de website vernieuwd wordt.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;POM Telegram community&lt;/strong&gt;&lt;br /&gt;
Ik luister regelmatig naar de &lt;a href=&quot;https://pom.show/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;podcast POM&lt;/a&gt; - over media en technologie. Er is een bijhorende &lt;a href=&quot;https://pom.community/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;groepschat in Telegram&lt;/a&gt;, waar bijvoorbeeld in het “Kunstmatige Intelligentie” kanaal veel toffe links en tips gedeeld worden. Maar ook experimenten van andere luisteraars. Zo maakte Jan een nieuws website in Axios-stijl (&lt;a href=&quot;https://www.inhetkort.xyz/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://www.inhetkort.xyz&lt;/a&gt;) en Frank een volledig &lt;a href=&quot;https://1tuner.com/podcast/beyond-the-screen/aHR0cHM6Ly9mZWVkcy50cmFuc2lzdG9yLmZtL2JleW9uZC10aGUtc2NyZWVuLTg1ZDg3ZWYzLWRjYzYtNDg5NC1iMjI2LTQxYWNkM2U3ZmRiMg==&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;door AI gegenereerde podcast&lt;/a&gt; met gebruik van zijn eigen stem. Echt 🤯 dus. Ik deelde daar ook &lt;a href=&quot;http://skipcast.nl/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;skipcast.nl&lt;/a&gt; en niet lang daarna zette &lt;a href=&quot;https://twitter.com/AlexanderNL/status/1654425839566561282&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;iemand dat op Twitter&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Maar nog mooier is dat Skipcast het uiteindelijk heeft gehaald &lt;a href=&quot;https://share.podimo.com/play/episode/1c6e9037-53da-464e-a9ef-dd23e63bd90a/timestamp/2358?creatorId=1bd2d592-e31f-42a3-ac55-1fe40c92ecd9&amp;amp;key=UwRLg6r8r0OE&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;in de podcast zelf&lt;/a&gt; (link naar Podimo op 39:18)! 🤗🎉🎉&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=gBPxej3XCUE&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;&lt;picture&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://robinbakker.nl/assets/img/skipcast-youtube-pom-240w.webp 240w, https://robinbakker.nl/assets/img/skipcast-youtube-pom-320w.webp 320w, https://robinbakker.nl/assets/img/skipcast-youtube-pom-480w.webp 480w&quot; sizes=&quot;100vw&quot; /&gt;&lt;img src=&quot;https://robinbakker.nl/assets/img/skipcast-youtube-pom-240w.jpeg&quot; alt=&quot;Bekijk het stukje uit de podcast op YouTube&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; class=&quot;article-image&quot; width=&quot;480&quot; height=&quot;270&quot; srcset=&quot;https://robinbakker.nl/assets/img/skipcast-youtube-pom-240w.jpeg 240w, https://robinbakker.nl/assets/img/skipcast-youtube-pom-320w.jpeg 320w, https://robinbakker.nl/assets/img/skipcast-youtube-pom-480w.jpeg 480w&quot; sizes=&quot;100vw&quot; /&gt;&lt;/picture&gt;&lt;/a&gt;
&lt;em&gt;Het fragment is ook te vinden &lt;a href=&quot;https://www.youtube.com/watch?v=gBPxej3XCUE&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;op YouTube&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;En verder?&lt;/strong&gt;&lt;br /&gt;
Ik wilde eigenlijk liever nog de hoogtepunten uit de transcripties halen en dan snel toegang bieden aan die specifieke podcast fragmenten. Misschien dat ik dat idee nog wel verder ga uitwerken.&lt;br /&gt;
Een andere vraag op Twitter was of het ook via mail gestuurd zou kunnen worden. Een soort persoonlijk overzicht zou ook leuk zijn natuurlijk.&lt;br /&gt;
Zolang het leuk blijft, ga ik er nog wel aan sleutelen. Maar het zou ook goed kunnen dat ik een volgend AI experimentje ga opzetten 🤓&lt;/p&gt;
&lt;hr class=&quot;footnotes-sep&quot; /&gt;
&lt;section class=&quot;footnotes&quot;&gt;
&lt;ol class=&quot;footnotes-list&quot;&gt;
&lt;li id=&quot;fn1&quot; class=&quot;footnote-item&quot;&gt;&lt;p&gt;Een inleiding schrijven kan ChatGPT overigens ook vrij goed, zoals je misschien wel had gemerkt. 😜 &lt;a href=&quot;https://robinbakker.nl/blog/podcast-samenvatting/#fnref1&quot; class=&quot;footnote-backref&quot;&gt;↩︎&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/section&gt;
</content>
    </entry>
    <entry>
      <title>Displaying maps in Astro (and maps resources)</title>
      <link href="https://robinbakker.nl/en/blog/maps-in-astro/"/>
      <updated>2022-09-09T00:00:00Z</updated>
      <id>https://robinbakker.nl/en/blog/maps-in-astro/</id>
      <content xml:lang="en" type="html">&lt;p&gt;Last summer we went on a family road trip in the USA with an RV. That was awesome! For fun and to keep everyone up to date at home, I wanted to create a travel blog (&lt;a href=&quot;https://www.rroadtrips.com/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;rroadtrips.com&lt;/a&gt;) with a map to show the route.&lt;/p&gt;
&lt;p&gt;I wanted to build something with &lt;a href=&quot;https://astro.build/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Astro&lt;/a&gt; and was very time limited. 😅 So I was looking for a simple solution to display a map. Because Astro works with all kind of components/frameworks, I thought it would be easy to drop-in an existing React component and then just go with it...&lt;/p&gt;
&lt;p&gt;However, I quickly found out that it wouldn&#39;t be that logical to do that. Astro is all about static rendering and zero javascript, and that would not be the case with an interactive map. So loading the complete React library for just one component? 🤔 &lt;a href=&quot;https://preactjs.com/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Preact&lt;/a&gt; (the 3KB React alternative) would be a better fit for this! And I could easily add other custom Preact components that would mostly render completely static with Astro.&lt;/p&gt;
&lt;h3&gt;TL;DR&lt;/h3&gt;
&lt;p&gt;Ultimately I implemented a simple Preact component with the &lt;a href=&quot;https://leafletjs.com/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Leaflet&lt;/a&gt; libary using OpenStreetMap. Mostly based on &lt;a href=&quot;https://stackoverflow.com/questions/70578136/leaflet-usage-in-preact-js&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;this answer on stackoverflow.com&lt;/a&gt;. Then used the attribute &lt;code&gt;client:only=&amp;quot;preact&amp;quot;&lt;/code&gt; to render the component on the client-side. I had set it up as TypeScript component, and I had to import the component &lt;a href=&quot;https://twitter.com/robinbakker/status/1547685193682599939&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;with the &amp;quot;.tsx&amp;quot; extension&lt;/a&gt;. Then it worked! 🥳&lt;/p&gt;
&lt;p&gt;&lt;picture&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://robinbakker.nl/assets/img/rroadtrips-map-800w.webp 800w, https://robinbakker.nl/assets/img/rroadtrips-map-1024w.webp 1024w, https://robinbakker.nl/assets/img/rroadtrips-map-1200w.webp 1200w&quot; sizes=&quot;100vw&quot; /&gt;&lt;img src=&quot;https://robinbakker.nl/assets/img/rroadtrips-map-800w.jpeg&quot; alt=&quot;Example of the maps usage for our blog; a map with markers and a list of locations (Leaflet/OpenStreetMap)&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; class=&quot;article-image&quot; width=&quot;1200&quot; height=&quot;720&quot; srcset=&quot;https://robinbakker.nl/assets/img/rroadtrips-map-800w.jpeg 800w, https://robinbakker.nl/assets/img/rroadtrips-map-1024w.jpeg 1024w, https://robinbakker.nl/assets/img/rroadtrips-map-1200w.jpeg 1200w&quot; sizes=&quot;100vw&quot; /&gt;&lt;/picture&gt;
&lt;em&gt;Map at rroadtrips.com&lt;/em&gt;&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;While I was looking for components and map solutions I also stumbled upon other nice map/location resources. So I just list them here mainly for myself but well, maybe it&#39;s usefull for others too! 😜&lt;/p&gt;
&lt;h2&gt;Useful React components&lt;/h2&gt;
&lt;p&gt;These are some of the components I tried before setting up the Preact component decribed above. ⬆️&lt;/p&gt;
&lt;h3&gt;Pigeon Maps (React/OpenStreetMap)&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://pigeon-maps.js.org/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://pigeon-maps.js.org&lt;/a&gt;&lt;br /&gt;
&lt;em&gt;Started with this one in Astro, worked very well, a bit limited&lt;/em&gt;&lt;/p&gt;
&lt;h3&gt;React Simple Maps (React/d3-geo/topojson)&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://www.react-simple-maps.io/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://www.react-simple-maps.io&lt;/a&gt;&lt;br /&gt;
&lt;em&gt;Tried it but it had old dependencies and warnings, so quickly moved to the next...&lt;/em&gt;&lt;/p&gt;
&lt;h3&gt;React Leaflet (React/Leaflet)&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://react-leaflet.js.org/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://react-leaflet.js.org&lt;/a&gt;&lt;br /&gt;
&lt;em&gt;Worked, but was too much for this use case&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;Map providers&lt;/h2&gt;
&lt;h3&gt;Google Maps&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://developers.google.com/maps/documentation&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://developers.google.com/maps/documentation&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;OpenStreetMap&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://www.openstreetmap.org/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://www.openstreetmap.org&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;HERE maps&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://developer.here.com/develop/javascript-api&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://developer.here.com/develop/javascript-api&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Mapbox&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://www.mapbox.com/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://www.mapbox.com&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;TomTom maps&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://developer.tomtom.com/products/maps-api&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://developer.tomtom.com/products/maps-api&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Mapzen/Nextzen/Tilezen&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://www.mapzen.com/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://www.mapzen.com&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;https://www.nextzen.org/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://www.nextzen.org&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;https://github.com/tilezen&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://github.com/tilezen&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;Map libraries/frameworks&lt;/h2&gt;
&lt;h3&gt;Leaflet (javascript library)&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://leafletjs.com/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://leafletjs.com&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;OpenLayers&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://openlayers.org/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://openlayers.org&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;MapLibre&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://maplibre.org/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://maplibre.org&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Mapbox GL JS&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://docs.mapbox.com/mapbox-gl-js&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://docs.mapbox.com/mapbox-gl-js&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;react-map-gl (React/Mapbox GL JS)&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://visgl.github.io/react-map-gl&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://visgl.github.io/react-map-gl&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;deck.gl (WebGL)&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://deck.gl/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://deck.gl&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Maptalks (javascript)&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://maptalks.org/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://maptalks.org&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Tangram (javascript/WebGL)&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/tangrams/tangram&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://github.com/tangrams/tangram&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;Misc&lt;/h2&gt;
&lt;h3&gt;Geolib&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/manuelbieh/geolib&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://github.com/manuelbieh/geolib&lt;/a&gt;&lt;br /&gt;
Library to provide basic geospatial operations like distance calculation, conversion of decimal coordinates to sexagesimal and vice versa, etc.&lt;/p&gt;
&lt;h3&gt;Turf.js&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://turfjs.org/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://turfjs.org&lt;/a&gt;&lt;br /&gt;
Advanced geospatial analysis for browsers and Node.js&lt;/p&gt;
&lt;h3&gt;Mapus&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/alyssaxuu/mapus&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://github.com/alyssaxuu/mapus&lt;/a&gt;&lt;br /&gt;
A map tool with real-time collaboration&lt;/p&gt;
&lt;h3&gt;OpenMapTiles&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://openmaptiles.org/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://openmaptiles.org&lt;/a&gt;&lt;br /&gt;
Open-source maps made for self-hosting&lt;/p&gt;
</content>
    </entry>
    <entry>
      <title>Kaartweergave in Astro (en meer met maps)</title>
      <link href="https://robinbakker.nl/blog/kaartweergave-in-astro/"/>
      <updated>2022-09-09T00:00:00Z</updated>
      <id>https://robinbakker.nl/blog/kaartweergave-in-astro/</id>
      <content xml:lang="nl" type="html">&lt;p&gt;Afgelopen zomer zijn we met een camper op rondreis gegaan door de VS... Te gek! 😎 Om thuis iedereen op de hoogte te houden wilde ik een reisblog maken (&lt;a href=&quot;https://www.rroadtrips.com/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;rroadtrips.com&lt;/a&gt;), met een kaart om de route te tonen.&lt;/p&gt;
&lt;p&gt;Ik wilde graag eens iets maken met &lt;a href=&quot;https://astro.build/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Astro&lt;/a&gt;, een &amp;quot;static&amp;quot; site builder. Tegelijkertijd had ik er ook niet heel veel tijd voor vrijgemaakt. 😅 Dus ging ik op zoek naar een eenvoudige oplossing om een kaart weer te geven. Omdat Astro om kan gaan met verschillende front-end framework componenten, dacht ik dat het wel makkelijk zou zijn om een React component te zoeken en deze in te zetten.&lt;/p&gt;
&lt;p&gt;Toch ben ik daar eigenlijk vrij snel van teruggekomen. Astro is vooral gericht op het genereren van statische pagina&#39;s, waarbij zoveel mogelijk javascript wordt weggelaten. Een maps component zou wel javascript moeten hebben om deze interacief te maken. Het leek me dan wel een beetje overdreven om dan de complete React library in te laden voor één component. 🤔 &lt;a href=&quot;https://preactjs.com/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Preact&lt;/a&gt; (het 3KB alternatief voor React) leek me een beter plan. En als ik dan toch Preact zou gaan gebruiken, dan zijn andere Preact components die statisch worden weergegeven in Astro ook makkelijker toe te voegen.&lt;/p&gt;
&lt;h3&gt;Langer verhaal kort:&lt;/h3&gt;
&lt;p&gt;Uiteindelijk koos ik voor een simpele Preact component implementatie met &lt;a href=&quot;https://leafletjs.com/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Leaflet&lt;/a&gt; (en OpenStreetMap kaart). Voornamelijk gebaseerd op &lt;a href=&quot;https://stackoverflow.com/questions/70578136/leaflet-usage-in-preact-js&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;dit stackoverflow artikel&lt;/a&gt;. Vervolgens met het attribuut &lt;code&gt;client:only=&amp;quot;preact&amp;quot;&lt;/code&gt; om het component aan de client-side te laten opbouwen. Ik gebruikte TypeScript, en om het werkend te maken met Astro moest ik de import schrijven &lt;a href=&quot;https://twitter.com/robinbakker/status/1547685193682599939&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;includief &amp;quot;.tsx&amp;quot; extensie&lt;/a&gt;. Dat werkte! 🥳&lt;/p&gt;
&lt;p&gt;&lt;picture&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://robinbakker.nl/assets/img/rroadtrips-map-800w.webp 800w, https://robinbakker.nl/assets/img/rroadtrips-map-1024w.webp 1024w, https://robinbakker.nl/assets/img/rroadtrips-map-1200w.webp 1200w&quot; sizes=&quot;100vw&quot; /&gt;&lt;img src=&quot;https://robinbakker.nl/assets/img/rroadtrips-map-800w.jpeg&quot; alt=&quot;Voorbeeld van de kaartweergave op ons blogje; een kaart met markers en een lijst van locaties (Leaflet/OpenStreetMap)&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; class=&quot;article-image&quot; width=&quot;1200&quot; height=&quot;720&quot; srcset=&quot;https://robinbakker.nl/assets/img/rroadtrips-map-800w.jpeg 800w, https://robinbakker.nl/assets/img/rroadtrips-map-1024w.jpeg 1024w, https://robinbakker.nl/assets/img/rroadtrips-map-1200w.jpeg 1200w&quot; sizes=&quot;100vw&quot; /&gt;&lt;/picture&gt;
&lt;em&gt;De kaartweergave op rroadtrips.com&lt;/em&gt;&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;Toen ik op zoek was naar componenten en andere map oplossingen ben ik veel andere interessante bronnen tegengekomen. Ik zet ze hier even neer, voornamelijk voor mezelf om later terug te vinden - maar misschien is het ook voor anderen handig! 😜&lt;/p&gt;
&lt;h2&gt;Handige React componenten&lt;/h2&gt;
&lt;p&gt;Hier zijn een paar componenten die ik heb geprobeerd voordat ik overstapte op het Preact component wat ik hierboven beschreef. ⬆️&lt;/p&gt;
&lt;h3&gt;Pigeon Maps (React/OpenStreetMap)&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://pigeon-maps.js.org/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://pigeon-maps.js.org&lt;/a&gt;&lt;br /&gt;
&lt;em&gt;Gebruikte dit component als eerste in Astro. Werkte goed, iets gelimiteerd in mogelijkheden&lt;/em&gt;&lt;/p&gt;
&lt;h3&gt;React Simple Maps (React/d3-geo/topojson)&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://www.react-simple-maps.io/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://www.react-simple-maps.io&lt;/a&gt;&lt;br /&gt;
&lt;em&gt;Ook geprobeerd, maar door de oude package dependencies vond ik dit niet ideaal&lt;/em&gt;&lt;/p&gt;
&lt;h3&gt;React Leaflet (React/Leaflet)&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://react-leaflet.js.org/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://react-leaflet.js.org&lt;/a&gt;&lt;br /&gt;
&lt;em&gt;Werkte ook, maar vond ik te groot/uitgebreid voor mijn usecase&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;Map providers&lt;/h2&gt;
&lt;h3&gt;Google Maps&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://developers.google.com/maps/documentation&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://developers.google.com/maps/documentation&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;OpenStreetMap&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://www.openstreetmap.org/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://www.openstreetmap.org&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;HERE maps&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://developer.here.com/develop/javascript-api&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://developer.here.com/develop/javascript-api&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Mapbox&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://www.mapbox.com/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://www.mapbox.com&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;TomTom maps&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://developer.tomtom.com/products/maps-api&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://developer.tomtom.com/products/maps-api&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Mapzen/Nextzen/Tilezen&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://www.mapzen.com/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://www.mapzen.com&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;https://www.nextzen.org/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://www.nextzen.org&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;https://github.com/tilezen&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://github.com/tilezen&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;Map libraries/frameworks&lt;/h2&gt;
&lt;h3&gt;Leaflet (javascript library)&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://leafletjs.com/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://leafletjs.com&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;OpenLayers&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://openlayers.org/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://openlayers.org&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;MapLibre&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://maplibre.org/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://maplibre.org&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Mapbox GL JS&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://docs.mapbox.com/mapbox-gl-js&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://docs.mapbox.com/mapbox-gl-js&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;react-map-gl (React/Mapbox GL JS)&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://visgl.github.io/react-map-gl&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://visgl.github.io/react-map-gl&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;deck.gl (WebGL)&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://deck.gl/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://deck.gl&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Maptalks (javascript)&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://maptalks.org/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://maptalks.org&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Tangram (javascript/WebGL)&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/tangrams/tangram&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://github.com/tangrams/tangram&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;Overig&lt;/h2&gt;
&lt;h3&gt;Geolib&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/manuelbieh/geolib&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://github.com/manuelbieh/geolib&lt;/a&gt;&lt;br /&gt;
Library to provide basic geospatial operations like distance calculation, conversion of decimal coordinates to sexagesimal and vice versa, etc.&lt;/p&gt;
&lt;h3&gt;Turf.js&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://turfjs.org/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://turfjs.org&lt;/a&gt;&lt;br /&gt;
Advanced geospatial analysis for browsers and Node.js&lt;/p&gt;
&lt;h3&gt;Mapus&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/alyssaxuu/mapus&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://github.com/alyssaxuu/mapus&lt;/a&gt;&lt;br /&gt;
Een map tool met real-time samenwerken&lt;/p&gt;
&lt;h3&gt;OpenMapTiles&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://openmaptiles.org/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://openmaptiles.org&lt;/a&gt;&lt;br /&gt;
Open-source maps gemaakt voor self-hosting&lt;/p&gt;
</content>
    </entry>
    <entry>
      <title>Starting a static side project</title>
      <link href="https://robinbakker.nl/en/blog/starting-a-static-side-project/"/>
      <updated>2020-10-05T00:00:00Z</updated>
      <id>https://robinbakker.nl/en/blog/starting-a-static-side-project/</id>
      <content xml:lang="en" type="html">&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt; I’ve created a basic website for fun; &lt;a href=&quot;https://topzender.nl/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;topzender.nl&lt;/a&gt;. It contains lists of podcasts and radio stations (mostly Dutch). Built with Eleventy, updated using Cloudflare Workers and generated and hosted via Netlify. I just want to share a little bit about the process, as this was quite new to me. So get ready for the long story… 😀 Or scroll down for the list of used resources/inspiration.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;Why and what&lt;/h2&gt;
&lt;p&gt;I really wanted to do something with &lt;a href=&quot;https://www.11ty.dev/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Eleventy&lt;/a&gt;, the static site generator from Zach Leatherman. Eleventy is becoming quite popular, and is used by sites like &lt;a href=&quot;https://web.dev/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;web.dev&lt;/a&gt; and &lt;a href=&quot;https://v8.dev/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;V8 docs&lt;/a&gt;. There is a lot of buzz around going “serverless” (&lt;a href=&quot;https://jamstack.org/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;JAMstack&lt;/a&gt;), and the promises are great; better performance, lower cost and greater scalability than a site on a “traditional stack”.&lt;/p&gt;
&lt;p&gt;So I needed a new side-&lt;a href=&quot;https://robinbakker.nl/en/blog/creating-a-web-app-as-side-project/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;side project&lt;/a&gt;. 😁 I figured I could do some kind of spin-off project by using the existing radio and podcasts JSON data from my little web app &lt;a href=&quot;https://1tuner.com/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;1tuner.com&lt;/a&gt;. But just spitting out the data would be kind of cheap and boring, so I was looking for some other data sources that I could combine with it.&lt;/p&gt;
&lt;p&gt;I already had some experience with the iTunes Search API, so I was looking what else you could do. Then I noticed the &lt;a href=&quot;https://rss.itunes.apple.com/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;RSS Feed Generator&lt;/a&gt; from Apple, with the option to get “Top Podcasts” lists that I could combine with the 1tuner data… 😎
I decided to get the top podcast list data for the Netherlands. I thought it would be better to use this in a smaller region to narrow down the results and was also interested to see new/trending podcasts in my own country. I also knew a site where I could get NL radio listening figures, so it was clear I was going to build a Dutch website in the first place. Next I was looking for a new domain. I ended up with the corny &lt;a href=&quot;https://topzender.nl/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;topzender.nl&lt;/a&gt; (“top channel”).
Well OK, what the heck… 😜&lt;/p&gt;
&lt;p&gt;&lt;picture&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://robinbakker.nl/assets/img/topzender-logo-619w.webp&quot; sizes=&quot;100vw&quot; /&gt;&lt;img src=&quot;https://robinbakker.nl/assets/img/topzender-logo-619w.jpeg&quot; alt=&quot;The Topzender logo&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; class=&quot;article-image&quot; width=&quot;619&quot; height=&quot;136&quot; /&gt;&lt;/picture&gt;
&lt;em&gt;Topzender logo&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;Fetching data&lt;/h2&gt;
&lt;p&gt;Of course, seemingly simple things quickly become more complex. For example, the podcast data from the RSS Feed Generator doesn’t have the original podcast feed URL’s in it, only the Apple ID… and at 1tuner.com I only use a feed URL as identifier. So I had to lookup the records and update data somehow. Luckily there is also a lookup URL from Apple based on the Apple ID, so there I could fill the gaps. Today there is another nice free alternative for this: &lt;a href=&quot;https://podcastindex.org/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;podcastindex.org&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;For the radio listening figures I thought of the monthly &lt;a href=&quot;https://nationaalluisteronderzoek.nl/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Dutch radio audience research&lt;/a&gt; reports. But I couldn’t find anything useful in their existing data service right away, so I tried the service &lt;a href=&quot;https://import.io/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Import.io&lt;/a&gt; to transform the main results right from their website to JSON. It felt wrong — but it works surprisingly good. 🙄&lt;/p&gt;
&lt;h2&gt;11ty setup&lt;/h2&gt;
&lt;p&gt;Now that I had some data, I could start adding pages. Earlier on I found the starter project &lt;a href=&quot;https://github.com/philhawksworth/eleventyone&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;EleventyOne&lt;/a&gt; from &lt;a href=&quot;https://www.hawksworx.com/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Phil Hawksworth&lt;/a&gt;, so I decided to start from there. I copied… uhm, I mean &lt;em&gt;learned&lt;/em&gt; a lot. 🙂&lt;br /&gt;
He does fancy stuff with a static JSON search file, a sitemap XML, and a “seed” option to use the same data over and over again during develop. Then I found out about &lt;a href=&quot;https://www.11ty.dev/docs/pagination/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;pagination&lt;/a&gt; in 11ty to iterate over data sets, and suddenly I had lots of files generated instantly. Push to GitHub, let Netlify pick this up automatically and online in seconds… 😮 That’s awesome!&lt;/p&gt;
&lt;p&gt;It was really fun to see how quickly this can be used. Along the way I found some great stuff from other people like &lt;a href=&quot;https://mxb.dev/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Max Böck&lt;/a&gt;; see for example his extreme lightweight &lt;a href=&quot;https://mxb.dev/blog/emergency-website-kit&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Emergency Website Kit&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The thing that’s just so great about this all, is that you are working very close to HTML and the output is also plain HTML, CSS and Javascript. These files can be placed anywhere, on any CDN. Page loading is not as a single page application would be, but in this case it’s all pretty small. And of course you’re free to add fancy loading stuff anyway. I didn’t do that, but tried to add just as much as things you couldn’t do in 1998. 👴 So I’ve added a service worker, dark mode, web share, etc.&lt;/p&gt;
&lt;p&gt;I think the search functionality is a cool part that makes it all feel less static. This is also something I learned from the starter projects. Basically, because it’s so easy to iterate over all the data with Eleventy, you can also create a customized search index JSON file (with common words filtered out). So now when you click on the search icon, it loads this JSON file, and you’re ready to search in it. Of course the JSON file is cached via the service worker for next requests.&lt;/p&gt;
&lt;p&gt;&lt;picture&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://robinbakker.nl/assets/img/topzender-search-800w.webp&quot; sizes=&quot;100vw&quot; /&gt;&lt;img src=&quot;https://robinbakker.nl/assets/img/topzender-search-800w.jpeg&quot; alt=&quot;The search bar with suggestions below it&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; class=&quot;article-image&quot; width=&quot;800&quot; height=&quot;256&quot; /&gt;&lt;/picture&gt;
&lt;em&gt;Topzender.nl search functionality&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Maybe for more complex sites you would use something more sophisticated. But for this purpose it suits really well I think!&lt;/p&gt;
&lt;h2&gt;Again, data&lt;/h2&gt;
&lt;p&gt;Until this point I had all data being fetched and overwritten at each 11ty production build (or “seed”). I needed to save some data somewhere to keep track of the lists, so I used the simple Realtime Database from Firebase because I worked with that before.&lt;/p&gt;
&lt;p&gt;Also, I wanted to learn about cloud functions. So I tried Cloudflare Workers, because I &lt;a href=&quot;https://gomakethings.com/getting-started-with-serverless-using-cloudflare-workers-and-vanilla-js/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;remembered this&lt;/a&gt; from the “Daily Developer Tips” email newsletter from Chris Fernandi. This was actually a nice takeaway — that this newsletter pushes things into your inbox that you maybe don’t need directly, but once read you may think about it later.
Cloudflare Workers turned out very quickly to put in place, so I was able to move some of the top lists data fetching to the cloud. Now I needed something to trigger...&lt;/p&gt;
&lt;h2&gt;Putting it together&lt;/h2&gt;
&lt;p&gt;I wanted to call my worker URL every once and a while to fetch the top podcasts. Therefore I added a “bot” at &lt;a href=&quot;https://gomakethings.com/getting-started-with-serverless-using-cloudflare-workers-and-vanilla-js/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Automate.io&lt;/a&gt; with a daily timer connected to a webhook (which is the Cloudflare Worker URL).&lt;br /&gt;
Over time I found out that the feed from Apple is not always that consistent in when it’s updated — or I got some sort of cached result. But when you return an HTTP error in those cases, you can easily find out that the webhook call didn’t work. In the end I cloned my existing bot a couple of times so it just tries it a couple of times a day.&lt;br /&gt;
Last week Cloudflare announced “&lt;a href=&quot;https://blog.cloudflare.com/introducing-cron-triggers-for-cloudflare-workers&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Cron Triggers&lt;/a&gt;” that you can use to execute workers on a schedule! 🎉 Haven’t implemented yet, but I think I can remove one service out of these &lt;a href=&quot;https://css-tricks.com/weaved-webs&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;weaved webs&lt;/a&gt;. 😀&lt;/p&gt;
&lt;p&gt;&lt;picture&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://robinbakker.nl/assets/img/topzender-flow1-800w.webp 800w, https://robinbakker.nl/assets/img/topzender-flow1-1024w.webp 1024w, https://robinbakker.nl/assets/img/topzender-flow1-1200w.webp 1200w&quot; sizes=&quot;100vw&quot; /&gt;&lt;img src=&quot;https://robinbakker.nl/assets/img/topzender-flow1-800w.jpeg&quot; alt=&quot;Flowchart: From automate.io to Cloudflare Worker that saves to Firebase data, to the build in Netlify (which reads Firebase data) resulting in a new website update&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; class=&quot;article-image&quot; width=&quot;1200&quot; height=&quot;399&quot; srcset=&quot;https://robinbakker.nl/assets/img/topzender-flow1-800w.jpeg 800w, https://robinbakker.nl/assets/img/topzender-flow1-1024w.jpeg 1024w, https://robinbakker.nl/assets/img/topzender-flow1-1200w.jpeg 1200w&quot; sizes=&quot;100vw&quot; /&gt;&lt;/picture&gt;&lt;/p&gt;
&lt;p&gt;I already had Import.io converting the radio listening chart HTML table to JSON data. Because the numbers are coming in only once per month on a Tuesday, it runs only on those days. They also have an option to call a webhook right after the data is successfully fetched, so that’s nice! I call another special worker for the radio station data.&lt;/p&gt;
&lt;p&gt;&lt;picture&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://robinbakker.nl/assets/img/topzender-flow2-800w.webp 800w, https://robinbakker.nl/assets/img/topzender-flow2-1024w.webp 1024w, https://robinbakker.nl/assets/img/topzender-flow2-1200w.webp 1200w&quot; sizes=&quot;100vw&quot; /&gt;&lt;img src=&quot;https://robinbakker.nl/assets/img/topzender-flow2-800w.jpeg&quot; alt=&quot;Flowchart: From import.io to Cloudflare Worker that saves to Firebase data, to the build in Netlify (which reads Firebase data) resulting in a new website update&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; class=&quot;article-image&quot; width=&quot;1200&quot; height=&quot;399&quot; srcset=&quot;https://robinbakker.nl/assets/img/topzender-flow2-800w.jpeg 800w, https://robinbakker.nl/assets/img/topzender-flow2-1024w.jpeg 1024w, https://robinbakker.nl/assets/img/topzender-flow2-1200w.jpeg 1200w&quot; sizes=&quot;100vw&quot; /&gt;&lt;/picture&gt;&lt;/p&gt;
&lt;p&gt;In the workers, if there is new data, it’s saved to Firebase and another webhook from Netlify is called to trigger a new deploy of the website.
And now... Everything is working automatically! 🚀&lt;/p&gt;
&lt;h2&gt;Thanks&lt;/h2&gt;
&lt;p&gt;Zach Leatherman for creating Eleventy (and everything regarding web fonts — I still think of the &lt;a href=&quot;https://www.zachleat.com/web/mitt-romney-webfont-problem&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Mitt Romney font problem&lt;/a&gt;).&lt;br /&gt;
Also thanks to all other people &amp;amp; services listed in this little story.&lt;br /&gt;
Netlify is really excellent. If you have linked your domain and GitHub repo, you don’t have to think about anything else. It just deploys the website (only updating files that have been changed). Each deploy has its own preview URL, so you can still have a look at what an older deploy looked like (also revert if you want to). And I haven’t even touched other features yet.
There are other services like &lt;a href=&quot;https://vercel.com/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Vercel&lt;/a&gt; that may be this good as well, but I haven’t tried yet. Please note that I once won a bottle with a Netlify logo on it, when Phil Hawksworth organized a small raffle, so I’m fully influenced and biased here! 😁&lt;/p&gt;
&lt;p&gt;&lt;picture&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://robinbakker.nl/assets/img/topzender-netlify-bottle-256w.webp&quot; sizes=&quot;100vw&quot; /&gt;&lt;img src=&quot;https://robinbakker.nl/assets/img/topzender-netlify-bottle-256w.jpeg&quot; alt=&quot;Cropped picture of a Netlify bottle&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; class=&quot;article-image&quot; width=&quot;256&quot; height=&quot;205&quot; /&gt;&lt;/picture&gt;&lt;/p&gt;
&lt;p&gt;❤ Rianne&lt;/p&gt;
&lt;h2&gt;Resources&lt;/h2&gt;
&lt;h3&gt;Data&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;iTunes Search API&lt;br /&gt;
&lt;a href=&quot;https://developer.apple.com/library/archive/documentation/AudioVideo/Conceptual/iTuneSearchAPI/index.html&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://developer.apple.com/library/archive/documentation/AudioVideo/Conceptual/iTuneSearchAPI/index.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;RSS Feed Generator from Apple&lt;br /&gt;
&lt;a href=&quot;https://rss.itunes.apple.com/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://rss.itunes.apple.com&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Podcastindex.org open podcast API (from Adam Curry)&lt;br /&gt;
&lt;a href=&quot;https://podcastindex.org/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://podcastindex.org&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Nationaal Luister Onderzoek (Dutch radio audience research)&lt;br /&gt;
&lt;a href=&quot;https://nationaalluisteronderzoek.nl/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://nationaalluisteronderzoek.nl&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Import.io (HTML to JSON)&lt;br /&gt;
&lt;a href=&quot;https://www.import.io/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://www.import.io&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Tools &amp;amp; Services&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Eleventy (static site generator)&lt;br /&gt;
&lt;a href=&quot;https://www.11ty.dev/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://www.11ty.dev&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Netlify (automated deployment)&lt;br /&gt;
&lt;a href=&quot;https://www.netlify.com/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://www.netlify.com&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;GitHub (source code host)&lt;br /&gt;
&lt;a href=&quot;https://github.com/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://github.com&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Cloudflare Workers (cloud functions)&lt;br /&gt;
&lt;a href=&quot;https://workers.cloudflare.com/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://workers.cloudflare.com&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Firebase Realtime Database (store JSON data)&lt;br /&gt;
&lt;a href=&quot;https://firebase.google.com/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://firebase.google.com&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Automate.io (webhook timers)&lt;br /&gt;
&lt;a href=&quot;https://automate.io/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://automate.io&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Gravit Designer (creating vector graphics)&lt;br /&gt;
&lt;a href=&quot;https://designer.gravit.io/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://designer.gravit.io&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Feather (awesome icons)&lt;br /&gt;
&lt;a href=&quot;https://feathericons.com/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://feathericons.com&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Get Waves (nice footer 😁)&lt;br /&gt;
&lt;a href=&quot;https://getwaves.io/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://getwaves.io&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;eleventy-plugin-pwa (service worker via Google WorkBox)&lt;br /&gt;
&lt;a href=&quot;https://github.com/okitavera/eleventy-plugin-pwa&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://github.com/okitavera/eleventy-plugin-pwa&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Other / Inspiration&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Zach Leatherman (Mr 11ty aka Mr web fonz)&lt;br /&gt;
&lt;a href=&quot;https://www.zachleat.com/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://www.zachleat.com&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;EleventyOne (starter project from Phil Hawksworth)&lt;br /&gt;
&lt;a href=&quot;https://github.com/philhawksworth/eleventyone&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://github.com/philhawksworth/eleventyone&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;https://www.hawksworx.com/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://www.hawksworx.com&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Daily Developer Tips newsletter (from Chris Fernandi)&lt;br /&gt;
&lt;a href=&quot;https://gomakethings.com/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://gomakethings.com&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Max Böck&lt;br /&gt;
&lt;a href=&quot;https://mxb.dev/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://mxb.dev&lt;/a&gt;
&lt;a href=&quot;https://whimsical.club/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://whimsical.club&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Piccalilli (👍 newsletter from Andy Bell)&lt;br /&gt;
&lt;a href=&quot;https://piccalil.li/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://piccalil.li&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Weaved Webs (about possible complexities with Jamstack sites)&lt;br /&gt;
&lt;a href=&quot;https://css-tricks.com/weaved-webs/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://css-tricks.com/weaved-webs/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Originally posted at &lt;a href=&quot;https://medium.com/@robinbakker/starting-a-static-side-project-75428dd41d9f&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Medium.com&lt;/a&gt;&lt;/p&gt;
</content>
    </entry>
    <entry>
      <title>Updating my web app side project</title>
      <link href="https://robinbakker.nl/en/blog/updating-my-web-app-side-project/"/>
      <updated>2020-01-28T00:00:00Z</updated>
      <id>https://robinbakker.nl/en/blog/updating-my-web-app-side-project/</id>
      <content xml:lang="en" type="html">&lt;p&gt;My little side-project web app &lt;a href=&quot;https://1tuner.com/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://1tuner.com&lt;/a&gt; is still running, and it’s fun to see a small number of people using it around the world.&lt;/p&gt;
&lt;p&gt;But at work we don’t use 1tuner anymore unfortunately 😥. We have Sonos speakers now, so the radio playlist was no longer needed.&lt;/p&gt;
&lt;h2&gt;New “problems”&lt;/h2&gt;
&lt;p&gt;Of course, me myself &amp;amp; I was still using 1tuner to listen to the radio when biking to the office. But now and then I wanted to listen to podcasts. So this was a new problem to work on! 🤓&lt;/p&gt;
&lt;p&gt;Also, I wasn’t happy with the app logo and icon, and felt the UI could use some attention too. And when my colleague said his girlfriend wouldn’t use the app because of the looks of it — well, that was some extra motivation. 😁&lt;/p&gt;
&lt;h2&gt;🎙Working on podcasts&lt;/h2&gt;
&lt;p&gt;I started out working on the podcast functionality. This shouldn’t be that hard right (I thought)? It’s basically reading an RSS feed and load the audio into the existing audio player.
First I needed to find a way to search for the podcast feeds. I found &lt;a href=&quot;https://listennotes.com/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Listen Notes&lt;/a&gt; and the &lt;a href=&quot;https://affiliate.itunes.apple.com/resources/documentation/itunes-store-web-service-search-api/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Apple iTunes Search API&lt;/a&gt;.
The Listen Notes API is very nice, but I only wanted a way to find podcasts and get a feed URL in return. This didn’t seem to be possible at the time I looked. Basically, you should use that API for searches as well as loading the podcast feeds in JSON format. I felt that it might was too fancy for what I was looking for.
So I was giving the free iTunes Search API a try. That worked out fine, finally I got some feed URL’s to work with. So I loaded the XML of some feeds of the Dutch public radio, and it just worked. Nice, time to show this to someone! 😎&lt;/p&gt;
&lt;p&gt;“OK, I want to hear that popular podcast”&lt;/p&gt;
&lt;p&gt;&lt;picture&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://robinbakker.nl/assets/img/updating-1tuner-cors-800w.webp&quot; sizes=&quot;100vw&quot; /&gt;&lt;img src=&quot;https://robinbakker.nl/assets/img/updating-1tuner-cors-800w.jpeg&quot; alt=&quot;A DevTools CORS error message&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; class=&quot;article-image&quot; width=&quot;800&quot; height=&quot;46&quot; /&gt;&lt;/picture&gt;
&lt;em&gt;💥BANG!&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;🤦‍♂️of CORS, &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Same-origin policy&lt;/a&gt;... A bit silly that I didn’t thought about that in the first place. But I was only testing feeds from the Dutch public radio. And all responses from their feeds were all nicely provided with an “Access-Control-Allow-Origin” header set to the origin of the request. This really makes sense because it’s a public feed that you want to share with as many services/apps as possible I think. Strange that podcast platforms like &lt;a href=&quot;https://art19.com/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;ART19&lt;/a&gt; don’t do this?&lt;/p&gt;
&lt;p&gt;Also something that is kind of hard to do with web apps specifically;&lt;/p&gt;
&lt;p&gt;&lt;picture&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://robinbakker.nl/assets/img/updating-1tuner-tweet-slightlylate-727w.webp&quot; sizes=&quot;100vw&quot; /&gt;&lt;img src=&quot;https://robinbakker.nl/assets/img/updating-1tuner-tweet-slightlylate-727w.jpeg&quot; alt=&quot;Tweet of Alex Russel (@slightlylate) about web app CORS issues&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; class=&quot;article-image&quot; width=&quot;727&quot; height=&quot;600&quot; /&gt;&lt;/picture&gt;
&lt;em&gt;&lt;a href=&quot;https://twitter.com/slightlylate/status/1222107257980235776&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;See original tweet&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;So I needed a proxy, or still use the Listen Notes API. Until then, 1tuner.com was purely a static site/app. It loads some static JSON files and the audio streams from radio stations.
I found a nice example at Glitch: &lt;a href=&quot;https://glitch.com/~rss2json&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://glitch.com/~rss2json&lt;/a&gt;
As I already parsed the XML itself client-side, I didn’t need the JSON conversion so I modified it a bit. When a feed request fails, it tries the same feed via that small proxy service. And because this is just my little hacky hobby project I decided to leave this for now 🤗
BTW: &lt;a href=&quot;https://glitch.com/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Glitch&lt;/a&gt; is awesome!&lt;/p&gt;
&lt;h2&gt;Logo update&lt;/h2&gt;
&lt;p&gt;The old logo was quite red and at first I wanted it to be some sort of a tuning knob. But as podcasts were also becoming part of the app, I experimented with 1 play icon (I used the online vector drawing tool &lt;a href=&quot;https://designer.gravit.io/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Gravit Designer&lt;/a&gt; for this again).&lt;/p&gt;
&lt;p&gt;&lt;picture&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://robinbakker.nl/assets/img/updating-1tuner-first-logos-314w.webp&quot; sizes=&quot;100vw&quot; /&gt;&lt;img src=&quot;https://robinbakker.nl/assets/img/updating-1tuner-first-logos-314w.jpeg&quot; alt=&quot;First logo experiments&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; class=&quot;article-image&quot; width=&quot;314&quot; height=&quot;171&quot; /&gt;&lt;/picture&gt;
&lt;em&gt;Some early experiments&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;It may be not very original, but I think this works better and looks more friendly (and Dutch 😜):&lt;/p&gt;
&lt;p&gt;&lt;picture&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://robinbakker.nl/assets/img/updating-1tuner-logo-old-new-800w.webp 800w, https://robinbakker.nl/assets/img/updating-1tuner-logo-old-new-1024w.webp 1024w, https://robinbakker.nl/assets/img/updating-1tuner-logo-old-new-1200w.webp 1200w&quot; sizes=&quot;100vw&quot; /&gt;&lt;img src=&quot;https://robinbakker.nl/assets/img/updating-1tuner-logo-old-new-800w.jpeg&quot; alt=&quot;The old and new logo&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; class=&quot;article-image&quot; width=&quot;1200&quot; height=&quot;562&quot; srcset=&quot;https://robinbakker.nl/assets/img/updating-1tuner-logo-old-new-800w.jpeg 800w, https://robinbakker.nl/assets/img/updating-1tuner-logo-old-new-1024w.jpeg 1024w, https://robinbakker.nl/assets/img/updating-1tuner-logo-old-new-1200w.jpeg 1200w&quot; sizes=&quot;100vw&quot; /&gt;&lt;/picture&gt;
&lt;em&gt;Yes, that round thingy at the right hand side is the new one&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;I also updated the manifest file of the web app with maskable icons. On Android, icons can be any shape (e.g. the Samsung squircle as opposed to the stock Android circle). Basically you add “bleed” and the OS crops it to the right shape.&lt;br /&gt;
See also &lt;a href=&quot;https://web.dev/maskable-icon/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Adaptive icon support in PWAs with maskable icons&lt;/a&gt; on web.dev.&lt;/p&gt;
&lt;h2&gt;New UI&lt;/h2&gt;
&lt;p&gt;I also tried to draw new navigation icons, because the ones of the old UI weren’t too consistent. And I wanted to have the same look and feel as the new logo / app icon.&lt;/p&gt;
&lt;p&gt;&lt;picture&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://robinbakker.nl/assets/img/updating-1tuner-nav-old-new-579w.webp&quot; sizes=&quot;100vw&quot; /&gt;&lt;img src=&quot;https://robinbakker.nl/assets/img/updating-1tuner-nav-old-new-579w.jpeg&quot; alt=&quot;1tuner navigation before and after&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; class=&quot;article-image&quot; width=&quot;579&quot; height=&quot;262&quot; /&gt;&lt;/picture&gt;
&lt;em&gt;Old and new navigation icons&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Other elements of the original app UI were flat and simple. For the station and podcast links/buttons, there was some room for improvement. Now I blur the logo in the background with the icon as overlay.&lt;/p&gt;
&lt;p&gt;&lt;picture&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://robinbakker.nl/assets/img/updating-1tuner-ui-old-new-800w.webp 800w, https://robinbakker.nl/assets/img/updating-1tuner-ui-old-new-1024w.webp 1024w&quot; sizes=&quot;100vw&quot; /&gt;&lt;img src=&quot;https://robinbakker.nl/assets/img/updating-1tuner-ui-old-new-800w.jpeg&quot; alt=&quot;1tuner UI before and after&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; class=&quot;article-image&quot; width=&quot;1024&quot; height=&quot;447&quot; srcset=&quot;https://robinbakker.nl/assets/img/updating-1tuner-ui-old-new-800w.jpeg 800w, https://robinbakker.nl/assets/img/updating-1tuner-ui-old-new-1024w.jpeg 1024w&quot; sizes=&quot;100vw&quot; /&gt;&lt;/picture&gt;
&lt;em&gt;Before and after&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;Dark theme&lt;/h2&gt;
&lt;p&gt;No new UI without a dark theme! 😀 I added a settings page were you can switch from theme. By default it uses the preferred theme setting from your OS if applicable. This works really nice in CSS with CSS variables aka custom properties and a special media query.
See also &lt;a href=&quot;https://css-tricks.com/dark-modes-with-css/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Dark Mode in CSS&lt;/a&gt; from CSS-Tricks.&lt;/p&gt;
&lt;p&gt;&lt;picture&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://robinbakker.nl/assets/img/updating-1tuner-dark-theme-740w.webp&quot; sizes=&quot;100vw&quot; /&gt;&lt;img src=&quot;https://robinbakker.nl/assets/img/updating-1tuner-dark-theme-740w.jpeg&quot; alt=&quot;1tuner UI before and after&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; class=&quot;article-image&quot; width=&quot;740&quot; height=&quot;453&quot; /&gt;&lt;/picture&gt;
&lt;em&gt;The dark side&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;Other changes&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;New radio station pages&lt;/strong&gt;&lt;br /&gt;
For some radio stations I added related podcast links and “suggested stations”. The header is also updated.&lt;br /&gt;
Examples:&lt;br /&gt;
&lt;a href=&quot;https://1tuner.com/radio-station/kink&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://1tuner.com/radio-station/kink&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;https://1tuner.com/radio-station/bbcradio4&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://1tuner.com/radio-station/bbcradio4&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Preact version upgrade&lt;/strong&gt;&lt;br /&gt;
At v10.2.1 now. This was done a bit earlier, and was kind of tricky because I actually used state updates synchronously, which was “fixed” in &lt;a href=&quot;https://preactjs.com/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Preact X&lt;/a&gt; but broke lots of things in my little app… Fixed now! ✔&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Chromecast experimental feature&lt;/strong&gt;&lt;br /&gt;
At a secret place at settings you can enable Chromecast support. 😄Beware, this is not finished… At a very early stage of 1tuner I started with the &lt;a href=&quot;https://www.w3.org/TR/remote-playback/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Remote Playback API&lt;/a&gt; already, but this seemed not very well implemented. As of today, for Chrome this still only works on Chrome on Android. So I’m implementing the “&lt;a href=&quot;https://developers.google.com/cast/docs/chrome_sender&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Cast Chrome Sender Framework&lt;/a&gt;” now.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;To do&lt;/h2&gt;
&lt;p&gt;Yeah, lots of things 😁&lt;/p&gt;
&lt;p&gt;For example, with the new version I also changed the wording of “Planner” to “Playlists”. But this is still the same basic radio station stream switching. Ultimately I want to be able to switch between radio and podcasts.&lt;/p&gt;
&lt;p&gt;❤ Rianne&lt;/p&gt;
&lt;p&gt;Originally posted at &lt;a href=&quot;https://medium.com/@robinbakker/updating-my-web-app-side-project-3963d818226&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Medium.com&lt;/a&gt;&lt;/p&gt;
</content>
    </entry>
    <entry>
      <title>Creating a web app as side project</title>
      <link href="https://robinbakker.nl/en/blog/creating-a-web-app-as-side-project/"/>
      <updated>2018-06-18T00:00:00Z</updated>
      <id>https://robinbakker.nl/en/blog/creating-a-web-app-as-side-project/</id>
      <content xml:lang="en" type="html">&lt;p&gt;&lt;a href=&quot;https://1tuner.com/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;1Tuner&lt;/a&gt; is a progressive web app that you can use to listen to online radio. And it allows you to plan your own ideal radio listening day, so the player switches between radio streams automatically.
The app is pretty basic, but it changed while I was learning during development of it. In this article I will try to describe the process and decisions.&lt;/p&gt;
&lt;h2&gt;The &amp;quot;problem&amp;quot;&lt;/h2&gt;
&lt;p&gt;At the office, we always listened to good-old radio. For years, we tuned our browser to the audio stream of the Dutch public radio channel 3FM. We heard nice pop/rock tunes, some fine jocks and a good news service.
Then came our problem, jocks left the station, and a music format switch brought us shittier music (and OK, a better logo maybe). At the same time, the dusty Dutch Radio 2 was changing as well - for the better in our opinion (reluctantly admitted at first). We were also looking for other alternatives. In the end, we switched throughout the day to Radio 2, to 3FM, to Radio 2 etc...
I knew this had to be fixed. So I started a new web app to start Radio 2.5; an automatic stream switcher.&lt;/p&gt;
&lt;p&gt;&lt;picture&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://robinbakker.nl/assets/img/1tuner-3fm-200w.webp&quot; sizes=&quot;100vw&quot; /&gt;&lt;img src=&quot;https://robinbakker.nl/assets/img/1tuner-3fm-200w.jpeg&quot; alt=&quot;NPO 3FM logo&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; class=&quot;article-image&quot; width=&quot;200&quot; height=&quot;133&quot; /&gt;&lt;/picture&gt;&lt;/p&gt;
&lt;h2&gt;Where to start&lt;/h2&gt;
&lt;p&gt;I was fairly late to the &amp;quot;front-end framework party&amp;quot;, and wanted to dive in. This side project seemed ideal for that. I started with &lt;a href=&quot;https://vuejs.org/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Vue.js&lt;/a&gt;, and wanted to try &lt;a href=&quot;https://webpack.js.org/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Webpack&lt;/a&gt; as well. I found some basic boilerplate projects and started by trial and error. Lots of errors actually… The thing with side projects is: time. I&#39;m not sure how other people manage this, but to be fair it&#39;s hard to start up each time when you leave your code behind for some days. And when you finally found out where you got stuck, it&#39;s time to sleep! 🙄 I was struggling in the world of Webpack modules and loaders, and somehow corrupted npm modules.
Another confusing problem at first, was the audio element. Initially I used the &amp;quot;autoplay&amp;quot; attribute, and then just changed the audio source. This worked in Chrome on desktop, but not on mobile - audio didn&#39;t play on mobile.
It took some time before I understood this was an &amp;quot;autoplay&amp;quot; problem (later on, the autoplay behaviour was the same on desktop).
From my experience; just avoid using autoplay 🙂. Nowadays you also should trigger audio change on user gestures like the tap/click of a button.&lt;/p&gt;
&lt;h2&gt;Start over&lt;/h2&gt;
&lt;p&gt;Once I had a basic app that was switching the audio streams, I was done with it for some time. But I also read a lot about &lt;a href=&quot;https://preactjs.com/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Preact&lt;/a&gt;, and when &lt;a href=&quot;https://github.com/developit/preact-cli&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;preact-cli&lt;/a&gt; came by in my Twitter timeline, I wanted to try that! So I started from scratch. Or maybe not really, because preact-cli works like a charm right out of the box.
One thing that bothered me with my previous setup was file size and loading times. I was using Firebase as well, which was actually quite big (with all the bells &amp;amp; whistles). And together with all inefficient things I had included, the total (optimized &amp;amp; minified) size was ridiculous - because I was just tinkering around.
The fresh start with Preact was also reason to keep things more efficient. Finally, I came to the conclusion that I needed to keep things as simple as possible. So no more authentication and saving to Firebase, but save all user data locally, and use the power of URL&#39;s! Progressive web apps rock! 😎&lt;/p&gt;
&lt;h2&gt;UI / Design&lt;/h2&gt;
&lt;p&gt;OK, don&#39;t laugh. I really thought things through. I wanted an interface that was as clean as possible, because the main way to use the app would be to tap and listen.&lt;/p&gt;
&lt;h3&gt;Icon&lt;/h3&gt;
&lt;p&gt;The main branding would be the app icon. But I still had to choose a name and register a domain. First it was stream-zapper, stream-switch, tunar, stream-tune... I ended up with 1tuner.com. One advantage of the name is that it&#39;s on top at your app list/drawer when it&#39;s sorted alphabetically. 😉&lt;/p&gt;
&lt;p&gt;&lt;picture&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://robinbakker.nl/assets/img/1tuner-icons-800w.webp 800w, https://robinbakker.nl/assets/img/1tuner-icons-1024w.webp 1024w, https://robinbakker.nl/assets/img/1tuner-icons-1200w.webp 1200w&quot; sizes=&quot;100vw&quot; /&gt;&lt;img src=&quot;https://robinbakker.nl/assets/img/1tuner-icons-800w.jpeg&quot; alt=&quot;Progress in icons&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; class=&quot;article-image&quot; width=&quot;1200&quot; height=&quot;236&quot; srcset=&quot;https://robinbakker.nl/assets/img/1tuner-icons-800w.jpeg 800w, https://robinbakker.nl/assets/img/1tuner-icons-1024w.jpeg 1024w, https://robinbakker.nl/assets/img/1tuner-icons-1200w.jpeg 1200w&quot; sizes=&quot;100vw&quot; /&gt;&lt;/picture&gt;&lt;/p&gt;
&lt;p&gt;For the logo and icons, I used the online vector tool &lt;a href=&quot;https://designer.gravit.io/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Gravit Designer&lt;/a&gt; - it&#39;s free and pretty amazing actually. Open, edit and save to SVG.&lt;/p&gt;
&lt;h3&gt;Fonts&lt;/h3&gt;
&lt;p&gt;Because I wanted a quick loading and a native-like app experience, I wanted to go with system fonts. By using system fonts, you always get the default font of the device. Stuart Frisby wrote a nice article about &lt;a href=&quot;https://booking.design/implementing-system-fonts-on-booking-com-a-lesson-learned-bdc984df627f&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;implementing system fonts on Booking.com&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;Layout&lt;/h3&gt;
&lt;p&gt;I started with a default header menu and a play button on the main screen. Then I moved the play button to a fixed positioned footer.
Recently I moved the navigation to a fixed icon/tab bar for mobile and left-hand menu for bigger screens. For web apps, the tab bar navigation can be problematic because in some browsers you get a double navigation at the bottom (app + browser navigation). But overall the experience is better this way I guess.&lt;/p&gt;
&lt;p&gt;&lt;picture&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://robinbakker.nl/assets/img/1tuner-devices-800w.webp 800w, https://robinbakker.nl/assets/img/1tuner-devices-1024w.webp 1024w, https://robinbakker.nl/assets/img/1tuner-devices-1200w.webp 1200w&quot; sizes=&quot;100vw&quot; /&gt;&lt;img src=&quot;https://robinbakker.nl/assets/img/1tuner-devices-800w.jpeg&quot; alt=&quot;1tuner.com displayed on tablet and phone&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; class=&quot;article-image&quot; width=&quot;1200&quot; height=&quot;670&quot; srcset=&quot;https://robinbakker.nl/assets/img/1tuner-devices-800w.jpeg 800w, https://robinbakker.nl/assets/img/1tuner-devices-1024w.jpeg 1024w, https://robinbakker.nl/assets/img/1tuner-devices-1200w.jpeg 1200w&quot; sizes=&quot;100vw&quot; /&gt;&lt;/picture&gt;&lt;/p&gt;
&lt;h2&gt;PWA features&lt;/h2&gt;
&lt;p&gt;I use the &lt;a href=&quot;https://developers.google.com/web/updates/2017/02/media-session&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Media Session API&lt;/a&gt; to display the current playing radio station notification. Obviously this puts in the &amp;quot;progressive&amp;quot; part in the web app, as this only seems to be supported in Chrome on Android right now. However, it works out great; you&#39;ll see the logo with play/pause on your lock screen, and even on your smartwatch!&lt;/p&gt;
&lt;p&gt;&lt;picture&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://robinbakker.nl/assets/img/1tuner-media-session-800w.webp 800w, https://robinbakker.nl/assets/img/1tuner-media-session-1024w.webp 1024w, https://robinbakker.nl/assets/img/1tuner-media-session-1200w.webp 1200w&quot; sizes=&quot;100vw&quot; /&gt;&lt;img src=&quot;https://robinbakker.nl/assets/img/1tuner-media-session-800w.jpeg&quot; alt=&quot;Testing the Media Session API&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; class=&quot;article-image&quot; width=&quot;1200&quot; height=&quot;720&quot; srcset=&quot;https://robinbakker.nl/assets/img/1tuner-media-session-800w.jpeg 800w, https://robinbakker.nl/assets/img/1tuner-media-session-1024w.jpeg 1024w, https://robinbakker.nl/assets/img/1tuner-media-session-1200w.jpeg 1200w&quot; sizes=&quot;100vw&quot; /&gt;&lt;/picture&gt;&lt;/p&gt;
&lt;p&gt;The Media Session API gives the web app a &amp;quot;native app feel&amp;quot;As you may have noticed there is only a &amp;quot;pause&amp;quot; icon. Because in the 1tuner app you are listening to &amp;quot;live&amp;quot; radio, I handle the pause event as &amp;quot;stop&amp;quot;. Unfortunately, there seems to be no stop event/icon from the media notification right now.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;https://developers.google.com/web/updates/2016/09/navigator-share&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Web Share API&lt;/a&gt; is another great addition to the app. It&#39;s easy to use and directly opens up the native share menu when you click the share icon.&lt;/p&gt;
&lt;h3&gt;Other&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Navigator.languages/language for the default &amp;quot;Region&amp;quot; filter.&lt;/li&gt;
&lt;li&gt;I use &lt;a href=&quot;https://github.com/jakearchibald/idb-keyval&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;idb-keyval&lt;/a&gt; from Jake Archibald, a simple way to store key/value data that is implemented with IndexedDB.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Tools, services &amp;amp; resources&lt;/h2&gt;
&lt;p&gt;It&#39;s just so great that there are so much free tools and services!
Yes, I&#39;m Dutch. 😁 An overview:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;https://code.visualstudio.com/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Visual Studio Code&lt;/a&gt; is awesome to use with the integrated terminal, together with preact-cli and live reloading. 👍&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/preactjs/preact-cli&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Preact-cli&lt;/a&gt; is amazing, you can start with some demo projects, routing, pre-render and a service worker that just works out of the box. &lt;a href=&quot;https://github.com/preactjs/preact&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Preact&lt;/a&gt; is like React, but smaller! Big thanks to Jason Miller.&lt;/li&gt;
&lt;li&gt;I used the online vector design tool &lt;a href=&quot;https://designer.gravit.io/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Gravit Designer&lt;/a&gt; for the logo and icons. You should really try this out!&lt;/li&gt;
&lt;li&gt;Gravit Designer easily exports to SVG, but the output can still be optimized. If you don&#39;t have it automated in your project, you should use the excellent &lt;a href=&quot;https://jakearchibald.github.io/svgomg/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;SVGOMG&lt;/a&gt; from Jake Archibald.&lt;/li&gt;
&lt;li&gt;To get all the app icons: https://realfavicongenerator.net. It&#39;s pretty full featured as you even get a Safari Pinned Tab SVG traced icon for instance. You can also use the favicon generator API and use this in your own automated tasks.&lt;/li&gt;
&lt;li&gt;I use &lt;a href=&quot;https://firebase.google.com/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Firebase&lt;/a&gt; for hosting and the database. I don&#39;t use much of the other features anymore, but authentication for client-side apps is really easy with Firebase!&lt;/li&gt;
&lt;li&gt;The header image is from &lt;a href=&quot;https://www.pexels.com/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Pexels&lt;/a&gt;, a free stock photo library (CC0 license).&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;Upcoming versions&lt;/h2&gt;
&lt;p&gt;Besides debugging and adding more radio stations, I have a couple more ideas that I would like to add to the app;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Let users add radio stations.&lt;/li&gt;
&lt;li&gt;Share planning with timezone support. Had a quick look earlier, but this is a bit complex because of daylight saving times.&lt;/li&gt;
&lt;li&gt;Podcast support (also for use in the planner).&lt;/li&gt;
&lt;li&gt;An option to cast to Chromecast directly.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Edit 29 January 2020:
See also the follow up: &lt;a href=&quot;https://robinbakker.nl/en/blog/updating-my-web-app-side-project&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Updating my web app side project&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;❤ Rianne&lt;/p&gt;
&lt;p&gt;🙂&lt;/p&gt;
&lt;p&gt;Originally posted at &lt;a href=&quot;https://medium.com/@robinbakker/creating-a-web-app-as-side-project-2b8f96a44893&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Medium.com&lt;/a&gt;&lt;/p&gt;
</content>
    </entry>
</feed>