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?

Ye Olde Express Lane Software, Receipt Printers, and Windows 10

We have lots of receipt printers in the library.  Some are attached to staff checkout stations (basically regular computers); some are attached to self checks running Express Lane.  We no longer have support for Express Lane, and all the hardware associated with it is… 6+ years old? Maybe 10+. I’m not actually sure.  Anyway the Express Lane self checks are where our current problems are. 

The Saga of the Children’s Room Self Check

Back in November, the self check in Children’s started acting up.  The receipt printer button disappeared from the software. Switching the receipt printer (a Star TSP 100 Future Print) to a different USB port made the receipt printer button show up again… but it broke the RFID pad. 

We went back and forth for a while with one or the other working, before getting the RFID pad up and running and accepting that there wouldn’t be receipt printing from that station anymore (at least temporarily). Telling Windows to update drivers didn’t help; upgrading Windows from 7 to 10 didn’t help; telling Windows not to manage printer preferences didn’t help. 

When I got Windows 10 on there, a giant queue of old receipts did start to print out, and had to be canceled.  I was also able to print test pages on the printer. But the “print receipt” button did not show up in the Express Lane software at that point, and we were unable to find a way to make it appear.  

A week or two later, I shuffled receipt printers around so that the nicer receipt printer on the self check (where it wasn’t doing any good) could go to another computer where it WOULD do some good.  The Star TSP 100 Future Print was perfectly happy on the other computer after I manually downloaded its drivers to make the computer recognize it as a printer. And the Star TSP700II that I put on the Children’s self check was immediately recognized by the computer AND it made the “print receipt” button show up in Express Lane! 

I tried to do a checkout, and a job was sent to that receipt printer–I could see it in the printer’s queue. But it didn’t ever print, even though I let it sit there for upwards of 15 minutes while I was doing other things. 

Current Status: Baffled

Self Check #3 at Main Circ (Save an OXPS File)

Meanwhile, Windows 10 updates were rolling out throughout the library.  I put Windows 10 on a self check upstairs, which had previously been playing just fine with its receipt printer (a Star TSP743II).  After the update, the “print receipt” button continued to exist in Express Lane… but if you hit it, you’d get a Save window instead of having a receipt just print out. 

The file type it was trying to save was .oxps, which I read doesn’t play with Windows 7.  I knew that receipt printing used to work in Windows 7, so I told Windows to use .xps instead of .oxps.  This did nothing except change what file type I’m asked to save when I hit the “print receipt” button.

Telling Windows to update the receipt printer’s drivers accomplished nothing.  Manually updating the drivers from Star’s website did get me a newer version of the drivers, now featuring a way-too-wide right margin that’s cutting off the text when I print a test page.  The “print receipt” button still shows up in Express Lane, but it’s bringing up a save dialog rather than actually printing the receipt. Switching back to .oxps didn’t fix any of this.  

Current Status: Baffled

Ridiculous Slowness at a Branch

We also installed Windows 10 on a self check at one of our branches.  On *that* self check, I have a report that the receipt printed… after a 5-minute wait.  That’s clearly not going to cut it from a patron’s point of view! The printer model there is a Star TSP700II.

Current Status: WTF


So basically… we have 3 self check stations running Windows 10.  All of them are now connected to a Star TSP700II receipt printer. 

  • One prints receipts after a ridiculous, unusable delay.
  • One tries to save the receipts instead of printing them. 
  • One does nothing when you tell it to print a receipt.  

On the bright side, I know that Express Lane recognizes Star TSP700II receipt printers. Woooo?


Factoids I forgot to include yesterday:

  • Until yesterday, both Self Check #3 and the Children’s self check were using driver version I manually updated Self Check #3 to version 3.6a yesterday; that’s when its margins got wonky.
  • I tried making it so that the Children’s self check couldn’t put USB devices to sleep to save power, just in case that’s what was happening. It didn’t help.
  • Also I noticed today that the Children’s self check had Microsoft XPS Writer listed as a printer and Self Check #3 didn’t. I figured out how to get XPS Writer to show up on Self Check #3… but it didn’t change the fact that Self Check #3 still asks users to save the .oxps file.

Current Status:

  • 1/9/20: Still baffled. Self Check #3 still asks users to save the receipt file. Children’s self check has moved on to not even putting a receipt in the printer’s queue (?!).
  • 1/21/20: All three self checks at main circ are doing the try-to-save-a-file thing when you tell them to print a receipt… but the self check in Children’s has had a miraculous recovery. It works. (But WHY?!?!)