It is currently 27 Apr 2024, 19:36
   
Text Size

Unified picture resource handling in MA and Forge

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

Unified picture resource handling in MA and Forge

Postby LordHelmchen » 21 Jan 2013, 10:51

Greetings!

As I'm using both Magic Album by Goblin Hero and Forge, I currently have two folders with card pictures, which strikes me as a waste of space (and on updates, bandwith). Thus I'd like to ask if the two projects could envision to collaborate on unifying their expected folder structure and enable to set one picture folder for both programms to read their images from.
Crossposting this to both Forge and MA subforums.

regards,
LordHelmchen
LordHelmchen
 
Posts: 125
Joined: 21 Aug 2012, 16:06
Has thanked: 21 times
Been thanked: 32 times

Re: Unified picture resource handling in MA and Forge

Postby Hellfish » 22 Jan 2013, 06:17

I havn't used Magic Album, how exactly does it expect it's image filenames?
So now you're
Screaming for the blood of the cookie monster
Evil puppet demon of obesity
Time to change the tune of his fearful ballad
C is for "Lettuce," that's good enough for me
User avatar
Hellfish
Programmer
 
Posts: 1297
Joined: 07 Jun 2009, 10:41
Location: South of the Pumphouse
Has thanked: 110 times
Been thanked: 169 times

Re: Unified picture resource handling in MA and Forge

Postby Max mtg » 22 Jan 2013, 12:08

I downloaded MA but could not figure out how to attach pictures to the program.
Forge supports images groupped per-set, ie root_image_folder/set_name/card_name.full.jpg - same syntax is supported by MWS.

I can't imagine what else needs improvement in current model.
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: Unified picture resource handling in MA and Forge

Postby LordHelmchen » 23 Jan 2013, 09:48

Greetings!

To get MA's pictures, there's a torrent at http://www.slightlymagic.net/tracker.

Starting from the configurable picture root, MA uses for example
Pictures/set_type/set_name/lang_and_type.zip/cardname.jpg (with Pictures/Back.jpg as exeption)
where
set_type is one of
    Core Sets
    Expansions
    Promo Cards
    Special Sets

set_name is
Core Sets | Open
10th Edition
1st Limited Edition Alpha
1st Limited Edition Beta
2nd Unlimited
3rd Revised Edition
4th Edition
5th Edition
6th Classic Edition
7th Edition
8th Edition
9th Edition
Magic 2010
Magic 2011
Magic 2012
Magic 2013

Expansions | Open
Alara Reborn
Alliances
Antiquities
Apocalypse
Arabian Nights
Avacyn Restored
Betrayers of Kamigawa
Champions of Kamigawa
Coldsnap
Conflux
Dark Ascension
Darksteel
Dissension
Eventide
Exodus
Fallen Empires
Fifth Dawn
Future Sight
Guildpact
Homelands
Ice Age
Innistrad
Invasion
Judgment
Legends
Legions
Lorwyn
Mercadian Masques
Mirage
Mirrodin
Mirrodin Besieged
Morningtide
Nemesis
New Phyrexia
Odyssey
Onslaught
Planar Chaos
Planeshift
Prophecy
Ravnica City of Guilds
Return to Ravnica
Rise of the Eldrazi
Saviors of Kamigawa
Scars of Mirrodin
Scourge
Shadowmoor
Shards of Alara
Stronghold
Tempest
The Dark
Time Spiral
Time Spiral Timeshifted
Torment
Urza's Destiny
Urza's Legacy
Urza's Saga
Visions
Weatherlight
Worldwake
Zendikar

Promo Cards | Open
Alternate Art Lands
Arena League
Book Inserts
Champs
Comic Inserts
Convention Promos
Friday Night Magic
Full Box Promotion
Gateway
Grand Prix
Happy Holidays
Hobby Japan
Judge Gift Cards
Junior Series
Legend Membership
Magazine Inserts
Magic Game Day
Magic Player Rewards
Magic Premiere Shop
Prerelease Events
Pro Tour
Redemption Program
Release Events
Stores
Summer of Magic
Two-Headed Giant
Ultra Rare
Video Game
Worlds

Special Sets | Open
Anthologies
Archenemy
Battle Royale
Beatdown
Chronicles
Coldsnap Theme Decks
Commander
Deckmasters
Duel Decks - Ajani vs. Nicol Bolas
Duel Decks - Divine vs. Demonic
Duel Decks - Elspeth vs. Tezzeret
Duel Decks - Elves vs. Goblins
Duel Decks - Garruk vs. Liliana
Duel Decks - Izzet vs. Golgari
Duel Decks - Jace vs. Chandra
Duel Decks - Knights vs. Dragons
Duel Decks - Phyrexia vs. The Coalition
Duel Decks - Venser vs. Koth
Duels of the Planeswalkers
From the Vault - Dragons
From the Vault - Exiled
From the Vault - Legends
From the Vault - Relics
Introductory Two-Player Set
Magic Encyclopedia
Multiverse Gift Box
Planechase
Planechase 2012
Portal
Portal Second Age
Portal Three Kingdoms
Premium Deck Series - Fire & Lightning
Premium Deck Series - Graveborn
Premium Deck Series - Slivers
Renaissance
Starter 1999
Starter 2000
Unglued
Unhinged
Vanguard

lang_and_type is
[list=lang_and_type]
ENG.zip
ENG TOK.zip
ENG FOIL.zip
ENG INS.zip
ZHC.zip
GER.zip
ITA.zip
RUS INS.zip
RUS TOK.zip
etc
[/list]
falling back to ENG if no localized images are found.


