#Hello-
If you’re like me and have a large collection of The Great Courses that you have downloaded, you would like there to be a metadata agent for these. Well, a while back I wrote code using urllib, BeautifulSoup and dryscrape to pull series summary, lecture titles, lecture descriptions, lecturer/professor, episode dates, ratings, fanart and poster art and was manually copying and pasting the data into my series. After a few times of doing this, I figured that I should spend the time to code a PLEX Agent for TGC. So I did. This has been tested only on Ubuntu 15.10 running the PLEX media server. No information on other systems is currently available.
The TGC.bundle github.com/bubonic/TGC.bundle that I ended up with doesn’t use the PLEX HTMLparser API or the JSON API, but instead I did a quick hack of the code I had already written using urllib and BeautifulSoup and inserted this into my Agent. Thus, full compatibility is still a ways off, so we will call this a BETA release of the TGC Agent. It pulls everything but rating; adding incremental dates from the day of series addition so that after a lecture is watched the new one will appear in the On Deck portion of PLEX.
Even though my agent pulls lecturer/professor metadata from TGC website, I am still having issues populating episode.writers and episode.directors. I tried various means of populating this data to no avail. So if anyone has any insight as to what I need to do to get this populated please chime in. Right now I have:
episode.directors.clear()
episode.writers.clear()
episode.directors.add(lecturer)
episode.writers.add(lecturer)
The old documentation I found said this was a Set object, which I interpreted in various ways (i.e., as a Set object, as a string, as a list, so on and so forth). I even set these values to different types of objects containing the lecturer/professor data, however nothing seemed to work.
The rating was pulled using dryscrape which I believe is incompatible with the restricted PLEX python library. So that code has been commented out for now. Please carefully read the instructions on how to get the TGC Agent working for you. I will include the README.md from the git repository here for completeness.
Requirements
For now, this PLEX Agent requires urllib/urllib2 and BeautifulSoup to run. Please have these installed in your python set-up.
INSTALL
Download the complete contents of this git project (git clone) and copy the bundle (TGC.bundle) to your PLEX plug-ins directory.
The appropriate plug-ins directory can be found on the PLEX website (https://support.plex.tv/hc/en-us/articles/201106098-How-do-I-find-the-Plug-Ins-folder-)
Be sure to restart the PLEX server after copying the Agent plug-in.
Usage
Rename your course to filenames of the type:
FULL COURSE NAME S01E## Some Text.ext
where E## is the lecture number. The Full Course name should be taken from TGC website.
The files must be renamed properly for this Agent to pull the data from TGC website.
###Example:
Games People Play: Game Theory in Life, Business, and Beyond S01E01 The World of Game Theory.mp4
or
Change and Motion: Calculus Made Clear, 2nd Edition S01E10 Blah.avi
Next:
Create a TV Shows Library in PLEX and set the primary agent to TGC. i.e.,
Add directories individually (not directories of directories) to your library. i.e.,
That should do the trick.
There remains a few minor bugs in this code which made me reluctant to release it, but no code is perfect. I’m very busy with multiple projects, but I will try to keep this updated whenever things change. Also, I have a TODO list for this Agent that is on the git repository and I do have ambitions to see them through, time permitting.
With that said:
Enjoy!
-bubonic







