Help talk:Gadget-ACDC

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search


Let me know if you would be okay for this to be made a gadget :)

Jean-Fred (talk) 08:18, 8 August 2019 (UTC)

@Jean-Frédéric: well, I assume as a gadget this would definitely have to support some older browsers… --Lucas Werkmeister (talk) 19:44, 8 August 2019 (UTC)
@Jean-Frédéric: the script should now support any modern browser supported by MediaWiki (though it would be nice to have some more people test this), so I guess it’s one step closer to becoming a gadget? :) --Lucas Werkmeister (talk) 22:20, 24 August 2019 (UTC)

@Lucas Werkmeister: ✓ Now a gadget :-) Jean-Fred (talk) 17:11, 11 September 2019 (UTC)

@Jean-Frédéric: wow, thanks a lot! (But how do I edit it now when necessary? Post an edit request on this talk page, I guess?) --Lucas Werkmeister (talk) 20:33, 11 September 2019 (UTC)
Ah, yeah, that’s a good point. Yes, please use {{Edit request}} on the talk page and ping me. (Alternatively, get interface admin rights ? ;-) ) Jean-Fred (talk) 21:03, 11 September 2019 (UTC)
I’m not sure how serious you were, but I figure it doesn’t hurt to ask 🙃 --Lucas Werkmeister (talk) 21:29, 12 September 2019 (UTC)


Thanks for this tool! Just gave it a try.

The selection of pictures
  • Selecting visually (like Cat-A-lot does) would be handy
  • Selecting by name was smoother than I expected thanks to autocompletion, and thanks to the tool not suggesting already selected images: I could keep pasting Raph Koster - Game Developers Conference Online 2012 - until I got all 11 pictures
  • The script froze when adding a Depicts to 11 files. The JS Console gives:

TypeError: statementWidget.getData(...).toArray(...).flatMap is not a function[Learn More] index.php:393:60

Jean-Fred (talk) 08:32, 8 August 2019 (UTC)

@Jean-Frédéric: Thanks! Which browser (version) are you using? The flatMap issue alone can be worked around with a few lines of code, but I’m not sure if everything else would still work then. (On the other hand, if you got that far, then I think your browser must support most of the other modern features I’m using.) Also, I definitely should improve error handling so it doesn’t look like the script froze. --Lucas Werkmeister (talk) 17:19, 8 August 2019 (UTC)
@Lucas Werkmeister: Firefox 61.0.1 (64-bit) for Ubuntu (yeah, I know, it’s out of support ^__^") Jean-Fred (talk) 17:35, 8 August 2019 (UTC)
@Jean-Frédéric: ah, those dang Linux distros keeping old Firefox versions alive ^^ I’ve improved the error handling a bit, and flatMap should work now :) --Lucas Werkmeister (talk) 19:43, 8 August 2019 (UTC)

Visual file selection[edit]

+1 to needing a visual file change component -- also because I can't see the files, I have to "know" which file I am going after. Sadads (talk) 15:45, 9 August 2019 (UTC)

