Pandemic Library Tech: Converting YouTube Captions to Facebook Captions

Our library’s front-facing services and programs have been entirely digital for two months now. One thing that has taken us entirely too long to figure out has been how to provide decent captions / transcripts for our videos.

Sure, YouTube and Facebook can auto-caption all the video you live streamed through them, but it looks to me like Facebook requires you to tell it to do that for each video (based on this) and even then the captions are… well, they’re auto-captions. YouTube’s captions are better, but again–auto-captions. Not always intelligible, and definitely not as good as what you’d get from an actual human doing the captioning. But who can afford a captioning service?

Better *still*, YouTube and Facebook use different file types if you want to just upload some manually corrected captions to them. So if you have one video in both places, you can’t just correct a file once and use it in both places. Nope. That would be too easy.

So we’ve been trying to figure out a workflow that would let our less tech-savvy library assistants work on captions and transcripts for us. We’re making progress, but that’s not actually in a place where I want to share it. (One major consideration is: Who are we comfortable giving enough rights on our Facebook page that they can access captioning tools? Facebook page management is not for the technologically squeamish or the person who will fail to notice when they’re acting as the page vs. when they’re acting as themself.)

What I want to share is some quick and dirty regex for converting YouTube caption files (.sbv files) to Facebook caption files (.srt). Is this the most code efficient way of converting between the two file types? Absolutely not. Have I built in much in the way of protections checking to see if the original file was well formatted? Nope. This is, I emphasize, quick and dirty. Also it’s the first time I’ve used PHP in… gosh, several years, I think. Probably the past-me who was fluent and spent all kinds of time coding would cringe.

That said, I didn’t find example regex when I was looking, so… yeah. Anyway, without further ado:

//turn all the non-html new line characters into <br> so they'll display on this page
    $pattern = "/[\r\n]{1,2}/";
    $replacement = "<br>";
    $convertMe = preg_replace($pattern,$replacement,$convertMe);
    
    
    //turn the commas between the numbers into arrows
    $pattern = "/(\d)\,(\d)/";
    $replacement = "$1 --> $2";
    $convertMe = preg_replace($pattern,$replacement,$convertMe);
    
    
    //put the leading zero on other places it's needed, and comma-ify the //milliseconds
    $pattern = "/([0-9]{1}:)([0-9]{2}:[0-9]{2})\.([0-9]{3})/";
    $replacement = "0$1$2,$3";
    $convertMe = preg_replace($pattern,$replacement,$convertMe);
    
    //now number the captions for facebook / .srt
    //count how many <br><br> there are, so we know how many captions
    $howMany = substr_count($convertMe, "<br><br>") + 1;
    
    //the first caption is its own case
    $convertMe = "1<br>" . $convertMe;
    
    //number all the rest of the captions
    //first, fill an array with all the numbers we'll use
    $pattern = "/<br><br>(\d\d:)/";
    for($i = 2; $i <= $howMany; $i++){
        $replacement = "<br><br>" . $i . "<br>$1";
        $convertMe = preg_replace($pattern, $replacement, $convertMe, 1);
    }

Pandemic Library Tech: Planning for Limited Patron Visits

My library is still in working from home mode. After WFH mode there will be a time where we’re all back in the building (maybe in shifts?) getting stuff organized, and then a further time when our only physical interactions with patrons will be… well, not interactions at all. We’re planning on having some sort of contactless pickup for a while. (How long? Who knows? We’ll have it for as long as we need to in order to keep our patrons and employees safe.)

Anyway, after contactless pickup mode ends, we’re anticipating a time when we do let patrons back into the building, but only a limited number of patrons, and only for a limited amount of time. The question becomes: How will we manage that?

Happily I have a genius co-worker who was like, “Hey, what about those pagers that chain restaurants give out so you know when they’re ready for you?” And then I kicked myself, because I’ve even worked at a library that had some of those pagers before, and that STILL never occurred to me. (My previous library used them originally to notify students when there was a laptop available for them to checkout, and then later to notify students when in-demand reserve items were available. So a pretty different context. But still–why did I not think of this??)

Anyway that’s my library’s plan. We’ve ordered a set of Microframe Slimline Vibrating Pagers for each of our branches. We chose this particular product because:

  • The Town procurement office, when we asked what they could turn up, only found us some other company that was going to charge us an ongoing monthly fee to make the pagers work. (You can’t see the face I make at the thought of ANOTHER monthly service we would have to keep up with, especially during a time when the budget is likely to be scarily tight. Please, no!)
  • My previous library bought the equivalent of these pagers from Microframe 15+ years ago. Of the 20 they bought, only about two have died so far.
  • The amount of time my previous library has had their pagers might be a giveaway, but did I mention–there’s no ongoing service charge for these! You buy the full system once, and it’s yours to use forever.

