Compare commits
25 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4f31b1a792 | |||
| 3fbfd4ccd7 | |||
| 50b0e142ec | |||
| 14db996a43 | |||
| 110589cb5b | |||
| 5c277495a3 | |||
| a466ab4e74 | |||
| 860a285ab0 | |||
| 2c105336b0 | |||
| ea85ca731f | |||
| 6e119ea98f | |||
| 67aaf3cbbe | |||
| fa13e2a5cf | |||
| 562e689418 | |||
| ae1ee7d6a5 | |||
| 93447d8dc6 | |||
| 1b6faf9e53 | |||
| b4c193eedc | |||
| 788a3df0cd | |||
| 04f591b466 | |||
| 9640467f69 | |||
| bfec2abf98 | |||
| 20103d589d | |||
| e18aa96a84 | |||
| 1dd4c7f87e |
10
README.md
10
README.md
@@ -18,6 +18,16 @@ Those can be installed using pip and the _requirements.txt_ file provided with t
|
|||||||
|
|
||||||
Versions
|
Versions
|
||||||
--------
|
--------
|
||||||
|
* v1.1.1
|
||||||
|
- Check if moved page exists
|
||||||
|
|
||||||
|
* v1.1
|
||||||
|
- Improved page filter
|
||||||
|
|
||||||
|
* v1.0
|
||||||
|
- first stable release
|
||||||
|
- less debug output
|
||||||
|
- fixed problems with article title
|
||||||
* test-v7
|
* test-v7
|
||||||
- Fixed problem with url encoded chars in article title
|
- Fixed problem with url encoded chars in article title
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
# markpages.py
|
# markpages.py
|
||||||
#
|
#
|
||||||
# Copyright 2016 GOLDERWEB – Jonathan Golder <jonathan@golderweb.de>
|
# Copyright 2017 Jonathan Golder <jonathan@golderweb.de>
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -145,14 +145,10 @@ class MarkPagesBot( CurrentPageBot ): # sets 'current_page' on each treat()
|
|||||||
for redfam in self.redfams:
|
for redfam in self.redfams:
|
||||||
|
|
||||||
# We need the talkpage (and only this) of each existing page
|
# We need the talkpage (and only this) of each existing page
|
||||||
for talkpage in pagegenerators.PageWithTalkPageGenerator(
|
for talkpage in redfam.article_generator(
|
||||||
redfam.article_generator(
|
|
||||||
filter_existing=True,
|
filter_existing=True,
|
||||||
exclude_article_status=["marked"] ),
|
exclude_article_status=["marked"],
|
||||||
return_talk_only=True ):
|
talkpages=True ):
|
||||||
|
|
||||||
# Add reference to redfam to talkpages
|
|
||||||
talkpage.redfam = redfam
|
|
||||||
|
|
||||||
yield talkpage
|
yield talkpage
|
||||||
|
|
||||||
@@ -188,14 +184,8 @@ class MarkPagesBot( CurrentPageBot ): # sets 'current_page' on each treat()
|
|||||||
# None if change was not accepted by user
|
# None if change was not accepted by user
|
||||||
save_ret = self.put_current( self.new_text, summary=summary )
|
save_ret = self.put_current( self.new_text, summary=summary )
|
||||||
|
|
||||||
# Normalize title with anchor (replace spaces in anchor)
|
# Get article as named in db
|
||||||
article = self.current_page.toggleTalkPage().title(
|
article = self.current_page.redarticle
|
||||||
asLink=True, textlink=True)
|
|
||||||
article = article.strip("[]")
|
|
||||||
article_parts = article.split("#", 1)
|
|
||||||
if len(article_parts) == 2:
|
|
||||||
article_parts[1] = article_parts[1].replace(" ", "_")
|
|
||||||
article = "#".join(article_parts)
|
|
||||||
|
|
||||||
# Status
|
# Status
|
||||||
if add_ret is None or ( add_ret and save_ret ):
|
if add_ret is None or ( add_ret and save_ret ):
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
# reddiscparser.py
|
# reddiscparser.py
|
||||||
#
|
#
|
||||||
# Copyright 2016 GOLDERWEB – Jonathan Golder <jonathan@golderweb.de>
|
# Copyright 2017 Jonathan Golder <jonathan@golderweb.de>
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
2
jogobot
2
jogobot
Submodule jogobot updated: 49ada2993e...d69d873624
@@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
# mysqlred.py
|
# mysqlred.py
|
||||||
#
|
#
|
||||||
# Copyright 2015 GOLDERWEB – Jonathan Golder <jonathan@golderweb.de>
|
# Copyright 2017 Jonathan Golder <jonathan@golderweb.de>
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -51,10 +51,11 @@ url = URL( "mysql+pymysql",
|
|||||||
password=config.db_password,
|
password=config.db_password,
|
||||||
host=config.db_hostname,
|
host=config.db_hostname,
|
||||||
port=config.db_port,
|
port=config.db_port,
|
||||||
database=config.db_username + jogobot.config['db_suffix'],
|
database=( config.db_username +
|
||||||
|
jogobot.config['redundances']['db_suffix'] ),
|
||||||
query={'charset': 'utf8'} )
|
query={'charset': 'utf8'} )
|
||||||
|
|
||||||
engine = create_engine(url, echo=True)
|
engine = create_engine(url, echo=False)
|
||||||
|
|
||||||
|
|
||||||
Session = sessionmaker(bind=engine)
|
Session = sessionmaker(bind=engine)
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
# redfam.py
|
# redfam.py
|
||||||
#
|
#
|
||||||
# Copyright 2017 GOLDERWEB – Jonathan Golder <jonathan@golderweb.de>
|
# Copyright 2018 Jonathan Golder <jonathan@golderweb.de>
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -514,7 +514,8 @@ class RedFamWorker( RedFam ):
|
|||||||
def article_generator(self, # noqa
|
def article_generator(self, # noqa
|
||||||
filter_existing=None, filter_redirects=None,
|
filter_existing=None, filter_redirects=None,
|
||||||
exclude_article_status=[],
|
exclude_article_status=[],
|
||||||
onlyinclude_article_status=[] ):
|
onlyinclude_article_status=[],
|
||||||
|
talkpages=None ):
|
||||||
"""
|
"""
|
||||||
Yields pywikibot pageobjects for articles belonging to this redfams
|
Yields pywikibot pageobjects for articles belonging to this redfams
|
||||||
in a generator
|
in a generator
|
||||||
@@ -528,6 +529,8 @@ class RedFamWorker( RedFam ):
|
|||||||
set to False to get only redirectpages,
|
set to False to get only redirectpages,
|
||||||
unset/None results in not filtering
|
unset/None results in not filtering
|
||||||
@type filter_redirects bool/None
|
@type filter_redirects bool/None
|
||||||
|
@param talkpages Set to True to get Talkpages instead of article page
|
||||||
|
@type talkpages bool/None
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -591,6 +594,34 @@ class RedFamWorker( RedFam ):
|
|||||||
except Break:
|
except Break:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
# Follow moved pages
|
||||||
|
if self.article_has_status( "redirect", title=article ):
|
||||||
|
try:
|
||||||
|
page = page.moved_target()
|
||||||
|
|
||||||
|
# Short circuit if movement destination does not exists
|
||||||
|
if not page.exists():
|
||||||
|
continue
|
||||||
|
|
||||||
|
except pywikibot.exceptions.NoMoveTarget:
|
||||||
|
pass
|
||||||
|
|
||||||
|
# Exclude Users & User Talkpage
|
||||||
|
if page.namespace() == 2 or page.namespace() == 3:
|
||||||
|
self.article_add_status( "user", title=article )
|
||||||
|
continue
|
||||||
|
|
||||||
|
# Toggle talkpage
|
||||||
|
if talkpages and not page.isTalkPage() or\
|
||||||
|
not talkpages and page.isTalkPage():
|
||||||
|
page = page.toggleTalkPage()
|
||||||
|
|
||||||
|
# Add reference to redfam to pages
|
||||||
|
page.redfam = self
|
||||||
|
|
||||||
|
# Keep article title from db with page object
|
||||||
|
page.redarticle = article
|
||||||
|
|
||||||
# Yield filtered pages
|
# Yield filtered pages
|
||||||
yield page
|
yield page
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
# redpage.py
|
# redpage.py
|
||||||
#
|
#
|
||||||
# Copyright 2015 GOLDERWEB – Jonathan Golder <jonathan@golderweb.de>
|
# Copyright 2017 Jonathan Golder <jonathan@golderweb.de>
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
2
red.py
2
red.py
@@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
# reddiscparser.py
|
# reddiscparser.py
|
||||||
#
|
#
|
||||||
# Copyright 2016 GOLDERWEB – Jonathan Golder <jonathan@golderweb.de>
|
# Copyright 2017 Jonathan Golder <jonathan@golderweb.de>
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
Reference in New Issue
Block a user