Esempio n. 1
0
        handle_path.append(pic_path)
        user_path = ''
        is_start_up = False
        try:
            user_path = sys.argv[1]
            is_start_up = sys.argv[2]
            handle_path.append(path_check(sys.argv[2]))
            logging.info("user path add ====>%s" % user_path)
        except Exception as e:
            logging.info(e)
            logging.info("using default path")
            print u"使用默认路径".encode('gbk')
        exe_path = os.path.join(os.path.expandvars("%userprofile%"),
                "AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Startup/")
        config_location = 'config.cfg'

        global config_utils = Config(config_location)
        info, is_first_time,,= config_utils._read_config()
        logging.info(info)

        if is_first_time:
            config_utils._init_config()
            _init(handle_path,config_location,is_start_up)

        run = PicSend(handle_path)
        run.start()
        ss = SocketServer()
        ss.start()
    except KeyboardInterrupt:
        sys.exit()
Esempio n. 2
0



if __name__ == '__main__':
    try:
        pic_path = os.path.join(os.path.expandvars("%userprofile%"),"Pictures")
        handle_path = []
        #handle_path.append(pic_path)
        handle_path.append("C:/Users/jason03.zhang/Pictures/Pictures/Pictures/Sample Pictures")

        exe_path = os.path.join(os.path.expandvars("%userprofile%"),
                "AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Startup/")
        config_location = exe_path + 'config.cfg'

        info, is_first_time = config_utils._read_config(config_location)
        logging.info(info)


        running_semaphore = Semaphore(1)
        ss_semaphore = Semaphore(0)
        if is_first_time:
            config_utils._init_config(config_location)
            _init(handle_path,config_location)

        thread.start_new_thread(_running,(handle_path,running_semaphore,))
        thread.start_new_thread(_socket_server,(ss_semaphore,))
        # running = threading.Thread(target=_running(handle_path,running_semaphore))
        # ss = threading.Thread(target=_socket_server(ss_semaphore))
        #
        # running.start()
Esempio n. 3
0
if __name__ == '__main__':
    try:
        pic_path = os.path.join(os.path.expandvars("%userprofile%"),
                                "Pictures")
        handle_path = []
        #handle_path.append(pic_path)
        handle_path.append(
            "C:/Users/jason03.zhang/Pictures/Pictures/Pictures/Sample Pictures"
        )

        exe_path = os.path.join(
            os.path.expandvars("%userprofile%"),
            "AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Startup/")
        config_location = exe_path + 'config.cfg'

        info, is_first_time = config_utils._read_config(config_location)
        logging.info(info)

        running_semaphore = Semaphore(1)
        ss_semaphore = Semaphore(0)
        if is_first_time:
            config_utils._init_config(config_location)
            _init(handle_path, config_location)

        thread.start_new_thread(_running, (
            handle_path,
            running_semaphore,
        ))
        thread.start_new_thread(_socket_server, (ss_semaphore, ))
        # running = threading.Thread(target=_running(handle_path,running_semaphore))
        # ss = threading.Thread(target=_socket_server(ss_semaphore))