Skip to content

gaurav8297/macefash

 
 

Repository files navigation

macefash

personal FaceMash clone


Inspiration

The Social Network - Facemash Scene

Live version

The platform is currently running here.

vote page on desktop

(Older version)

vote page mobile

Requirements

You need to have python2.7 installed (python3.4 should probably require slight adjustments to the code), as well as Flask (+ some plugins), SQLAlchemy, and authomatic (for the Facebook API).

sudo apt-get install python2.7 python-flask python-flask-sqlalchemy
sudo pip install matplotlib numpy scipy
sudo pip install authomatic flask-debugtoolbar Flask-Cache

This should be enough to get you covered. Additional tinkering might be necessary.

How to deploy

First off, the database needs to be generated. In order to achieve this, run the following command:

python databaseGenerator.py

This will parse the local files (placed in static/cns/) and scrape all profile links from them. In addition to the profiles, the generator will also add a few themes for the website. Afterwards, each person's facebook ID is obtained and added to the database.

Profiles can be added to the local files in the following format:

  • all files must be placed in static/cns/
  • filenames must contain a number (8-12, depending on the grade) and a letter (a-i, depending on the class specialization); it is ok if some files are inexistent.
  • each file contains the respective class' students, one on each line, as follows: GENDER_LETTER FULL_NAME FACEBOOK_PROFILE_URL (note: GENDER_LETTER can be either B for male or F for female; I should change this in the future, so that English equivalents are used). Check the existing files for clarification.

Note: the script does not overwrite existing entries, so it can be safely executed in case of more profile links having been recently added to the local files. Only the new entries will suffer any changes. Keep in mind that some of them might need to be manually classified into genders (through the genderHelp interface).

Macefash can be run locally (on port 8080, by default) using the following command:

python main.py

The port can be changed in the last line of the file:

    app.run(host='0.0.0.0', port=8080, threaded=True, debug=SETTINGS['debug'])

Using the debug=True flag is not recommended for production use. The flag can be set in the settings.py config file.

You should now be able to access the platform on localhost:8080 :D.

Resetting ratings

In case of any significant change to the rating system, all stats can be recomputed by simulating each real world vote. There are two different rating functions implemented:

  • The TopCoder Component Development Rating function - which is probably bugged. Ratings are considerably more sensible to losses than to wins, and they tend to converge in time.
  • A more basic Elo Rating function. So far, this looks promising.

The computeRatings.py module takes you through the process of recomputing all votes based on the Elo Rating function. It can also generate a rating evolution graph for any person (png format, stored in the static/graphs/ directory). Note that this is experimental and should only be used for checking whether or not the rating system behaves properly.

You should back up your database before attempting to reset ratings.

Updating profile pictures

Since version 3.1, the platform caches profile pictures whenever they are missing from the server. This allows for greater control over what appears and what does NOT appear on macefash (there should also be some performance improvement). For example, if someone decides to close their account (or change their profile picture to this), the change does not take place immediately. Instead, you can update all (or some of the) profile pictures at the same time, and manage the unadequate ones manually.

This method ensures that you will not stumble upon any white-head-on-grey-background picture while voting.

By default, pictures are saved when they are requested (make sure that the static/pics/ directory exists, though). The following command updates all of them:

python -c "from cacheSystem import *; buildEntireCache()"

The cacheSystem.py file also provides a method for updating specific pictures. Most of the time, there is no need for this.

About

personal FaceMash clone

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 49.4%
  • HTML 31.8%
  • Shell 15.3%
  • CSS 3.0%
  • JavaScript 0.5%