LordHelmchen's price import - BFZ and mkm
Posted: 21 Sep 2012, 11:04
UPDATED 2013-04-10 (April 10th)
Until further notice I will cease rewriting this post over and over again. The information and files below are probably out-of-date. Please go to the LHpi's Wiki page for all documentation and download links.
ADDITIONAL NOTE 2014-02-11 (Feb 2nd)
The above note doesn't mean you should not post questions or praise in the thread, so please go ahead
Special thanks to randerscheinung, as him clicking "thanks" on each new release post was practically all feedback I received on my scripts for the last year
ADDITIONAL NOTE 2104-05-05 (May 5th)
Because there have been almost as much downloads of old versions in the last three months than there have been of the current versions, let me state this again:The information and files in in all but the most recent posts of this thread are probably out-of-date. Please go to the LHpi's Wiki page for all documentation and download links.The version numbers in the changelog are also download links that will get you the corresponding (old!) file.
Do post questions, bugs, improvement ideas, praise or other feedback in this thread.Or open/use the wiki's discussion page, if that seems more appropriate.
----
Post updated Feb.7th. The old text has been archived to the second post.
Greetings.
This is the release and discussion thread for LHpi (LordHelmchen's price import), my pricing script library and its sitescripts.
Supports all core and expansion sets up to Gatecrash out-of-the-box. In theory, you should not be dependent on a new version once a new set is available: just add new entries to site.sets table in the sitescript.
I decided to start all versions at 2.0, since it's the continuation of magicuniverseDEv1.6.lua, but with enough changes to varant the next major version number. Do not expect revision numbers to stay synched. The sitescripts will know which library version they need and attempt to load the right one or exit gracefully.
To use it you need to have both the library LHpi-v2.0.lua (or a later version, as required by the sitescript) and a sitescript.
Currently offered sitescripts are:
Update probability is higher for LHpi.magicuniverseDE-v2.0.lua than for the others, both because that is the one I use and because the other scripts (so far) are much simpler to update yourself.
It is not expected to be fast, but as reliable as possible:
It first compares the user requested sets and languages with what the sitescript has available and builds a table of urls to querry, seperated by set.
Then it loops though the sets that are both available and selected:
The raw html data is fetched, parsed and entered into an intermediate table of all prices for the current edition, merging regular and foil prices to minimize calls to ma.SetPrice.
Should the same card (defined by set,card,language,(picture-)version ) be encountered again, it compared the prices. When they are equal, the new price is discarded. If they differ (Yes, magcuniverse.de's database is quirky), it uses the average price.
Cards that are suffxed with a condition description are currently disregarded.
Once that cardsetTable is completed (all urls belonging to the set are parsed), it sends the prices to MA.
All the while doing more sanity checks than could be considered sane
Logging to a seperate file is now enabbled per default (but still configurable by the variable SAVELOG in the script), since ma.PutFile(file,data,0) behaviour bug was fixed by our Hero. The log is overwritten on subsequent re-runs of the script.
If something does not happen as expected
- make sure the script is saved utf-8 encoded. It's customary for lua scripts to be saved ANSI encoded, but as MA expects utf input, this is what I considered the most wysiwyg approach to set cards with special characters in their names.
- open the lua file in a text editor and change "VERBOSE = false" to "VERBOSE = true". This will make the script provide feedback to help track down any problems (or just to see what it was doing) and also enable additional checks. The logging will be sent to "[MA Folder]\Prices\[scriptname].log".
I'll try to answer any questions you might have. If the script misbehaves please follow the two steps above and attach attach a copy of the .log.
Advice on and ideas for improving the script are most welcome. See also the second post for plans and problems.
To install, unzip both LHpi-v2.x and at least one sitescript into the "Prices" subdirectory of your MA installation and restart MA.
All files belonging to old versions can be deleted. If you want to use the SAVEHTML feature, you need to create an empty subdirectory, named like the sitescript without version suffix (for example "Prices\LHpi.magicuniverseDE").
Until further notice I will cease rewriting this post over and over again. The information and files below are probably out-of-date. Please go to the LHpi's Wiki page for all documentation and download links.
ADDITIONAL NOTE 2014-02-11 (Feb 2nd)
The above note doesn't mean you should not post questions or praise in the thread, so please go ahead
Special thanks to randerscheinung, as him clicking "thanks" on each new release post was practically all feedback I received on my scripts for the last year
ADDITIONAL NOTE 2104-05-05 (May 5th)
Because there have been almost as much downloads of old versions in the last three months than there have been of the current versions, let me state this again:The information and files in in all but the most recent posts of this thread are probably out-of-date. Please go to the LHpi's Wiki page for all documentation and download links.The version numbers in the changelog are also download links that will get you the corresponding (old!) file.
Do post questions, bugs, improvement ideas, praise or other feedback in this thread.Or open/use the wiki's discussion page, if that seems more appropriate.
----
Post updated Feb.7th. The old text has been archived to the second post.
Greetings.
This is the release and discussion thread for LHpi (LordHelmchen's price import), my pricing script library and its sitescripts.
Supports all core and expansion sets up to Gatecrash out-of-the-box. In theory, you should not be dependent on a new version once a new set is available: just add new entries to site.sets table in the sitescript.
I decided to start all versions at 2.0, since it's the continuation of magicuniverseDEv1.6.lua, but with enough changes to varant the next major version number. Do not expect revision numbers to stay synched. The sitescripts will know which library version they need and attempt to load the right one or exit gracefully.
To use it you need to have both the library LHpi-v2.0.lua (or a later version, as required by the sitescript) and a sitescript.
Currently offered sitescripts are:
- LHpi.magicuniverseDE-v2.0.lua | Open
- LHpi.mtgmintcard-v2.0.lua | Open
- LHpi.tcgplayerPriceGuide-v2.0.lua | Open
- LHpi.sitescriptTemplate-v2.0.lua | Open
Update probability is higher for LHpi.magicuniverseDE-v2.0.lua than for the others, both because that is the one I use and because the other scripts (so far) are much simpler to update yourself.
It is not expected to be fast, but as reliable as possible:
It first compares the user requested sets and languages with what the sitescript has available and builds a table of urls to querry, seperated by set.
Then it loops though the sets that are both available and selected:
The raw html data is fetched, parsed and entered into an intermediate table of all prices for the current edition, merging regular and foil prices to minimize calls to ma.SetPrice.
Should the same card (defined by set,card,language,(picture-)version ) be encountered again, it compared the prices. When they are equal, the new price is discarded. If they differ (Yes, magcuniverse.de's database is quirky), it uses the average price.
Cards that are suffxed with a condition description are currently disregarded.
Once that cardsetTable is completed (all urls belonging to the set are parsed), it sends the prices to MA.
All the while doing more sanity checks than could be considered sane
Logging to a seperate file is now enabbled per default (but still configurable by the variable SAVELOG in the script), since ma.PutFile(file,data,0) behaviour bug was fixed by our Hero. The log is overwritten on subsequent re-runs of the script.
If something does not happen as expected
- make sure the script is saved utf-8 encoded. It's customary for lua scripts to be saved ANSI encoded, but as MA expects utf input, this is what I considered the most wysiwyg approach to set cards with special characters in their names.
- open the lua file in a text editor and change "VERBOSE = false" to "VERBOSE = true". This will make the script provide feedback to help track down any problems (or just to see what it was doing) and also enable additional checks. The logging will be sent to "[MA Folder]\Prices\[scriptname].log".
I'll try to answer any questions you might have. If the script misbehaves please follow the two steps above and attach attach a copy of the .log.
Advice on and ideas for improving the script are most welcome. See also the second post for plans and problems.
- changelog | Open
To install, unzip both LHpi-v2.x and at least one sitescript into the "Prices" subdirectory of your MA installation and restart MA.
All files belonging to old versions can be deleted. If you want to use the SAVEHTML feature, you need to create an empty subdirectory, named like the sitescript without version suffix (for example "Prices\LHpi.magicuniverseDE").