Beispiel #1
0
__author__ = "Matthew ([email protected])"

from src.ImageGetter import *
from src.ImageAnalyzer import *
from src.WeiboPoster import *
import time

if __name__ == "__main__":

    status = "Clear"
    img_get = ImageGetter()
    img_analyzer = ImageAnalyzer()

    while True:
        try:
            img_data = img_get.get_radar_img("http://www.nmc.cn/publish/radar/qingpu.html")

            img_analyzer.set_region((235, 185, 330, 274))
            cropped_img = img_analyzer.crop_image(img_data)

            img_analyzer.set_region((37, 32, 46, 37))
            cropped_img2 = img_analyzer.crop_image(cropped_img)

            result = img_analyzer.analysis_image(cropped_img2)
            print("Check result: " + result)

            if status != result:
                string = "#AutoWeatherPoster# "
                string = string + "The weather at Jiangqiao is " + result
                string = string + ", Right Now"
                weibo = WeiboPoster()