runhey 3 лет назад
Родитель
Сommit
722d5c50b3
47 измененных файлов с 1754 добавлено и 17 удалено
  1. 674 0
      LICENSE
  2. 2 2
      README.md
  3. 3 0
      gui.py
  4. 103 0
      module/base/filter.py
  5. 16 0
      module/base/utils.py
  6. 123 5
      module/config/config.py
  7. 7 0
      module/config/config_manual.py
  8. 3 2
      module/config/config_menu.py
  9. 45 2
      module/config/config_model.py
  10. 1 0
      module/config/config_state.py
  11. BIN
      module/config/i18n/zh_CN.qm
  12. 72 0
      module/config/i18n/zh_CN.ts
  13. 31 0
      module/gui/context/utils.py
  14. 12 1
      module/gui/qml/Component/Args.qml
  15. 40 0
      module/handler/sensitive_info.py
  16. 2 1
      requirements-in.txt
  17. 256 3
      script.py
  18. 10 0
      tasks/AreaBoss/config.py
  19. 15 0
      tasks/AreaBoss/config_scheduler.py
  20. 18 0
      tasks/AreaBoss/script_task.py
  21. 6 0
      tasks/DemonEncounter/config.py
  22. 15 0
      tasks/DemonEncounter/config_scheduler.py
  23. 10 0
      tasks/EternitySea/config.py
  24. 15 0
      tasks/EternitySea/config_scheduler.py
  25. 10 0
      tasks/ExperienceYoukai/config.py
  26. 15 0
      tasks/ExperienceYoukai/config_scheduler.py
  27. 11 0
      tasks/FallenSun/config.py
  28. 15 0
      tasks/FallenSun/config_scheduler.py
  29. 10 0
      tasks/GoldYoukai/config.py
  30. 15 0
      tasks/GoldYoukai/config_scheduler.py
  31. 7 0
      tasks/Hunt/config.py
  32. 15 0
      tasks/Hunt/config_scheduler.py
  33. 11 0
      tasks/Nian/config.py
  34. 15 0
      tasks/Nian/config_scheduler.py
  35. 10 0
      tasks/Orochi/config.py
  36. 15 0
      tasks/Orochi/config_scheduler.py
  37. 11 0
      tasks/OrochiJudgement/config.py
  38. 15 0
      tasks/OrochiJudgement/config_scheduler.py
  39. 11 0
      tasks/OrochiMoans/config.py
  40. 15 0
      tasks/OrochiMoans/config_scheduler.py
  41. 6 0
      tasks/RealmRaid/config.py
  42. 15 0
      tasks/RealmRaid/config_scheduler.py
  43. 2 1
      tasks/Restart/config.py
  44. 2 0
      tasks/Restart/config_scheduler.py
  45. 11 0
      tasks/Sougenbi/config.py
  46. 15 0
      tasks/Sougenbi/config_scheduler.py
  47. 23 0
      tasks/base_task.py

+ 674 - 0
LICENSE

@@ -0,0 +1,674 @@
+                    GNU GENERAL PUBLIC LICENSE
+                       Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                            Preamble
+
+  The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+  The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works.  By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.  We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors.  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+  To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights.  Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received.  You must make sure that they, too, receive
+or can get the source code.  And you must show them these terms so they
+know their rights.
+
+  Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+  For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software.  For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+  Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so.  This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software.  The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable.  Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products.  If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+  Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary.  To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                       TERMS AND CONDITIONS
+
+  0. Definitions.
+
+  "This License" refers to version 3 of the GNU General Public License.
+
+  "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+  "The Program" refers to any copyrightable work licensed under this
+License.  Each licensee is addressed as "you".  "Licensees" and
+"recipients" may be individuals or organizations.
+
+  To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy.  The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+  A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+  To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy.  Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+  To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies.  Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+  An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License.  If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+  1. Source Code.
+
+  The "source code" for a work means the preferred form of the work
+for making modifications to it.  "Object code" means any non-source
+form of a work.
+
+  A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+  The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form.  A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+  The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities.  However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work.  For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+  The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+  The Corresponding Source for a work in source code form is that
+same work.
+
+  2. Basic Permissions.
+
+  All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met.  This License explicitly affirms your unlimited
+permission to run the unmodified Program.  The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work.  This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+  You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force.  You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright.  Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+  Conveying under any other circumstances is permitted solely under
+the conditions stated below.  Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+  No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+  When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+  4. Conveying Verbatim Copies.
+
+  You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+  You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+  5. Conveying Modified Source Versions.
+
+  You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+    a) The work must carry prominent notices stating that you modified
+    it, and giving a relevant date.
+
+    b) The work must carry prominent notices stating that it is
+    released under this License and any conditions added under section
+    7.  This requirement modifies the requirement in section 4 to
+    "keep intact all notices".
+
+    c) You must license the entire work, as a whole, under this
+    License to anyone who comes into possession of a copy.  This
+    License will therefore apply, along with any applicable section 7
+    additional terms, to the whole of the work, and all its parts,
+    regardless of how they are packaged.  This License gives no
+    permission to license the work in any other way, but it does not
+    invalidate such permission if you have separately received it.
+
+    d) If the work has interactive user interfaces, each must display
+    Appropriate Legal Notices; however, if the Program has interactive
+    interfaces that do not display Appropriate Legal Notices, your
+    work need not make them do so.
+
+  A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit.  Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+  6. Conveying Non-Source Forms.
+
+  You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+    a) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by the
+    Corresponding Source fixed on a durable physical medium
+    customarily used for software interchange.
+
+    b) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by a
+    written offer, valid for at least three years and valid for as
+    long as you offer spare parts or customer support for that product
+    model, to give anyone who possesses the object code either (1) a
+    copy of the Corresponding Source for all the software in the
+    product that is covered by this License, on a durable physical
+    medium customarily used for software interchange, for a price no
+    more than your reasonable cost of physically performing this
+    conveying of source, or (2) access to copy the
+    Corresponding Source from a network server at no charge.
+
+    c) Convey individual copies of the object code with a copy of the
+    written offer to provide the Corresponding Source.  This
+    alternative is allowed only occasionally and noncommercially, and
+    only if you received the object code with such an offer, in accord
+    with subsection 6b.
+
+    d) Convey the object code by offering access from a designated
+    place (gratis or for a charge), and offer equivalent access to the
+    Corresponding Source in the same way through the same place at no
+    further charge.  You need not require recipients to copy the
+    Corresponding Source along with the object code.  If the place to
+    copy the object code is a network server, the Corresponding Source
+    may be on a different server (operated by you or a third party)
+    that supports equivalent copying facilities, provided you maintain
+    clear directions next to the object code saying where to find the
+    Corresponding Source.  Regardless of what server hosts the
+    Corresponding Source, you remain obligated to ensure that it is
+    available for as long as needed to satisfy these requirements.
+
+    e) Convey the object code using peer-to-peer transmission, provided
+    you inform other peers where the object code and Corresponding
+    Source of the work are being offered to the general public at no
+    charge under subsection 6d.
+
+  A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+  A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling.  In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage.  For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product.  A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+  "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source.  The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+  If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information.  But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+  The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed.  Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+  Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+  7. Additional Terms.
+
+  "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law.  If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+  When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it.  (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.)  You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+  Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+    a) Disclaiming warranty or limiting liability differently from the
+    terms of sections 15 and 16 of this License; or
+
+    b) Requiring preservation of specified reasonable legal notices or
+    author attributions in that material or in the Appropriate Legal
+    Notices displayed by works containing it; or
+
+    c) Prohibiting misrepresentation of the origin of that material, or
+    requiring that modified versions of such material be marked in
+    reasonable ways as different from the original version; or
+
+    d) Limiting the use for publicity purposes of names of licensors or
+    authors of the material; or
+
+    e) Declining to grant rights under trademark law for use of some
+    trade names, trademarks, or service marks; or
+
+    f) Requiring indemnification of licensors and authors of that
+    material by anyone who conveys the material (or modified versions of
+    it) with contractual assumptions of liability to the recipient, for
+    any liability that these contractual assumptions directly impose on
+    those licensors and authors.
+
+  All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10.  If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term.  If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+  If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+  Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+  8. Termination.
+
+  You may not propagate or modify a covered work except as expressly
+provided under this License.  Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+  However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+  Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+  Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License.  If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+  9. Acceptance Not Required for Having Copies.
+
+  You are not required to accept this License in order to receive or
+run a copy of the Program.  Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance.  However,
+nothing other than this License grants you permission to propagate or
+modify any covered work.  These actions infringe copyright if you do
+not accept this License.  Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+  10. Automatic Licensing of Downstream Recipients.
+
+  Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License.  You are not responsible
+for enforcing compliance by third parties with this License.
+
+  An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations.  If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+  You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License.  For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+  11. Patents.
+
+  A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based.  The
+work thus licensed is called the contributor's "contributor version".
+
+  A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version.  For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+  Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+  In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement).  To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+  If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients.  "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+  If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+  A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License.  You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+  Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+  12. No Surrender of Others' Freedom.
+
+  If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all.  For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+  13. Use with the GNU Affero General Public License.
+
+  Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work.  The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+  14. Revised Versions of this License.
+
+  The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+  Each version is given a distinguishing version number.  If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation.  If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+  If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+  Later license versions may give you additional or different
+permissions.  However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+  15. Disclaimer of Warranty.
+
+  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. Limitation of Liability.
+
+  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+  17. Interpretation of Sections 15 and 16.
+
+  If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+                     END OF TERMS AND CONDITIONS
+
+            How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+  If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+    <program>  Copyright (C) <year>  <name of author>
+    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+  You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<https://www.gnu.org/licenses/>.
+
+  The GNU General Public License does not permit incorporating your program
+into proprietary programs.  If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.  But first, please read
+<https://www.gnu.org/licenses/why-not-lgpl.html>.

