Hi all and thanks in advance,
I’ve been getting my head around using web sources to put ID3 tags onto videos. I’ve looked over the official Discogs scripts, several others from the community and now tinkering with @Sweder and @RobertM’s TMDB scripts to try and make an all-in-one script for both Movies and TV using TMDB’s “multi” search.
For movies? Easy, works no problem.
For TV? It’s a bit of a stinker. As much as I prefer TMDB, it had to be difficult.
TL;DR: The only way to get a TV show season from TMBD’s API is by constructing a URL that messes with the Web Sources Framework: you can’t query or put a TV season in [IndexURL], but you need the TV season for [AlbumURL]. This requires bypassing search or a method to insert a new value at any point in the script.
I’ve tried calling a second search prompt to ask for the value, using a %placeholder% tag value, sneaking it as a URL ¶meter= into [ParserScriptIndex] and using “CurrentURL” as an output buffer.
No matter what, I can’t get my pointer pointing at anything other than the website’s HTML/JSON. Is there a way to point Line and position: to other data or could there please be a way to do so?
Full breakdown
There is the likes of Plex for video tagging but I’d rather have tag data contained in the files, not separate. There is also other media management software more catered towards video: no way, I got my workflow set up really nicely. MP3Tag to the core, baby.
I wanted to make a web source for TMDB that would tag both movies and TV shows. A movie is simple as you’re inputting and outputting for one file, with potential to return an array if you select multiple files or OutputTo “Tracks”.
(Movie franchises and collections are a thing but let’s not go there.)
I figured it would be easiest to search for TV shows by a single season to get those episodes. This would be easier than working with all seasons, there’s also a limit of 20 appended URL parameters (looking at you, The Simpsons):
Get all episodes of a series - Talk — The Movie Database (TMDB)
Searching
Using TMDB’s “multi” search makes it easier to find multiple types of media. For example:
https://api.themoviedb.org/3/search/multi?query=Game+of+Thrones&api_key=…
This finds the TV show, as well as other possible matches.
The alternative is two separate scripts for “movie” or tv” written into [IndexURL] for the corresponding search:
https://api.themoviedb.org/3/search/movie?query=Game+of+Thrones&api_key=…
https://api.themoviedb.org/3/search/tv?query=Game+of+Thrones&api_key=…
The same but with less possible results per search (which might be more desirable).
Once a search result is chosen:
- For a “multi” search,
json_select "media_type"andSayRestto append “movie” or “tv” to[AlbumURL] - For a dedicated “tv” script, it’s pre-written into
[AlbumURL]:
This, however, will only return an overview of the TV show, no arrays of season/episode data.
The problem
Back to square one and now everything suffers the same problem: constructing the URL for a TV season. You can query a TV Show by name but you can’t include the season.
[SearchBy]= Season||%tvseason%||/season/%s will mess with [IndexURL] as it’s not possible to search for a season through the API:
https://api.themoviedb.org/3/search/multi/season/1?query=Game+of+Thrones&api_key=…
https://api.themoviedb.org/3/search/tv/season/1?query=Game+of+Thrones&api_key=…
All will return a bad URL, unless you leave %tvseason% blank to disable /season/%s. Regardless, nothing supports any notion of a season/episode in the query.
To get season data, the only solution is to go straight to [AlbumURL]:
https://api.themoviedb.org/3/tv/{series_id}/season/{season_number}&api_key=…
@RobertM has kindly made a script based on this: you can go straight to the goods but this bypasses search functionality and requires extra steps to obtain an IMDB ID. I am desperate for one-click solutions, sorry. ![]()
wat do??
So I’m no coder but I’ve had a rare old time with columns, actions, a little bit of exporting and now trying out web sources. Frankly, bashing together functions, trial-and-error and unhealthy amounts of research got me confident enough to give this a try. Here’s what I’ve tried as potential options:
Being a noob:
Making a second section of [SearchBy] and [ParserScriptIndex]. Thought it might have initiated a second prompt to search and add in values with some conditions:
If it’s a movie, continue to
[ParserScriptAlbum]If it’s a TV show, ask for a season/episode then put that into
[ParserScriptAlbum]
Worth a try but not the case. Ho-hum.
%placeholders%:
Fair confirmation that tag values can’t be utilised except in [SearchBy]. It’d be fantastic though as %placeholders% are by far the most powerful part of MP3Tag functionality and are implemented in just about every other aspect of the software.
Sneak it into a URL:
This got me all excited so I tried [SearchBy]=Season||%tvseason%||&season=%s to sneak the season value into [IndexURL]:
https://api.themoviedb.org/3/search/tv?query=Game+of+Thrones&season=1&api_key=…
Thankfully, both the website and the API returned expected results and is still available in “CurrentURL” for the value to be appended to [AlbumUrl]…
Unfortunately, I haven’t found any way to grab it as I can’t figure out how to point to it. Please let me know if I’ve missed something, this is the first time I’ve worked with pointers.
Output buffer as an %output%:
Promising but from my understanding, it refers to an output as a parameter for commands to manipulate the HTML/JSON, rather than pointing at and manipulating the output value. I thought this would let me finally mess with “CurrentURL” but unfortunately not. I also kept typing %output% rather than say, %test% or %_url% or %title% or %TEMP_blahblahblah%.
Looks like a feature suggestion…
By checking debug text files, I’ve tried every command to get data other than what’s returned from TMDB’s API loaded into Line and position: which is where I’ve arrived at.
If there were a way to make Line and position: point at the likes of “CurrentURL” or %tvseason%, this could work. Multiple prompts sounds cool but that’s an afterthought (besides, too many clicks).
I’ll take whatever outcome but I’ve had far too much fun and utility with this program to skip getting advice or taking the opportunity to raise the case for something that could help web sources become far more flexible.
P.S. Apologies for the long read and throwing a load of hyperlinks. Got a bit passionate about this one. ![]()