Skip to content

Instantly share code, notes, and snippets.

@joshbrown
Last active September 3, 2020 15:01
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save joshbrown/abbe97c4d145df392ed5699af83a816c to your computer and use it in GitHub Desktop.
Save joshbrown/abbe97c4d145df392ed5699af83a816c to your computer and use it in GitHub Desktop.
Quick Apple Script for listening to freeCodeCamp.org's Code Radio with QuickTime Player on macOS!
(*
Quick and simple Apple Script to listen to
freeCodeCamp.org's Code Radio using QuickTime Player on macOS.
Check out the web player here:
https://coderadio.freecodecamp.org
Josh Brown <josh@joshmbrown.com>
===============
Installation
===============
- Using Script Editor (/Applications/Utilities/Script Editor.app, save this script to wherever you'd like using the 'Script' format in the save dialog
- File > Export
- In the Export Dialog select the following:
- File Format: Application
- Options: Run Only
- Double click when you want to listen!
- Pro tip: If you use Alfred or Spotlight, you can quickly start listening to Code Radio!
Changelog
v1.0
- Ability to select stream from list (no relays yet)
*)
set streamList to {"128kbps MP3", "64kbps MP3"}
set stream128 to "https://coderadio-admin.freecodecamp.org/radio/8010/radio.mp3"
set stream64 to "https://coderadio-admin.freecodecamp.org/radio/8010/low.mp3"
set selectedStream to ¬
(choose from list streamList ¬
with title ¬
"freeCodeCamp.org's Code Radio" with prompt ¬
"Which Stream Would You Like To Use?" default items "128kbps MP3") ¬
as text
if (selectedStream = "128kbps MP3") then
set theCodeRadioUrl to stream128
else
set theCodeRadioUrl to stream64
end if
set timestamp to (do shell script "date +'%s'")
tell application "QuickTime Player"
open URL theCodeRadioUrl & "?" & timestamp
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment