def PostItem(self): Keys=r.hkeys('queue') ReadyToPostItem=r.hget('queue',Keys[0]) UnPushed=ForbiddenItemPushed(ReadyToPostItem) print UnPushed if UnPushed is not False: Image='imgcache/'+r.hget('img',EDITEDPREFIX+ReadyToPostItem) post(status=ReadyToPostItem,pic=Image) r.zrem('queuenumber',ReadyToPostItem) r.hdel('imgkey',EDITEDPREFIX+ReadyToPostItem) r.hdel('queue',EDITEDPREFIX+ReadyToPostItem) r.hset('queue',PUSHEDPREFIX+ReadyToPostItem,ReadyToPostItem) else: pass
def PostItem(self): Keys=r.zrange('queuenumber',0,-1) ReadyToPostItem=Keys[0] UnPushed=ForbiddenItemPushed(ReadyToPostItem) if UnPushed is not False: name=r.hget('img',MU_MainConfig.EDITEDPREFIX+ReadyToPostItem) post(ReadyToPostItem,name) r.hdel('queue',MU_MainConfig.EDITEDPREFIX+ReadyToPostItem) os.remove('../imgcache/'+name) r.hdel('img',MU_MainConfig.EDITEDPREFIX+ReadyToPostItem) r.hdel('imgkey',MU_MainConfig.EDITEDPREFIX+ReadyToPostItem) score=r.zscore('queuenumber',ReadyToPostItem) r.zrem('queuenumber',ReadyToPostItem) scorequeue=r.zrange('queuenumber',int(score)-1,-1) for i in range(len(scorequeue)): score=r.zscore('queuenumber',scorequeue[i]) r.zadd('queuenumber',scorequeue[i],score-1) r.hset('queue',MU_MainConfig.PUSHEDPREFIX+ReadyToPostItem,ReadyToPostItem) else: pass