Movie cataloguer example, brain dead

Share your advanced PureBasic knowledge/code with the community.
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4747
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Movie cataloguer example, brain dead

Post by Fangbeast »

Here is my current implementation of my movie catalogueing features. Not meant to be comprehensive but a subset of what I am working on for my Multibase program.

Thanks to all those kind people who helped me correct my issues.

Main screen: Add, Delete, Edit, print movies, search the database.
Data screen: Save, Lookup, Scan, Print.

1. Make sure the scanner is connected for the cover scan function.

2. Add your OMDB API developer key to where it says [YourKey] in OMDBAPI_MyConstants.pb. Remove the square brackets as well:):)

3. Searching the IMDB that uses the OMDBAPI requires you to type in a title (Only the first match is returned, a title and year separated by '/' or the IMDB ID of a title that you are searching for (highly accurate!!) which looks something like this: 'tt3896198'

My sense of humour required me to use a toilet roll icon instead of a scanner icon for that option:):) The scan function allows you to scan your own cover and replace the one returned by the OMDB lookup.

Would be nice if people could look at it and improve it or give some sort of feedback.

And leave my goats alone!!

https://www.dropbox.com/s/detdb8maqg7hy ... te.7z?dl=0
Amateur Radio, D-STAR/VK3HAF
GoodNPlenty
Enthusiast
Enthusiast
Posts: 107
Joined: Wed May 13, 2009 8:38 am
Location: Arizona, USA

Re: Movie cataloguer example, brain dead

Post by GoodNPlenty »

Impressive. Wouldn't run in 5.70 x64 Windows 10, but ran fine in 5.70 x86.
Thank You for sharing!
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4747
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Re: Movie cataloguer example, brain dead

Post by Fangbeast »

GoodNPlenty wrote:Impressive. Wouldn't run in 5.70 x64 Windows 10, but ran fine in 5.70 x86.
Thank You for sharing!
Thanks. This one is only the first draft though. Have added a lot of other little things I needed since then including export to various formats but I have to yell in the forum for help as one of my queries has gone kaput.

When that's fixed, I will upload the new one.
Amateur Radio, D-STAR/VK3HAF
davido
Addict
Addict
Posts: 1890
Joined: Fri Nov 09, 2012 11:04 pm
Location: Uttoxeter, UK

Re: Movie cataloguer example, brain dead

Post by davido »

@Fangbeast,
I can confirm that it will not run when compiled in Windows 10 x64.
The error I am getting is: Cannot locate the SQLite Database.

Do you know, perchance, why this occurs?
DE AA EB
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4747
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Re: Movie cataloguer example, brain dead

Post by Fangbeast »

I can confirm that it will not run when compiled in Windows 10 x64.
The error I am getting is: Cannot locate the SQLite Database.

Do you know, perchance, why this occurs?
Hello Davido. I wish I knew but I don't use the 64 bit version of PB under Windows 10 Insider edition because it gives me nothing but trouble. Windows 10 is a pain in the buttocks for so many things lately.

Dump the old code, I am just about to post the new message about the current code below. Don't know if it will fix the problem but we can only go from there.
Amateur Radio, D-STAR/VK3HAF
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4747
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Re: Movie cataloguer example, brain dead

Post by Fangbeast »

Folks, new PERVERSION of my code. Please see if it fixes issues as well as I have worked hard on it.

https://www.dropbox.com/s/detdb8maqg7hy ... te.7z?dl=0
---------------------------
Okay, here is a new release (Major stuffup as usual) with things my wife asked for and things I needed. And before you ask, the export is broken and I don't know how I did it (for now)

**NOTE1** You must have an OMDB API developer key to use the internet lookup features. This key will be requested EACH time the program starts if you do not have one installed. This key is installed into the SQLite database. DO NOT GIVE THAT KEY TO ANYONE!!!

**NOTE2** You must have a TWAIN compliant scanner connected to the computer for the cover scan to work. This is the way I like getting up to date covers.

**NOTE3** Chuck the source code project into any directory as is. Any needed directories will be created. There should be a sample database provided WITHOUT the OMDB API developer key.

**NOTE4** There are some extra procedures in the Modules\Thirdparty directory that are not all currently used but are provided for interest only. Written by some very clever people (Obviously not me!)

**NOTE5** The covers returned by title searches are usually correct except for when you are trying to search for a series and sometimes not even then. For accuracy, I go to the IMDB database, locate the correct title, find the IMDB ID (starts with tt in the address bar) and paste that into my search bar to get accurate returned data. But I have noticed that the cover returned from the ID may be different than the picture shown on the actual IMDB web page for that id.

This frustrated me many times for my StarGate series as it kept returning a generic series cover when there were multiple episodes in a boxed set. You are better of using the ID all the time to fetch data and scanning covers individally for series dvds.

If you have a database from the previous source code, it hasn't changed format except for the addition of an extra preferences table which will also store your OMDB API developer key.

Just to summarise the features: FROM THE MAIN FORM

1 Add a new movie to the database. You can manually add all details or use the internet lookup button to fetch data from the OMDB database. You MUST have an OMDB API developer key installed for that.

If you decide to replace the poster/cover with one of your own, the path in the poster field is also replaced with the local filename of the new poster/cover. This local filename is generated from the movie title.

2 Change your stored OMDB API key and replace it with a new one in the database.

3 Delete the currently selected movie from the database. The associated picture is also removed.

4 Edit the currently selected movie.

You can manually add all details or use the internet lookup button to fetch data from the OMDB database. You MUST have an OMDB API developer key installed for that.

If you decide to replace the poster/cover with one of your own, the path in the poster field is also replaced with the local filename of the new poster/cover. This local filename is generated from the movie title.

5 Export all the movies in the database to disk in text, JSON and XML format. (Currently broken and I don't have the brain cells to figure out why)

6 Find movies in the database by using a simple text search.

7 Print the current movie. This uses some clever RASHAD code to grab a screen dump of the foreground window and send it to your default system printer, form and all. You can print the current movie from the main form and the editor form.

FROM THE EDITOR FORM

1 Save the new or edited movie data to the database

2 Lookup the details for the movie in the OMDB database from the details provided in the search bar. Type either the IMDB ID into the search bar and press ENTER or use the title by itself and press ENTER or use the title and the year separated by the forward slash '/' and press ENTER.

3 Scan a new cover for the current movie from a TWAIN compliant scanner. You must have a TWAIN compliant scanner connected to the computer for the cover scan to work. This is the way I like getting up to date covers.

4 Print the current movie. This uses some clever RASHAD code to grab a screen dump of the foreground window and send it to your default system printer, form and all. You can print the current movie from the main form and the editor form.

Amateur Radio, D-STAR/VK3HAF
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4747
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Re: Movie cataloguer example, brain dead

Post by Fangbeast »

Couldn't wait, just uploaded the fixed project. Same link as above. Maybe I can eat now?

Still to do:

1. Implement an import mode as well in case someone else has a database to give you. (Will need help with json)

2. Allow people to load a cover off disk as not everyone has a scanner lying around.

3. Add in a batch catalogue mode. OMDB allow an extra parameter to download a season of a series. Since I own 10 seasons of Stargate SG1, I want to be able to catalogue an entire season at a time. I've tested the data return from such a query and it returns 5 items of info for each movie in the series requested of which only the IMDB ID is of interest for the batch mode.

I will be able to parse that list for the IMDB ID's and request one after the other to catalogue.

This will require some testing and I need help with the json parsing (as usual) because I don't know what I am doing!!
Amateur Radio, D-STAR/VK3HAF
Post Reply