├── .gitignore ├── .gitmodules ├── AUTHORS ├── LICENSE.md ├── README.md ├── lib ├── README.md ├── qtdbusextended.pro └── qtmpris.pro ├── providers.conf ├── qtwebflix.pro ├── resource.qrc ├── resources ├── jquery.min.js ├── jquery.qrc └── qtwebflix.svg ├── src ├── amazonmprisinterface.cpp ├── amazonmprisinterface.h ├── commandlineparser.cpp ├── commandlineparser.h ├── defaultmprisinterface.cpp ├── defaultmprisinterface.h ├── main.cpp ├── mainwindow.cpp ├── mainwindow.h ├── mprisinterface.cpp ├── mprisinterface.h ├── netflixmprisinterface.cpp ├── netflixmprisinterface.h ├── src.pro ├── urlrequestinterceptor.cpp └── urlrequestinterceptor.h ├── ui └── mainwindow.ui ├── widevine-18.10.sh └── widevine.sh /.gitignore: -------------------------------------------------------------------------------- 1 | # 2 | build 3 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "lib/qtdbusextended"] 2 | path = lib/qtdbusextended 3 | url = https://github.com/nemomobile/qtdbusextended.git 4 | [submodule "lib/qtmpris"] 5 | path = lib/qtmpris 6 | url = https://github.com/sailfishos/qtmpris 7 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Development: 2 | Alessandro Toia 3 | Petr Mánek 4 | 5 | AUR package manager: 6 | Omni6 7 | 8 | Icon: 9 | Alexey Varfolomeev 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 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 | {one line to give the program's name and a brief idea of what it does.} 635 | Copyright (C) {year} {name of author} 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 | {project} Copyright (C) {year} {fullname} 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 | # qtwebflix 2 | 3 | ![logo](https://user-images.githubusercontent.com/8083855/50625087-08698480-0f3f-11e9-88a3-5c65a4ed9e4b.png) 4 | 5 | A Qt webengine browser application to watch Netflix and other streaming services. 6 | 7 | ![screenshot](https://i.imgur.com/jrc7vV9.jpg) 8 | 9 | **QtWebFlix on KDE Plasma Media Player and KDE Connect** 10 | 11 | ![kdeconnect-screenshot](https://i.imgur.com/m0NMzOK.png) 12 | 13 | 14 | 15 | ## Usage 16 | 17 | ``` 18 | Usage: qtwebflix [options] 19 | Qtwebflix Help 20 | 21 | Shortcuts: 22 | CTRL + Q to quit 23 | CTRL + F11 for full screen 24 | CTRL + F5 to reload 25 | CTRL + SHIFT + ALT + D for metrics display 26 | 27 | To Control playback rate : 28 | CTRL + W = Speed up 29 | CTRL + S = Slow down 30 | CTRL + R = Reset to default rate 31 | 32 | Options: 33 | -h, --help Displays this help. 34 | -v, --version Displays version information. 35 | -p, --provider Set content provider eg. netflix.com 36 | -u, --useragent change useragent eg. "Mozilla/5.0 (X11; Linux 37 | x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" 38 | -n, --nonhd Do not use HD addon, you will be limited to 720p 39 | ``` 40 | 41 | Example of playback rate visualizer. 42 | 43 | ![playback-rate-screenshot](https://i.imgur.com/B26CloV.png) 44 | 45 | ## News 46 | 47 | **January 7th 2022** 48 | 49 | * Netflix 1080p is working for now! 50 | 51 | **July 26th 2019:** 52 | 53 | * Netflix 1080p no longer working 54 | 55 | 56 | **As of March 30th 2018:** 57 | 58 | ~~* Now supports Netflix in 1080P. NOTE not all shows and movies will work!~~ 59 | * Also supports adding other streaming services. Go to `~/.config/Qtwebflix/providers.conf` and add your service. Example: 60 | 61 | Netflix=https://netflix.com 62 | 63 | * To use other services right click inside the application and a context menu will bring up all available options you added. 64 | 65 | ## Instructions 66 | 67 | ### Requirements 68 | ``` 69 | qt5 70 | qtwebegine(with proprietary codecs) *Most distros have this in their repos 71 | widevine libs 72 | ``` 73 | 74 | If your distro does not compile qtwebengine with proprietary codecs, read [this](http://blog.qt.io/blog/2016/06/03/netflix-qt-webengine-5-7/). 75 | 76 | ### Compiling manually 77 | ``` 78 | 1. git clone --recursive https://github.com/gort818/qtwebflix.git 79 | 2. cd qtwebflix 80 | 3. qmake -config release 81 | 4. make 82 | 5. Binary will be labeled qtwebflix 83 | ``` 84 | 85 | ### Distribution packages 86 | 87 | #### Arch and derivatives 88 | 89 | Refer the [AUR package](https://aur.archlinux.org/packages/qtwebflix-git/). 90 | 91 | #### Ubuntu 92 | 93 | **Ubuntu 17.04/17.10/18.04 and Linux Mint 19 - qtwebengine comes with proprietary codecs** 94 | 95 | chmod +x widevine.sh 96 | sudo ./widevine.sh 97 | to uninstall sudo ./widevine.sh uninstall 98 | Follow instructions for compiling manually 99 | 100 | **Ubuntu 18.10** 101 | 102 | chmod +x widevine-18.10.sh 103 | sudo ./widevine-18.10.sh 104 | to uninstall sudo ./widevine-18.10.sh uninstall 105 | Follow instructions for compiling manually 106 | 107 | **Note** 108 | 109 | If you receiving an error loading qtwebflix try: 110 | 111 | qtwebflix --register-pepper-plugins="/usr/lib/qt/plugins/ppapi/libwidevinecdmadapter.so; application/x-ppapi-widevine-cdm" 112 | 113 | ### Troubleshooting 114 | 115 | **HBO Now and HBO GO are currently not working** 116 | There have been reports that HBO Now and GO, but not verified yet. 117 | 118 | Current workarounds: 119 | 120 | 1. If you have Amazon you can add your HBO service. Read [instructions](https://help.hbogo.com/hc/en-us/articles/204872107-Watching-HBO-on-Amazon-Prime-Video-Channels). 121 | 122 | ![hbo-screenshot](https://i.imgur.com/8f7lsED.png) 123 | -------------------------------------------------------------------------------- /lib/README.md: -------------------------------------------------------------------------------- 1 | Libraries 2 | ========= 3 | 4 | This directory contains libraries necessary for the project. To keep up with 5 | their development, the concerned repositories are referenced as [submodules][1]. 6 | If you ever have troubles building the project, check that this directory is 7 | full -- if you don't use the `--recursive` flag during clone, git won't populate 8 | it by default. 9 | 10 | Since QtWebFlix is already included various package, it was decided that all 11 | libraries in this directory will be linked to it *statically* in order not to 12 | pollute the system library directory, and more importantly, to make sure all 13 | conflicts with already installed libraries are avoided. For this reason, custom 14 | *patched* versions of `.pro` files have been generated to superseed default 15 | configuration in the referenced directories. 16 | 17 | For more information, see the `.pro` files in this directory and in [src/][2]. 18 | 19 | [1]: https://git-scm.com/docs/git-submodule 20 | [2]: ../src/src.pro 21 | 22 | -------------------------------------------------------------------------------- /lib/qtdbusextended.pro: -------------------------------------------------------------------------------- 1 | include(qtdbusextended/common.pri) 2 | 3 | TEMPLATE = lib 4 | CONFIG += qt staticlib 5 | 6 | QT = core dbus 7 | 8 | TARGET = $${QTDBUSEXTENDEDLIB} 9 | 10 | DEFINES += QT_DBUS_EXTENDED_LIBRARY 11 | 12 | SOURCES += \ 13 | qtdbusextended/src/dbusextendedabstractinterface.cpp \ 14 | qtdbusextended/src/dbusextendedpendingcallwatcher.cpp 15 | 16 | HEADERS += \ 17 | qtdbusextended/src/dbusextended.h \ 18 | qtdbusextended/src/dbusextendedabstractinterface.h \ 19 | qtdbusextended/src/dbusextendedpendingcallwatcher_p.h 20 | 21 | INCLUDEPATH += qtdbusextended/src 22 | 23 | -------------------------------------------------------------------------------- /lib/qtmpris.pro: -------------------------------------------------------------------------------- 1 | include(qtmpris/common.pri) 2 | 3 | TEMPLATE = lib 4 | CONFIG += qt staticlib 5 | 6 | QT = core dbus qml 7 | 8 | TARGET = $${MPRISQTLIB} 9 | 10 | DEFINES += MPRIS_QT_LIBRARY 11 | 12 | SOURCES += \ 13 | qtmpris/src/mpris.cpp \ 14 | qtmpris/src/mprisrootadaptor.cpp \ 15 | qtmpris/src/mprisplayeradaptor.cpp \ 16 | qtmpris/src/mprisplayer.cpp \ 17 | qtmpris/src/mpriscontroller.cpp \ 18 | qtmpris/src/mprismanager.cpp \ 19 | qtmpris/src/mprisplayerinterface.cpp \ 20 | qtmpris/src/mprisrootinterface.cpp 21 | 22 | HEADERS += \ 23 | qtmpris/src/mprisqt.h \ 24 | qtmpris/src/mpris.h \ 25 | qtmpris/src/mprisplayer.h \ 26 | qtmpris/src/mprisplayer_p.h \ 27 | qtmpris/src/mpriscontroller.h \ 28 | qtmpris/src/mpriscontroller_p.h \ 29 | qtmpris/src/mprismanager.h 30 | 31 | OTHER_FILES += qtmpris/src/org.mpris.MediaPlayer2.xml \ 32 | qtmpris/src/org.mpris.MediaPlayer2.Player.xml 33 | 34 | INCLUDEPATH += qtmpris/src qtdbusextended/src 35 | 36 | LIBS += -L. -ldbusextended-qt5 37 | 38 | -------------------------------------------------------------------------------- /providers.conf: -------------------------------------------------------------------------------- 1 | [providers] 2 | 3 | ###International 4 | amazon="https://www.amazon.com/Amazon-Video/b/?&node=2858778011" 5 | #crunchyroll=https://crunchyroll.com 6 | netflix=https://netflix.com 7 | #sundancenow=https://www.sundancenow.com/ 8 | #mubi=https://mubi.com/ 9 | #shudder=https://www.shudder.com/ 10 | 11 | ###Africa 12 | #showmax=https://www.showmax.com 13 | 14 | ###America 15 | #hbogo=https://hbogo.com 16 | #hbonow=https://hbonow.com 17 | #hulu=hulu.com 18 | #fandangonow=https://www.fandangonow.com/ 19 | #crave-tv=https://www.cravetv.ca/ 20 | #starz=https://www.starz.com/ 21 | #vudo=https://www.vudu.com 22 | #filmstruck=https://www.filmstruck.com 23 | 24 | ###Australia 25 | #stan=https://www.stan.com.au/ 26 | #hayu=https://www.hayu.com/ 27 | #quickflix=https://www.quickflix.com.au/ 28 | 29 | ###Asia 30 | #hooq=https://www.hooq.tv 31 | #iflix=https://www.iflix.com/ 32 | #icflix=https://www.icflix.com/ 33 | 34 | ###Europe 35 | #maxdome=https://maxdome.de 36 | #videobuster=https://videobuster.de 37 | #videoload=https://www.videoload.de/ 38 | #sky-ticket=https://skyticket.sky.de 39 | 40 | ###Debug 41 | #gpu=chrome://gpu 42 | #plguins=chrome://plugins 43 | 44 | -------------------------------------------------------------------------------- /qtwebflix.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | CONFIG += ordered 3 | 4 | 5 | SUBDIRS = qtdbusextended \ 6 | qtmpris \ 7 | src 8 | 9 | qtdbusextended.file = lib/qtdbusextended.pro 10 | 11 | 12 | qtmpris.file = lib/qtmpris.pro 13 | qtmpris.depends = qtdbusextended 14 | 15 | 16 | src.depends = qtmpris\ 17 | qtdbusextended -------------------------------------------------------------------------------- /resource.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | resources/qtwebflix.svg 4 | 5 | 6 | -------------------------------------------------------------------------------- /resources/jquery.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | * jQuery JavaScript Library v1.3.2 3 | * http://jquery.com/ 4 | * 5 | * Copyright (c) 2009 John Resig 6 | * Dual licensed under the MIT and GPL licenses. 7 | * http://docs.jquery.com/License 8 | * 9 | * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009) 10 | * Revision: 6246 11 | */ 12 | (function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("",""]||!O.indexOf("",""]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"","
"]||!O.indexOf("",""]||(!O.indexOf("",""]||!O.indexOf("",""]||!o.support.htmlSerialize&&[1,"div
","
"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}}); 13 | /* 14 | * Sizzle CSS Selector Engine - v0.9.3 15 | * Copyright 2009, The Dojo Foundation 16 | * Released under the MIT, BSD, and GPL Licenses. 17 | * More information: http://sizzlejs.com/ 18 | */ 19 | (function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return UT[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="

