├── .gitignore
├── .gitmodules
├── LICENSE
├── README.md
├── document
├── border.css
├── gradient-back-ground.css
├── hide-scrollbar.css
├── screenshot-desktop.png
├── screenshot-game.png
└── transparent.css
├── extract.py
├── gui.py
├── requirements.txt
└── window
├── adjust.py
├── browser.py
├── console.py
├── desinger
├── ui_float_config.py
├── ui_float_config.ui
├── ui_float_scale.py
├── ui_float_scale.ui
├── ui_root.py
└── ui_root.ui
├── main.py
└── setting.py
/.gitignore:
--------------------------------------------------------------------------------
1 | # Byte-compiled / optimized / DLL files
2 | __pycache__/
3 | *.py[cod]
4 | *$py.class
5 |
6 | # C extensions
7 | *.so
8 |
9 | # Distribution / packaging
10 | .Python
11 | build/
12 | develop-eggs/
13 | dist/
14 | downloads/
15 | eggs/
16 | .eggs/
17 | lib/
18 | lib64/
19 | parts/
20 | sdist/
21 | var/
22 | wheels/
23 | *.egg-info/
24 | .installed.cfg
25 | *.egg
26 | MANIFEST
27 |
28 | # PyInstaller
29 | # Usually these files are written by a python script from a template
30 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
31 | *.manifest
32 | *.spec
33 |
34 | # Installer logs
35 | pip-log.txt
36 | pip-delete-this-directory.txt
37 |
38 | # Unit test / coverage reports
39 | htmlcov/
40 | .tox/
41 | .coverage
42 | .coverage.*
43 | .cache
44 | nosetests.xml
45 | coverage.xml
46 | *.cover
47 | .hypothesis/
48 | .pytest_cache/
49 |
50 | # Translations
51 | *.mo
52 | *.pot
53 |
54 | # Django stuff:
55 | *.log
56 | local_settings.py
57 | db.sqlite3
58 |
59 | # Flask stuff:
60 | instance/
61 | .webassets-cache
62 |
63 | # Scrapy stuff:
64 | .scrapy
65 |
66 | # Sphinx documentation
67 | docs/_build/
68 |
69 | # PyBuilder
70 | target/
71 |
72 | # Jupyter Notebook
73 | .ipynb_checkpoints
74 |
75 | # pyenv
76 | .python-version
77 |
78 | # celery beat schedule file
79 | celerybeat-schedule
80 |
81 | # SageMath parsed files
82 | *.sage.py
83 |
84 | # Environments
85 | .env
86 | .venv
87 | env/
88 | venv/
89 | ENV/
90 | env.bak/
91 | venv.bak/
92 |
93 | # Spyder project settings
94 | .spyderproject
95 | .spyproject
96 |
97 | # Rope project settings
98 | .ropeproject
99 |
100 | # mkdocs documentation
101 | /site
102 |
103 | # mypy
104 | .mypy_cache/
105 |
106 |
107 | /.idea
108 | /data
109 | /frontend
110 | /log
111 | /api
112 | /blivedm
113 | /models
114 | /config.py
115 | /main.py
116 | /update.py
117 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "blivechat"]
2 | path = blivechat
3 | url = https://github.com/xfgryujk/blivechat
4 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # blivechat GUI
2 |
3 | 用于 [blivechat]( https://github.com/xfgryujk/blivechat ) 的图形界面。
4 |
5 | 有朋友在搞 Vtuber,像 blivechat 类似的项目能通过自定义 CSS 的方式在 OBS 上添加一个非常好看的聊天栏。但是想要在桌面端看到弹幕的话得要再开一个浏览器页面,十分不方便。就想写一个背景透明的浮窗浏览器。
6 | 挺喜欢自带服务端的 blibechat, 但是启动后的 Console 窗口不仅丑,还容易误操作,所以就花了点时间写了个UI。
7 |
8 | 写完了之后 [xfgryujk]( https://github.com/xfgryujk ) 觉得这个 [PR]( https://github.com/xfgryujk/blivechat/pull/50 ) 太大,就只好独立出来,于是就有了这个项目。
9 |
10 |
11 | |  |  |
12 | | :----: | :----: |
13 | | 桌面截图 | 游戏截图 |
14 |
15 |
16 | ## 特性
17 |
18 | * 添加了控制台图形窗口;
19 | * 添加了托盘图标,控制台关闭自动缩小到托盘窗口~~防手滑~~;
20 | * 添加网页悬浮窗,可以当成桌面弹幕姬来用:
21 | * 可以配置屏蔽,就像 bilivechat 自动弹窗的管理页面一样;
22 | * 可以添加自定义 CSS;
23 | * CSS 设置的不透明度会正常生效;
24 | * 可调整页面位置、大小和缩放;
25 | * 没有改动 blivechat 原有的代码,维护成本低;
26 | * blivechat 原先的命令行参数会正常生效。
27 |
28 | ## 使用方法
29 |
30 | > 理论上来说,只要启动时 `--host` 和 `--port` 配置合理,网络的其他计算机能通过这个端口连接进来,那也是可以像 blivechat 那样搭成服务器供别人使用。但既然打算去搭建服务器了,[Docker]( https://github.com/xfgryujk/blivechat#%E5%9B%9Bdocker%E8%87%AA%E5%BB%BA%E6%9C%8D%E5%8A%A1%E5%99%A8 )不香嘛?
31 |
32 | ### 一、发布版
33 |
34 | 1. 下载[发布版]( https://github.com/sileence114/blivechatGUI/releases )(仅提供x64 Windows版)
35 | 2. 双击 blivechatGUI.exe 运行,也可以像 blivechat 那样添加命令行参数。
36 | ```bat
37 | blivechatGUI.exe --host 127.0.0.1 --port 12450
38 | ```
39 |
40 | ### 二、源代码版
41 |
42 | 0. 由于使用了git子模块,clone时需要加上`--recursive`参数:
43 | > blivechatGUI 包含了 blivechat, blivechat 包含了 blivedm。
44 | ```bat
45 | git clone --recursive https://github.com/sileence114/blivechatGUI.git
46 | ```
47 | 如果已经clone,拉子模块的方法:
48 | ```bat
49 | git submodule update --init --recursive
50 | ```
51 | 1. 安装依赖(Python 3.6+):
52 | ```bat
53 | pip install -r requirements.txt
54 | ```
55 | 2. 将 blivechat 的代码提取到项目根目录:
56 | > 由于 blivechat 中并没有将模块文件夹定义为包,所以 blivechatGUI 的文件需要与 blivechat 的入口文件在同一个目录中。
57 | ```bat
58 | python extract.py
59 | ```
60 | 3. 编译前端(需要安装Node.js):
61 | ```bat
62 | cd frontend
63 | npm i
64 | npm run build
65 | ```
66 | 4. 运行
67 | 如果想要看 Console 窗口, 请将下面命令中的 `pythonw` 替换为 `python`。
68 | ```bat
69 | pythonw gui.py
70 | ```
71 | 或者可以指定host和端口号:
72 | ```bat
73 | pythonw gui.py --host 127.0.0.1 --port 12450
74 | ```
75 |
76 | ## 启动命令行参数
77 |
78 | blivechatGUI 支持 blivechat 的所有命令行参数:
79 |
80 | * `--host 127.0.0.1` 设置监听地址为 127.0.0.1
81 | * `--port 12450` 设置监听端口为 12450
82 | * `--debug` Debug 模式,将显示更多的信息
83 |
84 | 此外,可以参考 [Chromium 命令行开关]( https://peter.sh/experiments/chromium-command-line-switches/ ),添加需要的参数用以修改浮窗浏览器。
85 | 下面这些参数已被默认添加:
86 |
87 | * `--disable-web-security` 禁用网页安全机制:跨域
88 | * `--allow-insecure-websocket-from-https-origin` 允许https页面访问不加密的websocket: https页面使用ws消息链连接
89 |
90 | 下面的参数在 Debug 模式自动添加:
91 |
92 | * `--remote-debugging-port=9222` 设置 DevTools 远程调试端口为 9222
93 |
94 | ## CSS 代码段
95 |
96 | 若有需要,可以将 CSS 保存,在悬【浮窗设置】-【额外的CSS】中添加。
97 | 若 Github 访问稳定,可复制 CSS 链接,通过【添加路径】按钮添加网络上的 CSS。
98 | > 上文的[桌面截图]( #blivechat-gui )用了**背景透明**、**隐藏滚动条**和**显示虚线边框**。
99 |
100 | * 背景透明 [transparent.css]( https://github.com/sileence114/blivechatGUI/raw/master/document/transparent.css )
101 | 若没有自定义 CSS,悬浮窗的背景为白色属于正常现象,添加这段 CSS 可变透明。这段代码会覆盖其他 CSS 的背景色设置,添加了其他 CSS 时慎用。
102 | ```css
103 | body{
104 | background-color: transparent !important;
105 | }
106 | yt-live-chat-renderer {
107 | background-color: transparent !important;
108 | }
109 | ```
110 | * 隐藏滚动条 [hide-scrollbar.css]( https://github.com/sileence114/blivechatGUI/raw/master/document/hide-scrollbar.css )
111 | 这个仅适用于 Chromium 和 Safari。
112 | ```css
113 | body::-webkit-scrollbar {
114 | display: none;
115 | }
116 | ```
117 |
118 | * 显示**虚线边框** [border.css]( https://github.com/sileence114/blivechatGUI/raw/master/document/border.css )
119 | ```css
120 | body{
121 | border: dotted;
122 | }
123 | ```
124 |
125 | * 渐变配色 [gradient-back-ground.css]( https://github.com/sileence114/blivechatGUI/blob/master/document/gradient-back-ground.css )
126 |
127 | > 上文的[游戏截图]( https://github.com/sileence114/blivechatGUI#blivechat-gui )就是这个 CSS,太长,就不贴了。
128 |
129 | ## PyInstaller 打包
130 |
131 | 0. 按照[前文所述]( #%E4%BA%8C%E6%BA%90%E4%BB%A3%E7%A0%81%E7%89%88 ),安装源代码版,确保其正常运行
132 | 1. 安装 PyInstaller,过程略
133 | 2. cd 到项目根目录,打包
134 | ```bat
135 | pyinstaller -D -w -i frontend\dist\favicon.ico -n blivechatGUI --add-data=".\data\*;.\data" --add-data=".\frontend\dist;.\frontend\dist" --add-data=".\log;.\log" gui.py
136 | ```
137 | 3. 项目中出现了 `dist` 文件夹,将文件夹 `dist\blivechatGUI\PyQt5\Qt` 与 `dist\blivechatGUI\PyQt5\Qt5` 合并(合并后文件夹为 `Qt5`)。
138 | 4. `dist\blivechatGUI` 就是打包输出,可以压缩成 zip 分享出去。
139 |
--------------------------------------------------------------------------------
/document/border.css:
--------------------------------------------------------------------------------
1 | body{
2 | border: dotted;
3 | }
--------------------------------------------------------------------------------
/document/gradient-back-ground.css:
--------------------------------------------------------------------------------
1 | @import url("https://fonts.googleapis.com/css?family=Changa%20One");
2 | @import url("https://fonts.googleapis.com/css?family=Imprima");
3 |
4 | /* 总背景色*/
5 | body {
6 | overflow: hidden;
7 | background-color: rgba(0, 0, 0, 0);
8 | }
9 |
10 | /* 消息列表容器 */
11 | yt-live-chat-item-list-renderer {
12 | margin-left: 5px;
13 | margin-right: 5px;
14 | }
15 |
16 | /* 透明背景 */
17 | yt-live-chat-renderer {
18 | background-color: transparent !important;
19 | }
20 |
21 | /* 一般观众 */
22 | yt-live-chat-text-message-renderer,
23 | yt-live-chat-text-message-renderer[is-highlighted] {
24 | background: linear-gradient(
25 | 90deg,
26 | rgba(173, 169, 150, 0.2),
27 | rgba(242, 242, 242, 0.2),
28 | rgba(219, 219, 219, 0.2),
29 | rgba(234, 234, 234, 0.2)
30 | );
31 | border-radius: 5px;
32 | margin: 5px 0 5px 0;
33 | }
34 | /* UP主消息 */
35 | yt-live-chat-text-message-renderer[author-type="owner"],
36 | yt-live-chat-text-message-renderer[author-type="owner"][is-highlighted] {
37 | background: linear-gradient(
38 | 45deg,
39 | rgba(248, 54, 0, 0.4),
40 | rgb(249, 212, 35, 0.6)
41 | );
42 | }
43 |
44 | /* 管理员消息 */
45 | yt-live-chat-text-message-renderer[author-type="moderator"],
46 | yt-live-chat-text-message-renderer[author-type="moderator"][is-highlighted] {
47 | background: linear-gradient(
48 | 45deg,
49 | rgba(67, 233, 123, 0.4),
50 | rgba(56, 249, 215, 0.6)
51 | );
52 | }
53 |
54 | /* 舰长 */
55 | yt-live-chat-text-message-renderer[author-type="member"],
56 | yt-live-chat-text-message-renderer[author-type="member"][is-highlighted] {
57 | background: linear-gradient(
58 | 60deg,
59 | rgba(196, 113, 237, 0.6),
60 | rgba(205, 107, 210, 0.9),
61 | rgba(246, 79, 89, 1)
62 | );
63 | }
64 |
65 | yt-live-chat-author-chip #author-name {
66 | background-color: transparent !important;
67 | }
68 |
69 | /* Outlines */
70 | yt-live-chat-renderer * {
71 | text-shadow: -2px -2px #000000, -2px -1px #000000, -2px 0px #000000,
72 | -2px 1px #000000, -2px 2px #000000, -1px -2px #000000, -1px -1px #000000,
73 | -1px 0px #000000, -1px 1px #000000, -1px 2px #000000, 0px -2px #000000,
74 | 0px -1px #000000, 0px 0px #000000, 0px 1px #000000, 0px 2px #000000,
75 | 1px -2px #000000, 1px -1px #000000, 1px 0px #000000, 1px 1px #000000,
76 | 1px 2px #000000, 2px -2px #000000, 2px -1px #000000, 2px 0px #000000,
77 | 2px 1px #000000, 2px 2px #000000;
78 | font-family: "Imprima", "Helvetica Neue", Helvetica, "PingFang SC",
79 | "Hiragino Sans GB", "Microsoft YaHei", "\5FAE\8F6F\96C5\9ED1", SimHei, Arial,
80 | sans-serif;
81 | font-size: 18px !important;
82 | line-height: 18px !important;
83 | }
84 |
85 | yt-live-chat-text-message-renderer #content,
86 | yt-live-chat-membership-item-renderer #content {
87 | overflow: initial !important;
88 | }
89 |
90 | /* Hide scrollbar. */
91 | yt-live-chat-item-list-renderer #items {
92 | overflow: hidden !important;
93 | }
94 |
95 | yt-live-chat-item-list-renderer #item-scroller {
96 | overflow: hidden !important;
97 | }
98 |
99 | /* Hide header and input. */
100 | yt-live-chat-header-renderer,
101 | yt-live-chat-message-input-renderer {
102 | display: none !important;
103 | }
104 |
105 | /* Reduce side padding. */
106 | yt-live-chat-text-message-renderer {
107 | padding-left: 4px !important;
108 | padding-right: 4px !important;
109 | }
110 |
111 | /* 消息头像设置 */
112 | yt-live-chat-text-message-renderer #author-photo {
113 | margin: 4px 0px 0px 0px !important;
114 | }
115 | yt-live-chat-text-message-renderer #author-photo img {
116 | width: 50px !important;
117 | height: 50px !important;
118 | border-radius: 50px !important;
119 | }
120 | /* 打赏头像设置 */
121 | yt-live-chat-paid-message-renderer #author-photo {
122 | width: 55px !important;
123 | height: 55px !important;
124 | margin: 0px 5px 0px 0px !important;
125 | }
126 | yt-live-chat-paid-message-renderer #author-photo img {
127 | width: 55px !important;
128 | height: 55px !important;
129 | border-radius: 55px !important;
130 | }
131 | /* 上舰头像设置 */
132 | yt-live-chat-membership-item-renderer #author-photo {
133 | width: 55px !important;
134 | height: 55px !important;
135 | margin: 0px 5px 0px 0px !important;
136 | }
137 | yt-live-chat-membership-item-renderer #author-photo img {
138 | width: 55px !important;
139 | height: 55px !important;
140 | border-radius: 55px !important;
141 | }
142 | /* 勋章 */
143 | yt-live-chat-text-message-renderer #chat-badges {
144 | vertical-align: text-top !important;
145 | }
146 |
147 | /* 时间戳 */
148 | yt-live-chat-text-message-renderer #timestamp {
149 | display: none !important;
150 | color: #999999 !important;
151 | font-family: "Imprima", "Helvetica Neue", Helvetica, "PingFang SC",
152 | "Hiragino Sans GB", "Microsoft YaHei", "\5FAE\8F6F\96C5\9ED1", SimHei, Arial,
153 | sans-serif;
154 | font-size: 16px !important;
155 | line-height: 16px !important;
156 | }
157 |
158 | /* UP主名 */
159 | yt-live-chat-text-message-renderer #author-name[type="owner"],
160 | yt-live-chat-text-message-renderer
161 | yt-live-chat-author-badge-renderer[type="owner"] {
162 | color: #ffd600 !important;
163 | }
164 |
165 | /* 管理员名 */
166 | yt-live-chat-text-message-renderer #author-name[type="moderator"],
167 | yt-live-chat-text-message-renderer
168 | yt-live-chat-author-badge-renderer[type="moderator"] {
169 | color: #0f9d58 !important;
170 | }
171 |
172 | /* 舰长名 */
173 | yt-live-chat-text-message-renderer #author-name[type="member"],
174 | yt-live-chat-text-message-renderer
175 | yt-live-chat-author-badge-renderer[type="member"] {
176 | color: rgb(231, 157, 255) !important;
177 | }
178 |
179 | /* 一般观众名 */
180 | yt-live-chat-text-message-renderer #author-name {
181 | color: #cccccc !important;
182 | font-family: "Changa One", "Helvetica Neue", Helvetica, "PingFang SC",
183 | "Hiragino Sans GB", "Microsoft YaHei", "\5FAE\8F6F\96C5\9ED1", SimHei, Arial,
184 | sans-serif;
185 | font-size: 20px !important;
186 | line-height: 20px !important;
187 | padding: 5px 5px 5px 5px !important;
188 | }
189 |
190 | yt-live-chat-text-message-renderer #author-name::after {
191 | content: ":";
192 | margin-left: 2px;
193 | }
194 |
195 | /* 消息文字 */
196 | yt-live-chat-text-message-renderer #message,
197 | yt-live-chat-text-message-renderer #message * {
198 | color: #ffffff !important;
199 | font-family: "Imprima", "Helvetica Neue", Helvetica, "PingFang SC",
200 | "Hiragino Sans GB", "Microsoft YaHei", "\5FAE\8F6F\96C5\9ED1", SimHei, Arial,
201 | sans-serif;
202 | font-size: 18px !important;
203 | line-height: 18px !important;
204 | }
205 |
206 | yt-live-chat-text-message-renderer #message {
207 | display: block !important;
208 | padding: 5px 5px 5px 5px !important;
209 | }
210 |
211 | /* SuperChat/Fan Funding Messages. */
212 |
213 | yt-live-chat-paid-message-renderer #author-name {
214 | padding: 5px 5px 5px 5px !important;
215 | }
216 | yt-live-chat-paid-message-renderer #author-name,
217 | yt-live-chat-paid-message-renderer #author-name *,
218 | yt-live-chat-membership-item-renderer #header-content-inner-column,
219 | yt-live-chat-membership-item-renderer #header-content-inner-column * {
220 | color: #ffffff !important;
221 | font-family: "Changa One", "Helvetica Neue", Helvetica, "PingFang SC",
222 | "Hiragino Sans GB", "Microsoft YaHei", "\5FAE\8F6F\96C5\9ED1", SimHei, Arial,
223 | sans-serif;
224 | font-size: 20px !important;
225 | line-height: 20px !important;
226 | }
227 | yt-live-chat-membership-item-renderer #author-name {
228 | padding: 5px 5px 5px 5px !important;
229 | }
230 |
231 | yt-live-chat-paid-message-renderer #purchase-amount,
232 | yt-live-chat-paid-message-renderer #purchase-amount *,
233 | yt-live-chat-membership-item-renderer #header-subtext,
234 | yt-live-chat-membership-item-renderer #header-subtext * {
235 | color: #ffffff !important;
236 | font-family: "Imprima", "Helvetica Neue", Helvetica, "PingFang SC",
237 | "Hiragino Sans GB", "Microsoft YaHei", "\5FAE\8F6F\96C5\9ED1", SimHei, Arial,
238 | sans-serif;
239 | font-size: 18px !important;
240 | line-height: 18px !important;
241 | padding: 5px 5px 5px 5px !important;
242 | }
243 |
244 | yt-live-chat-paid-message-renderer #content,
245 | yt-live-chat-paid-message-renderer #content * {
246 | color: #ffffff !important;
247 | font-family: "Imprima", "Helvetica Neue", Helvetica, "PingFang SC",
248 | "Hiragino Sans GB", "Microsoft YaHei", "\5FAE\8F6F\96C5\9ED1", SimHei, Arial,
249 | sans-serif;
250 | font-size: 18px !important;
251 | line-height: 18px !important;
252 | }
253 |
254 | yt-live-chat-paid-message-renderer {
255 | margin: 4px 0 !important;
256 | }
257 |
258 | yt-live-chat-membership-item-renderer #card,
259 | yt-live-chat-membership-item-renderer #header {
260 | background-color: #0f9d58 !important;
261 | margin: 4px 0 !important;
262 | }
263 |
264 | yt-live-chat-text-message-renderer a,
265 | yt-live-chat-membership-item-renderer a {
266 | text-decoration: none !important;
267 | }
268 |
269 | yt-live-chat-text-message-renderer[is-deleted],
270 | yt-live-chat-membership-item-renderer[is-deleted] {
271 | display: none !important;
272 | }
273 |
274 | yt-live-chat-ticker-renderer {
275 | background-color: transparent !important;
276 | box-shadow: none !important;
277 | }
278 |
279 | yt-live-chat-ticker-renderer {
280 | display: none !important;
281 | }
282 |
283 | yt-live-chat-ticker-paid-message-item-renderer,
284 | yt-live-chat-ticker-paid-message-item-renderer *,
285 | yt-live-chat-ticker-sponsor-item-renderer,
286 | yt-live-chat-ticker-sponsor-item-renderer * {
287 | color: #ffffff !important;
288 | font-family: "Imprima", "Helvetica Neue", Helvetica, "PingFang SC",
289 | "Hiragino Sans GB", "Microsoft YaHei", "\5FAE\8F6F\96C5\9ED1", SimHei, Arial,
290 | sans-serif;
291 | }
292 |
293 | yt-live-chat-mode-change-message-renderer,
294 | yt-live-chat-viewer-engagement-message-renderer,
295 | yt-live-chat-restricted-participation-renderer {
296 | display: none !important;
297 | }
298 |
299 | @keyframes inout_ani {
300 | 0% {
301 | opacity: 0;
302 | transform: translateX(160px) scale(0.5);
303 | }
304 | 0.16583747927031509% {
305 | opacity: 1;
306 | transform: none;
307 | }
308 | 99.66832504145937% {
309 | opacity: 1;
310 | transform: none;
311 | }
312 | 100% {
313 | opacity: 0;
314 | transform: translateX(-160px) scale(0.5);
315 | }
316 | }
317 |
318 | yt-live-chat-text-message-renderer,
319 | yt-live-chat-membership-item-renderer,
320 | yt-live-chat-paid-message-renderer {
321 | animation-name: inout_ani;
322 | animation-duration: 301500ms;
323 | animation-fill-mode: both;
324 | animation-timing-function: ease;
325 | }
326 |
--------------------------------------------------------------------------------
/document/hide-scrollbar.css:
--------------------------------------------------------------------------------
1 | body::-webkit-scrollbar {
2 | display: none;
3 | }
4 |
--------------------------------------------------------------------------------
/document/screenshot-desktop.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sileence114/blivechatGUI/03c9f670ae4d96aefa30a348167aa513206a8911/document/screenshot-desktop.png
--------------------------------------------------------------------------------
/document/screenshot-game.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sileence114/blivechatGUI/03c9f670ae4d96aefa30a348167aa513206a8911/document/screenshot-game.png
--------------------------------------------------------------------------------
/document/transparent.css:
--------------------------------------------------------------------------------
1 | body{
2 | background-color: transparent !important;
3 | }
4 | yt-live-chat-renderer {
5 | background-color: transparent !important;
6 | }
7 |
--------------------------------------------------------------------------------
/extract.py:
--------------------------------------------------------------------------------
1 | import os
2 | import shutil
3 |
4 |
5 | def copy(from_, to, sources):
6 | print(f'Copy from \'{from_}\', to \'{to}\'.')
7 | for file in sources:
8 | source = os.path.join(from_, file)
9 | target = os.path.join(to, file)
10 | print(f'- \'{source}\' -> \'{target}\'.')
11 | if os.path.isfile(source):
12 | if os.path.exists(target):
13 | print(f' ^ File \'{target}\' existed.')
14 | os.remove(target)
15 | shutil.copyfile(source, target)
16 | else:
17 | if os.path.exists(target):
18 | print(f' ^ Directory \'{target}\' existed.')
19 | shutil.rmtree(target)
20 | shutil.copytree(source, target)
21 |
22 |
23 | if __name__ == '__main__':
24 | copy(
25 | os.path.join('.', 'blivechat'),
26 | os.path.join('.'),
27 | [
28 | 'data', 'frontend', 'log',
29 | 'api', 'blivedm', 'models',
30 | 'config.py', 'main.py', 'update.py'
31 | ]
32 | )
33 |
--------------------------------------------------------------------------------
/gui.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | import asyncio
4 | import logging
5 | import threading
6 |
7 | import aiohttp
8 | import tornado.ioloop
9 | import tornado.web
10 |
11 | import api.chat
12 | import config
13 | import main
14 | import models.avatar
15 | import models.translate
16 | import models.database
17 | import update
18 | import window.main
19 | from window.console import ConsoleHandler
20 |
21 |
22 | def _server_thread(loop, args_):
23 | asyncio.set_event_loop(loop)
24 | main.main(args_)
25 |
26 |
27 | def override(loop):
28 | # event loop for thread
29 | models.avatar._main_event_loop = loop
30 | models.translate._main_event_loop = loop
31 | asyncio.ensure_future(api.chat._http_session.close())
32 | api.chat._http_session = aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(total=10), loop=loop)
33 | asyncio.ensure_future(models.avatar._http_session.close())
34 | models.avatar._http_session = aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(total=10), loop=loop)
35 |
36 | # disable web browser when start.
37 | def _run_server_override(host, port, debug):
38 | app = tornado.web.Application(
39 | main.routes,
40 | websocket_ping_interval=10,
41 | debug=debug,
42 | autoreload=False
43 | )
44 | cfg = config.get_config()
45 | try:
46 | app.listen(
47 | port,
48 | host,
49 | xheaders=cfg.tornado_xheaders
50 | )
51 | except OSError:
52 | main.logger.warning('Address is used %s:%d', host, port)
53 | return
54 | finally:
55 | window.main.config_url = 'http://localhost%s/?_v=%s' % (
56 | f':{port}' if port != 80 else '',
57 | update.VERSION # 防止更新版本后浏览器加载缓存
58 | )
59 | window.main.console.button_open_admin.setEnabled(True)
60 | window.main.console.action_open_admin.setEnabled(True)
61 | window.main.console.button_float_window.setEnabled(True)
62 | window.main.console.action_float_window.setEnabled(True)
63 | main.logger.info('Server started: %s:%d', host, port)
64 | tornado.ioloop.IOLoop.current().start()
65 |
66 | # add ui handler to logger
67 | def _init_logging_override(debug):
68 | # noinspection PyArgumentList
69 | main.logging.basicConfig(
70 | format='{asctime} {levelname} [{threadName}] [{name}]: {message}',
71 | datefmt='%Y-%m-%d %H:%M:%S',
72 | style='{',
73 | level=main.logging.INFO if not debug else main.logging.DEBUG,
74 | handlers=[
75 | main.logging.StreamHandler(ConsoleHandler()),
76 | # main.logging.StreamHandler(),
77 | main.logging.handlers.TimedRotatingFileHandler(
78 | main.LOG_FILE_NAME, encoding='utf-8', when='midnight', backupCount=7, delay=True
79 | )
80 | ]
81 | )
82 | if not debug:
83 | logging.getLogger('tornado.access').setLevel(logging.WARNING)
84 |
85 | # hook to args parser
86 | def _main_override(args_):
87 | main.init_logging(args_.debug)
88 | config.init()
89 | models.database.init(args_.debug)
90 | models.avatar.init()
91 | models.translate.init()
92 | api.chat.init()
93 | update.check_update()
94 |
95 | main.run_server(args_.host, args_.port, args_.debug)
96 |
97 | main.run_server = _run_server_override
98 | main.init_logging = _init_logging_override
99 | main.main = _main_override
100 |
101 |
102 | if __name__ == '__main__':
103 | args = main.parse_args()
104 | window.main.init(args)
105 |
106 | server_loop = asyncio.new_event_loop()
107 | override(server_loop)
108 | server_thread = threading.Thread(target=_server_thread, args=(server_loop, args), name='thread_server')
109 | server_thread.setDaemon(True)
110 | server_thread.start()
111 |
112 | window.main.loop()
113 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | aiohttp==3.7.4
2 | pycryptodome==3.10.1
3 | sqlalchemy==1.3.13
4 | tornado==6.0.2
5 | pyqt5==5.15.4
6 | PyQtWebEngine==5.15.4
7 | pyperclip==1.8.2
--------------------------------------------------------------------------------
/window/adjust.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | import os
4 |
5 | from PyQt5.QtCore import Qt
6 | from PyQt5.QtGui import QIcon, QPixmap, QCloseEvent, QMoveEvent, QResizeEvent
7 | from PyQt5.QtWidgets import QWidget, QLabel, QHBoxLayout, QMessageBox, QDialog
8 |
9 | from window import main, console
10 | from window.desinger.ui_float_scale import Ui_form
11 |
12 |
13 | class AdjustBox(QWidget):
14 | def __init__(self):
15 | super().__init__()
16 | self.move(
17 | main.configs['float']['x'],
18 | main.configs['float']['y']
19 | )
20 | self.resize(
21 | main.configs['float']['width'] - console.window_frame_delta_width,
22 | main.configs['float']['height'] - console.window_frame_delta_height
23 | )
24 | self.setWindowTitle('悬浮窗调整')
25 | self.setWindowIcon(QIcon(QPixmap(
26 | 'frontend/dist/favicon.ico'
27 | if os.path.exists('frontend/dist/favicon.ico')
28 | else 'frontend/public/favicon.ico'
29 | )))
30 | self.horizontal_layout = QHBoxLayout(self)
31 | self.label_message = QLabel(self)
32 | self.label_message.setAlignment(Qt.AlignCenter)
33 | self.horizontal_layout.addWidget(self.label_message)
34 | self.setLayout(self.horizontal_layout)
35 | self.show()
36 | if not main.configs['float']['mindedTransparent']:
37 | QMessageBox.information(
38 | main.console, '提示',
39 | '拖动、伸缩悬浮窗下的空白窗口,悬浮窗会跟随它变化。\n'
40 | '若您没有在悬浮窗下面看到一个空白的窗口,请先将悬浮窗不透明度降低。\n'
41 | '但调整窗口一直存在,只是被不透明的悬浮窗遮住而已。'
42 | )
43 | main.configs['float']['mindedTransparent'] = True
44 |
45 | def moveEvent(self, e: QMoveEvent):
46 | main.configs['float']['x'] = self.x()
47 | main.configs['float']['y'] = self.y()
48 | super().moveEvent(e)
49 | self.adjust_update(0)
50 |
51 | def resizeEvent(self, e: QResizeEvent):
52 | main.configs['float']['width'] = self.frameGeometry().width()
53 | main.configs['float']['height'] = self.frameGeometry().height()
54 | super().resizeEvent(e)
55 | self.adjust_update(1)
56 |
57 | def closeEvent(self, e: QCloseEvent):
58 | main.console.action_float_window_transform.setChecked(False)
59 | self.destroy()
60 | console.adjust_box_instance = None
61 | super().closeEvent(e)
62 |
63 | def adjust_update(self, update_index):
64 | if console.browser_instance is not None:
65 | console.browser_instance.update_adjust(update_index)
66 | self.label_message.setText('拖拽或缩放此窗口调整悬浮窗的位置和大小。\n\n位置:(%d,%d)\n大小:%d×%d' % (
67 | main.configs['float']['x'], main.configs['float']['y'],
68 | main.configs['float']['width'], main.configs['float']['height']
69 | ))
70 |
71 |
72 | class TransformEdit(QDialog, Ui_form):
73 | def __init__(self):
74 | QWidget.__init__(self)
75 | Ui_form.__init__(self)
76 | self.setupUi(self)
77 | self.setWindowIcon(QIcon(QPixmap(
78 | 'frontend/dist/favicon.ico'
79 | if os.path.exists('frontend/dist/favicon.ico')
80 | else 'frontend/public/favicon.ico'
81 | )))
82 | self.horizontal_slider_scale.valueChanged.connect(
83 | lambda: change_scale(self.horizontal_slider_scale.value())
84 | )
85 | self.horizontal_slider_scale.valueChanged.connect(self.spin_box_scale.setValue)
86 | self.spin_box_scale.valueChanged.connect(
87 | lambda: change_scale(self.spin_box_scale.value())
88 | )
89 | self.spin_box_scale.valueChanged.connect(self.horizontal_slider_scale.setValue)
90 | self.show()
91 |
92 | def closeEvent(self, e: QCloseEvent):
93 | main.console.action_float_window_transform_edit.setChecked(False)
94 | self.destroy()
95 | console.transform_edit_instance = None
96 | super().closeEvent(e)
97 |
98 |
99 | def change_scale(percent: int):
100 | main.configs['float']['scale'] = percent
101 | if console.browser_instance is not None:
102 | console.browser_instance.update_adjust(2)
103 |
--------------------------------------------------------------------------------
/window/browser.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | import logging
4 | import os
5 | import re
6 |
7 | from PyQt5.QtCore import Qt, QUrl
8 | from PyQt5.QtGui import QCloseEvent, QIcon, QPixmap, QColor
9 | from PyQt5.QtWebEngineWidgets import QWebEngineView, QWebEngineScript
10 | from PyQt5.QtWidgets import QWidget, QHBoxLayout
11 |
12 | from window import main, setting, console
13 |
14 | JS_LOAD_CSS_FROM_URL = '''(function(){
15 | let link = document.createElement('link');
16 | link.href = '%s';
17 | link.rel = 'stylesheet';
18 | document.head.append(link);
19 | console.log('Additional link to style sheet:\\n', link);
20 | })();
21 | '''
22 | JS_LOAD_CSS_FROM_STR = '''(function(){
23 | let style_node = document.createElement('style');
24 | style_node.append(document.createTextNode(`\n%s\n`));
25 | document.head.append(style_node);
26 | console.log('Additional inline style sheet:\\n', style_node);
27 | })();
28 | '''
29 | ESCAPE_REGEX = re.compile(r'([`\\])')
30 |
31 | logger = logging.getLogger(__name__)
32 |
33 |
34 | class BrowserRoot(QWidget):
35 | def __init__(self):
36 | super().__init__()
37 | logger.debug('Open a browser')
38 | self.setWindowTitle('room')
39 | self.setWindowIcon(QIcon(QPixmap(
40 | 'frontend/dist/favicon.ico'
41 | if os.path.exists('frontend/dist/favicon.ico')
42 | else 'frontend/public/favicon.ico'
43 | )))
44 | self.setWindowOpacity(main.configs['float']['transparent']/100)
45 | self.horizontal_layout = QHBoxLayout(self)
46 | self.horizontal_layout.setContentsMargins(0, 0, 0, 0)
47 | self.webview = WebView()
48 | self.webview.page().setBackgroundColor(QColor(0x00, 0x00, 0x00, 0x00))
49 | self.webview.titleChanged.connect(self.setWindowTitle)
50 | self.update_executes = [
51 | lambda: self.move(main.configs['float']['x'], main.configs['float']['y']),
52 | lambda: self.resize(main.configs['float']['width'], main.configs['float']['height']),
53 | lambda: self.webview.page().setZoomFactor(main.configs['float']['scale']/100)
54 | ]
55 | self.horizontal_layout.addWidget(self.webview)
56 | self.setLayout(self.horizontal_layout)
57 |
58 | self.lock(True)
59 | self.update_executes[0]()
60 | self.update_executes[1]()
61 | main.room_url = setting.get_url()
62 | self.webview.load(QUrl(main.room_url))
63 | self.update_executes[2]()
64 | self.show()
65 |
66 | def load_url(self, url):
67 | self.webview.load(QUrl(url))
68 |
69 | def lock(self, on: bool):
70 | self.setAttribute(Qt.WA_TransparentForMouseEvents, on)
71 | self.setWindowFlag(Qt.FramelessWindowHint, on)
72 | self.setWindowFlag(Qt.WindowStaysOnTopHint, on)
73 | self.setAttribute(Qt.WA_TranslucentBackground, on)
74 |
75 | def update_adjust(self, index: int = 3):
76 | if index < 3:
77 | self.update_executes[index]()
78 | elif index == 3:
79 | for i in self.update_executes:
80 | i()
81 |
82 | def closeEvent(self, e: QCloseEvent):
83 | logger.debug('Close the browser')
84 | main.console.button_float_window.setText('公屏浮窗')
85 | main.console.action_float_window.setChecked(False)
86 | self.destroy()
87 | console.browser_instance = None
88 | super().closeEvent(e)
89 |
90 |
91 | class WebView(QWebEngineView):
92 | def __init__(self):
93 | super().__init__()
94 | java_script = ''
95 | for i in main.configs['css']:
96 | java_script += get_css_insert_script(i)
97 | script = QWebEngineScript()
98 | script.setInjectionPoint(QWebEngineScript.DocumentReady)
99 | script.setSourceCode(java_script)
100 | self.page().scripts().insert(script)
101 |
102 | def additional_css(self, css):
103 | script = get_css_insert_script(css)
104 | self.page().runJavaScript(script)
105 |
106 |
107 | def get_css_insert_script(css):
108 | if QUrl == type(css) and css.isLocalFile() and os.path.isfile(css.toLocalFile()):
109 | with open(css.toLocalFile(), 'r', encoding='UTF-8') as file:
110 | return JS_LOAD_CSS_FROM_STR % ESCAPE_REGEX.sub(
111 | repl=lambda matched: '\\%s' % matched.group(0),
112 | string=file.read()
113 | )
114 | elif QUrl == type(css) and not css.isLocalFile():
115 | return JS_LOAD_CSS_FROM_URL % bytes(css.toEncoded()).decode('ASCII')
116 | elif str == type(css) and os.path.isfile(css):
117 | with open(css, 'r', encoding='UTF-8') as file:
118 | return JS_LOAD_CSS_FROM_STR % ESCAPE_REGEX.sub(
119 | repl=lambda matched: '\\%s' % matched.group(0),
120 | string=file.read()
121 | )
122 | elif str == type(css):
123 | return JS_LOAD_CSS_FROM_STR % ESCAPE_REGEX.sub(
124 | repl=lambda matched: '\\%s' % matched.group(0),
125 | string=css
126 | )
127 | else:
128 | logger.warning(
129 | 'Generated script error: Unknown type of stylesheet. \nType: %s\nPointer: %s\n-----\n%s' %
130 | (type(css), id(css), css)
131 | )
132 |
--------------------------------------------------------------------------------
/window/console.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | import os
4 | import re
5 | import webbrowser
6 | from typing import Optional
7 |
8 | from PyQt5.QtGui import QPixmap, QIcon, QColor
9 | from PyQt5.QtWidgets import QListWidgetItem
10 | from PyQt5.QtWidgets import QMainWindow, QSystemTrayIcon, QAction, QMenu, QMessageBox
11 |
12 | import window.main
13 | from window.adjust import AdjustBox, TransformEdit
14 | from window.browser import BrowserRoot
15 | from window.desinger.ui_root import Ui_root
16 | from window.setting import FloatConfig
17 |
18 | MAX_COUNT_OF_MESSAGES = 1000
19 | LEVEL_RE = re.compile(r'^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} (INFO|WARNING|ERROR|DEBUG|CRITICAL|NOTSET)')
20 | STYLE = {
21 | 'debug': (QColor('#666666'), QColor('#ffffff')),
22 | 'info': (QColor('#1B1B1B'), QColor('#ffffff')),
23 | 'warning': (QColor('#5C3C00'), QColor('#FFFBE5')),
24 | 'error': (QColor('#E10000'), QColor('#FFF0F0')),
25 | 'critical': (QColor('#792675'), QColor('#F8F0FF'))
26 | }
27 | window_frame_delta_width = 0
28 | window_frame_delta_height = 0
29 | browser_instance: Optional['BrowserRoot'] = None
30 | adjust_box_instance: Optional['AdjustBox'] = None
31 | transform_edit_instance: Optional['TransformEdit'] = None
32 |
33 |
34 | class ConsoleWindow(QMainWindow, Ui_root):
35 | def __init__(self):
36 | QMainWindow.__init__(self)
37 | Ui_root.__init__(self)
38 | self.setupUi(self)
39 | icon = QIcon(QPixmap(
40 | 'frontend/dist/favicon.ico' if os.path.exists(
41 | 'frontend/dist/favicon.ico'
42 | ) else 'frontend/public/favicon.ico'
43 | ))
44 | self.setWindowIcon(icon)
45 | self.tray_icon = QSystemTrayIcon(self)
46 | self.tray_icon.setIcon(icon)
47 | self.tray_icon.activated[QSystemTrayIcon.ActivationReason].connect(self._tray_icon_click_handler)
48 | self.action_show_main_window = QAction('打开主界面', self)
49 | self.action_show_main_window.triggered.connect(self._tray_icon_click_handler)
50 | self.action_open_admin = QAction('在浏览器中打开管理页面', self)
51 | self.action_open_admin.setEnabled(False)
52 | self.action_open_admin.triggered.connect(lambda: None if webbrowser.open(window.main.config_url) else None)
53 | self.action_float_window = QAction('公屏聊天悬浮窗', self)
54 | self.action_float_window.setEnabled(False)
55 | self.action_float_window.setCheckable(True)
56 | self.action_float_window.setChecked(False)
57 | self.action_float_window.triggered.connect(self._float_window_handler)
58 | self.action_float_window_transform = QAction('位置和大小', self)
59 | self.action_float_window_transform.setCheckable(True)
60 | self.action_float_window_transform.setChecked(False)
61 | self.action_float_window_transform.triggered.connect(self._show_adjust_handler)
62 | self.action_float_window_transform_edit = QAction('缩放', self)
63 | self.action_float_window_transform_edit.setCheckable(True)
64 | self.action_float_window_transform_edit.setChecked(False)
65 | self.action_float_window_transform_edit.triggered.connect(self._show_scale_edit)
66 | self.menu_float_window_adjust = QMenu('悬浮窗调整', self)
67 | self.menu_float_window_adjust.addAction(self.action_float_window_transform)
68 | self.menu_float_window_adjust.addAction(self.action_float_window_transform_edit)
69 | self.action_float_window_config = QAction('悬浮窗设置', self)
70 | self.action_float_window_config.triggered.connect(self._float_window_config_handler)
71 | self.action_stop = QAction('关闭服务', self)
72 | self.action_stop.triggered.connect(self._stop_handler)
73 | self.menu_tray_icon = QMenu(self)
74 | self.menu_tray_icon.addAction(self.action_show_main_window)
75 | self.menu_tray_icon.addSeparator()
76 | self.menu_tray_icon.addAction(self.action_open_admin)
77 | self.menu_tray_icon.addSeparator()
78 | self.menu_tray_icon.addAction(self.action_float_window)
79 | self.menu_tray_icon.addMenu(self.menu_float_window_adjust)
80 | self.menu_tray_icon.addAction(self.action_float_window_config)
81 | self.menu_tray_icon.addSeparator()
82 | self.menu_tray_icon.addAction(self.action_stop)
83 | self.tray_icon.setContextMenu(self.menu_tray_icon)
84 | self.tray_icon.show()
85 | self.button_open_admin.clicked.connect(lambda: webbrowser.open(window.main.config_url))
86 | self.button_float_window.clicked.connect(self._float_window_handler)
87 | self.button_float_window_config.clicked.connect(self._float_window_config_handler)
88 | self.button_stop.clicked.connect(self._stop_handler)
89 | self.show()
90 | # 窗体宽高与客户区宽高的差(边框的宽高),用以修正 AdjustBox.resize()。
91 | global window_frame_delta_width, window_frame_delta_height
92 | window_frame_delta_width = self.frameGeometry().width() - self.width()
93 | window_frame_delta_height = self.frameGeometry().height() - self.height()
94 |
95 | def _show_scale_edit(self):
96 | global transform_edit_instance
97 | if transform_edit_instance is not None:
98 | transform_edit_instance.close()
99 | else:
100 | transform_edit_instance = TransformEdit()
101 | self.action_float_window_transform_edit.setChecked(True)
102 |
103 | def _show_adjust_handler(self):
104 | global adjust_box_instance
105 | if adjust_box_instance is not None:
106 | adjust_box_instance.close()
107 | else:
108 | adjust_box_instance = AdjustBox()
109 | self.action_float_window_transform.setChecked(True)
110 |
111 | def _float_window_handler(self):
112 | global browser_instance
113 | if browser_instance is not None:
114 | browser_instance.close()
115 | else:
116 | browser_instance = BrowserRoot()
117 | self.button_float_window.setText('关闭浮窗')
118 | self.action_float_window.setChecked(True)
119 |
120 | @staticmethod
121 | def _float_window_config_handler():
122 | FloatConfig()
123 |
124 | def _stop_handler(self):
125 | if QMessageBox.Yes == QMessageBox.question(
126 | self, '关闭?', '要关闭服务器并退出吗?这会使已经打开的直播评论栏无法正常更新!',
127 | QMessageBox.Yes | QMessageBox.No, QMessageBox.No
128 | ):
129 | window.main.app.quit()
130 |
131 | def _tray_icon_click_handler(self, reason):
132 | if QSystemTrayIcon.DoubleClick == reason:
133 | self.showNormal()
134 | self.activateWindow()
135 |
136 |
137 | class ConsoleHandler(object):
138 | @staticmethod
139 | def write(message):
140 | if '\n' != message:
141 | lev = ConsoleHandler.get_lev(message)
142 | q_list_widget_item = QListWidgetItem(message, window.main.console.list_widget_console)
143 | q_list_widget_item.setForeground(STYLE[lev][0])
144 | q_list_widget_item.setBackground(STYLE[lev][1])
145 | if window.main.console.list_widget_console.count() > MAX_COUNT_OF_MESSAGES:
146 | window.main.console.list_widget_console.takeItem(0)
147 |
148 | @staticmethod
149 | def get_lev(msg):
150 | lev = LEVEL_RE.findall(msg)
151 | if len(lev) > 0:
152 | return lev[0].lower()
153 |
--------------------------------------------------------------------------------
/window/desinger/ui_float_config.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | # Form implementation generated from reading ui file 'ui_float_config.ui'
4 | #
5 | # Created by: PyQt5 UI code generator 5.15.4
6 | #
7 | # WARNING: Any manual changes made to this file will be lost when pyuic5 is
8 | # run again. Do not edit this file unless you know what you are doing.
9 |
10 |
11 | from PyQt5 import QtCore, QtGui, QtWidgets
12 |
13 |
14 | class Ui_config_window(object):
15 | def setupUi(self, config_window):
16 | config_window.setObjectName("config_window")
17 | config_window.resize(440, 600)
18 | config_window.setWindowTitle("悬浮窗设置")
19 | self.config_window_vertical_layout = QtWidgets.QVBoxLayout(config_window)
20 | self.config_window_vertical_layout.setObjectName("config_window_vertical_layout")
21 | self.tab_widget = QtWidgets.QTabWidget(config_window)
22 | self.tab_widget.setEnabled(True)
23 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
24 | sizePolicy.setHorizontalStretch(0)
25 | sizePolicy.setVerticalStretch(0)
26 | sizePolicy.setHeightForWidth(self.tab_widget.sizePolicy().hasHeightForWidth())
27 | self.tab_widget.setSizePolicy(sizePolicy)
28 | self.tab_widget.setObjectName("tab_widget")
29 | self.tab_general = QtWidgets.QWidget()
30 | self.tab_general.setObjectName("tab_general")
31 | self.form_layout_general = QtWidgets.QFormLayout(self.tab_general)
32 | self.form_layout_general.setLabelAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
33 | self.form_layout_general.setObjectName("form_layout_general")
34 | self.label_room_id = QtWidgets.QLabel(self.tab_general)
35 | self.label_room_id.setText("房间ID")
36 | self.label_room_id.setObjectName("label_room_id")
37 | self.form_layout_general.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.label_room_id)
38 | self.spin_box_room_id = QtWidgets.QSpinBox(self.tab_general)
39 | self.spin_box_room_id.setMaximum(999999999)
40 | self.spin_box_room_id.setObjectName("spin_box_room_id")
41 | self.form_layout_general.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.spin_box_room_id)
42 | self.check_box_show_messages = QtWidgets.QCheckBox(self.tab_general)
43 | self.check_box_show_messages.setText("显示弹幕")
44 | self.check_box_show_messages.setChecked(True)
45 | self.check_box_show_messages.setObjectName("check_box_show_messages")
46 | self.form_layout_general.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.check_box_show_messages)
47 | self.check_box_merge_similar_messages = QtWidgets.QCheckBox(self.tab_general)
48 | self.check_box_merge_similar_messages.setText("合并相似弹幕")
49 | self.check_box_merge_similar_messages.setObjectName("check_box_merge_similar_messages")
50 | self.form_layout_general.setWidget(3, QtWidgets.QFormLayout.FieldRole, self.check_box_merge_similar_messages)
51 | self.line_1 = QtWidgets.QFrame(self.tab_general)
52 | self.line_1.setFrameShape(QtWidgets.QFrame.HLine)
53 | self.line_1.setFrameShadow(QtWidgets.QFrame.Sunken)
54 | self.line_1.setObjectName("line_1")
55 | self.form_layout_general.setWidget(1, QtWidgets.QFormLayout.SpanningRole, self.line_1)
56 | self.spin_box_max_number_of_messages = QtWidgets.QSpinBox(self.tab_general)
57 | self.spin_box_max_number_of_messages.setMaximum(999999999)
58 | self.spin_box_max_number_of_messages.setProperty("value", 60)
59 | self.spin_box_max_number_of_messages.setObjectName("spin_box_max_number_of_messages")
60 | self.form_layout_general.setWidget(4, QtWidgets.QFormLayout.FieldRole, self.spin_box_max_number_of_messages)
61 | self.label_max_number_of_messages = QtWidgets.QLabel(self.tab_general)
62 | self.label_max_number_of_messages.setText("最大弹幕数")
63 | self.label_max_number_of_messages.setObjectName("label_max_number_of_messages")
64 | self.form_layout_general.setWidget(4, QtWidgets.QFormLayout.LabelRole, self.label_max_number_of_messages)
65 | self.line_2 = QtWidgets.QFrame(self.tab_general)
66 | self.line_2.setFrameShape(QtWidgets.QFrame.HLine)
67 | self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken)
68 | self.line_2.setObjectName("line_2")
69 | self.form_layout_general.setWidget(5, QtWidgets.QFormLayout.SpanningRole, self.line_2)
70 | self.check_box_show_gift_name = QtWidgets.QCheckBox(self.tab_general)
71 | self.check_box_show_gift_name.setText("显示礼物名")
72 | self.check_box_show_gift_name.setObjectName("check_box_show_gift_name")
73 | self.form_layout_general.setWidget(7, QtWidgets.QFormLayout.FieldRole, self.check_box_show_gift_name)
74 | self.check_box_merge_gifts = QtWidgets.QCheckBox(self.tab_general)
75 | self.check_box_merge_gifts.setText("合并礼物")
76 | self.check_box_merge_gifts.setChecked(True)
77 | self.check_box_merge_gifts.setObjectName("check_box_merge_gifts")
78 | self.form_layout_general.setWidget(8, QtWidgets.QFormLayout.FieldRole, self.check_box_merge_gifts)
79 | self.check_box_show_shper_chats = QtWidgets.QCheckBox(self.tab_general)
80 | self.check_box_show_shper_chats.setText("显示打赏和新舰长")
81 | self.check_box_show_shper_chats.setChecked(True)
82 | self.check_box_show_shper_chats.setObjectName("check_box_show_shper_chats")
83 | self.form_layout_general.setWidget(6, QtWidgets.QFormLayout.FieldRole, self.check_box_show_shper_chats)
84 | self.spin_box_min_price_of_super_chats_to_show = QtWidgets.QSpinBox(self.tab_general)
85 | self.spin_box_min_price_of_super_chats_to_show.setMaximum(999999999)
86 | self.spin_box_min_price_of_super_chats_to_show.setProperty("value", 7)
87 | self.spin_box_min_price_of_super_chats_to_show.setObjectName("spin_box_min_price_of_super_chats_to_show")
88 | self.form_layout_general.setWidget(9, QtWidgets.QFormLayout.FieldRole, self.spin_box_min_price_of_super_chats_to_show)
89 | self.label_min_price_of_super_chats_to_show = QtWidgets.QLabel(self.tab_general)
90 | self.label_min_price_of_super_chats_to_show.setText("最低显示打赏价格(元)")
91 | self.label_min_price_of_super_chats_to_show.setObjectName("label_min_price_of_super_chats_to_show")
92 | self.form_layout_general.setWidget(9, QtWidgets.QFormLayout.LabelRole, self.label_min_price_of_super_chats_to_show)
93 | self.tab_widget.addTab(self.tab_general, "常规")
94 | self.tab_block = QtWidgets.QWidget()
95 | self.tab_block.setObjectName("tab_block")
96 | self.form_layout_block = QtWidgets.QFormLayout(self.tab_block)
97 | self.form_layout_block.setLabelAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
98 | self.form_layout_block.setObjectName("form_layout_block")
99 | self.check_box_block_system_messages = QtWidgets.QCheckBox(self.tab_block)
100 | self.check_box_block_system_messages.setText("屏蔽礼物弹幕")
101 | self.check_box_block_system_messages.setChecked(True)
102 | self.check_box_block_system_messages.setObjectName("check_box_block_system_messages")
103 | self.form_layout_block.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.check_box_block_system_messages)
104 | self.check_box_block_informal_users = QtWidgets.QCheckBox(self.tab_block)
105 | self.check_box_block_informal_users.setText("屏蔽非正式会员")
106 | self.check_box_block_informal_users.setObjectName("check_box_block_informal_users")
107 | self.form_layout_block.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.check_box_block_informal_users)
108 | self.check_box_block_unverified_users = QtWidgets.QCheckBox(self.tab_block)
109 | self.check_box_block_unverified_users.setText("屏蔽未绑定手机用户")
110 | self.check_box_block_unverified_users.setObjectName("check_box_block_unverified_users")
111 | self.form_layout_block.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.check_box_block_unverified_users)
112 | self.line_3 = QtWidgets.QFrame(self.tab_block)
113 | self.line_3.setFrameShape(QtWidgets.QFrame.HLine)
114 | self.line_3.setFrameShadow(QtWidgets.QFrame.Sunken)
115 | self.line_3.setObjectName("line_3")
116 | self.form_layout_block.setWidget(3, QtWidgets.QFormLayout.SpanningRole, self.line_3)
117 | self.label_block_user_level_lower_than = QtWidgets.QLabel(self.tab_block)
118 | self.label_block_user_level_lower_than.setText("屏蔽用户等级低于")
119 | self.label_block_user_level_lower_than.setObjectName("label_block_user_level_lower_than")
120 | self.form_layout_block.setWidget(4, QtWidgets.QFormLayout.LabelRole, self.label_block_user_level_lower_than)
121 | self.horizontal_layout_block_user_level_lower_than = QtWidgets.QHBoxLayout()
122 | self.horizontal_layout_block_user_level_lower_than.setObjectName("horizontal_layout_block_user_level_lower_than")
123 | self.horizontal_slider_block_user_level_lower_than = QtWidgets.QSlider(self.tab_block)
124 | self.horizontal_slider_block_user_level_lower_than.setMaximum(60)
125 | self.horizontal_slider_block_user_level_lower_than.setOrientation(QtCore.Qt.Horizontal)
126 | self.horizontal_slider_block_user_level_lower_than.setObjectName("horizontal_slider_block_user_level_lower_than")
127 | self.horizontal_layout_block_user_level_lower_than.addWidget(self.horizontal_slider_block_user_level_lower_than)
128 | self.spin_box_block_user_level_lower_than = QtWidgets.QSpinBox(self.tab_block)
129 | self.spin_box_block_user_level_lower_than.setMaximum(60)
130 | self.spin_box_block_user_level_lower_than.setObjectName("spin_box_block_user_level_lower_than")
131 | self.horizontal_layout_block_user_level_lower_than.addWidget(self.spin_box_block_user_level_lower_than)
132 | self.form_layout_block.setLayout(4, QtWidgets.QFormLayout.FieldRole, self.horizontal_layout_block_user_level_lower_than)
133 | self.label_block_medal_level_lower_than = QtWidgets.QLabel(self.tab_block)
134 | self.label_block_medal_level_lower_than.setText("屏蔽当前直播间勋章等级低于")
135 | self.label_block_medal_level_lower_than.setObjectName("label_block_medal_level_lower_than")
136 | self.form_layout_block.setWidget(5, QtWidgets.QFormLayout.LabelRole, self.label_block_medal_level_lower_than)
137 | self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
138 | self.horizontalLayout_4.setObjectName("horizontalLayout_4")
139 | self.horizontal_slider_block_medal_level_lower_than = QtWidgets.QSlider(self.tab_block)
140 | self.horizontal_slider_block_medal_level_lower_than.setMaximum(40)
141 | self.horizontal_slider_block_medal_level_lower_than.setOrientation(QtCore.Qt.Horizontal)
142 | self.horizontal_slider_block_medal_level_lower_than.setObjectName("horizontal_slider_block_medal_level_lower_than")
143 | self.horizontalLayout_4.addWidget(self.horizontal_slider_block_medal_level_lower_than)
144 | self.spin_box_block_medal_level_lower_than = QtWidgets.QSpinBox(self.tab_block)
145 | self.spin_box_block_medal_level_lower_than.setMaximum(40)
146 | self.spin_box_block_medal_level_lower_than.setObjectName("spin_box_block_medal_level_lower_than")
147 | self.horizontalLayout_4.addWidget(self.spin_box_block_medal_level_lower_than)
148 | self.form_layout_block.setLayout(5, QtWidgets.QFormLayout.FieldRole, self.horizontalLayout_4)
149 | self.line_4 = QtWidgets.QFrame(self.tab_block)
150 | self.line_4.setFrameShape(QtWidgets.QFrame.HLine)
151 | self.line_4.setFrameShadow(QtWidgets.QFrame.Sunken)
152 | self.line_4.setObjectName("line_4")
153 | self.form_layout_block.setWidget(6, QtWidgets.QFormLayout.SpanningRole, self.line_4)
154 | self.label_block_keywords = QtWidgets.QLabel(self.tab_block)
155 | self.label_block_keywords.setText("屏蔽关键词")
156 | self.label_block_keywords.setObjectName("label_block_keywords")
157 | self.form_layout_block.setWidget(7, QtWidgets.QFormLayout.LabelRole, self.label_block_keywords)
158 | self.text_edit_block_keywords = QtWidgets.QTextEdit(self.tab_block)
159 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
160 | sizePolicy.setHorizontalStretch(0)
161 | sizePolicy.setVerticalStretch(0)
162 | sizePolicy.setHeightForWidth(self.text_edit_block_keywords.sizePolicy().hasHeightForWidth())
163 | self.text_edit_block_keywords.setSizePolicy(sizePolicy)
164 | self.text_edit_block_keywords.setMaximumSize(QtCore.QSize(16777215, 50))
165 | self.text_edit_block_keywords.setAcceptRichText(False)
166 | self.text_edit_block_keywords.setPlaceholderText("一行一个")
167 | self.text_edit_block_keywords.setObjectName("text_edit_block_keywords")
168 | self.form_layout_block.setWidget(7, QtWidgets.QFormLayout.FieldRole, self.text_edit_block_keywords)
169 | self.label_block_users = QtWidgets.QLabel(self.tab_block)
170 | self.label_block_users.setText("屏蔽用户")
171 | self.label_block_users.setObjectName("label_block_users")
172 | self.form_layout_block.setWidget(8, QtWidgets.QFormLayout.LabelRole, self.label_block_users)
173 | self.text_edit_block_users = QtWidgets.QTextEdit(self.tab_block)
174 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
175 | sizePolicy.setHorizontalStretch(0)
176 | sizePolicy.setVerticalStretch(0)
177 | sizePolicy.setHeightForWidth(self.text_edit_block_users.sizePolicy().hasHeightForWidth())
178 | self.text_edit_block_users.setSizePolicy(sizePolicy)
179 | self.text_edit_block_users.setMaximumSize(QtCore.QSize(16777215, 50))
180 | self.text_edit_block_users.setAcceptRichText(False)
181 | self.text_edit_block_users.setPlaceholderText("一行一个")
182 | self.text_edit_block_users.setObjectName("text_edit_block_users")
183 | self.form_layout_block.setWidget(8, QtWidgets.QFormLayout.FieldRole, self.text_edit_block_users)
184 | self.tab_widget.addTab(self.tab_block, "屏蔽")
185 | self.tab_advanced = QtWidgets.QWidget()
186 | self.tab_advanced.setObjectName("tab_advanced")
187 | self.form_layout_advanced = QtWidgets.QFormLayout(self.tab_advanced)
188 | self.form_layout_advanced.setObjectName("form_layout_advanced")
189 | self.check_box_reply_message_by_server = QtWidgets.QCheckBox(self.tab_advanced)
190 | self.check_box_reply_message_by_server.setText("通过服务器转发消息")
191 | self.check_box_reply_message_by_server.setObjectName("check_box_reply_message_by_server")
192 | self.form_layout_advanced.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.check_box_reply_message_by_server)
193 | self.check_box_auto_translate_messages_to_japanese = QtWidgets.QCheckBox(self.tab_advanced)
194 | self.check_box_auto_translate_messages_to_japanese.setText("自动翻译弹幕到日语(需要通过服务器转发消息)")
195 | self.check_box_auto_translate_messages_to_japanese.setObjectName("check_box_auto_translate_messages_to_japanese")
196 | self.form_layout_advanced.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.check_box_auto_translate_messages_to_japanese)
197 | self.radio_button_pronunciation_of_gift_username_none = QtWidgets.QRadioButton(self.tab_advanced)
198 | self.radio_button_pronunciation_of_gift_username_none.setText("不显示")
199 | self.radio_button_pronunciation_of_gift_username_none.setChecked(True)
200 | self.radio_button_pronunciation_of_gift_username_none.setObjectName("radio_button_pronunciation_of_gift_username_none")
201 | self.form_layout_advanced.setWidget(3, QtWidgets.QFormLayout.FieldRole, self.radio_button_pronunciation_of_gift_username_none)
202 | self.radio_button_pronunciation_of_gift_username_pinyin = QtWidgets.QRadioButton(self.tab_advanced)
203 | self.radio_button_pronunciation_of_gift_username_pinyin.setText("拼音")
204 | self.radio_button_pronunciation_of_gift_username_pinyin.setObjectName("radio_button_pronunciation_of_gift_username_pinyin")
205 | self.form_layout_advanced.setWidget(4, QtWidgets.QFormLayout.FieldRole, self.radio_button_pronunciation_of_gift_username_pinyin)
206 | self.radio_button_pronunciation_of_gift_username_kana = QtWidgets.QRadioButton(self.tab_advanced)
207 | self.radio_button_pronunciation_of_gift_username_kana.setText("日文假名")
208 | self.radio_button_pronunciation_of_gift_username_kana.setObjectName("radio_button_pronunciation_of_gift_username_kana")
209 | self.form_layout_advanced.setWidget(5, QtWidgets.QFormLayout.FieldRole, self.radio_button_pronunciation_of_gift_username_kana)
210 | self.label_pronunciation_of_gift_username = QtWidgets.QLabel(self.tab_advanced)
211 | self.label_pronunciation_of_gift_username.setText("标注打赏用户读音")
212 | self.label_pronunciation_of_gift_username.setObjectName("label_pronunciation_of_gift_username")
213 | self.form_layout_advanced.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.label_pronunciation_of_gift_username)
214 | self.line_5 = QtWidgets.QFrame(self.tab_advanced)
215 | self.line_5.setFrameShape(QtWidgets.QFrame.HLine)
216 | self.line_5.setFrameShadow(QtWidgets.QFrame.Sunken)
217 | self.line_5.setObjectName("line_5")
218 | self.form_layout_advanced.setWidget(2, QtWidgets.QFormLayout.SpanningRole, self.line_5)
219 | self.tab_widget.addTab(self.tab_advanced, "高级")
220 | self.config_window_vertical_layout.addWidget(self.tab_widget)
221 | self.frame_room_url = QtWidgets.QFrame(config_window)
222 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed)
223 | sizePolicy.setHorizontalStretch(0)
224 | sizePolicy.setVerticalStretch(0)
225 | sizePolicy.setHeightForWidth(self.frame_room_url.sizePolicy().hasHeightForWidth())
226 | self.frame_room_url.setSizePolicy(sizePolicy)
227 | self.frame_room_url.setFrameShape(QtWidgets.QFrame.StyledPanel)
228 | self.frame_room_url.setFrameShadow(QtWidgets.QFrame.Raised)
229 | self.frame_room_url.setObjectName("frame_room_url")
230 | self.form_layout_room_url = QtWidgets.QFormLayout(self.frame_room_url)
231 | self.form_layout_room_url.setObjectName("form_layout_room_url")
232 | self.label_room_url = QtWidgets.QLabel(self.frame_room_url)
233 | self.label_room_url.setText("房间URL")
234 | self.label_room_url.setObjectName("label_room_url")
235 | self.form_layout_room_url.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.label_room_url)
236 | self.horizontal_layout_room_url = QtWidgets.QHBoxLayout()
237 | self.horizontal_layout_room_url.setObjectName("horizontal_layout_room_url")
238 | self.line_edit_room_url = QtWidgets.QLineEdit(self.frame_room_url)
239 | self.line_edit_room_url.setObjectName("line_edit_room_url")
240 | self.horizontal_layout_room_url.addWidget(self.line_edit_room_url)
241 | self.push_button_copy_url = QtWidgets.QPushButton(self.frame_room_url)
242 | self.push_button_copy_url.setText("复制")
243 | self.push_button_copy_url.setObjectName("push_button_copy_url")
244 | self.horizontal_layout_room_url.addWidget(self.push_button_copy_url)
245 | self.form_layout_room_url.setLayout(0, QtWidgets.QFormLayout.FieldRole, self.horizontal_layout_room_url)
246 | self.horizontal_layout_room_url_edit = QtWidgets.QHBoxLayout()
247 | self.horizontal_layout_room_url_edit.setObjectName("horizontal_layout_room_url_edit")
248 | self.push_button_export_config = QtWidgets.QPushButton(self.frame_room_url)
249 | self.push_button_export_config.setText("导出配置")
250 | self.push_button_export_config.setObjectName("push_button_export_config")
251 | self.horizontal_layout_room_url_edit.addWidget(self.push_button_export_config)
252 | self.push_button_import_config = QtWidgets.QPushButton(self.frame_room_url)
253 | self.push_button_import_config.setText("导入配置")
254 | self.push_button_import_config.setObjectName("push_button_import_config")
255 | self.horizontal_layout_room_url_edit.addWidget(self.push_button_import_config)
256 | spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
257 | self.horizontal_layout_room_url_edit.addItem(spacerItem)
258 | self.push_button_set_test_room = QtWidgets.QPushButton(self.frame_room_url)
259 | self.push_button_set_test_room.setText("设置为测试房间")
260 | self.push_button_set_test_room.setObjectName("push_button_set_test_room")
261 | self.horizontal_layout_room_url_edit.addWidget(self.push_button_set_test_room)
262 | self.form_layout_room_url.setLayout(1, QtWidgets.QFormLayout.FieldRole, self.horizontal_layout_room_url_edit)
263 | self.config_window_vertical_layout.addWidget(self.frame_room_url)
264 | self.frame_extra_css = QtWidgets.QFrame(config_window)
265 | self.frame_extra_css.setMinimumSize(QtCore.QSize(0, 150))
266 | self.frame_extra_css.setFrameShape(QtWidgets.QFrame.StyledPanel)
267 | self.frame_extra_css.setFrameShadow(QtWidgets.QFrame.Raised)
268 | self.frame_extra_css.setObjectName("frame_extra_css")
269 | self.vertical_layout_extra_css = QtWidgets.QVBoxLayout(self.frame_extra_css)
270 | self.vertical_layout_extra_css.setObjectName("vertical_layout_extra_css")
271 | self.label_extra_css = QtWidgets.QLabel(self.frame_extra_css)
272 | self.label_extra_css.setText("额外的CSS")
273 | self.label_extra_css.setObjectName("label_extra_css")
274 | self.vertical_layout_extra_css.addWidget(self.label_extra_css)
275 | self.horizontal_layout_extra_css = QtWidgets.QHBoxLayout()
276 | self.horizontal_layout_extra_css.setObjectName("horizontal_layout_extra_css")
277 | self.list_widget_css_list = QtWidgets.QListWidget(self.frame_extra_css)
278 | self.list_widget_css_list.setObjectName("list_widget_css_list")
279 | self.horizontal_layout_extra_css.addWidget(self.list_widget_css_list)
280 | self.vertical_layout_extra_css_buttons = QtWidgets.QVBoxLayout()
281 | self.vertical_layout_extra_css_buttons.setObjectName("vertical_layout_extra_css_buttons")
282 | self.push_button_extra_css_add = QtWidgets.QPushButton(self.frame_extra_css)
283 | self.push_button_extra_css_add.setText("添加文件")
284 | self.push_button_extra_css_add.setObjectName("push_button_extra_css_add")
285 | self.vertical_layout_extra_css_buttons.addWidget(self.push_button_extra_css_add)
286 | self.push_button_extra_css_add_url = QtWidgets.QPushButton(self.frame_extra_css)
287 | self.push_button_extra_css_add_url.setText("添加路径")
288 | self.push_button_extra_css_add_url.setObjectName("push_button_extra_css_add_url")
289 | self.vertical_layout_extra_css_buttons.addWidget(self.push_button_extra_css_add_url)
290 | self.push_button_extra_css_remove = QtWidgets.QPushButton(self.frame_extra_css)
291 | self.push_button_extra_css_remove.setText("删除")
292 | self.push_button_extra_css_remove.setObjectName("push_button_extra_css_remove")
293 | self.vertical_layout_extra_css_buttons.addWidget(self.push_button_extra_css_remove)
294 | self.push_button_extra_css_edit = QtWidgets.QPushButton(self.frame_extra_css)
295 | self.push_button_extra_css_edit.setText("编辑")
296 | self.push_button_extra_css_edit.setObjectName("push_button_extra_css_edit")
297 | self.vertical_layout_extra_css_buttons.addWidget(self.push_button_extra_css_edit)
298 | spacerItem1 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
299 | self.vertical_layout_extra_css_buttons.addItem(spacerItem1)
300 | self.horizontal_layout_extra_css.addLayout(self.vertical_layout_extra_css_buttons)
301 | self.vertical_layout_extra_css.addLayout(self.horizontal_layout_extra_css)
302 | self.config_window_vertical_layout.addWidget(self.frame_extra_css)
303 |
304 | self.retranslateUi(config_window)
305 | self.tab_widget.setCurrentIndex(0)
306 | QtCore.QMetaObject.connectSlotsByName(config_window)
307 |
308 | def retranslateUi(self, config_window):
309 | pass
310 |
--------------------------------------------------------------------------------
/window/desinger/ui_float_config.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | config_window
4 |
5 |
6 |
7 | 0
8 | 0
9 | 440
10 | 600
11 |
12 |
13 |
14 | 悬浮窗设置
15 |
16 |
17 | -
18 |
19 |
20 | true
21 |
22 |
23 |
24 | 0
25 | 0
26 |
27 |
28 |
29 | 0
30 |
31 |
32 |
33 | 常规
34 |
35 |
36 |
37 | Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
38 |
39 |
-
40 |
41 |
42 | 房间ID
43 |
44 |
45 |
46 | -
47 |
48 |
49 | 999999999
50 |
51 |
52 |
53 | -
54 |
55 |
56 | 显示弹幕
57 |
58 |
59 | true
60 |
61 |
62 |
63 | -
64 |
65 |
66 | 合并相似弹幕
67 |
68 |
69 |
70 | -
71 |
72 |
73 | Qt::Horizontal
74 |
75 |
76 |
77 | -
78 |
79 |
80 | 999999999
81 |
82 |
83 | 60
84 |
85 |
86 |
87 | -
88 |
89 |
90 | 最大弹幕数
91 |
92 |
93 |
94 | -
95 |
96 |
97 | Qt::Horizontal
98 |
99 |
100 |
101 | -
102 |
103 |
104 | 显示礼物名
105 |
106 |
107 |
108 | -
109 |
110 |
111 | 合并礼物
112 |
113 |
114 | true
115 |
116 |
117 |
118 | -
119 |
120 |
121 | 显示打赏和新舰长
122 |
123 |
124 | true
125 |
126 |
127 |
128 | -
129 |
130 |
131 | 999999999
132 |
133 |
134 | 7
135 |
136 |
137 |
138 | -
139 |
140 |
141 | 最低显示打赏价格(元)
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 | 屏蔽
150 |
151 |
152 |
153 | Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
154 |
155 | -
156 |
157 |
158 | 屏蔽礼物弹幕
159 |
160 |
161 | true
162 |
163 |
164 |
165 | -
166 |
167 |
168 | 屏蔽非正式会员
169 |
170 |
171 |
172 | -
173 |
174 |
175 | 屏蔽未绑定手机用户
176 |
177 |
178 |
179 | -
180 |
181 |
182 | Qt::Horizontal
183 |
184 |
185 |
186 | -
187 |
188 |
189 | 屏蔽用户等级低于
190 |
191 |
192 |
193 | -
194 |
195 |
-
196 |
197 |
198 | 60
199 |
200 |
201 | Qt::Horizontal
202 |
203 |
204 |
205 | -
206 |
207 |
208 | 60
209 |
210 |
211 |
212 |
213 |
214 | -
215 |
216 |
217 | 屏蔽当前直播间勋章等级低于
218 |
219 |
220 |
221 | -
222 |
223 |
-
224 |
225 |
226 | 40
227 |
228 |
229 | Qt::Horizontal
230 |
231 |
232 |
233 | -
234 |
235 |
236 | 40
237 |
238 |
239 |
240 |
241 |
242 | -
243 |
244 |
245 | Qt::Horizontal
246 |
247 |
248 |
249 | -
250 |
251 |
252 | 屏蔽关键词
253 |
254 |
255 |
256 | -
257 |
258 |
259 |
260 | 0
261 | 0
262 |
263 |
264 |
265 |
266 | 16777215
267 | 50
268 |
269 |
270 |
271 | false
272 |
273 |
274 | 一行一个
275 |
276 |
277 |
278 | -
279 |
280 |
281 | 屏蔽用户
282 |
283 |
284 |
285 | -
286 |
287 |
288 |
289 | 0
290 | 0
291 |
292 |
293 |
294 |
295 | 16777215
296 | 50
297 |
298 |
299 |
300 | false
301 |
302 |
303 | 一行一个
304 |
305 |
306 |
307 |
308 |
309 |
310 |
311 | 高级
312 |
313 |
314 | -
315 |
316 |
317 | 通过服务器转发消息
318 |
319 |
320 |
321 | -
322 |
323 |
324 | 自动翻译弹幕到日语(需要通过服务器转发消息)
325 |
326 |
327 |
328 | -
329 |
330 |
331 | 不显示
332 |
333 |
334 | true
335 |
336 |
337 |
338 | -
339 |
340 |
341 | 拼音
342 |
343 |
344 |
345 | -
346 |
347 |
348 | 日文假名
349 |
350 |
351 |
352 | -
353 |
354 |
355 | 标注打赏用户读音
356 |
357 |
358 |
359 | -
360 |
361 |
362 | Qt::Horizontal
363 |
364 |
365 |
366 |
367 |
368 |
369 |
370 | -
371 |
372 |
373 |
374 | 0
375 | 0
376 |
377 |
378 |
379 | QFrame::StyledPanel
380 |
381 |
382 | QFrame::Raised
383 |
384 |
385 |
-
386 |
387 |
388 | 房间URL
389 |
390 |
391 |
392 | -
393 |
394 |
-
395 |
396 |
397 | -
398 |
399 |
400 | 复制
401 |
402 |
403 |
404 |
405 |
406 | -
407 |
408 |
-
409 |
410 |
411 | 导出配置
412 |
413 |
414 |
415 | -
416 |
417 |
418 | 导入配置
419 |
420 |
421 |
422 | -
423 |
424 |
425 | Qt::Horizontal
426 |
427 |
428 |
429 | 40
430 | 20
431 |
432 |
433 |
434 |
435 | -
436 |
437 |
438 | 设置为测试房间
439 |
440 |
441 |
442 |
443 |
444 |
445 |
446 |
447 | -
448 |
449 |
450 |
451 | 0
452 | 150
453 |
454 |
455 |
456 | QFrame::StyledPanel
457 |
458 |
459 | QFrame::Raised
460 |
461 |
462 |
-
463 |
464 |
465 | 额外的CSS
466 |
467 |
468 |
469 | -
470 |
471 |
-
472 |
473 |
474 | -
475 |
476 |
-
477 |
478 |
479 | 添加文件
480 |
481 |
482 |
483 | -
484 |
485 |
486 | 添加路径
487 |
488 |
489 |
490 | -
491 |
492 |
493 | 删除
494 |
495 |
496 |
497 | -
498 |
499 |
500 | 编辑
501 |
502 |
503 |
504 | -
505 |
506 |
507 | Qt::Vertical
508 |
509 |
510 |
511 | 20
512 | 40
513 |
514 |
515 |
516 |
517 |
518 |
519 |
520 |
521 |
522 |
523 |
524 |
525 |
526 |
527 |
528 |
529 |
--------------------------------------------------------------------------------
/window/desinger/ui_float_scale.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | # Form implementation generated from reading ui file 'ui_float_scale.ui'
4 | #
5 | # Created by: PyQt5 UI code generator 5.15.4
6 | #
7 | # WARNING: Any manual changes made to this file will be lost when pyuic5 is
8 | # run again. Do not edit this file unless you know what you are doing.
9 |
10 |
11 | from PyQt5 import QtCore, QtGui, QtWidgets
12 |
13 |
14 | class Ui_form(object):
15 | def setupUi(self, form):
16 | form.setObjectName("form")
17 | form.resize(320, 60)
18 | form.setMinimumSize(QtCore.QSize(320, 60))
19 | form.setMaximumSize(QtCore.QSize(320, 60))
20 | form.setWindowTitle("不透明度与缩放")
21 | self.formLayout = QtWidgets.QFormLayout(form)
22 | self.formLayout.setObjectName("formLayout")
23 | self.label = QtWidgets.QLabel(form)
24 | self.label.setText("滑动滑块调节页面缩放")
25 | self.label.setObjectName("label")
26 | self.formLayout.setWidget(0, QtWidgets.QFormLayout.SpanningRole, self.label)
27 | self.horizontal_layout_scale = QtWidgets.QHBoxLayout()
28 | self.horizontal_layout_scale.setObjectName("horizontal_layout_scale")
29 | self.label_scale = QtWidgets.QLabel(form)
30 | self.label_scale.setText("缩放")
31 | self.label_scale.setObjectName("label_scale")
32 | self.horizontal_layout_scale.addWidget(self.label_scale)
33 | self.horizontal_slider_scale = QtWidgets.QSlider(form)
34 | self.horizontal_slider_scale.setMinimum(25)
35 | self.horizontal_slider_scale.setMaximum(500)
36 | self.horizontal_slider_scale.setSingleStep(5)
37 | self.horizontal_slider_scale.setProperty("value", 100)
38 | self.horizontal_slider_scale.setOrientation(QtCore.Qt.Horizontal)
39 | self.horizontal_slider_scale.setObjectName("horizontal_slider_scale")
40 | self.horizontal_layout_scale.addWidget(self.horizontal_slider_scale)
41 | self.spin_box_scale = QtWidgets.QSpinBox(form)
42 | self.spin_box_scale.setSuffix("%")
43 | self.spin_box_scale.setMinimum(25)
44 | self.spin_box_scale.setMaximum(500)
45 | self.spin_box_scale.setSingleStep(5)
46 | self.spin_box_scale.setProperty("value", 100)
47 | self.spin_box_scale.setObjectName("spin_box_scale")
48 | self.horizontal_layout_scale.addWidget(self.spin_box_scale)
49 | self.formLayout.setLayout(1, QtWidgets.QFormLayout.SpanningRole, self.horizontal_layout_scale)
50 |
51 | self.retranslateUi(form)
52 | QtCore.QMetaObject.connectSlotsByName(form)
53 |
54 | def retranslateUi(self, form):
55 | pass
56 |
--------------------------------------------------------------------------------
/window/desinger/ui_float_scale.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | form
4 |
5 |
6 |
7 | 0
8 | 0
9 | 320
10 | 60
11 |
12 |
13 |
14 |
15 | 320
16 | 60
17 |
18 |
19 |
20 |
21 | 320
22 | 60
23 |
24 |
25 |
26 | 不透明度与缩放
27 |
28 |
29 | -
30 |
31 |
32 | 滑动滑块调节页面缩放
33 |
34 |
35 |
36 | -
37 |
38 |
-
39 |
40 |
41 | 缩放:
42 |
43 |
44 |
45 | -
46 |
47 |
48 | 25
49 |
50 |
51 | 500
52 |
53 |
54 | 5
55 |
56 |
57 | 100
58 |
59 |
60 | Qt::Horizontal
61 |
62 |
63 |
64 | -
65 |
66 |
67 | %
68 |
69 |
70 | 25
71 |
72 |
73 | 500
74 |
75 |
76 | 5
77 |
78 |
79 | 100
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
--------------------------------------------------------------------------------
/window/desinger/ui_root.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | # Form implementation generated from reading ui file 'ui_root.ui'
4 | #
5 | # Created by: PyQt5 UI code generator 5.15.4
6 | #
7 | # WARNING: Any manual changes made to this file will be lost when pyuic5 is
8 | # run again. Do not edit this file unless you know what you are doing.
9 |
10 |
11 | from PyQt5 import QtCore, QtGui, QtWidgets
12 |
13 |
14 | class Ui_root(object):
15 | def setupUi(self, root):
16 | root.setObjectName("root")
17 | root.resize(680, 480)
18 | root.setMinimumSize(QtCore.QSize(600, 400))
19 | root.setWindowTitle("blivechat")
20 | self.root_widget = QtWidgets.QWidget(root)
21 | self.root_widget.setMinimumSize(QtCore.QSize(600, 400))
22 | self.root_widget.setObjectName("root_widget")
23 | self.vertical_layout = QtWidgets.QVBoxLayout(self.root_widget)
24 | self.vertical_layout.setContentsMargins(0, 0, 0, 0)
25 | self.vertical_layout.setSpacing(1)
26 | self.vertical_layout.setObjectName("vertical_layout")
27 | self.list_widget_console = QtWidgets.QListWidget(self.root_widget)
28 | self.list_widget_console.setObjectName("list_widget_console")
29 | self.vertical_layout.addWidget(self.list_widget_console)
30 | self.horizontal_layout = QtWidgets.QHBoxLayout()
31 | self.horizontal_layout.setContentsMargins(5, 5, 5, 5)
32 | self.horizontal_layout.setSpacing(2)
33 | self.horizontal_layout.setObjectName("horizontal_layout")
34 | self.button_open_admin = QtWidgets.QPushButton(self.root_widget)
35 | self.button_open_admin.setEnabled(False)
36 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Ignored)
37 | sizePolicy.setHorizontalStretch(0)
38 | sizePolicy.setVerticalStretch(0)
39 | sizePolicy.setHeightForWidth(self.button_open_admin.sizePolicy().hasHeightForWidth())
40 | self.button_open_admin.setSizePolicy(sizePolicy)
41 | self.button_open_admin.setText("管理页面")
42 | self.button_open_admin.setObjectName("button_open_admin")
43 | self.horizontal_layout.addWidget(self.button_open_admin)
44 | spacerItem = QtWidgets.QSpacerItem(5, 0, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum)
45 | self.horizontal_layout.addItem(spacerItem)
46 | self.line_1 = QtWidgets.QFrame(self.root_widget)
47 | self.line_1.setFrameShape(QtWidgets.QFrame.VLine)
48 | self.line_1.setFrameShadow(QtWidgets.QFrame.Sunken)
49 | self.line_1.setObjectName("line_1")
50 | self.horizontal_layout.addWidget(self.line_1)
51 | spacerItem1 = QtWidgets.QSpacerItem(5, 0, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum)
52 | self.horizontal_layout.addItem(spacerItem1)
53 | self.button_float_window = QtWidgets.QPushButton(self.root_widget)
54 | self.button_float_window.setEnabled(False)
55 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Ignored)
56 | sizePolicy.setHorizontalStretch(0)
57 | sizePolicy.setVerticalStretch(0)
58 | sizePolicy.setHeightForWidth(self.button_float_window.sizePolicy().hasHeightForWidth())
59 | self.button_float_window.setSizePolicy(sizePolicy)
60 | self.button_float_window.setText("公屏浮窗")
61 | self.button_float_window.setObjectName("button_float_window")
62 | self.horizontal_layout.addWidget(self.button_float_window)
63 | self.button_float_window_config = QtWidgets.QPushButton(self.root_widget)
64 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Ignored)
65 | sizePolicy.setHorizontalStretch(0)
66 | sizePolicy.setVerticalStretch(0)
67 | sizePolicy.setHeightForWidth(self.button_float_window_config.sizePolicy().hasHeightForWidth())
68 | self.button_float_window_config.setSizePolicy(sizePolicy)
69 | self.button_float_window_config.setText("浮窗配置")
70 | self.button_float_window_config.setObjectName("button_float_window_config")
71 | self.horizontal_layout.addWidget(self.button_float_window_config)
72 | spacerItem2 = QtWidgets.QSpacerItem(5, 0, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum)
73 | self.horizontal_layout.addItem(spacerItem2)
74 | self.line_2 = QtWidgets.QFrame(self.root_widget)
75 | self.line_2.setFrameShape(QtWidgets.QFrame.VLine)
76 | self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken)
77 | self.line_2.setObjectName("line_2")
78 | self.horizontal_layout.addWidget(self.line_2)
79 | spacerItem3 = QtWidgets.QSpacerItem(40, 30, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
80 | self.horizontal_layout.addItem(spacerItem3)
81 | self.line_3 = QtWidgets.QFrame(self.root_widget)
82 | self.line_3.setFrameShape(QtWidgets.QFrame.VLine)
83 | self.line_3.setFrameShadow(QtWidgets.QFrame.Sunken)
84 | self.line_3.setObjectName("line_3")
85 | self.horizontal_layout.addWidget(self.line_3)
86 | spacerItem4 = QtWidgets.QSpacerItem(5, 0, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum)
87 | self.horizontal_layout.addItem(spacerItem4)
88 | self.button_stop = QtWidgets.QPushButton(self.root_widget)
89 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Ignored)
90 | sizePolicy.setHorizontalStretch(0)
91 | sizePolicy.setVerticalStretch(0)
92 | sizePolicy.setHeightForWidth(self.button_stop.sizePolicy().hasHeightForWidth())
93 | self.button_stop.setSizePolicy(sizePolicy)
94 | self.button_stop.setText("关闭服务")
95 | self.button_stop.setObjectName("button_stop")
96 | self.horizontal_layout.addWidget(self.button_stop)
97 | self.vertical_layout.addLayout(self.horizontal_layout)
98 | root.setCentralWidget(self.root_widget)
99 |
100 | self.retranslateUi(root)
101 | QtCore.QMetaObject.connectSlotsByName(root)
102 | root.setTabOrder(self.list_widget_console, self.button_open_admin)
103 | root.setTabOrder(self.button_open_admin, self.button_float_window)
104 | root.setTabOrder(self.button_float_window, self.button_float_window_config)
105 | root.setTabOrder(self.button_float_window_config, self.button_stop)
106 |
107 | def retranslateUi(self, root):
108 | pass
109 |
--------------------------------------------------------------------------------
/window/desinger/ui_root.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | root
4 |
5 |
6 |
7 | 0
8 | 0
9 | 680
10 | 480
11 |
12 |
13 |
14 |
15 | 600
16 | 400
17 |
18 |
19 |
20 | blivechat
21 |
22 |
23 |
24 |
25 | 600
26 | 400
27 |
28 |
29 |
30 |
31 | 1
32 |
33 |
34 | 0
35 |
36 |
37 | 0
38 |
39 |
40 | 0
41 |
42 |
43 | 0
44 |
45 | -
46 |
47 |
48 | -
49 |
50 |
51 | 2
52 |
53 |
54 | 5
55 |
56 |
57 | 5
58 |
59 |
60 | 5
61 |
62 |
63 | 5
64 |
65 |
-
66 |
67 |
68 | false
69 |
70 |
71 |
72 | 0
73 | 0
74 |
75 |
76 |
77 | 管理页面
78 |
79 |
80 |
81 | -
82 |
83 |
84 | Qt::Horizontal
85 |
86 |
87 | QSizePolicy::Fixed
88 |
89 |
90 |
91 | 5
92 | 0
93 |
94 |
95 |
96 |
97 | -
98 |
99 |
100 | Qt::Vertical
101 |
102 |
103 |
104 | -
105 |
106 |
107 | Qt::Horizontal
108 |
109 |
110 | QSizePolicy::Fixed
111 |
112 |
113 |
114 | 5
115 | 0
116 |
117 |
118 |
119 |
120 | -
121 |
122 |
123 | false
124 |
125 |
126 |
127 | 0
128 | 0
129 |
130 |
131 |
132 | 公屏浮窗
133 |
134 |
135 |
136 | -
137 |
138 |
139 |
140 | 0
141 | 0
142 |
143 |
144 |
145 | 浮窗配置
146 |
147 |
148 |
149 | -
150 |
151 |
152 | Qt::Horizontal
153 |
154 |
155 | QSizePolicy::Fixed
156 |
157 |
158 |
159 | 5
160 | 0
161 |
162 |
163 |
164 |
165 | -
166 |
167 |
168 | Qt::Vertical
169 |
170 |
171 |
172 | -
173 |
174 |
175 | Qt::Horizontal
176 |
177 |
178 |
179 | 40
180 | 30
181 |
182 |
183 |
184 |
185 | -
186 |
187 |
188 | Qt::Vertical
189 |
190 |
191 |
192 | -
193 |
194 |
195 | Qt::Horizontal
196 |
197 |
198 | QSizePolicy::Fixed
199 |
200 |
201 |
202 | 5
203 | 0
204 |
205 |
206 |
207 |
208 | -
209 |
210 |
211 |
212 | 0
213 | 0
214 |
215 |
216 |
217 | 关闭服务
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 | list_widget_console
228 | button_open_admin
229 | button_float_window
230 | button_float_window_config
231 | button_stop
232 |
233 |
234 |
235 |
236 |
--------------------------------------------------------------------------------
/window/main.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | import json
4 | import json.decoder
5 | import logging
6 | import os
7 | import sys
8 | from argparse import Namespace
9 | from typing import Optional
10 |
11 | from PyQt5.QtCore import QUrl
12 | from PyQt5.QtWidgets import QApplication
13 |
14 | import update
15 | from window.console import ConsoleWindow
16 |
17 | GUI_CONFIG_PATH = os.path.join('data', 'gui.config.json')
18 |
19 | configs = {
20 | 'roomId': '1',
21 | 'roomConfig': {
22 | 'showDanmaku': True,
23 | 'mergeSimilarDanmaku': False,
24 | 'maxNumber': 60,
25 | 'showGift': True,
26 | 'showGiftName': False,
27 | 'mergeGift': True,
28 | 'minGiftPrice': 7,
29 | 'blockGiftDanmaku': True,
30 | 'blockNewbie': False,
31 | 'blockNotMobileVerified': False,
32 | 'blockLevel': 0,
33 | 'blockMedalLevel': 0,
34 | 'blockKeywords': '',
35 | 'blockUsers': '',
36 | 'relayMessagesByServer': False,
37 | 'autoTranslate': False,
38 | 'giftUsernamePronunciation': ''
39 | },
40 | 'css': [],
41 | 'float': {
42 | 'x': 100,
43 | 'y': 100,
44 | 'width': 400,
45 | 'height': 800,
46 | 'transparent': 100,
47 | 'scale': 100,
48 | 'mindedTransparent': False
49 | }
50 | }
51 | room_url: str
52 | config_url = f'http://localhost:12450/?_v={update.VERSION}'
53 | logger = logging.getLogger(__name__)
54 | app: Optional['QApplication'] = None
55 | console: Optional['ConsoleWindow'] = None
56 | args: Optional['Namespace'] = None
57 |
58 |
59 | def merge(origin: dict, new: dict):
60 | for key in origin:
61 | if key in new:
62 | if isinstance(new[key], type(origin[key])):
63 | if isinstance(origin[key], dict):
64 | merge(origin[key], new[key])
65 | else:
66 | origin[key] = new[key]
67 | else:
68 | try:
69 | origin[key] = type(origin[key])(new[key])
70 | except ValueError:
71 | logger.error('Unknown config value: %s(%s), excepted: %s(%s)' % (
72 | new[key], type(new[key]), origin[key], type(origin[key])
73 | ))
74 |
75 |
76 | def encode_q_url(obj):
77 | if isinstance(obj, QUrl):
78 | return {'__QUrl__': obj.url()}
79 | else:
80 | raise TypeError(repr(obj) + " is not JSON serializable")
81 |
82 |
83 | def decode_q_url(dct):
84 | if '__QUrl__' in dct:
85 | return QUrl(dct['__QUrl__'])
86 | else:
87 | return dct
88 |
89 |
90 | def save_config():
91 | with open(GUI_CONFIG_PATH, 'w', encoding='UTF-8') as file:
92 | json.dump(configs, file, ensure_ascii=False, default=encode_q_url, indent=2)
93 |
94 |
95 | def load_config():
96 | if os.path.exists(GUI_CONFIG_PATH):
97 | with open(GUI_CONFIG_PATH, 'r', encoding='UTF-8') as file:
98 | merge(configs, json.load(file, object_hook=decode_q_url))
99 | else:
100 | save_config()
101 |
102 |
103 | def init(args_):
104 | global app, console, args
105 | args = args_
106 | app_argv = sys.argv.copy()
107 | load_config()
108 | if args_.debug:
109 | app_argv += ['--remote-debugging-port=9222']
110 | print('Remote WebViews DevTools:')
111 | print('- "chrome://inspect/#devices", Chromium based browser.')
112 | print('- "http://localhost:9222/", any browser.')
113 | app_argv += [
114 | # https://peter.sh/experiments/chromium-command-line-switches/
115 | '--disable-web-security', # 禁用网页安全机制:跨域
116 | '--allow-insecure-websocket-from-https-origin', # 允许https页面访问不加密的websocket: https页面使用ws消息链连接
117 | ]
118 | app = QApplication(app_argv)
119 | app.setQuitOnLastWindowClosed(False)
120 | console = ConsoleWindow()
121 |
122 |
123 | def loop():
124 | code = app.exec_()
125 | save_config()
126 | sys.exit(code)
127 |
--------------------------------------------------------------------------------
/window/setting.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | import json
4 | import os
5 | from typing import Optional
6 | from urllib.parse import urlencode
7 |
8 | import pyperclip
9 | from PyQt5.QtCore import Qt, QUrl, QSize
10 | from PyQt5.QtGui import QIcon, QPixmap, QCloseEvent
11 | from PyQt5.QtWidgets import QWidget, QDialog, QFileDialog, QInputDialog, QMessageBox, \
12 | QVBoxLayout, QListWidgetItem, QLabel
13 |
14 | import config
15 | from window import main
16 | from window.desinger.ui_float_config import Ui_config_window
17 |
18 | config_instance: Optional['FloatConfig'] = None
19 |
20 |
21 | class FloatConfig(QDialog, Ui_config_window):
22 | def __init__(self):
23 | global config_instance
24 | QWidget.__init__(self)
25 | Ui_config_window.__init__(self)
26 | config_instance = self
27 | self.setWindowModality(Qt.ApplicationModal)
28 | self.setWindowIcon(QIcon(QPixmap(
29 | 'frontend/dist/favicon.ico'
30 | if os.path.exists('frontend/dist/favicon.ico')
31 | else 'frontend/public/favicon.ico'
32 | )))
33 | self.setupUi(self)
34 | cfg = main.configs
35 | self.spin_box_room_id.valueChanged.connect(
36 | lambda t: self.update_url(cfg.update(roomId=self.spin_box_room_id.value()))
37 | )
38 | self.check_box_show_messages.clicked.connect(
39 | lambda: self.change_config('showDanmaku', self.check_box_show_messages.isChecked())
40 | )
41 | self.check_box_merge_similar_messages.clicked.connect(
42 | lambda: self.change_config('mergeSimilarDanmaku', self.check_box_merge_similar_messages.isChecked())
43 | )
44 | self.spin_box_max_number_of_messages.valueChanged.connect(
45 | lambda t: self.change_config('maxNumber', self.spin_box_max_number_of_messages.value())
46 | )
47 | self.check_box_show_shper_chats.clicked.connect(
48 | lambda: self.change_config('showGift', self.check_box_show_shper_chats.isChecked())
49 | )
50 | self.check_box_show_gift_name.clicked.connect(
51 | lambda: self.change_config('showGiftName', self.check_box_show_gift_name.isChecked())
52 | )
53 | self.check_box_merge_gifts.clicked.connect(
54 | lambda: self.change_config('mergeGift', self.check_box_merge_gifts.isChecked())
55 | )
56 | self.spin_box_min_price_of_super_chats_to_show.valueChanged.connect(
57 | lambda t: self.change_config('maxNumber', self.spin_box_min_price_of_super_chats_to_show.value())
58 | )
59 | self.check_box_block_system_messages.clicked.connect(
60 | lambda: self.change_config('blockGiftDanmaku', self.check_box_block_system_messages.isChecked())
61 | )
62 | self.check_box_block_informal_users.clicked.connect(
63 | lambda: self.change_config('blockNewbie', self.check_box_block_informal_users.isChecked())
64 | )
65 | self.check_box_block_unverified_users.clicked.connect(
66 | lambda: self.change_config('blockNotMobileVerified', self.check_box_block_unverified_users.isChecked())
67 | )
68 | self.horizontal_slider_block_user_level_lower_than.valueChanged.connect(
69 | lambda: self.change_config('blockLevel', self.horizontal_slider_block_user_level_lower_than.value())
70 | )
71 | self.horizontal_slider_block_user_level_lower_than.valueChanged.connect(
72 | self.spin_box_block_user_level_lower_than.setValue
73 | )
74 | self.spin_box_block_user_level_lower_than.valueChanged.connect(
75 | lambda: self.change_config('blockLevel', self.spin_box_block_user_level_lower_than.value())
76 | )
77 | self.spin_box_block_user_level_lower_than.valueChanged.connect(
78 | self.horizontal_slider_block_user_level_lower_than.setValue
79 | )
80 | self.horizontal_slider_block_medal_level_lower_than.valueChanged.connect(
81 | lambda: self.change_config('blockMedalLevel', self.horizontal_slider_block_medal_level_lower_than.value())
82 | )
83 | self.horizontal_slider_block_medal_level_lower_than.valueChanged.connect(
84 | self.spin_box_block_medal_level_lower_than.setValue
85 | )
86 | self.spin_box_block_medal_level_lower_than.valueChanged.connect(
87 | lambda: self.change_config('blockMedalLevel', self.spin_box_block_medal_level_lower_than.value())
88 | )
89 | self.spin_box_block_medal_level_lower_than.valueChanged.connect(
90 | self.horizontal_slider_block_medal_level_lower_than.setValue
91 | )
92 | self.text_edit_block_keywords.textChanged.connect(
93 | lambda: self.change_config('blockKeywords', self.text_edit_block_keywords.toPlainText())
94 | )
95 | self.text_edit_block_users.textChanged.connect(
96 | lambda: self.change_config('blockUsers', self.text_edit_block_users.toPlainText())
97 | )
98 | self.check_box_reply_message_by_server.clicked.connect(lambda: (
99 | self.change_config('relayMessagesByServer', self.check_box_reply_message_by_server.isChecked()),
100 | self.check_box_auto_translate_messages_to_japanese
101 | .setCheckable(self.check_box_reply_message_by_server.isChecked())
102 | ))
103 | self.check_box_reply_message_by_server.clicked.connect(
104 | lambda: self.change_config('autoTranslate', self.check_box_auto_translate_messages_to_japanese.isChecked())
105 | )
106 | self.radio_button_pronunciation_of_gift_username_none.clicked.connect(
107 | lambda: self.change_config('giftUsernamePronunciation', '')
108 | )
109 | self.radio_button_pronunciation_of_gift_username_pinyin.clicked.connect(
110 | lambda: self.change_config('giftUsernamePronunciation', 'pinyin')
111 | )
112 | self.radio_button_pronunciation_of_gift_username_kana.clicked.connect(
113 | lambda: self.change_config('giftUsernamePronunciation', 'kana')
114 | )
115 | self.push_button_copy_url.clicked.connect(lambda: pyperclip.copy(self.line_edit_room_url.text()))
116 | self.push_button_export_config.clicked.connect(self.export_config)
117 | self.push_button_import_config.clicked.connect(self.import_config)
118 | self.push_button_set_test_room.clicked.connect(lambda: self.update_url(cfg.update(roomId='test')))
119 | self.push_button_extra_css_add.clicked.connect(self.add_css)
120 | self.push_button_extra_css_add_url.clicked.connect(self.add_css_url)
121 | self.push_button_extra_css_remove.clicked.connect(self.remove_css)
122 | self.push_button_extra_css_edit.clicked.connect(self.edit_css)
123 | self.update_form()
124 | self.show()
125 |
126 | def closeEvent(self, e: QCloseEvent):
127 | super().closeEvent(e)
128 | main.save_config()
129 |
130 | def update_form(self):
131 | cfg = main.configs
132 | self.spin_box_room_id.setValue(int(cfg['roomId']) if 'test' != cfg['roomId'] else 0)
133 | self.check_box_show_messages.setChecked(cfg['roomConfig']['showDanmaku'])
134 | self.check_box_merge_similar_messages.setChecked(cfg['roomConfig']['mergeSimilarDanmaku'])
135 | self.spin_box_max_number_of_messages.setValue(cfg['roomConfig']['maxNumber'])
136 | self.check_box_show_shper_chats.setChecked(cfg['roomConfig']['showGift'])
137 | self.check_box_show_gift_name.setChecked(cfg['roomConfig']['showGiftName'])
138 | self.check_box_merge_gifts.setChecked(cfg['roomConfig']['mergeGift'])
139 | self.spin_box_min_price_of_super_chats_to_show.setValue(cfg['roomConfig']['maxNumber'])
140 | self.check_box_block_system_messages.setChecked(cfg['roomConfig']['blockGiftDanmaku'])
141 | self.check_box_block_informal_users.setChecked(cfg['roomConfig']['blockNewbie'])
142 | self.check_box_block_unverified_users.setChecked(cfg['roomConfig']['blockNotMobileVerified'])
143 | self.horizontal_slider_block_user_level_lower_than.setValue(cfg['roomConfig']['blockLevel'])
144 | self.spin_box_block_user_level_lower_than.setValue(cfg['roomConfig']['blockLevel'])
145 | self.horizontal_slider_block_medal_level_lower_than.setValue(cfg['roomConfig']['blockMedalLevel'])
146 | self.spin_box_block_medal_level_lower_than.setValue(cfg['roomConfig']['blockMedalLevel'])
147 | self.text_edit_block_keywords.setText(cfg['roomConfig']['blockKeywords'])
148 | self.text_edit_block_users.setText(cfg['roomConfig']['blockUsers'])
149 | self.check_box_reply_message_by_server.setChecked(cfg['roomConfig']['relayMessagesByServer'])
150 | self.check_box_auto_translate_messages_to_japanese.setChecked(cfg['roomConfig']['autoTranslate'])
151 | self.check_box_auto_translate_messages_to_japanese.setCheckable(cfg['roomConfig']['relayMessagesByServer'])
152 | {
153 | '': self.radio_button_pronunciation_of_gift_username_none,
154 | 'pinyin': self.radio_button_pronunciation_of_gift_username_pinyin,
155 | 'kana': self.radio_button_pronunciation_of_gift_username_kana
156 | }[cfg['roomConfig']['giftUsernamePronunciation']].setChecked(True)
157 | for url in main.configs['css']:
158 | self.add_list_widget_item(url)
159 |
160 | def change_config(self, key, value):
161 | main.configs['roomConfig'][key] = value
162 | self.update_url()
163 |
164 | def update_url(self, x=None):
165 | url = get_url()
166 | self.line_edit_room_url.setText(url)
167 | self.line_edit_room_url.home(True)
168 | main.room_url = url
169 | return x
170 |
171 | def export_config(self):
172 | path = QFileDialog.getSaveFileName(self, '保存配置文件', 'blivechat.json', 'JSON文件 (*.json)')[0]
173 | if '' != path:
174 | with open(path, 'w', encoding='UTF-8') as file:
175 | json.dump(main.configs['roomConfig'], file, ensure_ascii=False, indent=2)
176 |
177 | def import_config(self):
178 | path = QFileDialog.getOpenFileName(self, '打开配置文件', 'blivechat.json', 'JSON文件 (*.json)')[0]
179 | if '' != path:
180 | with open(path, 'r', encoding='UTF-8') as file:
181 | main.merge(main.configs['roomConfig'], json.load(file))
182 | self.update_form()
183 | self.update_url()
184 |
185 | def add_list_widget_item(self, url: QUrl):
186 | item = QListWidgetItem()
187 | item.setSizeHint(QSize(1, 50))
188 | self.list_widget_css_list.addItem(item)
189 | self.list_widget_css_list.setItemWidget(item, get_widget(url))
190 |
191 | def add_css(self):
192 | paths = QFileDialog.getOpenFileNames(self, '选择CSS', '', 'CSS文件 (*.css)')[0]
193 | for stylesheet in paths:
194 | for i in main.configs['css']:
195 | if i.isLocalFile() and os.path.samefile(i.toLocalFile(), stylesheet):
196 | break
197 | else:
198 | url = QUrl.fromUserInput(os.path.normcase(stylesheet))
199 | self.add_list_widget_item(url)
200 | main.configs['css'].append(url)
201 |
202 | def add_css_url(self):
203 | path = QInputDialog.getText(self, '输入URL', '输入网络上CSS资源链接或本地文件的路径:')[0]
204 | if '' != path:
205 | for i in main.configs['css']:
206 | if (not i.isLocalFile()) and i.url() == path.lower():
207 | break
208 | else:
209 | url = QUrl.fromUserInput(path.lower())
210 | self.add_list_widget_item(url)
211 | main.configs['css'].append(url)
212 |
213 | def remove_css(self):
214 | item = self.list_widget_css_list.currentItem()
215 | if item is not None and QMessageBox.Yes == QMessageBox.question(
216 | self, '删除?', '确定删除选中的样式表?', QMessageBox.Yes | QMessageBox.No, QMessageBox.No
217 | ):
218 | row = self.list_widget_css_list.row(item)
219 | self.list_widget_css_list.takeItem(row)
220 | main.configs['css'].pop(row)
221 |
222 | def edit_css(self):
223 | item = self.list_widget_css_list.currentItem()
224 | row = self.list_widget_css_list.row(item)
225 | url_old = main.configs['css'][row]
226 | path = QInputDialog.getText(
227 | self, '修改URL', '输入网络上CSS资源链接或本地文件的路径:',
228 | text=url_old.toLocalFile() if url_old.isLocalFile() else url_old.url()
229 | )[0]
230 | if '' != path:
231 | url_new = QUrl.fromUserInput(path)
232 | main.configs['css'][row] = url_new
233 | self.list_widget_css_list.setItemWidget(item, get_widget(url_new))
234 |
235 |
236 | def get_url():
237 | url = 'http://localhost%s/room/%s?%s' % (
238 | f':{main.args.port}' if main.args.port != 80 else '',
239 | main.configs['roomId'],
240 | urlencode(main.configs['roomConfig'])
241 | )
242 | loader_url = config.get_config().loader_url
243 | if '' != loader_url:
244 | url = f'{loader_url}?{urlencode({"url": url})}'
245 | return url
246 |
247 |
248 | def get_widget(url: QUrl):
249 | widget = QWidget()
250 | vertical_layout = QVBoxLayout()
251 | label_name = QLabel()
252 | label_name.setText(url.fileName())
253 | vertical_layout.addWidget(label_name)
254 | label_path = QLabel()
255 | if url.isLocalFile():
256 | label_path.setText(url.toLocalFile().capitalize())
257 | label_path.setStyleSheet('font: 10px; font-weight: 600; color: gray;')
258 | else:
259 | label_path.setText(url.toDisplayString())
260 | label_path.setStyleSheet('font: 10px; font-weight: 600; color: darkblue;')
261 | vertical_layout.addWidget(label_path)
262 | widget.setLayout(vertical_layout)
263 | return widget
264 |
--------------------------------------------------------------------------------