Forum New Posts Notifier for NiftyHost
11-15-2010, 08:18 PM, (This post was last modified: 05-30-2011, 12:21 AM by RichardGv.)
#1
Smile  Forum New Posts Notifier for NiftyHost
I just wrote a script that notifies users of new posts on NiftyHost Forums. (Actually it's generic forum new post notifier that supports more than one forum.)

Current version: 0.01 Pre-Alpha 1 Developmental Preview 20110428 Nightly (I'm trying to break the world record of the longest software version number! :D )

Features:
It does what its name implies: Periodically send a request to forums and filter the response to find new posts. It then can display a message in the terminal, or execute a set of commands to show a notification window, or play some sound. (On POSIX systems, like Linux or BSD, it additionally provides shell-quoted strings for the commands.)
It shows unread posts in "View new posts" page (you may change it to "View daily posts", though), so sometimes it won't show all unread posts. If NiftyHost Forums has a plugin like View Unread Posts, after a small modification my script should be able to display all unread posts.

It's only tested on my Gentoo box. In fact I'm too lazy to reboot to Windows to test it. :) Theoretically, it should work on any platform where Python runs on, this includes Windows, Linux, BSD, Mac OS X, Darwin, Nintendo DS, Nokia N800, Nokia N810, Xbox, and PlayStation 2/3 (provided that there's an Internet connection). Use it at your own risk. It may burn your CPU and I won't offer you a compensation if that happens! :D

Changelog:
Nightly May 29th:
Nightly April 28th: http://www.niftyhost.us/support/thread-7...ml#pid8894
Nightly 20110408: http://www.niftyhost.us/support/thread-7...ml#pid8536
Nightly 20101118: http://www.niftyhost.us/support/thread-7...ml#pid6154
Nightly 20101117: http://www.niftyhost.us/support/thread-7...ml#pid6151
Nightly 20101116: http://www.niftyhost.us/support/thread-7...ml#pid6134
Nightly 20101115: Initial version.

Installation:
It's written with Python 3, and you will need a Python 3 interpreter to try it. For the latest version, Python 3.2 is required, and optionally, lxml.
For the unfortunate Windows users, it's required to install Python 3.2+ to use it. Most Linux users should have it pre-installed, yet not necessarily the latest version.
Installation wizard? No, we don't offer such a stupid thing. My principle of programming is to make programs as complicated as possible, so that no newbies will dare to try it and it saves my time of answering the stupid questions they could ask. :D Take a look at the configuration part to learn about how to configure it. (Without proper configuration it won't run at all!)

Configuration:
The content below is obsolete in favor of the new XML external configuration system. (They still work, though.) Please read this reply for a description of the new system. I plan to write a comprehensive README file later, after I learn asciidoc.
Following my tradition, this script is customizable in almost every aspect, and the options are all ill-documented. :D So there's a bunch of configuration options. You can change these options by editing the script file directly.
  1. Username and password. Fill them unless you have exported a cookies.txt in the correct location. They are on line 23 and 24:
    Code:
            niftyhost = dict(\
            enable = True, \
            username = '', \
            password = '', \
  2. 'enabled' option for each forum. The script supports a total of 6 forums (2 of them are effectively broken :) ), and if you don't have accounts on the other forums it supports, you should turn off their 'enabled' option. Basically just change "enabled = True" in all other places to "enabled = False" except the one right after "niftyhost = dict(\"
  3. Constant strlst['cmd']. Line 116. Commands executed when a new post is discovered. You can use it to, for example, play some sound or show a libnotify popup when a new post is found. You can specify different sets of commands for different operating systems, but unless you are using a POSIX system, just change the command list "default = ()". It's written in the format of a Python tuple. Examples:
    Code:
    # No command is the best command :D And this is the default value for Windows users.
    default = ()

    # Attention: If there's only a single string in the tuple, you need to add an extra comma after the string.
    default = (r'notify-send A\ new\ post\ in\ {site_esc} {title_esc}\ by\ {author_esc}', )

    # The command I use, the Linux default:
    posix = (r'notify-send A\ new\ post\ in\ {site_esc} {title_esc}\ by\ {author_esc}', 'mplayer -really-quiet /usr/share/sounds/purple/receive.wav')

    # An example of a command on Windows
    default = (r'C:\Program Files\VideoLAN\VLC\vlc.exe C:\skyrocket_explode.mp3', )
For the rest, read the comments in the script and learn Python 3 yourself, please, because I hate writing documentations. :D

Hopefully you are not sleepy after reading all the boring stuffs above. :) Script is right here:
https://github.com/richardgv/newpostsche...tscheck.py
Gentoo Linux User (w/ fvwm) / Loyal Firefox User / Owner of a Stupid Old Computer - My PGP Public Key

No man is an island, entire of itself; every man is a piece of the continent, a part of the main; if a clod be washed away by the sea, Europe is the less, as well as if a promontory were, as well as if a manor of thy friends or of thine own were; any man's death diminishes me, because I am involved in mankind; and therefore never send to know for whom the bell tolls; it tolls for thee.
-- Devotions Upon Emergent Occasions (1624), John Donn
Reply


Messages In This Thread
Forum New Posts Notifier for NiftyHost - by RichardGv - 11-15-2010, 08:18 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How did you find Niftyhost? Serial Thrilla 21 5,557 06-29-2012, 07:26 AM
Last Post: Jennifer
  NiftyHost Server Monitor (created by Piotr GRD) Piotr GRD 21 12,963 01-18-2012, 05:12 AM
Last Post: Serial Thrilla
  OMG COLORS! A Niftyhost Production pspboy 12 4,516 01-18-2012, 05:01 AM
Last Post: Serial Thrilla
  NiftyHost Affiliate System MyDigitalpoint 4 2,045 10-09-2011, 01:12 PM
Last Post: cuckooz
Information How To Run A Board Forum Like myBB And SMF in Your Own PC [just for fun]! KSubedi 31 18,890 08-15-2011, 10:26 AM
Last Post: MyDigitalpoint
  Niftyhost (Forums) reaches 500 registered members Vanilla 36 8,687 06-26-2011, 06:28 AM
Last Post: micro

Forum Jump: