def check_for_live_posts(): dbcursor = weibo_module.db_cursor() tracking_post_ids = weibo_module.get_tracking_postids() num_currently_tracking = len(tracking_post_ids) if (num_currently_tracking == 0): print "No posts are being tracked right now." print "Currently tracking " + str(num_currently_tracking) + " posts" return num_currently_tracking
import time import sys import weibo_settings import weibo_module import traceback from json import loads from urllib import urlretrieve from os.path import splitext, isdir from dateutil import parser ########################################## ## OPEN DB ########################################## dbcursor = weibo_module.db_cursor() tracking_post_ids = weibo_module.get_tracking_postids() num_currently_tracking = len(tracking_post_ids) if (num_currently_tracking == 0): sys.exit("No posts are being tracked right now.") print "Currently tracking " + str(num_currently_tracking) + " posts" print weibo_module.post_alert() ########################################## ## GET LIST OF LIVE POSTS ########################################## #print tracking_post_ids ##########################################
########################################## ## INIT VARIABLES ########################################## thispostbuffer = [] newpostcount = 0 statuspage = 1 ########################################## ## OPEN DB, CHECK TO SEE IF IMG FOLDER EXISTS ########################################## dbcursor = weibo_module.db_cursor() if isdir(weibo_settings.imgdir) == False: sys.exit("No such directory " + weibo_settings.imgdir) ########################################## ## CHECK TO SEE HOW MANY POSTS WE ARE TRACKING ########################################## tracking_post_ids = weibo_module.get_tracking_postids() num_currently_tracking = len(tracking_post_ids) num_posts_to_track = weibo_module.num_posts_to_track() num_trackmore = num_posts_to_track - num_currently_tracking nowdatetime = weibo_module.get_current_chinatime()