Jump to content

User talk:Lucas Werkmeister/QuickCategories

Add topic
From Meta, a Wikimedia project coordination wiki

pending commands

[edit]

@Ash Crow and Strakhov: I’ve just reset some commands in batches of yours which were stuck in the “pending” state (should be run soon, but for some reason – most likely a bug in the tool – it never happened) to the default “planned” state. Specifically, these ones:

You might want to run some of these commands again to make sure they’re properly settled – hopefully they’ll work correctly now. Sorry for the inconvenience. --Lucas Werkmeister (talk) 11:32, 1 May 2019 (UTC)Reply

Thanks! I'll give it a look! Strakhov (talk) 11:36, 1 May 2019 (UTC)Reply
Hi, those batches were mostly each time the previous one without the blocking line (which I treated by hand then, which permitted me to see that the problem was protected categories), so running them again is useless. -Ash Crow (talk) 07:01, 2 May 2019 (UTC)Reply

Feature request

[edit]

Hey Lucas, thank you for this awesome tool! I do have an idea, how to make it even more useful but no clue how easy or hard it would be to implement this. Since batch category jobs are quite often created with PetScan, would it be possible create a batch here using a PagePile id? That would make life so much easier. What do you think, feasible? Cheers, --MB-one (talk) 12:11, 18 May 2019 (UTC)Reply

@MB-one: I assume you mean the actions would be the same for each page? That should be possible, though I’m not very familiar with the PagePile system – do you perhaps have an example link or something? --Lucas Werkmeister (talk) 11:34, 26 May 2019 (UTC)Reply
Yes, the action would have to be the same for each page/file/category. Unfortunately, I can't provide much information on the inner workings of PagePile either. You can find example page piles at https://tools.wmflabs.org/pagepile/?menu=recent.
Cheers --MB-one (talk) 19:34, 26 May 2019 (UTC)Reply
@MB-one: This is now available at toolforge:quickcategories/batch/new/pagepile, please try it out! I’ll send a pull request to Magnus to add a link from the PagePile tool as well. --Lucas Werkmeister (talk) 12:05, 1 June 2019 (UTC)Reply
Works great. Thank you! --MB-one (talk) 13:51, 1 June 2019 (UTC)Reply

No sort key support

[edit]

This would actually be the most interesting part for me. I can query the database for possibly wrong/missing sort keys, choose new ones based on some pattern matching but I haven't got a tool to replace them. So I'm looking forward to support for this. --Matěj Suchánek (talk) 16:25, 23 May 2019 (UTC)Reply

@Matěj Suchánek: thanks, that’s good to know! I’ve had sort key support on my to-do list for a while, but thought it wouldn’t be a very useful feature and therefore not a high priority. It’ll probably be at least a few more days before I have the time to work on it, but I can already show you what I’ve planned:
+Category:Cat#sort key
add with this sort key but only if no category link present
+Category:Cat##sort key
add with this sort key, or add sort key to existing category link if it doesn’t have one
+Category:cat###sort key
add with this sort key, or add/replace sort key of existing category link
-Category:cat#sort key
remove category link but only if it has this sort key
What do you think? I figured that the ## case would probably be the most common one (assuming that, if there already is a sort key, it might be better than what the user would add), but it sounds like you would use the ### case instead. --Lucas Werkmeister (talk) 11:29, 26 May 2019 (UTC)Reply
Thanks for your reply. It looks great to me and I like that the user will need to explicitly specify the prerequisites. Unless I'm missing something, there should be also a possibility to remove just the sort key and leave the category with the default one.
In fact, I'm more likely to use ##. --Matěj Suchánek (talk) 12:29, 26 May 2019 (UTC)Reply
To remove the sort key, you’d use ### without a sort key behind it (i. e. with an empty sort key). I’ll make sure the tool does the right thing in that case (i. e. not [[Category:Foo|]], because I have no idea what the pipe trick does to category links.) --Lucas Werkmeister (talk) 21:42, 27 May 2019 (UTC)Reply
@Matěj Suchánek: Sort key support is available now! --Lucas Werkmeister (talk) 22:31, 30 May 2019 (UTC)Reply
Very nice, thank you! I'm currently too busy to start testing and using it but I promise I will provide you with soem feedback soon. --Matěj Suchánek (talk) 15:39, 2 June 2019 (UTC)Reply

wiki read-only

[edit]

Hi @Lucas Werkmeister:, first of all, thanks for this awesome tool! I was for some time looking for something similar and was glad to find QuickCategories. Unfortunately, I caused some trouble. One status of the tasks of my job #393 was "wiki read-only", which seemed to have stopped the whole batch job. At the moment I'm not able to see which of the categories is actually affected as:

  • going to page two of the tasks causes an internal server error
  • changing the limit as per url parameter doesn't seem to be possible.

