Difference between pages "Tasklist for EventB meta model development" and "User:Mathieu/bot"

From Event-B
(Difference between pages)
Jump to navigationJump to search
imported>Colin
 
imported>Mathieu
m (Add a category to the last uploaded images)
 
Line 1: Line 1:
{| cellpadding="5" cellspacing="0" border="1"
+
A bot may be a useful tool to help a wiki maintenance.
!What
+
 
!Who
+
I tried to use the python framework provided by http://pywikipediabot.sourceforge.net/. Hereafter are some guidelines to make it work on this wiki.
!When
+
 
|-
+
== Requirements ==
|Input for deliverable on wiki
+
* Python >2.5
|C, F
+
 
|Dec 2009
+
== Getting pywikipedia framewok ==
|-
+
Get the source code from subversion:
|Basic documentation on wiki-WIP
+
<pre><nowiki>
|A, C, F
+
(prompt) svn co http://svn.wikimedia.org/svnroot/pywikipedia/trunk/pywikipedia pywikipedia
|January 2009
+
</nowiki></pre>
|-
+
== Configuring the framework for this wiki ==
|Text tools (partitially)
+
Add the following <tt>families/eventb_family.py</tt> file (be careful with the indentation):
|F
+
<pre><nowiki>
|January 2009
+
# -*- coding: utf-8  -*-
|-
+
 
|Presentation for tooling meeting
+
import family
|A
+
# The event-b family
|January (end) 2009
+
# user-config.py: usernames['event-b']['event-b'] = 'User name'
|-
+
class Family(family.Family):
|Investigate EMF Compare
+
    def __init__(self):
|A
+
        family.Family.__init__(self)
|March 2009
+
        self.name = 'eventb'
|-
+
        self.langs = {
|Implement persistence API
+
            'eventb': 'wiki.event-b.org',
|C,F
+
        }
|May 2009
+
 
|-
+
        self.namespaces[4] = {
|Finalize EMF model
+
            '_default': [u'Event-B', self.namespaces[4]['_default']],
|C, F
+
        }
|June 2009
+
 
|-
+
        self.namespaces[5] = {
|Detailed documentation
+
          '_default': [u'Event-B talk', self.namespaces[5]['_default']],
|C, F
+
        }
|June 2009
+
 
|-
+
    def version(self, code):
|Text editor released
+
        return '1.11'
|F
+
 
|June 2009
+
    def path(self, code):
|-
+
        return '/index.php' #The path of index.php, look at your wiki address.
|Project diagram
+
 
|C
+
    def scriptpath(self,code):
|July 2009
+
        return ''
|-
+
   
|Presentation for Rodin workshop
+
#    def shared_image_repository(self, code):
|C, F
+
#        return ('commons', 'commons')
|July 2009
+
      '_default': [u'Event-B talk', self.namespaces[5]['_default']],
|-
+
</nowiki></pre>
|Records Extension
+
 
|C
+
Then add the following <tt>user-config.py</tt> file:
|Sept 2009
+
<pre><nowiki>
|-
+
family='eventb'
|Team-working tools
+
mylang='eventb'
|?
+
usernames['eventb']['eventb'] = 'your_bot_user_name'
|Sept 2009
+
</nowiki></pre>
|-
+
 
|Migrate pattern editor
+
== Usage ==
|A
+
=== Login ===
|Sept 2009
+
First you should log in:
|-
+
<pre><nowiki>
|UML-B Rewrite
+
(prompt) python login.py
|C
+
</nowiki></pre>
|Jan 2010
+
=== Upload Images ===
|}
+
<pre><nowiki>
[[Category:Organization]]
+
(prompt) python upload.py -noverify -keep file.png "Image description"
 +
</nowiki></pre>
 +
 
 +
For uploading several images from a directory, I use the following ''sh'' command:
 +
<pre><nowiki>
 +
for i in /tmp/imagedir/* ; do (yes | python upload.py -v -noverify -keep $i "Import of image $i"); done
 +
</nowiki></pre>
 +
 
 +
 
 +
=== Add a category to the last uploaded images ===
 +
For the last 20 images, do :
 +
<pre><nowiki>
 +
python category.py -v add -newimages:20
 +
</nowiki></pre>

Revision as of 12:25, 10 July 2008

A bot may be a useful tool to help a wiki maintenance.

I tried to use the python framework provided by http://pywikipediabot.sourceforge.net/. Hereafter are some guidelines to make it work on this wiki.

Requirements

  • Python >2.5

Getting pywikipedia framewok

Get the source code from subversion:

(prompt) svn co http://svn.wikimedia.org/svnroot/pywikipedia/trunk/pywikipedia pywikipedia

Configuring the framework for this wiki

Add the following families/eventb_family.py file (be careful with the indentation):

# -*- coding: utf-8  -*-

import family
# The event-b family
# user-config.py: usernames['event-b']['event-b'] = 'User name'
class Family(family.Family):
    def __init__(self):
        family.Family.__init__(self)
        self.name = 'eventb'
        self.langs = {
            'eventb': 'wiki.event-b.org',
        }

        self.namespaces[4] = {
            '_default': [u'Event-B', self.namespaces[4]['_default']],
        }

        self.namespaces[5] = {
           '_default': [u'Event-B talk', self.namespaces[5]['_default']],
        }

    def version(self, code):
        return '1.11'

    def path(self, code):
         return '/index.php' #The path of index.php, look at your wiki address. 

    def scriptpath(self,code):
        return ''
    
#    def shared_image_repository(self, code):
#        return ('commons', 'commons')
      '_default': [u'Event-B talk', self.namespaces[5]['_default']],

Then add the following user-config.py file:

family='eventb'
mylang='eventb'
usernames['eventb']['eventb'] = 'your_bot_user_name'

Usage

Login

First you should log in:

(prompt) python login.py 

Upload Images

(prompt) python upload.py -noverify -keep file.png "Image description"

For uploading several images from a directory, I use the following sh command:

for i in /tmp/imagedir/* ; do (yes | python upload.py -v -noverify -keep $i "Import of image $i"); done


Add a category to the last uploaded images

For the last 20 images, do :

python category.py -v add -newimages:20