mstinaff / PMS_Updater

Shell script for updating the Plex Media Server inside the FreeNAS Plex plugin
MIT License
440 stars 90 forks source link

Added support for Plex's new site which has a JSON API for accessing download URL info #16

Closed mneumark closed 8 years ago

mneumark commented 8 years ago

I switched from using a regular expression for a webpage to using the jq utility that parses JSON since Plex now offers a JSON API.

I also put in a check to make sure the user has jq installed and a message explaining how to install if it is not there.

assistcontrol commented 8 years ago

Rather that making people install jq, what about just using perl? It's already installed in the PMS jail and has JSON support built-in.

curl 'https://plex.tv/api/downloads/1.json?channel=plexpass' | perl -MJSON::PP -E 'say decode_json(<STDIN>)->{computer}{FreeBSD}{releases}[0]{url}'
mneumark commented 8 years ago

I can give that a try. Sure. Didn't remember that Perl had JSON support without resorting to CPAN.

mneumark commented 8 years ago

@assistcontrol Took your advice, I will say that certainly simplifies things. Good call.

mstinaff commented 8 years ago

Haven't tested personally yet but it looks good. Will test it myself soon.