Can you help me with that? Thanks a lot, --Tomukas (talk) 16:15, 8 August 2019 (UTC)Reply

@Tomukas: Thanks for the bug report! I’ve fixed the issue when viewing the second page – it was display-only, and the tool automatically resumed the batch after half an hour and retried the failed command (that’s why it now shows 101 commands instead of 100), so there’s nothing more you need to do :) --Lucas Werkmeister (talk) 17:43, 8 August 2019 (UTC)Reply

Solving redirects

[edit]

Hello @Lucas Werkmeister:! As we talked yesterday, it would be interesting to have a method to solve redirect, so we can add categories to the actual article or to the redirection. Thanks! -Theklan (talk) 08:38, 3 January 2020 (UTC)Reply

@Theklan: So in the Telegram discussion, our idea was to make this a per-page option, so that you could decide for each command (page + actions) whether a redirect should be resolved or not. But I’ve looked a bit into how the API deals with redirects now, and it looks like this would be easier to implement if it’s an option for the entire batch: either all the commands in a batch resolve redirects, or none of them do. Do you think that would also work? (I suspect that would be easier to use, too – a separate checkbox with a helpful label, rather than some more ASCII syntax in the input field.) --Lucas Werkmeister (talk) 22:05, 20 January 2020 (UTC)Reply
I think it should work, yes. -Theklan (talk) 22:24, 20 January 2020 (UTC)Reply
@Theklan: So it took me a bit longer, but this is implemented now. I went for the original idea after all (! before a title) – making the flag per-batch didn’t simplify the code as much as I’d thought, and I didn’t like the reduced flexibility. --Lucas Werkmeister (talk) 15:19, 16 February 2020 (UTC)Reply
Great! I'll solve some redirects soon and I will write you if I find any problem (but I don't expect to find anything!). -Theklan (talk) 15:52, 17 February 2020 (UTC)Reply

Sortkeys

[edit]

Any way to keep sortkeys when removing a category and adding another? In this batch, I'd rather had the sortkey preserved when moving to the subcategory. 𝟙𝟤𝟯𝟺𝐪𝑤𝒆𝓇𝟷𝟮𝟥𝟜𝓺𝔴𝕖𝖗𝟰 (𝗍𝗮𝘭𝙠) 11:05, 25 January 2021 (UTC)Reply

"Removal all" command

[edit]

This might be a bit niche or out of scope for this tool, but it would be very helpful to be able to specify a command to remove all categories, followed by several additions. For example (assuming asterisks aren't allowed in category names): -Category:*|+Category:Very cute cats. The specific use case I'm thinking of is when clearly out frequently diffused categories that are sometimes filled with lots of low-quality logos. They're often tagging with stuff like "Technology", "Science", "Innovative" and so on, so it's not possible to move them to a new category in one go with Cat-a-lot.

Hopefully that makes sense, and thank you for making such a great tool. :) Perryprog (talk) 23:34, 21 February 2021 (UTC)Reply

I'm pretty sure asterisks are allowed in category names, but "|-*" would solve this problem. 𝟙𝟤𝟯𝟺𝐪𝑤𝒆𝓇𝟷𝟮𝟥𝟜𝓺𝔴𝕖𝖗𝟰 (𝗍𝗮𝘭𝙠) 23:36, 21 February 2021 (UTC)Reply
Another thing I just realized: in a perfectly ideal world, being able to remove all categories that do or don't match a regex (or just a string), and then adding additional ones from there would be really great. Obviously that's much more difficult (time wise) to implement. Perryprog (talk) 23:57, 21 February 2021 (UTC)Reply
And for what it's worth, this isn't totally undoable with VisualFileChange—I just made a profile (source here) that seems to do OK with some over-the-top regex replacements. Perryprog (talk) 00:31, 22 February 2021 (UTC)Reply

Fails on Telugu wikipedia

[edit]

@User:Lucas Werkmeister,batch did not work. Can you help?--Arjunaraoc (talk) 05:55, 4 January 2022 (UTC)Reply

@Arjunaraoc As far as I can tell, you created the batch but never ran it – make sure to press one of the buttons at the bottom (either run the commands on the current page, or run the whole batch in the background). Lucas Werkmeister (talk) 12:14, 4 January 2022 (UTC)Reply
@Lucas Werkmeister Thanks for your quick response. I tried running in background and it worked. Sorry to have bothered you. Arjunaraoc (talk) 13:05, 4 January 2022 (UTC)Reply

