Template talk:OCG-TCG card image

From Yugipedia
Jump to: navigation, search

This is the talk page for discussing the page, Template:OCG-TCG card image.

Please try to

  • Be polite
  • Assume good faith
  • Be welcoming

Exclamation mark[edit]

At File:LevelDown-DE01-JP-C.jpg, it doesn't seem to remove the "!"
-Falzar FZ- (talk page|useful stuff) 03:17, May 30, 2012 (UTC)

Fixed. =D ディノ千?!? · ☎ Dinoguy1000 03:20, May 30, 2012 (UTC)
Awesome! ^o^ Look234 (talkcontribs) 03:26, May 30, 2012 (UTC)
While you're at it, other symbols that have been used in the OCG names (so they may appear again later) and aren't being removed are: ・ ~ = % ☆
-Falzar FZ- (talk page|useful stuff) 03:47, May 30, 2012 (UTC)
Added (or removed, depending on your perspective =D ). Any others you can think of? ディノ千?!? · ☎ Dinoguy1000 19:13, May 30, 2012 (UTC)
File:GravekeepersServant-BE01-JP-C.png is broken. -Falzar FZ- (talk page|useful stuff) 02:47, October 30, 2012 (UTC)
Something about SMW's behavior changed at some point; I haven't investigated just what yet. I've actually known about this for a week or so, though; just another item on my to-do list. =D ディノ千?!? · ☎ Dinoguy1000 02:57, October 30, 2012 (UTC)

ZDC1[edit]

In the pages of "Clash! Duel Carnival!"'s OPs the template points to "Yu-Gi-Oh! ZEXAL Clash! Duel Carnival promotional cards" instead of "Yu-Gi-Oh! ZEXAL Clash! Duel Carnival! promotional cards" --XBrain130™X頭脳130」 07:22, September 19, 2013 (UTC)

Thanks. Does it look okay now? --UltimateKuriboh (talkcontribs) 12:48, September 19, 2013 (UTC)

More improvements[edit]

It's now broken for cards like TempestMagician-SOVR-EN-SR-LE.png, since the set contains a post-fix. Or is that supposed to be like it now?

One thing I would like to suggest is making the template "guess" the card name if the name parameter is not used. Basically,

