Ejemplo n.º 1
0
    liste_raccourcis = ['ra', 'dph']

    for raccourci in liste_raccourcis:
        #try:
        pywikibot.output(u"""
************************************************
|              TRAITEMENT DE %s              |
************************************************""" % raccourci)
        bot = TreatementBot(raccourci=raccourci)
        bot.traitement()
        pywikibot.output(u"""
************************************************
|          FIN DU TRAITEMENT DE %s            |
************************************************""" % raccourci)
        #except Exception, myexception:
        #	pywikibot.output(u'erreur lors du traitement de %s' % raccourci)
        #	pywikibot.output(u'%s %s' % (type(myexception), myexception.args))
        #	continue


if __name__ == '__main__':
    try:
        main()
    except Exception, myexception:
        almalog2.error(u'sysops_archives_new',
                       u'%s %s' % (type(myexception), myexception.args))
        pywikibot.output(u'%s %s' % (type(myexception), myexception.args))
        raise
    finally:
        almalog2.writelogs(u'sysops_archives_new')
        pywikibot.stopme()
Ejemplo n.º 2
0
		locale.setlocale(locale.LC_ALL, 'fr_FR')
	
	liste_raccourcis = ['ra', 'dph']
	
	for raccourci in liste_raccourcis:
		#try:
		pywikibot.output(u"""
************************************************
|              TRAITEMENT DE %s              |
************************************************""" %  raccourci)
		bot = TreatementBot(raccourci = raccourci)
		bot.traitement()
		pywikibot.output(u"""
************************************************
|          FIN DU TRAITEMENT DE %s            |
************************************************""" %  raccourci)
		#except Exception, myexception:
		#	pywikibot.output(u'erreur lors du traitement de %s' % raccourci)
		#	pywikibot.output(u'%s %s' % (type(myexception), myexception.args))
		#	continue
	
if __name__ == '__main__':
    try:
        main()
    except Exception, myexception:
        almalog2.error(u'sysops_archives_new', u'%s %s'% (type(myexception), myexception.args))
        pywikibot.output(u'%s %s' % (type(myexception), myexception.args))
        raise
    finally:
        almalog2.writelogs(u'sysops_archives_new')
        pywikibot.stopme()
Ejemplo n.º 3
0
			pywikibot.output("%s is blocked but a request has already been made"  % username)
	
	if not database:
		#database=MySQLdb.connect(host='sql', db='u_totoazero_unblocks', read_default_file="/home/totoazero/.my.cnf", use_unicode=True)
		database=_mysql.connect(host='sql', db='u_totoazero_unblocks', read_default_file="/home/totoazero/.my.cnf")
	database.query('SELECT username FROM unblocks')
	results=database.store_result()
	result=results.fetch_row(maxrows=0)
	for res in result:
		if res[0].decode('utf-8') not in userlist:
			pywikibot.output("Removing %s"% res[0])
			database.query('DELETE FROM unblocks WHERE username="******"' % res[0])

	if text:
		put_text(text, usernames_blocked)


if __name__ == '__main__':
	try:
		global debug
		debug = False
		main()
	except Exception, myexception:
		if not debug:
			almalog2.error(u'unblock', u'%s %s'% (type(myexception), myexception.args))
		raise
	finally:
		almalog2.writelogs(u'unblock')
		pywikibot.stopme()

Ejemplo n.º 4
0
		
	site = pywikibot.Site()
	now = datetime.now()
	
	page = pywikibot.Page(site, u"Wikipédia:Le Bistro/%i %s" % (int(now.strftime("%d")), now.strftime("%B %Y").decode('utf-8')))
	
	text = page.get()
	text_part = text[text.index(u"\n== Aujourd'hui, dans Wikipédia =="):]
	text_part_old = text_part
	text_part = text_part.replace(u"Actuellement, Wikipédia compte", u"Le ~~~~~, Wikipédia comptait")
	text_part = text_part.replace(u"{{NUMBEROFARTICLES}}", u"{{subst:NUMBEROFARTICLES}}")
	text_part = text_part.replace(u"{{Nombre d'articles de qualité}}", u"{{subst:formatnum:{{subst:#expr:{{subst:PAGESINCATEGORY:Article de qualité|R}}-3}}}}")
	text_part = text_part.replace(u"{{Nombre de bons articles}}", u"{{subst:formatnum:{{subst:#expr:{{subst:PAGESINCATEGORY:Bon article|R}}-3}}}}")
	text_part = text_part.replace(u"{{Nombre d'articles géolocalisés sur Terre}}", u"{{subst:formatnum:{{subst:#expr:{{subst:PAGESINCATEGORY:Article géolocalisé sur Terre|R}}}}}}")
	
	text = text.replace(text_part_old, text_part)
	
	page.put(text, comment = u"Statistiques fixes dans la section [[#Aujourd.27hui.2C_dans_Wikip.C3.A9dia|#Aujourd'hui, dans Wikipédia]]")
	
	
