Fetching tmbdid

Advanced Renamer forum
#1 : 10/12-24 07:31
Julix Pawel
Posts: 6
Hello Forum,

is there anyway to fetch a tmdb-id (the movie database) or imdb-id (internet movie database)
and use it in the renaming process of folders?

Thanks for the great software an have a great day.
Julix.

Edit: It looks like my internet had a hicup and posted the thread twice.
I'm sorry about that but I dont see a option to delete one myself.

edited: 10/12-24 09:37
#2 : 10/12-24 15:12
Miguel
Posts: 163
Reply to #1:
Hi there Julix.

I assume you want to add that data to your movie collection's name.
As far as I know, Aren doesn't currently access any websites to collect data.
There is probably some specialized program that can do what you're looking for.

However, AI can help you. It will be a bit difficult, but if you have patience, you can get it done.
Follow these steps:

1- In Advanced Renamer, load your movie files.
2 - Select the List method and press Populate List. This will populate the list with the names of your files. Make sure they are in alphabetical order.
3 - Select the entire list and paste it into your favorite text editor using Ctrl+C and Ctrl+V.

Now, we are going to use AI. I use Copilot, but ChatGPT can do it too.

4 - Select the movies you copied into your text editor. I would do it 20 at a time. I did it with 100 and it took a long time.
5 - In your preferred AI, type the following prompt:
"Could you get the imdb IDs of the following list of movies. Display it in text format and export the result to a txt file?."

6 - Paste the list of your movies.

This will give a result similar to this:
Gone with the Wind tt0031381
12 Angry Men tt0050083
Alien tt0078748

EDIT: If you copy the ID and paste in the search in imdb can see if the result is ok.
It´s possible that the result has : (colons) in the name. That can be fixed in Aren wit a Replace method. Somethig like this:
12 Angry Men: tt0050083
It seems to work with TMDB too.

You can copy the result and paste it into another List method in Aren. You must make sure that the order of your files is the same of the list.

I know that this can be complicated but don´t know any other method to do it.

Miguel

edited: 10/12-24 20:29
#3 : 11/12-24 10:47
Julix Pawel
Posts: 6
Reply to #2:

Hi thanks for the idea to go with AI, but to be honest I dont realy like AI as it's wrong way to often.

In the meantime i have seen that Advanced Renamer supports some self written scripts.
I assume these are javascript?!

I will take a look into that. With javascript it is pretty easy to call the tmdb-api.
All you need is a (free) API-token from tmdb.

#4 : 11/12-24 11:13
Julix Pawel
Posts: 6
Reply to #3:
Hmm it looks like sadly it won't work with the Script-Method as the in Advanced Renamer integrated Javascript does not support "fetch" or any other way to get some information from the internet.

So consider this a feature-request. Can we get "fetch" supported in the Script-Method?
Pretty please?!
#5 : 11/12-24 15:14
Miguel
Posts: 163
Reply to #4:
Hi Julix,
Sorry, I can’t help you with JS. I have zero programming knowledge, but maybe someone else can help you with that.

Miguel
#6 : 11/12-24 19:08
Delta Foxtrot
Posts: 364
Reply to #5:

Hi guys,

I looked into something like what you are describing, Julix, and I don't think it can be done inside ARen. If you have node.js or some other js interpreter you can probably do it outside of ARen, and have your script create a name -> code list in a text file, then import that into ARen for renaming.

As far as I can tell (but understand, I'm not an expert on this) there's no way to include any outside modules into the lightweight version of js implemented in ARen. But if you find a way to do it I'd love to see how you do it! :)

Best,
DF
#7 : 11/12-24 19:52
Julix Pawel
Posts: 6
Reply to #6:
Doing it outside of AdvRen would be pretty easy as you can simply import data from a csv or a textfile.

Having the ability to do it with the Scripting-Modul would be great to streamline the workflow and not have two different tools for one task.

I don't know which javascript framework is integrated into AdvRen, pretty sure only K. Jensen knows.
But we might be lucky and it's node.js < ver. 18.
In that case it would be as simple as updating node.js. Any version greater than 18 of node.js implements fetch.

You are (sadly) correct about including externals modules or librarys. That is not possible.
#8 : 11/12-24 20:01
Julix Pawel
Posts: 6
Reply to #7:
A little update: the javascript "framework" used is duktape.

edited: 11/12-24 20:02
#9 : 12/12-24 20:08
Kim Jensen
Administrator
Posts: 933
Reply to #4:
The idea of the program is for it to solve advanced and complex renaming tasks, hence the name Advanced Renamer. The program uses a lightweight JS engine based on Duktape for version 3 and QuickJS for version 4. The JS engine implements the JavaScript language and the most common and basic JS functionality. Features like importing libraries, internet connectivity, and file access are not available out-the-box, but I could probably implement those relatively fast. But I have chosen not to, and the reason is security, which I care about a lot. I am too afraid that those features will introduce a security risk to the users of Advanced Renamer, or that some more novice users don’t know what they are doing and end up making a mess.

The scripts used in the JS batch method, should be kept light. If you need more complex scripting, you should consider using a standalone script interpreter, like NodeJS, and maybe call the Advanced Renamer command line executable from the script instead.
#10 : 12/12-24 20:19
Julix Pawel
Posts: 6
Reply to #9:
Hi Kim Jensen,

thanks for your Email, Time and Response.
Im gonna post my reply here, because I think some other users may find the topic interessting.

I can somewhat understand the decision not to include web-functions because of securtiy reasons.
Even if I think its pretty unlikely that someone would social engineer an adv. renamer users to run a malicious script.
I can tottaly understand your point of view as the author.

Using the command line executable is something I absolutly forgot about.
Fetching the needed information with nodejs/python/php/perl and calling adv. renamer from the command line would make this a pretty solid solution for my problem.

Again, thanks for your time and the great software!
Best regards, Julix