Custom Plugins

Additional plug-ins for the program.
User avatar
Vlad
Developer
Posts: 2941
Joined: Wed Jan 23, 2008 11:37 am

Custom Plugins

Post by Vlad » Wed Jun 23, 2010 10:09 am

Movienizer up to the 3.2 version supports only plugins for importing data from other movie catalog programs. We have decided to make the plugin system more useful, and here is a beta-version of the API.

Here you can download a demo program that lists all available plugins and allows launching them. Also there is an example of a simple plugin that uses several functions from UserFunctions.dll. Plugin is written in Delphi 7 and shouldn't require any additional components.

UserFunctions.dll is a special library that makes usual tasks easier. For example, it contains functions to work with Movienizer's database, with Windows Registry, to download URL, to display lines from language files etc. But, of course, you don't have to use it if you are a Delphi specialist.

Currently there are no descriptions, the best way to learn is to study the demo plugin.
ImageImage

User avatar
Vlad
Developer
Posts: 2941
Joined: Wed Jan 23, 2008 11:37 am

Re: Custom Plugins

Post by Vlad » Wed Jun 23, 2010 10:12 am

In order to debug your dll, you should set up the Run Parameters menu (Run -> Parameters):
Image
and the folder where your dll is to be stored (Project -> Options, the Directory/Conditionals tab):
Image
ImageImage

User avatar
JeF
Black Belt Squirrel
Posts: 1173
Joined: Fri Feb 20, 2009 3:34 pm
Location: France

Re: Custom Plugins

Post by JeF » Wed Jun 23, 2010 11:33 am

Thanks for the feature!
Will give it a try asap :)
JeF

User avatar
Vlad
Developer
Posts: 2941
Joined: Wed Jan 23, 2008 11:37 am

Re: Custom Plugins

Post by Vlad » Fri Jun 25, 2010 8:50 am

functions of the UserFunctions.dll library

function Version(): Double; This function returns the current version of the library. Used only for compatibility checks.

function SetDataBaseName(AName: string): Boolean; Sets the active database to work with. All database functions called later will work with the active database. If the function fails to set the database, it returns False.

function ExecuteSQL(ASQL: string): Integer; Executes the SQL query provided in the ASQL parameter. Returns the number of records returned by the query. Before using this function, it is necessary to set an active database with the SetDatabaseName function.

function GetNextRecord(): Boolean; The routine moves the database index to the next record. If there is no next record, returns False.

function GetFirstRecord(): Boolean; The routine moves the database index to the first record. If number of records is 0, returns False.

function GetRecordsCount(): Integer; Gets the full number of records returned by the ExecuteSQL function.

function GetStringField(AName: string): string; Returns the field's value as a string for the current record.

function GetIntegerField(AName: string): Integer; Returns the field's value as an integer for the current record.

function GetFloatField (AName: string): Integer; Returns the field's value as a float for the current record.

function RegReadInteger(Akey: string; AdefaultValue: Integer = 0): Integer; The routine reads the registry key AKey as integer. If there is no such key, returns the default value (ADefaultValue).

function RegReadString(AKey: string; ADefaultValue: string = ''): string; The routine reads the registry key AKey as string. If the key is not found, returns the default value (ADefaultValue).

function RegWriteInteger(AKey: string; AValue: Integer): Boolean; The function saves the AValue value in the registry key AKey (for integer keys).

function RegWriteString (AKey: string; AValue: string): Boolean; The function saves the AValue value in the registry key AKey (for string keys)

function DownloadURL(AURL: string): string; The function downloads the AURL link from the Internet and returns the result as a string (using the Get method).

function DownloadURLToMemory(AURL: string): TMemoryStream; The function downloads the AURL link from the Internet and returns the result as an object of the TMemoryStream type (using the Get method).

function DownloadURLWithReferer(AURL: string; ARefer: string): string; The function downloads the AURL link from the Internet and returns the result as a string, using the ARefer parameter.

