Hi guys! I have modified the script and fixed some bugs of 'Friends Stalker!' and if you have the old one, please replace the code with new one.
For those who missed the last blog, 'Friends Stalker!' script will help you to know (**in real time**):
- if your friend has submitted a code on codeforces, along with its verdict and problem name through an alert on your screen.This works on contest time too, so that you won't have to open 'friends standings' page to know how many problems your friends have successfully solved or attempted!
- You won't have to check for system test results in every 2 minutes. You can leave script running in background and it will let you know the result of your submissions along with your friends in no delay!!
- If you are participating in a team but team members are at different locations, you will know quickly your teammate's submissions and results.
- You will have a record on your terminal/ command prompt of the last submissions of your friends.
So lets go quickly to installation:
Make sure you have python2.7 or higher installed. Script is written python. If you write python in your terminal/cmd, it should give you the information about the python version and your OS. (take note if you have 32 or 64 bit OS).
Make a folder named
tool
anywhere you like.Inside tool folder, make a file named
codeforces.py
and copy the code from here .(Since ideone screws up the code and alters it, I used a random problem to submit the code, I hope noone will mind it).Inside tool folder make a text file named
friends.txt
. Inside this file, copy-paste the handles of your friends separated by spaces .Make sure you paste correct spelling of handles as codeforces!!Through terminal/cmd, go to the tool directory and run
python codeforces.py friends.txt
.Voila!! You are good to go and will recieve a alert whenever your friend submits code.
Possible errors :
You might recieve an error telling easygui
module is not found! So you need to install this module with command
Linux based users :
sudo pip install easygui
Windows users : open
cmd
with administrator privilages (run as administrator). and typepip install easygui
If you still get an error telling something like 'pip not found' then :
Linux based users try this link
Windows users can try this youtube video i found link .It's an easy walkthrough to install pip.
Now install 'easygui' module! Done!!
Now if you are OK with canceling the alert through pressing enter key whenever it appears, everything is completed for you! Enjoy the script :)
But the users who have a 'lot' of friends may find annoying to cancel each alert by pressing enter! So HellKitsune suggested me to implement a massanger type notification which appears at corner and goes away automatically! I was able to find a way to implement this but unfortunately it is working for Linux based users only. (Since python-notify module is not available in windows!). I have written a script for windows too but I don't know if it is working since I have ubuntu machine. I will post the windows script also but someone has to tell me if it is working or not! So lets go to scripts for automatic close notification feature!!
- For LINUX based OS users :(very easy!)
just run the command
sudo apt-get install python-notify
.replace the code inside codeforces.py with code in this link
run command
python codeforces.py friends.txt
done!! now you dont have to close alert everytime it appear.
- For Windows users — (may or may not be working)
You have to download pywin32 library from here. Make sure you choose the right python version and OS (32 or 64bit) file. Installing is pretty easy since the user has given instruction below the page very clearly!!
replace the code inside codeforces.py with code in this link
run command
python codeforces.py friends.txt
.tell me if it worked or not :D (I am grateful and you are a big contributor :) )
Inside codeforces.py : (known as readme.txt, please read)
There are few changes you would want to make according to you preferences like :
I have left
flag = True
at start so that it will be easy to know if notifications are successfully coming. After checkin first time,setflag = False
so that you wont have to cancel bunch of pop-ups everytime you run script!I have checked last 15 solutions of a user in script. You may wanna increase or decrease this.
I have set the script to check CF every 3 minutes. You can increase or (please don't) decrease this count. Less count will check codeforces more often and it can cause site run slow if lot of users set this less. I had set 3 minutes for testing purposes.
So with thats all done, you might have just one more question, "what happened to your last blog?"
Answer is I deleted that mistakenly ;_; I thought like comments a blog can't be deleted permanently too and will discard the current change. I am very sad about it (That blog had 80-85 upvotes!!). Well whats done is done.
Now if you find bugs or want to suggest new features, please comment me. If you want to add a new feature yourself, feel free. I have commented almost everything in the code so it is very easy to understand. If you have any trouble in installing please comment below but try googling your error first. If you have found an error but fixed it yourself, then tell others too and save them from some trouble!! I am sure this script will save some time for you.
Last but not the least, thanks to Mike and other codeforces admins for providing free API. Thank you awoo for all you help, many bugs i fixed by his help :)
Cheers!!