Gebruiker:Valhallasw/catmove
Uiterlijk
Nodig:
Ik gebruik hiervoor:
- recur-move.pl
#!/usr/bin/perl @a = `bash getcats $ARGV[0]`; printf("Need to work on ".@a." cat pages\n"); foreach my $titel (@a) { chomp($titel); printf("-Working on: ".$titel.": \n"); @b = `bash mvCat $titel`; printf("@b"); }
- getcats
rm category.dump.bz2 > /dev/null echo -e "$1\n" | python2.3 category.py tree | grep -e '^#\[\[' | grep -e '([1-9]' | sed 's/\#\[\[:Categorie://g' | sed 's/|.*//g'
- mvCat
echo -e "$1" | python2.3 category_v.py remove | grep -e 'Changing page'
- category_v.py
Wijziging van category.py, unified diff:
--- category.py 2006-03-12 18:34:04.000000000 +0100 +++ category_v.py 2006-06-05 18:41:24.000000000 +0200 @@ -585,6 +585,8 @@ action = 'remove' elif arg == 'move': action = 'move' + elif arg == 'move-redir': + action = 'move-redir' elif arg == 'tidy': action = 'tidy' elif arg == 'tree': @@ -593,7 +595,7 @@ sort_by_last_name = True elif arg == '-rebuild': catDB.rebuild() - + if action == 'add': add_category(sort_by_last_name) elif action == 'remove': @@ -605,7 +607,18 @@ newCatTitle = wikipedia.input(u'Please enter the new name of the ca tegory:') bot = CategoryMoveRobot(oldCatTitle, newCatTitle) bot.run() - elif action == 'tidy': + elif action == 'move-redir': + oldCatTitle = wikipedia.input(u'Please enter the category name:') + temppage = wikipedia.Page(wikipedia.getSite(), "Categorie:"+oldCatTi tle) + if temppage.isRedirectPage(): + newCatTitle = wikipedia.Page(wikipedia.getSite(),temppage.getRed irectTarget()).titleWithoutNamespace() + + bot = CategoryMoveRobot(oldCatTitle, newCatTitle) + bot.run() + else: + wikipedia.output(u"ja, of niet :9") + + elif action == 'tidy': catTitle = wikipedia.input(u'Which category do you want to tidy up? ') bot = CategoryTidyRobot(catTitle, catDB) bot.run()
Getcats haalt een lijst met subcats op en geeft alle subcats met op zn minst een artikel. Recur.pl gaat deze af en laat op iedere subcat mvCat lopen die de cat van alle pagina's haalt goedzet.
Doel: Categorie:Redirect_van_categorie leeghouden