{{ #explode: {{ #explode: {{ PAGENAME }} | . | 0 }} | - | 0 }}

So, for cards like Sangan-LCYW-EN-ScR-UE.png, {{OCG-TCG card image}} would be enough. Becasita Pendulum (talkcontribs) 11:15, June 20, 2016 (UTC)

That's unintended, and I'm not sure it should be kept. But I'm also not sure it shouldn't, so at least for now I'm not going to fix it. For now, though, don't rename images like it suggests in these cases, since doing so will completely break the template output (worse than it is pre-renaming).
I thought about doing that, actually, but I want to wait until I can redo how it pulls information from the filename. Currently it works basically left-to-right, which works fine for recent names, but older card names kept the dash ("-") in the card's name, which will break the template, so I want to redo it to work right-to-left instead, which will be somewhat more involved to determine just what information is present, but will allow it to handle these older image names much better. (And now that I think a bit more about this, there may be a similar problem with periods, but if so that's a much simpler fix.) ディノ千?!? · ☎ Dinoguy1000 11:50, June 20, 2016 (UTC)
Alrighty. Keeping it may be confused, as it will add another thing between dashes. Won't that complicate it?
I had a scheme at my template where, given a parameter (fix), it would separate the card name from the set name, when they were together. I don't know if it might be useful for you, it's very rudimentary.
Working right-to-left sounds good.
Older card names also had commas (,). Example (if it still exists). Just leaving the note.
Oh and there was something I would like to point: as you can see here, it seems it will still ask for a rename on Proxies. Becasita Pendulum (talkcontribs) 14:12, June 20, 2016 (UTC)
Yes, if it's kept it will have to be handled differently. In the long term, I want to change the format of card image names (again) anyways, which would render this a moot point (since part of that change would be including the full card number in the image name; the other major part would be including the card name verbatim (to the extent that's possible given software limitations) and containing all the non-name info in a set of parentheses or something).
You may have noticed, but the template is already able to automatically separate the card name and set, if the card name is passed to it (though I think there are some edge cases that it doesn't quite handle correctly); looking at your code carefully, it looks like that's what you're doing as well (though if I'm wrong, you should correct me). I have some thoughts on enabling it to separate them in some cases where the name isn't provided, but I don't know how well those would pan out (since the only real way I can see to do it is with a massive #switch that checks the last N characters of the combined name/set to see if they match any known set prefix).
I'm aware of that, and don't think commas should affect anything, since the template doesn't do any handling around them.
Fixed it; it was a problem with how I was fetching info from the image name. ディノ千?!? · ☎ Dinoguy1000 15:02, June 20, 2016 (UTC)
Since we had some conversation where you mentioned it, I've also been thinking on a possible file naming to give us much information without making it confusing. I also thought putting the info for each thing into parentheses. But yeah, it wouldn't deal with everything, since there are chars that can't be used for file naming, but I guess those cases could be treated as exceptions.
Yes, that's how I handle it. The name has to be passed; then it's trimmed and then it's subtracted to the first part of the file name (exploding the -); this will leave the set abbreviation. Though it fails for file names that have card names with dashes, yes.
It would have to be some big #switch. That's something I haven't been able to reach yet. It would need to check the last 2, 3, 4 or 5 characters from that first part and then see if it could find a case-sensitive match (if I'm getting it correctly). And even in that case, it could fail (though I guess with the cards we have today, it wouldn't).
Let's pretend I didn't say anything about the commas.
I see, I gave a quick look to try to understand the problem (I always like to try to solve it myself (without damaging), but this code is really big and complicated for me. And it's divided into several pages. Very cool, though. Becasita Pendulum (talkcontribs) 15:25, June 20, 2016 (UTC)
I can't wait until we've gotten all images with dashes in the card name renamed; I'm working on making the image name parsing code more generalized, and handling those cases is next to impossible (since the card name may have zero or more dashes, and the card name and set prefix may be separated by a dash or not - so we have potential for "BlueEyesWhiteDragon-LOB", "Blue-EyesWhiteDragon-LOB", "BlueEyesWhiteDragonLOB", and "Blue-EyesWhiteDragonLOB", for example). I'm going to look through a list of all pages on the wiki with a dash in their name to see if I can cut any corners here; a shortcut or three for this would be much better than having to try and solve the general problem.
If I can properly solve the dash problem, I'll be able to properly cover cases regardless of whether the card name includes a dash or not.
I probably wouldn't bother with the 4-character case (and definitely not the 5-character case, since there's only been a single card print with a 5-character set prefix released to date). The 2-character case wouldn't be terrible, since 2-character prefixes are limited to the Series 2 sets (and some prefixes we use only on this wiki for some of the Series 1 sets), but the 3-character case would be annoying since there's at least 100 (and probably over 200) 3-character prefixes.
Actually, the /core and /core2 subpages are no longer used or needed; I'm just in no particular hurry to redirect them back to the main template. But yes, this template is pretty complicated, out of necessity (and it doesn't even fully support everything we'd like it to, like basically anything that isn't OCG/TCG!); that's one big reason I'd like to get it converted to a module. ディノ千?!? · ☎ Dinoguy1000 16:16, June 20, 2016 (UTC)
True. Maybe checking the last characters of that first part of the file name, until it spots a non upper-case character? I don't know how possible this is. Especially because they may also contain numbers, so it would be a lot of instances to check. For instance, for "BazootheSoul-EaterDB2", it would have to check "2": ambiguous, keeps checking, puts into a list/array; "B": upper-case, concatenate with the previous array; "D": upper-case, concatenate with the previous array; "r": lower-case, all sets' abbreviations are upper-case, don't add. So we would have "DB2" as the set. For the name, it would be "BazootheSoul-Eater". If the name would be entered, then it would have to cut everything right-to-left until leaving the last n+1 elements of the file name separated by the dash. Where n would be the number of times the dash appears at the name entered at name. So for an hypothetical name of "BazootheSoul-EaterDB2-EN-R-UE" where "Bazoo the Soul-Eater" was entered as the name, it would have to remove stuff until leaving the the last 1+1 elements ("BazootheSoul-EaterDB2"). And then do the upper-case thing check, maybe? In case the file was correctly named, it would end up as "BazootheSoulEater-DB2". And if the name was incorrect but was like "BazootheSoul-Eater-DB2-EN-R-UE", it would end as "BazootheSoul-Eater", then... Well, I guess the right-to-left approach would deal with this, no? It would be so much easier if nondeterminism was more than a concept. Another alternative is really comparing it with every set abbreviation... This would end up being a bit expensive.
Well, it works with correctly named stuff, but there is still a big lot of files to rename, indeed.
Yeah, I guess a module would make it cleaner and easier to read. Though it's also a hard language. Becasita Pendulum (talkcontribs) 16:49, June 20, 2016 (UTC)
After hacking away at it for a while, I actually decided right-to-left is probably more trouble than it's worth (not least because we don't have a comprehensive list of possible values for "alt" like we do for releases or editions), so right now what I'm doing instead is isolating the name+set as best I can and going from there. (Right now, "going from there" consists of seeing if the last dash-delimited piece is 5 characters or less, and if so, treating it as the set; this shouldn't have much different effect from how the template currently works, other than maybe catching some cases where the set is separated from the name and the name has at least one dash in it.) It's still slow going, though, since I keep getting distracted by hypothetical situations that probably don't actually need to be handled; I should just wrap up what I have already and save it.
Your suggestion about looking right-to-left and finding the first lowercase letter is a good one on the surface, but there are cards whose names end in an uppercase letter or a number, and that method would fall apart on them. This could be combined with checking whether the obtained string matches any known set abbreviation, and if not, proceeding to the next step before checking again (whether you check at each step as you're working right-to-left, or you wait until you've got a full candidate string and then work back through the candidate), but that still faces potential problems where another set with a longer or shorter prefix just happens to match as well. Ultimately, it's just too much overhead for something that's becoming increasingly rarer as images continue to get tagged and renamed, so I don't think it's worth the trouble of trying to deal with the ambiguity.
Yeah, and the biggest problem with them is just getting them initially tagged; after that, renaming and updating uses is straightforward.
Lua's actually a very simple, straightforward, and light language; what makes it difficult is the fact that it is a proper programming language, unlike wikitext+ParserFunctions (though it does do some weird things that more popular languages like JavaScript, C, and Java don't, which can give people a hard time if they're coming from some other language to Lua). ディノ千?!? · ☎ Dinoguy1000 17:16, June 20, 2016 (UTC)
Hum, if the problem would be the alt parameter, why not checking if it exists a priori and go from there? I do it on my template and I also look for the last #exploded bit to check if it's "OP", "GC", etc.. Wouldn't that facilitate it a bit (if I got what you said correctly, that is)? But for that, the alt parameter would have to be passed manually (at least most of the times), and I don't know if your idea was getting it automatically as well.
Well, what cases would those be? You could try it and if it brings problems, it could always be reverted. At least it would be running for a while, so we all could see if there are any major problems. It would work like de-bugging (though could be risky, I guess).
Yeah it wouldn't work with stuff like "Cannon Soldier MK-2", ect., but I was thinking more about using it in case the card wasn't correctly named. It would decrease the number of failed attempts, but it would be a big mess in the end. I like yours more. But it wouldn't work 100% of the time, still. But I would also say to don't bother much. People can manually correct it, if you give the template the chance to receive the parameters manually as well (like how it's now).
I'm familiar with several programming languages, but I just find some of Lua's terminology a bit unintuitive. But I confess I have yet to put some time into it. Becasita Pendulum (talkcontribs) 18:29, June 20, 2016 (UTC)
The problem with the "alt" parameter is that I don't have a list of all the values it can have, like I do for the "edition" and "release" parameters. So matching it isn't really an option.
I'm pretty much done working on the template for now, other than being prepared to fix bugs as I become aware of them, so further functionality isn't very high on my list of priorities now. That, and I've been staring at this thing off-and-on for something like 6 hours now, so I'm quite ready to go not think about it for a while. =D ディノ千?!? · ☎ Dinoguy1000 19:04, June 20, 2016 (UTC)
Either I wasn't clear, or I didn't understand you. I was saying you don't need to know what values the "alt" may take. You just need to know if it exists or not. If it does exist, then ignore it and treat everything like if it didn't exist, until you need it. If it doesn't exist, well, nothing, everything goes as it should. This is to the right-to-left approach, that is. But as I said, the "alt" parameter would have to be entered manually (in the sense I use on my template, like alt = 1).
Things that were correct seem to be fine after some purges (I had my favorite files to "de-bug"). I usually deal a lot with pics, so I'll alert you (here) if I find something wrong.
Oh, just take some rest, Dino. You've done some nice work! Becasita Pendulum (talkcontribs) 19:12, June 20, 2016 (UTC)
It is necessary to know the possible values while parsing the image name, since there's no parameter that can be checked (half the point is to avoid checking any parameters while working through the image name). You would have a point if the question were about working through parameters instead, or if each part of the image name had some unique identifier that showed definitively whether a given part was present, but neither of those is the case here. So instead of starting with the "alt" part, the template has to work up to it. Though of course, when this is eentually converted to a module (whenever that happens), I wouldn't be surprised to be able to handle the whole thing more gracefully.
That's good to hear. I'm probably going to leave this for a while, to allow any other bugs to settle out, then revisit it to see what sorts of simplifications and optimizations I can find, as well as taking a crack at implementing some other long-needed features (like proper support for anime and manga cards). ディノ千?!? · ☎ Dinoguy1000 19:26, June 20, 2016 (UTC)
Aaaaah, I see, I see. Alrighty then!
Sure, rest well! Becasita Pendulum (talkcontribs) 20:40, June 20, 2016 (UTC)
Is it safe to start using it like this, now, for newer uploads and such? Becasita Pendulum (talkcontribs) 18:41, June 23, 2016 (UTC)
Yeah, go for it. ディノ千?!? · ☎ Dinoguy1000 01:42, June 24, 2016 (UTC)

Script error: No such module "outdent". I'm really sorry to insist on this, but maybe now it would be the time to add a category for Official Proxy images? And maybe for Giant Cards and Case Toppers as well? And even Replicas? What do you think? Becasita Pendulum (talkcontribs) 20:34, June 24, 2016 (UTC)

Don't apologize, man, it's a perfectly reasonable request and one I probably would've done already if I'd thought of it in the past few days. =) At this point, I'd kind of like to put some more work into the template before I start looking at that sort of categorization, but I may go ahead with it regardless. ディノ千?!? · ☎ Dinoguy1000 23:12, June 24, 2016 (UTC)
Hey, you brought {{Outdent}} here! I knew it would be useful one these days, heheh.
Well, I just don't want to be annoying with it. Ok, don't worry, you know what's best. Just wanted to bring it again, to don't let it fall into oblivion. Becasita Pendulum (talkcontribs) 23:47, June 24, 2016 (UTC)
Honestly, I'm just surprised no one else's bothered to copy it here at any point (unless they have under some other name). ディノ千?!? · ☎ Dinoguy1000 12:04, June 25, 2016 (UTC)

