Kiri and Steve.co.uk

line

Playing a podcast over the phone

April 10th, 2020 (by Steve)

Coronavirus. An uncomfortable time for all of us, in different ways. But some great things are coming out of the crisis – the incredible sense of community and the way that people are serving others. We’ve tried to do our own little bit and part of that has involved helping to move a lot of our church communications online. Nearly a year ago now, I set up a system in our church to record sermons – pretty simple, a line out from the sound desk into a laptop with a program to record the audio. We then upload it to our church website. Simples! But what about those members of our congregation who don’t have access to a computer?

On 26 March I read a really interesting blog post about how you could use a service called Twilio to allow people to call a phone number and listen to an online audio file. I dropped an email to our vicar to ask whether there was a need for something similar in our church… and the response was positive; over 20 members of our congregation without access to email or the internet.

So, it was worthwhile doing, but I’m lazy and the method cited in the blog post involved changing an audio file every week. I don’t really want to be doing that – plus I don’t want to be a single point of failure in a system. Everything else with regards to our sermons is automated – we upload it once to a custom post type that I’ve created in WordPress, then we use IFTTT to detect when there’s a new sermon and post a link to the sermon to our Facebook and Twitter accounts. Then separately I’ve created an itunes-formatted RSS feed, at which I’ve pointed Apple Podcasts, Stitcher, PlayerFM and Spotify so people can be served the sermons from their favourite podcast platform. So let’s see if we can automate this phone call stuff.

The first thing I do when creating a new thing is to find out whether it actually is a new thing, so I check whether something exists out there already. This was the 27 March… it didn’t, so I got started. Using the blog post as a starting point, I got stuck into familiarising myself with Javascript (the language that the functions needed to be written in), and wrestling with some libraries to help me out. Oh, and there was also the thing of entertaining young children, working from home etc that meant I couldn’t dedicate much time to it. I finally finished on 6 April and it was all working.

And then I found out that someone had already done it and blogged about it on 3 April, with what I think is a neater solution (using the rss-parser library). The Switched On Network method enables you to point to any standalone MP3 file. Nick Holcombe’s method consumes an RSS feed, and gives you a menu of sermons to select from. My method is somewhere in the middle.

So, here’s my code in case anyone wants to see my alternative way (follow the instructions in the other blog posts to get Twilio up and running… the only extra bit you’ll need for mine is to add an npm dependency on the node-fetch library – version 2.6.0).

url = "https://www.stpaulstephenglos.org.uk/join-in/sermon-podcast/";

const fetch = require('node-fetch');
const DOMParser = require('xmldom').DOMParser;

exports.handler = function(context, event, callback) {
	// create the voice response object
	let twiml = new Twilio.twiml.VoiceResponse();
    
    // load the first item from the RSS feed (https://developers.google.com/web/updates/2015/03/introduction-to-fetch)
    fetch(url)
  .then(
    function(response) {
      if (response.status !== 200) {
        console.log('Looks like there was a problem. Status Code: ' +
          response.status);
        // end the call and hang up
	    twiml.hangup();
	    callback(null, twiml);
        return;
      }

      // Examine the text in the response
      response.text().then(function(data) {
        
        // create a parser, give it the RSS feed and tell it to parse as XML
        parser = new DOMParser();
        xmlfeed = parser.parseFromString(data,"text/xml");

        // extract the data from within the channel
        const channel = xmlfeed.getElementsByTagName("channel")[0];

        // get the title and description
        podcastTitle = channel.getElementsByTagName("title")[0].textContent;
        podcastDescription = channel.getElementsByTagName("description")[0].textContent;

        console.log(podcastTitle);
        console.log(podcastDescription);

        // Say the welcome text
        twiml.say('Welcome to ' + podcastTitle);
        twiml.say(podcastDescription);

        // get the first item 
        const podcastItem1 = channel.getElementsByTagName("item")[0];

        itemTitle = podcastItem1.getElementsByTagName("title")[0].textContent;
        itemDescription = podcastItem1.getElementsByTagName("itunes:subtitle")[0].textContent;
        itemDurationTotal = podcastItem1.getElementsByTagName("itunes:duration")[0].textContent;

        // use the double not bitwise operator to round to the minutes
        itemDurationMinutes = ~~(itemDurationTotal / 60);
        // use the modulus to get the seconds 
        itemDurationSeconds = itemDurationTotal % 60;

        itemUrl = podcastItem1.getElementsByTagName("enclosure")[0].getAttribute("url");
        
        console.log(itemTitle);
        console.log(itemDescription);
        console.log(itemDurationMinutes);
        console.log(itemDurationSeconds);
        
        // Introduce the item
        twiml.say('You are about to hear ' +itemTitle);
        twiml.say(itemDescription);
        twiml.say('This is ' +itemDurationMinutes+ ' minutes and ' +itemDurationSeconds+ ' seconds');
        twiml.say('Please wait while we load the sound file');
        
        // Play the item
        twiml.play(itemUrl);

        // end the call and hang up
	    twiml.hangup();
	    callback(null, twiml);
        return;
      });
    }
  )
  .catch(function(err) {
    console.log('Fetch Error', err);
    
    // end the call and hang up
	twiml.hangup();
	callback(null, twiml);
  });
};

