예제 #1
0
def ico_url(id):
    pic_id = ico96.get(id)
    if pic_id:
        return fs_url_jpg("96", pic_id)
예제 #2
0
def pic211_url(id):
    pic_id = ico96.get(id)
    if pic_id:
        return fs_url_jpg("211", pic_id)
예제 #3
0
 def __getattr__(self, name):
     if name.startswith('src'):
         size = name[3:]
         if size.isdigit():
             return fs_url_jpg(size, self.id)
예제 #4
0
def pic_url(id, size="721"):
    f = ico.get(id)
    if f:
        return fs_url_jpg(size, f)
예제 #5
0
def feed_tuple_by_db(id):
    m = Po.mc_get(id)
    if not m:
        feed_rm(id)
    cid = m.cid
    rid = m.rid
    has_question = cid in (CID_WORD, CID_ANSWER)

    if rid and has_question:
        question = m.target
        name = question.name
    elif cid == CID_REC:
        name = m.name_htm
    elif cid != CID_WORD:
        name = m.name
    else:
        name = None

    #if cid == CID_QUESTION:
    #    reply_count = answer_count(id)
    #else:
    reply_count = m.reply_count
    if cid == CID_PHOTO:
        rid = fs_url_jpg(721, rid)
    elif cid == CID_AUDIO:
        rid = fs_url_audio(id, '')
    elif cid == CID_VIDEO:
        rid = video_link_autoplay(rid, id)
    elif cid == CID_EVENT:
        event = Event.mc_get(id)
        feed_rm(id)
        rid = fs_url_jpg(162, event.pic_id)
    else:
        rid = rid

    result = [
        m.user_id,
        cid,
        rid,
        m.zsite_id,
        reply_count,
        m.create_time,
        name,
        #vote_count(id)
    ]

    txt = m.txt
    if cid != CID_WORD:
        txt, has_more = cnenoverflow(txt, 100)
        if not has_more:
            txt = m.htm
        result.extend((txt, has_more))
    else:
        txt = txt_withlink(txt)
        result.extend((txt, False))

    if cid == CID_EVENT:
        result.append(place_name(event.pid))
        result.append(event.address)
        result.extend(begin_end_by_minute(event.begin_time, event.end_time))
    elif rid and has_question:
        user = question.user
        result.extend((question.id, user.name, user.link))

    return result
예제 #6
0
def pic211_url(id):
    pic_id = ico96.get(id)
    if pic_id:
        return fs_url_jpg('211', pic_id)
예제 #7
0
def ico_url(id):
    pic_id = ico96.get(id)
    if pic_id:
        return fs_url_jpg('96', pic_id)
예제 #8
0
def pic_url(id, size='721'):
    f = ico.get(id)
    if f:
        return fs_url_jpg(size, f)
예제 #9
0
def feed_tuple_by_db(id):
    m = Po.mc_get(id)
    if not m:
        feed_rm(id)
    cid = m.cid
    rid = m.rid
    has_question = cid in (CID_WORD, CID_ANSWER)

    if rid and has_question:
        question = m.target
        name = question.name
    elif cid == CID_REC:
        name = m.name_htm
    elif cid != CID_WORD:
        name = m.name
    else:
        name = None

    #if cid == CID_QUESTION:
    #    reply_count = answer_count(id)
    #else:
    reply_count = m.reply_count
    if cid == CID_PHOTO:
        rid = fs_url_jpg(721, rid)
    elif cid == CID_AUDIO:
        rid = fs_url_audio(id, '')
    elif cid == CID_VIDEO:
        rid = video_link_autoplay(rid, id)
    elif cid == CID_EVENT:
        event = Event.mc_get(id)
        feed_rm(id)
        rid = fs_url_jpg(162, event.pic_id)
    else:
        rid = rid

    result = [
        m.user_id,
        cid,
        rid,
        m.zsite_id,
        reply_count,
        m.create_time,
        name,
        #vote_count(id)
    ]

    txt = m.txt
    if cid != CID_WORD:
        txt, has_more = cnenoverflow(txt, 100)
        if not has_more:
            txt = m.htm
        result.extend((txt, has_more))
    else:
        txt = txt_withlink(txt)
        result.extend((txt, False))

    if cid == CID_EVENT:
        result.append(place_name(event.pid))
        result.append(event.address)
        result.extend(
            begin_end_by_minute(event.begin_time, event.end_time)
        )
    elif rid and has_question:
        user = question.user
        result.extend(
            (question.id, user.name, user.link)
        )

    return result