Earlier batches in a series of batches did not run

[edit]

@User:Lucas Werkmeister I submitted several batches one after another and found only the last batch executed, even after waiting for 7 hours. If a queued feature is supported, it will be helpful. last batch which was run successfully. Earlier batch which did not run, but status says 'done'.--Arjunaraoc (talk) 00:42, 5 January 2022 (UTC)Reply

@Arjunaraoc When the status says “done”, but in teal instead of green, it means that no edit was necessary: in the case of batch #4217, which removes categories, that means the target page wasn’t in the category to begin with, as far as the tool could tell at least. (The tool can’t change categories added via templates, and doesn’t take subcategories into account: it only edits category links directly on the page.) The “done” badge for an individual edit also links to the permalink of the page as the tool saw it: for example, te:Category:అనంతసాగరం మండలంలోని గ్రామాలు, as of te:Special:PermanentLink/2241797, wasn’t in te:Category:శ్రీ పొట్టి శ్రీరాములు నెల్లూరు జిల్లా మండలాలు‎, and as far as I can tell from looking at the category’s source code myself, that’s correct. So the batch did run, there just wasn’t anything to do as far as the tool could tell. Lucas Werkmeister (talk) 01:33, 5 January 2022 (UTC)Reply
@Lucas Werkmeister, Ok. I might have made a mistake. If there is real change, it would be good to flag it. I I will try series of batches again and report if there is problem. Arjunaraoc (talk) 01:38, 5 January 2022 (UTC)Reply

Trimming category names

[edit]

@Lucas Werkmeister, I have one feature request for the tool: it should be able to trim the category name when removing, e.g. Also remove Category:_Bla when asked to remove Category:Bla. MediaWiki already handles the 2 identically and some users consider it mode readable to leave a space after the namespace. Strainu (talk) 09:10, 27 December 2023 (UTC)Reply

@Strainu: I wasn’t aware of that, thanks! It should recognize such category links when adding or removing categories now. (But newly added categories should still be added as the user specified them, except that spaces will be replaced with underscores. I hope that makes sense.) Lucas Werkmeister (talk) 13:47, 28 December 2023 (UTC)Reply
Confirmed working, thanks a lot for the quick implementation! Strainu (talk) 16:51, 28 December 2023 (UTC)Reply

Not accessible & does it work with Petscan?

[edit]

Interesting tool, if it can do what I think it does it seems underused/underrated but that is for good reasons:

  • Could you change it so that one can use it from one page instead of having to go to the query services and use its outputs? Petscan is used so much because it's all on one page and the first/simple use quite self-explanatory. One would enter a query at the top (the query service page could get embedded or this functionality be added to the Wikidata query page) and it would automatically use or enter its outputs.
  • This could later be improved further by simplifying the queries use query templates where one only replaces some variables / enters something into input fields.
  • Is this an alternative solution to this issue https://github.com/magnusmanske/petscan_rs/issues/173 ? I didn't understand the reply to the "#Feature request" about PetScan above. In the tool it says "Create a new pile in another tool" with a link to petscan but nowhere in petscan do I see any "PagePile ID". Can this be used with Petscan? If so, please add accessible instructions on how including a link to petscan in the info page. Like the suggestions above, I think it would also be better if this was integrated with petscan directly so this functionality is added to petscan (or petscan is embedded here with the PPID automatically being used). In Petscan I only see the petscan id (psid). Note that one issue is that often there are unrelated items in categories and currently it's not possible to easily identify the cause so maybe there should be some warning about this and maybe better support to identify and exclude these.
  • Why can one not see the query used for batches in the batches pages?

Prototyperspective (talk) 13:34, 21 August 2024 (UTC)Reply

@Prototyperspective: Thanks for the input!
  • Regarding points 1, 2 and 4: I feel like you’re focusing a bit too much on the query service integration? In my eyes, that’s only one way to use the tool – the input format is intentionally very simple and general so that people can generate the batches in whatever way they want. I put together the query workflow with someone else (don’t quite remember who they were, sorry) years ago at some event (I think it was the evening before the 2019 WikidataCon) and put it on the wiki page for documentation and further reference, but I don’t know if anyone is actually still using these queries. (Maybe that’s a fault with the documentation and it should be made clearer?) I don’t actually use the tool myself very often, so I’d always appreciate it if other users added their workflow on the documentation page. If it turns out that the query workflow really is widespread and maybe even often uses the same queries, I could consider integrating into the tool more, sure – but at the moment I have no idea where the tool’s input comes from, so (regarding point 4) it can’t be shown either.
  • Regarding point 3: I think it should be possible, yes – PagePile is one of the format options in PetScan’s output tab. (If you select it, you’ll be redirected to the PagePile tool after clicking the “Do it!” button.) And on PagePile, you then have the option to “use this PagePile in [dropdown]”, where one of the options is QuickCategories and will take you to that tool. Documenting this better is a fair point, sure. (Maybe you have a realistic example suggestion for a PetScan query + categorization that I can try to implement and take screenshots along the way?)
