It is currently 22 May 2025, 16:09
   
Text Size

myk's code contributions

Post MTG Forge Related Programming Questions Here

Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins

Re: myk's code contributions

Postby Max mtg » 17 Mar 2013, 08:31

How do I instruct Forge to use card pictures from D:\Projects\mtg\img-full\ ?

... except than by creating a symlink from C:\Users\Max\AppData\Local\Forge\Cache\pics\cards ?
Single class for single responsibility.
Max mtg
Programmer
 
Posts: 1997
Joined: 02 Jul 2011, 14:26
Has thanked: 173 times
Been thanked: 334 times

Re: myk's code contributions

Postby Max mtg » 17 Mar 2013, 08:49

Why are you using 2-letter codes? (@ CardPrinted.getImageLocator(String, int, boolean, boolean) )
This made my CCGHQ donwloaded pictures unusable.
Single class for single responsibility.
Max mtg
Programmer
 
Posts: 1997
Joined: 02 Jul 2011, 14:26
Has thanked: 173 times
Been thanked: 334 times

Re: myk's code contributions

Postby myk » 17 Mar 2013, 08:53

Max mtg wrote:How do I instruct Forge to use card pictures from D:\Projects\mtg\img-full\ ?
To use non-default directories, see the forge.profile.preferences.example file in the program root dir.

Max mtg wrote:Why are you using 2-letter codes? (@ CardPrinted.getImageLocator(String, int, boolean, boolean) )
This made my CCGHQ donwloaded pictures unusable.
It was my understanding that the HQ pics (and Magic Workstation) use the 2-letter code directories! It was that way in all the torrent files I examined, and I was endeavoring to make those files usable without any manual renaming. Did I have incorrect info?

edit: by the way, the migration dialog/import data dialog will import pics no matter how the directories are named. just point the import data dialog to the directory of pics. You can also import all the data/pics from another forge directory by pointing the import data dialog to that directory.
myk
 
Posts: 439
Joined: 17 Jan 2013, 02:39
Location: California
Has thanked: 38 times
Been thanked: 57 times

Re: myk's code contributions

Postby Max mtg » 17 Mar 2013, 09:26

Thanks for that properties file.
Though Forge uses a system class Properties to parse the file, the stupid parser made me escape backslashes in path!
Code: Select all
cardPicsDir=D:\\Projects\\mtg\\img-full
This one ^^^ works!
Had I used single backslashes, it would just create a folder Projectsmtgimg-full in forge dir and catch no pictures

That's bad =(
MWS really uses 2-letter codes folder names. My collection has 3-letter codes... I even remember renaming them to work properly in Forge.
Will you allow me to add an option to properties file, specifying which set abbreviations to use?
Single class for single responsibility.
Max mtg
Programmer
 
Posts: 1997
Joined: 02 Jul 2011, 14:26
Has thanked: 173 times
Been thanked: 334 times

Re: myk's code contributions

Postby myk » 17 Mar 2013, 09:40

I totally understand about the properties file parser. We don't really have any control over how Java properties files are read -- they're hard-coded to be in ISO-8859-1 encoding by the Java VM and backslashes are interpreted before Forge gets to the data. There is a reason that forward slashes are used in all the examples in that file -- forward slashes work on all platforms and don't require escaping. I'll add a note in the file to make others aware of that issue.

As for your pic collection -- while it would be technically possible to have forge search for 3-letter code directory names, is it really required? Wouldn't it be easier to just let the importer rename them? If you've set your cardPicsDir to that directory, you can actually have the importer rename the files for you in-place just by "importing" that directory in the Import Data dialog.
myk
 
Posts: 439
Joined: 17 Jan 2013, 02:39
Location: California
Has thanked: 38 times
Been thanked: 57 times

Re: myk's code contributions

Postby Max mtg » 17 Mar 2013, 10:20

Windows uses backslashes nativelly, so players copying the path right from Explorer will have to add extra slashes or change all the slashes. That is to be explained to users. Hope, there are few users who have a separate collection.

There is a possible workaround - use forge.util.FileSection.parse(Iterable<String>, String) to parse the properties file. It will treat lines literally. The only improvement to be made about that method is support of comments.


