User:RSW image renamer/Source
This page links to the 2 source code files for RSW image renamer.
MediaWiki.java[edit | edit source]
The package for this file is org.mediawiki. Make sure you save this file to org/mediawiki/MediaWiki.java on your local filesystem if you download it. (That is, create the folder 'org', then 'mediawiki' inside it, then save the file in 'mediawiki').
ImageRenamerBot.java[edit | edit source]
The package for this file is com.wikia.runescape. Make sure you save this file to com/wikia/runescape/ImageRenamerBot.java on your local filesystem if you download it.
Tools required[edit | edit source]
In addition to the two compiled Java source files, the following tool is required:
Installation instructions are found on the project's page.
Compiling[edit | edit source]
javac org/mediawiki/MediaWiki.java com/wikia/runescape/ImageRenamerBot.java
If using the javac command, it needs to be used in the folder containing 'org' and 'com'. For example, if you saved the two files as
you would use this command before javac to change to the correct directory:
Configuration[edit | edit source]
This bot uses a configuration file to do its work. Its location is $HOME/.imgmovebot.conf. ($HOME is going to be /home/youruser on Unix, /Users/You on Mac OS, and C:\Documents and Settings\You or C:\Users\You on Windows.) Here is a brief description of each configuration directive:
- Wiki=runescape.wikia.com (this is the domain of the wiki to work on)
- RequestPage=User:RSW image renamer/Requests (this is the name of the request page under the wiki's domain)
- LastRequestRevision=589252 (this is a variable that gets set by the bot; when transferring the bot to another user to run, this must be preserved to avoid spamming user talk pages with move errors for files that have already been moved long ago)
- RunInterval=180 (this is the number of seconds to wait between reads of the RequestPage)
- LoginName=RSW image renamer
This bot can be safely stopped using Ctrl+C, even in the middle of its processing. It saves a list of actions to the hard drive, at $HOME/.imgmovebot-leftover.ser, to be continued when it next starts. When empty, this file is 56 bytes, but it can grow to several megabytes.
Running[edit | edit source]
The bot can then be launched from the command line, using this command in the correct directory:
Logging to a file[edit | edit source]
If you wish to log to a file, and are running Windows XP, Unix, Linux or Mac OS X, you can start the bot with this command instead:
java com.wikia.runescape.ImageRenamerBot 2>> log.log