{ "info": { "author": "Ldream", "author_email": "821173262@qq.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3.5", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "#FileMonitor\n![py3][py3] [English Version][english_version]\n\nFileMonitor\u662f\u4e00\u4e2a\u5f00\u653e\u7684\u6587\u4ef6\u76d1\u63a7\u63a5\u53e3\uff0c\u76ee\u7684\u662f\u8ba9\u5f00\u53d1\u8005\u63d0\u9ad8\u5f00\u53d1\u6548\u7387\u3002\n\u63d0\u4f9b\u65b9\u4fbf\u7684\u63a5\u53e3\u6765\u5bf9\u53d1\u9001\u7684\u6587\u4ef6\u53d8\u52a8\u8fdb\u884c\u5904\u7406\n\n\n## Simple uses\n\n\u901a\u8fc7\u5982\u4e0b\u4ee3\u7801\uff0c\u53ef\u4ee5\u521d\u6b65\u901a\u8fc7Python\u521b\u5efa\u5bf9\u5e94\u7684\u5f15\u64ce\uff0c\u6ce8\u518c\u51fd\u6570\u548c\u6ce8\u518c\u76d1\u63a7\u8def\u5f84\nmain.py\n```python\nfrom FileMonitor import start_watch, create_engine, add_routers\nimport os\napp = create_engine()\nadd_routers(app, \"handler\")\nwatch_path = os.path.join(os.path.abspath('.'), 'monitor')\nstart_watch(app, watch_path)\n```\nhandler.py\n```python\nimport subprocess\nimport sys\n\nfrom FileMonitor import created, start, deleted\n\n\n@created(r'py', once=True)\ndef pys(src_path):\n pass\n # print(pys.__re_path__)\n print(pys.__method__)\n # print(\"test:\", src_path)\n\n\n@start(r'.*py', once=True, )\ndef sl(src_path):\n print(\"sl:\", src_path)\n command = ['python3', src_path]\n print('Start process %s...' % ' '.join(command))\n process = subprocess.Popen(command, stdin=sys.stdin, stdout=sys.stdout, stderr=sys.stderr)\n\n @deleted(src_path, once=True, escape=True, process=process)\n def fk(src_path):\n print('Kill process [%s]...' % fk.__data__['process'].pid)\n fk.__data__['process'].kill()\n fk.__data__['process'].wait()\n print('Process ended with code %s.' % fk.__data__['process'].returncode)\n process = None\n print(\"fk:\", src_path)\n\n sl.__app__.register_callback(fk)\n```\n\n\n## Comments\n\n\u5982\u679c\u6709\u4ec0\u4e48\u95ee\u9898\u6216\u8005\u5efa\u8bae\u90fd\u53ef\u4ee5\u5728\u8fd9\u4e2a[Issue][issue#1]\u548c\u6211\u8ba8\u8bba\n\n[py2]: https://img.shields.io/badge/python-2.7-ff69b4.svg \"python2\"\n[py3]: https://img.shields.io/badge/python-3.5-red.svg \"python3\"\n[issue#1]: https://github.com/Ldream/FileMonitor/issues/1", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Ldream/FileMonitor", "keywords": "File Monitor", "license": "Apache License", "maintainer": null, "maintainer_email": null, "name": "FileMonitor", "package_url": "https://pypi.org/project/FileMonitor/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/FileMonitor/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/Ldream/FileMonitor" }, "release_url": "https://pypi.org/project/FileMonitor/0.2/", "requires_dist": null, "requires_python": null, "summary": "A File Monitor", "version": "0.2" }, "last_serial": 2465603, "releases": { "0.1": [], "0.2": [] }, "urls": [] }