Script error: No such module "outdent". You know, I've been thinking: This wikia has access to smw, so you can store stuff has properties values. And if you want to know which articles have a certain value for a certain property, you just have to #ask, correct? So why not storing the trimmed card name (from {{Card image name}}) as a property value at {{CardTable2}} and then, the {{OCG-TCG card image}} just gets the first explode automatically and asks for it, to see what card has that trimmed name; then just associates the real name of the card at name. Wouldn't this work? Becasita Pendulum (talkcontribs) 09:20, June 27, 2016 (UTC)

I had a thought along those lines a few days ago, and we actually already use a similar system for generating the links between cards and their various "Card ...:" pages. I just haven't gotten around to testing the idea yet, since it would be a bit different from the current card pages system and thus might not work the same way (and it would have to be applied to all the card table templates, not just CT2). ディノ千?!? · ☎ Dinoguy1000 12:27, June 27, 2016 (UTC)
I think it deserves a try. At least only at the CT2 (or another), just to see if it works fine. Besides that, I don't know what other way could be to get the card name automatically. Becasita Pendulum (talkcontribs) 14:21, June 27, 2016 (UTC)

Script error: No such module "outdent". I'm not sure if this is the right spot to put this message, but I guess at least it's still under this topic, since it has to do with the latest additions/improvements:
I would just like to point that there seems to be a slight discrepancy between some gallery links generated by the template and the ones that actually exist. One example is WindUpSnail-TF06-JP-VG.png; the gallery link generated is Gallery of Yu-Gi-Oh! 5D's Tag Force 6 cards, while the one that exists and where the image is placed is Set Card Galleries:Generation Force (TF06-JP-VG). The latter doesn't seem to me the most appropriate ("Set Card Galleries" namespace doesn't seem the best), but I'm really not into the video games' stuff, so I thought it would be best to point it out. Becasita Pendulum (talkcontribs) 17:22, June 28, 2016 (UTC)

If the template is inserted into a file named accordingly to the old image policy and the name doesn't contain any dashes, the template won't be able to get it automatically. Example: if the template is inserted into something like TrapHoleSYE-EN-C-1E.png and the name parameter is correctly filled, it won't be able to get the file name correctly.
I know you are aware it will fail sometimes, but this is the basic case, where the name doesn't contain any dashes, so it just has to trim whatever it is at name and subtract it to the #explode 0 to get the set, right? Becasita Pendulum (talkcontribs) 16:22, July 3, 2016 (UTC)