# -*- coding: utf-8 -*-

import re

UI.UpdateLog("※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※")
UI.UpdateLog("※　　　【免空科學研究所　ｔｉｇｅｒｍａｘ．ｄｙｎｄｎｓ．ｏｒｇ】　　　※")
UI.UpdateLog("※　　　～㊣　　　　　　　　　　影楓　　製作分享　　　　　　　㊣～　　　※")
UI.UpdateLog("※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※")
UI.UpdateLog("【腳本更新】：2013.03.13",2)
UI.UpdateLog("【上傳空間】：[ES上傳] pixuria.com (圖空)",2)
UI.UpdateLog("【上傳大小】：10 MB",2)
UI.UpdateLog("【砍檔時間】：未知",2)
UI.UpdateLog("【腳本功能】：無帳號上傳",2)
UI.UpdateLog("※連結至 pixuria.com 圖空上傳頁面...",4)
HTTP.ClearProcedureData()
HTTP.AddUpParam("resize","320x240")
HTTP.AddUpParam("SendenButton","Upload")
HTTP.AddUpParam("MAX_FILE_SIZE","12582912")
HTTP.AddFileReference("userfile","image/jpeg")
UI.UpdateLog("※開始上傳...",4)
HTML=UI.UpFile("http://pixuria.com/")
Match = re.search("Hotlink",HTML)
if Match == None:
        UI.UpdateLog("※上傳失敗，網站改版或檔案超過上限值..." + HTML,3)
        UI.ProceFalse()
        exit()
else:
        UI.UpdateLog("※檔案：【"+UI.FileName+"】，上傳成功。",4)
        UI.UpdateLog("=================================================================")
Match = re.search("\;\&quot\;\&gt\;\&lt\;img src\=\&quot\;([^\&]+)",HTML)
if Match == None:
        UI.UpdateLog("※無法擷取圖片連結網址..." + HTML,3)
        UI.ProceFalse()
        exit()
else:
        HotLink = Match.group(1)
        ImgLink = "[img]" + HotLink + "[/img]"
UI.AddShareLink(HotLink + "^" + ImgLink)
UI.UpdateLog("※圖片網址：" + HotLink,4)
UI.UpdateLog("※論壇語法：" + ImgLink,4)
UI.UpdateLog("=================================================================")
UI.ProceSuccess()
exit()