+ 2 - 2
README.md

@@ -99,9 +99,9 @@ oas目前还在开发中,我们期待你的加入,Q群: 465946275
 | ✔优化window截图+控制                                         |
 | ✔投屏到OAS                                                   |
 | 🔨操作格式化json生成工具:可以从用户界面简单操作生成维护数据(包括✔图片匹配,✔点击操作,✔长按操作,✔滑动操作,ocr识别等等) |
-| 📆Atom: 对于上一条数据的接口                                  |
+| ✔Atom: 对于上一条数据的接口                                  |
 | 📆实现ocr单独进程                                             |
-| 📆到此我们可以(读参数)、(对游戏截屏控制)、(操控数据)。实现第一个脚本任务如挖土 |
+| 🔨到此我们可以(读参数)、(对游戏截屏控制)、(操控数据)。实现第一个脚本任务如挖土 |
 | 📆重写device(从alas复制过来需要解耦)                          |
 |                                                              |
 

+ 3 - 0
gui.py

@@ -6,6 +6,7 @@ from module.gui.utils import check_admin
 from module.gui.context.add import Add
 from module.gui.context.settings import Setting
 from module.gui.context.process_manager import ProcessManager
+from module.gui.context.utils import Utils
 from module.gui.register_type.paint_image import PaintImage
 from module.gui.register_type.rule_file import RuleFile
 from module.gui.fluent_app import FluentApp
@@ -20,10 +21,12 @@ if __name__ == "__main__":
     add_config = Add()
     setting = Setting()
     process_manager = ProcessManager()
+    utils = Utils()
 
     app.set_context_property(setting, 'setting')
     app.set_context_property(add_config, 'add_config')
     app.set_context_property(process_manager, 'process_manager')
+    app.set_context_property(utils, 'utils')
     app.qml_register_type(PaintImage, 'PaintImage')
     app.qml_register_type(RuleFile, 'RuleFile')
     # 启动一个GUI

+ 103 - 0
module/base/filter.py

@@ -0,0 +1,103 @@
+import re
+
+from module.logger import logger
+
+
+class Filter:
+    def __init__(self, regex, attr, preset=()):
+        """
+        Args:
+            regex: Regular expression.
+            attr: Attribute name.
+            preset: Build-in string preset.
+        """
+        if isinstance(regex, str):
+            regex = re.compile(regex)
+        self.regex = regex
+        self.attr = attr
+        self.preset = tuple(list(p.lower() for p in preset))
+        self.filter_raw = []
+        self.filter = []
+
+    def load(self, string):
+        string = str(string)
+        self.filter_raw = [f.strip(' \t\r\n') for f in string.split('>')]
+        self.filter = [self.parse_filter(f) for f in self.filter_raw]
+
+    def is_preset(self, filter):
+        return len(filter) and filter.lower() in self.preset
+
+    def apply(self, objs, func=None):
+        """
+        Args:
+            objs (list): List of objects and strings
+            func (callable): A function to filter object.
+                Function should receive an object as arguments, and return a bool.
+                True means add it to output.
+
+        Returns:
+            list: A list of objects and preset strings, such as [object, object, object, 'reset']
+        """
+        out = []
+        for raw, filter in zip(self.filter_raw, self.filter):
+            if self.is_preset(raw):
+                raw = raw.lower()
+                if raw not in out:
+                    out.append(raw)
+            else:
+                for index, obj in enumerate(objs):
+                    if self.apply_filter_to_obj(obj=obj, filter=filter) and obj not in out:
+                        out.append(obj)
+
+        if func is not None:
+            objs, out = out, []
+            for obj in objs:
+                if isinstance(obj, str):
+                    out.append(obj)
+                elif func(obj):
+                    out.append(obj)
+                else:
+                    # Drop this object
+                    pass
+
+        return out
+
+    def apply_filter_to_obj(self, obj, filter):
+        """
+        Args:
+            obj (object):
+            filter (list[str]):
+
+        Returns:
+            bool: If an object satisfy a filter.
+        """
+
+        for attr, value in zip(self.attr, filter):
+            if not value:
+                continue
+            if str(obj.__getattribute__(attr)).lower() != str(value):
+                return False
+
+        return True
+
+    def parse_filter(self, string):
+        """
+        Args:
+            string (str):
+
+        Returns:
+            list[strNone]:
+        """
+        string = string.replace(' ', '').lower()
+        result = re.search(self.regex, string)
+
+        if self.is_preset(string):
+            return [string]
+
+        if result and len(string) and result.span()[1]:
+            return [result.group(index + 1) for index, attr in enumerate(self.attr)]
+        else:
+            logger.warning(f'Invalid filter: "{string}". This selector does not match the regex, nor a preset.')
+            # Invalid filter will be ignored.
+            # Return strange things and make it impossible to match
+            return ['1nVa1d'] + [None] * (len(self.attr) - 1)

+ 16 - 0
module/base/utils.py

@@ -1,7 +1,9 @@
 import re
 
 import cv2
+import sys
 import numpy as np
+import importlib
 from PIL import Image
 
 REGEX_NODE = re.compile(r'(-?[A-Za-z]+)(-?\d+)')