if __name__ == '__main__':
    try:
        main()
    except Exception, myexception:
        almalog2.error(u'stats_bistro', u'%s %s'% (type(myexception), myexception.args))
        #print u'%s %s' % (type(myexception), myexception.args)
        raise
    finally:
        almalog2.writelogs(u'stats_bistro')
        pywikibot.stopme()
Ejemplo n.º 5
0
                                                       minorEdit=False)
                    except:
                        pywikibot.output(
                            u'erreur lors de la publication du message !')
                        continue

                # Enregistrer la requête comme analysée par le bot
                self.database.query(
                    'INSERT INTO drp VALUES ("%s", "%s", CURRENT_TIMESTAMP)' %
                    (titre_section_SQL.replace('"', '\\"').encode('utf-8'),
                     statut_actuel.encode('utf-8')))


def main():
    locale.setlocale(locale.LC_ALL, 'fr_FR.utf8')
    bot = WarnBot()
    bot.traitement()


if __name__ == '__main__':
    try:
        main()
    except Exception, myexception:
        almalog2.error(u'drp_warn',
                       u'%s %s' % (type(myexception), myexception.args))
        #print u'%s %s' % (type(myexception), myexception.args)
        raise
    finally:
        almalog2.writelogs(u'drp_warn')
        pywikibot.stopme()
Ejemplo n.º 6
0
                    if not origtext==finaltext:
                        pywikibot.output('**** Traitement de %s (et %s)' % (projectpage.title(), linkedpage.title()))
                        commandLogFile.write(u'* Traitement de [[%s]]\r\n' % projectpage.title())
                        if (debug==0) or (debug==3):
                            projectpage.put(finaltext, u'Catégorisation en projet des pages de traduction')
                        elif debug==2:
                            newpage=pywikibot.Page(site, u'Utilisateur:'+botName+'/Test')
                            newpage.put(origtext, u'Texte original de [[%s]]' % projectpage.title())
                            newpage.put(finaltext, u'Nouveau texte de [[%s]]' % projectpage.title())
                
            if (len(addedprojects)>=60):
                createcategories(addedprojects, debug, commandLogFile)
                addedprojects=list()
    
    if (len(addedprojects)>0):
        createcategories(addedprojects, debug, commandLogFile)

    
    #pywikibot.output(u'Total %d' % total)
        
    
if __name__ == '__main__':
    try:
        main()
    except Exception, myexception:
        almalog2.error(u'translation', u'%s %s'% (type(myexception), myexception.args))
        raise
    finally:
        almalog2.writelogs(u'translation')
        pywikibot.stopme()
Ejemplo n.º 7
0
					pywikibot.output(newtext)
				
				
				comment = self.resume % {'titre_page': titre_page_concernee}
				pywikibot.output(comment)
				
				try:
					page_discussion_demandeur.put(newtext, comment=comment, minorEdit=False)
				except:
					pywikibot.output(u'erreur lors de la publication du message !')
					continue
				
				# Enregistrer la requête comme analysée par le bot
				self.database.query('INSERT INTO drp VALUES ("%s", "%s", CURRENT_TIMESTAMP)' % (titre_section_SQL.replace('"', '\\"').encode('utf-8'), statut_actuel.encode('utf-8')))


def main():
	locale.setlocale(locale.LC_ALL, 'fr_FR.utf8')
	bot = WarnBot()
	bot.traitement()
	
if __name__ == '__main__':
    try:
        main()
    except Exception, myexception:
        almalog2.error(u'drp_warn', u'%s %s'% (type(myexception), myexception.args))
        #print u'%s %s' % (type(myexception), myexception.args)
        raise
    finally:
        almalog2.writelogs(u'drp_warn')
        pywikibot.stopme()
Ejemplo n.º 8
0
                        elif debug == 2:
                            newpage = pywikibot.Page(
                                site, u'Utilisateur:' + botName + '/Test')
                            newpage.put(
                                origtext, u'Texte original de [[%s]]' %
                                projectpage.title())
                            newpage.put(
                                finaltext, u'Nouveau texte de [[%s]]' %
                                projectpage.title())

            if (len(addedprojects) >= 60):
                createcategories(addedprojects, debug, commandLogFile)
                addedprojects = list()

    if (len(addedprojects) > 0):
        createcategories(addedprojects, debug, commandLogFile)

    #pywikibot.output(u'Total %d' % total)


if __name__ == '__main__':
    try:
        main()
    except Exception, myexception:
        almalog2.error(u'translation',
                       u'%s %s' % (type(myexception), myexception.args))
        raise
    finally:
        almalog2.writelogs(u'translation')
        pywikibot.stopme()