Bot24 Task | |
---|---|
Renames Mexican TV station callsign redirects. | |
Operator(s) | Negative24 |
Script | rename_redirect.py |
Script Author | Negative24 |
Type | Supervised (manual start; one-off batches) |
Programming language(s) | Pywikibot |
Description
editScript renames a batch of redirects specified in a Python file with tuples corresponding to original (currently existing) redirects and new redirects. Script then makes sure the new redirect points to the target the old redirect pointed to. It then finds all references to the old redirect, finds the links, and then if the link points to the old redirect, it modifies the link to point to the new redirect, keeping the original section, label, and any other arguments (it only targets the title to begin with).
Operation Actions
edit- FOR every old redirect in list of old redirects to new redirects:
- IF old redirect doesn't exist, BREAK to next old redirect
- IF new redirect doesn't exist, create it and point to final destination
- Create a list of pages linking to old redirect to process; FOR every page in list of pages to process:
- FOR every link on page:
- IF link points to old redirect, modify the title to point to the new redirect
- FOR every link on page:
Consensus
editSupport
edit- Support I commissioned this as a bot to simplify one of the most daunting tasks I've faced in my 10 years as an editor: the need to move hundreds of redirects as Mexico's analog-digital transition hits peak form. Since I began editing Mexico TV articles on a large scale in 2014, Mexico's digital transition has advanced extremely rapidly, which last year led to the beginning of the rewrite of the 32 state lists, and this year to many additions of new digital television technical information. I had to spend time doing the small batches of stations that were done earlier this year. It was quite a task just to do 10 or 12 of them, let alone the hundreds that will be changing over in the next month. With the DTV transition and analog shutoff occurring primarily this month, the use of a bot to complete the task will automate a lot of manual labor (hundreds of TV stations are affected, most of them redirects in Wikipedia) and ensure that my time can go to updating the separate articles that exist and improving coverage of Mexican broadcasting on en.wiki. Raymie (t • c) 04:36, 10 December 2015 (UTC)
Oppose
editTests
editTest 1
editDate: 03:47, 10 December 2015 (UTC)
Site: Test Wikipedia
Machine: Tool Labs
Commit: 75a9513781ab11c660522642c73b074abaa4938e
Simulated? No
Objectives:
- Demonstrate scripts capability to modify a new redirect correctly
- Demonstrate scripts capability to change links from old redirect to new redirect correctly
- Demonstrate scripts capability to work on pages with special characters
Scenario
editThe old redirect, testwiki:Ausdrücklich, has been created and pointed to testwiki:Robert Domes (diff). Many pages have been modified to contain different types of links (some with sections, labels, and linktrails) to the old redirect; some of these pages have special characters in their text and titles (diff 1 2 3).
Action
editThe old redirect will be renamed to testwiki:Äußerung.
Run
|
---|
Command: python scripts/rename_redirect.py -family:test -lang:test -redirectfile:../test1.py -summary:"Bot24 Task #3, Test #1: Bot Action! Renaming redirect" Contents of test1.py: # -*- coding: utf-8 -*- (u"Ausdrücklich", u"Äußerung") Output: Summary: Bot24 Task #3, Test #1: Bot Action! Renaming redirect Moving Ausdrücklich to Äußerung. Ausdrücklich was found. Proceeding... Target: Robert Domes Äußerung doesn't exist. Creating it now... @@ -0,0 +1 @@ + #REDIRECT [[Robert Domes]] Sleeping for 9.4 seconds, 2015-12-10 03:33:32 Page [[Äußerung]] saved Working on: Anton Sterbling @@ -17 +17 @@ - # {{#explode: n/92/120525|/|1}} [[Ausdrücklich#Test Section]] generates: {{#explode: n/92/120525|/|1}} + # {{#explode: n/92/120525|/|1}} [[Äußerung#Test Section]] generates: {{#explode: n/92/120525|/|1}} Sleeping for 9.1 seconds, 2015-12-10 03:33:43 Page [[Anton Sterbling]] saved WARNING: /data/project/bot24/bot24/env/local/lib/python2.7/site-packages/pywikibot/family.py:931: FamilyMaintenanceWarning: Family name wikimediachapter does not match family module name wikimedia Working on: Wikipédia:Escolha do artigo em destaque/Teste @@ -13 +13 @@ - ;Prazo de votação (30 dias): das 20:57 '''UTC''' de 4 de [[Ausdrücklich|This is a label]] April de 2015 até às <section begin="fim do prazo"/>20:57 '''UTC''' de 4 de May de 2015<section end="fim do prazo"/> + ;Prazo de votação (30 dias): das 20:57 '''UTC''' de 4 de [[Äußerung|This is a label]] April de 2015 até às <section begin="fim do prazo"/>20:57 '''UTC''' de 4 de May de 2015<section end="fim do prazo"/> Sleeping for 8.7 seconds, 2015-12-10 03:33:53 Page [[Wikipédia:Escolha do artigo em destaque/Teste]] saved Working on: 21 Ocak @@ -37 +37 @@ - * [[2001]] - [[Filipinler]]'de Devlet Başkan Yardımcısı [[Gloria Arroyo]], sokağın [[Ausdrücklich#Section Test]]linktrail ve ordunun baskısıyla [[Joseph Estrada]]'nın yerine Devlet Başkanı oldu. + * [[2001]] - [[Filipinler]]'de Devlet Başkan Yardımcısı [[Gloria Arroyo]], sokağın [[Äußerung#Section Test]]linktrail ve ordunun baskısıyla [[Joseph Estrada]]'nın yerine Devlet Başkanı oldu. Sleeping for 9.5 seconds, 2015-12-10 03:34:02 Page [[21 Ocak]] saved |
Results
editBot actions:
- The new redirect, testwiki:Äußerung, was created and was pointed to the correct target (diff)
- All links pointing to the old redirect were changed correctly to point to the new redirect (diff 1 2 3)
Bot edits: 4
Conclusion
editAll objectives met. No malfunctions or errors reported.
Test 2
editDate: 04:56, 13 December 2015 (UTC)
Site: Test Wikipedia
Machine: Local machine
Commit: ded72963bd9eb853ec458d58739b782321d9213a
Simulated? No
Objectives:
- Demonstrate that script doesn't save each page with fixed links after every redirect (bundles edits and submits at the end)
Scenario
edittestwiki:List of Redirects has been created with 2 redirects that will be moved (diff).
Action
edittestwiki:Redirect 1 and testwiki:Redirect 2 will be moved to testwiki:New Redirect 1 and testwiki:Redirect 2.
Run
|
---|
Command: python scripts/rename_redirect.py -family:test -lang:test -redirectfile:../redirects.py -summary:"Bot24 Test #2. Bot Action" Contents of redirects.py: # -*- coding: utf-8 -*- (u"Redirect 1", u"New Redirect 1") (u"Redirect 2", u"New Redirect 2") Output: Moving Redirect 1 to New Redirect 1. Redirect 1 was found. Proceeding... Target: Page759 New Redirect 1 doesn't exist. Creating it now... @@ -0,0 +1 @@ + #REDIRECT [[Page759]] Sleeping for 8.6 seconds, 2015-12-13 04:45:01 Page [[New Redirect 1]] saved Working on: Page 982 Working on: List of Redirects Moving Redirect 2 to New Redirect 2. Redirect 2 was found. Proceeding... Target: Test Felix New Redirect 2 doesn't exist. Creating it now... @@ -0,0 +1 @@ + #REDIRECT [[Test Felix]] Sleeping for 7.7 seconds, 2015-12-13 04:45:12 Page [[New Redirect 2]] saved Working on: List of Redirects @@ -2,2 +2,2 @@ - * [[Redirect 1]] + * [[New Redirect 1]] - * [[Redirect 2]] + * [[New Redirect 2]] Sleeping for 8.5 seconds, 2015-12-13 04:45:22 Page [[List of Redirects]] saved @@ -1 +1 @@ - This is a test page that links to a redirect. See, right here: [[Redirect 1]]. This is just a test. Thank you. + This is a test page that links to a redirect. See, right here: [[New Redirect 1]]. This is just a test. Thank you. Sleeping for 9.1 seconds, 2015-12-13 04:45:31 Page [[Page 982]] saved |
Results
editBot actions:
- testwiki:New Redirect 1 and testwiki:New Redirect 2 were created (diff 1 2)
- testwiki:List of Redirects was edited once with all the links fixed for testwiki:Redirect 1 and testwiki:Redirect 2 (diff)
- testwiki:Page 982 was edited to fix a testwiki:Redirect 1 link (diff)
Bot edits: 4
Conclusion
editAll objectives met. No malfunctions or errors reported.