Before I close, it’s probably worth a brief note on SOP and CORS (no, not SOP and The Corrs… although check them out!). This is all about permissions for scripts to access resources that are stored on other sites. The best description of it that I could find when trying to work out why my code wasn’t working was at javascript.info.

In essence, I needed to make a minor addition to the .htaccess file on the church website; we’re happy to allow GET requests from anywhere, so this is the code I added:

Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Methods "GET"
Header set Access-Control-Allow-Headers "Content-Type"

But hang on, there are other services consuming the RSS feed (Apple Podcasts, Stitcher, Player.fm, Spotify)… how come these permissions are not needed for the other feeds? My educated guess (although please do correct me) is because this code uses javascript (which is a client-server interaction) whereas the other podcast feed code will be server-server. SOP and CORS only apply for client-server conversations.

If you fancy using my code, it should work for you by just changing the URL to be the URL of your podcast RSS feed. If your podcast is available on ApplePodcasts or Soundcloud and you don’t know your RSS feed URL, then you can use the handy getrssfeed.com tool to find it.

Am I little irked that I could have saved myself some time an effort if I’d kept on searching to see if anyone had done this? Yes. Am I pleased that I managed to get something working on my own? Yes. Is the code meeting a need? Yes. And actually, that’s the main thing.

Stay safe.

Posted in Life, Web Design | 3 Comments »

Hobby or business?

September 18th, 2015 (by Steve)

Over the years, I seem to have plumped for hobbies that have paid me, rather than me having to pay for them. It’s not been a conscious thought; it’s just kind of happened. First it was bell-ringing as a teenager (getting paid to ring for weddings), then it was barbershop (busking and paid gigs), then it was photography as people asked me to photograph their weddings. It’s only the latter that actually grew into a business, and since I set up my sole trader account in 2006 I’ve photographed over 30 weddings. All the money I’ve earned then went straight back into investing in better equipment (apart from a slightly digression into experimentations with 3D photography… but that’s a different story!)

weddingphotos

It therefore seemed natural when Kiri and I got together to combine my photography and web development skills with Kiri’s design skills and to add graphic design and web design to the business. And this is where I should probably say that I use the term “business” very lightly. You see we’ve never really attacked either the photography or design work full on as a business. We’ve always charged mates rates as we built up a portfolio of work and improved our skills and have never properly got stuck into marketing our work.

Soon after we got married, we decided that the wedding photography side of things would be retired. After a full week at work, I don’t want to have the whole weekend taken up with a wedding (plus the mandatory few evenings of preparation beforehand). The web design and development stayed, as that’s something we were happy to work on together in evenings and at weekends – Kiri on the design side and me on the coding.

And then our big trip around Europe happened, which was basically a bit of a sabbatical from work for us both, although we did hole ourselves up in a campsite near Prague for a few days for some focussed web design. This time when I went back to work full-time though we realised that something had to go. With a child on the way, we would have to prioritise family time in evenings and weekends. We had hoped to get version 2 of the Pig & Porter website live before we moved on, but as they were undergoing a further re-branding, we were unable to do that before we bade them a reluctant goodbye. It wouldn’t have been fair on them to remain as their web designers as they’re a growing business and we wouldn’t be able to give them the support that a full time web design company could. We’ll just have to support them by drinking their beer instead!