";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="
";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0){I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("
").append(M.responseText.replace(//g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function(){G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='
';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})(); -------------------------------------------------------------------------------- /resources/jquery.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | jquery.min.js 4 | 5 | 6 | -------------------------------------------------------------------------------- /resources/qtwebflix.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /src/amazonmprisinterface.cpp: -------------------------------------------------------------------------------- 1 | #include "amazonmprisinterface.h" 2 | #include "mainwindow.h" 3 | #include "mprisinterface.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | AmazonMprisInterface::AmazonMprisInterface(QWidget *parent) 12 | : MprisInterface(parent) { 13 | prevTitleId = ""; 14 | prevArtUrl = ""; 15 | titleInfoFetching = true; 16 | } 17 | 18 | void AmazonMprisInterface::setup(MainWindow *window) { 19 | 20 | MprisInterface::setup(window); 21 | 22 | workWithPlayer([this](MprisPlayer &p) { 23 | // Expose player capabilities. 24 | p.setCanQuit(true); 25 | p.setCanSetFullscreen(true); 26 | p.setCanPause(true); 27 | p.setCanPlay(true); 28 | p.setCanControl(true); 29 | p.setCanSeek(true); 30 | p.setMetadata(QVariantMap()); 31 | 32 | connect(&p, SIGNAL(pauseRequested()), this, SLOT(pauseVideo())); 33 | connect(&p, SIGNAL(playRequested()), this, SLOT(playVideo())); 34 | connect(&p, SIGNAL(playPauseRequested()), this, SLOT(togglePlayPause())); 35 | connect(&p, SIGNAL(fullscreenRequested(bool)), this, 36 | SLOT(setFullScreen(bool))); 37 | connect(&p, SIGNAL(volumeRequested(double)), this, 38 | SLOT(setVideoVolume(double))); 39 | connect(&p, SIGNAL(setPositionRequested(QDBusObjectPath, qlonglong)), this, 40 | SLOT(setPosition(QDBusObjectPath, qlonglong))); 41 | connect(&p, SIGNAL(seekRequested(qlonglong)), this, 42 | SLOT(setSeek(qlonglong))); 43 | }); 44 | 45 | // Connect slots and start timers. 46 | connect(&playerStateTimer, SIGNAL(timeout()), this, 47 | SLOT(playerStateTimerFired())); 48 | playerStateTimer.start(500); 49 | 50 | connect(&playerPositionTimer, SIGNAL(timeout()), this, 51 | SLOT(playerPositionTimerFired())); 52 | playerPositionTimer.start(170); 53 | 54 | connect(&metadataTimer, SIGNAL(timeout()), this, SLOT(metadataTimerFired())); 55 | metadataTimer.start(500); 56 | 57 | connect(&volumeTimer, SIGNAL(timeout()), this, SLOT(volumeTimerFired())); 58 | volumeTimer.start(220); 59 | 60 | 61 | } 62 | 63 | void AmazonMprisInterface::playVideo() { 64 | QString code = ("(function () {" 65 | "var vid = document.querySelectorAll('video');" 66 | "for (i = 0; i < vid.length; ++i) { " 67 | "if(vid[i].getAttribute('src')) {var video = vid[i]} };" 68 | "if (video == undefined) return;" 69 | "video.play();" 70 | "})();"); 71 | qDebug() << "Player playing"; 72 | webView()->page()->runJavaScript(code); 73 | } 74 | 75 | void AmazonMprisInterface::pauseVideo() { 76 | QString code = ("(function () {" 77 | "var vid = document.querySelectorAll('video');" 78 | "for (i = 0; i < vid.length; ++i) { " 79 | "if(vid[i].getAttribute('src')) {var video = vid[i]} };" 80 | "if (!video) return;" 81 | "video.pause();" 82 | "})();"); 83 | qDebug() << "Player paused"; 84 | webView()->page()->runJavaScript(code); 85 | } 86 | 87 | void AmazonMprisInterface::togglePlayPause() { 88 | QString code = ("(function () {" 89 | "var vid = document.querySelectorAll('video');" 90 | "for (i = 0; i < vid.length; ++i) { " 91 | "if(vid[i].getAttribute('src')) {var video = vid[i]} };" 92 | "if (video.paused) video.play();" 93 | "else video.pause();" 94 | "})();"); 95 | qDebug() << "Player toggled play/pause"; 96 | webView()->page()->runJavaScript(code); 97 | } 98 | 99 | void AmazonMprisInterface::setVideoVolume(double volume) { 100 | QString code = ("(function () {" 101 | "var vid = document.querySelectorAll('video');" 102 | "for (i = 0; i < vid.length; ++i) { " 103 | "if(vid[i].getAttribute('src')) {var video = vid[i]} };" 104 | "if (!video) return;" 105 | "video.volume = " + 106 | QString::number(volume) + 107 | ";" 108 | "})();"); 109 | qDebug() << "Player set volume to " << volume; 110 | webView()->page()->runJavaScript(code); 111 | } 112 | 113 | void AmazonMprisInterface::setFullScreen(bool fullscreen) { 114 | window()->setFullScreen(fullscreen); 115 | } 116 | 117 | void AmazonMprisInterface::getVolume(std::function callback) { 118 | QString code = ("(function () {" 119 | "var vid = document.querySelectorAll('video');" 120 | "for (i = 0; i < vid.length; ++i) { " 121 | "if(vid[i].getAttribute('src')) {var video = vid[i]} };" 122 | "return video ? video.volume : -1;" 123 | "})()"); 124 | webView()->page()->runJavaScript(code, [callback](const QVariant &result) { 125 | callback(result.toDouble()); 126 | }); 127 | } 128 | 129 | void AmazonMprisInterface::getVideoPosition( 130 | std::function callback) { 131 | QString code = ("(function () {" 132 | "var vid = document.querySelectorAll('video');" 133 | "for (i = 0; i < vid.length; ++i) { " 134 | "if(vid[i].getAttribute('src')) {var video = vid[i]} };" 135 | "return video ? video.currentTime -10: -1;" 136 | "})()"); 137 | webView()->page()->runJavaScript(code, [callback](const QVariant &result) { 138 | double seconds = result.toDouble(); 139 | if (seconds < 0) 140 | callback(-1); 141 | else 142 | callback(seconds / 1e-6); 143 | }); 144 | } 145 | 146 | void AmazonMprisInterface::setPosition(QDBusObjectPath trackId, qlonglong pos) { 147 | double seconds = static_cast(pos); 148 | // double useconds= seconds/1e+6; 149 | double useconds = seconds / 1e+6; 150 | qDebug() << "set Position to " << useconds << " Seconds"; 151 | QString code = ("(function () {" 152 | "var vid = document.querySelectorAll('video');" 153 | "for (i = 0; i < vid.length; ++i) { " 154 | "if(vid[i].getAttribute('src')) {var video = vid[i]} };" 155 | "if (!video) return;" 156 | "video.pause();" 157 | "video.currentTime = " + 158 | QString::number(useconds) + 159 | ";" 160 | "var timer = setInterval(function() {" 161 | "if (video.paused && video.readyState ==4 || !video.paused) {" 162 | "video.play();" 163 | "clearInterval(timer);" 164 | "}" 165 | "}, 50);" 166 | "})();"); 167 | webView()->page()->runJavaScript(code); 168 | } 169 | 170 | void AmazonMprisInterface::setSeek(qlonglong seekPos) { 171 | double seconds = static_cast(seekPos); 172 | // double useconds= seconds/1e+6; 173 | double useconds = seconds / 1e+6; 174 | qDebug() << "Seeking Position by " << useconds << " Seconds"; 175 | QString code = ("(function () {" 176 | "var vid = document.querySelectorAll('video');" 177 | "for (i = 0; i < vid.length; ++i) { " 178 | "if(vid[i].getAttribute('src')) {var video = vid[i]} };" 179 | "if (!video) return;" 180 | "video.pause();" 181 | "video.currentTime +=" + 182 | QString::number(useconds) + 183 | ";" 184 | "var timer = setInterval(function() {" 185 | "if (video.paused && video.readyState ==4 || !video.paused) {" 186 | "video.play();" 187 | "clearInterval(timer);" 188 | "}" 189 | "}, 50);" 190 | "})();"); 191 | webView()->page()->runJavaScript(code); 192 | } 193 | 194 | void AmazonMprisInterface::getMetadata( 195 | std::function 197 | callback) { 198 | QString code = 199 | ("(function () {" 200 | "var vid = document.querySelectorAll('video');" 201 | "for (i = 0; i < vid.length; ++i) { if(vid[i].getAttribute('src')) {var " 202 | "video = vid[i]} };" 203 | "try {var titleLabel =document.querySelector('div.title').innerText;}" 204 | "catch(err){}" 205 | "try{ var subLabel =document.querySelector('div.subtitle').innerText;}" 206 | "catch(err){};" 207 | "var metadata = {};" 208 | "metadata.duration = video ? video.duration : -1;" 209 | "metadata.nid = video && video.offsetParent ? video.offsetParent.id : " 210 | "'';" 211 | "metadata.title = titleLabel +' ' + subLabel;" 212 | "try { var art " 213 | "=document.querySelector('div.av-bgimg__div').getAttribute('style')." 214 | "split('url')[1].replace('(','').replace(')','');" 215 | "}catch (err ) {}" 216 | "finally {" 217 | "try{ var art = " 218 | "document.querySelector('div.av-fallback-packshot').childNodes[0]." 219 | "getAttribute('src');" 220 | "} catch(err ) {} };" 221 | "metadata.arturl= art;" 222 | "return metadata;" 223 | "})()"); 224 | webView()->page()->runJavaScript(code, [callback](const QVariant &result) { 225 | QVariantMap map = result.toMap(); 226 | 227 | double seconds = map["duration"].toDouble(); 228 | if (seconds < 0) 229 | seconds = -1; 230 | else 231 | seconds /= 1e-6; 232 | 233 | QString title = map["title"].toString(); 234 | QString nid = map["nid"].toString(); 235 | QString artUrl = map["arturl"].toString(); 236 | 237 | callback(seconds, title, nid, artUrl); 238 | }); 239 | } 240 | 241 | void AmazonMprisInterface::getVideoState( 242 | std::function callback) { 243 | QString code = ("(function () {" 244 | "var vid = document.querySelectorAll('video');" 245 | "for (i = 0; i < vid.length; ++i) { " 246 | "if(vid[i].getAttribute('src')) {var video = vid[i]} };" 247 | "if (!video) return 'stopped';" 248 | "return video.paused ? 'paused' : 'playing';" 249 | "})()"); 250 | webView()->page()->runJavaScript(code, [callback](const QVariant &result) { 251 | QString resultString = result.toString(); 252 | Mpris::PlaybackStatus status = Mpris::InvalidPlaybackStatus; 253 | if (resultString == "stopped") 254 | status = Mpris::Stopped; 255 | else if (resultString == "playing") 256 | status = Mpris::Playing; 257 | else if (resultString == "paused") 258 | status = Mpris::Paused; 259 | callback(status); 260 | }); 261 | } 262 | 263 | void AmazonMprisInterface::playerStateTimerFired() { 264 | getVideoState([this](Mpris::PlaybackStatus state) { 265 | workWithPlayer([&](MprisPlayer &p) { 266 | p.setPlaybackStatus(state); 267 | p.setServiceName("QtWebFlix-Amazon"); 268 | }); 269 | }); 270 | } 271 | 272 | void AmazonMprisInterface::playerPositionTimerFired() { 273 | getVideoPosition([this](qlonglong useconds) { 274 | workWithPlayer([&](MprisPlayer &p) { p.setPosition(useconds); }); 275 | }); 276 | } 277 | 278 | void AmazonMprisInterface::metadataTimerFired() { 279 | getMetadata([this](qlonglong lengthUseconds, const QString &title, 280 | const QString &nid, const QString &artUrl) { 281 | workWithPlayer([&](MprisPlayer &p) { 282 | QVariantMap metadata; 283 | if (lengthUseconds >= 0) { 284 | metadata[Mpris::metadataToString(Mpris::Length)] = 285 | QVariant(lengthUseconds); 286 | } 287 | if (!title.isEmpty()) { 288 | metadata[Mpris::metadataToString(Mpris::Title)] = QVariant(title); 289 | } 290 | if (!nid.isEmpty()) { 291 | metadata[Mpris::metadataToString(Mpris::TrackId)] = 292 | QVariant("/com/Amazon/title/" + nid); 293 | // QString artUrl = getArtUrl(nid); 294 | if (!artUrl.isEmpty()) { 295 | metadata[Mpris::metadataToString(Mpris::ArtUrl)] = QVariant(artUrl); 296 | } 297 | } 298 | p.setMetadata(metadata); 299 | }); 300 | }); 301 | } 302 | 303 | void AmazonMprisInterface::volumeTimerFired() { 304 | getVolume([this](double volume) { 305 | if (volume >= 0) { 306 | workWithPlayer([&](MprisPlayer &p) { p.setVolume(volume); }); 307 | } 308 | }); 309 | } 310 | -------------------------------------------------------------------------------- /src/amazonmprisinterface.h: -------------------------------------------------------------------------------- 1 | #ifndef AMAZONMPRISINTERFACE_H 2 | #define AMAZONMPRISINTERFACE_H 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include "mprisinterface.h" 10 | 11 | class MainWindow; 12 | 13 | class AmazonMprisInterface : public MprisInterface { 14 | Q_OBJECT 15 | 16 | public: 17 | explicit AmazonMprisInterface(QWidget *parent = nullptr); 18 | 19 | virtual void setup(MainWindow *window) override; 20 | 21 | void updatePlayerFullScreen(); 22 | 23 | private slots: 24 | // slots for handlers of hotkeys 25 | void playVideo(); 26 | void pauseVideo(); 27 | void togglePlayPause(); 28 | void setVideoVolume(double volume); 29 | void setFullScreen(bool fullscreen); 30 | void setPosition (QDBusObjectPath trackId,qlonglong pos); 31 | void setSeek (qlonglong seekPos); 32 | void playerStateTimerFired(); 33 | void playerPositionTimerFired(); 34 | void metadataTimerFired(); 35 | void volumeTimerFired(); 36 | 37 | //void networkManagerFinished(QNetworkReply *reply); 38 | 39 | private: 40 | QTimer playerStateTimer; 41 | QTimer playerPositionTimer; 42 | QTimer metadataTimer; 43 | QTimer volumeTimer; 44 | //QNetworkAccessManager networkManager; 45 | QString prevTitleId; 46 | QString prevArtUrl; 47 | std::mutex mtx_titleInfo; 48 | bool titleInfoFetching; 49 | 50 | QString getArtUrl(const QString& nid); 51 | 52 | void getVideoState(std::function callback); 53 | void getVideoPosition(std::function callback); 54 | void getMetadata(std::function callback); 55 | void getVolume(std::function callback); 56 | 57 | }; 58 | 59 | 60 | #endif // AMAZONMPRISINTERFACE_H 61 | -------------------------------------------------------------------------------- /src/commandlineparser.cpp: -------------------------------------------------------------------------------- 1 | #include "commandlineparser.h" 2 | 3 | Commandlineparser::Commandlineparser() { 4 | 5 | // create commandline parser, set options, and parse them. 6 | QCommandLineParser parser; 7 | QCoreApplication::setApplicationName("qtwebflix"); 8 | QCoreApplication::setApplicationVersion(QVariant(GIT_VERSION).toString()); 9 | parser.setApplicationDescription( 10 | "\nQtwebflix Help\n\n Shortcuts:\n CTRL + Q to quit\n CTRL + F11 for full screen\n CTRL + F5 to reload\n\n To Control playback rate:\n CTRL + W = speed up \n " 11 | "CTRL + S = slow down \n CTRL + R = reset to defualt"); 12 | parser.addHelpOption(); 13 | parser.addVersionOption(); 14 | 15 | QCommandLineOption setProvider( 16 | QStringList() << "p" 17 | << "provider", 18 | QCoreApplication::translate("main", 19 | "Set content provider eg. netflix.com"), 20 | QCoreApplication::translate("main", "provider")); 21 | parser.addOption(setProvider); 22 | 23 | QCommandLineOption userAgent( 24 | QStringList() << "u" 25 | << "useragent", 26 | QCoreApplication::translate( 27 | "main", "change useragent eg. \"Mozilla/5.0 (X11; Linux x86_64; " 28 | "rv:63.0) Gecko/20100101 Firefox/63.0\""), 29 | QCoreApplication::translate("main", "useragent")); 30 | parser.addOption(userAgent); 31 | 32 | QCommandLineOption nonHD(QStringList() << "n" 33 | << "nonhd", 34 | QCoreApplication::translate( 35 | "main", "Do not use HD addon, you will be limited to 720p")); 36 | parser.addOption(nonHD); 37 | 38 | QStringList webOptions = {"--register-pepper-plugins", 39 | "--disable-seccomp-filter-sandbox", 40 | "--disable-logging", 41 | "--ignore-gpu-blacklist", 42 | "--enable-gpu-rasterization", 43 | "--enable-native-gpu-memory-buffers"}; 44 | 45 | QStringList args; 46 | 47 | args = qApp->arguments(); 48 | // qDebug()< 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | DefaultMprisInterface::DefaultMprisInterface(QWidget *parent) 12 | : MprisInterface(parent) { 13 | prevTitleId = ""; 14 | prevArtUrl = ""; 15 | titleInfoFetching = true; 16 | } 17 | 18 | void DefaultMprisInterface::setup(MainWindow *window) { 19 | 20 | MprisInterface::setup(window); 21 | 22 | workWithPlayer([this](MprisPlayer &p) { 23 | // Expose player capabilities. 24 | p.setCanQuit(true); 25 | p.setCanSetFullscreen(true); 26 | p.setCanPause(true); 27 | p.setCanPlay(true); 28 | p.setCanControl(true); 29 | p.setCanSeek(true); 30 | p.setMetadata(QVariantMap()); 31 | 32 | connect(&p, SIGNAL(pauseRequested()), this, SLOT(pauseVideo())); 33 | connect(&p, SIGNAL(playRequested()), this, SLOT(playVideo())); 34 | connect(&p, SIGNAL(playPauseRequested()), this, SLOT(togglePlayPause())); 35 | connect(&p, SIGNAL(fullscreenRequested(bool)), this, 36 | SLOT(setFullScreen(bool))); 37 | connect(&p, SIGNAL(volumeRequested(double)), this, 38 | SLOT(setVideoVolume(double))); 39 | connect(&p, SIGNAL(setPositionRequested(QDBusObjectPath, qlonglong)), this, 40 | SLOT(setPosition(QDBusObjectPath, qlonglong))); 41 | connect(&p, SIGNAL(seekRequested(qlonglong)), this, 42 | SLOT(setSeek(qlonglong))); 43 | }); 44 | 45 | // Connect slots and start timers. 46 | connect(&playerStateTimer, SIGNAL(timeout()), this, 47 | SLOT(playerStateTimerFired())); 48 | playerStateTimer.start(500); 49 | 50 | connect(&playerPositionTimer, SIGNAL(timeout()), this, 51 | SLOT(playerPositionTimerFired())); 52 | playerPositionTimer.start(170); 53 | 54 | connect(&metadataTimer, SIGNAL(timeout()), this, SLOT(metadataTimerFired())); 55 | metadataTimer.start(500); 56 | 57 | connect(&volumeTimer, SIGNAL(timeout()), this, SLOT(volumeTimerFired())); 58 | volumeTimer.start(220); 59 | 60 | 61 | } 62 | 63 | void DefaultMprisInterface::playVideo() { 64 | QString code = ("(function () {" 65 | "var vid = document.querySelectorAll('video');" 66 | "for (let i = 0, n = vid.length; i < n; ++i) { " 67 | "if (vid[i].getAttribute('src')) vid[i].play();}" 68 | "})();"); 69 | qDebug() << "Player playing"; 70 | webView()->page()->runJavaScript(code); 71 | } 72 | 73 | void DefaultMprisInterface::pauseVideo() { 74 | QString code = ("(function () {" 75 | "var vid = document.querySelectorAll('video');" 76 | "for (let i = 0, n = vid.length; i < n; ++i) { " 77 | "if (vid[i].getAttribute('src')) vid[i].pause();}" 78 | "})();"); 79 | qDebug() << "Player paused"; 80 | webView()->page()->runJavaScript(code); 81 | } 82 | 83 | void DefaultMprisInterface::togglePlayPause() { 84 | QString code = ("(function () {" 85 | "var vid = document.querySelectorAll('video');" 86 | "for (let i = 0, n = vid.length; i < n; ++i) { " 87 | "if (vid[i].getAttribute('src')) { " 88 | "if (vid[i].paused) vid[i].play();" 89 | "else vid[i].pause();}}" 90 | "})();"); 91 | qDebug() << "Player toggled play/pause"; 92 | webView()->page()->runJavaScript(code); 93 | } 94 | 95 | void DefaultMprisInterface::setVideoVolume(double volume) { 96 | QString code = ("(function () {" 97 | "var vid = document.querySelectorAll('video');" 98 | "for (let i = 0, n = vid.length; i < n; ++i) { " 99 | "if (vid[i].getAttribute('src')) {var video = vid[i];} } " 100 | "if (!video) return;" 101 | "video.volume = " + 102 | QString::number(volume) + 103 | ";})();"); 104 | qDebug() << "Player set volume to " << volume; 105 | webView()->page()->runJavaScript(code); 106 | } 107 | 108 | void DefaultMprisInterface::setFullScreen(bool fullscreen) { 109 | window()->setFullScreen(fullscreen); 110 | } 111 | 112 | void DefaultMprisInterface::getVolume(std::function callback) { 113 | QString code = ("(function () {" 114 | "var vid = document.querySelectorAll('video');" 115 | "for (let i = 0, n = vid.length; i < n; ++i) { " 116 | "if (vid[i].getAttribute('src')) {var video = vid[i];} } " 117 | "return (video) ? video.volume : -1;" 118 | "})()"); 119 | webView()->page()->runJavaScript(code, [callback](const QVariant &result) { 120 | callback(result.toDouble()); 121 | }); 122 | } 123 | 124 | void DefaultMprisInterface::getVideoPosition( 125 | std::function callback) { 126 | QString code = ("(function () {" 127 | "var vid = document.querySelectorAll('video');" 128 | "for (let i = 0, n = vid.length; i < n; ++i) { " 129 | "if (vid[i].getAttribute('src')) {var video = vid[i];} } " 130 | "return (video) ? video.currentTime : -1;" 131 | "})()"); 132 | webView()->page()->runJavaScript(code, [callback](const QVariant &result) { 133 | double seconds = result.toDouble(); 134 | if (seconds < 0) 135 | callback(-1); 136 | else 137 | callback(seconds / 1e-6); 138 | }); 139 | } 140 | 141 | void DefaultMprisInterface::setPosition(QDBusObjectPath trackId, qlonglong pos) { 142 | double seconds = static_cast(pos); 143 | // double useconds= seconds/1e+6; 144 | double useconds = seconds / 1e+6; 145 | qDebug() << "set Position to " << useconds << " Seconds"; 146 | QString code = ("(function () {" 147 | "var vid = document.querySelectorAll('video');" 148 | "for (let i = 0, n = vid.length; i < n; ++i) { " 149 | "if (vid[i].getAttribute('src')) {" 150 | "var video = vid[i]; break;} } " 151 | "if (!video) return;" 152 | "video.pause();" 153 | "video.currentTime = " + 154 | QString::number(useconds) + 155 | ";" 156 | "var sptimer = setInterval(function() {" 157 | "if (video.paused && video.readyState == 4 || !video.paused) {" 158 | "video.play();" 159 | "clearInterval(sptimer);" 160 | "}" 161 | "}, 50);" 162 | "})();"); 163 | webView()->page()->runJavaScript(code); 164 | } 165 | 166 | void DefaultMprisInterface::setSeek(qlonglong seekPos) { 167 | double seconds = static_cast(seekPos); 168 | // double useconds= seconds/1e+6; 169 | double useconds = seconds / 1e+6; 170 | qDebug() << "Seeking Position by " << useconds << " Seconds"; 171 | QString code = ("(function () {" 172 | "var vid = document.querySelectorAll('video');" 173 | "for (let i = 0, n = vid.length; i < n; ++i) { " 174 | "if (vid[i].getAttribute('src')) {" 175 | "var video = vid[i]; break;} };" 176 | "if (!video) return;" 177 | "video.pause();" 178 | "video.currentTime += " + 179 | QString::number(useconds) + 180 | ";" 181 | "var sstimer = setInterval(function() {" 182 | "if (video.paused && video.readyState == 4 || !video.paused) {" 183 | "video.play();" 184 | "clearInterval(sstimer);" 185 | "}" 186 | "}, 50);" 187 | "})();"); 188 | webView()->page()->runJavaScript(code); 189 | } 190 | 191 | void DefaultMprisInterface::getMetadata( 192 | std::function 194 | callback) { 195 | QString code = 196 | ("(function () {" 197 | "var vid = document.querySelectorAll('video');" 198 | "for (let i = 0, n = vid.length; i < n; ++i) {" 199 | "if (vid[i].getAttribute('src') && vid[i].duration) {" 200 | "var duration = vid[i].duration;" 201 | "}" 202 | "};" 203 | "try {" 204 | "var titleLabel = document.querySelector('title').innerText;" 205 | "} catch(err){" 206 | "var titleLabel = 'Playing Video'" 207 | "}" 208 | "var metadata = {};" 209 | "metadata.duration = (duration) ? duration : -1;" 210 | "metadata.nid = '';" 211 | "metadata.title = titleLabel;" 212 | "var art = '';" 213 | "metadata.arturl= art;" 214 | "return metadata;" 215 | "})()"); 216 | webView()->page()->runJavaScript(code, [callback](const QVariant &result) { 217 | QVariantMap map = result.toMap(); 218 | 219 | double seconds = map["duration"].toDouble(); 220 | if (seconds < 0) 221 | seconds = -1; 222 | else 223 | seconds /= 1e-6; 224 | 225 | QString title = map["title"].toString(); 226 | QString nid = map["nid"].toString(); 227 | QString artUrl = map["arturl"].toString(); 228 | 229 | callback(seconds, title, nid, artUrl); 230 | }); 231 | } 232 | 233 | void DefaultMprisInterface::getVideoState( 234 | std::function callback) { 235 | QString code = ("(function () {" 236 | "var vid = document.querySelectorAll('video');" 237 | "for (let i = 0, n = vid.length; i < n; ++i) { " 238 | "if (vid[i].getAttribute('src')) {" 239 | "return (vid[i].paused) ? 'paused' : 'playing';" 240 | "}} " 241 | "return 'stopped';" 242 | "})()"); 243 | webView()->page()->runJavaScript(code, [callback](const QVariant &result) { 244 | QString resultString = result.toString(); 245 | Mpris::PlaybackStatus status = Mpris::InvalidPlaybackStatus; 246 | if (resultString == "stopped") 247 | status = Mpris::Stopped; 248 | else if (resultString == "playing") 249 | status = Mpris::Playing; 250 | else if (resultString == "paused") 251 | status = Mpris::Paused; 252 | callback(status); 253 | }); 254 | } 255 | 256 | void DefaultMprisInterface::playerStateTimerFired() { 257 | getVideoState([this](Mpris::PlaybackStatus state) { 258 | workWithPlayer([&](MprisPlayer &p) { 259 | p.setPlaybackStatus(state); 260 | p.setServiceName("QtWebFlix-Video"); 261 | }); 262 | }); 263 | } 264 | 265 | void DefaultMprisInterface::playerPositionTimerFired() { 266 | getVideoPosition([this](qlonglong useconds) { 267 | workWithPlayer([&](MprisPlayer &p) { p.setPosition(useconds); }); 268 | }); 269 | } 270 | 271 | void DefaultMprisInterface::metadataTimerFired() { 272 | getMetadata([this](qlonglong lengthUseconds, const QString &title, 273 | const QString &nid, const QString &artUrl) { 274 | workWithPlayer([&](MprisPlayer &p) { 275 | QVariantMap metadata; 276 | if (lengthUseconds >= 0) { 277 | metadata[Mpris::metadataToString(Mpris::Length)] = 278 | QVariant(lengthUseconds); 279 | } 280 | if (!title.isEmpty()) { 281 | metadata[Mpris::metadataToString(Mpris::Title)] = QVariant(title); 282 | } 283 | if (!nid.isEmpty()) { 284 | metadata[Mpris::metadataToString(Mpris::TrackId)] = 285 | QVariant("/com/video/title/" + nid); 286 | // QString artUrl = getArtUrl(nid); 287 | if (!artUrl.isEmpty()) { 288 | metadata[Mpris::metadataToString(Mpris::ArtUrl)] = QVariant(artUrl); 289 | } 290 | } 291 | p.setMetadata(metadata); 292 | }); 293 | }); 294 | } 295 | 296 | void DefaultMprisInterface::volumeTimerFired() { 297 | getVolume([this](double volume) { 298 | if (volume >= 0) { 299 | workWithPlayer([&](MprisPlayer &p) { p.setVolume(volume); }); 300 | } 301 | }); 302 | } 303 | -------------------------------------------------------------------------------- /src/defaultmprisinterface.h: -------------------------------------------------------------------------------- 1 | #ifndef DEFAULTMPRISINTERFACE_H 2 | #define DEFAULTMPRISINTERFACE_H 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include "mprisinterface.h" 10 | 11 | class MainWindow; 12 | 13 | class DefaultMprisInterface : public MprisInterface { 14 | Q_OBJECT 15 | 16 | public: 17 | explicit DefaultMprisInterface(QWidget *parent = nullptr); 18 | 19 | virtual void setup(MainWindow *window) override; 20 | 21 | void updatePlayerFullScreen(); 22 | 23 | private slots: 24 | // slots for handlers of hotkeys 25 | void playVideo(); 26 | void pauseVideo(); 27 | void togglePlayPause(); 28 | void setVideoVolume(double volume); 29 | void setFullScreen(bool fullscreen); 30 | void setPosition (QDBusObjectPath trackId,qlonglong pos); 31 | void setSeek (qlonglong seekPos); 32 | void playerStateTimerFired(); 33 | void playerPositionTimerFired(); 34 | void metadataTimerFired(); 35 | void volumeTimerFired(); 36 | 37 | //void networkManagerFinished(QNetworkReply *reply); 38 | 39 | private: 40 | QTimer playerStateTimer; 41 | QTimer playerPositionTimer; 42 | QTimer metadataTimer; 43 | QTimer volumeTimer; 44 | //QNetworkAccessManager networkManager; 45 | QString prevTitleId; 46 | QString prevArtUrl; 47 | std::mutex mtx_titleInfo; 48 | bool titleInfoFetching; 49 | 50 | QString getArtUrl(const QString& nid); 51 | 52 | void getVideoState(std::function callback); 53 | void getVideoPosition(std::function callback); 54 | void getMetadata(std::function callback); 55 | void getVolume(std::function callback); 56 | 57 | }; 58 | 59 | 60 | #endif // DEFAULTMPRISINTERFACE_H 61 | -------------------------------------------------------------------------------- /src/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include "mainwindow.h" 10 | 11 | //#include 12 | 13 | int main(int argc, char *argv[]) { 14 | qputenv("QTWEBENGINE_CHROMIUM_FLAGS", "--disable-features=MediaSessionService"); 15 | QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); 16 | QApplication::setAttribute(Qt::AA_ShareOpenGLContexts); 17 | QApplication app(argc, argv); 18 | QApplication::setWindowIcon(QIcon(":/resources/qtwebflix.svg")); 19 | 20 | 21 | MainWindow w; 22 | 23 | w.show(); 24 | w.parseCommand(); 25 | 26 | return app.exec(); 27 | } 28 | -------------------------------------------------------------------------------- /src/mainwindow.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include "amazonmprisinterface.h" 14 | #include "commandlineparser.h" 15 | #include "defaultmprisinterface.h" 16 | #include "mainwindow.h" 17 | #include "mprisinterface.h" 18 | #include "netflixmprisinterface.h" 19 | #include "ui_mainwindow.h" 20 | #include "urlrequestinterceptor.h" 21 | 22 | MainWindow::MainWindow(QWidget *parent) 23 | : QMainWindow(parent), ui(new Ui::MainWindow), 24 | mprisType(typeid(DefaultMprisInterface)), mpris(new DefaultMprisInterface) { 25 | QWebEngineSettings::globalSettings()->setAttribute( 26 | QWebEngineSettings::PluginsEnabled, true); 27 | appSettings = new QSettings("Qtwebflix", "save_state", this); 28 | QWebEngineProfile::defaultProfile()->setPersistentCookiesPolicy(QWebEngineProfile::ForcePersistentCookies); 29 | 30 | // set playbackrate and read jquery file 31 | playRate = 1.0; 32 | playRateStr = QString::number(playRate); 33 | QFile file; 34 | file.setFileName(":/jquery.min.js"); 35 | file.open(QIODevice::ReadOnly); 36 | jQuery = file.readAll(); 37 | jQuery.append("\nvar qt = { 'jQuery': jQuery.noConflict(true) };"); 38 | file.close(); 39 | 40 | ui->setupUi(this); 41 | this->setWindowTitle("QtWebFlix"); 42 | readSettings(); 43 | webview = new QWebEngineView; 44 | parseCommand(); 45 | ui->horizontalLayout->addWidget(webview); 46 | 47 | if (appSettings->value("site").toString() == "") { 48 | webview->setUrl(QUrl(QStringLiteral("https://netflix.com"))); 49 | } else { 50 | webview->setUrl(appSettings->value("site").toString()); 51 | } 52 | webview->settings()->setAttribute( 53 | QWebEngineSettings::FullScreenSupportEnabled, true); 54 | // Check for QT if equal or greater than 5.10 hide scrollbars 55 | #if HAS_SCROLLBAR 56 | webview->settings()->setAttribute(QWebEngineSettings::ShowScrollBars, false); 57 | #endif 58 | 59 | // connect handler for fullscreen press on video 60 | connect(webview->page(), &QWebEnginePage::fullScreenRequested, this, 61 | &MainWindow::fullScreenRequested); 62 | 63 | 64 | // key short cuts 65 | 66 | // F11 67 | keyF11 = new QShortcut(this); // Initialize the object 68 | keyF11->setKey(Qt::Key_F11); // Set the key code 69 | // connect handler to keypress 70 | connect(keyF11, SIGNAL(activated()), this, SLOT(slotShortcutF11())); 71 | 72 | // Ctrl + Q 73 | keyCtrlQ = new QShortcut(this); // Initialize the object 74 | keyCtrlQ->setKey(Qt::CTRL + Qt::Key_Q); // Set the key code 75 | // connect handler to keypress 76 | connect(keyCtrlQ, SIGNAL(activated()), this, SLOT(slotShortcutCtrlQ())); 77 | 78 | // Ctrl + W 79 | keyCtrlW = new QShortcut(this); 80 | keyCtrlW->setKey(Qt::CTRL + Qt::Key_W); // Set the key code 81 | connect(keyCtrlW, SIGNAL(activated()), this, SLOT(slotShortcutCtrlW())); 82 | 83 | // Ctrl + S 84 | keyCtrlS = new QShortcut(this); 85 | keyCtrlS->setKey(Qt::CTRL + Qt::Key_S); // Set the key code 86 | connect(keyCtrlS, SIGNAL(activated()), this, SLOT(slotShortcutCtrlS())); 87 | 88 | // Ctrl + R 89 | keyCtrlR = new QShortcut(this); 90 | keyCtrlR->setKey(Qt::CTRL + Qt::Key_R); // Set the key code 91 | connect(keyCtrlR, SIGNAL(activated()), this, SLOT(slotShortcutCtrlR())); 92 | 93 | // Ctrl + F5 94 | keyCtrlF5 = new QShortcut(this); 95 | keyCtrlF5->setKey(Qt::CTRL + Qt::Key_F5); // Set the key code 96 | connect(keyCtrlF5, SIGNAL(activated()), this, SLOT(slotShortcutCtrlF5())); 97 | 98 | this->webview->page()->profile()->setHttpUserAgent("Mozilla/5.0 (X11; Linux x86_64; rv:89.0) Gecko/20100101 Firefox/89.0"); 99 | 100 | // Connect finished loading boolean 101 | connect(webview, &QWebEngineView::loadFinished, this, 102 | &MainWindow::finishLoading); 103 | 104 | // Window size settings 105 | QSettings settings; 106 | restoreState(settings.value("mainWindowState").toByteArray()); 107 | 108 | webview->setContextMenuPolicy(Qt::CustomContextMenu); 109 | connect(webview, SIGNAL(customContextMenuRequested(const QPoint &)), this, 110 | SLOT(ShowContextMenu(const QPoint &))); 111 | 112 | mpris->setup(this); 113 | } 114 | 115 | MainWindow::~MainWindow() { delete ui; } 116 | 117 | // Slot handler of F11 118 | void MainWindow::slotShortcutF11() { 119 | /* This handler will make switching applications in full screen mode 120 | * and back to normal window mode 121 | * */ 122 | this->setFullScreen(!this->isFullScreen()); 123 | } 124 | 125 | QWebEngineView *MainWindow::webView() const { return webview; } 126 | 127 | // Slot handler for Ctrl + Q 128 | void MainWindow::slotShortcutCtrlQ() { 129 | writeSettings(); 130 | QApplication::quit(); 131 | } 132 | 133 | void MainWindow::finishLoading(bool) { exchangeMprisInterfaceIfNeeded(); } 134 | 135 | void MainWindow::exchangeMprisInterfaceIfNeeded() { 136 | QString hostname = webview->url().host(); 137 | if (hostname.endsWith("netflix.com")) { 138 | //this->webview->page()->profile()->setHttpUserAgent("Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0"); 139 | setMprisInterface(); 140 | } else if (hostname.endsWith("amazon.com")) { 141 | //use javascript to change useragent to watch HD Amazon Prime Videos as using QT crashes the program. 142 | QString code = "window.navigator.__defineGetter__('userAgent', function () {" 143 | "return 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.84 Safari/537.36 OPR/55.0.2994.34 (Edition beta)';" 144 | "});"; 145 | 146 | 147 | webView()->page()->runJavaScript(code); 148 | 149 | setMprisInterface(); 150 | } else { 151 | setMprisInterface(); 152 | } 153 | } 154 | 155 | // Slot handler for Ctrl + W 156 | void MainWindow::slotShortcutCtrlW() { 157 | QString getPlayer = 158 | ("var netflix = document.getElementsByClassName('ellipsize-text')[0];"); 159 | webview->page()->runJavaScript(getPlayer); 160 | if (playRate >= 2) { 161 | return; 162 | } 163 | playRate += .1; 164 | playRateStr = QString::number(playRate); 165 | // QString code = QStringLiteral("qt.jQuery('video').get(0).playbackRate =") 166 | QString code = 167 | QStringLiteral("document.querySelector('video').playbackRate = ") 168 | .append(playRateStr); 169 | QString setSpeedText = QStringLiteral("var y = document.createTextNode('") 170 | .append(playRateStr) 171 | .append(" X');"); 172 | 173 | QString replaceText = ("netflix.replaceChild(y, netflix.childNodes[3])"); 174 | QString addTextToPlayer = ("netflix.appendChild(y);"); 175 | QString addTextCode = (setSpeedText + addTextToPlayer + replaceText); 176 | qDebug() << "Player Speed set to: " << playRateStr; 177 | webview->page()->runJavaScript(code); 178 | webview->page()->runJavaScript(addTextCode); 179 | } 180 | 181 | // Slot handler for Ctrl + S 182 | void MainWindow::slotShortcutCtrlS() { 183 | 184 | QString getPlayer = 185 | ("var netflix = document.getElementsByClassName('ellipsize-text')[0];"); 186 | webview->page()->runJavaScript(getPlayer); 187 | if (playRate < 0.2) { 188 | return; 189 | } 190 | playRate -= .1; 191 | playRateStr = QString::number(playRate); 192 | QString code = 193 | QStringLiteral("document.querySelector('video').playbackRate = ") 194 | .append(playRateStr); 195 | QString setSpeedText = QStringLiteral("var y = document.createTextNode('") 196 | .append(playRateStr) 197 | .append(" X');"); 198 | 199 | QString replaceText = ("netflix.replaceChild(y, netflix.childNodes[3])"); 200 | QString addTextToPlayer = ("netflix.appendChild(y);"); 201 | QString addTextCode = (setSpeedText + addTextToPlayer + replaceText); 202 | qDebug() << "Player Speed set to: " << playRateStr; 203 | webview->page()->runJavaScript(code); 204 | webview->page()->runJavaScript(addTextCode); 205 | } 206 | 207 | // Slot handler for Ctrl + R 208 | void MainWindow::slotShortcutCtrlR() { 209 | webview->page()->runJavaScript(jQuery); 210 | if (playRate != 1.0) { 211 | playRate = 1.0; 212 | playRateStr = QString::number(playRate); 213 | QString code = QStringLiteral("qt.jQuery('video').get(0).playbackRate =") 214 | .append(playRateStr); 215 | QString setSpeedText = QStringLiteral("var y = document.createTextNode('") 216 | .append(playRateStr) 217 | .append(" X');"); 218 | 219 | QString replaceText = ("netflix.replaceChild(y, netflix.childNodes[3])"); 220 | QString addTextToPlayer = ("netflix.appendChild(y);"); 221 | QString addTextCode = (setSpeedText + addTextToPlayer + replaceText); 222 | qDebug() << "Player Speed set to: " << playRateStr; 223 | webview->page()->runJavaScript(code); 224 | webview->page()->runJavaScript(addTextCode); 225 | } 226 | } 227 | 228 | void MainWindow::slotShortcutCtrlF5() { 229 | webview->triggerPageAction(QWebEnginePage::ReloadAndBypassCache); 230 | } 231 | 232 | void MainWindow::setFullScreen(bool fullscreen) { 233 | if (!fullscreen) { 234 | this->showNormal(); 235 | } else { 236 | this->showFullScreen(); 237 | } 238 | mpris->updatePlayerFullScreen(); 239 | } 240 | 241 | void MainWindow::closeEvent(QCloseEvent *) { 242 | // This will be called whenever this window is closed. 243 | writeSettings(); 244 | } 245 | 246 | void MainWindow::writeSettings() { 247 | // Write the values to disk in categories. 248 | appSettings->setValue("state/mainWindowState", saveState()); 249 | appSettings->setValue("geometry/mainWindowGeometry", saveGeometry()); 250 | QString site = webview->url().toString(); 251 | appSettings->setValue("site", site); 252 | qDebug() << " write settings:" << site; 253 | QString hostname = webview->url().host(); 254 | //Resuming netflix video causes qtwebflix to hang, write to default homepage 255 | if (hostname.endsWith("netflix.com")){ 256 | appSettings->setValue("site", "https://netflix.com/browse"); 257 | } 258 | else{ 259 | webview->setUrl(appSettings->value("site").toString()); 260 | } 261 | } 262 | 263 | void MainWindow::restore() { 264 | 265 | QByteArray stateData = 266 | appSettings->value("state/mainWindowState").toByteArray(); 267 | 268 | QByteArray geometryData = 269 | appSettings->value("geometry/mainWindowGeometry").toByteArray(); 270 | 271 | restoreState(stateData); 272 | restoreGeometry(geometryData); 273 | } 274 | 275 | void MainWindow::readSettings() { restore(); } 276 | 277 | void MainWindow::fullScreenRequested(QWebEngineFullScreenRequest request) { 278 | 279 | // fullscreen on video players 280 | 281 | if (request.toggleOn() && !this->isFullScreen()) { 282 | this->showFullScreen(); 283 | } else { 284 | this->showNormal(); 285 | } 286 | mpris->updatePlayerFullScreen(); 287 | request.accept(); 288 | } 289 | 290 | void MainWindow::ShowContextMenu(const QPoint &pos) // this is a slot 291 | { 292 | 293 | QPoint globalPos = webview->mapToGlobal(pos); 294 | provSettings = new QSettings("Qtwebflix", "providers", this); 295 | provSettings->setIniCodec("UTF-8"); 296 | provSettings->beginGroup("providers"); 297 | QString conf(provSettings->fileName()); 298 | 299 | // Check if config file exists,if not create a default key. 300 | if (!QFile::exists(conf)) 301 | 302 | { 303 | qDebug() << "Config file does not exist, creating default"; 304 | provSettings->setValue("netflix", "http://netflix.com"); 305 | provSettings->sync(); 306 | } 307 | 308 | QStringList keys = provSettings->allKeys(); 309 | 310 | QMenu myMenu; 311 | for (const auto &i : keys) { 312 | // qDebug() << "keys" << i; 313 | 314 | if (!i.startsWith("#")) { 315 | myMenu.addAction(i); 316 | myMenu.addSeparator(); 317 | } 318 | } 319 | 320 | QAction *selectedItem = myMenu.exec(globalPos); 321 | 322 | if (selectedItem == nullptr) { 323 | return; 324 | } else if (selectedItem) { 325 | QString url = provSettings->value(selectedItem->text()).toString(); 326 | qDebug() << "URL is :" << url; 327 | webview->setUrl(QUrl(url)); 328 | provSettings->endGroup(); 329 | } 330 | 331 | else { 332 | // nothing was chosen 333 | } 334 | } 335 | 336 | void MainWindow::parseCommand() { 337 | // create parser object and get arguemts 338 | Commandlineparser parser; 339 | 340 | // check if argument is used and set provider 341 | if (parser.providerIsSet()) { 342 | if (parser.getProvider() == "") { 343 | qDebug() << "site is invalid reditecting to netflix.com"; 344 | webview->setUrl(QUrl(QStringLiteral("https://netflix.com"))); 345 | } else if (parser.getProvider() != "") { 346 | qDebug() << "site is set to" << parser.getProvider(); 347 | webview->setUrl(QUrl::fromUserInput(parser.getProvider())); 348 | } 349 | } 350 | 351 | // check if argument is used and set useragent 352 | if (parser.userAgentisSet()) { 353 | qDebug() << "Changing useragent to :" << parser.getUserAgent(); 354 | this->webview->page()->profile()->setHttpUserAgent(parser.getUserAgent()); 355 | } 356 | if (!parser.nonHDisSet()) { 357 | // qDebug() <<"1080p NEFLIX NO LONGER WORKS!"; 358 | //NO LONGER WORKING!!!!!!!!DAMN YOU NETFLIX 359 | this->m_interceptor = new UrlRequestInterceptor; 360 | this->webview->page()->profile()->setUrlRequestInterceptor( 361 | this->m_interceptor); 362 | } 363 | } 364 | -------------------------------------------------------------------------------- /src/mainwindow.h: -------------------------------------------------------------------------------- 1 | #ifndef MAINWINDOW_H 2 | #define MAINWINDOW_H 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | #include "urlrequestinterceptor.h" 18 | #include "mprisinterface.h" 19 | 20 | namespace Ui { 21 | class MainWindow; 22 | } 23 | 24 | class MainWindow : public QMainWindow { 25 | Q_OBJECT 26 | 27 | public: 28 | explicit MainWindow(QWidget *parent = nullptr); 29 | // void set_provider(QString); 30 | // void set_useragent(QString); 31 | // void parseCommand(QCommandLineParser &); 32 | void parseCommand(); 33 | ~MainWindow(); 34 | // QAction amazon(); 35 | void setFullScreen(bool fullscreen); 36 | QWebEngineView *webView() const; 37 | 38 | private slots: 39 | // slots for handlers of hotkeys 40 | void finishLoading(bool); 41 | void slotShortcutF11(); 42 | void slotShortcutCtrlQ(); 43 | void slotShortcutCtrlW(); 44 | void slotShortcutCtrlS(); 45 | void slotShortcutCtrlR(); 46 | void slotShortcutCtrlF5(); 47 | void ShowContextMenu(const QPoint &pos); 48 | 49 | protected: 50 | // save window geometry 51 | void closeEvent(QCloseEvent *); 52 | 53 | private: 54 | Ui::MainWindow *ui; 55 | QWebEngineView *webview; 56 | QString jQuery; 57 | double playRate; 58 | QString playRateStr; 59 | QShortcut *keyF11; // Entity of F11 hotkey 60 | QShortcut *keyCtrlQ; // Entity of Ctrl + D hotkeys 61 | QShortcut *keyCtrlW; // Entity of Crtl + W hotkey 62 | QShortcut *keyCtrlS; // Entity of Crtl + S hotkey 63 | QShortcut *keyCtrlR; // Entity of Crtl + R hotkey 64 | QShortcut *keyCtrlF5; // Entity of Crtl + R hotkey 65 | QSettings *appSettings; 66 | QSettings *provSettings; 67 | std::type_index mprisType; 68 | std::unique_ptr mpris; 69 | void fullScreenRequested(QWebEngineFullScreenRequest request); 70 | void writeSettings(); 71 | void readSettings(); 72 | void restore(); 73 | void exchangeMprisInterfaceIfNeeded(); 74 | 75 | UrlRequestInterceptor *m_interceptor; 76 | 77 | template 78 | bool setMprisInterface() { 79 | std::type_index newType(typeid(Interface)); 80 | if (mprisType == newType) { 81 | return false; 82 | } 83 | 84 | qDebug() << "Transitioning to new MPRIS interface: " << typeid(Interface).name(); 85 | mprisType = newType; 86 | mpris.reset(); 87 | 88 | mpris = std::make_unique(); 89 | mpris->setup(this); 90 | return true; 91 | } 92 | }; 93 | 94 | #endif // MAINWINDOW_H 95 | -------------------------------------------------------------------------------- /src/mprisinterface.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "mainwindow.h" 4 | #include "mprisinterface.h" 5 | 6 | MprisInterface::MprisInterface(QWidget *parent) 7 | : QObject(parent) { 8 | } 9 | 10 | void MprisInterface::setup(MainWindow *window) { 11 | m_window = window; 12 | 13 | //testing setting service name in the seperate interfaces 14 | workWithPlayer([] (MprisPlayer& p) { 15 | p.setServiceName("QtWebFlix"); 16 | p.setIdentity("QtWebFlix"); 17 | }); 18 | } 19 | 20 | 21 | void MprisInterface::workWithPlayer(std::function callback) { 22 | std::lock_guard l(m_mtx_player); 23 | 24 | // This should be the ONLY point where `m_player` is accessed. 25 | // For anything else, use `workWithPlayer()`. 26 | callback(m_player); 27 | } 28 | 29 | MainWindow * MprisInterface::window() const { 30 | return m_window; 31 | } 32 | 33 | QWebEngineView * MprisInterface::webView() const { 34 | return m_window->webView(); 35 | } 36 | 37 | void MprisInterface::updatePlayerFullScreen() { 38 | workWithPlayer([this] (MprisPlayer& p) { 39 | p.setFullscreen(m_window->isFullScreen()); 40 | }); 41 | } 42 | 43 | -------------------------------------------------------------------------------- /src/mprisinterface.h: -------------------------------------------------------------------------------- 1 | #ifndef MPRISINTERFACE_H 2 | #define MPRISINTERFACE_H 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | class MainWindow; 12 | 13 | class MprisInterface : public QObject { 14 | Q_OBJECT 15 | 16 | public: 17 | explicit MprisInterface(QWidget *parent = nullptr); 18 | virtual ~MprisInterface() = default; 19 | 20 | virtual void setup(MainWindow *window); 21 | 22 | void updatePlayerFullScreen(); 23 | 24 | protected: 25 | void workWithPlayer(std::function callback); 26 | MainWindow * window() const; 27 | QWebEngineView * webView() const; 28 | 29 | private: 30 | MainWindow *m_window; 31 | std::mutex m_mtx_player; 32 | MprisPlayer m_player; 33 | 34 | }; 35 | 36 | #endif // MPRISINTERFACE_H 37 | -------------------------------------------------------------------------------- /src/netflixmprisinterface.cpp: -------------------------------------------------------------------------------- 1 | #include "netflixmprisinterface.h" 2 | #include "mainwindow.h" 3 | #include "mprisinterface.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | NetflixMprisInterface::NetflixMprisInterface(QWidget *parent) 12 | : MprisInterface(parent) { 13 | prevTitleId = ""; 14 | prevArtUrl = ""; 15 | titleInfoFetching = false; 16 | } 17 | 18 | void NetflixMprisInterface::setup(MainWindow *window) { 19 | MprisInterface::setup(window); 20 | 21 | workWithPlayer([this](MprisPlayer &p) { 22 | // Expose player capabilities. 23 | p.setCanQuit(true); 24 | p.setCanSetFullscreen(true); 25 | p.setCanPause(true); 26 | p.setCanPlay(true); 27 | p.setCanControl(true); 28 | p.setCanSeek(true); 29 | p.canSeek(); 30 | p.canSeekChanged(); 31 | p.setMetadata(QVariantMap()); 32 | p.setIdentity("Qtwebflix -- Netflix"); 33 | 34 | connect(&p, SIGNAL(pauseRequested()), this, SLOT(pauseVideo())); 35 | connect(&p, SIGNAL(playRequested()), this, SLOT(playVideo())); 36 | connect(&p, SIGNAL(playPauseRequested()), this, SLOT(togglePlayPause())); 37 | connect(&p, SIGNAL(nextRequested()), this, SLOT(goNextEpisode())); 38 | connect(&p, SIGNAL(fullscreenRequested(bool)), this, 39 | SLOT(setFullScreen(bool))); 40 | connect(&p, SIGNAL(volumeRequested(double)), this, 41 | SLOT(setVideoVolume(double))); 42 | connect(&p, SIGNAL(setPositionRequested(QDBusObjectPath, qlonglong)), this, 43 | SLOT(setPosition(QDBusObjectPath, qlonglong))); 44 | connect(&p, SIGNAL(seekRequested(qlonglong)), this, 45 | SLOT(setSeek(qlonglong))); 46 | }); 47 | 48 | connect(&networkManager, SIGNAL(finished(QNetworkReply *)), this, 49 | SLOT(networkManagerFinished(QNetworkReply *))); 50 | 51 | // Connect slots and start timers. 52 | connect(&playerStateTimer, SIGNAL(timeout()), this, 53 | SLOT(playerStateTimerFired())); 54 | playerStateTimer.start(500); 55 | 56 | connect(&playerPositionTimer, SIGNAL(timeout()), this, 57 | SLOT(playerPositionTimerFired())); 58 | playerPositionTimer.start(170); 59 | 60 | connect(&metadataTimer, SIGNAL(timeout()), this, SLOT(metadataTimerFired())); 61 | metadataTimer.start(200); 62 | 63 | connect(&volumeTimer, SIGNAL(timeout()), this, SLOT(volumeTimerFired())); 64 | volumeTimer.start(220); 65 | 66 | connect(&goNextTimer, SIGNAL(timeout()), this, SLOT(goNextTimerFired())); 67 | goNextTimer.start(5000); 68 | } 69 | 70 | void NetflixMprisInterface::playVideo() { 71 | QString code = ("(function () {" 72 | "var vid = document.querySelector('video');" 73 | "if (!vid) return;" 74 | "vid.play();" 75 | "})();"); 76 | qDebug() << "Player playing"; 77 | webView()->page()->runJavaScript(code); 78 | } 79 | 80 | void NetflixMprisInterface::pauseVideo() { 81 | QString code = ("(function () {" 82 | "var vid = document.querySelector('video');" 83 | "if (!vid) return;" 84 | "vid.pause();" 85 | "})();"); 86 | qDebug() << "Player paused"; 87 | webView()->page()->runJavaScript(code); 88 | } 89 | 90 | void NetflixMprisInterface::togglePlayPause() { 91 | QString code = ("(function () {" 92 | "var vid = document.querySelector('video');" 93 | "if (!vid) return;" 94 | "if (vid.paused) vid.play();" 95 | "else vid.pause();" 96 | "})();"); 97 | qDebug() << "Player toggled play/pause"; 98 | webView()->page()->runJavaScript(code); 99 | } 100 | 101 | void NetflixMprisInterface::goNextEpisode() { 102 | 103 | QString code = ("(function () {" 104 | "var goNext = " 105 | "document.querySelector('button.touchable.PlayerControls--" 106 | "control-element.nfp-button-control.default-control-button." 107 | "button-nfplayerNextEpisode');" 108 | "goNext.click();" 109 | "})()"); 110 | qDebug() << "Next episode"; 111 | webView()->page()->runJavaScript(code); 112 | } 113 | 114 | void NetflixMprisInterface::setVideoVolume(double volume) { 115 | QString code = ("(function () {" 116 | "var vid = document.querySelector('video');" 117 | "if (!vid) return;" 118 | "vid.volume = " + 119 | QString::number(volume) + 120 | ";" 121 | "})();"); 122 | qDebug() << "Player set volume to " << volume; 123 | webView()->page()->runJavaScript(code); 124 | } 125 | 126 | void NetflixMprisInterface::setFullScreen(bool fullscreen) { 127 | window()->setFullScreen(fullscreen); 128 | } 129 | 130 | void NetflixMprisInterface::getVolume(std::function callback) { 131 | QString code = ("(function () {" 132 | "var vid = document.querySelector('video');" 133 | "return vid ? vid.volume : -1;" 134 | "})()"); 135 | webView()->page()->runJavaScript(code, [callback](const QVariant &result) { 136 | callback(result.toDouble()); 137 | }); 138 | } 139 | 140 | void NetflixMprisInterface::getVideoPosition( 141 | std::function callback) { 142 | QString code = ("(function () {" 143 | "var vid = document.querySelector('video');" 144 | "return vid ? vid.currentTime : -1;" 145 | "})()"); 146 | webView()->page()->runJavaScript(code, [callback](const QVariant &result) { 147 | double seconds = result.toDouble(); 148 | if (seconds < 0) 149 | callback(-1); 150 | else 151 | callback(seconds / 1e-6); 152 | }); 153 | } 154 | 155 | void NetflixMprisInterface::setPosition(QDBusObjectPath trackId, 156 | qlonglong pos) { 157 | double useconds = static_cast(pos); 158 | useconds = useconds / 1000; 159 | qDebug() << "Seeking Position by " << useconds / 1000 << " Seconds"; 160 | QString code = ("(function () {" 161 | "const videoPlayer = netflix" 162 | ".appContext" 163 | ".state" 164 | ".playerApp" 165 | ".getAPI()" 166 | ".videoPlayer;" 167 | "const playerSessionId = videoPlayer" 168 | ".getAllPlayerSessionIds()[0];" 169 | "const player = videoPlayer" 170 | ".getVideoPlayerBySessionId(playerSessionId);" 171 | "player.seek(" + 172 | QString::number(useconds) + 173 | ");" 174 | "})();"); 175 | webView()->page()->runJavaScript(code); 176 | qDebug("running"); 177 | } 178 | 179 | void NetflixMprisInterface::setSeek(qlonglong seekPos) { 180 | double useconds = static_cast(seekPos); 181 | useconds = useconds / 1000; 182 | qDebug() << "Seeking Position by " << useconds / 1000 << " Seconds"; 183 | QString code = ("(function () {" 184 | "const videoPlayer = netflix" 185 | ".appContext" 186 | ".state" 187 | ".playerApp" 188 | ".getAPI()" 189 | ".videoPlayer;" 190 | "const playerSessionId = videoPlayer" 191 | ".getAllPlayerSessionIds()[0];" 192 | "const player = videoPlayer" 193 | ".getVideoPlayerBySessionId(playerSessionId);" 194 | "player.seek(player.getCurrentTime() +" + 195 | QString::number(useconds) + 196 | ");" 197 | "})();"); 198 | webView()->page()->runJavaScript(code); 199 | } 200 | void NetflixMprisInterface::getMetadata( 201 | std::function callback) { 202 | QString code = 203 | ("(function () {" 204 | "var vid = document.querySelector('video');" 205 | "const titleLabel = " 206 | "document.querySelectorAll(\"[data-uia='video-title']\")[0];" 207 | "var metadata = {};" 208 | "metadata.duration = vid ? vid.duration : -1;" 209 | "metadata.title = titleLabel ? " 210 | "titleLabel.innerHTML.replace(/(<([^>]+)>)/g, \" \").replace(/ +(?= " 211 | ")/g,'').replace(/ +(?= )/g,'').trim() : '';" 212 | "metadata.nid = vid && vid.offsetParent ? vid.offsetParent.id : '';" 213 | "return metadata;" 214 | "})()"); 215 | webView()->page()->runJavaScript(code, [callback](const QVariant &result) { 216 | QVariantMap map = result.toMap(); 217 | 218 | double seconds = map["duration"].toDouble(); 219 | if (seconds < 0) 220 | seconds = -1; 221 | else 222 | seconds /= 1e-6; 223 | 224 | QString nid = map["nid"].toString(); 225 | if (map["title"].toString() != "") { 226 | QString title = map["title"].toString(); 227 | map["title"] = title; 228 | callback(seconds, title, nid); 229 | } 230 | }); 231 | } 232 | 233 | void NetflixMprisInterface::getVideoState( 234 | std::function callback) { 235 | QString code = ("(function () {" 236 | "var vid = document.querySelector('video');" 237 | "if (!vid) return 'stopped';" 238 | "return vid.paused ? 'paused' : 'playing';" 239 | "})()"); 240 | webView()->page()->runJavaScript(code, [callback](const QVariant &result) { 241 | QString resultString = result.toString(); 242 | Mpris::PlaybackStatus status = Mpris::InvalidPlaybackStatus; 243 | if (resultString == "stopped") 244 | status = Mpris::Stopped; 245 | else if (resultString == "playing") 246 | status = Mpris::Playing; 247 | else if (resultString == "paused") 248 | status = Mpris::Paused; 249 | callback(status); 250 | }); 251 | } 252 | 253 | void NetflixMprisInterface::playerStateTimerFired() { 254 | getVideoState([this](Mpris::PlaybackStatus state) { 255 | workWithPlayer([&](MprisPlayer &p) { p.setPlaybackStatus(state); }); 256 | }); 257 | } 258 | 259 | void NetflixMprisInterface::playerPositionTimerFired() { 260 | getVideoPosition([this](qlonglong useconds) { 261 | workWithPlayer([&](MprisPlayer &p) { p.setPosition(useconds); }); 262 | }); 263 | } 264 | 265 | void NetflixMprisInterface::metadataTimerFired() { 266 | getMetadata([this](qlonglong lengthUseconds, const QString &title, 267 | const QString &nid) { 268 | workWithPlayer([&](MprisPlayer &p) { 269 | QVariantMap metadata; 270 | if (lengthUseconds >= 0) { 271 | metadata[Mpris::metadataToString(Mpris::Length)] = 272 | QVariant(lengthUseconds); 273 | } 274 | if (!title.isEmpty()) { 275 | metadata[Mpris::metadataToString(Mpris::Title)] = QVariant(title); 276 | } 277 | if (!nid.isEmpty()) { 278 | metadata[Mpris::metadataToString(Mpris::TrackId)] = 279 | QVariant("/com/netflix/title/" + nid); 280 | QString artUrl = getArtUrl(nid); 281 | if (!artUrl.isEmpty()) { 282 | metadata[Mpris::metadataToString(Mpris::ArtUrl)] = QVariant(artUrl); 283 | } 284 | } 285 | p.setMetadata(metadata); 286 | }); 287 | }); 288 | } 289 | 290 | void NetflixMprisInterface::volumeTimerFired() { 291 | getVolume([this](double volume) { 292 | if (volume >= 0) { 293 | workWithPlayer([&](MprisPlayer &p) { p.setVolume(volume); }); 294 | } 295 | }); 296 | } 297 | 298 | QString NetflixMprisInterface::getArtUrl(const QString &nid) { 299 | std::lock_guard l(mtx_titleInfo); 300 | 301 | if (nid.isEmpty()) { 302 | return QString(); 303 | } 304 | 305 | if (nid == prevTitleId && !prevArtUrl.isEmpty()) { 306 | // The URL was asynchronously retrieved earlier. 307 | return prevArtUrl; 308 | } 309 | 310 | if (titleInfoFetching) { 311 | // GET request already in progress. 312 | return QString(); 313 | } 314 | 315 | QUrl jsonUrl("https://www.netflix.com/title/" + nid); 316 | QNetworkRequest titleInfoRequest(jsonUrl); 317 | titleInfoRequest.setRawHeader("Accept", "application/json"); 318 | titleInfoRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, 319 | QVariant(true)); 320 | 321 | // Here we assume that nobody but `metadataTimerFired` calls us. 322 | // Since the timer ticks every second, it's unlikely that we will make 323 | // duplicate requests. Otherwise we would need locks. 324 | titleInfoFetching = true; 325 | prevArtUrl = QString(); 326 | prevTitleId = nid; 327 | 328 | networkManager.get(titleInfoRequest); 329 | 330 | // The request's under way. Hopefully, next time around the response will have 331 | // arrived. 332 | return QString(); 333 | } 334 | 335 | void NetflixMprisInterface::networkManagerFinished(QNetworkReply *reply) { 336 | if (!reply->error()) { 337 | QString html = reply->readAll(); 338 | QRegExp rx("\"image\": *\"([^\"]*)\""); 339 | if (rx.indexIn(html) != -1) { 340 | prevArtUrl = rx.cap(1); 341 | } else { 342 | qDebug() 343 | << "Could not find art URL in title info response. Check the regex."; 344 | } 345 | } else { 346 | qDebug() << "Title info request failed with error:" << reply->errorString(); 347 | } 348 | 349 | { 350 | std::lock_guard l(mtx_titleInfo); 351 | titleInfoFetching = false; 352 | } 353 | 354 | reply->deleteLater(); 355 | } 356 | 357 | void NetflixMprisInterface::goNextTimerFired() { 358 | QString code = ("(function () {" 359 | "var goNext = " 360 | "document.querySelector('button.touchable.PlayerControls--" 361 | "control-element.nfp-button-control.default-control-button." 362 | "button-nfplayerNextEpisode');" 363 | "if (!goNext) return false;" 364 | "else return true;" 365 | "})()"); 366 | webView()->page()->runJavaScript(code, [this](const QVariant &result) { 367 | QString resultString = result.toString(); 368 | if (resultString == "false") { 369 | workWithPlayer([](MprisPlayer &p) { p.setCanGoNext(false); }); 370 | } else { 371 | workWithPlayer([](MprisPlayer &p) { p.setCanGoNext(true); }); 372 | } 373 | }); 374 | } 375 | -------------------------------------------------------------------------------- /src/netflixmprisinterface.h: -------------------------------------------------------------------------------- 1 | #ifndef NETFLIXMPRISINTERFACE_H 2 | #define NETFLIXMPRISINTERFACE_H 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include "mprisinterface.h" 10 | 11 | class MainWindow; 12 | 13 | class NetflixMprisInterface : public MprisInterface { 14 | Q_OBJECT 15 | 16 | public: 17 | explicit NetflixMprisInterface(QWidget *parent = nullptr); 18 | 19 | virtual void setup(MainWindow *window) override; 20 | 21 | void updatePlayerFullScreen(); 22 | 23 | private slots: 24 | // slots for handlers of hotkeys 25 | void playVideo(); 26 | void pauseVideo(); 27 | void togglePlayPause(); 28 | void goNextEpisode(); 29 | void setVideoVolume(double volume); 30 | void setFullScreen(bool fullscreen); 31 | void setPosition (QDBusObjectPath trackId,qlonglong pos); 32 | void setSeek (qlonglong seekPos); 33 | void playerStateTimerFired(); 34 | void playerPositionTimerFired(); 35 | void metadataTimerFired(); 36 | void volumeTimerFired(); 37 | void goNextTimerFired(); 38 | 39 | void networkManagerFinished(QNetworkReply *reply); 40 | 41 | private: 42 | QTimer playerStateTimer; 43 | QTimer playerPositionTimer; 44 | QTimer metadataTimer; 45 | QTimer volumeTimer; 46 | QTimer goNextTimer; 47 | QNetworkAccessManager networkManager; 48 | QString prevTitleId; 49 | QString prevArtUrl; 50 | std::mutex mtx_titleInfo; 51 | bool titleInfoFetching; 52 | 53 | QString getArtUrl(const QString& nid); 54 | 55 | void getVideoState(std::function callback); 56 | void getVideoPosition(std::function callback); 57 | void getMetadata(std::function callback); 58 | void getVolume(std::function callback); 59 | void canGoNext(std::functioncallback); 60 | 61 | }; 62 | 63 | #endif // NETFLIXMPRISINTERFACE_H 64 | -------------------------------------------------------------------------------- /src/src.pro: -------------------------------------------------------------------------------- 1 | QT += webenginewidgets core dbus 2 | 3 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 4 | 5 | TARGET = ../qtwebflix 6 | TEMPLATE = app 7 | # The following define makes your compiler emit warnings if you use 8 | # any feature of Qt which as been marked as deprecated (the exact warnings 9 | # depend on your compiler). Please consult the documentation of the 10 | # deprecated API in order to know how to port your code away from it. 11 | DEFINES += QT_DEPRECATED_WARNINGS 12 | 13 | # You can also make your code fail to compile if you use deprecated APIs. 14 | # In order to do so, uncomment the following line. 15 | # You can also select to disable deprecated APIs only up to a certain version of Qt. 16 | #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 17 | 18 | #Check version of qt to enable hide scrollbars available in qt 5.10+ 19 | equals(QT_MAJOR_VERSION, 5):!lessThan(QT_MINOR_VERSION, 10) { 20 | DEFINES += HAS_SCROLLBAR 21 | } else { 22 | message(Qt $$QT_VERSION ScrollBars not supported in this version.) 23 | } 24 | 25 | #Get current git tag and use for version number 26 | BASE_GIT_COMMAND = git --git-dir $$PWD/../.git --work-tree $$PWD 27 | GIT_VERSION = $$system($$BASE_GIT_COMMAND describe --always --tags) 28 | DEFINES += GIT_VERSION=\\\"$$GIT_VERSION\\\" 29 | 30 | 31 | SOURCES += main.cpp\ 32 | mainwindow.cpp \ 33 | urlrequestinterceptor.cpp \ 34 | commandlineparser.cpp \ 35 | mprisinterface.cpp \ 36 | defaultmprisinterface.cpp \ 37 | netflixmprisinterface.cpp\ 38 | amazonmprisinterface.cpp 39 | HEADERS += mainwindow.h \ 40 | urlrequestinterceptor.h \ 41 | commandlineparser.h \ 42 | mprisinterface.h \ 43 | defaultmprisinterface.h \ 44 | netflixmprisinterface.h\ 45 | amazonmprisinterface.h 46 | 47 | FORMS += ../ui/mainwindow.ui 48 | 49 | RESOURCES = ../resources/jquery.qrc \ 50 | ../resources/qtwebflix.svg 51 | 52 | DISTFILES += 53 | 54 | LIBS = -L../lib -ldbusextended-qt5 -lmpris-qt5 55 | 56 | INCLUDEPATH += ../lib/qtdbusextended/src ../lib/qtmpris/src 57 | 58 | 59 | -------------------------------------------------------------------------------- /src/urlrequestinterceptor.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "urlrequestinterceptor.h" 5 | 6 | UrlRequestInterceptor::UrlRequestInterceptor(QObject *parent) 7 | : QWebEngineUrlRequestInterceptor(parent) 8 | { 9 | } 10 | 11 | void UrlRequestInterceptor::interceptRequest(QWebEngineUrlRequestInfo &info) 12 | { 13 | static const QRegExp netflix1080p_pattern(R"(.*\:\/\/assets\.nflxext\.com\/.*\/ffe\/player\/html\/.*|)" 14 | R"(.*\:\/\/www\.assets\.nflxext\.com\/.*\/ffe\/player\/html\/.*)"); 15 | 16 | if (netflix1080p_pattern.exactMatch(info.requestUrl().toString())) 17 | { 18 | qDebug() << "Netflix Player detected! Injecting Netflix 1080p Unlocker..."; 19 | //info.redirect(QUrl("https://rawgit.com/gort818/netflix-1080p/master/cadmium-playercore-6.0009.325.011-1080p.js")); 20 | 21 | // old playercore still works but a lot fo shows no longer play in 1080 22 | //info.redirect(QUrl("https://rawcdn.githack.com/gort818/netflix-1080p/a225d19994546396f252a169704e2bde43e5ff7d/playercore-481.js")); 23 | //new playercore (ctrl + alt + shift + s no longer working 24 | info.redirect(QUrl("https://rawcdn.githack.com/gort818/netflix-1080p/556ae9660864867a767a2dc06e1f6548a513bfa6/cadmium-playercore-6.0033.414.911-1080p.js")); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/urlrequestinterceptor.h: -------------------------------------------------------------------------------- 1 | #ifndef URLREQUESTINTERCEPTOR_H 2 | #define URLREQUESTINTERCEPTOR_H 3 | 4 | #include 5 | 6 | class UrlRequestInterceptor : public QWebEngineUrlRequestInterceptor 7 | { 8 | Q_OBJECT 9 | 10 | public: 11 | UrlRequestInterceptor(QObject *parent = nullptr); 12 | void interceptRequest(QWebEngineUrlRequestInfo &info) override; 13 | }; 14 | 15 | #endif // URLREQUESTINTERCEPTOR_H 16 | -------------------------------------------------------------------------------- /ui/mainwindow.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | MainWindow 4 | 5 | 6 | 7 | 0 8 | 0 9 | 466 10 | 400 11 | 12 | 13 | 14 | Netflix 15 | 16 | 17 | 18 | 19 | 300 20 | 400 21 | 22 | 23 | 24 | 25 | 0 26 | 27 | 28 | 0 29 | 30 | 31 | 0 32 | 33 | 34 | 0 35 | 36 | 37 | 0 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /widevine-18.10.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #script to download and extract widevine compements, tested on unbutu 18.10 4 | 5 | 6 | #Uninstall the files 7 | 8 | if [ "$1" == "uninstall" ]; then 9 | echo "Uninstalling libwidevinecdmadapter.so" 10 | rm /usr/lib/x86_64-linux-gnu/qt5/plugins/ppapi/libwidevinecdmadapter.so 11 | echo "Uninstalling libwidevinecdm.so" 12 | rm /usr/lib/x86_64-linux-gnu/qt5/plugins/ppapi/libwidevinecdm.so 13 | exit 14 | fi 15 | 16 | 17 | 18 | 19 | #Create temp directory 20 | tmp_dir=$(mktemp -d) 21 | echo $tmp_dir 22 | 23 | #set urls and checksums 24 | url1="https://www.slimjet.com/chrome/download-chrome.php?file=lnx%2Fchrome64_66.0.3359.181.deb" 25 | file1=$(basename "$url1") 26 | sha256_1=("229b35f0d41bbb6edd98ce4ab8305994a0f5cd1ac4d9817571f07365b2d1ad80") 27 | 28 | #Download Files 29 | wget $url1 -P $tmp_dir 30 | #Get checksums from files 31 | local_sha2561=$(sha256sum $tmp_dir/"$file1"| awk '{print $1}') 32 | 33 | #check checksums for first file 34 | if [ "$sha256_1" == "$local_sha2561" ]; then 35 | echo "Checksums match for $file1" 36 | else 37 | echo "Checksums do not match for '$file1' exiting!" 38 | exit 39 | fi 40 | 41 | 42 | 43 | cd $tmp_dir 44 | 45 | #extract the files 46 | ar -vx $tmp_dir/$file1 47 | #unzip $tmp_dir/$file2 48 | tar -xvf $tmp_dir/data.tar.xz --strip-components 4 ./opt/google/chrome/libwidevinecdmadapter.so \ 49 | ./opt/google/chrome/libwidevinecdm.so 50 | 51 | #install the files 52 | echo "Installing libwidevinecdmadapter.so to /usr/lib/x86_64-linux-gnu/qt5/plugins/ppapi/" 53 | install -Dm644 $tmp_dir/libwidevinecdmadapter.so -t /usr/lib/x86_64-linux-gnu/qt5/plugins/ppapi/ 54 | echo "Installing libwidevinecdm.so to /usr/lib/x86_64-linux-gnu/qt5/plugins/ppapi/" 55 | install -Dm644 $tmp_dir/libwidevinecdm.so -t /usr/lib/x86_64-linux-gnu/qt5/plugins/ppapi/ 56 | 57 | -------------------------------------------------------------------------------- /widevine.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #script to download and extract widevine compements, tested on unbutu 17+ 4 | 5 | 6 | #Uninstall the files 7 | 8 | if [ "$1" == "uninstall" ]; then 9 | echo "Uninstalling libwidevinecdmadapter.so" 10 | rm /usr/lib/x86_64-linux-gnu/qt5/plugins/ppapi/libwidevinecdmadapter.so 11 | echo "Uninstalling libwidevinecdm.so" 12 | rm /usr/lib/x86_64-linux-gnu/qt5/plugins/ppapi/libwidevinecdm.so 13 | exit 14 | fi 15 | 16 | 17 | 18 | 19 | #Create temp directory 20 | tmp_dir=$(mktemp -d) 21 | echo $tmp_dir 22 | 23 | #set urls and checksums 24 | url1=https://archive.archlinux.org/packages/c/chromium/chromium-61.0.3163.100-1-x86_64.pkg.tar.xz 25 | file1=$(basename "$url1") 26 | url2=https://dl.google.com/widevine-cdm/1.4.8.1008-linux-x64.zip 27 | file2=$(basename "$url2") 28 | sha256_1=("5d4380308b3d5c2bc6e13d77090688ba00f0828f2777d83376d44038a6d0e2dd") 29 | sha256_2=("fe04a5b56eac6674f1eda2c8eb28a0183ec1a66d80f72db618291e33078eb17d") 30 | 31 | #Download Files 32 | wget $url1 -P $tmp_dir 33 | wget $url2 -P $tmp_dir 34 | #Get checksums from files 35 | local_sha2561=$(sha256sum $tmp_dir/"$file1"| awk '{print $1}') 36 | local_sha2562=$(sha256sum $tmp_dir/"$file2"| awk '{print $1}') 37 | 38 | #check checksums for first file 39 | if [ "$sha256_1" == "$local_sha2561" ]; then 40 | echo "Checksums match for $file1" 41 | else 42 | echo "Checksums do not match for '$file1' exiting!" 43 | exit 44 | fi 45 | 46 | #check checksums for second file 47 | 48 | if [ "$sha256_2" == "$local_sha2562" ]; then 49 | echo "Checksums match for $file2" 50 | else 51 | echo "Checksums do not match for '$file2' exiting!" 52 | exit 53 | fi 54 | 55 | cd $tmp_dir 56 | 57 | #extract the files 58 | tar -xf $tmp_dir/$file1 usr/lib/chromium/libwidevinecdmadapter.so 59 | unzip $tmp_dir/$file2 60 | 61 | #install the files 62 | echo "Installing libwidevinecdmadapter.so to /usr/lib/x86_64-linux-gnu/qt5/plugins/ppapi/" 63 | install -Dm644 $tmp_dir/usr/lib/chromium/libwidevinecdmadapter.so -t /usr/lib/x86_64-linux-gnu/qt5/plugins/ppapi/ 64 | echo "Installing libwidevinecdm.so to /usr/lib/x86_64-linux-gnu/qt5/plugins/ppapi/" 65 | install -Dm644 $tmp_dir/libwidevinecdm.so -t /usr/lib/x86_64-linux-gnu/qt5/plugins/ppapi/ 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | --------------------------------------------------------------------------------