Forums › English Language Forums › General › General Discussion

Search

Guild log manager in Python

4 replies [Last post]
Sun, 02/15/2015 - 16:27
Krakob's picture
Krakob

GitHub repository
Development for this tool is at a halt and I might not resume anytime soon.

It's a thing for the logs and all. I can't be bothered writing a thread for now but the code is well documented (by my standards) and there is a readme.

Currently, it doesn't have any proper features so if you're a user, this is not interesting to you. Go away. Wait a month or something until I've worked more on it, then come back.

Sun, 02/15/2015 - 17:53
#1
Bopp's picture
Bopp
see also

See also the two solutions mentioned in this thread:

http://forums.spiralknights.com/en/node/71766

Mon, 02/16/2015 - 04:26
#2
Krakob's picture
Krakob

I'm aware of those. However, I intend to develop more/different functionality. One problem with Heruncle's app is
In order to set this up, you'll need a web server with PHP and MySQL, and some basic knowledge of PHP and MySQL for installation and configuration
With a Python script, one can make it function on any computer, create executables that just work without having the user install stuff, et cetera. Right now my priorities are to make a good foundation for this and then develop a GUI. After that, I might be able to make a web application using Django but I have no experience with developing for the web.

Mon, 02/16/2015 - 06:35
#3
Bopp's picture
Bopp
agree

Yes, a Python script is easier to set up than a web server (in that it requires no set-up at all). Notice that the second solution in that thread is a simple Python script. It doesn't seem very polished, though. So it's nice that you're trying to make something better.

Wed, 04/08/2015 - 19:34
#4
Mynameis-Seven's picture
Mynameis-Seven
Python Script for Managing Guild Logs

I have an application i made for my guild that is essentially the same, but I have terrible code documentation and it is rather hard to follow. I will attempt to document it better in the near future. It can currently handle name changes, and the duplication as you have specified in your todo. If you'd like to see my terrible yet functional code, i can send you a link from my dropbox or i can add you to the project if you have a dropbox. Mine acts more like it generates a database of events based on the guild log, and then displays them through a client.

Some thoughts/ideas from your todo:

I handle the renaming through a refactoring of all the log events to change the specified knight's name to the new name. It permanently modifies the database, but it was the only reasonable way i could think of to maintain the names without having the chance for a potential conflict.
i.e. Bopp namechanges to Krakob, and Zeddy namechanges to Bopp. If you use an ID system and associate names with ID's, then there will be a collision in the database with Bopp because Bopp has logs that still contain "Bopp" as the knight. To fix this, for each name change I perform a complete refactorization of the copy of the logs i keep in a database. Because of this, I have to generalize the primary identifier to be the timestamp. This forefits the usage of any other elements of the log entry as an identifier since it's subject to change. If you were to add a duplicate entry with the same timestamp with a namechanged knight, my database would not add it since the timestamp that you're adding is not a new time stamp.

I have not implemented a storage withrdawl/deposit within my guild program because of the nature by which I have to add each log entry, but i did make a seperate tool for it using the same strategy I used for the treasury deposits. I paired the date with the treasury deposit amount. The difference with the treasury and the storage, is that with storage there's 2 regex you need.

recipe_pattern1 = re.compile("(Added|Removed) (.*) Recipe (to|from) officer storage")
recipe_pattern2 = re.compile("(Added|Removed) (.*) Recipe (\(\d+ copies\))* (to|from) officer storage")

These are for our officer storage, but can be generalized for use with any storage.
recipe_pattern1 = re.compile("(Added|Removed) (.*) Recipe (to|from) (officer|veteran|member) storage")

The 2nd pattern returns a number of copies if more than 1 were to be deposited along with whether or not they were added or removed and from what storage.
I use the groups() function of the re match object to get the relevant parameters.
For your purpose i think you could generalize the storage to being something like these.
re.compile("(Added|Removed) (.*) (to|from) (officer|veteran|member) storage")
re.compile("(Added|Removed) (.*) (\(\d+ copies\))* (to|from) officer storage")

For the crowns, i used this simple re:
re.compile("Added (.*) crowns to the guild treasury.")

If you would like to see my code I would be glad to add you to my dropbox folder (if you have one, if not i'll just send you a link), but i have not set up any of my code for github yet.

Powered by Drupal, an open source content management system