Lucas Werkmeister (talk) 18:08, 21 August 2024 (UTC)Reply

Removing categories

[edit]

Does it only work when the category is there? Web-julio (talk) 06:01, 20 November 2024 (UTC)Reply

I don’t know what you expect removing a category to do when the category isn’t there? Lucas Werkmeister (talk) 07:02, 20 November 2024 (UTC)Reply
Because when I just created a new specific child category (e.g. in an intersection), I want to fulfill it without the files or pages directly in the general (grand)parent categories, so either I replace or add, depending if the page already has the parent or not. Web-julio (talk) 10:42, 21 November 2024 (UTC)Reply
@Web-julio: Okay, I’m not sure I fully understand you but I think I have the answer you want – if you specify SomePage|+Category:ChildCategory|-Category:ParentCategory, this will add the child category, and remove the parent category if it’s present; if the parent category isn’t present, the child category will still be added. Does that answer your question? Lucas Werkmeister (talk) 21:23, 21 November 2024 (UTC)Reply
It worked now. Maybe I was doing something wrong the first time I tried. Also can you check ptwiki? It doesn't recognize Categoria:, only Category:. Web-julio (talk) 17:01, 22 November 2024 (UTC)Reply
@Web-julio: When creating batches, only Category: is supported, as mentioned in § Submitting batches. But when editing the page it should use the translated namespace name (example). Lucas Werkmeister (talk) 22:01, 22 November 2024 (UTC)Reply

Request for comments: Watchlist behavior

[edit]

Currently, QuickCategories obeys your Add pages and files I edit to my watchlist preference: if you have that preference enabled, all the pages you edit through QuickCategories will end up on your watchlist. It would be possible to change this, so that QuickCategories never changes your watchlist (by adding watchlist=nochange to the API request, as @Stjn requested for another of my tools the other day). Should I make this change?

I tried to check some other mass-editing tools for comparison but didn’t find much. Cat-a-lot, where I also copied the “should this edit be marked as minor?” logic from, apparently has a setting for watchlist behavior; if I’m reading the code correctly, it defaults to watchlist=preferences (i.e. obey the Add pages and files I edit to my watchlist preference).

Thoughts welcome :) Lucas Werkmeister (talk) 21:12, 20 November 2024 (UTC)Reply

To clarify, I think tools that are supposed to be used by non-automated users for mass edits should take care not to put stuff in watchlist, at least not without a warning/option. I have ‘Add pages and files I edit to my watchlist’ preference to track pages I actually edited, not pages I edited with tools. I have never used Cat-a-lot from my own account but it looks from the code like it allows changing the preference. I’m fine with it being a preference, what I think tools should not do is mass watchlist without an alternative. stjn[ru] 21:21, 20 November 2024 (UTC)Reply
In general I’m not a big fan of preferences in tools (because of the added maintenance cost), but in this case it would very straightforwardly map to an underlying API option (and if the API option is ever removed, I can just remove the preference and wash my hands of any guilt), and QuickCategories already has a few other preferences (making an additional preference easier to implement). So I could probably live with this here. (But I’ll wait a bit to see if anyone else has comments here.) Lucas Werkmeister (talk) 21:31, 20 November 2024 (UTC)Reply
I used to have Cat-a-lot on the default, which matched my preference at the time to add all edited pages to my watchlist. This quickly ballooned the size of my watchlist with files I didn't care about, so I turned it off. I still haven't fully cleared those files out of my watchlist because it'd be too much of a pain, so I'm still removing files as they come up. Default off would be preferred. AntiCompositeNumber (talk) 21:39, 20 November 2024 (UTC)Reply
I’ve now deployed a new version of the tool that adds a preference for watchlist behavior – though I still kept the default behavior the same as before (i.e. obey the on-wiki preference), as I think that’s less surprising. Lucas Werkmeister (talk) 18:27, 1 December 2024 (UTC)Reply
As far as I know, the tool hasn't added anything to my whatchlist... is because I changed something in the preferences? Theklan (talk) 19:24, 1 December 2024 (UTC)Reply
Do you have the Add pages and files I edit to my watchlist preference turned on? I don’t think it’s turned on by default. Lucas Werkmeister (talk) 22:03, 1 December 2024 (UTC)Reply