p+p

And we’ve just put the finishing touches to the Compass Maths Workshops website that we started several months ago.

compassmaths

So that leaves us with some big decisions. With the “business” as just graphic design currently and Kiri as a full time Mum, we’re contemplating whether it’s worth keeping it as a business. We’re not entirely sure that the freelance model works for us; you’ve got to be driven and hungry for sales as that’s what clients normally expect and deserve… isn’t it? But we’ve got other priorities now – there’s family and we’ve still got photos and video footage from our Europe trip that remain unprocessed.

If we’re serious with the “business”, we’ll need to invest in a new Mac for Kiri and start paying out for the latest Adobe Creative Suite software which is sold on a subscription basis these days. And what about the camera equipment that’s just sitting there? How can we justify that? Should we start selling photos from our trip? Should we get into baby photography?

And in all of this, our “business” website remains in the temporary state we put it in back in 2012. So watch this space – there may be exciting things on the horizon for Lightbulb Head, or we may just quietly switch the light off. Who knows.

Posted in Photography, Web Design | 4 Comments »

Spanners

March 26th, 2014 (by Steve)

You know how it is. You’ve just put the finishing touches to a plan; you know roughly what’s going to happen and then a spanner gets thrown into the works. Or several spanners even… in several plans! It’s not all bad though and after 4 months of travelling we’re now getting used to being flexible with our planning.

The first change of plan / delay has come courtesy of the great British weather (oh, how we’ve missed you!). Bertha was due to go straight to our friendly mechanic the day after we arrived back on British soil at the end of February for a routine medical. Sadly though, that soil was rather saturated and with more inclement weather imminent, Bertha was unable to be seen to properly until the weather had cleared up a bit (as work on her has to be done outside). However, whilst she’s been standing, waiting in the doctor’s queue, we’ve seized the opportunity to move the fuse box in the habitation area, clear up some of the other temporary wiring we put in place on the road (see previous blog post for details), replace the bathroom sink waste pipe that had perished and, most importantly, put our Talbot Owners’ Club tax disc holder up (yes, we know that the paper disc is becoming obsolete)

bertha

The other main change of plan is to do with our second loop. We’ve always been keen that our trip should be more than just an adventurous holiday; we want it to be purposeful and we want it to fit with God’s plan for our lives. So, we planned out a route for the second part (in Bertha… we’ve decided that she’s solid enough!) around Northern Europe and contacted a few projects that we wanted to visit. We then prayed that if that wasn’t what God wanted, we’d like Him to make it clear. He’s made it clear… either timings haven’t been convenient for the projects, or there aren’t opportunities there for us to serve… so it’s back to the drawing board.

The time that we’ve spent back in the UK so far hasn’t been wasted though. We’ve managed to spend some really good, quality time with our families and catch up with some of our friends. Going back to London for a while was a bit weird, but not in a bad way… it just seems so long ago that we lived there, even though it was only 7 months ago that we left! As well as socialising, we’ve also been busy with a few tweaks to this website – our route map page now allows you to filter the types of places you want to see, and we’ve made the site responsive, so it should display better on mobile devices and tablets (please let us know if you have any issues!).

displays

So in general, although things aren’t quite going to plan, we’re pretty happy. Saying that though, we can’t help but read the blogs of fellow motorhome travellers Julien + Anais and Rhys + Kristen and feel the call of the road. Our time will come again soon though. Patience.

Posted in Bertha, KIST 2EU, Web Design | 1 Comment »

Back to school

December 8th, 2013 (by Steve)

Our plan was never to stay in Serbia for that long… but we’re learning that having flexible plans is the best way of life when you’ve got a motorhome. We’d found that we could be useful in Ruma… so we stayed there for a few days longer than planned. We found that we could be useful in our next destination (Belgrade Bible School), so we stayed there for a few days longer than planned too!

