~tardypad/wee-most

1584fc7984f277c882ef269204424445bf3790b2 — Damien Tardy-Panis 3 months ago c5b585a
Move write_file_lines function to post file
2 files changed, 11 insertions(+), 10 deletions(-)

M wee_most/file.py
M wee_most/post.py
M wee_most/file.py => wee_most/file.py +0 -9
@@ 10,15 10,6 @@ class File:
        self.name = kwargs["name"]
        self.url = wee_most.http.build_file_url(kwargs["id"], server)

def write_file_lines(post):
    for file in post.files:
        weechat.prnt_date_tags(
            post.buffer,
            post.date,
            "file_id_" + file.id,
            "	[{}]({})".format(file.name, file.url)
        )

def prepare_download_location():
    location = config.get_download_location()


M wee_most/post.py => wee_most/post.py +11 -1
@@ 323,6 323,15 @@ def write_message_lines(post):

    weechat.buffer_set(post.buffer, "localvar_set_last_post_id", post.id)

def write_file_lines(post):
    for file in post.files:
        weechat.prnt_date_tags(
            post.buffer,
            post.date,
            "file_id_" + file.id,
            "	[{}]({})".format(file.name, file.url)
        )

def write_post_edited(post):
    if post.server.get_post(post.id) is not None:
        write_edited_message_lines(post)


@@ 336,7 345,8 @@ def write_post(post):
        write_reply_message_lines(post)
    else:
        write_message_lines(post)
    wee_most.file.write_file_lines(post)

    write_file_lines(post)

def get_line_data_tags(line_data):
    tags = []