Hey folks, there is a new Podcast category for forums https://forums.plex.tv/categories/podcasts
If you have not already, we suggest setting your Plex username to something else rather than email which is displayed on your posts in forum. You can change the username at https://app.plex.tv/desktop#!/account
Welcome to our forums! Please take a few moments to read through our Community Guidelines (also conveniently linked in the header at the top of each page). There, you'll find guidelines on conduct, tips on getting the help you may be searching for, and more!

[REL] TGC (The Great Courses) Metadata Agent



  • tramp78tramp78 Posts: 85Members ✭✭
    edited July 2017

    VERY cool. Yup, that fixed the Set issue.
    Regarding the Audio lectures, I looked through my library and compared it to the website and it looks like there are only 40 courses that are still for sale that are audio only. Not that many. Here is the list if you are interested. LOL Not sure this is worth it compared to other things you are working on.

    1066 (The Conquest)
    20th Century American Fiction
    36 Big Ideas
    A Day’s Read
    Abraham Lincoln: In His Own Words
    Aeneid Of Virgil
    American Religion History
    Americas in the Revolutionary Era
    Business Law - Contracts
    Business Law - Negligence and Torts
    China, India, and the United States: The Future of Economic Supremacy
    Espionage And Covert Operations: A Global History
    Ethics of Aristotle
    European Thought and Culture in the 20th Century
    Explaining Social Deviance
    Exploring Metaphysics
    Francis of Assisi
    History of the US Economy in the 20th Century
    How the Crusades Changed History
    How to Read and Understand Poetry
    Language A to Z
    Legacies of Great Economists
    Life and Writings of C. S. Lewis
    Life and Writings of Geoffrey Chaucer
    Literary Modernism
    Modern British Drama
    Moral Decision Making: How to Approach Everyday Ethics
    Plato, Socrates and the Dialogues
    Practical Philosophy: The Greco-Roman Moralists
    Quest for Meaning: Values, Ethics, and the Modern Experience
    Rights of Man: Great Thinkers and Great Movements
    Skepticism 101: How to Think like a Scientist
    The Art of War
    The First Amendment and You
    The Greatest Controversies of Early Christian History
    The Skeptic's Guide To The Great Books
    The Soul and the City: Art, Literature, and Urban Living
    Turning Points in Medieval History
    Understanding Literature and Life
    Lives and Works of the English Romantic Poets

  • bubonic314bubonic314 Posts: 27Members ✭✭


    (v 0.4.1)


    A few updates have been added:

    • Adds Lecture thumbnails from available courses on the TGC+ website
    • Cleaned up some of the code

    We have a new addition. For courses found on the TGC+ (https://www.thegreatcoursesplus.com/) website, the TGC Agent now pulls the Lecture thumbnails from the respective course webpage on TGC+. This was a suggestion from a friendly user of github.


    It should find most of the courses from TGC that have a counterpart TGC+ course site. Not all courses are available on TGC+. There might be a few straggling courses that are on TGC+ that TGC.bundle doesn't quite pull, so if you find any, PLEASE LET ME KNOW and I'll make adjustments to the code to find the TGC+ course page. Unfortunately I had to use a brute force method to find the courses on TGC+ because the search results are all in javascript and TGC.bundle primarily parses HTML.


    • Make course description identical to TGC course site. (lots of html parsing! - half way done)
    • Add genres.
    • Clean up some of the code.
    • Add more try/except error checking.
    • Add checks for existing metadata so it's not updating the metadata every time.
    • Make the code less demanding on the PLEX server.
    • Add compatibility for audio lectures.




  • tramp78tramp78 Posts: 85Members ✭✭
    edited July 2017

    Quick question on your latest TTC plug in. I'm trying to get the episode thumbnails to work and I need to know if there is a naming convention. Most of my lectures are named
    S01E01 - name
    S01E02 - name
    And none of those actually get the thumbs.
    But I just added one that had the following names

    Tgc course# - S01E01 - name
    Tgc course# - S01E02 - name
    And that one did. Is the key putting in the "TGC course number" before the episode numbers? IF so I guess I may need to track all those down somewhere.....

  • tramp78tramp78 Posts: 85Members ✭✭

    Followup - just adding those values didn't do it after a rescan. But if you unmatch it and rematch it (or just fix match) it works regardless of whether you put the course number in.

  • bubonic314bubonic314 Posts: 27Members ✭✭
    edited August 2017

    File Renamer

    I have written a little script to rename the TGC course files, gathering data from the directory name of the course (usually contains part or most of the TGC course name), and matching it with a course from a database file. It will rename all the multimedia files to appropriate names for the TGC.bundle PLEX Agent to use in collecting metadata for the course.



    If you're like me and working on a headless machine with a PLEX server installed, you've probably had to do a bunch of commands like:

    for i in *; do echo "FILE: $i" && mv "$i" "echo "$i" | sed 's/.*lecture-//g'"; done

    and again and again until you got the TGC course video files named corretly. Well, I got tired of doing this so I
    wrote a shell and perl script to do all the work for us.

    These three files:

    • AllTGC_TItlesandCNonly.csv - All TGC course names and numbers separated by '['.
    • levenstein.pl - A fuzzy matching algorithm written in PERL.
    • TGCrename.sh - The brain (or heart) of it all.

    will use the data in the directory name to find the best course match and will rename all the multimedia files
    to an appropriate name that the TGC.bundle Agent can then use to collect metadata.


    First, copy all files in this repository to the course directory:

    cp AllTGC_TItlesandCNonly.csv levenstein.pl TGCrename.sh directory_of_course_containing_lecture_files

    Then cd to the course directory and run

    ./TGCrename [option]

    There are two options that can be used:

    -y , Trust TGCrename to automatically rename all the files, but will prompt for acceptance of matching course.

    -yy , Fully trust TGCrename to do everything for you. i.e., it finds the correct course and names all the files correctly.

    If you just run:


    within the course directly, it will prompt for acceptance of course name and will prompt for acceptance to rename each file.

    If you run:

    ./TGCrename -y

    It will prompt for acceptance of the course name and will use that data to automatcially rename the files.

    if you run:

    ./TGCrename -yy

    It won't prompt you for any acceptance and will use the data collected to automatically rename the files. This means you are fully trusting the program. (It tends to work almost all the time, but it's up to you what level of trust you would like).



    Companion Files

    I found a list of all the courses with some data included about the courses on reddit. It took sometime, but I was able to convert this to pdf, csv, ods, and xlsx. It can be useful for researching the data and finding basic course information. All the files can be found here:

    All The Great Courses Lists

  • tramp78tramp78 Posts: 85Members ✭✭

    Note - Introduction to Archaeology (TGC193) is now Out of Print.

    Also, I have a large collection of sample and or audition lectures. Do you want a list of those? For example these were one off lectures:
    Olympics From Ancient Greece to Athens 2004
    Christmas Traditions in Victorian Britain and America
    Fiction In The Da Vinci Code
    Papal Elections
    Einstein’s 100th 'Anniversary'
    St. Patrick- The Patron Saint of Ireland
    Holiday Music

    These were lectures that were sent out due to current events in most cases.

    There were also a bunch of lectures that were sent out as auditions for lectures that were never made. Stuff like:

    Book of Ruth
    The Religion of our Founding Fathers
    The Science of Memory
    Voting - Determining The Will Of The People
    Great Leaders - Abraham Lincoln And Winston Churchill

  • bubonic314bubonic314 Posts: 27Members ✭✭

    @tramp78 I would love a list of those, anything to complete my collection. I wasn't even aware of those lectures. It'd be cool to add them too. Thanks!

    On another note, the TGCrename doesn't always find the right match based on the directory name, but most of the time it does. One thing to be aware of is that the database that TGCrename uses still has unicode characters in there and the agent doesn't handle those yet. I'm in the process of removing the unicode characters and fixing some of the titles that are not the exact course name found on the page. But, in using the TGCrename program, I'm finding it saving a lot of time for me. I usually use TGCrename.sh -y just in case.

  • gamjargamjar Posts: 21Members, Plex Pass Plex Pass
    edited August 2017

    Here is my list of video auditions. A few of us, who have put together a xbmc nfo agent pack, just threw all the auditions in as one season as follows. I'm still using the nfo solution for out of print materials - but thanks again for all your work on this agent! Also FYI Tramp at least half of those current audio only also have been sold as video - they are just not being sold any more.

    Auditions S01E01 Phillip Braun - A Brief Introduction to Portfolio Diversification.avi
    Auditions S01E02 Philip Brown - The Chinese Economic Miracle.avi
    Auditions S01E03 Stuart Sutherland - The Death of the Dinosaurs.avi
    Auditions S01E04 Rick Roderick - The Emancipatory Challenge of Critical Theory.avi
    Auditions S01E05 William Fitch - The Evolution of Speech.avi
    Auditions S01E06 Paul Pasles - Great Mathematical Ideas - The Polygon and Leonard Euler.avi
    Auditions S01E07 William Newman - Isaac Newton and 17th-Century Alchemy.avi
    Auditions S01E08 Donald G. Saari - A Mathematical Look at Elections.avi
    Auditions S01E09 David Kung - Mathematics and Music.avi
    Auditions S01E10 Nathan Harshman - Measuring Gravity.avi
    Auditions S01E11 Bruce H. Edwards - Prime Numbers - Pure Math That Is Useful.avi
    Auditions S01E12 Patrick Bahls - Prime Numbers and the Mathematics of Cryptography.avi
    Auditions S01E13 Grace Spatafora - The Rise and Fall of Antibiotics.avi
    Auditions S01E14 Bruce E. Fleury - The Rise of Germ Theory.avi
    Auditions S01E15 Kevin Ryan - The Science of Cooking - Secrets of Sugar.avi
    Auditions S01E16 Frank Summers - Things that Go Kaboom in the Night.avi
    Auditions S01E17 David J. Helfand - Your Universal Insignificance.avi
    Auditions S01E18 Lee Branstetter - Will China and India Dominate the 21st-Century Global Economy.m4v

  • tramp78tramp78 Posts: 85Members ✭✭
    edited August 2017

    yeah, I figured that out on the audio only stuff. Filled in a bunch of blanks recently.

    My Demo and audition list is as follows.

    A Mathematical Look at Elections - VIDEO
    Abolitionism, Anti-Slavery and the Origins of the American Civil War
    Book of Ruth
    Brave New Words - The Creation Of Language
    Brief Introduction to Portfolio Diversification - VIDEO
    Christmas Traditions in Victorian Britain and America
    Confucius and the Analects
    Death of King Charles I
    Duke Ellington; the Jazzman - Extra
    Einstein’s 100th 'Anniversary' - Two Complimentary Lectures
    Evolution of Speech
    Fiction In The Da Vinci Code
    Frederick the Great
    Great Leaders - Abraham Lincoln And Winston Churchill
    Great Mathematical Ideas - The Polygon and Leonard Euler - VIDEO
    History of the Construction of St. Peter's Basillica
    Holiday Music
    Isaac Newton and 17th-Century Alchemy - VIDEO
    Lewis and Clark -The Explorers
    Mathematics and Music - VIDEO
    Measuring Gravity - VIDEO
    Nietzsche, Wittgenstein, Rawls and Foucault
    Olympics From Ancient Greece to Athens 2004
    Papal Elections
    Prime Numbers - Pure Math That Is Useful - VIDEO
    Prime Numbers and the Mathematics of Cryptography - VIDEO
    Rise and Fall of Antibiotics
    Rise and Fall of Antibiotics - VIDEO
    Speech, Perception and Stereotypes
    St. Patrick- The Patron Saint of Ireland
    Structuralism in Homer's The Oddysey - Audition
    Swift- Gulliver's Travels
    The Chinese Economic Miracle - VIDEO
    The Death of the Dinosaurs - VIDEO
    The Evidence for Evolution
    The First Jewish Revolt Against Rome
    The Religion of our Founding Fathers
    The Science of Memory
    The Search For What Killed The Dinosaurs
    Things that Go Kaboom in the Night - The Phenomenon of Supernovae
    Unifying a Divided World
    Voting - Determining The Will Of The People
    What Does It Mean To Be An American
    Who Was Goliath!
    Will China and India Dominate the 21st Century Global Economy - VIDEO
    Wittgenstein and Language Analysis
    Your Universal Insignificance - VIDEO

    Some of these were those audition lectures they used to send out . Some weren't all that good but I couldn't being myself to get rid of them.

  • bubonic314bubonic314 Posts: 27Members ✭✭


    (v 0.4.5)

    Added Genres for all courses


    This will cause PLEX to populate the "Related Shows" more accurately.




  • tramp78tramp78 Posts: 85Members ✭✭

    Ok, this is pretty cool. It pulls in the genres and allows you to filter on those since it adds the tags. Duh. Very cool.

    For some reason, The Everyday Gourmet the Joy of Mediterranean Cooking (TGC9284) pulls in the artwork for the "FREE BONUS" artwork. The artwork is the third graphic on the list, instead of the second for that one. All other cooking shows have the BONUS art (get a big cookbook) in the third slot but that one has it in the second slot where the cover art resides 99% of the time.

  • bubonic314bubonic314 Posts: 27Members ✭✭


    It looks like TGC has switched to an all HTTPS site. So I had to update the code to add support for HTTPS requests when gathering metadata. Please update if you haven't already.



  • jeronzjeronz Posts: 1Members, Plex Pass Plex Pass

    Thank you so much for this. It works really great.

  • GoingGaGaGoingGaGa Posts: 99Members, Plex Pass Plex Pass

    @bubonic314 Dude, you are an absolute time-saving-ninja!

    Just started my collection, will rapidly build in the new year, but thus far my 7 sets have gone flawlessly!

    Thank you so much for both the renamer and the agent, truly appreciate it!

  • gamjargamjar Posts: 21Members, Plex Pass Plex Pass

    Would there be any way to hard code in information from the out of print courses into this agent? A few of us have made nfo files and used the XBMCnfo agent for discontinued video courses (I think there are around 100 or so). Solution right now is to stack your agent and the XBMCnfo agent, but it might be worth brainstorming on other solutions.

  • GoingGaGaGoingGaGa Posts: 99Members, Plex Pass Plex Pass
    edited September 2017

    Understanding Calculus - Problems, Solutions, and Tips (TGC1007)

    Renaming discrepancy...

    The Great Courses/Understanding Calculus - Problems, Solutions, and Tips (TGC1007)/Understanding Calculus: Problems, Solutions, and Tips (TGC1007) S01E01. A Preview of Calculus.avi
    The Great Courses/Understanding Calculus - Problems, Solutions, and Tips (TGC1007)/Understanding Calculus: Problems, Solutions, and Tips (TGC1007) S01E02.__Review_-_Graphs_Models_and_Functions.avi

    Also, renamer picked up episode 37 and named as End Credits while the agent picked it up as 2017-10-08 for some reason...

  • bubonic314bubonic314 Posts: 27Members ✭✭

    @gamjar I recently got some of the OOP courses, but I don't have any data on them to load into the agent results. If you you have the nfo files we could make a database of the out of print course metadata and I could code the agent to retrieve that data when it it encounters an OOP course. Hardcoding it would make the agent bulky and slower, but retrieving it from a db file when it, say, encounters a course number for an OOP course would be more efficient. Do you have course numbers for the OOP courses among the data in the nfo files?

  • tramp78tramp78 Posts: 85Members ✭✭

    Remember this?


    It has as many OOP lectures as I'm aware of with the course numbers and lecturer name.

    All of the single demo lectures, freebies and auditions don't have numbers.

  • bubonic314bubonic314 Posts: 27Members ✭✭

    @tramp78 Oh right.... good looking out. :)

    I don't have any of the info for the OOP lectures (course description, lecture names, lecture description, etc.) in order to populate the PLEX fields. At this point, I'm a little hesitant to code TGC.bundle to accept data from other agents until I have fully tested them. So, if I get any data for the XBMCnfo to use, I'll test it with my agent and make sure it doesn't slow it down or conflict with anything the TGC agent currently does. Stacking the agents might be a means to populating OOP courses though.

    @GoingGaGa The reason why episode (lecture) 37 in that course series shows up on PLEX as a date, is because there is no lecture 37 on TGC website and since I use incremental dates in order for the next lecture to show up in the "On Deck" bar, it will use the date as the name. Haven't experimented with using filename info to pull in lecture name for say episode 0 and episode n+1.

  • gamjargamjar Posts: 21Members, Plex Pass Plex Pass

    @tramp78 Yes, that is my spreadsheet. I believe there are still a few errors in that one.

    @bubonic314 I'll PM you soon about the xmbcnfo files

Sign In or Register to comment.