Picture collection... I don't want the collection automatically renamed or anything like that. There was a request for custom paths to picture collection viewtopic.php?f=26&t=9467, and I was one of those who refused to intergate it. Now looks like we I got in a situation of the one who needs customizable paths to sets.
So, I'll tell you what this will look like. Another option in preferences file, which would hold a map serialized in a single line. That map will be keyed by set code and it's value is the subfolder of cardPicsDir for that certain set.
Single class for single responsibility.
Max mtg
Programmer
 
Posts: 1997
Joined: 02 Jul 2011, 14:26
Has thanked: 173 times
Been thanked: 334 times

Re: myk's code contributions

Postby myk » 17 Mar 2013, 10:28

Fair enough. I can get that added in.
myk
 
Posts: 439
Joined: 17 Jan 2013, 02:39
Location: California
Has thanked: 38 times
Been thanked: 57 times

Re: myk's code contributions

Postby Max mtg » 17 Mar 2013, 10:53

wait, I'll add whatever is related to picture collection myself
I have already moved all that image-related code out of CardPrinted class - will test and commit
Single class for single responsibility.
Max mtg
Programmer
 
Posts: 1997
Joined: 02 Jul 2011, 14:26
Has thanked: 173 times
Been thanked: 334 times

Re: myk's code contributions

Postby Max mtg » 17 Mar 2013, 11:35

How can I test the commited changes?
Besides everything related to ingame card display works, there is migration routine - could not test it.
Single class for single responsibility.
Max mtg
Programmer
 
Posts: 1997
Joined: 02 Jul 2011, 14:26
Has thanked: 173 times
Been thanked: 334 times

Re: myk's code contributions

Postby Sloth » 17 Mar 2013, 11:36

I've migrated my data and had no problems. Thanks a lot for completing this monstrous task, myk!

=D> =D> =D>
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: myk's code contributions

Postby Max mtg » 17 Mar 2013, 12:40

I've commited r20418 that adds an option to use custom names for folders containing picture of each set.

the option name is cardPicsSubDirs, it stores a map of 3-letter wizards code to your folder name.

Example:
Code: Select all
cardPicsSubDirs=LEA->LEA|LEB->LEB|2ED->2ED
That will make Forge use folders LEA instead of A, LEB instead of B, 2ED instead of default folder U assigned for Unlimited.

Please don't forget to point me at any faults in migration, if my latest changes broke the picture migration process.
Single class for single responsibility.
Max mtg
Programmer
 
Posts: 1997
Joined: 02 Jul 2011, 14:26
Has thanked: 173 times
Been thanked: 334 times

Re: myk's code contributions

Postby Chris H. » 17 Mar 2013, 12:54

I seem to not have had any problems that were unresolvable while updating. From my terminal I CD'ed to my project folder and then did a "svn up". From there I had to revert a conflict in Eclipse and refresh and that did the trick.

I will now attempt a snapshot build and deploy to cardforge.


Oh, I do try to keep my project clean and do not have any decks, pics quest data, etc so it was probably easier on my part.
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Re: myk's code contributions

Postby Chris H. » 17 Mar 2013, 14:41

Ran a few more tests using today's snapshot build. I imported the data from yesterday's snapshot into today's snapshot build. Today's snapshot build wants to download over 300 new card pictures so I let it and these are the file names for these new cards:

