Author Topic: PvdImport image selection  (Read 4077 times)

0 Members and 1 Guest are viewing this topic.

Offline rick.ca

  • Global Moderator
  • *****
  • Posts: 3241
  • "I'm willing to shoot you!"
    • View Profile
PvdImport image selection
« on: September 15, 2009, 09:57:13 pm »
Nostra, I don't expect you to know how raldo has coded his plugin (I certainly don't!), but I would like to ask on his behalf...

What is the method for addressing/selecting one particular image associated with a movie? In particular, is there a way of selecting the poster that has been selected ("paper clipped") for display when there are multiple posters? MC can handle only one "cover art" item, and this is the obvious one to import.

From my testing of the plugin, I can only guess the issue of multiple posters has not been addressed. Where there are multiple images, it might select anything—usually a poster, but sometimes a screenshot or cover. I don't see any pattern to this, so maybe it's getting image with the highest or lowest index number. The only way I've found to change the image it's getting, is to delete the image, run it again, and hope it gets a poster. If I re-add the "offending" screenshot or cover again, it may be selected again, or it may not.

Looking at the database tables, I see there's a field for the image type. So I guess the obvious solution is to restrict the selection to posters. It would be desirable, however, if the specific poster selected for display in PVD could be selected. I couldn't determine how this is recorded in the database.

Offline nostra

  • Administrator
  • *****
  • Posts: 2852
    • View Profile
    • Personal Video Database
Re: PvdImport image selection
« Reply #1 on: September 15, 2009, 10:46:57 pm »
Do you need a solution using SQL (there is one) or export plugin (no way to retrieve a particular poster, but image types are distinguished)?
Gentlemen, you can’t fight in here! This is the War Room!

Offline rick.ca

  • Global Moderator
  • *****
  • Posts: 3241
  • "I'm willing to shoot you!"
    • View Profile
Re: PvdImport image selection
« Reply #2 on: September 15, 2009, 11:16:48 pm »
Export plugin, I guess. The plugin maps SQL statements to MC fields, but it has a separate option for importing "cover art" to a designated folder or "beside" the media file. I'll have to let raldo explain further, it that's necessary.

This doesn't seem likely, but... Assuming the best he can do is restrict image type to posters, is there a way to relate the poster retrieved to the poster numbers that appear in the PVD interface? In other words, even though the poster selected for display can't be identified, can it be done in such a way that "poster #1" is the one retrieved?

Offline raldo

  • Power User
  • ****
  • Posts: 140
    • View Profile
Re: PvdImport image selection
« Reply #3 on: September 16, 2009, 08:44:20 am »
Do you need a solution using SQL (there is one) or export plugin (no way to retrieve a particular poster, but image types are distinguished)?

If it's possible to do this via SQL, then that would definitely be the best solution since that is the only way PvdImport currenly communicates with PVD.

Is there some kind of record in the database, perhaps, that keep track of "selected  images"? In my DB, I've only got one image per movie, so this hasn't been an issue for me...
« Last Edit: September 16, 2009, 08:47:54 am by raldo »

Offline raldo

  • Power User
  • ****
  • Posts: 140
    • View Profile
Re: PvdImport image selection
« Reply #4 on: September 16, 2009, 01:06:17 pm »
the only way PvdImport currenly communicates with PVD.

Let me clarify something here: PvdImport only uses the Pvd database to retrieve information. This also true for cover art retrieval.

This means that there is an SQL statement in PvdImport which the user cannot see. It basically retrieves the first image blob from the DB and saves it where the user has indicated in the PvdImport configuration.

I basically need some way of determining the index into the image table to where the desired image is stored. Does this info exist somewhere?

Offline nostra

  • Administrator
  • *****
  • Posts: 2852
    • View Profile
    • Personal Video Database
Re: PvdImport image selection
« Reply #5 on: September 17, 2009, 02:13:03 am »
Quote
In other words, even though the poster selected for display can't be identified, can it be done in such a way that "poster #1" is the one retrieved?

There is no way to be sure which post you get (currently). ;)

Quote
If it's possible to do this via SQL, then that would definitely be the best solution since that is the only way PvdImport currenly communicates with PVD.

Is there some kind of record in the database, perhaps, that keep track of "selected  images"? In my DB, I've only got one image per movie, so this hasn't been an issue for me...

Select one (random) poster as BLOB (you will get actual bytes of the post in "imgdata" field) (this poster is shown for a movie if you have not manually defined default poster):
Code: [Select]
SELECT FIRST 1 * FROM IMAGES WHERE ("imgtype" = 0) AND ("mid" = %d)
Select all posters as BLOB (you will get actual bytes of the post in "imgdata" field):
Code: [Select]
SELECT * FROM IMAGES WHERE ("imgtype" = 0) AND ("mid" = %d)
Select poster set as default as BLOB (you will get actual bytes of the post in "imgdata" field):
Code: [Select]
SELECT * FROM IMAGES
INNER JOIN MOVIES ON (MOVIES."mid" = IMAGES."mid" AND MOVIES."defposter" = IMAGES."imgid")
WHERE IMAGES."mid" = %d

Note: This code will return nothing if no poster is set as default
« Last Edit: September 17, 2009, 02:36:59 am by rick.ca »
Gentlemen, you can’t fight in here! This is the War Room!

Offline rick.ca

  • Global Moderator
  • *****
  • Posts: 3241
  • "I'm willing to shoot you!"
    • View Profile
Re: PvdImport image selection
« Reply #6 on: September 17, 2009, 02:43:58 am »
Thanks!

Quote
This code will return nothing if no poster is set as default

I assume raldo will be able to figure out how to combine this statement with the first one—so if there is no default poster, a random one will be retrieved.

Offline nostra

  • Administrator
  • *****
  • Posts: 2852
    • View Profile
    • Personal Video Database
Re: PvdImport image selection
« Reply #7 on: September 17, 2009, 02:58:50 am »
Quote
I assume raldo will be able to figure out how to combine this statement with the first one—so if there is no default poster, a random one will be retrieved.

Should be easy...
Gentlemen, you can’t fight in here! This is the War Room!

Offline raldo

  • Power User
  • ****
  • Posts: 140
    • View Profile
Re: PvdImport image selection
« Reply #8 on: September 17, 2009, 07:20:04 am »
MOVIES."defposter" = IMAGES."imgid"
Thanks, Nostra, It's now on my list of todos in PvdImport...