Is there a way to have AHK find a runtime for movies?

Get help with using AutoHotkey and its commands and hotkeys
Louis Tully
Posts: 19
Joined: 25 Apr 2018, 03:03

Is there a way to have AHK find a runtime for movies?

25 Apr 2018, 03:24

Hello, all. Longtime user, first time caller. (mostly video games and a couple things at work)

For the past few years, I've been wanting to make a list of all the movies and tv shows I've ever watched from as far back as I can recall. Just for the hell of it. Recently, I thought it would be an interesting addition to also calculate the total minutes of the shows and movies. I was wondering if it's possible to have AHK get data from wiki or imdb or where ever possible to find the runtime for these things and have it put that info in a list?


So, I type in a list of movie titles and AHK finds runtimes. Something like this maybe. I'm not particular on how it looks.



Image
TheDewd
Posts: 874
Joined: 19 Dec 2013, 11:16
Location: USA

Re: Is there a way to have AHK find a runtime for movies?

25 Apr 2018, 10:28

I found an API for the Open Movie Database. They require users to sign up for an account, but their website offers free lookups from the "Examples" on their website.

The link below is the Request URL used for the examples. You must keep the "BanMePlz" for the API Key for it to work. Not sure what the consequences are for using that URL. They might track the outside requests using "BanMePlz" and ban IP addresses. If you're worried, you can just navigate to their website, scroll down to the examples, and run the search directly from their website: http://www.omdbapi.com/

http://www.omdbapi.com/?t=Jurassic+Park&apikey=BanMePlz
User avatar
Gio
Posts: 370
Joined: 30 Sep 2013, 10:54
Location: Brazil

Re: Is there a way to have AHK find a runtime for movies?

25 Apr 2018, 10:37

Hello Louis Tully.

Welcome to the AutoHotkey Community Forums.

It is possible to create an algorithm to do this. I would suggest something like this:

  • 1. Choose a search mechanism to retrieve the data from (Wikipedia, Google Search, etc)
  • 2. Study the URL of the search mechanism to understand how to have your script create fully functional searching URLs for that search mechanism.
  • 3. Use HttpRequest() by VxE or some other function that retrieves HTML source codes of webpages whose URL you provide.
  • 4. Study the incoming source codes to understand how to isolate the info you whant. This can be achieve with RegExMatch() (Or if you don't know how to use it, a well thought chain of simple String treating AutoHotkey commands)
  • 5. Use the info to update the Excel spreadsheet via COM or display in a GUI or however you want to.

The main problem in this case is that HTML source codes for certain mechanisms (google search in example) may vary a lot, so you have to find a mechanism and a string treating routine that has good reliability (i.e., out of 100 movie titles searched, it sucessfully retieves 90+).

The following algortihm uses Google Search and works for some titles, but will not work for others (and may even display inaccurate info sometimes). If you want to, you can build over it in order to improve reliability. It is a pretty small code, most of it is just VxEs function, which i included to allow copy-paste-run.

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus



:arrow: EDIT: I see TheDewd found an excellent source, perhaps much better than google search, but since i had already written this step-by-step instruction i will just leave it here. You can update this code to use his source if you want to.
"What is suitable automation? Whatever saves your day for the greater matters."
Barcoder - Create QR Codes and other Barcodes using only Autohotkey !!
Louis Tully
Posts: 19
Joined: 25 Apr 2018, 03:03

Re: Is there a way to have AHK find a runtime for movies?

26 Apr 2018, 17:44

Gio wrote:Hello Louis Tully.

Welcome to the AutoHotkey Community Forums.

It is possible to create an algorithm to do this. I would suggest something like this...



Thanks so much!

That stuff is waaay above my meager tinkerings with AHK so far. I sort of got it work. I click on the movie title then hit F1. If I don't put a reload command in there, I have to select the movie title and press F1 two times for it to work. Am I going about this wrong and is there a way to make it roll through a long list? Say if I filled in 50 or 100 movies.

Image


Here's what I did.

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus


Return to “Ask For Help”

Who is online

Users browsing this forum: No registered users and 30 guests