Author Topic: Plugin dev. with C++ - Poster in movie folder - Questions  (Read 3101 times)

0 Members and 1 Guest are viewing this topic.

Offline Einar

  • Member
  • *
  • Posts: 9
    • View Profile
Plugin dev. with C++ - Poster in movie folder - Questions
« on: April 10, 2011, 03:26:11 pm »
Hello everyone,

I'm new to the forum and first I'd like to say that I really like PVD. I Tried some other applications, just recently found PVD and finally decided that it fits best, not least because of the possibility to adapt it with scripts, plugins and templates. 

Right now I'm trying to develop a plugin on the basis of the "C++ Plugin Skeleton" (http://www.videodb.info/forum_en/index.php/topic,1211.0.html) and got some problems while working with it. Mainly there are some basic questions I can't find an answer to. Actually I tried to develop the desired functionality as a script, but as it seems that the script engine does not support the necessary functions and datatypes, that isn't possible.

What i'm trying to do is, automatically getting an image, that is in the same folder as the movie-file, and assign it as a movie poster. I managed to do this with a script for the case that the image has the same filename as the movie-file. However, I like to get this working for arbitrary filenames. So obviously I tried "FindNext" and failed because the script engine does not know the function and the datatypes needed for it. 

Thus, I read the topic about programming own plugins (http://www.videodb.info/forum_en/index.php/topic,764.0.html), and tried different things with the C++ skeleton, but nothing works so far. So I hope someone here could enlighten me regarding some basic questions:

1. How can I get the Path of the current movie file (e.g. while scanning for movie files to include the movies in the db)? In the script it's "GetFieldValue(31)", but is there a way I can access the path within the C++ skeleton?

2. When I set the plugin type to PLUGIN_WEBPICIMPORT, which function is executed by starting the plugin? I thought that "BeginWork" and "GetURL" might be executed automatically when the plugin is used in PVD, but that does not seem to be the case with the C++ skeleton. I tried to write files with debug messages in order to find out which functions are executed, but apart from GetType, GetName and so on, nothing was executed. So what has to be done to get, for example, the "GetURL" function rolling when the plugin is started? Are there any preconditions apart from the function being implemented in some way? The signature is:
PVDIMPORTPLUGIN_API int __stdcall GetURL(const bool isEpisode, const PCHAR CurrentURL, PCHAR NewURL);

3. Let's assume 1. is answered and an image is found. How can the image be assigned to the current movie (as a poster)? Is there a function or a datastructure which has to be used so that PVD gets the path from the plugin and completes the assignment?

4. How, in general, can movie-field-values be accessed or changed respectively, within the C++ framework?

That's enough for now, I guess. Hope somebody can help with this.

Best regards,
Einar

Offline rick.ca

  • Global Moderator
  • *****
  • Posts: 3241
  • "I'm willing to shoot you!"
    • View Profile
Re: Plugin dev. with C++ - Poster in movie folder - Questions
« Reply #1 on: April 10, 2011, 05:56:52 pm »
Welcome, Einar.

I believe nostra is the only one who could help you with questions about writing a plugin.

There's already a utility for importing posters: IMGByID. Search the forum for "IMGByID" and you'll find a number of posts describing how it can be used for this sort of task.

Offline Einar

  • Member
  • *
  • Posts: 9
    • View Profile
Re: Plugin dev. with C++ - Poster in movie folder - Questions
« Reply #2 on: April 11, 2011, 10:45:51 am »
Hello rick.ca.

Thank you for the hint! I will try the utility you mentioned.

Nevertheless, I'm looking forward to answers to the questions, for they would help for further plugin development.

Thanks again!

Einar

Offline Einar

  • Member
  • *
  • Posts: 9
    • View Profile
Re: Plugin dev. with C++ - Poster in movie folder - Questions
« Reply #3 on: April 11, 2011, 07:09:50 pm »
Hello again.

I think  IMGById is a nice utility, but using it for importing images which are situated in the same folder as the movie files, but not necessarily have the same filename or follow an explicit naming scheme is quite a fuss. I see that it is possible, but actually I don't intend to rename the files and doing all that export/import work every time I add some movies to the db. In my humble opinion the effort seems a little disproportionate for such a basic task.
So I'd like to stick with the project of developing a plugin that automatically assigns the poster found next to a movie-file while importing movies. I use the file scanner rather than add something manually and it would be the fastest and easiest way of adding the images for the initial import as well as later additions. That said, I guess i have to wait for master nostra before I can start developing ;) With answers to the questions stated above, the intended plugin shouldn't be too much trouble to write.

By the way, as mentioned before, I wrote a script that automatically adds one poster which is within the same folder as the movie file and has the same filename as the movie file. I posted it, in case someone likes to use it:
http://www.videodb.info/forum_en/index.php/topic,2336.0.html

Greetings,
Einar

Offline federer

  • Member
  • *
  • Posts: 15
    • View Profile
Re: Plugin dev. with C++ - Poster in movie folder - Questions
« Reply #4 on: May 14, 2011, 06:55:42 am »
in general, can movie-field-values be accessed or changed respectively, within the C++ framework..Yup its working i have experienced with this one.

Offline Einar

  • Member
  • *
  • Posts: 9
    • View Profile
Re: Plugin dev. with C++ - Poster in movie folder - Questions
« Reply #5 on: July 05, 2011, 03:17:48 am »
Hi federer.

Could you tell me how? Or perhaps send me your sourcecode as an example?
Do you know how to get the current movie path? I still can't work out how to get the current movie path within the C++ framework...

Thanks.
Einar

Offline Einar

  • Member
  • *
  • Posts: 9
    • View Profile
Re: Plugin dev. with C++ - Poster in movie folder - Questions
« Reply #6 on: July 17, 2011, 03:38:07 pm »
Hello.
So there does not seem to be answers, or my questions are just expressed badly.
Thus I'm going to try it with another question:

How can I get a message to be printed into the debug-log? For Scripts there is a function "LogMessage", is there anything equivalent for the C++ Framework?

Is there anything wrong with the following signature for the GetURL method that might prevent execution of the method?
PVDIMPORTPLUGIN_API int __stdcall GetURL(const bool isEpisode, const char* CurrentURL, char* NewURL)

Best regards,
Einar
« Last Edit: July 17, 2011, 04:03:26 pm by Einar »

 

anything