Skip to content

Instantly share code, notes, and snippets.

@40thieves
Last active October 20, 2020 14:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 40thieves/a9c506e4a0bc00588540f48be8bca1ac to your computer and use it in GitHub Desktop.
Save 40thieves/a9c506e4a0bc00588540f48be8bca1ac to your computer and use it in GitHub Desktop.

Pocketcasts/BeardedSpice fix 💚

So I like to listen to podcasts while at work. Nope, I don't find it distracting if it's specific podcasts. I like the background noise.

BeardedSpice is awesome for wiring up your Mac play/pause controls to things other than iTunes. Like the Pocketcasts web app. Unfortunately it broke recently, but here's the steps to fix.

Extra bonus: it now works in the Pocketcasts Beta 🎉

  1. Allow BeardedSpice to run JS in Chrome
  2. Restart BeardedSpice
  3. Grab the pocketcasts-plus.bsstrategy file in this gist
  4. Open BeardedSpice preferences and import it
  5. Enjoy your podcasts 🎧

Note: The file in the gist is adapted from this PR - thanks! I hope they merge it at some point.

BSStrategy = {
version: 4,
displayName: "PocketCasts+",
accepts: {
method: "predicateOnTab",
format: "%K LIKE[c] '*play*.pocketcasts.com*'",
args: ["URL"]
},
toggle: function () {
document.querySelector('.controls [aria-label="Play"]').click()
},
next: function () {
document.querySelector('.skip_forward_button').click()
},
previous: function () {
document.querySelector('.skip_back_button').click()
},
pause: function () {
if (document.querySelector('.play_pause_button') && document.querySelector('.play_pause_button').classList.contains('pause_button')) {
document.querySelector('.play_pause_button').click()
} else if (document.querySelector('.controls [aria-label="Play"]') && document.querySelector('.controls [aria-label="Play"]').ariaPressed === 'true') {
document.querySelector('.controls [aria-label="Play"]').click()
}
},
isPlaying: function () {
if (document.querySelector('.play_pause_button')) {
return document.querySelector('.play_pause_button').classList.contains('pause_button')
} else if (document.querySelector('.controls [aria-label="Play"]')) {
return document.querySelector('.controls [aria-label="Play"]').ariaPressed === 'true'
}
},
trackInfo: function () {
return {
'track': document.querySelector(
'div.player_top div.player_episode'
) ? document.querySelector(
'div.player_top div.player_episode'
).innerText : document.querySelector('.controls .episode-title').innerText,
'album': document.querySelector(
'div.player_podcast_title div.player_episode'
) ? document.querySelector(
'div.player_podcast_title div.player_episode'
).innerText : document.querySelector('.controls .podcast-title').innerText,
'image': document.querySelector(
'div.player_top div.player_artwork img'
) ? document.querySelector(
'div.player_top div.player_artwork img'
).src : document.querySelector('.controls .podcast-image img').src,
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment