From 8b26641a7a62343a70a59967fc5b345bb494f200 Mon Sep 17 00:00:00 2001 From: Lunatixz Date: Thu, 9 Nov 2017 16:02:21 -0500 Subject: [plugin.video.ustvnow] 2017.10.16 recommend updates --- plugin.video.ustvnow/LICENSE | 674 ++++++++++++++++++ plugin.video.ustvnow/README.md | 0 plugin.video.ustvnow/addon.xml | 13 +- plugin.video.ustvnow/default.py | 690 +----------------- plugin.video.ustvnow/net.py | 328 --------- plugin.video.ustvnow/resources/__init__.py | 0 .../resources/images/screenshot01.png | Bin 561123 -> 576212 bytes .../resources/images/screenshot02.png | Bin 693317 -> 623725 bytes .../resources/images/screenshot03.png | Bin 517590 -> 323137 bytes .../resources/images/screenshot04.png | Bin 751334 -> 222154 bytes .../resources/images/screenshot05.png | Bin 379036 -> 222154 bytes .../language/resource.language.en_gb/strings.po | 12 + plugin.video.ustvnow/resources/lib/__init__.py | 0 plugin.video.ustvnow/resources/lib/net.py | 345 +++++++++ plugin.video.ustvnow/resources/lib/ustvnow.py | 787 +++++++++++++++++++++ .../default/1080i/script.module.uepg.guide.xml | 673 ++++++++++++++++++ .../default/1080i/script.module.uepg.splash.xml | 21 + .../resources/skins/default/media/Arrow.png | Bin 0 -> 698 bytes .../resources/skins/default/media/Background.png | Bin 0 -> 108563 bytes .../resources/skins/default/media/Bar.png | Bin 0 -> 473 bytes .../resources/skins/default/media/Blur.png | Bin 0 -> 2772469 bytes .../resources/skins/default/media/ButtonFocus.png | Bin 0 -> 472 bytes .../resources/skins/default/media/CC.png | Bin 0 -> 2104 bytes .../resources/skins/default/media/Lines.png | Bin 0 -> 603 bytes .../resources/skins/default/media/Live.png | Bin 0 -> 1782 bytes .../resources/skins/default/media/Overlay.png | Bin 0 -> 192843 bytes .../resources/skins/default/media/PastFade.png | Bin 0 -> 131 bytes .../resources/skins/default/media/Splash.gif | Bin 0 -> 748468 bytes .../resources/skins/default/media/Splash.png | Bin 0 -> 226441 bytes .../resources/skins/default/media/TimeBar.png | Bin 0 -> 701 bytes .../skins/default/media/USTVnow - Copy.png | Bin 0 -> 15213 bytes .../resources/skins/default/media/USTVnow.png | Bin 0 -> 17791 bytes .../resources/skins/default/media/White.png | Bin 0 -> 281 bytes .../media/epg-genres/COLOR_ButtonNoFocus.png | Bin 0 -> 484 bytes 34 files changed, 2522 insertions(+), 1021 deletions(-) create mode 100644 plugin.video.ustvnow/LICENSE create mode 100644 plugin.video.ustvnow/README.md delete mode 100644 plugin.video.ustvnow/net.py create mode 100644 plugin.video.ustvnow/resources/__init__.py create mode 100644 plugin.video.ustvnow/resources/lib/__init__.py create mode 100644 plugin.video.ustvnow/resources/lib/net.py create mode 100644 plugin.video.ustvnow/resources/lib/ustvnow.py create mode 100644 plugin.video.ustvnow/resources/skins/default/1080i/script.module.uepg.guide.xml create mode 100644 plugin.video.ustvnow/resources/skins/default/1080i/script.module.uepg.splash.xml create mode 100644 plugin.video.ustvnow/resources/skins/default/media/Arrow.png create mode 100644 plugin.video.ustvnow/resources/skins/default/media/Background.png create mode 100644 plugin.video.ustvnow/resources/skins/default/media/Bar.png create mode 100644 plugin.video.ustvnow/resources/skins/default/media/Blur.png create mode 100644 plugin.video.ustvnow/resources/skins/default/media/ButtonFocus.png create mode 100644 plugin.video.ustvnow/resources/skins/default/media/CC.png create mode 100644 plugin.video.ustvnow/resources/skins/default/media/Lines.png create mode 100644 plugin.video.ustvnow/resources/skins/default/media/Live.png create mode 100644 plugin.video.ustvnow/resources/skins/default/media/Overlay.png create mode 100644 plugin.video.ustvnow/resources/skins/default/media/PastFade.png create mode 100644 plugin.video.ustvnow/resources/skins/default/media/Splash.gif create mode 100644 plugin.video.ustvnow/resources/skins/default/media/Splash.png create mode 100644 plugin.video.ustvnow/resources/skins/default/media/TimeBar.png create mode 100644 plugin.video.ustvnow/resources/skins/default/media/USTVnow - Copy.png create mode 100644 plugin.video.ustvnow/resources/skins/default/media/USTVnow.png create mode 100644 plugin.video.ustvnow/resources/skins/default/media/White.png create mode 100644 plugin.video.ustvnow/resources/skins/default/media/epg-genres/COLOR_ButtonNoFocus.png diff --git a/plugin.video.ustvnow/LICENSE b/plugin.video.ustvnow/LICENSE new file mode 100644 index 0000000..9cecc1d --- /dev/null +++ b/plugin.video.ustvnow/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + {one line to give the program's name and a brief idea of what it does.} + Copyright (C) {year} {name of author} + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + {project} Copyright (C) {year} {fullname} + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/plugin.video.ustvnow/README.md b/plugin.video.ustvnow/README.md new file mode 100644 index 0000000..e69de29 diff --git a/plugin.video.ustvnow/addon.xml b/plugin.video.ustvnow/addon.xml index 9df31a6..7ebce54 100644 --- a/plugin.video.ustvnow/addon.xml +++ b/plugin.video.ustvnow/addon.xml @@ -1,21 +1,22 @@ - + - + + video - Watch All the Major American Television Networks Live in HD for Free! - Entirely Legal and Free! Start watching instantly or record shows for later. Signup for one of three packages, today! + The Official plugin for the USTVnow Service. + Entirely Legal and Free! Start watching instantly or record shows for later. Signup for one of three packages today! all GNU GENERAL PUBLIC LICENSE. Version 3, June 2007 - https://github.com/Lunatixz/XBMC_Addons/tree/master/plugin.video.ustvnow + https://github.com/Lunatixz/plugin.video.ustvnow/tree/master/ http://ustvnow.com http://forum.kodi.tv/showthread.php?tid=233135 - [CR]2017.8.23[CR]- Added Preferred Playback Method and Stream Quality settings.[CR]2017.8.5[CR]- Fixed encoding error.[CR]2017.8.2[CR]- Fixed paid subscription channels and dvr control.[CR]2017.7.31[CR]- Fixed login issues.[CR]- Added fallback token generation[CR]- Added initial support for uEPG module.[CR]2017.7.26[CR]- Corrected version format.[CR]- Changed "Featured" and "Guide" click behavior.[CR]- Improved Error handling.[CR]2017.4.7a[CR]- Added "Featured"[CR]- Fixed DVR support.2017.4.7[CR]-100% new code base, written from scratch for your enjoy!!, DVR Recording and Playback Untested. + [CR]2017.10.16[CR]- Added OnDemand (Preview).[CR]- Added Highlights.[CR]- Added Search.[CR]- Improved UI.[CR]- Added EPG Guide w/DVR context menu.[CR]- Misc. Tweaks and Corrections.[CR]2017.8.23[CR]- Added Preferred Playback Method and Stream Quality settings.[CR]2017.8.5[CR]- Fixed encoding error.[CR]2017.8.2[CR]- Fixed paid subscription channels and dvr control.[CR]2017.7.31[CR]- Fixed login issues.[CR]- Added fallback token generation[CR]- Added initial support for uEPG module.[CR]2017.7.26[CR]- Corrected version format.[CR]- Changed "Featured" and "Guide" click behavior.[CR]- Improved Error handling.[CR]2017.4.7a[CR]- Added "Featured"[CR]- Fixed DVR support.2017.4.7[CR]-100% new code base, written from scratch for your enjoy!!, DVR Recording and Playback Untested. resources/images/icon.png resources/images/fanart.jpg diff --git a/plugin.video.ustvnow/default.py b/plugin.video.ustvnow/default.py index aacf5f3..63f1603 100644 --- a/plugin.video.ustvnow/default.py +++ b/plugin.video.ustvnow/default.py @@ -17,691 +17,7 @@ # along with USTVnow. If not, see . # -*- coding: utf-8 -*- -import os, sys, datetime, re, traceback, HTMLParser, calendar -import urllib, urllib2, socket, json, collections, net, random -import xbmc, xbmcvfs, xbmcgui, xbmcplugin, xbmcaddon -from simplecache import SimpleCache -# Plugin Info -ADDON_ID = 'plugin.video.ustvnow' -REAL_SETTINGS = xbmcaddon.Addon(id=ADDON_ID) -ADDON_NAME = REAL_SETTINGS.getAddonInfo('name') -SETTINGS_LOC = REAL_SETTINGS.getAddonInfo('profile') -ADDON_PATH = REAL_SETTINGS.getAddonInfo('path').decode('utf-8') -ADDON_VERSION = REAL_SETTINGS.getAddonInfo('version') -ICON = REAL_SETTINGS.getAddonInfo('icon') -FANART = REAL_SETTINGS.getAddonInfo('fanart') -LANGUAGE = REAL_SETTINGS.getLocalizedString - -## GLOBALS ## -TIMEOUT = 30 -USER_EMAIL = REAL_SETTINGS.getSetting('User_Email') -PASSWORD = REAL_SETTINGS.getSetting('User_Password') -LAST_TOKEN = REAL_SETTINGS.getSetting('User_Token') -LAST_PASSKEY = REAL_SETTINGS.getSetting('User_Paskey') -DEBUG = REAL_SETTINGS.getSetting('Enable_Debugging') == 'true' -PTVL_RUN = xbmcgui.Window(10000).getProperty('PseudoTVRunning') == 'True' -BASEURL = 'https://m-api.ustvnow.com/' -BASEWEB = 'https://watch.ustvnow.com/' -BASEMOB = 'http://mc.ustvnow.com/' -IMG_PATH = os.path.join(ADDON_PATH,'resources','images') -IMG_HTTP = BASEMOB + 'gtv/1/live/viewposter?srsid=' -IMG_MOVIE = 'http://tvdata.ustvnow.com/movieposters/' -IMG_TV = 'http://tvdata.ustvnow.com/tvbanners/' -IMG_POSTER = 'http://m.poster.static-ustvnow.com/' -IMG_POSTER_RE= 'http://m.reimages.static-ustvnow.com/' -IMG_SNAPSHOT = 'http://m.snapshot.static-ustvnow.com/%s/high' -IMG_CHLOGO = 'http://m.ustvnow.com/images/%s.png' -COOKIE_JAR = xbmc.translatePath(os.path.join(SETTINGS_LOC, "cookiejar.lwp")) -MEDIA_TYPES = {'SP':'video','SH':'episode','EP':'episode','MV':'movie'} -FREE_CHANS = ['CW','ABC','FOX','PBS','CBS','NBC','MY9'] -URL_TYPE = {0:'m3u8',1:'mp4'}[int(REAL_SETTINGS.getSetting('URL_Type'))] -URL_QUALITY = int(REAL_SETTINGS.getSetting('URL_Quality')) + 1 -CHAN_NAMES = {'ABC':'ABC','AMC':'AMC','Animal Planet':'Animal Planet','Bravo':'Bravo','CBS':'CBS','CNBC':'CNBC','CW':'CW','Comedy Central':'Comedy Central','Discovery Channel':'Discovery Channel','ESPN':'ESPN', - 'FOX':'FOX','FX':'FX','Fox News Channel':'Fox News','Freeform':'Freeform','MSNBC':'MSNBC','NBC':'NBC','National Geographic Channel':'National Geographic','Nickelodeon':'Nickelodeon','PBS':'PBS', - 'SPIKE TV':'SPIKE TV','SundanceTV':'SundanceTV','Syfy':'Syfy','AE':'A&E','My9':'MY9','BBCA':'BBC America','ESPN2':'ESPN 2','NBCSNHD':'NBCSN','The Learning Channel':'TLC','Universal HD':'Universal', - 'USA':'USA Network','SUNDHD':'SundanceTV'} - -USTVNOW_MENU = [("Live" , '', 0), - ("Schedules" , '', 1), - ("Recordings", '', 2), - ("Guide" , '', 3), - ("Featured" , '', 5)] - -if xbmc.getCondVisibility('System.HasAddon(script.module.uepg)') == 1: - USTVNOW_MENU.append(("uEPG Guide", '', 20)) - -uEPG_PARAMS = {"stream_code":"studio","description":"plot","synopsis":"plotoutline","ut_start":"starttime","orig_air_date":"firstaired"} -FILE_PARAMS = ["title", "artist", "albumartist", "genre", "year", "rating", "album", "track", "duration", "comment", "lyrics", "musicbrainztrackid", "musicbrainzartistid", "musicbrainzalbumid", "musicbrainzalbumartistid", "playcount", "fanart", "director", "trailer", "tagline", "plot", "plotoutline", "originaltitle", "lastplayed", "writer", "studio", "mpaa", "cast", "country", "imdbnumber", "premiered", "productioncode", "runtime", "set", "showlink", "streamdetails", "top250", "votes", "firstaired", "season", "episode", "showtitle", "thumbnail", "file", "resume", "artistid", "albumid", "tvshowid", "setid", "watchedepisodes", "disc", "tag", "art", "genreid", "displayartist", "albumartistid", "description", "theme", "mood", "style", "albumlabel", "sorttitle", "episodeguide", "uniqueid", "dateadded", "size", "lastmodified", "mimetype", "specialsortseason", "specialsortepisode"] -PVR_PARAMS = ["title","plot","plotoutline","starttime","endtime","runtime","progress","progresspercentage","genre","episodename","episodenum","episodepart","firstaired","hastimer","isactive","parentalrating","wasactive","thumbnail","rating","originaltitle","cast","director","writer","year","imdbnumber","hastimerrule","hasrecording","recording","isseries"] -ART_PARAMS = ["thumb","poster","fanart","banner","landscape","clearart","clearlogo"] - - -def uni(string, encoding = 'utf-8'): - if isinstance(string, basestring): - if not isinstance(string, unicode): - string = unicode(string, encoding) - elif isinstance(string, unicode): - string = string.encode('ascii', 'replace') - return string - -def unescape(string): - try: - parser = HTMLParser.HTMLParser() - return (parser.unescape(string)) - except: - return string - -def log(msg, level=xbmc.LOGDEBUG): - msg = msg.encode("utf-8") - if DEBUG == True: - if level == xbmc.LOGERROR: - msg += ' ,' + traceback.format_exc() - xbmc.log(ADDON_ID + '-' + ADDON_VERSION + '-' + msg, level) - -def inputDialog(heading=ADDON_NAME, default='', key=xbmcgui.INPUT_ALPHANUM, opt=0, close=0): - retval = xbmcgui.Dialog().input(heading, default, key, opt, close) - if len(retval) > 0: - return retval - -def okDialog(str1, str2='', str3='', header=ADDON_NAME): - xbmcgui.Dialog().ok(header, str1, str2, str3) - -def yesnoDialog(str1, str2='', str3='', header=ADDON_NAME, yes='', no='', autoclose=0): - return xbmcgui.Dialog().yesno(header, str1, str2, str3, no, yes, autoclose) - -def getParams(): - param=[] - if len(sys.argv[2])>=2: - params=sys.argv[2] - cleanedparams=params.replace('?','') - if (params[len(params)-1]=='/'): - params=params[0:len(params)-2] - pairsofparams=cleanedparams.split('&') - param={} - for i in range(len(pairsofparams)): - splitparams={} - splitparams=pairsofparams[i].split('=') - if (len(splitparams))==2: - param[splitparams[0]]=splitparams[1] - return param - -socket.setdefaulttimeout(TIMEOUT) -class USTVnow(): - def __init__(self): - log('__init__') - self.net = net.Net() - self.cache = SimpleCache() - if self.login(USER_EMAIL, PASSWORD) == False: - raise SystemExit - - - def mainMenu(self): - log('mainMenu') - for item in USTVNOW_MENU: - self.addDir(*item) - - - def buildHeader(self): - header_dict = {} - header_dict['Accept'] = 'application/json, text/javascript, */*; q=0.01' - header_dict['Host'] = 'm-api.ustvnow.com' - header_dict['Connection'] = 'keep-alive' - header_dict['Referer'] = 'http://watch.ustvnow.com' - header_dict['Origin'] = 'http://watch.ustvnow.com' - header_dict['User-Agent'] = 'Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.127 Large Screen Safari/533.4 GoogleTV/162671' - return header_dict - - - def login(self, user, password): - log('login') - if len(user) > 0: - try: - #remove COOKIE_JAR Folder - xbmcvfs.rmdir(COOKIE_JAR) - except: - pass - - if xbmcvfs.exists(COOKIE_JAR) == False: - try: - xbmcvfs.mkdirs(SETTINGS_LOC) - f = xbmcvfs.File(COOKIE_JAR, 'w') - f.close() - except: - log('login, Unable to create the storage directory', xbmc.LOGERROR) - header_dict = self.buildHeader() - self.net.set_cookies(COOKIE_JAR) - - try: - #check token - dvrlink = None - custlink = json.loads(self.net.http_POST(BASEURL + 'gtv/1/live/getcustomerkey', form_data={'token':LAST_TOKEN}, headers=header_dict).content.encode("utf-8").rstrip()) - '''{u'username': u'', u'ip': u'', u'customerkey': u''}''' - self.custkey = (custlink.get('customerkey','') or 0) - if custlink and 'username' in custlink and user.lower() == custlink['username'].lower(): - log('login, using existing token, passkey') - self.token = LAST_TOKEN - self.passkey = LAST_PASSKEY - else: - #login - loginlink = json.loads(self.net.http_POST(BASEURL + 'gtv/1/live/login', form_data={'username':user,'password':password,'device':'gtv','redir':'0'}, headers=header_dict).content.encode("utf-8").rstrip()) - '''{u'token': u'', u'result': u'success'}''' - if loginlink and 'token' in loginlink and loginlink['result'].lower() == 'success': - log('login, creating new token') - self.token = loginlink['token'] - REAL_SETTINGS.setSetting('User_Token',self.token) - - #passkey - dvrlink = json.loads(self.net.http_POST(BASEURL + 'gtv/1/live/viewdvrlist', form_data={'token':self.token}, headers=header_dict).content.encode("utf-8").rstrip()) - '''{u'globalparams': {u'passkey': u''}, u'results': []}''' - if dvrlink and 'globalparams' in dvrlink: - log('login, creating new passkey') - self.passkey = dvrlink['globalparams']['passkey'] - REAL_SETTINGS.setSetting('User_Paskey',self.passkey) - else: - raise Exception - - #check user credentials - userlink = json.loads(self.net.http_POST(BASEURL + 'gtv/1/live/getuserbytoken', form_data={'token':self.token}, headers=header_dict).content.encode("utf-8").rstrip()) - '''{u'status': u'success', u'data': {u'username': u'', u'need_account_activation': False, u'plan_id': 1, u'language': u'en', u'plan_free': 1, u'sub_id': u'7', u'lname': u'', u'currency': u'USD', u'points': 1, u'need_account_renew': False, u'fname': u'', u'plan_name': u'Free Plan'}}''' - log('login, checking user account') - if userlink and 'data' in userlink and userlink['status'].lower() == 'success': - REAL_SETTINGS.setSetting('User_Plan' ,userlink['data']['plan_name']) - expires = 'Never' if userlink['data']['plan_name'] == 'Free Plan' else '' - REAL_SETTINGS.setSetting('User_Expires' ,'%s'%expires) - REAL_SETTINGS.setSetting('User_isFree' ,str(userlink['data']['plan_name'] == 'Free Plan')) - dvrPlan = 2 if 'dvr' in (userlink['data']['plan_name']).lower() else None - REAL_SETTINGS.setSetting('User_DVRpoints' ,str(dvrPlan or userlink['data']['points'] or 0)) - xbmcgui.Dialog().notification(ADDON_NAME, LANGUAGE(30006) + userlink['data']['fname'], ICON, 4000) - - if userlink['data']['need_account_renew'] == True: - xbmcgui.Dialog().notification(ADDON_NAME, LANGUAGE(30016) + userlink['data']['fname'], ICON, 4000) - elif userlink['data']['need_account_activation'] == True: - xbmcgui.Dialog().notification(ADDON_NAME, LANGUAGE(30022) + userlink['data']['fname'], ICON, 4000) - else: - if REAL_SETTINGS.getSetting('User_DVRpoints') != REAL_SETTINGS.getSetting('Last_DVRpoints'): - REAL_SETTINGS.setSetting('Last_DVRpoints',REAL_SETTINGS.getSetting('User_DVRpoints')) - xbmcgui.Dialog().notification(ADDON_NAME, LANGUAGE(30021) + userlink['data']['fname'], ICON, 4000) - - #check subscription - try: - #error prone, isolate and debug. - sublink = json.loads(self.net.http_POST(BASEURL + 'gtv/1/live/getaccountsubscription', form_data={'username':user,'customerkey':self.custkey}, headers=header_dict).content.encode("utf-8").rstrip()) - '''{u'username': u'', u'billingDatetime': u'', u'currency': u'USD', u'cgaccountstatusreason': u'', u'invoicehistory': u'', u'ocaccountstatus': u'Account active', u'ccLastFour': u'', u'lname': u'', u'x-cg-acnt-USD': False, u'fname': u'', u'sub_info': {u'cost': 0, u'plan': {u'sub_group': 4, u'plan_id': 1, u'name': u'Free Plan', u'language': u'en', u'date_expire': u'0000-00-00', u'sub_id': 7, u'price': 0, u'currency': u'USD', u'plan_code': u'7_FREETRIAL', - u'details': u'This plan lets you receive all major US terrestrial stations (ABC, CBS, CW, FOX, NBC, PBS). You can later upgrade to a paid plan with more channels and DVR.'}, u'packages': []}, u'pendinginvoices': u'', u'cgbillingstatus': u'', u'dvrpoints': 1, u'plans': {u'10': {u'price': 15, u'name': u'1 Week All Channel Plan $15 ($2.14/day)', - u'details': u'1 Week pass for all channels (No DVR)'}, u'23': {u'price': 19, u'name': u'All Channel Promo Plan $19/mo first 3 months', - u'details': u'Monthly subscription for all channels. This promotional price is for the first three months after which it will renew at $29. This plan automatically renews each month but you can cancel anytime and will not be billed again when your current 30 day period has expired. '}, u'31': {u'price': 29, u'name': u'All Channel Promo Plan w/DVR $29/mo first 3 months', - u'details': u'Monthly subscription for all channels. This promotional price is for the first three months after which it will renew at $39. This plan automatically renews each month but you can cancel anytime and will not be billed again when your current 30 day period has expired.'}, u'7': {u'price': 0, u'name': u'Free Plan', - u'details': u'This plan lets you receive all major US terrestrial stations (ABC, CBS, CW, FOX, NBC, PBS). You can later upgrade to a paid plan with more channels and DVR.'}, u'9': {u'price': 0.00, u'name': u'3 Day All Channel Plan $6.99 ($2.33/day)', - u'details': u'3 Day pass for all channels (No DVR)'}, u'8': {u'price': 2.99, u'name': u'1 Day All Channel Plan $2.99', - u'details': u'24 hour pass for all channels (No DVR)'}}, u'cgredirectUrl': u'', u'cgaccountstatus': False, u'isfacebookuser': False, u'cgkey': u'', u'ocaccountstatuscode': 0, u'packages': [], u'subscription': u'Free Plan', u'language': u'en', u'sub_id': u'7', u'dateopened': u'December 01, 2000', u'canceledDatetime': u'', u'cgbillingmethod': u''}''' - if sublink: - REAL_SETTINGS.setSetting('User_Expires' ,'%s'%(sublink['sub_info']['date_expire'])) - except: - pass - else: - raise Exception - self.net.save_cookies(COOKIE_JAR) - - self.channels = channels = self.cache.get(ADDON_NAME + '.channelguide') - if not self.channels: - log('login, refreshing channels') - channels = sorted(json.loads(self.net.http_POST(BASEURL + 'gtv/1/live/channelguide', form_data={'token':self.token}, headers=header_dict).content.encode("utf-8").rstrip())['results'], key=lambda x: x['displayorder']) - '''{u'app_name': u'preview', u'stream': u'00000WXYZustvnow', u'af': u'US', u'dvraction': u'add', u'callsign': u'WHTM', u'event_inprogress': 1, - u'srsid': 3560383, u'guideremainingtime': 3660, u'scheduleid': 9952642, u'favoriteaction': u'remove', u'event_time': u'00:00:00',u'title': u'Shark Tank', - u'timemark': 1498867200, u'recordedon': u'June 30, 2017 20:00', u'prg_img': u'h3/NowShowing/9977826/p9977826_b1t_h3_aa.jpg', u'title_10': u'', - u'xcdrappname': u'livehd', u'event_date': u'2017-07-01', u'has_img': 1, u'stream_code': u'ABC', u'updated': u'2017-06-29 11:49:08', - u'description': u'Durable bags made out of the material that protects on the front lines of firefighting; a vibrating mat that helps calm babies; - an ointment made from essential oils; a natural snack made with acai.', u'actualremainingtime': 3281, u'content_allowed': False, - u'dvrtimeraction': u'add', u'mediatype': u'EP', u'auth': None, u'stream_origin': u'dne.ustvnow.com', u'dvrtimertype': 0, u'scode': u'whtm', - u'aksid': 1, u'guideheight': 120, u'orig_air_date': u'2017-02-10', u'prgsvcid': 11534, u'runtime': 3660, u'img': u'images/WHTM.png', - u'connectorid': u'SH011581290000', u'ut_start': 1498867200, u'streamname': u'00000WXYZustvnow', u'episode_title': u'', u'synopsis': - u'A vibrating mat that helps calm babies.', u't': 1, u'edgetypes': 7, u'imgmark': u'live', u'content_id': u'EP011581290171', u'order': 1, - u'displayorder': 1}''' - self.cache.set(ADDON_NAME + '.channelguide', channels, expiration=datetime.timedelta(minutes=5)) - self.channels = self.cache.get(ADDON_NAME + '.channelguide') - - self.upcoming = self.cache.get(ADDON_NAME + '.upcoming') - if not self.upcoming: - log('login, refreshing upcoming') - upcoming = json.loads(self.net.http_POST(BASEURL + 'gtv/1/live/upcoming', form_data={'token':self.token}, headers=header_dict).content.encode("utf-8").rstrip()) - '''{u'prgschid': 19479379, u'dvraction': u'add', u'callsign': u'AMC', u'newtimecat': True, u'srsid': 14930, u'timecat': u'Today', u'scheduleid': 9946282, - u'img': u'images/AMC.png', u'title': u'The Fugitive', u'prg_img': u'v5/NowShowing/14930/p14930_p_v5_aa.jpg', u'has_img': 1, u't': 0, u'sname': u'AMC', - u'description': u'U.S. marshal (Tommy Lee Jones) hunts doctor (Harrison Ford) for murder of his wife (Sela Ward).', u'dvrtimeraction': u'add', - u'auth': None, u'orig_air_date': None, u'dvrtimertype': 0, u'scode': u'amchd', u'prgsvcid': 10021, u'runtime': 10800, u'connectorid': u'MV000371790000', - u'episode_title': u'', u'synopsis': u'An innocent man must evade the law as he pursues a killer.', u'event_inprogress': 1, u'ut_start': 1499009400, - u'content_allowed': False, u'imgmark': u'live', u'content_id': u'MV000371790000', u'displayorder': 100}''' - self.cache.set(ADDON_NAME + '.upcoming', upcoming, expiration=datetime.timedelta(hours=6)) - self.upcoming = self.cache.get(ADDON_NAME + '.upcoming') - - self.recorded = self.cache.get(ADDON_NAME + '.recorded') - if not self.recorded: - log('login, refreshing recorded') - '''{u'fn1': u'20170702', u'episode_season': 0, u'filename_smil': u'20170702_213000_220000_utc_SH000000010000_11534_11534_ABC.smil', u'app_name': u'dvrrokuplay', - u'stream': u'2F1ECWHTMUSTVNOW', u'imgmark': u'rem', u'dvrtimeraction': u'add', u'mediatype': u'SH', u'orig_air_date': None, u'content_id': u'SH000000010000', - u'callsign': u'WHTM', u'ut_expires': 1500327000, u'filename_med': u'20170702_213000_220000_utc_SH000000010000_11534_11534_ABC_650.mp4', - u'filename_high': u'20170702_213000_220000_utc_SH000000010000_11534_11534_ABC_950.mp4', u'dvrlocation': u'dvr6', u'episode_number': 0, u'srsid': 459763, - u'runtime': 1800, u'description': u'Paid programming.', u'scheduleid': 9952747, u'has_img': 1, u'fn3': u'220000', u'fn2': u'213000', - u'event_time': u'21:30:00', u'title': u'Paid Programming', u'recordedonmmddyyyy': u'07/02/2017', u'connectorid': u'SH000000010000', - u'recordedon': u'July 2, 2017', u'prg_img': u'h3/NowShowing/459763/p459763_b_h3_ae.jpg', u'filename_low': u'20170702_213000_220000_utc_SH000000010000_11534_11534_ABC_350.mp4', - u'episode_title': u'', u'synopsis': u'Paid programming.', u'dvrtimertype': 0, u'content_allowed': True, u'xcdrappname': u'livehd', u'event_date': u'2017-07-02', - u'event_inprogress': 2, u'prgsvcid': 11534, u'ut_start': 1499031000, u'stream_code': u'ABC'}''' - if dvrlink: - recorded = dvrlink['results'] - else: - recorded = (json.loads(self.net.http_POST(BASEURL + 'gtv/1/live/viewdvrlist', form_data={'token':self.token}, headers=header_dict).content.encode("utf-8").rstrip()))['results'] - self.cache.set(ADDON_NAME + '.recorded', recorded, expiration=datetime.timedelta(minutes=1)) - self.recorded = self.cache.get(ADDON_NAME + '.recorded') - return True - except Exception,e: - log('login, Unable to login ' + str(e), xbmc.LOGERROR) - REAL_SETTINGS.setSetting('User_Token','') - REAL_SETTINGS.setSetting('User_Paskey','') - REAL_SETTINGS.setSetting('User_Activated',str(False)) - xbmcgui.Dialog().notification(ADDON_NAME, LANGUAGE(30007), ICON, 4000) - return False - else: - #firstrun wizard - if yesnoDialog(LANGUAGE(30008),no=LANGUAGE(30009), yes=LANGUAGE(30010)): - user = inputDialog(LANGUAGE(30001)) - password = inputDialog(LANGUAGE(30002),opt=xbmcgui.ALPHANUM_HIDE_INPUT) - REAL_SETTINGS.setSetting('User_Email' ,user) - REAL_SETTINGS.setSetting('User_Password',password) - return self.login(user, password) - else: - okDialog(LANGUAGE(30003)) - return False - - - def browseLive(self): - log('browseLive') - d = datetime.datetime.utcnow() - now = datetime.datetime.fromtimestamp(calendar.timegm(d.utctimetuple())) - isFree = REAL_SETTINGS.getSetting('User_isFree') == "True" - if self.channels is None: - xbmc.executebuiltin("Container.Refresh") - for channel in self.channels: - try: - name = CHAN_NAMES[channel['stream_code']] - if isFree == True and name not in FREE_CHANS: - continue - startime = datetime.datetime.fromtimestamp(channel['ut_start']) - endtime = startime + datetime.timedelta(seconds=channel['runtime']) - if endtime > now and startime <= now: - label, url, liz = self.buildChannelListItem(name, channel) - self.addLink(label, url, 9, liz, len(self.channels)) - except Exception,e: - log('browseLive, failed ' + str(e), xbmc.LOGERROR) - - - def browseRecordings(self, recorded=False): - log('browseRecordings') - d = datetime.datetime.utcnow() - now = datetime.datetime.fromtimestamp(calendar.timegm(d.utctimetuple())) - if self.recorded is None: - xbmc.executebuiltin("Container.Refresh") - for channel in self.recorded: - try: - startime = datetime.datetime.fromtimestamp(channel['ut_start']) - endtime = startime + datetime.timedelta(seconds=channel['runtime']) - if endtime > now and (startime <= now or startime > now) and recorded == True: - continue - elif endtime < now and (startime <= now or startime > now) and recorded == False: - continue - label, url, liz = self.buildRecordedListItem(CHAN_NAMES[channel['stream_code']]) - mode = 10 if recorded == True else 21 - if mode == 21: - liz.setProperty("IsPlayable","false") - self.addLink(label, url, mode, liz, len(self.recorded)) - except Exception,e: - log('browseRecordings, failed ' + str(e), xbmc.LOGERROR) - - - def browseGuide(self, name=None, upcoming=False): - log('browseGuide') - d = datetime.datetime.utcnow() - now = datetime.datetime.fromtimestamp(calendar.timegm(d.utctimetuple())) - isFree = REAL_SETTINGS.getSetting('User_isFree') == "True" - if self.channels is None: - xbmc.executebuiltin("Container.Refresh") - if name is None and upcoming == False: - collect = [] - for channel in self.channels: - try: - name = CHAN_NAMES[channel['stream_code']] - if isFree == True and name not in FREE_CHANS: - continue - collect.append(name) - except: - xbmc.executebuiltin("Container.Refresh") - counter = collections.Counter(collect) - for key, value in sorted(counter.iteritems()): - icon = (os.path.join(IMG_PATH,'logos','%s.png'%key) or ICON) - infoArt = {"thumb":icon,"poster":icon,"icon":icon,"fanart":FANART} - self.addDir("%s"%(key), key, 4, infoArt=infoArt) - else: - for channel in self.channels: - try: - if isFree == True and name not in FREE_CHANS: - continue - if name == CHAN_NAMES[channel['stream_code']]: - startime = datetime.datetime.fromtimestamp(channel['ut_start']) - endtime = startime + datetime.timedelta(seconds=channel['runtime']) - if endtime > now and (startime <= now): - label, url, liz = self.buildChannelListItem(name, channel) - self.addLink(label, url, 9, liz, len(self.channels)) - elif endtime > now and (startime <= now or startime > now): - label, url, liz = self.buildChannelListItem(name, channel) - mode = 9 if PTVL_RUN == True else 21 - if mode == 21: - liz.setProperty("IsPlayable","false") - self.addLink(label, url, mode, liz, len(self.channels)) - except Exception,e: - log('browseGuide, failed ' + str(e), xbmc.LOGERROR) - - - def browseFeatured(self): - log('browseFeatured') - d = datetime.datetime.utcnow() - now = datetime.datetime.fromtimestamp(calendar.timegm(d.utctimetuple())) - isFree = REAL_SETTINGS.getSetting('User_isFree') == "True" - if self.upcoming is None: - xbmc.executebuiltin("Container.Refresh") - for channel in self.upcoming: - try: - name = CHAN_NAMES[channel['sname']] - startime = datetime.datetime.fromtimestamp(channel['ut_start']) - endtime = startime + datetime.timedelta(seconds=channel['runtime']) - if endtime > now and (startime <= now or startime > now): - label, url, liz = self.buildChannelListItem(name, channel, feat=True) - liz.setProperty("IsPlayable","false") - self.addLink(label, url, 21, liz, len(self.upcoming)) - except Exception,e: - log('browseFeatured, failed ' + str(e), xbmc.LOGERROR) - - - def buildChannelListItem(self, name, channel=None, feat=False): - if channel is None: - for channel in self.channels: - if name == CHAN_NAMES[channel['stream_code']]: - break - startime = datetime.datetime.fromtimestamp(channel['ut_start']) - endtime = startime + datetime.timedelta(seconds=channel['runtime']) - title = unescape(channel['title']) - mediatype = (channel.get('mediatype','') or (channel.get('connectorid',''))[:2] or (channel.get('content_id',''))[:2] or 'SP') - mtype = MEDIA_TYPES[mediatype.upper()] - if PTVL_RUN == True: - label = name - elif feat == True: - label = '%s %s-%s: %s - %s'%(startime.strftime('%m/%d/%Y'),startime.strftime('%I:%M').lstrip('0'),endtime.strftime('%I:%M %p').lstrip('0'),name,title) - else: - label = '%s: %s - %s'%(startime.strftime('%I:%M %p').lstrip('0'),name,title) - label2 = '%s - %s'%(startime.strftime('%I:%M %p').lstrip('0'),endtime.strftime('%I:%M %p').lstrip('0')) - scode = (channel.get('stream_code','') or channel.get('sname','') or '') - url = CHAN_NAMES[scode] - liz = xbmcgui.ListItem(label) - infoList = {"mediatype":mtype,"label":label,"label2":label2,"title":label, - "studio":CHAN_NAMES[scode],"duration":channel['runtime'],"plotoutline":unescape(channel['synopsis']), - "plot":unescape(channel['description']),"aired":(channel['orig_air_date'] or startime.strftime('%Y-%m-%d'))} - - # if mediatype.startswith('MV'): - # poster = IMG_MOVIE+channel['prg_img'] - # elif mediatype.startswith(('SH','EP')): - # poster = IMG_TV+channel['prg_img'] - # else: - thumb = IMG_HTTP + str(channel['srsid']) + '&cs=' + channel['callsign'] + '&tid=' + mediatype - poster = (os.path.join(IMG_PATH,'%s.png'%name) or ICON) - liz.setInfo(type="Video", infoLabels=infoList) - liz.setArt({"thumb":thumb,"poster":poster,"fanart":FANART}) - liz.setProperty("IsPlayable","true") - liz.setProperty("IsInternetStream","true") - if channel['dvrtimeraction'] == 'add': - opt = '@'.join([str(channel['prgsvcid']),(channel.get('event_time','') or str(channel.get('ut_start','')))])#lazy solution rather then create additional url parameters for this single function. - contextMenu = [('Set single recording' ,'XBMC.RunPlugin(%s)'%(sys.argv[0]+"?url="+urllib.quote_plus(str(channel['scheduleid']))+"&mode="+str(6)+"&name="+urllib.quote_plus(opt))), - ('Set recurring recording','XBMC.RunPlugin(%s)'%(sys.argv[0]+"?url="+urllib.quote_plus(str(channel['connectorid']))+"&mode="+str(7)+"&name="+urllib.quote_plus(opt)))] - else: - contextMenu = [('Remove recording','XBMC.RunPlugin(%s)'%(sys.argv[0]+"?url="+urllib.quote_plus(str(channel['scheduleid']))+"&mode="+str(8)+"&name="+urllib.quote_plus(name)))] - liz.addContextMenuItems(contextMenu) - log('buildChannelListItem, label = ' + label + ', url = ' + url) - return label, url, liz - - - def buildRecordedListItem(self, name): - for channel in self.recorded: - if name == CHAN_NAMES[channel['stream_code']] or name == str(channel['scheduleid']): - startime = datetime.datetime.fromtimestamp(channel['ut_start']) - endtime = startime + datetime.timedelta(seconds=channel['runtime']) - title = unescape(channel['title']) - label = '%s %s-%s: %s - %s'%(startime.strftime('%m/%d/%Y'),startime.strftime('%I:%M').lstrip('0'),endtime.strftime('%I:%M %p').lstrip('0'),name,title) - label2 = '%s %s-%s'%(startime.strftime('%m/%d/%Y'),startime.strftime('%I:%M').lstrip('0'),endtime.strftime('%I:%M %p').lstrip('0')) - url = str(channel['scheduleid']) - liz = xbmcgui.ListItem(label) - mediatype = (channel.get('mediatype','') or (channel.get('connectorid',''))[:2] or (channel.get('content_id',''))[:2] or 'SP') - mtype = MEDIA_TYPES[mediatype.upper()] - infoList = {"mediatype":mtype,"label":label,"label2":label2,"title":label,"studio":CHAN_NAMES[channel['stream_code']], - "duration":channel['runtime'],"plotoutline":unescape(channel['synopsis']),"plot":unescape(channel['description']), - "aired":(channel['orig_air_date'] or startime.strftime('%Y-%m-%d'))} - # if mediatype.startswith('MV'): - # poster = IMG_MOVIE+channel['prg_img'] - # elif mediatype.startswith(('SH','EP')): - # poster = IMG_TV+channel['prg_img'] - # else: - thumb = IMG_HTTP + str(channel['srsid']) + '&cs=' + channel['callsign'] + '&tid=' + mediatype - poster = (os.path.join(IMG_PATH,'%s.png'%name) or ICON) - liz.setInfo(type="Video", infoLabels=infoList) - liz.setArt({"thumb":thumb,"poster":poster,"fanart":FANART}) - liz.setProperty("IsPlayable","true") - liz.setProperty("IsInternetStream","true") - print channel['dvrtimeraction'] - if channel['dvrtimeraction'] == 'add': - opt = '@'.join([str(channel['prgsvcid']),channel['event_time']])#lazy solution rather then create additional url parameters for this single function. - contextMenu = [('Set single recording' ,'XBMC.RunPlugin(%s)'%(sys.argv[0]+"?url="+urllib.quote_plus(str(channel['scheduleid']))+"&mode="+str(6)+"&name="+urllib.quote_plus(opt))), - ('Set recurring recording','XBMC.RunPlugin(%s)'%(sys.argv[0]+"?url="+urllib.quote_plus(str(channel['connectorid']))+"&mode="+str(7)+"&name="+urllib.quote_plus(opt)))] - contextMenu.extend([('Remove recording','XBMC.RunPlugin(%s)'%(sys.argv[0]+"?url="+urllib.quote_plus(str(channel['scheduleid']))+"&mode="+str(8)+"&name="+urllib.quote_plus(name)))]) - liz.addContextMenuItems(contextMenu) - log('buildRecordedListItem, label = ' + label + ', url = ' + url) - return label, url, liz - - - def resolveURL(self, url, dvr=False): - log('resolveURL, url = ' + url + ', dvr = ' + str(dvr)) - isFree = REAL_SETTINGS.getSetting('User_isFree') == "True" - if dvr: - for channel in self.recorded: - if url == str(channel['scheduleid']): - try: - urllink = json.loads(self.net.http_POST(BASEURL + 'stream/1/dvr/play', form_data={'token':self.token,'key':self.passkey,'scheduleid':channel['scheduleid']}, headers=self.buildHeader()).content.encode("utf-8").rstrip()) - '''{u'pr': u'll', u'domain': u'ilvc02.ll.ustvnow.com',u'stream': u'http://ilvc02.ll.ustvnow.com/ilv10/pr/xxl/smil:0B64AWHTMUSTVNOW/playlist.m3u8?', - u'streamname': u'0B64AWHTMUSTVNOW', u'tr': u'', u'up': 1, u'pd': 0, u'pl': u'vjs'}''' - if URL_TYPE == 'm3u8': - stream = urllink['stream'] - else: - stream = (urllink['stream'].replace('smil:','mp4:').replace('USTVNOW','USTVNOW%d'%URL_QUALITY)) - log('resolveURL, url = ' + stream) - return stream - except Exception,e: - if channel and channel['scheduleid']: - self.replaceToken(url, dvr) - else: - for channel in self.channels: - if url == CHAN_NAMES[channel['stream_code']]: - try: - urllink = json.loads(self.net.http_POST(BASEURL + 'stream/1/live/view', form_data={'token':self.token,'key':self.passkey,'scode':channel['scode']}, headers=self.buildHeader()).content.encode("utf-8").rstrip()) - '''{u'pr': u'll', u'domain': u'ilvc02.ll.ustvnow.com',u'stream': u'http://ilvc02.ll.ustvnow.com/ilv10/pr/xxl/smil:0B64AWHTMUSTVNOW/playlist.m3u8?', - u'streamname': u'0B64AWHTMUSTVNOW', u'tr': u'', u'up': 1, u'pd': 0, u'pl': u'vjs'}''' - if URL_TYPE == 'm3u8': - stream = urllink['stream'] - else: - stream = (urllink['stream'].replace('smil:','mp4:').replace('USTVNOW','USTVNOW%d'%URL_QUALITY)) - log('resolveURL, stream = ' + stream) - return stream - except Exception,e: - if channel and channel['scode']: - self.replaceToken(url, dvr) - - - def replaceToken(self, url, dvr): - #generate alternative token using website endpoint rather then googletv. - try: - #get CSRF Token - responce = urllib2.urlopen(BASEWEB + "account/signin").read() - CSRF = re.findall(r'var csrf_value = "(.*?)"', responce, re.DOTALL)[0] - #get WEB Token - responce = (self.net.http_POST(BASEWEB + 'account/login', form_data={'csrf_ustvnow': CSRF, 'signin_email': USER_EMAIL, 'signin_password':PASSWORD, 'signin_remember':'1'}).content.encode("utf-8").rstrip()) - altToken = re.findall(r'var token(.*?)= "(.*?)";', responce, re.DOTALL)[0][1] - if altToken and altToken != 'null': - self.token = altToken - log('replaceToken, replacing existing token') - REAL_SETTINGS.setSetting('User_Token',altToken) - self.resolveURL(url, dvr) - except Exception,e: - log('replaceToken, Unable to login ' + str(e), xbmc.LOGERROR) - xbmcgui.Dialog().notification(ADDON_NAME, LANGUAGE(30005), ICON, 4000) - raise SystemExit - - - def setRecording(self, name, url, remove=False, recurring=False): - log('setRecording, name = ' + name + ', url = ' + url + ', remove = ' + str(remove)) - if remove == True: - setlink = (self.net.http_POST(BASEURL + 'gtv/1/dvr/updatedvr', form_data={'scheduleid':url,'token':self.token,'action':'remove'}, headers=self.buildHeader()).content.encode("utf-8").rstrip()) - else: - if int(REAL_SETTINGS.getSetting('User_DVRpoints')) <= 1: - xbmcgui.Dialog().notification(ADDON_NAME, LANGUAGE(30019), ICON, 4000) - return - opt = name.split('@')#lazy solution rather then create additional url parameters for this single function. - if recurring == True: - setlink = (self.net.http_POST(BASEURL + 'gtv/1/dvr/updatedvrtimer', form_data={'connectorid':url,'prgsvcid':opt[0],'eventtime':opt[1],'token':self.token,'action':'add'}, headers=self.buildHeader()).content.encode("utf-8").rstrip()) - else: - setlink = (self.net.http_POST(BASEURL + 'gtv/1/dvr/updatedvr' , form_data={'scheduleid':url,'token':self.token,'action':'add'}, headers=self.buildHeader()).content.encode("utf-8").rstrip()) - '''failureadd''' - action = re.findall(r'(.*?)', setlink, re.DOTALL)[0] - status = re.findall(r'(.*?)', setlink, re.DOTALL)[0] - log('setRecording, action = ' + action + ', status = ' + status) - if status == 'failure': - xbmcgui.Dialog().notification(ADDON_NAME, LANGUAGE(30023)%action.title(), ICON, 4000) - return - xbmcgui.Dialog().notification(ADDON_NAME, LANGUAGE(30024)%action.title(), ICON, 4000) - xbmc.executebuiltin("Container.Refresh") - - - def playVideo(self, url, dvr=False): - log('playVideo, url = ' + url + ', dvr = ' + str(dvr)) - if dvr: - label, path, liz = self.buildRecordedListItem(url) - else: - label, path, liz = self.buildChannelListItem(url) - liz.setPath(self.resolveURL(url,dvr)) - xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, liz) - - - def addLink(self, name, u, mode, liz, total=0): - log('addLink, name = ' + name) - u=sys.argv[0]+"?url="+urllib.quote_plus(u)+"&mode="+str(mode)+"&name="+urllib.quote_plus(uni(name)) - xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=liz,totalItems=total) - - - def addDir(self, name, u, mode, infoList=False, infoArt=False): - log('addDir, name = ' + name) - liz=xbmcgui.ListItem(name) - liz.setProperty('IsPlayable', 'false') - if infoList == False: - liz.setInfo(type="Video", infoLabels={"mediatype":"video","label":name,"title":name} ) - else: - liz.setInfo(type="Video", infoLabels=infoList) - if infoArt == False: - liz.setArt({'thumb':ICON,'fanart':FANART}) - else: - liz.setArt(infoArt) - u=sys.argv[0]+"?url="+urllib.quote_plus(u)+"&mode="+str(mode)+"&name="+urllib.quote_plus(uni(name)) - xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=liz,isFolder=True) - - - def uEPG(self): - log('uEPG') - #support for upcoming uEPG universal epg framework module, module will be available from the Kodi repository. - #https://github.com/Lunatixz/XBMC_Addons/tree/master/script.module.uepg - isFree = REAL_SETTINGS.getSetting('User_isFree') == "True" - collect = [] - for channel in self.channels: - try: - name = CHAN_NAMES[channel['stream_code']] - if isFree == True and name not in FREE_CHANS: - continue - collect.append(name) - except: - xbmc.executebuiltin("Container.Refresh") - - channelNum = 0 - channelList = [] - counter = collections.Counter(collect) - for key, value in sorted(counter.iteritems()): - guidedata = [] - newChannel = {} - channelName = key - channelNum = channelNum + 1 - newChannel['channelname'] = channelName - newChannel['channelnumber'] = channelNum - for channel in self.channels: - try: - name = CHAN_NAMES[channel['stream_code']] - if isFree == True and name not in FREE_CHANS: - continue - if name == channelName: - tmpdata = {} - mediatype = (channel.get('mediatype','') or (channel.get('connectorid',''))[:2] or (channel.get('content_id',''))[:2] or 'SP') - mtype = MEDIA_TYPES[mediatype.upper()] - thumb = IMG_HTTP + str(channel['srsid']) + '&cs=' + channel['callsign'] + '&tid=' + mediatype - logo = (os.path.join(IMG_PATH,'%s.png'%name) or ICON) - - for key, value in channel.iteritems(): - try: - tmpdata[uEPG_PARAMS[key]] = unescape(value) - except: - if key in FILE_PARAMS + PVR_PARAMS: - tmpdata[key] = unescape(value) - tmpdata['art'] = {"thumb":thumb,"logo":logo} - tmpdata['mediatype'] = mtype - tmpdata['url'] = sys.argv[0]+'?mode=9&name=%s'%name - guidedata.append(tmpdata) - except: - pass - newChannel['guidedata'] = guidedata - channelList.append(newChannel) - return channelList - -params=getParams() -try: - url=urllib.unquote_plus(params["url"]) -except: - url=None -try: - name=urllib.unquote_plus(params["name"]) -except: - name=None -try: - mode=int(params["mode"]) -except: - mode=None - -log("Mode: "+str(mode)) -log("URL : "+str(url)) -log("Name: "+str(name)) - -if mode==None: USTVnow().mainMenu() -elif mode == 0: USTVnow().browseLive() -elif mode == 1: USTVnow().browseRecordings() -elif mode == 2: USTVnow().browseRecordings(recorded=True) -elif mode == 3: USTVnow().browseGuide() -elif mode == 4: USTVnow().browseGuide(name) -elif mode == 5: USTVnow().browseFeatured() -elif mode == 6: USTVnow().setRecording(name,url) -elif mode == 7: USTVnow().setRecording(name,url,recurring=True) -elif mode == 8: USTVnow().setRecording(name,url,remove=True) -elif mode == 9: USTVnow().playVideo(url) -elif mode == 10:USTVnow().playVideo(url,dvr=True) -elif mode == 20:xbmc.executebuiltin("RunScript(script.module.uepg,json=%s&refresh_path=%s&refresh_interval=%s)"%(urllib.quote_plus(json.dumps(USTVnow().uEPG())),urllib.quote_plus(json.dumps(sys.argv[0]+"?mode=20")),urllib.quote_plus(json.dumps("hours=2")))) -elif mode == 21:xbmc.executebuiltin("action(ContextMenu)") - -xbmcplugin.addSortMethod(int(sys.argv[1]) , xbmcplugin.SORT_METHOD_NONE ) -xbmcplugin.addSortMethod(int(sys.argv[1]) , xbmcplugin.SORT_METHOD_LABEL ) -xbmcplugin.endOfDirectory(int(sys.argv[1]), cacheToDisc=True) \ No newline at end of file +#entrypoint +if __name__ == '__main__': + from resources.lib import ustvnow \ No newline at end of file diff --git a/plugin.video.ustvnow/net.py b/plugin.video.ustvnow/net.py deleted file mode 100644 index 769881c..0000000 --- a/plugin.video.ustvnow/net.py +++ /dev/null @@ -1,328 +0,0 @@ -''' - common XBMC Module - Copyright (C) 2011 t0mm0 - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -''' - -import cookielib -import gzip -import re -import StringIO -import urllib -import urllib2 -import socket - -#Set Global timeout - Useful for slow connections and Putlocker. -socket.setdefaulttimeout(30) - -class HeadRequest(urllib2.Request): - '''A Request class that sends HEAD requests''' - def get_method(self): - return 'HEAD' - -class Net: - ''' - This class wraps :mod:`urllib2` and provides an easy way to make http - requests while taking care of cookies, proxies, gzip compression and - character encoding. - - Example:: - - from t0mm0.common.net import Net - net = Net() - response = net.http_GET('http://xbmc.org') - print response.content - ''' - - _cj = cookielib.LWPCookieJar() - _proxy = None - _user_agent = 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.1 ' + \ - '(KHTML, like Gecko) Chrome/13.0.782.99 Safari/535.1' - _http_debug = False - - - def __init__(self, cookie_file='', proxy='', user_agent='', - http_debug=False): - ''' - Kwargs: - cookie_file (str): Full path to a file to be used to load and save - cookies to. - - proxy (str): Proxy setting (eg. - ``'http://user:pass@example.com:1234'``) - - user_agent (str): String to use as the User Agent header. If not - supplied the class will use a default user agent (chrome) - - http_debug (bool): Set ``True`` to have HTTP header info written to - the XBMC log for all requests. - ''' - if cookie_file: - self.set_cookies(cookie_file) - if proxy: - self.set_proxy(proxy) - if user_agent: - self.set_user_agent(user_agent) - self._http_debug = http_debug - self._update_opener() - - - def set_cookies(self, cookie_file): - ''' - Set the cookie file and try to load cookies from it if it exists. - - Args: - cookie_file (str): Full path to a file to be used to load and save - cookies to. - ''' - try: - self._cj.load(cookie_file, ignore_discard=True) - self._update_opener() - return True - except: - return False - - - def get_cookies(self): - '''Returns A dictionary containing all cookie information by domain.''' - return self._cj._cookies - - - def save_cookies(self, cookie_file): - ''' - Saves cookies to a file. - - Args: - cookie_file (str): Full path to a file to save cookies to. - ''' - self._cj.save(cookie_file, ignore_discard=True) - - - def set_proxy(self, proxy): - ''' - Args: - proxy (str): Proxy setting (eg. - ``'http://user:pass@example.com:1234'``) - ''' - self._proxy = proxy - self._update_opener() - - - def get_proxy(self): - '''Returns string containing proxy details.''' - return self._proxy - - - def set_user_agent(self, user_agent): - ''' - Args: - user_agent (str): String to use as the User Agent header. - ''' - self._user_agent = user_agent - - - def get_user_agent(self): - '''Returns user agent string.''' - return self._user_agent - - - def _update_opener(self): - ''' - Builds and installs a new opener to be used by all future calls to - :func:`urllib2.urlopen`. - ''' - if self._http_debug: - http = urllib2.HTTPHandler(debuglevel=1) - else: - http = urllib2.HTTPHandler() - - if self._proxy: - opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(self._cj), - urllib2.ProxyHandler({'http': - self._proxy}), - urllib2.HTTPBasicAuthHandler(), - http) - - else: - opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(self._cj), - urllib2.HTTPBasicAuthHandler(), - http) - urllib2.install_opener(opener) - - - def http_GET(self, url, headers={}, compression=True): - ''' - Perform an HTTP GET request. - - Args: - url (str): The URL to GET. - - Kwargs: - headers (dict): A dictionary describing any headers you would like - to add to the request. (eg. ``{'X-Test': 'testing'}``) - - compression (bool): If ``True`` (default), try to use gzip - compression. - - Returns: - An :class:`HttpResponse` object containing headers and other - meta-information about the page and the page content. - ''' - return self._fetch(url, headers=headers, compression=compression) - - - def http_POST(self, url, form_data, headers={}, compression=True): - ''' - Perform an HTTP POST request. - - Args: - url (str): The URL to POST. - - form_data (dict): A dictionary of form data to POST. - - Kwargs: - headers (dict): A dictionary describing any headers you would like - to add to the request. (eg. ``{'X-Test': 'testing'}``) - - compression (bool): If ``True`` (default), try to use gzip - compression. - - Returns: - An :class:`HttpResponse` object containing headers and other - meta-information about the page and the page content. - ''' - return self._fetch(url, form_data, headers=headers, - compression=compression) - - - def http_HEAD(self, url, headers={}): - ''' - Perform an HTTP HEAD request. - - Args: - url (str): The URL to GET. - - Kwargs: - headers (dict): A dictionary describing any headers you would like - to add to the request. (eg. ``{'X-Test': 'testing'}``) - - Returns: - An :class:`HttpResponse` object containing headers and other - meta-information about the page. - ''' - req = HeadRequest(url) - req.add_header('User-Agent', self._user_agent) - for k, v in headers.items(): - req.add_header(k, v) - response = urllib2.urlopen(req) - return HttpResponse(response) - - - def _fetch(self, url, form_data={}, headers={}, compression=True): - ''' - Perform an HTTP GET or POST request. - - Args: - url (str): The URL to GET or POST. - - form_data (dict): A dictionary of form data to POST. If empty, the - request will be a GET, if it contains form data it will be a POST. - - Kwargs: - headers (dict): A dictionary describing any headers you would like - to add to the request. (eg. ``{'X-Test': 'testing'}``) - - compression (bool): If ``True`` (default), try to use gzip - compression. - - Returns: - An :class:`HttpResponse` object containing headers and other - meta-information about the page and the page content. - ''' - encoding = '' - req = urllib2.Request(url) - if form_data: - form_data = urllib.urlencode(form_data) - req = urllib2.Request(url, form_data) - req.add_header('User-Agent', self._user_agent) - for k, v in headers.items(): - req.add_header(k, v) - if compression: - req.add_header('Accept-Encoding', 'gzip') - response = urllib2.urlopen(req) - return HttpResponse(response) - - - -class HttpResponse: - ''' - This class represents a resoponse from an HTTP request. - - The content is examined and every attempt is made to properly encode it to - Unicode. - - .. seealso:: - :meth:`Net.http_GET`, :meth:`Net.http_HEAD` and :meth:`Net.http_POST` - ''' - - content = '' - '''Unicode encoded string containing the body of the reposne.''' - - - def __init__(self, response): - ''' - Args: - response (:class:`mimetools.Message`): The object returned by a call - to :func:`urllib2.urlopen`. - ''' - self._response = response - html = response.read() - try: - if response.headers['content-encoding'].lower() == 'gzip': - html = gzip.GzipFile(fileobj=StringIO.StringIO(html)).read() - except: - pass - - try: - content_type = response.headers['content-type'] - if 'charset=' in content_type: - encoding = content_type.split('charset=')[-1] - except: - pass - - r = re.search('. +''' + +import socket, urllib, urllib2, cookielib, gzip +import re, StringIO, requests, traceback +import xbmc, xbmcaddon + +# Plugin Info +ADDON_ID = 'plugin.video.ustvnow' +REAL_SETTINGS = xbmcaddon.Addon(id=ADDON_ID) +ADDON_VERSION = REAL_SETTINGS.getAddonInfo('version') +DEBUG = REAL_SETTINGS.getSetting('Enable_Debugging') == 'true' + +def log(msg, level=xbmc.LOGDEBUG): + if DEBUG == False and level != xbmc.LOGERROR: return + if level == xbmc.LOGERROR: msg += ' ,' + traceback.format_exc() + xbmc.log(ADDON_ID + '-' + ADDON_VERSION + '-' + (msg.encode("utf-8")), level) + +class HeadRequest(urllib2.Request): + '''A Request class that sends HEAD requests''' + def get_method(self): + return 'HEAD' + +socket.setdefaulttimeout(30) +class Net: + ''' + This class wraps :mod:`urllib2` and provides an easy way to make http + requests while taking care of cookies, proxies, gzip compression and + character encoding. + + Example:: + + from t0mm0.common.net import Net + net = Net() + response = net.http_GET('http://xbmc.org') + print response.content + ''' + + _cj = cookielib.LWPCookieJar() + _proxy = None + _user_agent = 'Mozilla/5.0' + _http_debug = DEBUG + + + def __init__(self, cookie_file='', proxy='', user_agent='', + http_debug=False): + ''' + Kwargs: + cookie_file (str): Full path to a file to be used to load and save + cookies to. + + proxy (str): Proxy setting (eg. + ``'http://user:pass@example.com:1234'``) + + user_agent (str): String to use as the User Agent header. If not + supplied the class will use a default user agent (chrome) + + http_debug (bool): Set ``True`` to have HTTP header info written to + the XBMC log for all requests. + ''' + if cookie_file: + self.set_cookies(cookie_file) + if proxy: + self.set_proxy(proxy) + if user_agent: + self.set_user_agent(user_agent) + self._http_debug = http_debug + self._update_opener() + + + def set_cookies(self, cookie_file): + ''' + Set the cookie file and try to load cookies from it if it exists. + + Args: + cookie_file (str): Full path to a file to be used to load and save + cookies to. + ''' + try: + self._cj.load(cookie_file, ignore_discard=True) + self._update_opener() + return True + except: + return False + + + def get_cookies(self): + '''Returns A dictionary containing all cookie information by domain.''' + return self._cj._cookies + + + def save_cookies(self, cookie_file): + ''' + Saves cookies to a file. + + Args: + cookie_file (str): Full path to a file to save cookies to. + ''' + self._cj.save(cookie_file, ignore_discard=True) + + + def set_proxy(self, proxy): + ''' + Args: + proxy (str): Proxy setting (eg. + ``'http://user:pass@example.com:1234'``) + ''' + self._proxy = proxy + self._update_opener() + + + def get_proxy(self): + '''Returns string containing proxy details.''' + return self._proxy + + + def set_user_agent(self, user_agent): + ''' + Args: + user_agent (str): String to use as the User Agent header. + ''' + self._user_agent = user_agent + + + def get_user_agent(self): + '''Returns user agent string.''' + return self._user_agent + + + def _update_opener(self): + ''' + Builds and installs a new opener to be used by all future calls to + :func:`urllib2.urlopen`. + ''' + if self._http_debug: + http = urllib2.HTTPHandler(debuglevel=1) + else: + http = urllib2.HTTPHandler() + + if self._proxy: + opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(self._cj), + urllib2.ProxyHandler({'http': + self._proxy}), + urllib2.HTTPBasicAuthHandler(), + http) + + else: + opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(self._cj), + urllib2.HTTPBasicAuthHandler(), + http) + urllib2.install_opener(opener) + + + def http_GET(self, url, headers={}, compression=True): + ''' + Perform an HTTP GET request. + + Args: + url (str): The URL to GET. + + Kwargs: + headers (dict): A dictionary describing any headers you would like + to add to the request. (eg. ``{'X-Test': 'testing'}``) + + compression (bool): If ``True`` (default), try to use gzip + compression. + + Returns: + An :class:`HttpResponse` object containing headers and other + meta-information about the page and the page content. + ''' + return self._fetch(url, headers=headers, compression=compression) + + + def http_POST(self, url, form_data, headers={}, compression=True): + ''' + Perform an HTTP POST request. + + Args: + url (str): The URL to POST. + + form_data (dict): A dictionary of form data to POST. + + Kwargs: + headers (dict): A dictionary describing any headers you would like + to add to the request. (eg. ``{'X-Test': 'testing'}``) + + compression (bool): If ``True`` (default), try to use gzip + compression. + + Returns: + An :class:`HttpResponse` object containing headers and other + meta-information about the page and the page content. + ''' + return self._fetch(url, form_data, headers=headers, + compression=compression) + + + def http_HEAD(self, url, headers={}): + ''' + Perform an HTTP HEAD request. + + Args: + url (str): The URL to GET. + + Kwargs: + headers (dict): A dictionary describing any headers you would like + to add to the request. (eg. ``{'X-Test': 'testing'}``) + + Returns: + An :class:`HttpResponse` object containing headers and other + meta-information about the page. + ''' + req = HeadRequest(url) + req.add_header('User-Agent', self._user_agent) + for k, v in headers.items(): + req.add_header(k, v) + response = urllib2.urlopen(req) + return HttpResponse(response) + + + def _json(self, url, form_data={}, headers={}): + if not headers: + headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36', + 'X-Requested-With': 'XMLHttpRequest'} + response = requests.get(url, params=form_data, headers=headers) + return response.json() + + + def _fetch(self, url, form_data={}, headers={}, compression=True): + ''' + Perform an HTTP GET or POST request. + + Args: + url (str): The URL to GET or POST. + + form_data (dict): A dictionary of form data to POST. If empty, the + request will be a GET, if it contains form data it will be a POST. + + Kwargs: + headers (dict): A dictionary describing any headers you would like + to add to the request. (eg. ``{'X-Test': 'testing'}``) + + compression (bool): If ``True`` (default), try to use gzip + compression. + + Returns: + An :class:`HttpResponse` object containing headers and other + meta-information about the page and the page content. + ''' + encoding = '' + try: + req = urllib2.Request(url) + if form_data: + form_data = urllib.urlencode(form_data) + req = urllib2.Request(url, form_data) + req.add_header('User-Agent', self._user_agent) + for k, v in headers.items(): + req.add_header(k, v) + if compression: + req.add_header('Accept-Encoding', 'gzip') + response = urllib2.urlopen(req) + except urllib2.HTTPError as e: + log('_fetch, failed ' + str(e.code), xbmc.LOGERROR) + log('_fetch, failed ' + str(e.msg), xbmc.LOGERROR) + return + return HttpResponse(response) + + + +class HttpResponse: + ''' + This class represents a resoponse from an HTTP request. + + The content is examined and every attempt is made to properly encode it to + Unicode. + + .. seealso:: + :meth:`Net.http_GET`, :meth:`Net.http_HEAD` and :meth:`Net.http_POST` + ''' + + content = '' + '''Unicode encoded string containing the body of the reposne.''' + + + def __init__(self, response): + ''' + Args: + response (:class:`mimetools.Message`): The object returned by a call + to :func:`urllib2.urlopen`. + ''' + self._response = response + html = response.read() + try: + if response.headers['content-encoding'].lower() == 'gzip': + html = gzip.GzipFile(fileobj=StringIO.StringIO(html)).read() + except: + pass + + try: + content_type = response.headers['content-type'] + if 'charset=' in content_type: + encoding = content_type.split('charset=')[-1] + except: + pass + + r = re.search('. + +# -*- coding: utf-8 -*- +import os, sys, datetime, re, traceback, HTMLParser, calendar +import urllib, urllib2, socket, json, collections, net, random +import xbmc, xbmcvfs, xbmcgui, xbmcplugin, xbmcaddon + +from simplecache import SimpleCache +# Plugin Info +ADDON_ID = 'plugin.video.ustvnow' +REAL_SETTINGS = xbmcaddon.Addon(id=ADDON_ID) +ADDON_NAME = REAL_SETTINGS.getAddonInfo('name') +SETTINGS_LOC = REAL_SETTINGS.getAddonInfo('profile') +ADDON_PATH = REAL_SETTINGS.getAddonInfo('path').decode('utf-8') +ADDON_VERSION = REAL_SETTINGS.getAddonInfo('version') +ICON = REAL_SETTINGS.getAddonInfo('icon') +FANART = REAL_SETTINGS.getAddonInfo('fanart') +LANGUAGE = REAL_SETTINGS.getLocalizedString + +## GLOBALS ## +TIMEOUT = 30 +CONTENT_TYPE = 'files' +USER_EMAIL = REAL_SETTINGS.getSetting('User_Email') +PASSWORD = REAL_SETTINGS.getSetting('User_Password') +LAST_TOKEN = REAL_SETTINGS.getSetting('User_Token') +LAST_PASSKEY = REAL_SETTINGS.getSetting('User_Paskey') +DEBUG = REAL_SETTINGS.getSetting('Enable_Debugging') == 'true' +PTVL_RUN = xbmcgui.Window(10000).getProperty('PseudoTVRunning') == 'True' +BASEURL = 'https://m-api.ustvnow.com/' +BASEWEB = 'https://watch.ustvnow.com' +BASEMOB = 'http://mc.ustvnow.com/' +IMG_PATH = os.path.join(ADDON_PATH,'resources','images') +IMG_BASE = 'http://m.poster.static-ustvnow.com' +IMG_SOURCE = IMG_BASE + '/%s/%s/%s/med' +IMG_CHLOGO_W = 'http://tvdata.ustvnow.com/inverse-logos/360/%s.png' +IMG_CHLOGO = 'http://m.ustvnow.com/images/%s.png' +COOKIE_JAR = xbmc.translatePath(os.path.join(SETTINGS_LOC, "cookiejar.lwp")) +MEDIA_TYPES = {'SP':'video','SH':'episode','EP':'episode','MV':'movie'} +FREE_CHANS = ['CW','ABC','FOX','PBS','CBS','NBC','MY9'] +URL_TYPE = {0:'m3u8',1:'mp4'}[int(REAL_SETTINGS.getSetting('URL_Type'))] +URL_QUALITY = int(REAL_SETTINGS.getSetting('URL_Quality')) + 1 +CHAN_NAMES = {'whtm':'ABC','ABC':'ABC','amchd':'AMC','AMC':'AMC','animalplanet':'Animal Planet','Animal Planet':'Animal Planet','bravo':'Bravo','Bravo':'Bravo','whphd':'CBS','CBS':'CBS','cnbc':'CNBC','CNBC':'CNBC','wlyh':'CW','CW':'CW','comedycentral':'Comedy Central','Comedy Central':'Comedy Central','discovery':'Discovery Channel','Discovery Channel':'Discovery Channel','espn':'ESPN','ESPN':'ESPN', + 'FOX':'FOX','wpmt':'FOX','fxhd':'FX','FX':'FX','Fox News Channel':'Fox News','foxnews':'Fox News','frfrm':'Freeform','Freeform':'Freeform','msnbc':'MSNBC','MSNBC':'MSNBC','wgal':'NBC','NBC':'NBC','natgeo':'National Geographic','National Geographic Channel':'National Geographic','nickelodeon':'Nickelodeon','Nickelodeon':'Nickelodeon','wpsu':'PBS','PBS':'PBS', + 'spiketv':'SPIKE TV','SPIKE TV':'SPIKE TV','sndnc':'SundanceTV','SundanceTV':'SundanceTV','syfy':'Syfy','Syfy':'Syfy','AE':'A&E','My9':'MY9','whvl':'MY9','bbca':'BBC America','BBCA':'BBC America','espntwo':'ESPN 2','ESPN2':'ESPN 2','nbcsnhd':'NBCSN','NBCSNHD':'NBCSN','tlchd':'TLC','The Learning Channel':'TLC','Universal HD':'Universal', + 'usahd':'USA Network','USA':'USA Network'} + +USTVNOW_MENU = [("Live" , '', 0), + ("Schedules" , '', 1), + ("Recordings" , '', 2), + ("Lineup" , '', 3), + ("Movies" , '', 5), + ("Highlights", '', 12), + ("OnDemand" , '', 13), + ("Search" , '', 11), + ("Guide" , '', 20)] + +# if xbmc.getCondVisibility('System.HasAddon(script.module.uepg)') == 1: + # USTVNOW_MENU.append(("uEPG Guide", '', 20)) + +uEPG_PARAMS = {"runtime":"duration","stream_code":"studio","description":"plot","synopsis":"plotoutline","ut_start":"starttime","orig_air_date":"firstaired"} +FILE_PARAMS = ["title", "artist", "albumartist", "genre", "year", "rating", "album", "track", "duration", "comment", "lyrics", "musicbrainztrackid", "musicbrainzartistid", "musicbrainzalbumid", "musicbrainzalbumartistid", "playcount", "fanart", "director", "trailer", "tagline", "plot", "plotoutline", "originaltitle", "lastplayed", "writer", "studio", "mpaa", "cast", "country", "imdbnumber", "premiered", "productioncode", "runtime", "set", "showlink", "streamdetails", "top250", "votes", "firstaired", "season", "episode", "showtitle", "thumbnail", "file", "resume", "artistid", "albumid", "tvshowid", "setid", "watchedepisodes", "disc", "tag", "art", "genreid", "displayartist", "albumartistid", "description", "theme", "mood", "style", "albumlabel", "sorttitle", "episodeguide", "uniqueid", "dateadded", "size", "lastmodified", "mimetype", "specialsortseason", "specialsortepisode"] +PVR_PARAMS = ["title","plot","plotoutline","starttime","endtime","runtime","progress","progresspercentage","genre","episodename","episodenum","episodepart","firstaired","hastimer","isactive","parentalrating","wasactive","thumbnail","rating","originaltitle","cast","director","writer","year","imdbnumber","hastimerrule","hasrecording","recording","isseries"] +ART_PARAMS = ["thumb","poster","fanart","banner","landscape","clearart","clearlogo"] + +def uni(string, encoding = 'utf-8'): + if isinstance(string, basestring): + if not isinstance(string, unicode): + string = unicode(string, encoding) + elif isinstance(string, unicode): + string = string.encode('ascii', 'replace') + return string + +def unescape(string): + try: + parser = HTMLParser.HTMLParser() + return (parser.unescape(string)) + except: + return string + +def log(msg, level=xbmc.LOGDEBUG): + if DEBUG == False and level != xbmc.LOGERROR: return + if level == xbmc.LOGERROR: msg += ' ,' + traceback.format_exc() + xbmc.log(ADDON_ID + '-' + ADDON_VERSION + '-' + (msg.encode("utf-8")), level) + +def inputDialog(heading=ADDON_NAME, default='', key=xbmcgui.INPUT_ALPHANUM, opt=0, close=0): + retval = xbmcgui.Dialog().input(heading, default, key, opt, close) + if len(retval) > 0: + return retval + +def okDialog(str1, str2='', str3='', header=ADDON_NAME): + xbmcgui.Dialog().ok(header, str1, str2, str3) + +def yesnoDialog(str1, str2='', str3='', header=ADDON_NAME, yes='', no='', autoclose=0): + return xbmcgui.Dialog().yesno(header, str1, str2, str3, no, yes, autoclose) + +def getParams(): + param=[] + if len(sys.argv[2])>=2: + params=sys.argv[2] + cleanedparams=params.replace('?','') + if (params[len(params)-1]=='/'): + params=params[0:len(params)-2] + pairsofparams=cleanedparams.split('&') + param={} + for i in range(len(pairsofparams)): + splitparams={} + splitparams=pairsofparams[i].split('=') + if (len(splitparams))==2: + param[splitparams[0]]=splitparams[1] + return param + +socket.setdefaulttimeout(TIMEOUT) +class USTVnow(): + def __init__(self): + log('__init__') + self.net = net.Net() + self.cache = SimpleCache() + self.isFree = REAL_SETTINGS.getSetting('User_isFree') == "True" + if self.login(USER_EMAIL, PASSWORD) == False: raise SystemExit + + + def mainMenu(self): + log('mainMenu') + for item in USTVNOW_MENU: + self.addDir(*item) + + + def buildHeader(self): + header_dict = {} + header_dict['Accept'] = 'application/json, text/javascript, */*; q=0.01' + header_dict['Host'] = 'm-api.ustvnow.com' + header_dict['Connection'] = 'keep-alive' + header_dict['Referer'] = 'http://watch.ustvnow.com' + header_dict['Origin'] = 'http://watch.ustvnow.com' + header_dict['User-Agent'] = 'Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.127 Large Screen Safari/533.4 GoogleTV/162671' + return header_dict + + + def login(self, user, password): + log('login') + if len(user) > 0: + try: xbmcvfs.rmdir(COOKIE_JAR) + except: pass + + if xbmcvfs.exists(COOKIE_JAR) == False: + try: + xbmcvfs.mkdirs(SETTINGS_LOC) + f = xbmcvfs.File(COOKIE_JAR, 'w') + f.close() + except: log('login, Unable to create the storage directory', xbmc.LOGERROR) + header_dict = self.buildHeader() + self.net.set_cookies(COOKIE_JAR) + + try: + #check token + dvrlink = None + custlink = json.loads(self.net.http_POST(BASEURL + 'gtv/1/live/getcustomerkey', form_data={'token':LAST_TOKEN}, headers=header_dict).content.encode("utf-8").rstrip()) + '''{u'username': u'', u'ip': u'', u'customerkey': u''}''' + self.custkey = (custlink.get('customerkey','') or 0) + if custlink and 'username' in custlink and user.lower() == custlink['username'].lower(): + log('login, using existing token, passkey') + self.token = LAST_TOKEN + self.passkey = LAST_PASSKEY + else: + #login + loginlink = json.loads(self.net.http_POST(BASEURL + 'gtv/1/live/login', form_data={'username':user,'password':password,'device':'gtv','redir':'0'}, headers=header_dict).content.encode("utf-8").rstrip()) + '''{u'token': u'', u'result': u'success'}''' + if loginlink and 'token' in loginlink and loginlink['result'].lower() == 'success': + log('login, creating new token') + self.token = loginlink['token'] + REAL_SETTINGS.setSetting('User_Token',self.token) + + #passkey + dvrlink = json.loads(self.net.http_POST(BASEURL + 'gtv/1/live/viewdvrlist', form_data={'token':self.token}, headers=header_dict).content.encode("utf-8").rstrip()) + '''{u'globalparams': {u'passkey': u''}, u'results': []}''' + if dvrlink and 'globalparams' in dvrlink: + log('login, creating new passkey') + self.passkey = dvrlink['globalparams']['passkey'] + REAL_SETTINGS.setSetting('User_Paskey',self.passkey) + else: raise Exception + + #check user credentials + userlink = json.loads(self.net.http_POST(BASEURL + 'gtv/1/live/getuserbytoken', form_data={'token':self.token}, headers=header_dict).content.encode("utf-8").rstrip()) + '''{u'status': u'success', u'data': {u'username': u'', u'need_account_activation': False, u'plan_id': 1, u'language': u'en', u'plan_free': 1, u'sub_id': u'7', u'lname': u'', u'currency': u'USD', u'points': 1, u'need_account_renew': False, u'fname': u'', u'plan_name': u'Free Plan'}}''' + log('login, checking user account') + if userlink and 'data' in userlink and userlink['status'].lower() == 'success': + REAL_SETTINGS.setSetting('User_Plan' ,userlink['data']['plan_name']) + expires = 'Never' if userlink['data']['plan_name'] == 'Free Plan' else '' + REAL_SETTINGS.setSetting('User_Expires' ,'%s'%expires) + REAL_SETTINGS.setSetting('User_isFree' ,str(userlink['data']['plan_name'] == 'Free Plan')) + dvrPlan = 2 if 'dvr' in (userlink['data']['plan_name']).lower() else None + REAL_SETTINGS.setSetting('User_DVRpoints' ,str(dvrPlan or userlink['data']['points'] or 0)) + xbmcgui.Dialog().notification(ADDON_NAME, LANGUAGE(30006) + userlink['data']['fname'], ICON, 4000) + + if userlink['data']['need_account_renew'] == True: + xbmcgui.Dialog().notification(ADDON_NAME, LANGUAGE(30016) + userlink['data']['fname'], ICON, 4000) + elif userlink['data']['need_account_activation'] == True: + xbmcgui.Dialog().notification(ADDON_NAME, LANGUAGE(30022) + userlink['data']['fname'], ICON, 4000) + else: + if REAL_SETTINGS.getSetting('User_DVRpoints') != REAL_SETTINGS.getSetting('Last_DVRpoints'): + REAL_SETTINGS.setSetting('Last_DVRpoints',REAL_SETTINGS.getSetting('User_DVRpoints')) + xbmcgui.Dialog().notification(ADDON_NAME, LANGUAGE(30021) + userlink['data']['fname'], ICON, 4000) + + #check subscription + try: + #error prone, isolate and debug. + sublink = json.loads(self.net.http_POST(BASEURL + 'gtv/1/live/getaccountsubscription', form_data={'username':user,'customerkey':self.custkey}, headers=header_dict).content.encode("utf-8").rstrip()) + '''{u'username': u'', u'billingDatetime': u'', u'currency': u'USD', u'cgaccountstatusreason': u'', u'invoicehistory': u'', u'ocaccountstatus': u'Account active', u'ccLastFour': u'', u'lname': u'', u'x-cg-acnt-USD': False, u'fname': u'', u'sub_info': {u'cost': 0, u'plan': {u'sub_group': 4, u'plan_id': 1, u'name': u'Free Plan', u'language': u'en', u'date_expire': u'0000-00-00', u'sub_id': 7, u'price': 0, u'currency': u'USD', u'plan_code': u'7_FREETRIAL', + u'details': u'This plan lets you receive all major US terrestrial stations (ABC, CBS, CW, FOX, NBC, PBS). You can later upgrade to a paid plan with more channels and DVR.'}, u'packages': []}, u'pendinginvoices': u'', u'cgbillingstatus': u'', u'dvrpoints': 1, u'plans': {u'10': {u'price': 15, u'name': u'1 Week All Channel Plan $15 ($2.14/day)', + u'details': u'1 Week pass for all channels (No DVR)'}, u'23': {u'price': 19, u'name': u'All Channel Promo Plan $19/mo first 3 months', + u'details': u'Monthly subscription for all channels. This promotional price is for the first three months after which it will renew at $29. This plan automatically renews each month but you can cancel anytime and will not be billed again when your current 30 day period has expired. '}, u'31': {u'price': 29, u'name': u'All Channel Promo Plan w/DVR $29/mo first 3 months', + u'details': u'Monthly subscription for all channels. This promotional price is for the first three months after which it will renew at $39. This plan automatically renews each month but you can cancel anytime and will not be billed again when your current 30 day period has expired.'}, u'7': {u'price': 0, u'name': u'Free Plan', + u'details': u'This plan lets you receive all major US terrestrial stations (ABC, CBS, CW, FOX, NBC, PBS). You can later upgrade to a paid plan with more channels and DVR.'}, u'9': {u'price': 0.00, u'name': u'3 Day All Channel Plan $6.99 ($2.33/day)', + u'details': u'3 Day pass for all channels (No DVR)'}, u'8': {u'price': 2.99, u'name': u'1 Day All Channel Plan $2.99', + u'details': u'24 hour pass for all channels (No DVR)'}}, u'cgredirectUrl': u'', u'cgaccountstatus': False, u'isfacebookuser': False, u'cgkey': u'', u'ocaccountstatuscode': 0, u'packages': [], u'subscription': u'Free Plan', u'language': u'en', u'sub_id': u'7', u'dateopened': u'December 01, 2000', u'canceledDatetime': u'', u'cgbillingmethod': u''}''' + if sublink: REAL_SETTINGS.setSetting('User_Expires' ,'%s'%(sublink['sub_info']['date_expire'])) + except: pass + else: raise Exception + self.net.save_cookies(COOKIE_JAR) + + self.channels = self.cache.get(ADDON_NAME + '.channelguide') + if not self.channels: + log('login, refreshing channels') + channels = sorted(json.loads(self.net.http_POST(BASEURL + 'gtv/1/live/channelguide', form_data={'token':self.token}, headers=header_dict).content.encode("utf-8").rstrip())['results'], key=lambda x: x['displayorder']) + '''{u'app_name': u'preview', u'stream': u'00000WXYZustvnow', u'af': u'US', u'dvraction': u'add', u'callsign': u'WHTM', u'event_inprogress': 1, + u'srsid': 3560383, u'guideremainingtime': 3660, u'scheduleid': 9952642, u'favoriteaction': u'remove', u'event_time': u'00:00:00',u'title': u'Shark Tank', + u'timemark': 1498867200, u'recordedon': u'June 30, 2017 20:00', u'prg_img': u'h3/NowShowing/9977826/p9977826_b1t_h3_aa.jpg', u'title_10': u'', + u'xcdrappname': u'livehd', u'event_date': u'2017-07-01', u'has_img': 1, u'stream_code': u'ABC', u'updated': u'2017-06-29 11:49:08', + u'description': u'Durable bags made out of the material that protects on the front lines of firefighting; a vibrating mat that helps calm babies; + an ointment made from essential oils; a natural snack made with acai.', u'actualremainingtime': 3281, u'content_allowed': False, + u'dvrtimeraction': u'add', u'mediatype': u'EP', u'auth': None, u'stream_origin': u'dne.ustvnow.com', u'dvrtimertype': 0, u'scode': u'whtm', + u'aksid': 1, u'guideheight': 120, u'orig_air_date': u'2017-02-10', u'prgsvcid': 11534, u'runtime': 3660, u'img': u'images/WHTM.png', + u'connectorid': u'SH011581290000', u'ut_start': 1498867200, u'streamname': u'00000WXYZustvnow', u'episode_title': u'', u'synopsis': + u'A vibrating mat that helps calm babies.', u't': 1, u'edgetypes': 7, u'imgmark': u'live', u'content_id': u'EP011581290171', u'order': 1, + u'displayorder': 1}''' + self.cache.set(ADDON_NAME + '.channelguide', channels, expiration=datetime.timedelta(minutes=5)) + self.channels = self.cache.get(ADDON_NAME + '.channelguide') + + self.upcoming = self.cache.get(ADDON_NAME + '.upcoming') + if not self.upcoming: + log('login, refreshing upcoming') + upcoming = json.loads(self.net.http_POST(BASEURL + 'gtv/1/live/upcoming', form_data={'token':self.token}, headers=header_dict).content.encode("utf-8").rstrip()) + '''{u'prgschid': 19479379, u'dvraction': u'add', u'callsign': u'AMC', u'newtimecat': True, u'srsid': 14930, u'timecat': u'Today', u'scheduleid': 9946282, + u'img': u'images/AMC.png', u'title': u'The Fugitive', u'prg_img': u'v5/NowShowing/14930/p14930_p_v5_aa.jpg', u'has_img': 1, u't': 0, u'sname': u'AMC', + u'description': u'U.S. marshal (Tommy Lee Jones) hunts doctor (Harrison Ford) for murder of his wife (Sela Ward).', u'dvrtimeraction': u'add', + u'auth': None, u'orig_air_date': None, u'dvrtimertype': 0, u'scode': u'amchd', u'prgsvcid': 10021, u'runtime': 10800, u'connectorid': u'MV000371790000', + u'episode_title': u'', u'synopsis': u'An innocent man must evade the law as he pursues a killer.', u'event_inprogress': 1, u'ut_start': 1499009400, + u'content_allowed': False, u'imgmark': u'live', u'content_id': u'MV000371790000', u'displayorder': 100}''' + self.cache.set(ADDON_NAME + '.upcoming', upcoming, expiration=datetime.timedelta(hours=6)) + self.upcoming = self.cache.get(ADDON_NAME + '.upcoming') + + self.highlights = self.cache.get(ADDON_NAME + '.highlights') + if not self.highlights: + log('login, refreshing highlights') + highlights = json.loads(self.net.http_POST(BASEURL + 'api/1/live/highlights', form_data={'token':self.token}, headers=header_dict).content.encode("utf-8").rstrip()) + '''{u'prgschid': 114059791, u'dvraction': u'add', u'bb_content': u'How would you like having Jim Morrison as a college roommate? ', u'callsign': u'WPSU', u'newtimecat': True, + u'srsid': 185479, u'timecat': u'Tomorrow', u'scheduleid': 49826153, u'img': u'images/WPSU.png', u'title': u'Antiques Roadshow', u'prg_img': u'h3/NowShowing/185479/p185479_b_h3_ag.jpg', + u'has_img': 1, u't': 1, u'sname': u'PBS', u'description': u'A French Art Deco diamond and platinum ring; a copy of "The History of Magic" signed by Jim Morrison; four Rembrandt', + u'dvrtimeraction': u'add', u'auth': None, u'orig_air_date': u'2014-02-17', u'dvrtimertype': 0, u'scode': u'wpsu', u'prgsvcid': 11786, u'runtime': 3600, u'connectorid': u'SH002036520000', + u'episode_title': u'Baton Rouge', u'synopsis': u'Diamond and platinum ring.', u'event_inprogress': 2, u'ut_start': 1508216400, u'content_allowed': True, u'imgmark': u'', u'content_id': + u'EP002036520417', u'displayorder': 6}''' + self.cache.set(ADDON_NAME + '.highlights', highlights, expiration=datetime.timedelta(hours=6)) + self.highlights = self.cache.get(ADDON_NAME + '.highlights') + + self.recorded = self.cache.get(ADDON_NAME + '.recorded') + if not self.recorded: + log('login, refreshing recorded') + '''{u'fn1': u'20170702', u'episode_season': 0, u'filename_smil': u'20170702_213000_220000_utc_SH000000010000_11534_11534_ABC.smil', u'app_name': u'dvrrokuplay', + u'stream': u'2F1ECWHTMUSTVNOW', u'imgmark': u'rem', u'dvrtimeraction': u'add', u'mediatype': u'SH', u'orig_air_date': None, u'content_id': u'SH000000010000', + u'callsign': u'WHTM', u'ut_expires': 1500327000, u'filename_med': u'20170702_213000_220000_utc_SH000000010000_11534_11534_ABC_650.mp4', + u'filename_high': u'20170702_213000_220000_utc_SH000000010000_11534_11534_ABC_950.mp4', u'dvrlocation': u'dvr6', u'episode_number': 0, u'srsid': 459763, + u'runtime': 1800, u'description': u'Paid programming.', u'scheduleid': 9952747, u'has_img': 1, u'fn3': u'220000', u'fn2': u'213000', + u'event_time': u'21:30:00', u'title': u'Paid Programming', u'recordedonmmddyyyy': u'07/02/2017', u'connectorid': u'SH000000010000', + u'recordedon': u'July 2, 2017', u'prg_img': u'h3/NowShowing/459763/p459763_b_h3_ae.jpg', u'filename_low': u'20170702_213000_220000_utc_SH000000010000_11534_11534_ABC_350.mp4', + u'episode_title': u'', u'synopsis': u'Paid programming.', u'dvrtimertype': 0, u'content_allowed': True, u'xcdrappname': u'livehd', u'event_date': u'2017-07-02', + u'event_inprogress': 2, u'prgsvcid': 11534, u'ut_start': 1499031000, u'stream_code': u'ABC'}''' + if dvrlink: recorded = dvrlink['results'] + else: recorded = (json.loads(self.net.http_POST(BASEURL + 'gtv/1/live/viewdvrlist', form_data={'token':self.token}, headers=header_dict).content.encode("utf-8").rstrip()))['results'] + self.cache.set(ADDON_NAME + '.recorded', recorded, expiration=datetime.timedelta(minutes=1)) + self.recorded = self.cache.get(ADDON_NAME + '.recorded') + self.names = self.getChannelNames() + return True + except Exception as e: + log('login, Unable to login ' + str(e), xbmc.LOGERROR) + REAL_SETTINGS.setSetting('User_Token','') + REAL_SETTINGS.setSetting('User_Paskey','') + REAL_SETTINGS.setSetting('User_Activated',str(False)) + xbmcgui.Dialog().notification(ADDON_NAME, LANGUAGE(30007), ICON, 4000) + return False + else: + #firstrun wizard + if yesnoDialog(LANGUAGE(30008),no=LANGUAGE(30009), yes=LANGUAGE(30010)): + user = inputDialog(LANGUAGE(30001)) + password = inputDialog(LANGUAGE(30002),opt=xbmcgui.ALPHANUM_HIDE_INPUT) + REAL_SETTINGS.setSetting('User_Email' ,user) + REAL_SETTINGS.setSetting('User_Password',password) + return self.login(user, password) + else: + okDialog(LANGUAGE(30003)) + return False + + + def getChannelNames(self): + collect = [] + if self.channels is None: xbmc.executebuiltin("Container.Refresh") + for channel in self.channels: + try: + name = CHAN_NAMES[channel['stream_code']] + if self.isFree == True and name not in FREE_CHANS: continue + collect.append(name) + except: pass + counter = collections.Counter(collect) + names = sorted(list(set(sorted(counter.elements())))) + log('getChannelNames, names = ' + str(names)) + return names + + + def browseLive(self): + log('browseLive') + d = datetime.datetime.utcnow() + now = datetime.datetime.fromtimestamp(calendar.timegm(d.utctimetuple())) + if self.channels is None: xbmc.executebuiltin("Container.Refresh") + for channel in self.channels: + try: + name = CHAN_NAMES[channel['stream_code']] + if self.isFree == True and name not in FREE_CHANS: continue + startime = datetime.datetime.fromtimestamp(channel['ut_start']) + endtime = startime + datetime.timedelta(seconds=channel['runtime']) + if endtime > now and startime <= now: + label, url, liz = self.buildChannelListItem(name, channel, opt='Live') + self.addLink(label, url, 9, liz, len(self.channels)) + except Exception as e: + log('browseLive, failed ' + str(e), xbmc.LOGERROR) + + + def browseRecordings(self, recorded=False): + log('browseRecordings') + d = datetime.datetime.utcnow() + now = datetime.datetime.fromtimestamp(calendar.timegm(d.utctimetuple())) + if self.recorded is None: xbmc.executebuiltin("Container.Refresh") + for channel in self.recorded: + try: + startime = datetime.datetime.fromtimestamp(channel['ut_start']) + endtime = startime + datetime.timedelta(seconds=channel['runtime']) + if recorded == False and channel['event_inprogress'] == 0: continue + elif recorded == True and channel['event_inprogress'] != 0: continue + label, url, liz = self.buildRecordedListItem(CHAN_NAMES[channel['stream_code']]) + mode = 10 if recorded == True else 21 + if mode == 21: liz.setProperty("IsPlayable","false") + self.addLink(label, url, mode, liz, len(self.recorded)) + except Exception as e: + log('browseRecordings, failed ' + str(e), xbmc.LOGERROR) + + + def browseGuide(self, name=None, upcoming=False): + log('browseGuide') + d = datetime.datetime.utcnow() + now = datetime.datetime.fromtimestamp(calendar.timegm(d.utctimetuple())) + if self.channels is None: xbmc.executebuiltin("Container.Refresh") + if name is None and upcoming == False: + for channel in sorted(self.names): + icon = (os.path.join(IMG_PATH,'logos','%s.png'%channel) or ICON) + infoArt = {"thumb":icon,"poster":icon,"icon":icon,"fanart":FANART} + self.addDir(channel, channel, 4, infoArt=infoArt) + else: + for channel in self.channels: + try: + if self.isFree == True and name not in FREE_CHANS: continue + if name == CHAN_NAMES[channel['stream_code']]: + startime = datetime.datetime.fromtimestamp(channel['ut_start']) + endtime = startime + datetime.timedelta(seconds=channel['runtime']) + if endtime > now and (startime <= now): + label, url, liz = self.buildChannelListItem(name, channel) + self.addLink(label, url, 9, liz, len(self.channels)) + elif endtime > now and (startime <= now or startime > now): + label, url, liz = self.buildChannelListItem(name, channel) + mode = 9 if PTVL_RUN == True else 21 + if mode == 21: liz.setProperty("IsPlayable","false") + self.addLink(label, url, mode, liz, len(self.channels)) + except Exception as e: + log('browseGuide, failed ' + str(e), xbmc.LOGERROR) + + + def browseFeatured(self, hlt=False): + log('browseFeatured') + d = datetime.datetime.utcnow() + now = datetime.datetime.fromtimestamp(calendar.timegm(d.utctimetuple())) + CONTENT_TYPE = 'movies' if not hlt else 'episodes' + optLST = self.highlights.get('programs') if hlt else self.upcoming + if optLST is None: xbmc.executebuiltin("Container.Refresh") + for channel in optLST: + try: + name = CHAN_NAMES[channel['sname']] + startime = datetime.datetime.fromtimestamp(channel['ut_start']) + endtime = startime + datetime.timedelta(seconds=channel['runtime']) + if endtime > now and (startime <= now or startime > now): + label, url, liz = self.buildChannelListItem(name, channel, opt='Featured') + liz.setProperty("IsPlayable","false") + self.addLink(label, url, 21, liz, len(optLST)) + except Exception as e: + log('browseFeatured, failed ' + str(e), xbmc.LOGERROR) + + + def browseVOD(self, url=None, limit=24): + log('browseVOD') + ''' + {u'paging': {u'current': u'/api/1/live/vod/?role=user&limit=24&status%5B0%5D=5', u'next_query': u'role=user&limit=24&status%5B0%5D=5&page=4954', u'next': u'/api/1/live/vod/?role=user&limit=24&status%5B0%5D=5&page=4954'}, + u'data': [{u'rented': None, u'ratings': [{u'description': u'', u'id': 12585970, u'name': u'TV-Y'}], u'scheduleid': u'V4954', u'description': u"HORSELAND: FIRST LOVE - Tomboyish Alma has a crush on a boy. Chloe . (CC)", + u'language': u'en', u'title': u'Horseland: First Love', u'content_allowed': False, u'price': u'0.99', u'created': 1493301489, u'genres': [], u'licensing_start': 1494475260, u'slug': u'V4954', u'director': None, + u'closed_caption': True, u'rent_due': 2, u'actors': [{u'lname': u'Donlan', u'id': 30781624, u'fname': u'Dana'}, {u'lname': u'Hernandez', u'id': 30781625, u'fname': u'Emily'}, {u'lname': u'Heyward', u'id': 30781626, u'fname': + u'Bianca'}], u'year': 2006, u'images': {u'posters': {u'small': u'/V4954/USTVNOW/mv/small', u'large': u'/V4954/USTVNOW/mv/large', u'medium': u'/V4954/USTVNOW/mv/medium'}}, u'runtime': u'00:21:15', u'id': 4954, + u'licensing_end': 1499745540}]} + ''' + if url is None: url = BASEWEB + '/vod/all-items' + items = self.net._json(url, form_data={'limit':limit,'token':self.token}) + if items and len(items) > 0: + label = '[B]%s[/B]'%LANGUAGE(30029) + liz = xbmcgui.ListItem(label) + liz.setArt({"thumb":ICON,"poster":ICON,"fanart":FANART}) + self.addLink(label, '', 22, liz, len(items)) + next = (items.get('paging','').get('next','') or '') + for item in items['data']: + label, url, liz = self.buildVODListItem(item) + liz.setProperty("IsPlayable","true") + liz.addContextMenuItems([('Purchase','')]) + self.addLink(label, url, 22, liz, len(items)) + # self.addDir('>> Next', BASEWEB + next, 13) + + + def search(self): + log('search') + kb = xbmc.Keyboard('', LANGUAGE(30027)%ADDON_NAME) + xbmc.sleep(1000) + kb.doModal() + if kb.isConfirmed(): + try: + query = kb.getText() + items = json.loads(self.net.http_POST(BASEURL + 'gtv/1/live/search', form_data={'token':self.token,'q_title':query}, headers=self.buildHeader()).content.encode("utf-8").rstrip())['results']['programs'] + for channel in items: + try: + name = CHAN_NAMES[channel['progs']['scode']] + label, url, liz = self.buildChannelListItem(name, channel['progs'], opt='Search') + liz.setProperty("IsPlayable","false") + self.addLink(label, url, 21, liz, len(items)) + except Exception as e: + log('search, error ' + str(e), xbmc.LOGERROR) + if len(items) == 0: + label = LANGUAGE(30028)%query + liz = xbmcgui.ListItem(label) + liz.setArt({"thumb":ICON,"poster":ICON,"fanart":FANART}) + self.addLink(label, '', 0, liz, 1) + except Exception as e: + log('search, failed ' + str(e), xbmc.LOGERROR) + else: self.mainMenu() + + + def buildVODListItem(self, item): + url = '' + title = unescape(item['title']) + price = item['price'] + year = item['year'] + h, m, s = item['runtime'].split(':') + runtime = int(h) * 3600 + int(m) * 60 + int(s) + label = '%s ($%s)'%(title,price) + label2 = item['price'] + plot = unescape(item['description']) + liz = xbmcgui.ListItem(label) + thumb = IMG_BASE + item['images']['posters']['large'] + infoList = {"mediatype":'movie',"label":label,"label2":label2,"title":label,"duration":runtime,"plot":plot} + liz.setInfo(type="Video", infoLabels=infoList) + liz.setArt({"thumb":thumb,"poster":thumb,"fanart":FANART}) + liz.setProperty("IsPlayable","true") + liz.setProperty("IsInternetStream","true") + log('buildVODListItem, label = ' + label + ', url = ' + url) + return label, url, liz + + + def buildChannelListItem(self, name, channel=None, opt=''): + if channel is None: + for idx, channel in enumerate(self.channels): + if name == CHAN_NAMES[channel['stream_code']]: break + startime = datetime.datetime.fromtimestamp(channel['ut_start']) + endtime = startime + datetime.timedelta(seconds=channel['runtime']) + title = unescape(channel['title']) + mediatype = (channel.get('mediatype','') or (channel.get('connectorid',''))[:2] or (channel.get('content_id',''))[:2] or 'SP') + mtype = MEDIA_TYPES[mediatype.upper()] + label = name if PTVL_RUN == True else '%s: %s - %s'%(startime.strftime('%I:%M %p').lstrip('0'),name,title) + label = '%s - %s'%(name,title) if opt == 'Live' else label + label2 = '%s - %s'%(startime.strftime('%I:%M %p').lstrip('0'),endtime.strftime('%I:%M %p').lstrip('0')) + url = name + liz = xbmcgui.ListItem(label) + thumb = IMG_SOURCE%(str(channel['srsid']),channel['callsign'],mediatype) + thumb = thumb + '/snapshot' if opt == 'Live' else thumb + poster = (os.path.join(IMG_PATH,'%s.png'%name) or ICON) + logo = IMG_CHLOGO%(channel['callsign']) + tag = ''#urllib.quote(json.dumps({"channelname":name,"channelnumber":self.names.index(name)+1,"channellogo":logo,"label":title,"label2":self.isHD(),"starttime":channel['ut_start']})) + infoList = {"mediatype":'episode',"label":label,"label2":label2,"title":label,"tagline":tag, + "studio":name,"duration":channel['runtime'],"plotoutline":unescape(channel.get('synopsis','')), + "plot":unescape(channel['description']),"aired":startime.strftime('%Y-%m-%d')} + liz.setInfo(type="Video", infoLabels=infoList) + liz.setArt({"thumb":thumb,"poster":thumb,"fanart":FANART,"clearlogo":logo}) + liz.setProperty("IsPlayable","true") + liz.setProperty("IsInternetStream","true") + if channel['dvrtimeraction'] == 'add': + opt = '@'.join([str(channel['prgsvcid']),(channel.get('event_time','') or str(channel.get('ut_start','')))])#lazy solution rather then create additional url parameters for this single function. + contextMenu = [('Set single recording' ,'XBMC.RunPlugin(%s)'%(sys.argv[0]+"?url="+urllib.quote(str(channel['scheduleid']))+"&mode="+str(6)+"&name="+urllib.quote(opt))), + ('Set recurring recording','XBMC.RunPlugin(%s)'%(sys.argv[0]+"?url="+urllib.quote(str(channel['connectorid']))+"&mode="+str(7)+"&name="+urllib.quote(opt)))] + else: + contextMenu = [('Remove recording','XBMC.RunPlugin(%s)'%(sys.argv[0]+"?url="+urllib.quote(str(channel['scheduleid']))+"&mode="+str(8)+"&name="+urllib.quote(name)))] + liz.addContextMenuItems(contextMenu) + log('buildChannelListItem, label = ' + label + ', url = ' + url) + return label, url, liz + + + def buildRecordedListItem(self, name): + for channel in self.recorded: + if name == CHAN_NAMES[channel['stream_code']] or name == str(channel['scheduleid']): + startime = datetime.datetime.fromtimestamp(channel['ut_start']) + endtime = startime + datetime.timedelta(seconds=channel['runtime']) + title = unescape(channel['title']) + label = '%s - %s: %s - %s'%(startime.strftime('%Y-%m-%d'),startime.strftime('%I:%M %p').lstrip('0'),name,title) + label2 = '%s-%s'%(startime.strftime('%I:%M %p').lstrip('0'),endtime.strftime('%I:%M %p').lstrip('0')) + url = str(channel['scheduleid']) + liz = xbmcgui.ListItem(label) + mediatype = (channel.get('mediatype','') or (channel.get('connectorid',''))[:2] or (channel.get('content_id',''))[:2] or 'SP') + mtype = MEDIA_TYPES[mediatype.upper()] + infoList = {"mediatype":mtype,"label":label,"label2":label2,"title":label,"studio":CHAN_NAMES[channel['stream_code']], + "duration":channel['runtime'],"plotoutline":unescape(channel['synopsis']),"plot":unescape(channel['description']), + "aired":startime.strftime('%Y-%m-%d')} + thumb = IMG_SOURCE%(str(channel['srsid']),channel['callsign'],mediatype) + liz.setInfo(type="Video", infoLabels=infoList) + liz.setArt({"thumb":thumb,"poster":thumb,"fanart":FANART}) + liz.setProperty("IsPlayable","true") + liz.setProperty("IsInternetStream","true") + contextMenu = [] + # if channel['dvrtimeraction'] == 'add': + # opt = '@'.join([str(channel['prgsvcid']),channel['event_time']])#lazy solution rather then create additional url parameters for this single function. + # contextMenu = [('Set single recording' ,'XBMC.RunPlugin(%s)'%(sys.argv[0]+"?url="+urllib.quote(str(channel['scheduleid']))+"&mode="+str(6)+"&name="+urllib.quote(opt))), + # ('Set recurring recording','XBMC.RunPlugin(%s)'%(sys.argv[0]+"?url="+urllib.quote(str(channel['connectorid']))+"&mode="+str(7)+"&name="+urllib.quote(opt)))] + contextMenu.extend([('Remove recording','XBMC.RunPlugin(%s)'%(sys.argv[0]+"?url="+urllib.quote(str(channel['scheduleid']))+"&mode="+str(8)+"&name="+urllib.quote(name)))]) + liz.addContextMenuItems(contextMenu) + log('buildRecordedListItem, label = ' + label + ', url = ' + url) + return label, url, liz + + + def resolveURL(self, url, dvr=False): + log('resolveURL, url = ' + url + ', dvr = ' + str(dvr)) + if dvr: + for channel in self.recorded: + if url == str(channel['scheduleid']): + try: + urllink = json.loads(self.net.http_POST(BASEURL + 'stream/1/dvr/play', form_data={'token':self.token,'key':self.passkey,'scheduleid':channel['scheduleid']}, headers=self.buildHeader()).content.encode("utf-8").rstrip()) + '''{u'pr': u'll', u'domain': u'ilvc02.ll.ustvnow.com',u'stream': u'http://ilvc02.ll.ustvnow.com/ilv10/pr/xxl/smil:0B64AWHTMUSTVNOW/playlist.m3u8?', + u'streamname': u'0B64AWHTMUSTVNOW', u'tr': u'', u'up': 1, u'pd': 0, u'pl': u'vjs'}''' + stream = urllink['stream'] + # if URL_TYPE == 'm3u8': stream = urllink['stream'] + # else: stream = (urllink['stream'].replace('smil:','mp4:').replace('USTVNOW','USTVNOW%d'%URL_QUALITY)) + log('resolveURL, url = ' + stream) + return stream + except Exception as e: + if channel and channel['scheduleid']: + self.replaceToken(url, dvr) + else: + for channel in self.channels: + if url == CHAN_NAMES[channel['stream_code']]: + try: + urllink = json.loads(self.net.http_POST(BASEURL + 'stream/1/live/view', form_data={'token':self.token,'key':self.passkey,'scode':channel['scode']}, headers=self.buildHeader()).content.encode("utf-8").rstrip()) + '''{u'pr': u'll', u'domain': u'ilvc02.ll.ustvnow.com',u'stream': u'http://ilvc02.ll.ustvnow.com/ilv10/pr/xxl/smil:0B64AWHTMUSTVNOW/playlist.m3u8?', + u'streamname': u'0B64AWHTMUSTVNOW', u'tr': u'', u'up': 1, u'pd': 0, u'pl': u'vjs'}''' + if URL_TYPE == 'm3u8': stream = urllink['stream'] + else: stream = (urllink['stream'].replace('smil:','mp4:').replace('USTVNOW','USTVNOW%d'%URL_QUALITY)) + log('resolveURL, stream = ' + stream) + return stream + except Exception as e: + if channel and channel['scode']: + self.replaceToken(url, dvr) + + + def replaceToken(self, url, dvr): + #generate alternative token using website endpoint rather then googletv. + try: + #get CSRF Token + response = urllib2.urlopen(BASEWEB + "/account/signin").read() + CSRF = re.findall(r'var csrf_value = "(.*?)"', response, re.DOTALL)[0] + #get WEB Token + response = (self.net.http_POST(BASEWEB + '/account/login', form_data={'csrf_ustvnow': CSRF, 'signin_email': USER_EMAIL, 'signin_password':PASSWORD, 'signin_remember':'1'}).content.encode("utf-8").rstrip()) + altToken = re.findall(r'var token(.*?)= "(.*?)";', response, re.DOTALL)[0][1] + if altToken and altToken != 'null': + self.token = altToken + log('replaceToken, replacing existing token') + REAL_SETTINGS.setSetting('User_Token',altToken) + self.resolveURL(url, dvr) + except Exception as e: + log('replaceToken, Unable to login ' + str(e), xbmc.LOGERROR) + xbmcgui.Dialog().notification(ADDON_NAME, LANGUAGE(30005), ICON, 4000) + raise SystemExit + + + def setRecording(self, name, url, remove=False, recurring=False): + log('setRecording, name = ' + name + ', url = ' + url + ', remove = ' + str(remove)) + if remove == True: + setlink = (self.net.http_POST(BASEURL + 'gtv/1/dvr/updatedvr', form_data={'scheduleid':url,'token':self.token,'action':'remove'}, headers=self.buildHeader()).content.encode("utf-8").rstrip()) + else: + if int(REAL_SETTINGS.getSetting('User_DVRpoints')) <= 1: + xbmcgui.Dialog().notification(ADDON_NAME, LANGUAGE(30019), ICON, 4000) + return + opt = name.split('@')#lazy solution rather then create additional url parameters for this single function. + if recurring == True: + setlink = (self.net.http_POST(BASEURL + 'gtv/1/dvr/updatedvrtimer', form_data={'connectorid':url,'prgsvcid':opt[0],'eventtime':opt[1],'token':self.token,'action':'add'}, headers=self.buildHeader()).content.encode("utf-8").rstrip()) + else: + setlink = (self.net.http_POST(BASEURL + 'gtv/1/dvr/updatedvr' , form_data={'scheduleid':url,'token':self.token,'action':'add'}, headers=self.buildHeader()).content.encode("utf-8").rstrip()) + '''failureadd''' + action = re.findall(r'(.*?)', setlink, re.DOTALL)[0] + status = re.findall(r'(.*?)', setlink, re.DOTALL)[0] + log('setRecording, action = ' + action + ', status = ' + status) + if status == 'failure': + log('setRecording, setlink = ' + str(setlink), xbmc.LOGERROR) + xbmcgui.Dialog().notification(ADDON_NAME, LANGUAGE(30023)%action.title(), ICON, 4000) + return + self.cache.set(ADDON_NAME + '.recorded', None, expiration=datetime.timedelta(seconds=1)) + xbmcgui.Dialog().notification(ADDON_NAME, LANGUAGE(30024)%action.title(), ICON, 4000) + # xbmc.sleep(1001) + # xbmc.executebuiltin("Container.Update(plugin://plugin.video.ustvnow/?mode=1)") + # xbmc.executebuiltin("Container.Update(plugin://plugin.video.ustvnow/?mode=2)") + + + def playVideo(self, url, dvr=False): + log('playVideo, url = ' + url + ', dvr = ' + str(dvr)) + if dvr: label, path, liz = self.buildRecordedListItem(url) + else: label, path, liz = self.buildChannelListItem(url, opt='Live') + liz.setPath(self.resolveURL(url,dvr)) + xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, liz) + + + def addLink(self, name, u, mode, liz, total=0): + log('addLink, name = ' + name) + u=sys.argv[0]+"?url="+urllib.quote(u)+"&mode="+str(mode)+"&name="+urllib.quote(uni(name)) + xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=liz,totalItems=total) + + + def addDir(self, name, u, mode, infoList=False, infoArt=False): + log('addDir, name = ' + name) + liz=xbmcgui.ListItem(name) + liz.setProperty('IsPlayable', 'false') + if infoList == False: liz.setInfo(type="Video", infoLabels={"mediatype":"video","label":name,"title":name} ) + else: liz.setInfo(type="Video", infoLabels=infoList) + if infoArt == False: liz.setArt({'thumb':ICON,'fanart':FANART}) + else: liz.setArt(infoArt) + u=sys.argv[0]+"?url="+urllib.quote(u)+"&mode="+str(mode)+"&name="+urllib.quote(uni(name)) + xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=liz,isFolder=True) + + + def isHD(self): + if URL_TYPE == 'm3u8': return 'HD' + elif URL_QUALITY > 2: return 'HD' + return '' + + + def hasCC(self): + if URL_TYPE == 'm3u8': return True + return False + + + def uEPG(self): + log('uEPG') + #support for upcoming uEPG universal epg framework module, module will be available from the Kodi repository. + #https://github.com/Lunatixz/XBMC_Addons/tree/master/script.module.uepg + collect = [] + if self.channels is None: xbmc.executebuiltin("Container.Refresh") + for channel in self.channels: + try: + name = CHAN_NAMES[channel['stream_code']] + if self.isFree == True and name not in FREE_CHANS: continue + collect.append(name) + except: pass + + channelNum = 0 + counter = collections.Counter(collect) + for key, value in sorted(counter.iteritems()): + newChannel = {} + guidedata = [] + channelName = key + channelNum = channelNum + 1 + isHD = self.isHD() + hasCC = self.hasCC() + newChannel['channelname'] = channelName + newChannel['channelnumber'] = channelNum + for channel in self.channels: + try: + name = CHAN_NAMES[channel['stream_code']] + if self.isFree == True and name not in FREE_CHANS: continue + if name == channelName: + tmpdata = {} + mediatype = (channel.get('mediatype','') or (channel.get('connectorid',''))[:2] or (channel.get('content_id',''))[:2] or 'SP') + mtype = MEDIA_TYPES[mediatype.upper()] + thumb = IMG_SOURCE%(str(channel['srsid']),channel['callsign'],mediatype) + poster = thumb if mediatype.lower() == 'mv' else '' + logo = IMG_CHLOGO_W%(channel['callsign']) + newChannel['channellogo'] = logo + + for key, value in channel.iteritems(): + try: + tmpdata[uEPG_PARAMS[key]] = unescape(value) + except: + if key in FILE_PARAMS + PVR_PARAMS: + tmpdata[key] = unescape(value) + + # contextMenu = [('Schedules' ,'XBMC.RunPlugin(%s)'%(sys.argv[0]+"?mode="+str(1))), + # ('Recordings','XBMC.RunPlugin(%s)'%(sys.argv[0]+"?mode="+str(2))), + # ('OnDemand' ,'XBMC.RunPlugin(%s)'%(sys.argv[0]+"?mode="+str(13)))] + + contextMenu = [] + if channel['dvrtimeraction'] == 'add': + opt = '@'.join([str(channel['prgsvcid']),(channel.get('event_time','') or str(channel.get('ut_start','')))])#lazy solution rather then create additional url parameters for this single function. + contextMenu.append(('Set single recording' ,'XBMC.RunPlugin(%s)'%(sys.argv[0]+"?url="+urllib.quote(str(channel['scheduleid']))+"&mode="+str(6)+"&name="+urllib.quote(opt)))) + contextMenu.append(('Set recurring recording','XBMC.RunPlugin(%s)'%(sys.argv[0]+"?url="+urllib.quote(str(channel['connectorid']))+"&mode="+str(7)+"&name="+urllib.quote(opt)))) + else: + contextMenu.append(('Remove recording','XBMC.RunPlugin(%s)'%(sys.argv[0]+"?url="+urllib.quote(str(channel['scheduleid']))+"&mode="+str(8)+"&name="+urllib.quote(name)))) + + isNew = False #todo parse startime and data + label2 = isHD + tags = {'isHD':isHD,'hasCC':hasCC,'isNew':isNew} + tmpdata['label'] = unescape(channel['title']) + tmpdata['label2'] = label2 + # tmpdata['tagline'] = json.dumps(tags) + tmpdata['art'] = {"thumb":thumb,"poster":poster,"clearlogo":logo} + tmpdata['mediatype'] = mtype + tmpdata['url'] = sys.argv[0]+'?mode=9&url=%s'%name + tmpdata['contextmenu'] = json.dumps(contextMenu) + guidedata.append(tmpdata) + except: pass + newChannel['guidedata'] = guidedata + yield newChannel + +params=getParams() +try: url=urllib.unquote(params["url"]) +except: url=None +try: name=urllib.unquote(params["name"]) +except: name=None +try: mode=int(params["mode"]) +except: mode=None + +log("Mode: "+str(mode)) +log("URL : "+str(url)) +log("Name: "+str(name)) + +if mode==None: USTVnow().mainMenu() +elif mode == 0: USTVnow().browseLive() +elif mode == 1: USTVnow().browseRecordings() +elif mode == 2: USTVnow().browseRecordings(recorded=True) +elif mode == 3: USTVnow().browseGuide() +elif mode == 4: USTVnow().browseGuide(name) +elif mode == 5: USTVnow().browseFeatured() +elif mode == 6: USTVnow().setRecording(name,url) +elif mode == 7: USTVnow().setRecording(name,url,recurring=True) +elif mode == 8: USTVnow().setRecording(name,url,remove=True) +elif mode == 9: USTVnow().playVideo(url) +elif mode == 10:USTVnow().playVideo(url,dvr=True) +elif mode == 11:USTVnow().search() +elif mode == 12: USTVnow().browseFeatured(True) +elif mode == 13:USTVnow().browseVOD(url) +elif mode == 19:xbmc.executebuiltin("RunScript(script.module.uepg,listitem=%s&skin_path=%s&refresh_path=%s&refresh_interval=%s&row_count=%s)"%(urllib.quote(sys.argv[0]+"?mode=3"),urllib.quote(json.dumps(ADDON_PATH)),urllib.quote(json.dumps(sys.argv[0]+"?mode=19")),urllib.quote(json.dumps("7200")),urllib.quote(json.dumps("7")))) +elif mode == 20:xbmc.executebuiltin("RunScript(script.module.uepg,json=%s&skin_path=%s&refresh_path=%s&refresh_interval=%s&row_count=%s)"%(urllib.quote(json.dumps(list(USTVnow().uEPG()))),urllib.quote(json.dumps(ADDON_PATH)),urllib.quote(json.dumps(sys.argv[0]+"?mode=20")),urllib.quote(json.dumps("7200")),urllib.quote(json.dumps("7")))) +elif mode == 21:xbmc.executebuiltin("action(ContextMenu)") + +xbmcplugin.setContent(int(sys.argv[1]) , CONTENT_TYPE) +xbmcplugin.addSortMethod(int(sys.argv[1]) , xbmcplugin.SORT_METHOD_UNSORTED) +xbmcplugin.addSortMethod(int(sys.argv[1]) , xbmcplugin.SORT_METHOD_NONE) +xbmcplugin.addSortMethod(int(sys.argv[1]) , xbmcplugin.SORT_METHOD_LABEL) +xbmcplugin.addSortMethod(int(sys.argv[1]) , xbmcplugin.SORT_METHOD_TITLE) +xbmcplugin.endOfDirectory(int(sys.argv[1]), cacheToDisc=True) \ No newline at end of file diff --git a/plugin.video.ustvnow/resources/skins/default/1080i/script.module.uepg.guide.xml b/plugin.video.ustvnow/resources/skins/default/1080i/script.module.uepg.guide.xml new file mode 100644 index 0000000..2295767 --- /dev/null +++ b/plugin.video.ustvnow/resources/skins/default/1080i/script.module.uepg.guide.xml @@ -0,0 +1,673 @@ + + + no + 2 + 2 + + 0 + 0 + + SetProperty(uEPG.timeCount,3,10000) + SetProperty(uEPG.textColor,0xFFFFFFFF,10000) + SetProperty(uEPG.disabledColor,0xFFFFFFFF,10000) + SetProperty(uEPG.focusedColor,0xFFFFFFFF,10000) + SetProperty(uEPG.shadowColor,0xFF000000,10000) + SetProperty(uEPG.pastColor,0xFFFFFFFF,10000) + SetProperty(uEPG.timeColor,0xFFFFFFFF,10000) + SetProperty(uEPG.textFont,font12,10000) + SetProperty(uEPGGuide,True,10000) + SetProperty(uEPGGuide,False,10000) + WindowOpen + WindowClose + + + 1920 + 1080 + Splash.png + Conditional + + + 1920 + 1080 + Background.png + Conditional + + + 1920 + 1080 + Overlay.png + Conditional + + + Artwork + 1660 + 0 + 200 + 200 + + keep + USTVnow.png + + + + + + + + + 25 + 2 + 1848 + 500 + + + Artwork + 10 + 105 + 375 + 260 + stretch + $INFO[Container(40000).ListItem.Art(thumb)] + VisibleChange + !Player.Playing + + + Artwork + 10 + 105 + 375 + 260 + stretch + blur.png + Conditional + [!Player.Playing + !String.IsEmpty(Container(40000).ListItem.Art(poster))] + + + Artwork + 10 + 105 + 375 + 260 + keep + $INFO[Container(40000).ListItem.Art(poster)] + VisibleChange + [!Player.Playing + !String.IsEmpty(Container(40000).ListItem.Art(poster))] + + + VideoWindow + 10 + 85 + 375 + 260 + + + Show Info + 411 + 105 + 1468 + 40 + font60 + FFFFFFFF + ff000000 + center + left + + + + 405 + 180 + 1 + horizontal + + 100 + 40 + keep + Live.png + VisibleChange + + + 90 + 40 + keep + CC.png + VisibleChange + + + 90 + 40 + keep + $INFO[Container(40000).ListItem.Art(clearlogo)] + VisibleChange + + + + Show Info + 411 + 235 + 1400 + 250 + font30 + FFFFFFFF + FF000000 + top + left + true + true + 50 + - + + + + + 0 + 350 + + 0 + 110 + + 35 + 2 + 1848 + 40 + Bar.png + + + 35 + 42 + 1848 + 40 + Lines.png + + + Date Label + 45 + auto + 38 + left + center + font12 + FFFFFFFF + + + Timebar Current Time Button + 420 + auto + 38 + 250 + FFFFFFFF + font12 + center + center + + + Time Label + 405 + auto + 38 + + font12 + left + center + FFFFFFFF + + + Time Label + 895 + auto + 38 + + font12 + left + center + FFFFFFFF + + + Time Label + 1390 + auto + 38 + + font12 + left + center + FFFFFFFF + + + + Timebar line + 400 + 507 + 40 + 25 + keep + + + 25 + 0 + 0 + vertical + + 10 + 189 + 375 + 74 + epg-genres\COLOR_ButtonNoFocus.png + + + 10 + 264 + 375 + 74 + epg-genres\COLOR_ButtonNoFocus.png + + + 10 + 339 + 375 + 74 + epg-genres\COLOR_ButtonNoFocus.png + + + 10 + 414 + 375 + 74 + epg-genres\COLOR_ButtonNoFocus.png + + + 10 + 489 + 375 + 74 + epg-genres\COLOR_ButtonNoFocus.png + + + 10 + 563 + 375 + 74 + epg-genres\COLOR_ButtonNoFocus.png + + + 10 + 637 + 375 + 74 + epg-genres\COLOR_ButtonNoFocus.png + + + + 10 + 189 + 0 + vertical + Number + + Channel 1 Number + 75 + 75 + + font32_title + right + center + FFFFFFFF + ff000000 + + + Channel 2 Number + 75 + 75 + + font32_title + right + center + FFFFFFFF + ff000000 + + + Channel 3 Number + 75 + 75 + + font32_title + right + center + FFFFFFFF + ff000000 + + + Channel 4 Number + 75 + 75 + + font32_title + right + center + FFFFFFFF + ff000000 + + + Channel 5 Number + 75 + 75 + + font32_title + right + center + FFFFFFFF + ff000000 + + + Channel 6 Number + 75 + 75 + + font32_title + right + center + FFFFFFFF + ff000000 + + + Channel 7 Number + 75 + 75 + + font32_title + right + center + FFFFFFFF + ff000000 + + + + Channel 1 Icon + false + + + Channel 2 Icon + false + + + Channel 3 Icon + false + + + Channel 4 Icon + false + + + Channel 5 Icon + false + + + Channel 6 Icon + false + + + Channel 7 Icon + false + + + 25 + 0 + 278 + 75 + 0 + vertical + Names + + Channel 1 Name + 90 + 189 + 255 + 75 + font12 + left + center + FFFFFFFF + ff000000 + + + Channel 2 Name + 90 + 264 + 255 + 75 + + font12 + left + center + FFFFFFFF + ff000000 + + + Channel 3 Name + 90 + 339 + 255 + 75 + + font12 + left + center + FFFFFFFF + ff000000 + + + Channel 4 Name + 90 + 414 + 255 + 75 + + font12 + left + center + FFFFFFFF + ff000000 + + + Channel 5 Name + 90 + 489 + 255 + 75 + + font12 + left + center + FFFFFFFF + ff000000 + + + Channel 6 Name + 90 + 564 + 255 + 75 + + font12 + left + center + FFFFFFFF + ff000000 + + + Channel 7 Name + 90 + 639 + 255 + 75 + + font12 + left + center + FFFFFFFF + ff000000 + + + + + 411 + 539 + 1475 + 74 + + + 411 + 614 + 1475 + 74 + + + 411 + 689 + 1475 + 74 + + + 411 + 765 + 1475 + 74 + + + 411 + 840 + 1475 + 74 + + + 411 + 913 + 1475 + 74 + + + 411 + 987 + 1475 + 74 + + + Timebar Optional past fade + 411 + 539 + -1 + 520 + scale + + + Timebar Optional future fade + 411 + 539 + -1 + 520 + scale + + + Optional Channel Focus Highlight + 345 + -1000 + 74 + 74 + Arrow.png + Conditional + + + Optional Channel Playing Highlight + 345 + -1000 + 74 + 74 + Arrow.png + Conditional + + + 446 + 325 + 1848 + 133 + vertical + plugin://plugin.video.ustvnow/?mode=1 + + + 910 + 120 + 133 + font12 + C0C0C0C0 + FF000000 + center + right + true + ListItem.Label + + + 1282 + 120 + 133 + keep + ListItem.Art(thumb) + + + + + 910 + 350 + 133 + font12 + C0C0C0C0 + FF000000 + center + right + true + ListItem.Label + + + 1282 + 120 + 133 + keep + VisibleChange + ListItem.Icon + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugin.video.ustvnow/resources/skins/default/1080i/script.module.uepg.splash.xml b/plugin.video.ustvnow/resources/skins/default/1080i/script.module.uepg.splash.xml new file mode 100644 index 0000000..d26e46a --- /dev/null +++ b/plugin.video.ustvnow/resources/skins/default/1080i/script.module.uepg.splash.xml @@ -0,0 +1,21 @@ + + + no + 2 + 2 + + 0 + 0 + + SetProperty(uEPGSplash,True,10000) + SetProperty(uEPGSplash,False,10000) + WindowOpen + WindowClose + + + 1920 + 1080 + Splash.gif + + + diff --git a/plugin.video.ustvnow/resources/skins/default/media/Arrow.png b/plugin.video.ustvnow/resources/skins/default/media/Arrow.png new file mode 100644 index 0000000..d28de29 Binary files /dev/null and b/plugin.video.ustvnow/resources/skins/default/media/Arrow.png differ diff --git a/plugin.video.ustvnow/resources/skins/default/media/Background.png b/plugin.video.ustvnow/resources/skins/default/media/Background.png new file mode 100644 index 0000000..ace234a Binary files /dev/null and b/plugin.video.ustvnow/resources/skins/default/media/Background.png differ diff --git a/plugin.video.ustvnow/resources/skins/default/media/Bar.png b/plugin.video.ustvnow/resources/skins/default/media/Bar.png new file mode 100644 index 0000000..b1cd970 Binary files /dev/null and b/plugin.video.ustvnow/resources/skins/default/media/Bar.png differ diff --git a/plugin.video.ustvnow/resources/skins/default/media/Blur.png b/plugin.video.ustvnow/resources/skins/default/media/Blur.png new file mode 100644 index 0000000..9d77d85 Binary files /dev/null and b/plugin.video.ustvnow/resources/skins/default/media/Blur.png differ diff --git a/plugin.video.ustvnow/resources/skins/default/media/ButtonFocus.png b/plugin.video.ustvnow/resources/skins/default/media/ButtonFocus.png new file mode 100644 index 0000000..56678cd Binary files /dev/null and b/plugin.video.ustvnow/resources/skins/default/media/ButtonFocus.png differ diff --git a/plugin.video.ustvnow/resources/skins/default/media/CC.png b/plugin.video.ustvnow/resources/skins/default/media/CC.png new file mode 100644 index 0000000..862fc68 Binary files /dev/null and b/plugin.video.ustvnow/resources/skins/default/media/CC.png differ diff --git a/plugin.video.ustvnow/resources/skins/default/media/Lines.png b/plugin.video.ustvnow/resources/skins/default/media/Lines.png new file mode 100644 index 0000000..b26c701 Binary files /dev/null and b/plugin.video.ustvnow/resources/skins/default/media/Lines.png differ diff --git a/plugin.video.ustvnow/resources/skins/default/media/Live.png b/plugin.video.ustvnow/resources/skins/default/media/Live.png new file mode 100644 index 0000000..982c77a Binary files /dev/null and b/plugin.video.ustvnow/resources/skins/default/media/Live.png differ diff --git a/plugin.video.ustvnow/resources/skins/default/media/Overlay.png b/plugin.video.ustvnow/resources/skins/default/media/Overlay.png new file mode 100644 index 0000000..d7e700b Binary files /dev/null and b/plugin.video.ustvnow/resources/skins/default/media/Overlay.png differ diff --git a/plugin.video.ustvnow/resources/skins/default/media/PastFade.png b/plugin.video.ustvnow/resources/skins/default/media/PastFade.png new file mode 100644 index 0000000..ca1a370 Binary files /dev/null and b/plugin.video.ustvnow/resources/skins/default/media/PastFade.png differ diff --git a/plugin.video.ustvnow/resources/skins/default/media/Splash.gif b/plugin.video.ustvnow/resources/skins/default/media/Splash.gif new file mode 100644 index 0000000..d2257b2 Binary files /dev/null and b/plugin.video.ustvnow/resources/skins/default/media/Splash.gif differ diff --git a/plugin.video.ustvnow/resources/skins/default/media/Splash.png b/plugin.video.ustvnow/resources/skins/default/media/Splash.png new file mode 100644 index 0000000..f27b010 Binary files /dev/null and b/plugin.video.ustvnow/resources/skins/default/media/Splash.png differ diff --git a/plugin.video.ustvnow/resources/skins/default/media/TimeBar.png b/plugin.video.ustvnow/resources/skins/default/media/TimeBar.png new file mode 100644 index 0000000..b7167fe Binary files /dev/null and b/plugin.video.ustvnow/resources/skins/default/media/TimeBar.png differ diff --git a/plugin.video.ustvnow/resources/skins/default/media/USTVnow - Copy.png b/plugin.video.ustvnow/resources/skins/default/media/USTVnow - Copy.png new file mode 100644 index 0000000..b39123b Binary files /dev/null and b/plugin.video.ustvnow/resources/skins/default/media/USTVnow - Copy.png differ diff --git a/plugin.video.ustvnow/resources/skins/default/media/USTVnow.png b/plugin.video.ustvnow/resources/skins/default/media/USTVnow.png new file mode 100644 index 0000000..a224ace Binary files /dev/null and b/plugin.video.ustvnow/resources/skins/default/media/USTVnow.png differ diff --git a/plugin.video.ustvnow/resources/skins/default/media/White.png b/plugin.video.ustvnow/resources/skins/default/media/White.png new file mode 100644 index 0000000..6fc42c1 Binary files /dev/null and b/plugin.video.ustvnow/resources/skins/default/media/White.png differ diff --git a/plugin.video.ustvnow/resources/skins/default/media/epg-genres/COLOR_ButtonNoFocus.png b/plugin.video.ustvnow/resources/skins/default/media/epg-genres/COLOR_ButtonNoFocus.png new file mode 100644 index 0000000..4cf2e85 Binary files /dev/null and b/plugin.video.ustvnow/resources/skins/default/media/epg-genres/COLOR_ButtonNoFocus.png differ -- cgit v1.2.3