:arrow:
I am sure both structures have their own merrits and histories.
MA's Goblin Hero already stated that his structure won't be changed (since it depends on his database and the zips are a necessity to get around file-count-limitations in the torrent distribution), I can only hope for Forge to consider a compatibility option.
Considering the stress that forge put on preventing unneccessary picture downloads, the torrent distribution might still make MA's pictures a viable alternative...
LordHelmchen
 
Posts: 125
Joined: 21 Aug 2012, 16:06
Has thanked: 21 times
Been thanked: 32 times

Re: Unified picture resource handling in MA and Forge

Postby Max mtg » 23 Jan 2013, 10:14

In that case (since Forge won't change its format either) I can only suggest you to unpack the archives you want to use in Forge and make directory symlinks (http://en.wikipedia.org/wiki/NTFS_symbolic_link) to matching MA folders

But even that won't work, since Forge expects filenames to be like CardName.full.jpg (not just raw cardname.jpg)
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: Unified picture resource handling in MA and Forge

Postby Chris H. » 23 Jan 2013, 12:47

LordHelmchen wrote:I am sure both structures have their own merrits and histories.
MA's Goblin Hero already stated that his structure won't be changed (since it depends on his database and the zips are a necessity to get around file-count-limitations in the torrent distribution), I can only hope for Forge to consider a compatibility option.
Considering the stress that forge put on preventing unneccessary picture downloads, the torrent distribution might still make MA's pictures a viable alternative...
 
This is an interesting idea. Not sure how many people would find themselves in a position to make use of this type of a feature.
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: Unified picture resource handling in MA and Forge

Postby friarsol » 23 Jan 2013, 13:08

LordHelmchen wrote: :arrow:
I am sure both structures have their own merrits and histories.
MA's Goblin Hero already stated that his structure won't be changed (since it depends on his database and the zips are a necessity to get around file-count-limitations in the torrent distribution), I can only hope for Forge to consider a compatibility option.
Considering the stress that forge put on preventing unneccessary picture downloads, the torrent distribution might still make MA's pictures a viable alternative...
We use the format based on how the HQ Pictures name their pictures, which a lot of other people on this forum also use. It seems like MA is the oddball here not us, and we are being more compatible by sticking to the HQ Pics naming convention.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Unified picture resource handling in MA and Forge

Postby LordHelmchen » 12 Feb 2013, 13:03

Greetings again!
I'm still not done with my idea :-) Please note that I'm not trying to demand anything, only throwing out thoughts to be discussed.

Max mtg wrote:I downloaded MA but could not figure out how to attach pictures to the program.
For reference, here is the Wiki page for Magic Album's Picture Structure.

friarsol wrote:It seems like MA is the oddball here not us, and we are being more compatible by sticking to the HQ Pics naming convention.
I admit that the MWS way has become a de facto standard of picture structure. But it seems that this is more of legacy compatibility decision (made higer up by HQ Pictures and not by forge itself) than anything else. Since Forge uses only one type of image, the ".full" infix is more or less redundant.
Besides, I'm not proposing to give up the HQ Picture structure, just to make it an option to choose another structure.

Chris H. wrote:This is an interesting idea. Not sure how many people would find themselves in a position to make use of this type of a feature.
That is a good point. Me neither. I'll leave that to the MA users to answer in the sister thread. Still, I wonder how many people use MWS and are thus in a position to have Forge and MWS share their image resources. For collection management and deckbuilding, MA is at least a viable if not better alternative. There's still online play going for MWS; but with people apparently working on a Forge hotset branch, the hope for Forge to become an actively develloped substitution for it seems not completely unfounded.

What I think needs to be done for this:
  • change image filename from *.full.jpg to *.jpg.
    either switch extension based on preference or have it look for *.jpg if *.full.jpg is not found
  • include support for .zip archives instead of flat folders
  • change set-to-folder mapping from MWS-like to MA-like
    depending on how card-to-jpg mapping is stored, this could be simply a 2-by-#(sets) table or needs to be an additional property of each individual card.
  • look for tokens in %set%\ENG TOK.zip instead of pics\tokens, so tokens would need to know which set they belong to.
  • .preferences file settings
    IMAGE_SOURCE_TYPE = MWS (default) | MA
    disable picture downloader exept for booster/box/etc art and quest mode images
    change expected file extension
    switch expected folder structure
    IMAGE_PATH = %forge_root%\pics (default) | user defined path ( for example %forge_root%\..\Magic Album\Pictures )
  • (optional) gui to change .preferences option
LordHelmchen
 
Posts: 125
Joined: 21 Aug 2012, 16:06
Has thanked: 21 times
Been thanked: 32 times

Re: Unified picture resource handling in MA and Forge

Postby Chris H. » 12 Feb 2013, 16:03

Originally, Forge did not support multiple images for each card. Each card would use the URL:

http://www.wizards.com/global/images/magic/general/{card_name.jpg}

and Forge did not care about which set this card came from.

The number of cards in Forge increased over time and it reached a point where including set information started to make sense. We decided to make use of the HQ set pics and used their naming convention as this would prevent people from having to rename the pics that are located in the various set folders located in the /res/pics/ folder. Please note that some people have displays large enough that they choose to use HQ pics rather than the LQ pics.

I seem to remember that the code would also recognize the naming convention used by the non set cards located in the /res/pics/ folder.
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: Unified picture resource handling in MA and Forge

Postby LordHelmchen » 12 Feb 2013, 17:39

Chris H. wrote:Please note that some people have displays large enough that they choose to use HQ pics rather than the LQ pics.
The pictures from MA's torrent are HQ.
The gain for forge this option brings is a collection of HQ pictures that is complete (MA is a collector's archival tool), already sorted (imho logically, albeit differently than what MWS uses) and distributed in a way that takes the load off cardforge.org (torrent).

edit: [cut a paragraph, rephrased and reposted it 10 minutes later]
I can see SVar:Picture in res/cardsfolder/... for each card; that points to wizards.com/global/images (matching what was said by Chris H.) or cardforge.org/fpics. It does neither have the .full infix nor a set subdir (or any other local filename).
Then there's res/pics_link/card-pictures_X.txt: that looks like some sort of replacement table. It changes capitalization, switches "_" to "%20" and adds the .full infix. The set subdirs given are 2 or 3 letters long, while the HQ archive for forge that I had found uses 3 letters only.

When and where does forge decide on the local filename, both for storing the ressource downloader data and for loading the images? Maybe someone who knows their way around the code can point me in the right direction so I can make the changes in a dirty hack style for my local forge install.
LordHelmchen
 
Posts: 125
Joined: 21 Aug 2012, 16:06
Has thanked: 21 times
Been thanked: 32 times

Re: Unified picture resource handling in MA and Forge

Postby timmermac » 12 Feb 2013, 18:17

I would advise continuing to handle pictures in a fashion that is at least more similar to how they are currently handled. I.E. Low quality. The reason why Forge has gone away from HQ pictures is due to memory concerns, as the HQ pics had been bogging Forge down to the point where it would be unplayable on lower-end systems. Anyone that does use HQ pics probably has a ton of RAM in their computer.
"I just woke up, haven't had coffee, let alone a pee in 7 days, and I find out you stole my ass and made a ...mini-me! Carter, I should be irked currently, yes?" - Jack O'Neill
User avatar
timmermac
Tester
 
Posts: 1512
Joined: 17 May 2010, 20:36
Has thanked: 18 times
Been thanked: 95 times

Re: Unified picture resource handling in MA and Forge

Postby Chris H. » 12 Feb 2013, 19:25

timmermac wrote:I would advise continuing to handle pictures in a fashion that is at least more similar to how they are currently handled. I.E. Low quality. The reason why Forge has gone away from HQ pictures is due to memory concerns, as the HQ pics had been bogging Forge down to the point where it would be unplayable on lower-end systems. Anyone that does use HQ pics probably has a ton of RAM in their computer.
 
Good point. In the past Forge had Java Heap Space problems and this forced us to create the launcher process which would increase the Java Heap Space as Forge was launched.

Lower end machines such as the popular netbooks may find using the HQ pics to be too painful and they would be better off using the LQ pics.
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: Unified picture resource handling in MA and Forge

Postby myk » 12 Feb 2013, 19:27

For filename building, see CardUtil:203
Code: Select all
    private static String buildFilename(final String cardName, final String setName, final int artIndex,
            final int artIndexMax, final boolean isToken) {
...
myk
 
Posts: 439
Joined: 17 Jan 2013, 02:39
Location: California
Has thanked: 38 times
Been thanked: 57 times

Re: Unified picture resource handling in MA and Forge

Postby Chris H. » 12 Feb 2013, 19:36

LordHelmchen wrote:Then there's res/pics_link/card-pictures_X.txt: that looks like some sort of replacement table. It changes capitalization, switches "_" to "%20" and adds the .full infix. The set subdirs given are 2 or 3 letters long, while the HQ archive for forge that I had found uses 3 letters only.
 
A person once set up a server with HQ pics that would use the files in question to download those HQ Pics. This server went off line a couple of years ago. :( During this time we started to notice Java Heap Space issues.

LordHelmchen wrote:When and where does forge decide on the local filename, both for storing the ressource downloader data and for loading the images? Maybe someone who knows their way around the code can point me in the right direction so I can make the changes in a dirty hack style for my local forge install.
 
If you want to take a try at modifying the code I would suggest that you follow these instructions:

How to Get Started Developing Forge
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: Unified picture resource handling in MA and Forge

Postby LordHelmchen » 13 Feb 2013, 00:51

re:timmermac : When I installed Forge a few months ago, I just optimistically looked for forge-compatible HQ pics, unzipped them and have not experienced unplayable bogging down. As MA's picures are the same size, I assume that, at least for me and my "ton of RAM" Laptop, they should work as well. Besides, I still don't want Forge to abandom their working LQ image downloader. I just want an the option to have Forge use an alternative image source, namely my existing MA installation.

re Chris H. : Am I corretly to assume that the res/pics_link dir and its contents is thus a leftover that is no longer used, and kept only in case someone wants to reactivate Forge-internal HQ downloads ?

Anyways...
Thanks to the Wiki page and myk, I started to experiment a bit. So far I have successfully made buildFilename recognize the existance of the file, but no image shows up. (though I cheated around the zip archives by creating unzipped folders that I just renamed to have a .zip suffix). When copied to the MWS-style expected location, image files from MA are read and displayed, so I know that it's not the jpgs themselves that are the problem...
what I tried so far patchfile | Open
[code]
Index: res/blockdata/setdata.txt
===================================================================
--- res/blockdata/setdata.txt (revision 19554)
+++ res/blockdata/setdata.txt (working copy)
@@ -1,97 +1,97 @@
Index:0|Code2:MBP|Code3:MBP|Type:Other|Name:Media Insert Promo|Alias:PRO
-Index:1|Code2:A|Code3:LEA|Type:Core|Name:Limited Edition Alpha
-Index:2|Code2:B|Code3:LEB|Type:Core|Name:Limited Edition Beta
-Index:3|Code2:U|Code3:2ED|Type:Core|Name:Unlimited Edition
-Index:4|Code2:AN|Code3:ARN|Type:Expansion|Name:Arabian Nights
-Index:5|Code2:AQ|Code3:ATQ|Type:Expansion|Name:Antiquities
-Index:6|Code2:R|Code3:3ED|Type:Core|Name:Revised Edition
-Index:7|Code2:LG|Code3:LEG|Type:Expansion|Name:Legends
-Index:8|Code2:DK|Code3:DRK|Type:Expansion|Name:The Dark
-Index:9|Code2:FE|Code3:FEM|Type:Expansion|Name:Fallen Empires
+Index:1|Code2:A|Code3:LEA|Type:Core|Name:Limited Edition Alpha|MApath:Core Sets/1st Limited Edition Alpha
+Index:2|Code2:B|Code3:LEB|Type:Core|Name:Limited Edition Beta|MApath:Core Sets/1st Limited Edition Beta
+Index:3|Code2:U|Code3:2ED|Type:Core|Name:Unlimited Edition|MApath:Core Sets/2nd Unlimited
+Index:4|Code2:AN|Code3:ARN|Type:Expansion|Name:Arabian Nights|MApath:Expansions/Arabian Nights
+Index:5|Code2:AQ|Code3:ATQ|Type:Expansion|Name:Antiquities|MApath:Expansions/Antiquities
+Index:6|Code2:R|Code3:3ED|Type:Core|Name:Revised Edition|MApath:Core Sets/3rd Revised Edition
+Index:7|Code2:LG|Code3:LEG|Type:Expansion|Name:Legends|MApath:Expansions/Legends
+Index:8|Code2:DK|Code3:DRK|Type:Expansion|Name:The Dark|MApath:Expansions/The Dark
+Index:9|Code2:FE|Code3:FEM|Type:Expansion|Name:Fallen Empires|MApath:Expansions/Fallen Empires

-Index:10|Code2:4E|Code3:4ED|Type:Core|Name:Fourth Edition
-Index:11|Code2:IA|Code3:ICE|Type:Expansion|Name:Ice Age
-Index:12|Code2:CH|Code3:CHR|Type:Reprint|Name:Chronicles
-Index:13|Code2:HL|Code3:HML|Type:Expansion|Name:Homelands
-Index:14|Code2:AL|Code3:ALL|Type:Expansion|Name:Alliances
-Index:15|Code2:MI|Code3:MIR|Type:Expansion|Name:Mirage
-Index:16|Code2:VI|Code3:VIS|Type:Expansion|Name:Visions
-Index:17|Code2:5E|Code3:5ED|Type:Core|Name:Fifth Edition
-Index:18|Code2:PT|Code3:POR|Type:Starter|Name:Portal
-Index:19|Code2:WL|Code3:WTH|Type:Expansion|Name:Weatherlight
+Index:10|Code2:4E|Code3:4ED|Type:Core|Name:Fourth Edition|MApath:Core Sets/4th Edition
+Index:11|Code2:IA|Code3:ICE|Type:Expansion|Name:Ice Age|MApath:Expansions/Ice Age
+Index:12|Code2:CH|Code3:CHR|Type:Reprint|Name:Chronicles|MApath:Special Sets/Chronicles
+Index:13|Code2:HL|Code3:HML|Type:Expansion|Name:Homelands|MApath:Expansions/Homelands
+Index:14|Code2:AL|Code3:ALL|Type:Expansion|Name:Alliances|MApath:Expansions/Alliances
+Index:15|Code2:MI|Code3:MIR|Type:Expansion|Name:Mirage|MApath:Expansions/Mirage
+Index:16|Code2:VI|Code3:VIS|Type:Expansion|Name:Visions|MApath:Expansions/Visions
+Index:17|Code2:5E|Code3:5ED|Type:Core|Name:Fifth Edition|MApath:Core Sets/5th Edition
+Index:18|Code2:PT|Code3:POR|Type:Starter|Name:Portal|MApath:Special Sets/Portal
+Index:19|Code2:WL|Code3:WTH|Type:Expansion|Name:Weatherlight|MApath:Expansions/Weatherlight

-Index:20|Code2:TE|Code3:TMP|Type:Expansion|Name:Tempest
-Index:21|Code2:SH|Code3:STH|Type:Expansion|Name:Stronghold
-Index:22|Code2:EX|Code3:EXO|Type:Expansion|Name:Exodus
-Index:23|Code2:P2|Code3:PO2|Type:Starter|Name:Portal Second Age|Alias:P02
-Index:24|Code2:US|Code3:USG|Type:Expansion|Name:Urza's Saga
-Index:25|Code2:UL|Code3:ULG|Type:Expansion|Name:Urza's Legacy
-Index:26|Code2:6E|Code3:6ED|Type:Core|Name:Classic (Sixth Edition)
-Index:27|Code2:UD|Code3:UDS|Type:Expansion|Name:Urza's Destiny
-Index:28|Code2:P3|Code3:PTK|Type:Starter|Name:Portal Three Kingdoms
-Index:29|Code2:ST|Code3:S99|Type:Starter|Name:Starter 1999
+Index:20|Code2:TE|Code3:TMP|Type:Expansion|Name:Tempest|MApath:Expansions/Tempest
+Index:21|Code2:SH|Code3:STH|Type:Expansion|Name:Stronghold|MApath:Expansions/Stronghold
+Index:22|Code2:EX|Code3:EXO|Type:Expansion|Name:Exodus|MApath:Expansions/Exodus
+Index:23|Code2:P2|Code3:PO2|Type:Starter|Name:Portal Second Age|Alias:P02|MApath:Special Sets/Portal Second Age
+Index:24|Code2:US|Code3:USG|Type:Expansion|Name:Urza's Saga|MApath:Expansions/Urza's Saga
+Index:25|Code2:UL|Code3:ULG|Type:Expansion|Name:Urza's Legacy|MApath:Expansions/Urza's Legacy
+Index:26|Code2:6E|Code3:6ED|Type:Core|Name:Classic (Sixth Edition)|MApath:Core Sets/6th Classic Edition
+Index:27|Code2:UD|Code3:UDS|Type:Expansion|Name:Urza's Destiny|MApath:Expansions/Urza's Destiny
+Index:28|Code2:P3|Code3:PTK|Type:Starter|Name:Portal Three Kingdoms|MApath:Special Sets/Portal Three Kingdoms
+Index:29|Code2:ST|Code3:S99|Type:Starter|Name:Starter 1999|MApath:Special Sets/Starter 1999

-Index:30|Code2:MM|Code3:MMQ|Type:Expansion|Name:Mercadian Masques
-Index:31|Code2:NE|Code3:NMS|Type:Expansion|Name:Nemesis|Alias:NEM
-Index:32|Code2:S2K|Code3:S00|Type:Starter|Name:Starter 2000
-Index:33|Code2:PY|Code3:PCY|Type:Expansion|Name:Prophecy
-Index:34|Code2:IN|Code3:INV|Type:Expansion|Name:Invasion
-Index:35|Code2:PS|Code3:PLS|Type:Expansion|Name:Planeshift
-Index:36|Code2:7E|Code3:7ED|Type:Core|Name:Seventh Edition
-Index:37|Code2:AP|Code3:APC|Type:Expansion|Name:Apocalypse
-Index:38|Code2:OD|Code3:ODY|Type:Expansion|Name:Odyssey
-Index:39|Code2:TO|Code3:TOR|Type:Expansion|Name:Torment
+Index:30|Code2:MM|Code3:MMQ|Type:Expansion|Name:Mercadian Masques|MApath:Expansions/Mercadian Masques
+Index:31|Code2:NE|Code3:NMS|Type:Expansion|Name:Nemesis|Alias:NEM|MApath:Expansions/Nemesis
+Index:32|Code2:S2K|Code3:S00|Type:Starter|Name:Starter 2000|MApath:Special Sets/Starter 2000
+Index:33|Code2:PY|Code3:PCY|Type:Expansion|Name:Prophecy|MApath:Expansions/Prophecy
+Index:34|Code2:IN|Code3:INV|Type:Expansion|Name:Invasion|MApath:Expansions/Invasion
+Index:35|Code2:PS|Code3:PLS|Type:Expansion|Name:Planeshift|MApath:Expansions/Planeshift
+Index:36|Code2:7E|Code3:7ED|Type:Core|Name:Seventh Edition|MApath:Core Sets/7th Edition
+Index:37|Code2:AP|Code3:APC|Type:Expansion|Name:Apocalypse|MApath:Expansions/Apocalypse
+Index:38|Code2:OD|Code3:ODY|Type:Expansion|Name:Odyssey|MApath:Expansions/Odyssey
+Index:39|Code2:TO|Code3:TOR|Type:Expansion|Name:Torment|MApath:Expansions/Torment

-Index:40|Code2:JU|Code3:JUD|Type:Expansion|Name:Judgment
-Index:41|Code2:ON|Code3:ONS|Type:Expansion|Name:Onslaught
-Index:42|Code2:LE|Code3:LGN|Type:Expansion|Name:Legions
-Index:43|Code2:SC|Code3:SCG|Type:Expansion|Name:Scourge
-Index:44|Code2:8E|Code3:8ED|Type:Core|Name:Core Set - Eighth Edition
-Index:45|Code2:MR|Code3:MRD|Type:Expansion|Name:Mirrodin
-Index:46|Code2:DS|Code3:DST|Type:Expansion|Name:Darksteel
-Index:47|Code2:FD|Code3:5DN|Type:Expansion|Name:Fifth Dawn
-Index:48|Code2:CHK|Code3:CHK|Type:Expansion|Name:Champions of Kamigawa
-Index:49|Code2:BOK|Code3:BOK|Type:Expansion|Name:Betrayers of Kamigawa
+Index:40|Code2:JU|Code3:JUD|Type:Expansion|Name:Judgment|MApath:Expansions/Judgment
+Index:41|Code2:ON|Code3:ONS|Type:Expansion|Name:Onslaught|MApath:Expansions/Onslaught
+Index:42|Code2:LE|Code3:LGN|Type:Expansion|Name:Legions|MApath:Expansions/Legions
+Index:43|Code2:SC|Code3:SCG|Type:Expansion|Name:Scourge|MApath:Expansions/Scourge
+Index:44|Code2:8E|Code3:8ED|Type:Core|Name:Core Set - Eighth Edition|MApath:Core Sets/8th Edition
+Index:45|Code2:MR|Code3:MRD|Type:Expansion|Name:Mirrodin|MApath:Expansions/Mirrodin
+Index:46|Code2:DS|Code3:DST|Type:Expansion|Name:Darksteel|MApath:Expansions/Darksteel
+Index:47|Code2:FD|Code3:5DN|Type:Expansion|Name:Fifth Dawn|MApath:Expansions/Fifth Dawn
+Index:48|Code2:CHK|Code3:CHK|Type:Expansion|Name:Champions of Kamigawa|MApath:Expansions/Champions of Kamigawa
+Index:49|Code2:BOK|Code3:BOK|Type:Expansion|Name:Betrayers of Kamigawa|MApath:Expansions/Betrayers of Kamigawa

-Index:50|Code2:SOK|Code3:SOK|Type:Expansion|Name:Saviors of Kamigawa
-Index:51|Code2:9E|Code3:9ED|Type:Core|Name:Core Set - Ninth Edition
-Index:52|Code2:RAV|Code3:RAV|Type:Expansion|Name:Ravnica: City of Guilds
-Index:53|Code2:GP|Code3:GPT|Type:Expansion|Name:Guildpact
-Index:54|Code2:DIS|Code3:DIS|Type:Expansion|Name:Dissension
-Index:55|Code2:CS|Code3:CSP|Type:Expansion|Name:Coldsnap
-Index:56|Code2:TSP|Code3:TSP|Type:Expansion|Name:Time Spiral
-Index:57|Code2:TSB|Code3:TSB|Type:Expansion|Name:Time Spiral Timeshifted
-Index:58|Code2:PLC|Code3:PLC|Type:Expansion|Name:Planar Chaos
-Index:59|Code2:FUT|Code3:FUT|Type:Expansion|Name:Future Sight
+Index:50|Code2:SOK|Code3:SOK|Type:Expansion|Name:Saviors of Kamigawa|MApath:Expansions/Saviors of Kamigawa
+Index:51|Code2:9E|Code3:9ED|Type:Core|Name:Core Set - Ninth Edition|MApath:Core Sets/9th Edition
+Index:52|Code2:RAV|Code3:RAV|Type:Expansion|Name:Ravnica: City of Guilds|MApath:Expansions/Ravnica City of Guilds
+Index:53|Code2:GP|Code3:GPT|Type:Expansion|Name:Guildpact|MApath:Expansions/Guildpact
+Index:54|Code2:DIS|Code3:DIS|Type:Expansion|Name:Dissension|MApath:Expansions/Dissension
+Index:55|Code2:CS|Code3:CSP|Type:Expansion|Name:Coldsnap|MApath:Expansions/Coldsnap
+Index:56|Code2:TSP|Code3:TSP|Type:Expansion|Name:Time Spiral|MApath:Expansions/Time Spiral
+Index:57|Code2:TSB|Code3:TSB|Type:Expansion|Name:Time Spiral Timeshifted|MApath:Expansions/Time Spiral Timeshifted
+Index:58|Code2:PLC|Code3:PLC|Type:Expansion|Name:Planar Chaos|MApath:Expansions/Planar Chaos
+Index:59|Code2:FUT|Code3:FUT|Type:Expansion|Name:Future Sight|MApath:Expansions/Future Sight

-Index:60|Code2:10E|Code3:10E|Type:Core|Name:Core Set - Tenth Edition
-Index:61|Code2:LRW|Code3:LRW|Type:Expansion|Name:Lorwyn
-Index:62|Code2:MOR|Code3:MOR|Type:Expansion|Name:Morningtide
-Index:63|Code2:SHM|Code3:SHM|Type:Expansion|Name:Shadowmoor
-Index:64|Code2:EVE|Code3:EVE|Type:Expansion|Name:Eventide|Alias:EVT
-Index:65|Code2:ALA|Code3:ALA|Type:Expansion|Name:Shards of Alara
-Index:66|Code2:CFX|Code3:CFX|Type:Expansion|Name:Conflux|Alias:CON
-Index:67|Code2:ARB|Code3:ARB|Type:Expansion|Name:Alara Reborn
-Index:68|Code2:M10|Code3:M10|Type:Core|Name:Magic 2010
-Index:69|Code2:ZEN|Code3:ZEN|Type:Expansion|Name:Zendikar
+Index:60|Code2:10E|Code3:10E|Type:Core|Name:Core Set - Tenth Edition|MApath:Core Sets/10th Edition
+Index:61|Code2:LRW|Code3:LRW|Type:Expansion|Name:Lorwyn|MApath:Expansions/Lorwyn
+Index:62|Code2:MOR|Code3:MOR|Type:Expansion|Name:Morningtide|MApath:Expansions/Morningtide
+Index:63|Code2:SHM|Code3:SHM|Type:Expansion|Name:Shadowmoor|MApath:Expansions/Shadowmoor
+Index:64|Code2:EVE|Code3:EVE|Type:Expansion|Name:Eventide|Alias:EVT|MApath:Expansions/Eventide
+Index:65|Code2:ALA|Code3:ALA|Type:Expansion|Name:Shards of Alara|MApath:Expansions/Shards of Alara
+Index:66|Code2:CFX|Code3:CFX|Type:Expansion|Name:Conflux|Alias:CON|MApath:Expansions/Conflux
+Index:67|Code2:ARB|Code3:ARB|Type:Expansion|Name:Alara Reborn|MApath:Expansions/Alara Reborn
+Index:68|Code2:M10|Code3:M10|Type:Core|Name:Magic 2010|MApath:Core Sets/Magic 2010
+Index:69|Code2:ZEN|Code3:ZEN|Type:Expansion|Name:Zendikar|MApath:Expansions/Zendikar

-Index:70|Code2:WWK|Code3:WWK|Type:Expansion|Name:Worldwake
-Index:71|Code2:ROE|Code3:ROE|Type:Expansion|Name:Rise of the Eldrazi
-Index:72|Code2:M11|Code3:M11|Type:Core|Name:Magic 2011
-Index:73|Code2:SOM|Code3:SOM|Type:Expansion|Name:Scars of Mirrodin
-Index:74|Code2:MBS|Code3:MBS|Type:Expansion|Name:Mirrodin Besieged
-Index:75|Code2:NPH|Code3:NPH|Type:Expansion|Name:New Phyrexia
-Index:76|Code2:COM|Code3:COM|Type:Other|Name:Commander
-Index:77|Code2:M12|Code3:M12|Type:Core|Name:Magic 2012
-Index:78|Code2:ISD|Code3:ISD|Type:Expansion|Name:Innistrad
-Index:79|Code2:DKA|Code3:DKA|Type:Expansion|Name:Dark Ascension
+Index:70|Code2:WWK|Code3:WWK|Type:Expansion|Name:Worldwake|MApath:Expansions/Worldwake
+Index:71|Code2:ROE|Code3:ROE|Type:Expansion|Name:Rise of the Eldrazi|MApath:Expansions/Rise of the Eldrazi
+Index:72|Code2:M11|Code3:M11|Type:Core|Name:Magic 2011|MApath:Core Sets/Magic 2011
+Index:73|Code2:SOM|Code3:SOM|Type:Expansion|Name:Scars of Mirrodin|MApath:Expansions/Scars of Mirrodin
+Index:74|Code2:MBS|Code3:MBS|Type:Expansion|Name:Mirrodin Besieged|MApath:Expansions/Mirrodin Besieged
+Index:75|Code2:NPH|Code3:NPH|Type:Expansion|Name:New Phyrexia|MApath:Expansions/New Phyrexia
+Index:76|Code2:COM|Code3:COM|Type:Other|Name:Commander|MApath:Special Sets/Commander
+Index:77|Code2:M12|Code3:M12|Type:Core|Name:Magic 2012|MApath:Core Sets/Magic 2012
+Index:78|Code2:ISD|Code3:ISD|Type:Expansion|Name:Innistrad|MApath:Expansions/Innistrad
+Index:79|Code2:DKA|Code3:DKA|Type:Expansion|Name:Dark Ascension|MApath:Expansions/Dark Ascension

-Index:80|Code2:AVR|Code3:AVR|Type:Expansion|Name:Avacyn Restored
-Index:81|Code2:PC2|Code3:PC2|Type:Other|Name:Planechase 2012 Edition
-Index:82|Code2:M13|Code3:M13|Type:Core|Name:Magic 2013
-Index:83|Code2:RTR|Code3:RTR|Type:Expansion|Name:Return to Ravnica
-Index:84|Code2:GTC|Code3:GTC|Type:Expansion|Name:Gatecrash
+Index:80|Code2:AVR|Code3:AVR|Type:Expansion|Name:Avacyn Restored|MApath:Expansions/Avacyn Restored
+Index:81|Code2:PC2|Code3:PC2|Type:Other|Name:Planechase 2012 Edition|MApath:Special Sets/Planechase 2012
+Index:82|Code2:M13|Code3:M13|Type:Core|Name:Magic 2013|MApath:Core Sets/Magic 2013
+Index:83|Code2:RTR|Code3:RTR|Type:Expansion|Name:Return to Ravnica|MApath:Expansions/Return to Ravnica
+Index:84|Code2:GTC|Code3:GTC|Type:Expansion|Name:Gatecrash|MApath:Expansions/Gatecrash

-Index:86|Code2:VAN|Code3:VAN|Type:Other|Name:Vanguard
-Index:87|Code2:ARC|Code3:ARC|Type:Other|Name:Archenemy
-Index:88|Code2:HOP|Code3:HOP|Type:Other|Name:Planechase
+Index:86|Code2:VAN|Code3:VAN|Type:Other|Name:Vanguard|MApath:Special Sets/Vanguard
+Index:87|Code2:ARC|Code3:ARC|Type:Other|Name:Archenemy|MApath:Special Sets/Archenemy
+Index:88|Code2:HOP|Code3:HOP|Type:Other|Name:Planechase|MApath:Special Sets/Planechase
Index: res/preferences/main.properties
===================================================================
--- res/preferences/main.properties (revision 19554)
+++ res/preferences/main.properties (working copy)
@@ -60,6 +60,7 @@

lang--transparent-properties=../lang/lang.properties

+image/magicalbum--file=../../../TestPictures
image/base--file=../pics
image/token--file=../pics/tokens
image/icon--file=../pics/icons
Index: src/main/java/forge/CardUtil.java
===================================================================
--- src/main/java/forge/CardUtil.java (revision 19554)
+++ src/main/java/forge/CardUtil.java (working copy)
@@ -208,11 +208,27 @@

File f = null;
if (StringUtils.isNotBlank(setName)) {
+ // try Magic Album Pictures
+ final File maPicturePath = ForgeProps.getFile(NewConstants.IMAGE_MAGICALBUM);
+ final String maSetPath = Singletons.getModel().getEditions().getMapathByCode(setName);
+ final String maZipName = isToken ? "ENG TOK.zip" : "ENG.zip";
+ //final String maCardName = GuiDisplayUtil.cleanStringMa(cardName);
+ final String maCardName = cardName;
+ final String maNn = artIndexMax > 1 ? String.format(" [%s]", Integer.toString(artIndex + 1)) : "";
+ final String maFileName = String.format("%s/%s/%s%s", maSetPath, maZipName, maCardName, maNn);
+ f = new File(maPicturePath, maFileName + ".jpg");
+ System.out.println(String.format("(MA:%s", f));
+ if (f.exists()) {
+ return maFileName;
+ }
+ // end of MA image mod
+
final String mwsCardName = GuiDisplayUtil.cleanStringMWS(cardName);

// First, try 3 letter set code with MWS filename format
final String mwsSet3 = String.format("%s/%s%s.full", setName, mwsCardName, nn);
f = new File(path, mwsSet3 + ".jpg");
+ System.out.println(String.format("(MWS3:%s", f));
if (f.exists()) {
return mwsSet3;
}
@@ -220,6 +236,7 @@
// Second, try 2 letter set code with MWS filename format
final String mwsSet2 = String.format("%s/%s%s.full", Singletons.getModel().getEditions().getCode2ByCode(setName), mwsCardName, nn);
f = new File(path, mwsSet2 + ".jpg");
+ System.out.println(String.format("(MWS2:%s", f));
if (f.exists()) {
return mwsSet2;
}
@@ -227,6 +244,7 @@
// Third, try 3 letter set code with Forge filename format
final String forgeSet3 = String.format("%s/%s%s", setName, cleanCardName, nn);
f = new File(path, forgeSet3 + ".jpg");
+ System.out.println(String.format("(Forge:%s", f));
if (f.exists()) {
return forgeSet3;
}
Index: src/main/java/forge/card/CardEdition.java
===================================================================
--- src/main/java/forge/card/CardEdition.java (revision 19554)
+++ src/main/java/forge/card/CardEdition.java (working copy)
@@ -48,7 +48,7 @@
}

/** The Constant unknown. */
- public static final CardEdition UNKNOWN = new CardEdition(-1, "??", "???", Type.UNKNOWN, "Undefined", null);
+ public static final CardEdition UNKNOWN = new CardEdition(-1, "??", "???", Type.UNKNOWN, "Undefined", null, null);

private final int index;
private final String code2;
@@ -56,9 +56,21 @@
private final Type type;
private final String name;
private final String alias;
+ private final String mapath;

+// old Constructor without mapath
+// private CardEdition(int index, String code2, String code, Type type, String name, String alias) {
+// this.index = index;
+// this.code2 = code2;
+// this.code = code;
+// this.type = type;
+// this.name = name;
+// this.alias = alias;
+// this.mapath = "";
+// }
/**
* Instantiates a new card set.
+ * Constructor with additional mapath parameter. Had to add mapath field and modify Reader for this.
*
* @param index indicates order of set release date
* @param code2 the 2 (usually) letter code used for image filenames/URLs distributed by the HQ pics team that
@@ -69,22 +81,26 @@
* @param type the set type
* @param name the name of the set
* @param an optional secondary code alias for the set
+ * @param MagicAlbum-style picture path infix
*/
- private CardEdition(int index, String code2, String code, Type type, String name, String alias) {
+ private CardEdition(int index, String code2, String code, Type type, String name, String alias, String mapath) {
this.index = index;
this.code2 = code2;
this.code = code;
this.type = type;
this.name = name;
this.alias = alias;
+ this.mapath = mapath;
}

+
public int getIndex() { return index; }
public String getCode2() { return code2; }
public String getCode() { return code; }
public Type getType() { return type; }
public String getName() { return name; }
public String getAlias() { return alias; }
+ public String getMapath() {return mapath; }

/** The Constant fnGetName. */
public static final Function<CardEdition, String> FN_GET_CODE = new Function<CardEdition, String>() {
@@ -206,6 +222,7 @@
String type = section.get("type");
String name = section.get("name");
String alias = section.get("alias");
+ String mapath = section.get("mapath");

Type enumType = Type.UNKNOWN;
if (null != type && !type.isEmpty()) {
@@ -217,7 +234,7 @@
}
}

- return new CardEdition(index, code2, code, enumType, name, alias);
+ return new CardEdition(index, code2, code, enumType, name, alias, mapath);
}

}
Index: src/main/java/forge/card/EditionCollection.java
===================================================================
--- src/main/java/forge/card/EditionCollection.java (revision 19554)
+++ src/main/java/forge/card/EditionCollection.java (working copy)
@@ -80,6 +80,15 @@
final CardEdition set = this.get(code);
return set == null ? "" : set.getCode2();
}
+ /**
+ * Gets MagicAlbum-style Edition Picture path by code, as set in setdata.txt MApath: property
+ * @param code
+ * @return path as String, f.e. "Core Sets/8th Edition"
+ */
+ public String getMapathByCode(final String code) {
+ final CardEdition set = this.get(code);
+ return set == null ? "" : set.getMapath();
+ }

public final Function<String, CardEdition> FN_EDITION_BY_CODE = new Function<String, CardEdition>() {
@Override
Index: src/main/java/forge/properties/NewConstants.java
===================================================================
--- src/main/java/forge/properties/NewConstants.java (revision 19554)
+++ src/main/java/forge/properties/NewConstants.java (working copy)
@@ -139,6 +139,8 @@
/** The SYMBOLS_SMALL. */
public static final String SYMBOLS_SMALL = "symbols/small";

+ /** Constant <code>IMAGE_MAGICALBUM="image/magicalbum"</code>. */
+ public static final String IMAGE_MAGICALBUM = "image/magicalbum";
/** Constant <code>IMAGE_BASE="image/base"</code>. */
public static final String IMAGE_BASE = "image/base";
/** Constant <code>IMAGE_TOKEN="image/token"</code>. */

[code]
LordHelmchen
 
Posts: 125
Joined: 21 Aug 2012, 16:06
Has thanked: 21 times
Been thanked: 32 times

Next

Return to Forge

Who is online

Users browsing this forum: No registered users and 189 guests


Who is online

In total there are 189 users online :: 0 registered, 0 hidden and 189 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 189 guests

Login Form