예제 #1
0
def list_live_posts():

    tracking_post_ids = weibo_module.get_tracking_postids()

    print "########## POSTS TRACKING ##########"
    print "# of posts we're tracking: ", len(tracking_post_ids)

    if (len(tracking_post_ids) > 0):

        for this_post_id in tracking_post_ids:
            print "Checking post #" + this_post_id + ":",

            this_post_new = weibo_module.get_most_recent_live_post(
                this_post_id)
            this_post_old = weibo_module.get_oldest_post(this_post_id)

            print "alive: new/old repost count (", this_post_new[
                "post_repost_count"], " / ", this_post_old[
                    "post_repost_count"], ") "

            #			print "* this_post_new = " , this_post_new

            elapsedtime = nowdatetime - weibo_module.set_timezone_to_china(
                this_post_new["started_tracking_at"])
            print "elapsed time = ", elapsedtime
예제 #2
0
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
예제 #3
0
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
예제 #4
0
def list_live_posts():

	tracking_post_ids = weibo_module.get_tracking_postids()

	print "########## POSTS TRACKING ##########"
	print "# of posts we're tracking: " , len(tracking_post_ids)

	if (len(tracking_post_ids) > 0):

		for this_post_id in tracking_post_ids:
			print "Checking post #" + this_post_id + ":",

			this_post_new = weibo_module.get_most_recent_live_post(this_post_id)
			this_post_old = weibo_module.get_oldest_post(this_post_id)

			print "alive: new/old repost count (" , this_post_new["post_repost_count"] , " / " , this_post_old["post_repost_count"] , ") "

#			print "* this_post_new = " , this_post_new

			elapsedtime  = nowdatetime - weibo_module.set_timezone_to_china(this_post_new["started_tracking_at"]) 
			print "elapsed time = " ,  elapsedtime
예제 #5
0
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

##########################################
## HAS ENOUGH TIME PASSED?
예제 #6
0

##########################################
## 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()

print "The DATE/TIME IS ", nowdatetime

# if we're tracking more than we need, exit.
if num_trackmore <= 0:
    print "Currently tracking all " + str(num_currently_tracking) + " posts:"
    print "After all, we can only track a max of " + str(weibo_module.num_posts_to_track()) + " posts"
    counter = 1
    for thispostid in tracking_post_ids:
        thispost = weibo_module.get_most_recent_live_post(thispostid)