@Christian Ferrer, Sadads, Jean-Frédéric: Building a powerful visual file selector might take a lot of time, though, and it’s essentially duplicate effort with VisualFileChange, Cat-a-lot and possibly other gadgets already existing. I think it would be much better if those tools had the option to export the current selection, and then you could import it into AC/DC (or other tools, too). That could be as simple as copying the list of files to the user’s clipboard, but even more useful would probably be PagePile integration. Would that work for you? (On the AC/DC side I’d probably have to add a warning for piles of more than, dunno, 100 files.) --Lucas Werkmeister (talk) 14:48, 11 August 2019 (UTC)
Yes, it would be fine to be abble to copy a selected list of files. Christian Ferrer (talk) 17:13, 11 August 2019 (UTC)
Pagepile integration would be fine if we could get it in and out of the other tools or there was a one click url into AC/DC (i.e. AC/DC could grab a pile from a url variable) . Worth reaching out to the maintainers for pagepile production? Sadads (talk) 00:44, 12 August 2019 (UTC)
Yes, why not. Christian Ferrer (talk) 11:20, 12 August 2019 (UTC)
@Perhelion, Zhuyifei1999: Would love your thoughts on this? Anyone else we should ask? Sadads (talk) 19:55, 12 August 2019 (UTC)
Magnus Manske (who maintains pagepile)? --Zhuyifei1999 (talk) 14:52, 13 August 2019 (UTC)
It turns out PagePile needs some changes before I can even start to use it from a user script. I’ve sent a pull request. (Once that’s done, yes, it should be possible to make AC/DC read the ID from the URL.) --Lucas Werkmeister (talk) 20:19, 14 August 2019 (UTC)
@Christian Ferrer, Sadads, Jean-Frédéric: PagePile integration is now live! You can click the ellipsis icon in the files input to load a PagePile, and soon there will also be a link to AC/DC in the PagePile tool (though it will only work for people who have installed the user script, at least until we make it a gadget). --Lucas Werkmeister (talk) 19:52, 24 August 2019 (UTC)
Great, thanks you. I just tried with a page pile created with PetScan, and that's worked. I notice that File:Mihyla palmipes 120607-0085 krw.jpg have been ignored, because BotMultichill already did it, that leaded me to notice that the tool don't push to "Preferred rank" an existing "Normal rank" value. But anyway that's already very great, thanks again. Christian Ferrer (talk) 13:21, 25 August 2019 (UTC)
@Christian Ferrer: hm, interesting – I think I can make AC/DC bump normal-rank statements to preferred ones, but I take it the inverse shouldn’t happen – if the statement already exists with preferred rank, and you specify normal rank in AC/DC, it shouldn’t be demoted? --Lucas Werkmeister (talk) 12:38, 27 August 2019 (UTC)
Good question.. theoretically I would say no, because if the statements are already at preferred rank it is because there is surely a good reason for this. In another hand the tool will be more powerful if we have the possibility to demote statements (for maintenance purposes, or to fix a few mistakes). So finally the two possibilities are worth. The only thing I am afraid is that someone comes to put a statement on all the files of a category (via a pagepile), without checking what have been done, and so then overriding the potentially justified preferred rank(s) with less relevant normal rank(s). It would be perfect if we could have the choice, a kind of option "do you want to override the existing preferred/normal ranks?". Possible? Christian Ferrer (talk) 17:23, 27 August 2019 (UTC)
I would add that what would be perfect would be a seeting by default with no overinding of the existing rank(s), and with a possibility to easily set the tool, in the dialog box, for that it overides the existing ranks. Christian Ferrer (talk) 10:34, 28 August 2019 (UTC)
@Christian Ferrer: bumping statements to preferred rank is now supported – I’m not yet convinced the inverse operation would be very useful, and I don’t want to clutter the UI too much, so for now I’m leaving that out / waiting for another tool to offer it. --Lucas Werkmeister (talk) 12:40, 1 September 2019 (UTC)
Ok, very fine, thanks you. Christian Ferrer (talk) 14:29, 1 September 2019 (UTC)
@Perhelion, Zhuyifei1999: Is there an opportunity to create pagepile outputs for your tools? Sadads (talk) 12:21, 27 August 2019 (UTC)
Which tool are you referring to? I don't really 'own' a user script / gadget here ;) --Zhuyifei1999 (talk) 22:55, 27 August 2019 (UTC)
Aren't you maintaining/contributing to Cat-a-lot or Visual File Change? The idea would be to make a set from one of those tools that could be sent to AC/DC, perhaps with a pagepile or similar, Sadads (talk) 15:17, 28 August 2019 (UTC) (reping coorectly: @Zhuyifei1999: Sadads (talk) 15:18, 28 August 2019 (UTC))
As far as I understand, pagepile is a database of lists of pages right? So your idea is for the tools to export their page lists to pagepile right?
The pagepile manual seems all about PHP-tools. Is there a public HTTP endpoint to create a pagepile? --Zhuyifei1999 (talk) 17:19, 28 August 2019 (UTC)
@Zhuyifei1999: yes, essentially you POST to with action=create_pile_with_data, wiki=commonswiki (or other dbname), and data being the newline-separated list of pages. Each line of data contains the title and namespace number separated by a tab (Test.png 6), or the namespace number can be set to -999 to instead interpret the first field as the full title (File:Test.png -999). See the QuickCategories source code for a Python version of this. However, PagePile doesn’t (yet) send an Access-Control-Allow-Origin header for the create_pile_with_data response, so while you can create a PagePile from client-side JS, the browser won’t let you read the response and you won’t get the pile ID. --Lucas Werkmeister (talk) 19:37, 28 August 2019 (UTC)
Hmm. I think I would wait for a CORS fix. --Zhuyifei1999 (talk) 21:48, 28 August 2019 (UTC)
I have added Access-Control-Allow-Origin to the create_pile and create_pile_with_data actions. If it's abused by others I'll have to wait for CORS, but maybe try it now? --Magnus Manske (talk) 13:04, 3 September 2019 (UTC)
@Zhuyifei1999: in case you missed it – creating PagePiles from user scripts should now be possible (though I haven’t tried it out myself). --Lucas Werkmeister (talk) 21:13, 16 September 2019 (UTC)
I am badly lacking time. I'll see if I can do it this weekend --Zhuyifei1999 (talk) 04:26, 17 September 2019 (UTC)
Can't. Maybe next weekend --Zhuyifei1999 (talk) 21:53, 22 September 2019 (UTC)
@Sadads: Interesting, I'm with Zhuyifei1999. For Cat-a-lot (initial version by Magnus Manske ;-)) there has been such a (import) feature request in the past and I was on the way to fulfill it. @Export/PagePile (I also don't know): Unfortunately I've not many experience with this, so I would need concrete information how this format should look like. @VisualFileChange is certainly one of the most powerful tools for Commons and can be extended with many things (I guess Rillke finds this interesting too). -- User: Perhelion 22:51, 3 September 2019 (UTC)