function GetLangStr(ANumber: Integer): string; The function reads the line with the ANumber index from the language file. The language file is read from the registry. If there is no line with the given index, returns an empty string.
ImageImage

User avatar
Vlad
Developer
Posts: 2941
Joined: Wed Jan 23, 2008 11:37 am

Re: Custom Plugins

Post by Vlad » Fri Jun 25, 2010 5:28 pm

Developing custom plugins for Movienizer is pretty easy (provided that you are acquainted with Delphi). You can develop an application that works with Movienizer's database (using or not using functions from the UserFunctions.dll). Then create a library with the code similar to this:

Code: Select all

library PluginExample;

uses
  Forms,
  SysUtils,
  Classes,
  unPluginExample in 'unPluginExample.pas' {fmPluginExample},
  unUserFunctions in 'unUserFunctions.pas';

{$R *.res}

function VersionId(): Double; stdcall;
begin
  Result := 1;
end;

function Author(): PChar; stdcall;
begin
  Result := 'Fade';
end;

function Description(): PChar; stdcall;
begin
  Result := 'Sample plugin for show mechanizm abilities';
end;

function Name(): PChar; stdcall;
begin
  Result := 'Plugin example';
end;

function Execute(): Boolean; stdcall;
begin
  Result := True;
  try
    fmPluginExample := TfmPluginExample.Create(Application);
    try
      fmPluginExample.ShowModal();
    finally
      fmPluginExample.Free();
    end;
  except
    Result := False;
  end;
end;

function GetLastError(): PChar; stdcall;
begin
  Result := 'Last Error';
end;

exports
  Name,
  Author,  
  Execute,
  VersionId,
  Description,
  GetLastError;

begin

end.
As you can see, the function
function Execute(): Boolean; stdcall;
creates an instance of our custom application and runs it.
ImageImage

User avatar
JeF
Black Belt Squirrel
Posts: 1173
Joined: Fri Feb 20, 2009 3:34 pm
Location: France

Re: Custom Plugins

Post by JeF » Tue Jun 29, 2010 8:36 pm

Ok, got it work. Starting my first plugin... :)
JeF

User avatar
Vlad
Developer
Posts: 2941
Joined: Wed Jan 23, 2008 11:37 am

Re: Custom Plugins

Post by Vlad » Mon Sep 06, 2010 11:57 am

New UserFunctions.dll is attached. Should download through a proxy server, too.
Attachments
UserFunctions.zip
(282.47 KiB) Downloaded 908 times
ImageImage

estate
Star
Posts: 465
Joined: Sat Sep 05, 2009 6:06 pm
Location: Meppel, The Netherlands

Re: Custom Plugins

Post by estate » Tue Sep 07, 2010 10:53 am

when I put this in the plugin map movienizer gives an error at loading stating that it can not get data through proxy.

when I have started MN and want to use the plugins (menubar plugins) movinizer hangs and is closed by windows 7

User avatar
Vlad
Developer
Posts: 2941
Joined: Wed Jan 23, 2008 11:37 am

Re: Custom Plugins

Post by Vlad » Sun Sep 26, 2010 6:09 pm

The latest version of unUserFunctions.pas attached.
Attachments
unUserFunctions.zip
(1.72 KiB) Downloaded 838 times
ImageImage

estate
Star
Posts: 465
Joined: Sat Sep 05, 2009 6:06 pm
Location: Meppel, The Netherlands

Re: Custom Plugins

Post by estate » Mon Dec 05, 2011 1:04 pm

Hi y'all :)

This one is for Jeff I guess :)

Moved MN to a new pc and placed all files outside the program files map so now all paths of my dB are changed.

The database was in; R:program files\movienizer\jsnijder.dmo
My movie trailers were in; R:\movie trailers\.....

My new setup is:
H:\MovieNizerDataBase\jsnijder.dmo
H:\MovieTrailers\....

Is it possible to write a personal script for me so I can run it on MN to use this please?


Thank in advance.

and now.... off to translating the rest of your stuff :)

Post Reply