Page 1 of 1

[Patch] User Defined Fields

Posted: 2004-07-27 19:25:23
by TekmanRO
Hi,
I was in need of an option to add User Defined Fields to the catalog, so I decided to do it myself.
I thought that maybe some of you guys might find it an interesting feature to have, so I decided to put it up for download. Here it is: Patch.zip.
You need to apply it to the source code and re-compile.

I added scripting support through 2 new functions that you can call from your script:

Code: Select all

SetUDField(name: string; value: string);
GetUDField(name: string): string;
They're pretty self-explanatory, I think :)

I also added support for export. You add in the export template something like this:

Code: Select all

$$ITEM_USERDEFINEDFIELD(My Field)
Where, of course, you replace My Field to whichever name you gave to your field. Note that there is no error-checking right now, so you need to have this exact syntax - no space between the paranthesis "(" and the field name or the tag name.

I also added a "rudimentary" :D GUI for manually adding and modifying user defined fields (UDFs). You can find a button on the main frame, that leads you to a poorly-designed dialog for this purpose. It doesn't have language support (only english for now :/).

You can define specific fields for specific movies (no restrictions there). However, the true power (and usability) of this option comes into hand when you define the same UDF for every movie in the catalog (such as importing more stuff from an online provider into your defined fields). In this way, you could make exports, and all kind of stuff with your fields. There is no limit to the number of UDF you can define for movies ( maybe 65.536, but you won't get there :hihi:).

You don't need to manually add the UDF to each movie from the GUI. You simply modify your script, and if the script wishes to set the value for a UDF that is not defined yet, it automatically creates it for that movie. Oh, and remember to back-up you catalogs before using this feature. I didn't have problems with it, bu who knows? :P

Please note that these fields work only for XML catalogs. If you save your catalog in AMC format, you lose all defined UDFs. An EXE compiled with this code should have no problem loading catalogs w/o UDFs, and also, a normal build should have no problems loading a catalog that has UDFs (just that it won't know how to read them).

Ok, I already made this text too long. If you guys will find this an interesting option, I will surely invest more of my time to making it clean and more appealing. I won't however be able to (easily) add support for the standard .AMC file format, because it's a fixed-length-record file, binary, so not much I can do about that.

Anyway, enjoy. If antp finds this interesting, I have no problem with him making a build (EXE), or integrating with his sources for you guys to look at it. I would make it myself, but my files are way too stripped, you wouldn't like what I made of it :p (no reporting, no printing, etc), and plus, I don't know the legal consequences of me distributing a compiled .EXE of the application.

Posted: 2004-07-27 22:18:38
by antp
No problem of redistributing the .exe as long as you also distribute the source, and that you do not change the license (GPL).
About the binary format, I do not know yet what it will become, but in the future I will probably use only XML (with the possibility of storing but the XML and the pictures in a kind of big binary file, for those that prefer to have only one file).

In the changes you made, there is nothing displayed in the user interface ?
That's actually the reason why I was not sure to add user-defined fields : too much work to allow people to design the interface for user-defined fields, problems for translations, etc. :D

I do not know how it will evolve in the future, but there are lots of things that I have to do before serious changes like this one, I think.

Posted: 2004-07-28 06:28:11
by TekmanRO
Well, ok, then. Here is the EXE : MovieCatalog.zip, and here is the source code (replace current files in your source if you want to compile): Patch.zip.

Yes, there are minor user interface changes. Like this:

Image
Notice that small "User Defined..." button right under the Description label :lol:

Image
This is what opens up when you click on it :hihi:

Image
And here you can choose wether or not to save the UDFs retrieved by the script (if there are any).

These are the only user interface changes for now. Of course, the functionality should be all there. I think I must add something for import (to allow importing into UDFs), and maybe in a couple of other places. :)

Posted: 2004-08-24 22:05:30
by Mystiqq
Holy cow! This is what ive been waiting for a long time. Thanks a lot and i really hope you continue with this feature!

Cheers.

Posted: 2004-09-01 10:52:41
by Junior76
Hello Everybody, Hello Antp,

I think taht is a very good thing to open a Project to SourceForge to example.

Many people is ready to add lot of feature at AMC but, if you don't regulate this, the power wil be lose.

En gros car mon anglais est minable : beaucoup de personnes sont prêtes à t'aider dans l'évolution de AMC (dont moi dans la mesure de mes compétences), mais si tu ne fédère pas un peu cette mouvance, il va y avoir beaucoup d'énergie dissipé dans des projets annexes et différents.

Amicalement

Junior76

in Tabs?

Posted: 2004-09-02 16:25:41
by Mystiqq
Would it be possible to make tabs? basicly to have own tab for user defined fields and then the original fields in own tab? I hope you understand what i mean.

Similar to how Extreme movie manager works...

Shame i dont know much about coding, id try to make it myself. :/

Posted: 2004-11-06 19:40:43
by barfly
The compiled exe link seems to be broken. Can you fix it TekmanRO. (Or compile a new one if it was based on an older version of amc.)
I was looking for this for ages. Thanks a lot!