Anyway, the plan for how we’ll use them works like this:

  1. Patrons wait outside the library in a socially distanced line until it’s their turn to come in.
  2. You (the patron) can come in when we have a pager to give you. We buzz the pager so it’s vibrating when we hand it to you, and have it set so that it will automatically go off again 25 minutes later. (Re-page function for the win!)
  3. We explain that this is what it looks like when the pager goes off. When it goes off again, you need to bring back your pager, checkout your materials, and leave.
  4. When you bring the pager back to us, we ask you to wipe it down with a sanitizing wipe before you hand it to us.
  5. We give the pager to the next patron in line.

It’s an easy way for us to keep track of how many people are in the building. It’s an easy way to remind people to come back to the desk and get ready to leave. It’s good for privacy because we’re not linking this to anyone’s phone or anything. It’s good for equity because we’re not *requiring* anyone to have a phone or anything.

Possible drawbacks? A patron could set the pager down and walk away, intentionally or not. I’m not worried about finding the pagers again–they can be triggered to go off until you find them–but it’s very much just an honor policy thing for patrons to actually hold on to the pager and return to the checkout area when they’re supposed to. Also I suppose someone could steal their pager, though I can’t think why anyone would want to.

Nifty bonuses to this system? It sounds like we’ll be able to put some kind of customizable, swap-out-able, promotional material or instructions on each pager.

Also, I have plans for these things when/if we get back to doing live, in-person events again. We used to give out boring paper tickets for our storytimes. How much cooler if you could hand a kid a pager that will vibrate and light up when it’s time to head over to storytime? So. Much. Cooler.

So, yep. That’s why my library is buying restaurant pagers.

Pandemic Library Tech: Phone Reference

When we all first started working from home, we didn’t worry about getting phone reference up and running. Chat and email were a lot easier; we’d start there and see how it went.

Since then, our reopening to the public has been pushed back until at least June 29. And you know what that means? That means it’s time to figure out phone reference. Not all of our patrons have access to (or the knowledge to use) chat and email.

Ideas I Considered But Threw Out

  1. Just have the normal reference phone forward to the reference librarian(s) on duty

    This idea failed because IT informed us that our phones can only forward to one number at a time. Technically I guess we could maybe swap out which phone got forwarded to, every time we switched shifts? But that sounds like a lot of work, plus having only one person able to answer the phone for reference isn’t ideal. This one might be worth looking into if you’re a tiny library, or you’re flat broke and have no other options.
  2. Google Voice

    It seemed like genius–just create a free account and every everyone login and monitor it from their computer during their shifts. The thing I forgot? Privacy. No way I’m letting Google listen in on our patrons’ calls / save their voicemails / anything of the sort. Nope. Not happening. I’d rather do without phones.
  3. MightyCall

    I started looking for cheap options that would let us ring all 8 of our working reference librarians’ phones at once, without having to pay by user. MightyCall looked super promising, and I got really excited by their offer for 3 months free for non-profits, municipal government, etc. It sounded amazing! But then I read their privacy policy and got a little worried… so I emailed them and asked a bunch of stuff about privacy.

    They were really great about getting back to me, but their answer was that they’re not HIPAA compliant, your calls and voicemail get saved “temporarily” as data on their servers, and they would absolutely hand that over to law enforcement or other governmental requests.

    So… that’s a nonstarter. Reference phone calls need to be private.

Product I Think We’re Going With

It’s not finalized yet–I’m still waiting for a few more details from the vendor, and then I need to sort out which budget line will pay for this–but I think we’ll likely be going with Talkroute. They are HIPAA compliant as long as you don’t use their texting or voicemail-to-email features. I have an email out to them about what exactly that entails, but I doubt I’m likely to do better.

If my library got Talkroute’s “Plus” plan, we could have calls ring simultaneously to the computer of as many of our 8 reference librarians as we wanted. We could also do some handy-sounding things like having a special message that patrons would hear if they called outside of the hours that we’re offering reference. And $39 / month isn’t hideously expensive (pricing page here).

Update 5/16/20: Talkroute doesn’t actually mean “there is no limit” when they say the Plus plan has “unlimited” talk minutes. Based on our estimated use (phone reference is pretty darn popular for us), we’d have to go with the Enterprise plan… which is $99 / month rather than $39. Expletives. Will we do it anyway? Maybe. Talkroute seems to be the best on privacy, and every other vendor I’ve been able to turn up has the same asterisk next to where they claim they offer unlimited minutes. WTF, vendors? WTF?