list | Open
Abbey Matron1.full.jpg
Abbey Matron2.full.jpg
Aesthir Glider1.full.jpg
Aesthir Glider2.full.jpg
Agent of Stromgald1.full.jpg
Agent of Stromgald2.full.jpg
Aliban's Tower1.full.jpg
Aliban's Tower2.full.jpg
Ambush Party2.full.jpg
Anaba Bodyguard2.full.jpg
Anaba Shaman2.full.jpg
Anaconda2.full.jpg
Arcane Denial1.full.jpg
Arcane Denial2.full.jpg
Armor Thrull1.full.jpg
Armor Thrull2.full.jpg
Armor Thrull3.full.jpg
Armor Thrull4.full.jpg
Army of Allah1.full.jpg
Army of Allah2.full.jpg
Astrolabe1.full.jpg
Astrolabe2.full.jpg
Aysen Bureaucrats2.full.jpg
Balduvian War-Makers1.full.jpg
Balduvian War-Makers2.full.jpg
Basal Thrull1.full.jpg
Basal Thrull2.full.jpg
Basal Thrull3.full.jpg
Basal Thrull4.full.jpg
Bestial Fury1.full.jpg
Bestial Fury2.full.jpg
Bird Maiden2.full.jpg
Birds of Paradise Avatar1.full.jpg
Birds of Paradise Avatar2.full.jpg
Blaze2.full.jpg
Brassclaw Orcs2.full.jpg
Brassclaw Orcs3.full.jpg
Brassclaw Orcs4.full.jpg
Carapace2.full.jpg
Carrier Pigeons1.full.jpg
Carrier Pigeons2.full.jpg
Casting of Bones1.full.jpg
Casting of Bones2.full.jpg
Cemetery Gate1.full.jpg
Cemetery Gate2.full.jpg
Combat Medic1.full.jpg
Combat Medic2.full.jpg
Combat Medic3.full.jpg
Combat Medic4.full.jpg
Dark Maze2.full.jpg
Deadly Insect2.full.jpg
Dry Spell2.full.jpg
Dwarven Soldier2.full.jpg
Dwarven Soldier3.full.jpg
Dwarven Trader1.full.jpg
Dwarven Trader2.full.jpg
Elite Cat Warrior1.full.jpg
Elite Cat Warrior2.full.jpg
Elven Fortress1.full.jpg
Elven Fortress2.full.jpg
Elven Fortress3.full.jpg
Elven Fortress4.full.jpg
Elvish Hunter1.full.jpg
Elvish Hunter2.full.jpg
Elvish Hunter3.full.jpg
Elvish Ranger2.full.jpg
Elvish Scout1.full.jpg
Elvish Scout2.full.jpg
Elvish Scout3.full.jpg
Enslaved Scout1.full.jpg
Enslaved Scout2.full.jpg
Erg Raiders2.full.jpg
Erhnam Djinn Avatar1.full.jpg
Erhnam Djinn Avatar2.full.jpg
Ertai, the Corrupted1.full.jpg
Ertai, the Corrupted2.full.jpg
False Demise2.full.jpg
Farrel's Zealot1.full.jpg
Farrel's Zealot2.full.jpg
Farrel's Zealot3.full.jpg
Feast of the Unicorn2.full.jpg
Feast or Famine1.full.jpg
Feast or Famine2.full.jpg
Fevered Strength1.full.jpg
Fevered Strength2.full.jpg
Fishliver Oil2.full.jpg
Folk of An-Havva1.full.jpg
Folk of An-Havva2.full.jpg
Foresight1.full.jpg
Foresight2.full.jpg
Forest1.full.jpg
Forest5.full.jpg
Forest6.full.jpg
Forest7.full.jpg
Forest8.full.jpg
Fyndhorn Druid1.full.jpg
Fyndhorn Druid2.full.jpg
Giant Tortoise2.full.jpg
Gift of the Woods1.full.jpg
Gift of the Woods2.full.jpg
Goblin Chirurgeon1.full.jpg
Goblin Chirurgeon2.full.jpg
Goblin Chirurgeon3.full.jpg
Goblin Grenade2.full.jpg
Goblin Grenade3.full.jpg
Goblin War Drums2.full.jpg
Goblin War Drums3.full.jpg
Goblin War Drums4.full.jpg
Goblin Warchief Avatar1.full.jpg
Goblin Warchief Avatar2.full.jpg
Gorilla Chieftain2.full.jpg
Gorilla Shaman1.full.jpg
Gorilla Shaman2.full.jpg
Gorilla War Cry1.full.jpg
Gorilla War Cry2.full.jpg
Grinning Demon Avatar1.full.jpg
Grinning Demon Avatar2.full.jpg
Guerrilla Tactics2.full.jpg
Hand of Death2.full.jpg
Hasran Ogress2.full.jpg
High Tide1.full.jpg
High Tide2.full.jpg
High Tide3.full.jpg
Homarid Warrior2.full.jpg
Homarid Warrior3.full.jpg
Homarid1.full.jpg
Homarid2.full.jpg
Homarid3.full.jpg
Homarid4.full.jpg
Hungry Mist2.full.jpg
Hymn to Tourach1.full.jpg
Hymn to Tourach2.full.jpg
Hymn to Tourach3.full.jpg
Hymn to Tourach4.full.jpg
Icatian Javelineers2.full.jpg
Icatian Javelineers3.full.jpg
Icatian Moneychanger1.full.jpg
Icatian Moneychanger2.full.jpg
Icatian Moneychanger3.full.jpg
Icatian Scout2.full.jpg
Icatian Scout3.full.jpg
Icatian Scout4.full.jpg
Initiates of the Ebon Hand2.full.jpg
Initiates of the Ebon Hand3.full.jpg
Insidious Bookworms1.full.jpg
Insidious Bookworms2.full.jpg
Island1.full.jpg
Island5.full.jpg
Island6.full.jpg
Island7.full.jpg
Island8.full.jpg
Kjeldoran Pride1.full.jpg
Kjeldoran Pride2.full.jpg
Labyrinth Minotaur2.full.jpg
Lat-Nam's Legacy1.full.jpg
Lat-Nam's Legacy2.full.jpg
Lim-Dul's High Guard1.full.jpg
Lim-Dul's High Guard2.full.jpg
Memory Lapse2.full.jpg
Mesa Falcon2.full.jpg
Mindstab Thrull2.full.jpg
Mindstab Thrull3.full.jpg
Mishra's Factory2.full.jpg
Mishra's Factory3.full.jpg
Mishra's Factory4.full.jpg
Monstrous Growth2.full.jpg
Moorish Cavalry2.full.jpg
Mountain5.full.jpg
Mountain6.full.jpg
Mountain7.full.jpg
Mountain8.full.jpg
Mountain9.full.jpg
Nafs Asp2.full.jpg
Necrite2.full.jpg
Necrite3.full.jpg
Night Soil1.full.jpg
Night Soil2.full.jpg
Night Soil3.full.jpg
Noble Steeds1.full.jpg
Noble Steeds2.full.jpg
null.jpg
Orcish Spy2.full.jpg
Orcish Spy3.full.jpg
Orcish Veteran1.full.jpg
Orcish Veteran2.full.jpg
Orcish Veteran3.full.jpg
Orcish Veteran4.full.jpg
Order of Leitbur1.full.jpg
Order of Leitbur2.full.jpg
Order of Leitbur3.full.jpg
Order of the Ebon Hand1.full.jpg
Order of the Ebon Hand2.full.jpg
Order of the Ebon Hand3.full.jpg
Oubliette1.full.jpg
Oubliette2.full.jpg
Phantasmal Fiend1.full.jpg
Phantasmal Fiend2.full.jpg
Phyrexian Boon1.full.jpg
Phyrexian Boon2.full.jpg
Phyrexian War Beast1.full.jpg
Phyrexian War Beast2.full.jpg
Piety2.full.jpg
Plains1.full.jpg
Plains5.full.jpg
Plains6.full.jpg
Plains7.full.jpg
Plains8.full.jpg
Platinum Angel Avatar1.full.jpg
Platinum Angel Avatar2.full.jpg
Prodigal Sorcerer Avatar1.full.jpg
Prodigal Sorcerer Avatar2.full.jpg
Raging Goblin2.full.jpg
Reef Pirates2.full.jpg
Reinforcements1.full.jpg
Reinforcements2.full.jpg
Reprisal2.full.jpg
Rith, the Awakener Avatar1.full.jpg
Rith, the Awakener Avatar2.full.jpg
Royal Assassin Avatar1.full.jpg
Royal Assassin Avatar2.full.jpg
Royal Herbalist1.full.jpg
Royal Herbalist2.full.jpg
Rukh Egg2.full.jpg
Samite Alchemist1.full.jpg
Samite Alchemist2.full.jpg
Sengir Bats1.full.jpg
Sengir Bats2.full.jpg
Serra Angel Avatar1.full.jpg
Serra Angel Avatar2.full.jpg
Shrink2.full.jpg
Skyship Weatherlight1.full.jpg
Skyship Weatherlight2.full.jpg
Soldevi Adnate1.full.jpg
Soldevi Adnate2.full.jpg
Soldevi Heretic1.full.jpg
Soldevi Heretic2.full.jpg
Soldevi Sage2.full.jpg
Soldevi Steam Beast1.full.jpg
Soldevi Steam Beast2.full.jpg
Spore Cloud1.full.jpg
Spore Cloud2.full.jpg
Spore Cloud3.full.jpg
Stench of Decay1.full.jpg
Stench of Decay2.full.jpg
Stone-Throwing Devils1.full.jpg
Stone-Throwing Devils2.full.jpg
Storm Crow2.full.jpg
Storm Shaman2.full.jpg
Strip Mine2.full.jpg
Strip Mine3.full.jpg
Strip Mine4.full.jpg
Swamp Mosquito2.full.jpg
Swamp1.full.jpg
Swamp5.full.jpg
Swamp6.full.jpg
Swamp7.full.jpg
Swamp8.full.jpg
Tahngarth, Talruum Hero1.full.jpg
Tahngarth, Talruum Hero2.full.jpg
Thallid2.full.jpg
Thallid3.full.jpg
Thallid4.full.jpg
Thorn Thallid1.full.jpg
Thorn Thallid2.full.jpg
Thorn Thallid3.full.jpg
Thorn Thallid4.full.jpg
Torture2.full.jpg
Trade Caravan1.full.jpg
Trade Caravan2.full.jpg
Tradewind Rider Avatar1.full.jpg
Tradewind Rider Avatar2.full.jpg
Undergrowth1.full.jpg
Undergrowth2.full.jpg
Urza's Mine2.full.jpg
Urza's Mine3.full.jpg
Urza's Mine4.full.jpg
Urza's Power Plant2.full.jpg
Urza's Power Plant3.full.jpg
Urza's Power Plant4.full.jpg
Urza's Tower2.full.jpg
Urza's Tower3.full.jpg
Urza's Tower4.full.jpg
Varchild's Crusader1.full.jpg
Varchild's Crusader2.full.jpg
Veteran's Voice1.full.jpg
Veteran's Voice2.full.jpg
Viscerid Armor1.full.jpg
Viscerid Armor2.full.jpg
Vodalian Mage1.full.jpg
Vodalian Mage2.full.jpg
Vodalian Mage3.full.jpg
Vodalian Soldiers2.full.jpg
Vodalian Soldiers3.full.jpg
Vodalian Soldiers4.full.jpg
Warrior's Charge1.full.jpg
Warrior's Charge2.full.jpg
Whip Vine1.full.jpg
Whip Vine2.full.jpg
Wild Aesthir1.full.jpg
Wild Aesthir2.full.jpg
Willow Faerie1.full.jpg
Willow Faerie2.full.jpg
Wyluli Wolf2.full.jpg
Yavimaya Ancients1.full.jpg
Yavimaya Ancients2.full.jpg

 
Ran a quick test on a few of these cards and it appears that the pic file minus the number at the end is in the older snapshot but it was not transferred.

The abbey_matron.jpg file is not imported and we end up with these cards being downloaded: Abbey Matron1.full.jpg and Abbey Matron2.full.jpg
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Re: myk's code contributions

Postby Max mtg » 17 Mar 2013, 16:04

That's a bit wrong - I'll do something about it.
Single class for single responsibility.
Max mtg
Programmer
 
Posts: 1997
Joined: 02 Jul 2011, 14:26
Has thanked: 173 times
Been thanked: 334 times

Re: myk's code contributions

Postby goonjamin » 17 Mar 2013, 17:43

r20422

Data migration was easy and fast and proceeded without errors on my windows 7 machine.

Everything seems to be working fine but I am not seeing a card picture for my ape pet (currently a level 2 ape) when I play quest matches? I see the image in the token folder in the new location but it is not showing up in game, is there something I need to do?
goonjamin
 
Posts: 133
Joined: 19 Aug 2010, 19:51
Has thanked: 39 times
Been thanked: 5 times

PreviousNext

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 20 guests


Who is online

In total there are 20 users online :: 0 registered, 0 hidden and 20 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 20 guests

Login Form