With our move from Ruma came the first illness of the trip; I had a spectacular bout of man flu, with lack of energy, blocked nose, hacking cough… yet still we were welcomed with open arms at the Belgrade Bible School. It soon transpired though that we weren’t the only guests there; Howel Jones, a visiting teacher from Wales arrived soon after us, bringing wisdom, gentleness and welsh cakes! He was followed shortly by rather more unwelcome guests though… snow and ice!

brrr

When it came to clearing 4 inches of snow from the roof of Bertha, we realised our attempt to out-run the cold weather had been in vain. After the one day of snowfall, the temperature remained low and whilst we could warm Bertha during the day, at night the mercury plummeted. I think -7 degrees was the coldest it got outside, which corresponded to an internal temperature of -2 when we woke one morning. Inside our sleeping bag, with a duvet on top, we’ve actually been really quite snug, but you realise that you’re living life on the edge slightly when you’re scraping ice off the inside of the windows in the morning! However, it has been really beautiful in the wintery conditions too!

View from the school gate in perfect morning light

Once we had arrived and greeted people at the Bible School, we had a bit of a skills audit session with Sladjan, who runs the school with his wife, Jaroslava. We’d said when we set off from England that when we arrived at a project, we would serve in any way we could. At the Bible School, this took the form of me working to re-platform their website from Joomla to WordPress (a fun task for a multi-lingual site!). Meanwhile, Kiri set to work on multiple projects, including designing the Christmas card for the school, creating illustrations of Ezekiel 1 to help in teaching sessions, moving half the library and designing their latest newsletter. Note to self: when taking pictures of students in the snow, it might seem like a good idea to get them to throw snowballs at you… it’s not!

"...and on the count of 3, throw it at me...hang on....NO....!"

We’ve once again been overwhelmed by the Serbian hospitality here; everyone is so willing to give and we have eaten so well, that we might take Bertha over her GVW rating! Whilst we’ve been sleeping in Bertha, we’ve been joining the students for their daily morning prayer meetings and eating all of our meals with them. This has been a great chance to get to know some of them; they’re such a fantastic group of people. We can’t quite keep up with them when it comes to consuming bread though; it seems to be eaten at every meal in vast quantities… maybe we need to go into training!

A close subject to bread… beard (well, nearly!). One positive about being at the bible school was that it had mains electricity, so I was finally able to shave my beard, having got to the stage where I looked like Fagin!

After just under 2 weeks, we got to the stage where we had offered nearly all we had to offer; the graphic design and website work was complete, so we offered a cup of tea in Bertha to the staff. They had gone out of their way so many times for us during our stay and we really felt part of the team, so wanted to offer them something in return.

Staff team visit Bertha

Sadly, that signalled the end of our stay at the Bible School; much as we didn’t want to leave, the weather was beginning to force our hand. So, on a cold and icy Thursday morning, we started Bertha up (first time!) and off we headed in search of warmer climes.

Posted in KIST 2EU, Web Design | 2 Comments »

And now for something completely different

August 15th, 2013 (by Steve)

Doing web design, whilst chasing cows out of your front garden… you don’t see that happening in London! Living in the countryside whilst we do the last few things before our trip is taking a little bit of adjusting to, but it’s great!

It’s now been just over a week since we left London and we had hoped to have made good progress with Bertha, our four-wheeled friend, by this stage. However, the last time we checked up on her, she looked like this (well, her rear axle did):

P1020454

Bertha is in safe hands though, with a friendly mechanic, undergoing a service before her MOT. The signs are all fairly positive, as the only things which require attention are a minor issue with the rear brakes and a leisure battery which is leaking vaguely explosive hydrogen. Thank goodness we hadn’t got round to testing the gas yet! So with these things being fixed (delayed a little by a wait for parts), we’ve been focussing on the non-van-related things to do for our trip, interspersed with a few other lovely activities.

The main thing that we’ve been focussing on is this site; specifically the KIST 2EU section. We’ve added an FAQs page (please ask us more questions to go on it!) and we’re slowly working through the creation of our country guides. They’re not going to rival Lonely Planet, but they should at least hold all of the pertinent information that we’ll need in one place. There’s still work to be done on an infographics page; something that has to be done considering my background in data analysis and Kiri’s graphic design skills. We also still need to work out exactly how we’re going to display a map of our route as we go along – we’ll write a separate blog post shortly about our testing of a GPS device.