Deduplication of statements?[edit]

So I started seriously playing around with the category to Depicts potential of AC/DC today, and was wondering if the tool makes sure that you don't add a duplicate of the exact same statement(+ qualifiers)? I am asking, because I could imagine starting a set with one or two manual "depicts" statements but finding hints of which categories that might contribute great information about particular statements, and doing that in batch. But when I run AC/DC it would be quite hard to go through and manually look for statements already there, especially in larger batches. There might be some complexity here, because you might, for example, have two bycicles: one red and facing left and one blue and facing right, but you want to add two separate depicts statements in batch. Sadads (talk) 16:06, 13 September 2019 (UTC)

@Sadads: Currently, the gadget will not add duplicate statements – if there’s an existing statement with the same value, it will add any missing qualifiers to it, and optionally bump its rank from Normal to Preferred (but never vice versa). I guess in terms of “depicts”, that’s more useful for individual items (people, buildings, etc.) than for classes of items. (If you try to add two statements with the same value in the same AC/DC batch, you should actually see an error message about that.) --Lucas Werkmeister (talk) 13:06, 14 September 2019 (UTC)
Thanks! That makes a lot of sense: how does it handle "different" qualifiers? I.e. there could be two bycicles, one red, one blue and it doesn't make a sense for the additional color to the first bicycle. Sadads (talk) 00:15, 17 September 2019 (UTC)

Global off switch?[edit]

In the Monitoring section, I wrote that the gadget has no global “off” switch yet. I think I put that there thinking of some other bots/tools, but does this gadget need a global off switch? Because otherwise I might as well remove that sentence. (This is mainly a question for the admins, I suppose.) --Lucas Werkmeister (talk) 13:57, 20 September 2019 (UTC)