@@ -884,3 +886,17 @@ def color_bar_percentage(image, area, prev_color, reverse=False, starter=0, thre
         prev_color = np.mean(image[:, prev_index], axis=0)
 
     return 0.
+
+
+def load_module(moduleName :str, moduleFile :str):
+    """
+    加载模块
+    :param moduleName:
+    :param moduleFile: 文件路径带py
+    :return:
+    """
+    spec = importlib.util.spec_from_file_location(moduleName, moduleFile)
+    module = importlib.util.module_from_spec(spec)
+    spec.loader.exec_module(module)
+    sys.modules[moduleName] = module
+    return module

+ 123 - 5
module/config/config.py

@@ -6,6 +6,9 @@ import datetime
 import operator
 import threading
 
+from datetime import datetime
+
+from module.base.filter import Filter
 from module.config.config_updater import ConfigUpdater
 from module.config.config_manual import ConfigManual
 from module.config.config_watcher import ConfigWatcher
@@ -14,8 +17,66 @@ from module.config.config_model import ConfigModel
 from module.config.config_state import ConfigState
 from module.config.utils import *
 
+from module.exception import RequestHumanTakeover, ScriptError
 from module.logger import logger
 
+class TaskEnd(Exception):
+    pass
+
+class Function:
+    def __init__(self, key: str, data: dict):
+        """
+        输入的是每一个ConfigModel的一个字段对象
+        :param data:
+        """
+        if isinstance(data, dict) is False:
+            self.enable = False
+            self.command = "Unknown"
+            self.next_run = DEFAULT_TIME
+            return
+        if data.get("scheduler") is None:
+            self.enable = False
+            self.command = "Unknown"
+            self.next_run = DEFAULT_TIME
+            return
+
+        self.enable: bool = data['scheduler']['enable']
+        self.command: str = ConfigModel.type(key)
+        self.next_run: datetime = data['scheduler']['next_run']
+        # self.enable = deep_get(data, keys="Scheduler.Enable", default=False)
+        # self.command = deep_get(data, keys="Scheduler.Command", default="Unknown")
+        # self.next_run = deep_get(data, keys="Scheduler.NextRun", default=DEFAULT_TIME)
+
+    def __str__(self):
+        enable = "Enable" if self.enable else "Disable"
+        return f"{self.command} ({enable}, {str(self.next_run)})"
+
+    __repr__ = __str__
+
+    def __eq__(self, other):
+        if not isinstance(other, Function):
+            return False
+
+        if self.command == other.command and self.next_run == other.next_run:
+            return True
+        else:
+            return False
+
+
+def name_to_function(name):
+    """
+    Args:
+        name (str):
+
+    Returns:
+        Function:
+    """
+    function = Function({})
+    function.command = name
+    function.enable = True
+    return function
+
+
 class Config(ConfigState, ConfigManual, ConfigWatcher, ConfigMenu):
 
     def __init__(self, config_name: str, task=None) -> None:
@@ -84,11 +145,68 @@ class Config(ConfigState, ConfigManual, ConfigWatcher, ConfigMenu):
         """
         self.model.write_json(self.config_name, self.model.dict())
 
+    def update_scheduler(self) -> None:
+        """
+        更新调度器, 设置pending_task and waiting_task
+        :return:
+        """
+        pending_task = []
+        waiting_task = []
+        error = []
+        now = datetime.now()
+        for key, value in self.model.dict().items():
+            func = Function(key, value)
+            if not func.enable:
+                continue
+            if not isinstance(func.next_run, datetime):
+                error.append(func)
+            elif func.next_run < now:
+                pending_task.append(func)
+            else:
+                waiting_task.append(func)
+
+        f = Filter(regex=r"(.*)", attr=["command"])
+        f.load(self.SCHEDULER_PRIORITY)
+        if pending_task:
+            pending_task = f.apply(pending_task)
+        if waiting_task:
+            waiting_task = f.apply(waiting_task)
+            waiting_task = sorted(waiting_task, key=operator.attrgetter("next_run"))
+        if error:
+            pending_task = error + pending_task
+
+        self.pending_task = pending_task
+        self.waiting_task = waiting_task
+
+    def get_next(self) -> Function:
+        """
+        获取下一个要执行的任务
+        :return:
+        """
+        self.update_scheduler()
+
+        if self.pending_task:
+            logger.info(f"Pending tasks: {[f.command for f in self.pending_task]}")
+            task = self.pending_task[0]
+            logger.attr("Task", task)
+            return task
+
+        # 哪怕是没有任务,也要返回一个任务,这样才能保证调度器正常运行
+        if self.waiting_task:
+            logger.info("No task pending")
+            task = copy.deepcopy(self.waiting_task[0])
+            # task.next_run = (task.next_run + self.hoarding).replace(microsecond=0)
+            logger.attr("Task", task)
+            return task
+        else:
+            logger.critical("No task waiting or pending")
+            logger.critical("Please enable at least one task")
+            raise RequestHumanTakeover
+
+
+
 if __name__ == '__main__':
-    config = Config(config_name='pydantic')
-    print(config.menu)
-    print(config.config_name)
+    config = Config(config_name='oas1')
+    print(config.get_next())
 
-    config.script.device.serial = 123
-    print(config.script.device.serial)
 

+ 7 - 0
module/config/config_manual.py

@@ -6,6 +6,13 @@ class ConfigManual:
     """
     module.device
     """
+
+    SCHEDULER_PRIORITY = """
+        Restart
+        > AreaBoss > GoldYoukai > ExperienceYoukai > Nian
+        > Orochi > OrochiMoans > OrochiJudgement > Sougenbi > FallenSun > EternitySea
+        """
+
     DEVICE_OVER_HTTP = False
     FORWARD_PORT_RANGE = (20000, 21000)
     REVERSE_SERVER_PORT = 7903

+ 3 - 2
module/config/config_menu.py

@@ -18,9 +18,10 @@ class ConfigMenu:
         self.menu['Script'] = ['Script', 'General', 'Restart']
         # 开发工具
         self.menu["Tools"] = ['Image Rule', 'Ocr Rule', 'Click Rule', 'Long Click Rule', 'Swipe Rule']
+        # 刷御魂
+        self.menu["Soul Zones"] = ['Orochi', 'OrochiMoans', 'OrochiJudgement', 'Sougenbi', 'FallenSun', 'EternitySea']
         # 日常的任务
-        self.menu["Daily Task"] = ['Territorial Demon', 'Coin Challenge']
-
+        self.menu["Daily Task"] = ['AreaBoss', 'GoldYoukai', 'ExperienceYoukai', 'Nian']
     @cached_property
     def gui_menu(self) -> str:
         """

+ 45 - 2
module/config/config_model.py

@@ -1,6 +1,7 @@
 # This Python file uses the following encoding: utf-8
 # @author runhey
 # github https://github.com/runhey
+import re
 
 from pathlib import Path
 from pydantic import BaseModel, ValidationError, Field
@@ -11,7 +12,16 @@ from module.logger import logger
 # 导入配置的Python文件
 from tasks.Script.config import Script
 from tasks.Restart.config import Restart
-
+from tasks.AreaBoss.config import AreaBoss
+from tasks.ExperienceYoukai.config import ExperienceYoukai
+from tasks.GoldYoukai.config import GoldYoukai
+from tasks.Nian.config import Nian
+from tasks.Orochi.config import Orochi
+from tasks.OrochiMoans.config import OrochiMoans
+from tasks.OrochiJudgement.config import OrochiJudgement
+from tasks.Sougenbi.config import Sougenbi
+from tasks.FallenSun.config import FallenSun
+from tasks.EternitySea.config import EternitySea
 
 
 
@@ -22,6 +32,21 @@ class ConfigModel(BaseModel):
     script: Script = Field(default_factory=Script)
     restart: Restart = Field(default_factory=Restart)
 
+    # 这些是每日人物的
+    area_boss: AreaBoss = Field(default_factory=AreaBoss)
+    experience_youkai: ExperienceYoukai = Field(default_factory=ExperienceYoukai)
+    gold_youkai: GoldYoukai = Field(default_factory=GoldYoukai)
+    nian: Nian = Field(default_factory=Nian)
+
+    # 这些是刷御魂的
+    orochi: Orochi = Field(default_factory=Orochi)
+    orochi_moans: OrochiMoans = Field(default_factory=OrochiMoans)
+    orochi_judgement: OrochiJudgement = Field(default_factory=OrochiJudgement)
+    sougenbi: Sougenbi = Field(default_factory=Sougenbi)
+    fallen_sun: FallenSun = Field(default_factory=FallenSun)
+    eternity_sea: EternitySea = Field(default_factory=EternitySea)
+
+
     # @validator('script')
     # def script_validator(cls, v):
     #     if v is None:
@@ -103,6 +128,21 @@ class ConfigModel(BaseModel):
         """
         self.write_json(self.config_name, self.dict())
 
+    @staticmethod
+    def type(key: str) -> str:
+        """
+        输入模型的键值,获取这个字段对象的类型 比如输入是orochi输出是Orochi
+        :param key:
+        :return:
+        """
+        field_type: str = str(ConfigModel.__annotations__[key])
+        # return field_type
+        if '.' in field_type:
+            classname = field_type.split('.')[-1][:-2]
+            return classname
+        else:
+            classname = re.findall(r"'([^']*)'", field_type)[0]
+            return classname
 
     # @root_validator
     # def on_on_property_change(cls, values):
@@ -123,4 +163,7 @@ if __name__ == "__main__":
         c = ConfigModel()
     # c.write_json('oas1', c.dict())
     # c.write_json('oas1', c.schema())
-    c.script.device.serial = "5555"
+    # for key, value in c.dict().items():
+    #     print(ConfigModel.type(key))
+
+

+ 1 - 0
module/config/config_state.py

@@ -11,3 +11,4 @@ class ConfigState:
         self.config_name = config_name
         self.pending_task = []
         self.waiting_task = []
+        self.task = None

BIN
module/config/i18n/zh_CN.qm


+ 72 - 0
module/config/i18n/zh_CN.ts

@@ -142,5 +142,77 @@
         <source>Restart</source>
         <translation>重启</translation>
     </message>
+	<message>
+        <source>Tools</source>
+        <translation>工具</translation>
+    </message>
+	<message>
+        <source>Image Rule</source>
+        <translation>截图规范</translation>
+    </message>
+	<message>
+        <source>Ocr Rule</source>
+        <translation>OCR规范</translation>
+    </message>
+	<message>
+        <source>Click Rule</source>
+        <translation>点击规范</translation>
+    </message>
+	<message>
+        <source>Long Click Rule</source>
+        <translation>长按规范</translation>
+    </message>
+	<message>
+        <source>Swipe Rule</source>
+        <translation>滑动规范</translation>
+    </message>
+	<message>
+        <source>Daily Task</source>
+        <translation>日常任务</translation>
+    </message>
+	<message>
+        <source>AreaBoss</source>
+        <translation>地狱鬼王</translation>
+    </message>
+	<message>
+        <source>GoldYoukai</source>
+        <translation>金币妖怪</translation>
+    </message>
+	<message>
+        <source>ExperienceYoukai</source>
+        <translation>经验妖怪</translation>
+    </message>
+	<message>
+        <source>Nian</source>
+        <translation>年兽</translation>
+    </message>
+	<message>
+        <source>Soul Zones</source>
+        <translation>御魂副本</translation>
+    </message>
+	<message>
+        <source>Orochi</source>
+        <translation>八岐大蛇</translation>
+    </message>
+	<message>
+        <source>OrochiMoans</source>
+        <translation>御魂悲鸣</translation>
+    </message>
+	<message>
+        <source>OrochiJudgement</source>
+        <translation>御魂神罚</translation>
+    </message>
+	<message>
+        <source>Sougenbi</source>
+        <translation>业原火</translation>
+    </message>
+	<message>
+        <source>FallenSun</source>
+        <translation>日轮之城</translation>
+    </message>
+	<message>
+        <source>EternitySea</source>
+        <translation>永生之海</translation>
+    </message>
 </context>
 </TS>

+ 31 - 0
module/gui/context/utils.py

@@ -0,0 +1,31 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+import re
+from pathlib import Path
+from datetime import datetime
+from PySide6.QtCore import QObject, Slot, Signal
+
+from module.logger import logger
+
+
+class Utils(QObject):
+
+    def __init__(self) -> None:
+        super(Utils, self).__init__()
+
+    @Slot(result="QString")
+    def current_datetime(self) -> str:
+        """
+        获取当前的时间
+        :return:
+        """
+        return datetime.now().strftime("%Y-%m-%d %H:%M:%S")
+
+
+
+
+
+if __name__ == "__main__":
+    u = Utils()
+    print(u.current_datetime())

+ 12 - 1
module/gui/qml/Component/Args.qml

@@ -29,7 +29,7 @@ Item {
             expand: true
             headerText: qsTr(groupTitle) +" "+ qsTr("Setting")
             width: contentScrollable.width
-            contentHeight: group_column.height
+            contentHeight: group_column.height + 20
             Column{
                 id: group_column
                 spacing: 4
@@ -123,6 +123,7 @@ Item {
         Item{
             id: stringItem
             property var modelData: null
+            property bool isDateTime: false
             width: parent.width
             implicitHeight: string_title.implicitHeight + string_description.implicitHeight
             Layout.fillHeight: true
@@ -135,6 +136,12 @@ Item {
                 }
                 placeholderText: ""
                 onEditingFinished: {
+                    if(stringItem.isDateTime){
+                        if(string_text.text === ""){
+                            string_text.text = utils.current_datetime()
+                        }
+                    }
+
                     if(set_task(stringItem.parent.parent.parent.groupName, modelData.name, text)){
                         showSuccess( qsTr("Successful setting"))
                     }
@@ -173,6 +180,10 @@ Item {
                 }
                 string_text.text = modelData.value
                 string_text.placeholderText = modelData["default"]
+                if(string_text.placeholderText.startsWith("2023-01-01")){
+                    //判断是不是时间类型的变量2023-01-01
+                    stringItem.isDateTime = true
+                }
                 string_title.text = modelData.title
                 if( typeof modelData.description === 'undefined'){
                     return

+ 40 - 0
module/handler/sensitive_info.py

@@ -0,0 +1,40 @@
+import re
+
+# from module.base.mask import Mask
+# from module.ui.page import *
+#
+# MASK_MAIN = Mask('./assets/mask/MASK_MAIN.png')
+# MASK_PLAYER = Mask('./assets/mask/MASK_PLAYER.png')
+
+
+def handle_sensitive_image(image):
+    """
+    Args:
+        image:
+
+    Returns:
+        np.ndarray:
+    """
+    # if PLAYER_CHECK.match(image, offset=(30, 30)):
+    #     image = MASK_PLAYER.apply(image)
+    # if MAIN_CHECK.match(image, offset=(30, 30)):
+    #     image = MASK_MAIN.apply(image)
+
+    return image
+
+
+def handle_sensitive_text(text):
+    """
+    Args:
+        text (str):
+
+    Returns:
+        str:
+    """
+    text = re.sub('File \"(.*?)AzurLaneAutoScript', 'File \"C:\\\\fakepath\\\\AzurLaneAutoScript', text)
+    text = re.sub('\[Adb_binary\] (.*?)AzurLaneAutoScript', '[Adb_binary] C:\\\\fakepath\\\\AzurLaneAutoScript', text)
+    return text
+
+
+def handle_sensitive_logs(logs):
+    return [handle_sensitive_text(line) for line in logs]

+ 2 - 1
requirements-in.txt

@@ -11,4 +11,5 @@ anytree==2.8.0
 pywin32==306
 zerorpc==0.6.3
 wrapt==1.15.0
-pydantic==1.10.7
+pydantic==1.10.7
+inflection==0.5.1

+ 256 - 3
script.py

@@ -5,22 +5,37 @@ import zerorpc
 import zmq
 import msgpack
 import random
+import re
 import cv2
+import time
+import os
+import inflection
+
+from datetime import datetime, timedelta
+from pathlib import Path
 from cached_property import cached_property
 from pydantic import BaseModel, ValidationError
 from PySide6.QtGui import QImage
 
 
 from module.config.utils import convert_to_underscore
+from module.config.config import Config, TaskEnd
+from module.device.device import Device
+from module.base.utils import load_module
+from module.base.decorator import del_cached_property
 from module.logger import logger
 from module.exception import *
 
 class Script:
     def __init__(self, config_name: str ='oas') -> None:
+        logger.hr('Start', level=0)
         self.server = None
         self.config_name = config_name
-
-
+        # Skip first restart
+        self.is_first_task = True
+        # Failure count of tasks
+        # Key: str, task name, value: int, failure count
+        self.failure_record = {}
 
     @cached_property
     def config(self) -> "Config":
@@ -48,6 +63,44 @@ class Script:
             logger.exception(e)
             exit(1)
 
+    @cached_property
+    def checker(self):
+        """
+        占位函数,在alas中是检查服务器是否正常的
+        :return:
+        """
+        return None
+
+    def save_error_log(self):
+        """
+        Save last 60 screenshots in ./log/error/<timestamp>
+        Save logs to ./log/error/<timestamp>/log.txt
+        """
+        from module.base.utils import save_image
+        from module.handler.sensitive_info import (handle_sensitive_image,
+                                                   handle_sensitive_logs)
+        if self.config.Error_SaveError:
+            if not os.path.exists('./log/error'):
+                os.mkdir('./log/error')
+            folder = f'./log/error/{int(time.time() * 1000)}'
+            logger.warning(f'Saving error: {folder}')
+            os.mkdir(folder)
+            for data in self.device.screenshot_deque:
+                image_time = datetime.strftime(data['time'], '%Y-%m-%d_%H-%M-%S-%f')
+                image = handle_sensitive_image(data['image'])
+                save_image(image, f'{folder}/{image_time}.png')
+            with open(logger.log_file, 'r', encoding='utf-8') as f:
+                lines = f.readlines()
+                start = 0
+                for index, line in enumerate(lines):
+                    line = line.strip(' \r\t\n')
+                    if re.match('^═{15,}$', line):
+                        start = index
+                lines = lines[start - 2:]
+                lines = handle_sensitive_logs(lines)
+            with open(f'{folder}/log.txt', 'w', encoding='utf-8') as f:
+                f.writelines(lines)
+
     def init_server(self, port: int) -> int:
         """
         初始化zerorpc服务,返回端口号
@@ -61,7 +114,6 @@ class Script:
             logger.error(f"Ocr server cannot bind on port {port}")
             return None
 
-
     def run_server(self) -> None:
         """
         启动zerorpc服务
@@ -128,7 +180,208 @@ class Script:
         ret, buffer = cv2.imencode('.jpg', self.device.screenshot())
         yield buffer.tobytes()
 
+    def wait_until(self, future):
+        """
+        Wait until a specific time.
+
+        Args:
+            future (datetime):
+
+        Returns:
+            bool: True if wait finished, False if config changed.
+        """
+        future = future + timedelta(seconds=1)
+        self.config.start_watching()
+        while 1:
+            if datetime.now() > future:
+                return True
+            # if self.stop_event is not None:
+            #     if self.stop_event.is_set():
+            #         logger.info("Update event detected")
+            #         logger.info(f"[{self.config_name}] exited. Reason: Update")
+            #         exit(0)
+
+            time.sleep(5)
+
+            if self.config.should_reload():
+                return False
+
+    def get_next_task(self) -> str:
+        """
+        获取下一个任务的名字, 大驼峰。
+        :return:
+        """
+        while 1:
+            task = self.config.get_next()
+            self.config.task = task
+
+            # from module.base.resource import release_resources
+            # if self.config.task.command != 'Alas':
+            #     release_resources(next_task=task.command)
+
+            if task.next_run > datetime.now():
+                logger.info(f'Wait until {task.next_run} for task `{task.command}`')
+                # self.is_first_task = False
+                method = self.config.optimization.when_task_queue_empty
+                if method == 'close_game':
+                    logger.info('Close game during wait')
+                    self.device.app_stop()
+                    self.device.release_during_wait()
+                    if not self.wait_until(task.next_run):
+                        del_cached_property(self, 'config')
+                        continue
+                    self.run('start')
+                elif method == 'goto_main':
+                    logger.info('Goto main page during wait')
+                    self.run('goto_main')
+                    self.device.release_during_wait()
+                    if not self.wait_until(task.next_run):
+                        del_cached_property(self, 'config')
+                        continue
+                else:
+                    logger.warning(f'Invalid Optimization_WhenTaskQueueEmpty: {method}, fallback to stay_there')
+                    self.device.release_during_wait()
+                    if not self.wait_until(task.next_run):
+                        del_cached_property(self, 'config')
+                        continue
+            break
+
+        return task.command
+
+    def run(self, command: str) -> bool:
+        """
+
+        :param command:
+        :return:
+        """
+        if command == 'start' and command == 'goto_main':
+            logger.error(f'Invalid command `{command}`')
+
+        try:
+            self.device.screenshot()
+            module_name = 'script_task'
+            module_path = str(Path.cwd() / 'tasks' / command / (module_name+'.py'))
+            logger.info(f'module_path: {module_path}, module_name: {module_name}')
+            task_module = load_module(module_name, module_path)
+            task_module.ScriptTask(config=self.config, device=self.device).run()
+        except TaskEnd:
+            return True
+        except GameNotRunningError as e:
+            logger.warning(e)
+            self.config.task_call('Restart')
+            return True
+        except (GameStuckError, GameTooManyClickError) as e:
+            logger.error(e)
+            self.save_error_log()
+            logger.warning(f'Game stuck, {self.device.package} will be restarted in 10 seconds')
+            logger.warning('If you are playing by hand, please stop Alas')
+            self.config.task_call('Restart')
+            self.device.sleep(10)
+            return False
+        except GameBugError as e:
+            logger.warning(e)
+            self.save_error_log()
+            logger.warning('An error has occurred in Azur Lane game client, Alas is unable to handle')
+            logger.warning(f'Restarting {self.device.package} to fix it')
+            self.config.task_call('Restart')
+            self.device.sleep(10)
+            return False
+        except GamePageUnknownError:
+            logger.info('Game server may be under maintenance or network may be broken, check server status now')
+            self.checker.check_now()
+            if self.checker.is_available():
+                logger.critical('Game page unknown')
+                self.save_error_log()
+                exit(1)
+            else:
+                self.checker.wait_until_available()
+                return False
+        except ScriptError as e:
+            logger.critical(e)
+            logger.critical('This is likely to be a mistake of developers, but sometimes just random issues')
+            exit(1)
+        except RequestHumanTakeover:
+            logger.critical('Request human takeover')
+            exit(1)
+        except Exception as e:
+            logger.exception(e)
+            self.save_error_log()
+            exit(1)
+
+    def loop(self):
+        """
+        Main loop of scheduler.
+        :return:
+        """
+        logger.set_file_logger(self.config_name)
+        logger.info(f'Start scheduler loop: {self.config_name}')
+
+        while 1:
+            # Check update event from GUI
+            # if self.stop_event is not None:
+            #     if self.stop_event.is_set():
+            #         logger.info("Update event detected")
+            #         logger.info(f"Alas [{self.config_name}] exited.")
+            #         break
+
+            # Check game server maintenance
+            # self.checker.wait_until_available()
+            # if self.checker.is_recovered():
+            #     # There is an accidental bug hard to reproduce
+            #     # Sometimes, config won't be updated due to blocking
+            #     # even though it has been changed
+            #     # So update it once recovered
+            #     del_cached_property(self, 'config')
+            #     logger.info('Server or network is recovered. Restart game client')
+            #     self.config.task_call('Restart')
+
+            # Get task
+            task = self.get_next_task()
+            # Init device and change server
+            _ = self.device
+            # Skip first restart
+            if self.is_first_task and task == 'Restart':
+                logger.info('Skip task `Restart` at scheduler start')
+                self.config.task_delay(server_update=True)
+                del_cached_property(self, 'config')
+                continue
+
+            # Run
+            logger.info(f'Scheduler: Start task `{task}`')
+            self.device.stuck_record_clear()
+            self.device.click_record_clear()
+            logger.hr(task, level=0)
+            success = self.run(inflection.underscore(task))
+            logger.info(f'Scheduler: End task `{task}`')
+            self.is_first_task = False
+
+            # Check failures
+            # failed = deep_get(self.failure_record, keys=task, default=0)
+            failed = self.failure_record[task] if task in self.failure_record else 0
+            failed = 0 if success else failed + 1
+            # deep_set(self.failure_record, keys=task, value=failed)
+            self.failure_record[task] = failed
+            if failed >= 3:
+                logger.critical(f"Task `{task}` failed 3 or more times.")
+                logger.critical("Possible reason #1: You haven't used it correctly. "
+                                "Please read the help text of the options.")
+                logger.critical("Possible reason #2: There is a problem with this task. "
+                                "Please contact developers or try to fix it yourself.")
+                logger.critical('Request human takeover')
+                exit(1)
 
+            if success:
+                del_cached_property(self, 'config')
+                continue
+            elif self.config.error.handle.error:
+                # self.config.task_delay(success=False)
+                del_cached_property(self, 'config')
+                self.checker.check_now()
+                continue
+            else:
+                break
 
 if __name__ == "__main__":
     script = Script("oas1")
+    print(script.get_next_task())
+    script.run("AreaBoss")

+ 10 - 0
tasks/AreaBoss/config.py

@@ -0,0 +1,10 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+from pydantic import BaseModel, Field
+
+from tasks.AreaBoss.config_scheduler import Scheduler
+
+
+class AreaBoss(BaseModel):
+    scheduler: Scheduler = Field(default_factory=Scheduler)

+ 15 - 0
tasks/AreaBoss/config_scheduler.py

@@ -0,0 +1,15 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+from enum import Enum
+from datetime import datetime, time
+from pydantic import BaseModel, ValidationError, validator, Field
+
+class Scheduler(BaseModel):
+    enable: bool = Field(default=False,
+                         description='none')
+    next_run: datetime = Field(default="2023-01-01 00:00:00",
+                               description='none')
+    priority: int = Field(default=3,
+                          description='default 3')
+

+ 18 - 0
tasks/AreaBoss/script_task.py

@@ -0,0 +1,18 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+import time
+
+from tasks.base_task import BaseTask
+from module.logger import logger
+
+
+class ScriptTask(BaseTask):
+
+    def run(self) -> bool:
+        """
+        运行脚本
+        :return:
+        """
+        time.sleep(10)
+        logger.info("运行脚本")

+ 6 - 0
tasks/DemonEncounter/config.py

@@ -0,0 +1,6 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+from pydantic import BaseModel, Field
+
+from tasks.DemonEncounter.config_scheduler import Scheduler

+ 15 - 0
tasks/DemonEncounter/config_scheduler.py

@@ -0,0 +1,15 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+from enum import Enum
+from datetime import datetime, time
+from pydantic import BaseModel, ValidationError, validator, Field
+
+class Scheduler(BaseModel):
+    enable: bool = Field(default=False,
+                         description='none')
+    next_run: datetime = Field(default="2023-01-01 00:00:00",
+                               description='none')
+    priority: int = Field(default=3,
+                          description='default 3')
+

+ 10 - 0
tasks/EternitySea/config.py

@@ -0,0 +1,10 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+from pydantic import BaseModel, Field
+
+from tasks.EternitySea.config_scheduler import Scheduler
+
+
+class EternitySea(BaseModel):
+    scheduler: Scheduler = Field(default_factory=Scheduler)

+ 15 - 0
tasks/EternitySea/config_scheduler.py

@@ -0,0 +1,15 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+from enum import Enum
+from datetime import datetime, time
+from pydantic import BaseModel, ValidationError, validator, Field
+
+class Scheduler(BaseModel):
+    enable: bool = Field(default=False,
+                         description='none')
+    next_run: datetime = Field(default="2023-01-01 00:00:00",
+                               description='none')
+    priority: int = Field(default=3,
+                          description='default 3')
+

+ 10 - 0
tasks/ExperienceYoukai/config.py

@@ -0,0 +1,10 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+from pydantic import BaseModel, Field
+
+from tasks.ExperienceYoukai.config_scheduler import Scheduler
+
+class ExperienceYoukai(BaseModel):
+    scheduler: Scheduler = Field(default_factory=Scheduler)
+

+ 15 - 0
tasks/ExperienceYoukai/config_scheduler.py

@@ -0,0 +1,15 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+from enum import Enum
+from datetime import datetime, time
+from pydantic import BaseModel, ValidationError, validator, Field
+
+class Scheduler(BaseModel):
+    enable: bool = Field(default=False,
+                         description='none')
+    next_run: datetime = Field(default="2023-01-01 00:00:00",
+                               description='none')
+    priority: int = Field(default=3,
+                          description='default 3')
+

+ 11 - 0
tasks/FallenSun/config.py

@@ -0,0 +1,11 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+from pydantic import BaseModel, Field
+
+from tasks.FallenSun.config_scheduler import Scheduler
+
+
+class FallenSun(BaseModel):
+    scheduler: Scheduler = Field(default_factory=Scheduler)
+

+ 15 - 0
tasks/FallenSun/config_scheduler.py

@@ -0,0 +1,15 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+from enum import Enum
+from datetime import datetime, time
+from pydantic import BaseModel, ValidationError, validator, Field
+
+class Scheduler(BaseModel):
+    enable: bool = Field(default=False,
+                         description='none')
+    next_run: datetime = Field(default="2023-01-01 00:00:00",
+                               description='none')
+    priority: int = Field(default=3,
+                          description='default 3')
+

+ 10 - 0
tasks/GoldYoukai/config.py

@@ -0,0 +1,10 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+from pydantic import BaseModel, Field
+
+from tasks.GoldYoukai.config_scheduler import Scheduler
+
+
+class GoldYoukai(BaseModel):
+    scheduler: Scheduler = Field(default_factory=Scheduler)

+ 15 - 0
tasks/GoldYoukai/config_scheduler.py

@@ -0,0 +1,15 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+from enum import Enum
+from datetime import datetime, time
+from pydantic import BaseModel, ValidationError, validator, Field
+
+class Scheduler(BaseModel):
+    enable: bool = Field(default=False,
+                         description='none')
+    next_run: datetime = Field(default="2023-01-01 00:00:00",
+                               description='none')
+    priority: int = Field(default=3,
+                          description='default 3')
+

+ 7 - 0
tasks/Hunt/config.py

@@ -0,0 +1,7 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+from pydantic import BaseModel, Field
+
+from tasks.Hunt.config_scheduler import Scheduler
+

+ 15 - 0
tasks/Hunt/config_scheduler.py

@@ -0,0 +1,15 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+from enum import Enum
+from datetime import datetime, time
+from pydantic import BaseModel, ValidationError, validator, Field
+
+class Scheduler(BaseModel):
+    enable: bool = Field(default=False,
+                         description='none')
+    next_run: datetime = Field(default="2023-01-01 00:00:00",
+                               description='none')
+    priority: int = Field(default=3,
+                          description='default 3')
+

+ 11 - 0
tasks/Nian/config.py

@@ -0,0 +1,11 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+from pydantic import BaseModel, Field
+
+from tasks.Nian.config_scheduler import Scheduler
+
+
+class Nian(BaseModel):
+    scheduler: Scheduler = Field(default_factory=Scheduler)
+

+ 15 - 0
tasks/Nian/config_scheduler.py

@@ -0,0 +1,15 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+from enum import Enum
+from datetime import datetime, time
+from pydantic import BaseModel, ValidationError, validator, Field
+
+class Scheduler(BaseModel):
+    enable: bool = Field(default=False,
+                         description='none')
+    next_run: datetime = Field(default="2023-01-01 00:00:00",
+                               description='none')
+    priority: int = Field(default=3,
+                          description='default 3')
+

+ 10 - 0
tasks/Orochi/config.py

@@ -0,0 +1,10 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+from pydantic import BaseModel, Field
+
+from tasks.Orochi.config_scheduler import Scheduler
+
+class Orochi(BaseModel):
+    scheduler: Scheduler = Field(default_factory=Scheduler)
+

+ 15 - 0
tasks/Orochi/config_scheduler.py

@@ -0,0 +1,15 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+from enum import Enum
+from datetime import datetime, time
+from pydantic import BaseModel, ValidationError, validator, Field
+
+class Scheduler(BaseModel):
+    enable: bool = Field(default=False,
+                         description='none')
+    next_run: datetime = Field(default="2023-01-01 00:00:00",
+                               description='none')
+    priority: int = Field(default=3,
+                          description='default 3')
+

+ 11 - 0
tasks/OrochiJudgement/config.py

@@ -0,0 +1,11 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+from pydantic import BaseModel, Field
+
+from tasks.OrochiJudgement.config_scheduler import Scheduler
+
+
+class OrochiJudgement(BaseModel):
+    scheduler: Scheduler = Field(default_factory=Scheduler)
+

+ 15 - 0
tasks/OrochiJudgement/config_scheduler.py

@@ -0,0 +1,15 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+from enum import Enum
+from datetime import datetime, time
+from pydantic import BaseModel, ValidationError, validator, Field
+
+class Scheduler(BaseModel):
+    enable: bool = Field(default=False,
+                         description='none')
+    next_run: datetime = Field(default="2023-01-01 00:00:00",
+                               description='none')
+    priority: int = Field(default=3,
+                          description='default 3')
+

+ 11 - 0
tasks/OrochiMoans/config.py

@@ -0,0 +1,11 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+from pydantic import BaseModel, Field
+
+from tasks.OrochiMoans.config_scheduler import Scheduler
+
+
+class OrochiMoans(BaseModel):
+    scheduler: Scheduler = Field(default_factory=Scheduler)
+

+ 15 - 0
tasks/OrochiMoans/config_scheduler.py

@@ -0,0 +1,15 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+from enum import Enum
+from datetime import datetime, time
+from pydantic import BaseModel, ValidationError, validator, Field
+
+class Scheduler(BaseModel):
+    enable: bool = Field(default=False,
+                         description='none')
+    next_run: datetime = Field(default="2023-01-01 00:00:00",
+                               description='none')
+    priority: int = Field(default=3,
+                          description='default 3')
+

+ 6 - 0
tasks/RealmRaid/config.py

@@ -0,0 +1,6 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+from pydantic import BaseModel, Field
+
+from tasks.RealmRaid.config_scheduler import Scheduler

+ 15 - 0
tasks/RealmRaid/config_scheduler.py

@@ -0,0 +1,15 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+from enum import Enum
+from datetime import datetime, time
+from pydantic import BaseModel, ValidationError, validator, Field
+
+class Scheduler(BaseModel):
+    enable: bool = Field(default=False,
+                         description='none')
+    next_run: datetime = Field(default="2023-01-01 00:00:00",
+                               description='none')
+    priority: int = Field(default=3,
+                          description='default 3')
+

+ 2 - 1
tasks/Restart/config.py

@@ -6,4 +6,5 @@ from pydantic import BaseModel, Field
 from tasks.Restart.config_scheduler import Scheduler
 
 class Restart(BaseModel):
-    scheduler: Scheduler = Field(default_factory=Scheduler)
+    scheduler: Scheduler = Field(default_factory=Scheduler)
+

+ 2 - 0
tasks/Restart/config_scheduler.py

@@ -12,6 +12,8 @@ class Scheduler(BaseModel):
                          description='none')
     next_run: datetime = Field(default="2023-01-01 00:00:00",
                                description='none')
+    priority: int = Field(default=0,
+                          description='default 0')
     command: str = Field(default='Restart',
                          description='none')
     success_interval: float = Field(default=0,

+ 11 - 0
tasks/Sougenbi/config.py

@@ -0,0 +1,11 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+from pydantic import BaseModel, Field
+
+from tasks.Sougenbi.config_scheduler import Scheduler
+
+
+class Sougenbi(BaseModel):
+    scheduler: Scheduler = Field(default_factory=Scheduler)
+

+ 15 - 0
tasks/Sougenbi/config_scheduler.py

@@ -0,0 +1,15 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+from enum import Enum
+from datetime import datetime, time
+from pydantic import BaseModel, ValidationError, validator, Field
+
+class Scheduler(BaseModel):
+    enable: bool = Field(default=False,
+                         description='none')
+    next_run: datetime = Field(default="2023-01-01 00:00:00",
+                               description='none')
+    priority: int = Field(default=3,
+                          description='default 3')
+

+ 23 - 0
tasks/base_task.py

@@ -0,0 +1,23 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+from datetime import datetime
+
+from module.config.config import Config
+from module.device.device import Device
+
+class BaseTask:
+    config: Config = None
+    device: Device = None
+
+    folder: str
+    name: str
+    stage: str
+
+    limit_time: datetime  # 限制运行的时间,是软时间,不是硬时间
+
+
+    def __init__(self, config: Config, device: Device) -> None:
+        self.config = config
+        self.device = device
+