There have also been a few purchases that we’ve been making; the most significant of which is fabric for re-upholstering the seats in the living area and making new curtains. After a lot of research (including visiting this website which has a great quote of “We offer a discount to OAPs on a Wednesday”), we decided that we’ll use cotton dust sheets as the main fabric (£10.99 for a 12′ by 9′ sheet!), then sew patches of interesting material onto them to brighten it all up. I also spent a couple of hours servicing and setting up our folding bikes so the chain doesn’t fall off when you change gear!

P1020401

With all of this busyness, our Lightbulb Head work has taken a bit of a back seat, however it was great to see Pig and Porter in action at the Ashburnham Flower show and taste their wares. Seriously, with beer and food that tasty, which sells itself, they don’t really need the website for marketing, but we’re spending a bit of time working with them whilst we’re in the area.

fete024

We have also attempted to do a countryside time lapse video to rival the one we did in London before we left (Oval crossroads). On our first day here, Norman the local farmer was mowing a field, so we set up a camera expectantly… It turns out that there’s a slower pace of life outside London (plenty of tea breaks in the mowing!), so the resulting time lapse doesn’t particularly work on its own. We’ll combine it into another bit of film work at some stage though.

As for the “lovely activities”, these have included a barbecue followed by watching shooting stars, a visit to play pirate golf in Hastings and attending the local MI (men’s institute) meeting. We could get used to village life!

Posted in Bertha, KIST 2EU, Web Design | No Comments »

London calling…to say goodbye

August 4th, 2013 (by Steve)

We’re leaving London tomorrow and we’re not coming back…well, actually, we are coming back in 2 weeks for a wedding, but then we’re not coming back! Yes, after weeks and months of planning, we’re finally leaving London to embark on upgrading Bertha (our motorhome) before we set off in her around Europe. These last few weeks in London have been pretty full on – here’s a flavour of what we’ve been up to.

Aside from both going through the rigmarole of leaving our jobs (thank you for the moderately priced bottle of wine!), we’ve had the interesting task of deciding where to leave our belongings whilst we’re travelling. Our family have been very kind and have given us the use of a loft, so in early July we hired a van and drove most of our things to Leicester. Now we don’t want Bertha to feel inadequate in any way, but the hire van was less than a year old, with only 1000 miles on the clock and incredible air conditioning on the first hot weekend of the year. Bliss. So that’s most of our belongings dealt with.

For months I’ve been wanting to do a time lapse from the top of St. Mark’s church overlooking the crossroads at Oval tube station and a couple of weeks ago we finally got round to it. There’s a blog post about it on our business website (lightbulbhead.co.uk) if you’re interested in the back story, but here’s the video:

We’ve also been looking after the design and content of the St. Mark’s website for the last couple of years and we wanted to leave it in a state where we were happy with it visually, but we could hand over the management of content to someone in the church office. Again, there’s a blog post about it at lightbulbhead.co.uk covering some of the technical details. If you want to go straight to the website, it’s stmarkskennington.org.

We’re terrible at goodbyes, but we’ve enjoyed spending some final fleeting moments with our London friends in the last few days in various locations; a garden, a pub, another pub and today at church. It’s now just time for the packing of the last few things in the flat and a quick wipe of surfaces on top of the deep clean we’ve done in the last week. I think we’ll leave our mouse traps for the next tenants…they’ll need them!

The adventure starts here!

Posted in KIST 2EU, Photography, Web Design | No Comments »

Another beautiful union

December 26th, 2012 (by Steve)

So, first came the wedding and the union of Kiri and Steve. Now comes Pig and Porter and the union of srphotos.co.uk (no longer associated with us) and Lightbulb Head. You can read the details in blog posts at either site, but basically we’ve just completed our first web design project together (www.pigandporter.co.uk) and have decided that we’re going to merge our businesses under the banner of Lightbulb Head and close down srphotos.co.uk. Watch the Lightbulb Head space in 2013!

pigandporter.co.uk screenshot

Posted in Web Design | No Comments »