├── LICENSE ├── README.md ├── e2m3u2bouquet.py ├── generator.html ├── generator_config.xml └── providers.enc /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | {one line to give the program's name and a brief idea of what it does.} 635 | Copyright (C) {year} {name of author} 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | {project} Copyright (C) {year} {fullname} 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Enigma2 IPTV m3u to bouquet 2 | 3 | Latest release can be downloaded from [releases](https://github.com/su1s/e2m3u2bouquet/releases/latest) 4 | 5 | ## Usage 6 | ``` 7 | usage: e2m3u2bouquet.py [-h] [-m M3UURL] [-e EPGURL] [-n PROVIDERNAME] 8 | [-u USERNAME] [-p PASSWORD] [-i] [-sttv STTV] 9 | [-stvod STVOD] [-M] [-a] [-P] [-q ICONPATH] [-xs] 10 | [-b BOUQUETURL] [-bd] [-bt] [-U] [-V] 11 | 12 | e2m3u2bouquet.e2m3u2bouquet -- Enigma2 IPTV m3u to bouquet parser 13 | 14 | Copyright 2017. All rights reserved. 15 | Created on 2017-06-04. 16 | Licensed under GNU GENERAL PUBLIC LICENSE version 3 17 | Distributed on an "AS IS" basis without warranties 18 | or conditions of any kind, either express or implied. 19 | 20 | USAGE 21 | 22 | optional arguments: 23 | -h, --help show this help message and exit 24 | -i, --iptvtypes Treat all stream references as IPTV stream type. 25 | (required for some enigma boxes) 26 | -sttv STTV, --streamtype_tv STTV 27 | Stream type for TV (e.g. 1, 4097, 5001 or 5002) 28 | overrides iptvtypes 29 | -stvod STVOD, --streamtype_vod STVOD 30 | Stream type for VOD (e.g. 4097, 5001 or 5002) 31 | overrides iptvtypes 32 | -M, --multivod Create multiple VOD bouquets rather than single VOD 33 | bouquet 34 | -a, --allbouquet Create all channels bouquet 35 | -P, --picons Automatically download of Picons, this option will 36 | slow the execution 37 | -q ICONPATH, --iconpath ICONPATH 38 | Option path to store picons, if not supplied defaults 39 | to /usr/share/enigma2/picon/ 40 | -xs, --xcludesref Disable service ref overriding from override.xml file 41 | -b BOUQUET_URL, --bouqueturl BOUQUET_URL 42 | URL to download providers bouquet - to map custom 43 | service references 44 | -bd, --bouquetdownload 45 | Download providers bouquet (use default url) - to map 46 | custom service references 47 | -bt, --bouquettop Place IPTV bouquets at top 48 | -U, --uninstall Uninstall all changes made by this script 49 | -V, --version show program's version number and exit 50 | 51 | URL Based Setup: 52 | -m M3UURL, --m3uurl M3UURL 53 | URL to download m3u data from (required) 54 | -e EPGURL, --epgurl EPGURL 55 | URL source for XML TV epg data sources 56 | 57 | -n PROVIDERNAME, --providername PROVIDERNAME 58 | Host IPTV provider name 59 | 60 | Config file based setup 61 | No parameters required 62 | The script will create a default config file 63 | first time it is run, IPTV providers details 64 | need to be entered into this file before 65 | running the script again 66 | ``` 67 | 68 | ## Prerequisites 69 | EPG-Importer plugin is required. This should be available in the plugin feed or already installed. 70 | 71 | N.B. OpenPLi may need additional packages installed. If you attempt to run the script and get an error about 72 | missing modules please run 73 | ``` 74 | opkg update 75 | opkg install python-image python-imaging python-argparse 76 | ``` 77 | 78 | ## How to install 79 | * FTP the e2m3u2bouquet.py to your enigma2 box (I would suggest to /etc/enigma2/e2m3u2bouquet) 80 | * SSH to your enigma2 box (using putty or something similar) 81 | * CD to the correct directory if you are not already there 82 | ``` 83 | cd /etc/enigma2/e2m3u2bouquet 84 | ``` 85 | * Make script executable 86 | ``` 87 | chmod 755 e2m3u2bouquet.py 88 | ``` 89 | 90 | ## URL Based Setup 91 | Run the script passing the url for your m3u file and the url for your providers XML TV data feed 92 | ``` 93 | ./e2m3u2bouquet.py -m "http://provider_url/get.php?username=YOURUSERNAME&password=YOURPASSWORD&type=m3u_plus&output=ts" -e "http://provider_url/xmltv.php?username=YOURUSERNAME&password=YOURPASSWORD" 94 | ``` 95 | **NB: you need to replace the username and password values X 2** 96 | 97 | If you are with a different provider the script should work but you will obviously need the m3u url (1st parameter) and XML TV url (2nd parameter) for your own provider. Please note the m3u file needs to be the "extended" version if you have the option. 98 | 99 | ## Config File Setup 100 | No parameters required, just run the script 101 | ``` 102 | ./e2m3u2bouquet.py 103 | ``` 104 | The script will create a default config.xml file in /etc/enigma2/e2m3u2bouquet the first time it is run 105 | IPTV providers details need to be entered into this file before running the script again 106 | 107 | Note: Multiple IPTV providers can be supported via the config.xml 108 | 109 | ## For Picon Download Support 110 | Add -P and optionally -q /path/to/picon/folder/ if you don't store your picons in the default location. The default location 111 | is `/usr/share/enigma2/picon/` (internal flash) other enigma2 picon search location are `/media/usb/picon/` & `/media/hdd/picon/`. 112 | 113 | N.B. If you store the picons on HDD it was spin up whenever they are shown 114 | 115 | ``` 116 | ./e2m3u2bouquet.py "http://provider_url/get.php?username=YOURUSERNAME&password=YOURPASSWORD&type=m3u_plus&output=ts" -e "http://provider_url/xmltv.php?username=YOURUSERNAME&password=YOURPASSWORD" -P 117 | ``` 118 | 119 | ## Specify all stream types to be IPTV 120 | Default is DVB stream types for live channels and IPTV for VOD, all IPTV type streams may be required if you are unable to record channels. 121 | ``` 122 | ./e2m3u2bouquet.py "http://provider_url/get.php?username=YOURUSERNAME&password=YOURPASSWORD&type=m3u_plus&output=ts" -e "http://provider_url/xmltv.php?username=YOURUSERNAME&password=YOURPASSWORD" -i 123 | ``` 124 | 125 | ## Keep VOD all in a single bouquet 126 | ./e2m3u2bouquet.py "http://provider_url/get.php?username=YOURUSERNAME&password=YOURPASSWORD&type=m3u_plus&output=ts" -e "http://provider_url/xmltv.php?username=YOURUSERNAME&password=YOURPASSWORD" -s 127 | 128 | ## Uninstall 129 | ./e2m3u2bouquet.py -U 130 | 131 | ## Help! 132 | ``` 133 | ./e2m3u2bouquet.py --help 134 | ``` 135 | 136 | ## Importing EPG Data 137 | * Open EPG-Importer plugin (download it if you haven't already got it) 138 | * Select sources (Blue button on OpenVix) 139 | * Enable the source created by the script (listed under IPTV Bouquet Maker - E2m3u2bouquet) 140 | * Kick off a manual EPG import 141 | 142 | ## Updating Channels 143 | To update the channels simply run this script again. A scheduled script can 144 | be set up to automate this process (see below) 145 | 146 | ## Automate channel updates (set up from SSH) 147 | * If your box doesn't already have cron then install it 148 | ``` 149 | opkg install busybox-cron 150 | ``` 151 | * open crontab for editing 152 | ``` 153 | crontab -e 154 | ``` 155 | Once open press i to switch to INSERT mode enter the following (retype or ctrl-v to paste) 156 | This will automatically run the script at 06:00 & 18:00 every day 157 | ``` 158 | 0 6,18 * * * /etc/enigma2/e2m3u2bouquet/e2m3u2bouquet.py -m "http://provider_url/get.php?username=YOURUSERNAME&password=YOURPASSWORD&type=m3u_plus&output=ts" -e "http://provider_url/xmltv.php?username=YOURUSERNAME&password=YOURPASSWORD" 159 | ``` 160 | or 161 | ``` 162 | 0 6,18 * * * /etc/enigma2/e2m3u2bouquet/e2m3u2bouquet.py 163 | ``` 164 | Press ESC follwed by :wq to exit the cron editor and save the entry 165 | You can check the entry with the command below 166 | ``` 167 | crontab -l 168 | ``` 169 | 170 | (Depending on your box image installing nano `opkg install nano` may set it as the default editor 171 | which makes editing the crontab easier) 172 | 173 | ## Automate Channel Updates (set up from box GUI) 174 | * Go to 'Menu -> Timers -> CronTimers 175 | * Select the required update frequency 176 | * For the command to run enter i.e. to run at 06:00 & 18:00 enter 177 | ``` 178 | 0 6,18 * * * cd /home/root && ./e2m3u2bouquet.py 179 | ``` 180 | * Ensure that cron Autostart is active 181 | 182 | ## Custom Mapping 183 | * Run the script once. It will create `provider_name-sort-current.xml` 184 | * FTP `provider_name-sort-current.xml` to your machine and rename it `provider_name-sort-override.xml` 185 | * For custom bouquet order move the ` -> ` 186 | * To disable a bouquet change `enabled="true"` to `enabled="false"` 187 | * For custom channel ordering within a bouquet move the ` -> ` 188 | * To disable a channel change `enabled="true"` to `enabled="false"` 189 | * To change the id used for XML EPG mapping update the `tvg-id` attribute 190 | * To change the service ref (e.g. to map to an existing satellite EPG feed) change the `serviceRef` attribute 191 | * For example to use the Channel 4 HD DVB-S EPG you would set the serviceRef to "1:0:1:**52D0:814:2:11A0000**:0:0:0" (part in bold SID:TID:NID:Namespace needs to match). If you match a DVB service and also set the streamUrl to blank the DVB service will replace the IPTV service 192 | * FTP `provider_name-sort-override.xml` to your box 193 | * Run the script again and the changes made will be applied 194 | 195 | ## Change notes 196 | #### v0.1 197 | * Initial version 198 | #### v0.2 199 | * Updated to use providers epg, doesn't need reboot to take effect - so could be scheduled from cron job 200 | #### v0.3 201 | * Complete restructure of the code base to some thing more usable going forward, incorporated Dougs changes to EPG data source 202 | * tvg-id now included in the channels 203 | * better parsing of m3u data 204 | * downloads m3u file from url 205 | * sets custom source to providers xml tv feed (as per Dougs v0.2) 206 | * fixed IPTV streams not playing / having incorrect stream type 207 | * option to make all streams IPTV type 208 | * option to split VOD bouquets by initial category 209 | * all parameters arg based so in theory works for other providers and can be croned 210 | * auto reloads bouquets 211 | * debug \ testrun modes 212 | #### v0.4 213 | * Restructure (again) of code base to bring in some of dougs better structures 214 | * m3u file parsing updated 215 | * channel ordering based on m3u file, bouquet ordering alphabetically or custom. 216 | * create single channels and sources list for EPG-Importer. Only one source now needs to be enabled in the EPG-Importer plugin 217 | * Add Picon download option (thanks to Jose Sanchez for initial code and idea) 218 | * Better args layout and processing 219 | * Mutli VOD by default 220 | * Named provider support (= simplified command line) 221 | * Delimiter options for user defined parsing of the m3u file 222 | * Ability to chose own bouquet sort order 223 | #### v0.4.1 224 | * Update service number to use numbers unlikely to be in use by existing sat services 225 | * Leave service number gaps between categories to reduce the effect of playlist additions cause the epg to get out of sync 226 | #### v0.4.2 227 | * Fixed error for ACE and FLAWLESS users where ":" in category put the box into an infinite loop 228 | #### v0.5 229 | * Custom mapping feature 230 | * Reorder bouquets 231 | * Reorder channels within bouquets 232 | * Disable entire bouquet or individual channels 233 | * Ability to change service reference (so that EPG from existing satellite service can be used) 234 | * Change tvg-id to match other xml epg feeds 235 | * Support unicode characters in playlist 236 | * Xml override file can set-up EPG-Importer config for different xmltv feeds 237 | * Single VOD bouquet now default (use -M for multiple VOD bouquets) 238 | * Option for all channels bouquet (-a) 239 | #### v0.5.1 240 | * Stream Url no longer output to xml (replaced by clearStreamUrl). This means that custom override 241 | maps can be shared as they no longer contain username and passwords 242 | 243 | #### v0.5.2 244 | * Fix bug where delimiter arguments weren't getting converted to ints 245 | 246 | #### v0.5.3 247 | * Minor fixes 248 | 249 | #### v0.5.4 250 | * Add nameOverride attribute to xml files to allow channel name or category name to be changed 251 | * Add option to use service references from providers bouquet file. See -b argument 252 | * Add SSL fix for some boxes (unconfirmed if working) 253 | * Improved service ref id generation logic to reduce (hopefully eliminate) id conflicts especially if override file is used 254 | * Add option -xs to stop service refs from override.xml file being used 255 | 256 | #### v0.5.5 257 | * Minor fixes 258 | 259 | #### v0.5.6 260 | * Minor fixes 261 | 262 | #### v0.6 263 | * Better m3u parsing 264 | * Plugin integration 265 | 266 | #### v0.6.1 267 | * Dedicated config directory '/etc/enigma2/e2m3u2bouquet' 268 | * Pre Python 2.7.9 SSL context workaround 269 | * Remove delimiter options 270 | * No longer uninstall on each run 271 | * Option to place IPTV bouquets at top or bottom '-bt' 272 | * Consistent channel numbering (best results when IPTV bouquets are set to top). Each new IPTV category 273 | will start numbering +100 from start of last category 274 | * [plugin] Add /picon option for download path 275 | * [plugin] Show last playlist update 276 | * [plugin] Add override service service refs' option 277 | * [plugin] Add IPTV bouquet position option 278 | * [plugin] Add option download providers bouquet (for custom service refs) 279 | 280 | #### v0.6.2 281 | * Put epg-importer source in source cat for new epg-importer version 282 | 283 | #### v0.6.3 284 | * Set user agent for downloads 285 | 286 | #### v0.7 287 | * Added Config file based setup support 288 | * Support for multiple service providers 289 | 290 | #### v0.7.1 291 | * Make sure comments are xml safe 292 | * Extract username and password from m3u url if they are not passed in 293 | * Set services to stream type '1' in epg config so that the epg can be imported if 294 | serviceapp is overriding stream type '4097' to exteplayer3 295 | * Minor fixes & tidy 296 | * Option for custom stream type for TV and VOD 297 | * Allow https & rtmp services 298 | * Unicode fixes 299 | * Url encoding fixes 300 | 301 | ### v0.7.3 302 | * Fix issue where main screen showing no text on some skins 303 | * Add option to reset bouquets 304 | 305 | ### v0.7.4 306 | * Extra checking to ensure that logos are actually images 307 | * Keep provider order from config file 308 | 309 | ### v0.7.5 310 | * Additional stream url type checking (e.g. live or VOD) 311 | 312 | ### v0.7.6 313 | * Add nocheck attribute for EpgImporter sources (fix for new EpgImporter version) 314 | * Add m3u8 VOD stream matching 315 | 316 | ### v0.7.7 317 | * Set extensionless streams as live TV 318 | 319 | ### v0.8 320 | * When providers bouquet is downloaded (-b or -bd option) now uses full service references 321 | instead of just the epg relevant part in case it's used for picon naming 322 | * Better multi provider handler e.g. if there is an issue with one provider it 323 | won't stop the script processing others 324 | * If vod categories are out of order in the playlist group together 325 | * Fix file naming issues with non alphanumeric characters 326 | * Much faster when using an override file :) 327 | * Don't retry failed picon downloads 328 | * Option to add placeholder channel in override file (to control channel numbering) 329 | * Allow channels to be moved between categories, use categoryOverride in the override file 330 | * All custom categories, use customCategory="true" in the override file 331 | * Add provider managed update support 332 | 333 | Visit https://www.suls.co.uk/enigma2-iptv-bouquets-with-epg/ for further information on the script 334 | -------------------------------------------------------------------------------- /e2m3u2bouquet.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python2 2 | # encoding: utf-8 3 | 4 | """ 5 | e2m3u2bouquet.e2m3u2bouquet -- Enigma2 IPTV m3u to bouquet parser 6 | 7 | @author: Dave Sully, Doug Mackay 8 | @copyright: 2017 All rights reserved. 9 | @license: GNU GENERAL PUBLIC LICENSE version 3 10 | @deffield updated: Updated 11 | """ 12 | import time 13 | import sys 14 | import os 15 | import errno 16 | import re 17 | import unicodedata 18 | import datetime 19 | import urllib 20 | import urlparse 21 | import imghdr 22 | import tempfile 23 | import glob 24 | import ssl 25 | import hashlib 26 | import socket 27 | from PIL import Image 28 | from collections import OrderedDict 29 | try: 30 | import xml.etree.cElementTree as ET 31 | except ImportError: 32 | import xml.etree.ElementTree as ET 33 | try: 34 | from enigma import eDVBDB 35 | except ImportError: 36 | eDVBDB = None 37 | from argparse import ArgumentParser 38 | from argparse import RawDescriptionHelpFormatter 39 | from xml.sax.saxutils import escape 40 | 41 | __all__ = [] 42 | __version__ = '0.8.5' 43 | __date__ = '2017-06-04' 44 | __updated__ = '2020-01-28' 45 | 46 | DEBUG = 0 47 | TESTRUN = 0 48 | 49 | ENIGMAPATH = '/etc/enigma2/' 50 | EPGIMPORTPATH = '/etc/epgimport/' 51 | CFGPATH = os.path.join(ENIGMAPATH, 'e2m3u2bouquet/') 52 | PICONSPATH = '/usr/share/enigma2/picon/' 53 | IMPORTED = False 54 | PLACEHOLDER_SERVICE = '#SERVICE 1:832:d:0:0:0:0:0:0:0:' 55 | 56 | 57 | class CLIError(Exception): 58 | """Generic exception to raise and log different fatal errors.""" 59 | def __init__(self, msg): 60 | super(CLIError).__init__(type(self)) 61 | self.msg = "E: %s" % msg 62 | 63 | def __str__(self): 64 | return self.msg 65 | 66 | def __unicode__(self): 67 | return self.msg 68 | 69 | 70 | class AppUrlOpener(urllib.FancyURLopener): 71 | """Set user agent for downloads 72 | """ 73 | version = 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36' 74 | 75 | 76 | def display_welcome(): 77 | print('\n********************************') 78 | print('Starting Enigma2 IPTV bouquets v{}'.format(__version__)) 79 | print(str(datetime.datetime.now())) 80 | print("********************************\n") 81 | 82 | def display_end_msg(): 83 | print("\n********************************") 84 | print("Enigma2 IPTV bouquets created ! ") 85 | print("********************************") 86 | print("\nTo enable EPG data") 87 | print("Please open EPG-Importer plugin.. ") 88 | print("Select sources and enable the new IPTV source") 89 | print("(will be listed as under 'IPTV Bouquet Maker - E2m3u2bouquet')") 90 | print("Save the selected sources, press yellow button to start manual import") 91 | print("You can then set EPG-Importer to automatically import the EPG every day") 92 | 93 | def make_config_folder(): 94 | """create config folder if it doesn't exist 95 | """ 96 | try: 97 | os.makedirs(CFGPATH) 98 | except OSError, e: # race condition guard 99 | if e.errno != errno.EEXIST: 100 | raise 101 | 102 | 103 | def uninstaller(): 104 | """Clean up routine to remove any previously made changes 105 | """ 106 | print('----Running uninstall----') 107 | try: 108 | # Bouquets 109 | print('Removing old IPTV bouquets...') 110 | for fname in os.listdir(ENIGMAPATH): 111 | if 'userbouquet.suls_iptv_' in fname: 112 | os.remove(os.path.join(ENIGMAPATH, fname)) 113 | elif 'bouquets.tv.bak' in fname: 114 | os.remove(os.path.join(ENIGMAPATH, fname)) 115 | # Custom Channels and sources 116 | print('Removing IPTV custom channels...') 117 | if os.path.isdir(EPGIMPORTPATH): 118 | for fname in os.listdir(EPGIMPORTPATH): 119 | if 'suls_iptv_' in fname: 120 | os.remove(os.path.join(EPGIMPORTPATH, fname)) 121 | # bouquets.tv 122 | print('Removing IPTV bouquets from bouquets.tv...') 123 | os.rename(os.path.join(ENIGMAPATH, 'bouquets.tv'), os.path.join(ENIGMAPATH, 'bouquets.tv.bak')) 124 | tvfile = open(os.path.join(ENIGMAPATH, 'bouquets.tv'), 'w+') 125 | bakfile = open(os.path.join(ENIGMAPATH, 'bouquets.tv.bak')) 126 | for line in bakfile: 127 | if '.suls_iptv_' not in line: 128 | tvfile.write(line) 129 | bakfile.close() 130 | tvfile.close() 131 | except Exception, e: 132 | print('Unable to uninstall') 133 | raise 134 | print('----Uninstall complete----') 135 | 136 | 137 | def get_category_title(cat, category_options): 138 | """Return the title override if set else the title 139 | """ 140 | if cat in category_options: 141 | return category_options[cat]['nameOverride'] if category_options[cat].get('nameOverride', False) else cat 142 | return cat 143 | 144 | 145 | def get_service_title(channel): 146 | """Return the title override if set else the title 147 | """ 148 | return channel['nameOverride'] if channel.get('nameOverride', False) else channel['stream-name'] 149 | 150 | 151 | def reload_bouquets(): 152 | if not TESTRUN: 153 | print("\n----Reloading bouquets----") 154 | if eDVBDB: 155 | eDVBDB.getInstance().reloadBouquets() 156 | print("bouquets reloaded...") 157 | else: 158 | os.system("wget -qO - http://127.0.0.1/web/servicelistreload?mode=2 > /dev/null 2>&1 &") 159 | print("bouquets reloaded...") 160 | 161 | def xml_escape(string): 162 | return escape(string, {'"': '"', "'": "'"}) 163 | 164 | 165 | def xml_safe_comment(string): 166 | """Can't have -- in xml comments""" 167 | return string.replace('--', '- - ') 168 | 169 | 170 | def get_safe_filename(filename, fallback=''): 171 | """Convert filename to safe filename 172 | """ 173 | name = filename.replace(" ", "_").replace("/", "_") 174 | if type(name) is unicode: 175 | name = name.encode('utf-8') 176 | name = unicodedata.normalize('NFKD', unicode(name, 'utf_8', errors='ignore')).encode('ASCII', 'ignore') 177 | name = re.sub('[^a-z0-9-_]', '', name.lower()) 178 | if not name: 179 | name = fallback 180 | return name 181 | 182 | 183 | def get_parser_args(program_license, program_version_message): 184 | parser = ArgumentParser(description=program_license, formatter_class=RawDescriptionHelpFormatter) 185 | # URL Based Setup 186 | urlgroup = parser.add_argument_group('URL Based Setup') 187 | urlgroup.add_argument('-m', '--m3uurl', dest='m3uurl', action='store', 188 | help='URL to download m3u data from (required)') 189 | urlgroup.add_argument('-e', '--epgurl', dest='epgurl', action='store', 190 | help='URL source for XML TV epg data sources') 191 | # Provider based setup 192 | providergroup = parser.add_argument_group('Provider Based Setup') 193 | providergroup.add_argument('-n', '--providername', dest='providername', action='store', 194 | help='Host IPTV provider name (e.g. FAB/EPIC) (required)') 195 | providergroup.add_argument('-u', '--username', dest='username', action='store', 196 | help='Your IPTV username (required)') 197 | providergroup.add_argument('-p', '--password', dest='password', action='store', 198 | help='Your IPTV password (required)') 199 | # Options 200 | parser.add_argument('-i', '--iptvtypes', dest='iptvtypes', action='store_true', 201 | help='Treat all stream references as IPTV stream type. (required for some enigma boxes)') 202 | parser.add_argument('-sttv', '--streamtype_tv', dest='sttv', action='store', type=int, 203 | help='Stream type for TV (e.g. 1, 4097, 5001 or 5002) overrides iptvtypes') 204 | parser.add_argument('-stvod', '--streamtype_vod', dest='stvod', action='store', type=int, 205 | help='Stream type for VOD (e.g. 4097, 5001 or 5002) overrides iptvtypes') 206 | parser.add_argument('-M', '--multivod', dest='multivod', action='store_true', 207 | help='Create multiple VOD bouquets rather single VOD bouquet') 208 | parser.add_argument('-a', '--allbouquet', dest='allbouquet', action='store_true', 209 | help='Create all channels bouquet') 210 | parser.add_argument('-P', '--picons', dest='picons', action='store_true', 211 | help='Automatically download of Picons, this option will slow the execution') 212 | parser.add_argument('-q', '--iconpath', dest='iconpath', action='store', 213 | help='Option path to store picons, if not supplied defaults to /usr/share/enigma2/picon/') 214 | parser.add_argument('-xs', '--xcludesref', dest='xcludesref', action='store_true', 215 | help='Disable service ref overriding from override.xml file') 216 | parser.add_argument('-b', '--bouqueturl', dest='bouqueturl', action='store', 217 | help='URL to download providers bouquet - to map custom service references') 218 | parser.add_argument('-bd', '--bouquetdownload', dest='bouquetdownload', action='store_true', 219 | help='Download providers bouquet (use default url) - to map custom service references') 220 | parser.add_argument('-bt', '--bouquettop', dest='bouquettop', action='store_true', 221 | help='Place IPTV bouquets at top') 222 | parser.add_argument('-U', '--uninstall', dest='uninstall', action='store_true', 223 | help='Uninstall all changes made by this script') 224 | parser.add_argument('-V', '--version', action='version', version=program_version_message) 225 | return parser 226 | 227 | 228 | class Status: 229 | is_running = False 230 | message = '' 231 | 232 | 233 | class ProviderConfig: 234 | def __init__(self): 235 | self.name = '' 236 | self.num = 0 237 | self.enabled = False 238 | self.settings_level = '' 239 | self.m3u_url = '' 240 | self.epg_url = '' 241 | self.username = '' 242 | self.password = '' 243 | self.provider_update_url = '' 244 | self.provider_hide_urls = False 245 | self.iptv_types = False 246 | self.streamtype_tv = '' 247 | self.streamtype_vod = '' 248 | self.multi_vod = False 249 | self.all_bouquet = False 250 | self.picons = False 251 | self.icon_path = '' 252 | self.sref_override = False 253 | self.bouquet_url = '' 254 | self.bouquet_download = False 255 | self.bouquet_top = False 256 | self.last_provider_update = 0 257 | 258 | 259 | class Provider: 260 | def __init__(self, config): 261 | self._panel_bouquet_file = '' 262 | self._panel_bouquet = {} 263 | self._m3u_file = None 264 | self._category_order = [] 265 | self._category_options = {} 266 | self._dictchannels = OrderedDict() 267 | self._xmltv_sources_list = None 268 | self.config = config 269 | 270 | def _download_picon_file(self, channel): 271 | logo_url = channel['tvg-logo'] 272 | if logo_url: 273 | if not logo_url.startswith('http'): 274 | logo_url = 'http://{}'.format(logo_url) 275 | piconname = self._get_picon_name(channel) 276 | picon_file_path = os.path.join(self.config.icon_path, piconname) 277 | existingpicon = filter(os.path.isfile, glob.glob(picon_file_path + '*')) 278 | 279 | if not existingpicon: 280 | if DEBUG: 281 | print("Picon file doesn't exist downloading") 282 | print('PiconURL: {}'.format(logo_url)) 283 | else: 284 | # Output some kind of progress indicator 285 | if not IMPORTED: 286 | # don't output when called from the plugin 287 | sys.stdout.write('.') 288 | sys.stdout.flush() 289 | try: 290 | response = urllib.urlopen(logo_url) 291 | info = response.info() 292 | response.close() 293 | if info.maintype == 'image': 294 | urllib.urlretrieve(logo_url, picon_file_path) 295 | else: 296 | if DEBUG: 297 | print('Download Picon - not an image, skipping') 298 | self._picon_create_empty(picon_file_path) 299 | return 300 | except Exception, e: 301 | if DEBUG: 302 | print('Download picon urlopen error', e) 303 | self._picon_create_empty(picon_file_path) 304 | return 305 | self._picon_post_processing(picon_file_path) 306 | 307 | def _picon_create_empty(self, picon_file_path): 308 | """ 309 | create an empty picon so that we don't retry this picon 310 | """ 311 | open(picon_file_path + '.None', 'a').close() 312 | 313 | def _picon_post_processing(self, picon_file_path): 314 | """Check type of image received and convert to png 315 | if necessary 316 | """ 317 | ext = "" 318 | # get image type 319 | try: 320 | ext = imghdr.what(picon_file_path) 321 | except Exception, e: 322 | if DEBUG: 323 | print('Picon post processing - not an image or no file', e, picon_file_path) 324 | self._picon_create_empty(picon_file_path) 325 | return 326 | # if image but not png convert to png 327 | if (ext is not None) and (ext is not 'png'): 328 | if DEBUG: 329 | print('Converting Picon to png') 330 | try: 331 | Image.open(picon_file_path).save("{}.{}".format(picon_file_path, 'png')) 332 | except Exception, e: 333 | if DEBUG: 334 | print('Picon post processing - unable to convert image', e) 335 | self._picon_create_empty(picon_file_path) 336 | return 337 | try: 338 | # remove non png file 339 | os.remove(picon_file_path) 340 | except Exception, e: 341 | if DEBUG: 342 | print('Picon post processing - unable to remove non png file', e) 343 | return 344 | else: 345 | # rename to correct extension 346 | try: 347 | os.rename(picon_file_path, "{}.{}".format(picon_file_path, ext)) 348 | except Exception, e: 349 | if DEBUG: 350 | print('Picon post processing - unable to rename file ', e) 351 | 352 | def _get_picon_name(self, channel): 353 | """Convert the service name to a Picon Service Name 354 | """ 355 | service_title = get_service_title(channel) 356 | name = service_title 357 | 358 | if type(name) is unicode: 359 | name = name.encode('utf-8') 360 | name = unicodedata.normalize('NFKD', unicode(name, 'utf_8', errors='ignore')).encode('ASCII', 'ignore') 361 | name = re.sub('[\W]', '', name.replace('&', 'and') 362 | .replace('+', 'plus') 363 | .replace('*', 'star') 364 | .lower()) 365 | if not name: 366 | # use SRP instead of SNP if name can't be used 367 | name = channel['serviceRef'].replace(':', '_').upper() 368 | return name 369 | 370 | def _parse_panel_bouquet(self): 371 | """Check providers bouquet for custom service references 372 | """ 373 | 374 | if os.path.isfile(self._panel_bouquet_file): 375 | with open(self._panel_bouquet_file, "r") as f: 376 | for line in f: 377 | if '#SERVICE' in line: 378 | # get service ref values we need (dict value) and stream file (dict key) 379 | service = line.strip().split(':') 380 | if len(service) == 11: 381 | pos = service[10].rfind('/') 382 | if pos != -1 and (pos + 1 != len(service[10])): 383 | key = service[10][pos + 1:] 384 | value = ':'.join((service[1], service[2], service[3], service[4], service[5], 385 | service[6], service[7], service[8], service[9])) 386 | if value != '0:1:0:0:0:0:0:0:0': 387 | # only add to dict if a custom service id is present 388 | self._panel_bouquet[key] = value 389 | if not DEBUG: 390 | # remove panel bouquet file 391 | os.remove(self._panel_bouquet_file) 392 | 393 | def _set_streamtypes_vodcats(self, service_dict): 394 | """Set the stream types and VOD categories 395 | """ 396 | parsed_stream_url = urlparse.urlparse(service_dict['stream-url']) 397 | root, ext = os.path.splitext(parsed_stream_url.path) 398 | 399 | # check for vod streams ending .*.m3u8 e.g. 2345.mp4.m3u8 400 | is_m3u8_vod = re.search('\.[^/]+\.m3u8$', parsed_stream_url.path) 401 | 402 | if (parsed_stream_url.path.endswith('ts') or parsed_stream_url.path.endswith('.m3u8')) \ 403 | or not ext \ 404 | and not is_m3u8_vod: 405 | service_dict['stream-type'] = '4097' if self.config.iptv_types else '1' 406 | if self.config.streamtype_tv: 407 | # Set custom TV stream type if supplied - this overrides all_iptv_stream_types 408 | service_dict['stream-type'] = str(self.config.streamtype_tv) 409 | else: 410 | service_dict['category_type'] = 'vod' 411 | service_dict['group-title'] = u"VOD - {}".format(service_dict['group-title']) 412 | service_dict['stream-type'] = '4097' if not self.config.streamtype_vod else str(self.config.streamtype_vod) 413 | 414 | def _parse_map_bouquet_xml(self): 415 | """Check for bouquets within mapping override file and applies if found 416 | """ 417 | category_order = [] 418 | mapping_file = self._get_mapping_file() 419 | if mapping_file: 420 | self._update_status('----Parsing custom bouquet order----') 421 | print('\n'.format(Status.message)) 422 | 423 | try: 424 | tree = ET.ElementTree(file=mapping_file) 425 | for node in tree.findall(".//category"): 426 | dictoption = {} 427 | 428 | category = node.attrib.get('name') 429 | if not type(category) is unicode: 430 | category = category.decode("utf-8") 431 | cat_title_override = node.attrib.get('nameOverride', '') 432 | if not type(cat_title_override) is unicode: 433 | cat_title_override = cat_title_override.decode("utf-8") 434 | dictoption['nameOverride'] = cat_title_override 435 | dictoption['enabled'] = node.attrib.get('enabled', True) == 'true' 436 | category_order.append(category) 437 | 438 | # If this category is marked as custom and doesn't exist in self._dictchannels then add 439 | is_custom_category = node.attrib.get('customCategory', False) == 'true' 440 | if is_custom_category: 441 | dictoption['customCategory'] = True 442 | if category not in self._dictchannels: 443 | self._dictchannels[category] = [] 444 | 445 | self._category_options[category] = dictoption 446 | 447 | self._update_status('custom bouquet order applied...') 448 | print(Status.message) 449 | except Exception, e: 450 | msg = 'Corrupt override.xml file' 451 | print(msg) 452 | if DEBUG: 453 | raise msg 454 | 455 | return category_order 456 | 457 | def _set_category_type(self): 458 | """set category type (live/vod) 459 | """ 460 | for cat in self._category_order: 461 | if cat != 'VOD': 462 | if self._dictchannels.get(cat): 463 | if self._category_options.get(cat) is None: 464 | dictoption = {'nameOverride': '', 'enabled': True, 'customCategory': False, 465 | type: 'live'} 466 | self._category_options[cat] = dictoption 467 | # set category type (live/vod) to same as first stream in cat 468 | self._category_options[cat]["type"] = self._dictchannels[cat][0].get("category_type", "live") 469 | else: 470 | if self._category_options.get(cat) is None: 471 | dictoption = {'nameOverride': '', 'enabled': True, 'customCategory': False, 472 | type: 'vod'} 473 | self._category_options[cat] = dictoption 474 | 475 | def _parse_map_channels_xml(self): 476 | """Check for channels within mapping override file and apply if found 477 | """ 478 | mapping_file = self._get_mapping_file() 479 | if mapping_file: 480 | self._update_status('----Parsing custom channel order, please be patient----') 481 | print('\n{}'.format(Status.message)) 482 | 483 | try: 484 | tree = ET.ElementTree(file=mapping_file) 485 | i = 0 486 | for cat in self._dictchannels: 487 | if self._category_options[cat].get('type', 'live') == 'live': 488 | # Only override live (not vod) streams 489 | sortedchannels = [] 490 | listchannels = [] 491 | 492 | # find channels that are to be moved to this category (categoryOverride) 493 | for node in tree.findall(u'.//channel[@categoryOverride="{}"]'.format(cat)): 494 | node_name = node.attrib.get('name') 495 | category = node.attrib.get('category') 496 | channel_index = None 497 | 498 | # get index of channel in the current category 499 | try: 500 | channel_index = next((self._dictchannels[category].index(item) for item in self._dictchannels[category] 501 | if item['stream-name'] == node_name), None) 502 | except KeyError: 503 | pass 504 | 505 | if channel_index is not None: 506 | # remove from existing category and add to new 507 | self._dictchannels[cat].append(self._dictchannels[category].pop(channel_index)) 508 | 509 | for x in self._dictchannels[cat]: 510 | listchannels.append(x['stream-name']) 511 | 512 | for node in tree.findall(u'.//channel[@category="{}"]'.format(cat)): 513 | # Check for placeholders, give unique name, insert into sorted channels and dictchannels[cat] 514 | node_name = node.attrib.get('name') 515 | 516 | if node_name == 'placeholder': 517 | node_name = 'placeholder_' + str(i) 518 | listchannels.append(node_name) 519 | self._dictchannels[cat].append({'stream-name': node_name}) 520 | i += 1 521 | sortedchannels.append(node_name) 522 | 523 | sortedchannels.extend(listchannels) 524 | # remove duplicates, keep order 525 | listchannels = OrderedDict((x, True) for x in sortedchannels).keys() 526 | 527 | # sort the channels by new order 528 | channel_order_dict = {channel: index for index, channel in enumerate(listchannels)} 529 | self._dictchannels[cat].sort(key=lambda x: channel_order_dict[x['stream-name']]) 530 | self._update_status('custom channel order applied...') 531 | print(Status.message) 532 | 533 | # apply overrides 534 | channel_nodes = tree.iter('channel') 535 | for override_channel in channel_nodes: 536 | name = override_channel.attrib.get('name') 537 | category = override_channel.attrib.get('category') 538 | category_override = override_channel.attrib.get('categoryOverride') 539 | channel_index = None 540 | channels_list = None 541 | 542 | if category_override: 543 | # check if the channel has been moved to the new category 544 | try: 545 | channel_index = next((self._dictchannels[category_override].index(item) for item in self._dictchannels[category_override] 546 | if item['stream-name'] == name), None) 547 | except KeyError: 548 | pass 549 | 550 | if category_override and channel_index is not None: 551 | channels_list = self._dictchannels.get(category_override) 552 | else: 553 | channels_list = self._dictchannels.get(category) 554 | 555 | if channels_list is not None and name != 'placeholder': 556 | for x in channels_list: 557 | if x['stream-name'] == name: 558 | if override_channel.attrib.get('enabled') == 'false': 559 | x['enabled'] = False 560 | x['nameOverride'] = override_channel.attrib.get('nameOverride', '') 561 | x['categoryOverride'] = override_channel.attrib.get('categoryOverride', '') 562 | # default to current values if attribute doesn't exist 563 | x['tvg-id'] = override_channel.attrib.get('tvg-id', x['tvg-id']) 564 | if override_channel.attrib.get('serviceRef', None) and self.config.sref_override: 565 | x['serviceRef'] = override_channel.attrib.get('serviceRef', x['serviceRef']) 566 | x['serviceRefOverride'] = True 567 | # streamUrl no longer output to xml file but we still check and process it 568 | x['stream-url'] = override_channel.attrib.get('streamUrl', x['stream-url']) 569 | clear_stream_url = override_channel.attrib.get('clearStreamUrl') == 'true' 570 | if clear_stream_url: 571 | x['stream-url'] = '' 572 | break 573 | self._update_status('custom overrides applied...') 574 | print(Status.message) 575 | except Exception, e: 576 | msg = 'Corrupt override.xml file' 577 | print(msg) 578 | if DEBUG: 579 | raise msg 580 | 581 | 582 | def _get_mapping_file(self): 583 | mapping_file = None 584 | provider_safe_filename = self._get_safe_provider_filename() 585 | search_path = [os.path.join(CFGPATH, provider_safe_filename + '-sort-override.xml'), 586 | os.path.join(os.getcwd(), provider_safe_filename + '-sort-override.xml')] 587 | for path in search_path: 588 | if os.path.isfile(path): 589 | mapping_file = path 590 | break; 591 | return mapping_file 592 | 593 | def _save_bouquet_entry(self, f, channel): 594 | """Add service to bouquet file 595 | """ 596 | if not channel['stream-name'].startswith('placeholder_'): 597 | f.write("#SERVICE {}:{}:\n" 598 | .format(channel['serviceRef'], urllib.quote(channel['stream-url']))) 599 | f.write("#DESCRIPTION {}\n".format(get_service_title(channel).encode("utf-8"))) 600 | else: 601 | f.write('{}\n'.format(PLACEHOLDER_SERVICE)) 602 | 603 | def _get_bouquet_index_name(self, cat_filename, provider_filename): 604 | return ('#SERVICE 1:7:1:0:0:0:0:0:0:0:FROM BOUQUET "userbouquet.suls_iptv_{}_{}.tv" ORDER BY bouquet\n' 605 | .format(provider_filename, cat_filename)) 606 | 607 | def _save_bouquet_index_entries(self, iptv_bouquets): 608 | """Add to the main bouquets.tv file 609 | """ 610 | # get current bouquets indexes 611 | current_bouquet_indexes = self._get_current_bouquet_indexes() 612 | 613 | if iptv_bouquets: 614 | with open(os.path.join(ENIGMAPATH, 'bouquets.tv'), 'w') as f: 615 | f.write('#NAME Bouquets (TV)\n') 616 | if self.config.bouquet_top: 617 | for bouquet in iptv_bouquets: 618 | f.write(bouquet) 619 | for bouquet in current_bouquet_indexes: 620 | f.write(bouquet) 621 | else: 622 | for bouquet in current_bouquet_indexes: 623 | f.write(bouquet) 624 | for bouquet in iptv_bouquets: 625 | f.write(bouquet) 626 | 627 | def _get_current_bouquet_indexes(self): 628 | """Get all the bouquet indexes except this provider 629 | """ 630 | current_bouquets_indexes = [] 631 | 632 | with open(os.path.join(ENIGMAPATH, 'bouquets.tv'), 'r') as f: 633 | for line in f: 634 | if line.startswith('#NAME'): 635 | continue 636 | else: 637 | if not '.suls_iptv_{}'.format(self._get_safe_provider_filename()) in line: 638 | current_bouquets_indexes.append(line) 639 | return current_bouquets_indexes 640 | 641 | def _create_all_channels_bouquet(self): 642 | """Create the Enigma2 all channels bouquet 643 | """ 644 | self._update_status('----Creating all channels bouquet----') 645 | print('\n{}'.format(Status.message)) 646 | 647 | bouquet_indexes = [] 648 | provider_filename = self._get_safe_provider_filename() 649 | bouquet_name = '{} All Channels'.format(provider_filename) 650 | cat_filename = get_safe_filename(bouquet_name) 651 | 652 | # create file 653 | bouquet_filepath = os.path.join(ENIGMAPATH, 'userbouquet.suls_iptv_{}_{}.tv' 654 | .format(provider_filename, cat_filename)) 655 | if DEBUG: 656 | print("Creating: {}".format(bouquet_filepath)) 657 | 658 | with open(bouquet_filepath, 'w+') as f: 659 | f.write('#NAME {} - {}\n'.format(self.config.name.encode('utf-8'), bouquet_name.encode('utf-8'))) 660 | 661 | # write place holder channels (for channel numbering) 662 | for i in xrange(100): 663 | f.write('{}\n'.format(PLACEHOLDER_SERVICE)) 664 | channel_num = 1 665 | 666 | for cat in self._category_order: 667 | cat_enabled = False 668 | if self._category_options[cat].get('type', 'live') == 'live': 669 | cat_enabled = self._category_options.get(cat, {}).get('enabled', True) 670 | 671 | if cat in self._dictchannels and cat_enabled: 672 | cat_title = get_category_title(cat, self._category_options) 673 | # Insert group description placeholder in bouquet 674 | f.write("#SERVICE 1:64:0:0:0:0:0:0:0:0:\n") 675 | f.write("#DESCRIPTION {}\n".format(cat_title.encode('utf-8'))) 676 | for x in self._dictchannels[cat]: 677 | if x.get('enabled') or x['stream-name'].startswith('placeholder_'): 678 | self._save_bouquet_entry(f, x) 679 | channel_num += 1 680 | 681 | while (channel_num % 100) is not 0: 682 | f.write('{}\n'.format(PLACEHOLDER_SERVICE)) 683 | channel_num += 1 684 | 685 | # Add to bouquet index list 686 | bouquet_indexes.append(self._get_bouquet_index_name(cat_filename, provider_filename)) 687 | self._update_status('all channels bouquet created ...') 688 | print(Status.message) 689 | return bouquet_indexes 690 | 691 | def _create_epgimport_source(self, sources, group=None): 692 | """Create epg-importer source file 693 | """ 694 | indent = " " 695 | provider_safe_filename = self._get_safe_provider_filename() 696 | source_name = '{} - {}'.format(provider_safe_filename, group) if group else provider_safe_filename 697 | 698 | channels_filename = os.path.join(EPGIMPORTPATH, 'suls_iptv_{}_channels.xml'.format(provider_safe_filename)) 699 | 700 | # write providers epg feed 701 | source_filename = os.path.join(EPGIMPORTPATH, 'suls_iptv_{}.sources.xml' 702 | .format(get_safe_filename(source_name))) 703 | 704 | with open(os.path.join(EPGIMPORTPATH, source_filename), "w+") as f: 705 | f.write('\n') 706 | f.write('{}\n'.format(indent)) 707 | f.write('{}\n' 708 | .format(2 * indent, channels_filename)) 709 | f.write('{}{}\n'.format(3 * indent, xml_escape(source_name.encode('utf-8')))) 710 | for source in sources: 711 | f.write('{}\n'.format(3 * indent, source)) 712 | f.write('{}\n'.format(2 * indent)) 713 | f.write('{}\n'.format(indent)) 714 | f.write('\n') 715 | 716 | def _get_category_id(self, cat): 717 | """Generate 32 bit category id to help make service refs unique""" 718 | return hashlib.md5(self.config.name.encode('utf-8') + cat.encode('utf-8')).hexdigest()[:8] 719 | 720 | def _has_m3u_file(self): 721 | return self._m3u_file is not None 722 | 723 | def _extract_user_details_from_url(self): 724 | """Extract username & password from m3u_url """ 725 | if self.config.m3u_url: 726 | parsed = urlparse.urlparse(self.config.m3u_url) 727 | username_param = urlparse.parse_qs(parsed.query).get('username') 728 | if username_param: 729 | self.config.username = username_param[0] 730 | password_param = urlparse.parse_qs(parsed.query).get('password') 731 | if password_param: 732 | self.config.password = password_param[0] 733 | 734 | def _update_status(self, message): 735 | Status.message = '{}: {}'.format(self.config.name.encode('utf-8'), message) 736 | 737 | def _process_provider_update(self): 738 | """Download provider update file from url""" 739 | downloaded = False 740 | updated = False 741 | 742 | path = tempfile.gettempdir() 743 | filename = os.path.join(path, 'provider-{}-update.txt'.format(self.config.name)) 744 | self._update_status('----Downloading providers update file----') 745 | print('\n{}'.format(Status.message)) 746 | print('provider update url = ', self.config.provider_update_url) 747 | try: 748 | context = ssl._create_unverified_context() 749 | urllib.urlretrieve(self.config.provider_update_url, filename, context=context) 750 | downloaded = True 751 | except Exception: 752 | pass # fallback to no ssl context 753 | 754 | if not downloaded: 755 | try: 756 | urllib.urlretrieve(self.config.provider_update_url, filename) 757 | except Exception, e: 758 | print('[e2m3u2b] process_provider_update error. Type:', type(e)) 759 | print('[e2m3u2b] process_provider_update error: ', e) 760 | 761 | if os.path.isfile(filename): 762 | try: 763 | with open(filename, 'r') as f: 764 | line = f.readline().strip() 765 | if line: 766 | provider_tmp = { 767 | 'name': line.split(',')[0], 768 | 'm3u': line.split(',')[1], 769 | 'epg': line.split(',')[2], 770 | } 771 | # check we have name and m3u values 772 | if provider_tmp.get('name') and provider_tmp.get('m3u'): 773 | self.config.name = provider_tmp['name'] 774 | self.config.m3u_url = provider_tmp['m3u'] 775 | self.config.epg_url = provider_tmp.get('epg', self.config.epg_url) 776 | self.config.last_provider_update = int(time.time()) 777 | updated = True 778 | except IndexError, e: 779 | print('[e2m3u2b] _process_provider_update error unable to read providers update file') 780 | 781 | if not DEBUG: 782 | os.remove(filename) 783 | return updated 784 | 785 | def _get_safe_provider_filename(self): 786 | return get_safe_filename(self.config.name, 'provider{}'.format(self.config.num)) 787 | 788 | def process_provider(self): 789 | Status.is_running = True 790 | 791 | # Set epg to rytec if nothing else provided 792 | if self.config.epg_url is None: 793 | self.config.epg_url = "http://www.vuplus-community.net/rytec/rytecxmltv-UK.gz" 794 | # Set picon path 795 | if self.config.icon_path is None or TESTRUN == 1: 796 | self.config.icon_path = PICONSPATH 797 | if self.config.name is None: 798 | self.config.name = "E2m3u2Bouquet" 799 | 800 | # If no username or password supplied extract them from m3u_url 801 | if (self.config.username is None) or (self.config.password is None): 802 | self._extract_user_details_from_url() 803 | 804 | # Replace USERNAME & PASSWORD placeholders in urls 805 | self.config.m3u_url = self.config.m3u_url.replace('USERNAME', urllib.quote_plus(self.config.username)).replace('PASSWORD', urllib.quote_plus(self.config.password)) 806 | self.config.epg_url = self.config.epg_url.replace('USERNAME', urllib.quote_plus(self.config.username)).replace('PASSWORD', urllib.quote_plus(self.config.password)) 807 | if self.config.bouquet_download and self.config.bouquet_url: 808 | self.config.bouquet_url = self.config.bouquet_url.replace('USERNAME', urllib.quote_plus(self.config.username)).replace('PASSWORD', urllib.quote_plus(self.config.password)) 809 | 810 | # get default provider bouquet download url if bouquet download set and no bouquet url given 811 | if self.config.bouquet_download and not self.config.bouquet_url: 812 | # set bouquet_url to default url 813 | pos = self.config.m3u_url.find('get.php') 814 | if pos != -1: 815 | self.config.bouquet_url = self.config.m3u_url[0:pos + 7] + '?username={}&password={}&type=dreambox&output=ts'.format( 816 | urllib.quote_plus(self.config.username), urllib.quote_plus(self.config.password)) 817 | 818 | # Download panel bouquet 819 | if self.config.bouquet_url: 820 | self.download_panel_bouquet() 821 | 822 | # Download m3u 823 | self.download_m3u() 824 | 825 | if self._has_m3u_file(): 826 | # parse m3u file 827 | self.parse_m3u() 828 | 829 | if self._dictchannels: 830 | self.parse_data() 831 | 832 | self.parse_map_xmltvsources_xml() 833 | # save xml mapping - should be after m3u parsing 834 | self.save_map_xml() 835 | 836 | # Download picons 837 | if self.config.picons: 838 | self.download_picons() 839 | # Create bouquet files 840 | self.create_bouquets() 841 | # Now create custom channels for each bouquet 842 | self._update_status('----Creating EPG-Importer config ----') 843 | print('\n{}'.format(Status.message)) 844 | self.create_epgimporter_config() 845 | self._update_status('EPG-Importer config created...') 846 | print(Status.message) 847 | 848 | Status.is_running = False 849 | 850 | def provider_update(self): 851 | if self.config.provider_update_url and self.config.username and self.config.password: 852 | return self._process_provider_update() 853 | return False 854 | 855 | def download_m3u(self): 856 | """Download m3u file from url""" 857 | path = tempfile.gettempdir() 858 | filename = os.path.join(path, 'e2m3u2bouquet.m3u') 859 | self._update_status('----Downloading m3u file----') 860 | 861 | print("\n{}".format(Status.message)) 862 | if DEBUG: 863 | print("m3uurl = {}".format(self.config.m3u_url)) 864 | try: 865 | urllib.urlretrieve(self.config.m3u_url, filename) 866 | except Exception, e: 867 | self._update_status('Unable to download m3u file from url') 868 | print(Status.message) 869 | filename = None 870 | self._m3u_file = filename 871 | 872 | def parse_m3u(self): 873 | """core parsing routine""" 874 | # Extract and generate the following items from the m3u 875 | # tvg-id 876 | # tvg-name 877 | # tvg-logo 878 | # group-title 879 | # stream-name 880 | # stream-url 881 | 882 | self._update_status('----Parsing m3u file----') 883 | print('\n{}'.format(Status.message)) 884 | try: 885 | if not os.path.getsize(self._m3u_file): 886 | msg = 'M3U file is empty. Check username & password' 887 | print(msg) 888 | if DEBUG: 889 | raise Exception(msg) 890 | except Exception, e: 891 | print(e) 892 | if DEBUG: 893 | raise 894 | 895 | service_dict = {} 896 | valid_services_found = False 897 | service_valid = False 898 | 899 | with open(self._m3u_file, "r") as f: 900 | for line in f: 901 | try: 902 | line.decode('utf-8') 903 | except UnicodeDecodeError: 904 | # if can't parse as utf-8 encode back to ascii removing illegal chars 905 | line = line.decode('ascii', 'ignore').encode('ascii') 906 | # line = unicodedata.normalize('NFKD', unicode(line, 'utf_8', errors='ignore')).encode('ASCII', 'ignore') 907 | 908 | if 'EXTM3U' in line or (line.startswith('#') and not line.startswith('#EXTINF')): # First line or comments we are not interested 909 | continue 910 | elif 'EXTINF:' in line: # Info line - work out group and output the line 911 | service_valid = False 912 | service_dict = {'tvg-id': '', 'tvg-name': '', 'tvg-logo': '', 'group-title': '', 'stream-name': '', 913 | 'category_type': 'live', 'has_archive': False, 914 | 'stream-url': '', 'enabled': True, 'nameOverride': '', 'categoryOverride': '', 915 | 'serviceRef': '', 'serviceRefOverride': False 916 | } 917 | if line.find('tvg-') == -1 and line.find('group-') == -1: 918 | if DEBUG: 919 | msg = "No extended playlist info found for this service'" 920 | print(msg) 921 | continue 922 | elif not valid_services_found: 923 | valid_services_found = True 924 | 925 | channel = line.split('"') 926 | # strip unwanted info at start of line 927 | pos = channel[0].find(' ') 928 | channel[0] = channel[0][pos:] 929 | 930 | # loop through params and build dict 931 | for i in xrange(0, len(channel) - 2, 2): 932 | service_dict[channel[i].lower().strip(' =')] = channel[i + 1].decode('utf-8') 933 | 934 | # Get the stream name from end of line (after comma) 935 | stream_name_pos = line.rfind('",') 936 | if stream_name_pos != -1: 937 | service_dict['stream-name'] = line[stream_name_pos + 2:].strip().decode('utf-8') 938 | 939 | # Set default name for any blank groups 940 | if service_dict['group-title'] == '': 941 | service_dict['group-title'] = u'None' 942 | service_valid = True 943 | elif ('http:' in line or 'https:' in line or 'rtmp:' in line or 'rtsp:' in line) and service_valid is True: 944 | service_dict['stream-url'] = line.strip() 945 | self._set_streamtypes_vodcats(service_dict) 946 | 947 | if service_dict['group-title'] not in self._dictchannels: 948 | self._dictchannels[service_dict['group-title']] = [service_dict] 949 | else: 950 | self._dictchannels[service_dict['group-title']].append(service_dict) 951 | 952 | if not valid_services_found: 953 | msg = "No extended playlist info found. Check m3u url should be 'type=m3u_plus'" 954 | print(msg) 955 | if DEBUG: 956 | raise Exception(msg) 957 | 958 | if not DEBUG: 959 | # remove m3u file 960 | if os.path.isfile(self._m3u_file): 961 | os.remove(self._m3u_file) 962 | 963 | def parse_data(self): 964 | # sort categories by custom order (if exists) 965 | sorted_categories = self._parse_map_bouquet_xml() 966 | self._category_order = self._dictchannels.keys() 967 | sorted_categories.extend(self._category_order) 968 | # remove duplicates, keep order 969 | self._category_order = OrderedDict((x, True) for x in sorted_categories).keys() 970 | self._set_category_type() 971 | 972 | # Check for and parse override map 973 | self._parse_map_channels_xml() 974 | 975 | # Add Service references 976 | 977 | for cat in self._category_order: 978 | num = 1 979 | if cat in self._dictchannels: 980 | for x in self._dictchannels[cat]: 981 | cat_id = self._get_category_id(cat) 982 | service_ref = "{:x}:{}:{}:0".format(num, cat_id[:4], cat_id[4:]) 983 | if not x['stream-name'].startswith('placeholder_'): 984 | if self._panel_bouquet and not x.get('serviceRefOverride'): 985 | # check if we have the panels custom service ref 986 | pos = x['stream-url'].rfind('/') 987 | if pos != -1 and (pos + 1 != len(x['stream-url'])): 988 | m3u_stream_file = x['stream-url'][pos + 1:] 989 | if m3u_stream_file in self._panel_bouquet: 990 | # have a match use the panels custom service ref 991 | x['serviceRef'] = "{}:{}".format(x['stream-type'], 992 | self._panel_bouquet[m3u_stream_file]) 993 | continue 994 | if not x.get('serviceRefOverride'): 995 | # if service ref is not overridden in xml update 996 | x['serviceRef'] = "{}:0:1:{}:0:0:0".format(x['stream-type'], service_ref) 997 | num += 1 998 | else: 999 | x['serviceRef'] = PLACEHOLDER_SERVICE 1000 | 1001 | vod_index = None 1002 | if "VOD" in self._category_order: 1003 | # if we have the vod category placeholder from the override use it otherwise 1004 | # place at end 1005 | vod_index = self._category_order.index("VOD") 1006 | else: 1007 | vod_index = len(self._category_order) 1008 | 1009 | if vod_index is not None: 1010 | # move all VOD categories to VOD placeholder position or place at end 1011 | vod_categories = list((cat for cat in self._category_order if self._category_options[cat].get('type', 'live') == 'vod')) 1012 | if len(vod_categories): 1013 | # remove the vod category(s) from current position 1014 | self._category_order = [x for x in self._category_order if x not in vod_categories] 1015 | # insert the vod category(s) at the placeholder / first pos 1016 | self._category_order[vod_index:vod_index] = vod_categories 1017 | try: 1018 | self._category_order.remove("VOD") 1019 | except ValueError: 1020 | pass # ignore exception 1021 | 1022 | # Have a look at what we have 1023 | if DEBUG and TESTRUN: 1024 | datafile = open(os.path.join(CFGPATH, 'channels.debug'), "w+") 1025 | for cat in self._category_order: 1026 | if cat in self._dictchannels: 1027 | for line in self._dictchannels[cat]: 1028 | linevals = "" 1029 | for key, value in line.items(): 1030 | if type(value) is bool: 1031 | linevals += str(value) + ":" 1032 | else: 1033 | linevals += value.encode("utf-8") + ":" 1034 | datafile.write("{}\n".format(linevals)) 1035 | datafile.close() 1036 | 1037 | self._update_status('Completed parsing data...') 1038 | print(Status.message) 1039 | 1040 | def download_panel_bouquet(self): 1041 | """Download panel bouquet file from url 1042 | """ 1043 | path = tempfile.gettempdir() 1044 | filename = os.path.join(path, 'userbouquet.panel.tv') 1045 | self._update_status('---Downloading providers bouquet file----') 1046 | print('\n{}'.format(Status.message)) 1047 | if DEBUG: 1048 | print("bouqueturl = {}".format(self.config.bouquet_url)) 1049 | try: 1050 | urllib.urlretrieve(self.config.bouquet_url, filename) 1051 | except Exception, e: 1052 | msg = 'Unable to download providers panel bouquet file' 1053 | print(msg) 1054 | if DEBUG: 1055 | raise msg 1056 | self._panel_bouquet_file = filename 1057 | self._parse_panel_bouquet() 1058 | 1059 | def download_picons(self): 1060 | self._update_status('----Downloading Picon files, please be patient----') 1061 | print('\n{}'.format(Status.message)) 1062 | print('If no Picons exist this will take a few minutes') 1063 | try: 1064 | os.makedirs(self.config.icon_path) 1065 | except OSError, e: # race condition guard 1066 | if e.errno != errno.EEXIST: 1067 | raise 1068 | 1069 | for cat in self._dictchannels: 1070 | if self._category_options[cat].get('type', 'live') == 'live': 1071 | # Download Picon if not VOD 1072 | for x in self._dictchannels[cat]: 1073 | if not x['stream-name'].startswith('placeholder_'): 1074 | self._download_picon_file(x) 1075 | self._update_status('Picons download completed...') 1076 | print('\n{}'.format(Status.message)) 1077 | print('Box will need restarted for Picons to show...') 1078 | 1079 | def parse_map_xmltvsources_xml(self): 1080 | """Check for a mapping override file and parses it if found 1081 | """ 1082 | self._xmltv_sources_list = {} 1083 | mapping_file = self._get_mapping_file() 1084 | if mapping_file: 1085 | try: 1086 | tree = ET.ElementTree(file=mapping_file) 1087 | for group in tree.findall('.//xmltvextrasources/group'): 1088 | group_name = group.attrib.get('id') 1089 | urllist = [] 1090 | for url in group: 1091 | urllist.append(url.text) 1092 | self._xmltv_sources_list[group_name] = urllist 1093 | except Exception, e: 1094 | msg = 'Corrupt override.xml file' 1095 | print(msg) 1096 | if DEBUG: 1097 | raise msg 1098 | 1099 | def save_map_xml(self): 1100 | """Create mapping file""" 1101 | mappingfile = os.path.join(CFGPATH, self._get_safe_provider_filename() + '-sort-current.xml') 1102 | indent = " " 1103 | vod_category_output = False 1104 | 1105 | if self._dictchannels: 1106 | with open(mappingfile, "wb") as f: 1107 | f.write('\r\n') 1115 | 1116 | f.write('\r\n') 1117 | 1118 | f.write('{}\r\n'.format(indent)) 1119 | if not self._xmltv_sources_list: 1120 | # output example config 1121 | f.write('{}\r\n'.format(2 * indent)) 1183 | 1184 | else: 1185 | for group in self._xmltv_sources_list: 1186 | f.write('{}\r\n'.format(2 * indent, xml_escape(group))) 1187 | for source in self._xmltv_sources_list[group]: 1188 | f.write('{}{}\r\n'.format(3 * indent, xml_escape(source))) 1189 | f.write('{}\r\n'.format(2 * indent)) 1190 | f.write('{}\r\n'.format(indent)) 1191 | 1192 | f.write('{}\r\n'.format(indent)) 1193 | for cat in self._category_order: 1194 | if cat in self._dictchannels: 1195 | if self._category_options[cat].get('type', 'live') == 'live': 1196 | cat_title_override = self._category_options[cat].get('nameOverride', '') 1197 | f.write('{}\r\n' 1198 | .format(2 * indent, 1199 | xml_escape(cat).encode('utf-8'), 1200 | xml_escape(cat_title_override).encode('utf-8'), 1201 | str(self._category_options[cat].get('enabled', True)).lower(), 1202 | str(self._category_options[cat].get('customCategory', False)).lower() 1203 | )) 1204 | elif not vod_category_output: 1205 | # Replace multivod categories with single VOD placeholder 1206 | cat_title_override = '' 1207 | cat_enabled = True 1208 | if 'VOD' in self._category_options: 1209 | cat_title_override = self._category_options['VOD'].get('nameOverride', '') 1210 | cat_enabled = self._category_options['VOD'].get('enabled', True) 1211 | f.write('{}\r\n' 1212 | .format(2 * indent, 1213 | 'VOD', 1214 | xml_escape(cat_title_override).encode('utf-8'), 1215 | str(cat_enabled).lower() 1216 | )) 1217 | vod_category_output = True 1218 | 1219 | f.write('{}\r\n'.format(indent)) 1220 | 1221 | f.write('{}\r\n'.format(indent)) 1222 | for cat in self._category_order: 1223 | if cat in self._dictchannels: 1224 | # Don't output any of the VOD channels 1225 | if self._category_options[cat].get('type', 'live') == 'live': 1226 | f.write('{}\r\n'.format(2 * indent, xml_safe_comment(xml_escape(cat.encode('utf-8'))))) 1227 | for x in self._dictchannels[cat]: 1228 | if not x['stream-name'].startswith('placeholder_'): 1229 | f.write('{}\r\n' 1230 | .format(2 * indent, 1231 | xml_escape(x['stream-name'].encode('utf-8')), 1232 | xml_escape(x.get('nameOverride', '').encode('utf-8')), 1233 | xml_escape(x['tvg-id'].encode('utf-8')), 1234 | str(x['enabled']).lower(), 1235 | xml_escape(x['group-title'].encode('utf-8')), 1236 | xml_escape(x.get('categoryOverride', '').encode('utf-8')), 1237 | xml_escape(x['serviceRef']), 1238 | 'false' if x['stream-url'] else 'true' 1239 | )) 1240 | else: 1241 | f.write( 1242 | '{}\r\n' 1243 | .format(2 * indent, 1244 | 'placeholder', 1245 | xml_escape(cat.encode('utf-8')), 1246 | )) 1247 | 1248 | f.write('{}\r\n'.format(indent)) 1249 | f.write('') 1250 | 1251 | def create_bouquets(self): 1252 | """Create the Enigma2 bouquets 1253 | """ 1254 | self._update_status('----Creating bouquets----') 1255 | print('\n{}'.format(Status.message)) 1256 | # clean old bouquets before writing new 1257 | if self._dictchannels: 1258 | for fname in os.listdir(ENIGMAPATH): 1259 | if 'userbouquet.suls_iptv_{}'.format(self._get_safe_provider_filename()) in fname: 1260 | os.remove(os.path.join(ENIGMAPATH, fname)) 1261 | iptv_bouquet_list = [] 1262 | 1263 | if self.config.all_bouquet: 1264 | iptv_bouquet_list = self._create_all_channels_bouquet() 1265 | 1266 | vod_categories = list(cat for cat in self._category_order if self._category_options[cat].get('type', 'live') == 'vod') 1267 | vod_category_output = False 1268 | vod_bouquet_entry_output = False 1269 | channel_number_start_offset_output = False 1270 | 1271 | cat_num = 0 1272 | for cat in self._category_order: 1273 | if self._category_options[cat].get('type', 'live') == 'live': 1274 | cat_enabled = self._category_options.get(cat, {}).get('enabled', True) 1275 | else: 1276 | cat_enabled = self._category_options.get('VOD', {}).get('enabled', True) 1277 | 1278 | if cat in self._dictchannels and cat_enabled: 1279 | cat_title = get_category_title(cat, self._category_options) 1280 | # create file 1281 | cat_filename = get_safe_filename(cat_title, 'cat{}'.format(cat_num)) 1282 | provider_filename = self._get_safe_provider_filename() 1283 | 1284 | if cat in vod_categories and not self.config.multi_vod: 1285 | cat_filename = "VOD" 1286 | 1287 | bouquet_filepath = os.path.join(ENIGMAPATH, 'userbouquet.suls_iptv_{}_{}.tv' 1288 | .format(provider_filename, cat_filename)) 1289 | if DEBUG: 1290 | print("Creating: {}".format(bouquet_filepath)) 1291 | 1292 | if cat not in vod_categories or self.config.multi_vod: 1293 | with open(bouquet_filepath, "w+") as f: 1294 | bouquet_name = '{} - {}'.format(self.config.name.encode('utf-8'), cat_title.encode('utf-8')).decode("utf-8") 1295 | if self._category_options[cat].get('type', 'live') == 'live': 1296 | if cat in self._category_options and self._category_options[cat].get('nameOverride', False): 1297 | bouquet_name = self._category_options[cat]['nameOverride'].decode('utf-8') 1298 | else: 1299 | if 'VOD' in self._category_options and self._category_options['VOD'].get('nameOverride', False): 1300 | bouquet_name = '{} - {}'\ 1301 | .format(self._category_options['VOD']['nameOverride'].decode('utf-8'), 1302 | cat_title.replace('VOD - ', '').decode("utf-8")) 1303 | channel_num = 0 1304 | f.write("#NAME {}\n".format(bouquet_name.encode("utf-8"))) 1305 | if not channel_number_start_offset_output and not self.config.all_bouquet: 1306 | # write place holder services (for channel numbering) 1307 | for i in xrange(100): 1308 | f.write('{}\n'.format(PLACEHOLDER_SERVICE)) 1309 | channel_number_start_offset_output = True 1310 | channel_num += 1 1311 | 1312 | for x in self._dictchannels[cat]: 1313 | if x.get('enabled') or x['stream-name'].startswith('placeholder_'): 1314 | self._save_bouquet_entry(f, x) 1315 | channel_num += 1 1316 | 1317 | while (channel_num % 100) is not 0: 1318 | f.write('{}\n'.format(PLACEHOLDER_SERVICE)) 1319 | channel_num += 1 1320 | elif not vod_category_output and not self.config.multi_vod: 1321 | # not multivod - output all the vod services in one file 1322 | with open(bouquet_filepath, "w+") as f: 1323 | bouquet_name = '{} - VOD'.format(self.config.name).decode("utf-8") 1324 | if 'VOD' in self._category_options and self._category_options['VOD'].get('nameOverride', False): 1325 | bouquet_name = self._category_options['VOD']['nameOverride'].decode('utf-8') 1326 | 1327 | channel_num = 0 1328 | f.write("#NAME {}\n".format(bouquet_name.encode("utf-8"))) 1329 | if not channel_number_start_offset_output and not self.config.all_bouquet: 1330 | # write place holder services (for channel numbering) 1331 | for i in xrange(100): 1332 | f.write('{}\n'.format(PLACEHOLDER_SERVICE)) 1333 | channel_number_start_offset_output = True 1334 | channel_num += 1 1335 | 1336 | for vodcat in vod_categories: 1337 | if vodcat in self._dictchannels: 1338 | # Insert group description placeholder in bouquet 1339 | f.write("#SERVICE 1:64:0:0:0:0:0:0:0:0:\n") 1340 | f.write("#DESCRIPTION {}\n". format(vodcat.encode("utf-8"))) 1341 | for x in self._dictchannels[vodcat]: 1342 | self._save_bouquet_entry(f, x) 1343 | channel_num += 1 1344 | 1345 | while (channel_num % 100) is not 0: 1346 | f.write('{}\n'.format(PLACEHOLDER_SERVICE)) 1347 | channel_num += 1 1348 | vod_category_output = True 1349 | 1350 | # Add to bouquet index list 1351 | if cat not in vod_categories or (cat in vod_categories and not vod_bouquet_entry_output): 1352 | iptv_bouquet_list.append(self._get_bouquet_index_name(cat_filename, provider_filename)) 1353 | if cat in vod_categories and not self.config.multi_vod: 1354 | vod_bouquet_entry_output = True 1355 | cat_num += 1 1356 | 1357 | # write the bouquets.tv indexes 1358 | self._save_bouquet_index_entries(iptv_bouquet_list) 1359 | 1360 | self._update_status('bouquets created ...') 1361 | print(Status.message) 1362 | 1363 | def create_epgimporter_config(self): 1364 | indent = " " 1365 | if DEBUG: 1366 | print('creating EPGImporter config') 1367 | # create channels file 1368 | try: 1369 | os.makedirs(EPGIMPORTPATH) 1370 | except OSError, e: # race condition guard 1371 | if e.errno != errno.EEXIST: 1372 | raise 1373 | channels_filename = os.path.join(EPGIMPORTPATH, 'suls_iptv_{}_channels.xml'.format(self._get_safe_provider_filename())) 1374 | 1375 | if self._dictchannels: 1376 | with open(channels_filename, "w+") as f: 1377 | f.write('\n') 1378 | for cat in self._category_order: 1379 | if cat in self._dictchannels and self._category_options.get(cat, {}).get('enabled', True): 1380 | if self._category_options[cat].get('type', 'live') == 'live': 1381 | cat_title = get_category_title(cat, self._category_options) 1382 | 1383 | f.write('{}\n'.format(indent, xml_safe_comment(xml_escape(cat_title.encode('utf-8'))))) 1384 | for x in self._dictchannels[cat]: 1385 | if not x['stream-name'].startswith('placeholder_'): 1386 | tvg_id = x['tvg-id'] if x['tvg-id'] else get_service_title(x) 1387 | if x['enabled']: 1388 | # force the epg channels to stream type '1' 1389 | epg_service_ref = x['serviceRef'] 1390 | pos = epg_service_ref.find(':') 1391 | if pos != -1: 1392 | epg_service_ref = '1{}'.format(epg_service_ref[pos:]) 1393 | f.write('{}{}:http%3a//example.m3u8 \n' 1394 | .format(indent, xml_escape(tvg_id.encode('utf-8')), epg_service_ref, 1395 | xml_safe_comment(xml_escape(get_service_title(x).encode('utf-8'))))) 1396 | f.write('\n') 1397 | 1398 | # create epg-importer sources file for providers feed 1399 | self._create_epgimport_source([self.config.epg_url]) 1400 | 1401 | # create epg-importer sources file for additional feeds 1402 | for group in self._xmltv_sources_list: 1403 | self._create_epgimport_source(self._xmltv_sources_list[group], group) 1404 | 1405 | 1406 | class Config: 1407 | def __init__(self): 1408 | self.providers = OrderedDict() 1409 | 1410 | def make_default_config(self, configfile): 1411 | print('Default configuration file created in {}\n'.format(os.path.join(CFGPATH, 'config.xml'))) 1412 | 1413 | f = open(configfile, 'wb') 1414 | f.write("""\r 1422 | \r 1423 | \r 1424 | Supplier Name 1\r 1425 | 1\r 1426 | \r 1427 | \r 1428 | \r 1429 | \r 1430 | 0\r 1431 | \r 1432 | \r 1433 | 0\r 1434 | 1\r 1435 | 0\r 1436 | /usr/share/enigma2/picon/\r 1437 | 1\r 1438 | \r 1439 | 0\r 1440 | 0\r 1441 | \r 1442 | \r 1443 | Supplier Name\r 1444 | 0\r 1445 | \r 1446 | \r 1447 | \r 1448 | \r 1449 | 0\r 1450 | \r 1451 | \r 1452 | 0\r 1453 | 1\r 1454 | 0\r 1455 | /usr/share/enigma2/picon/\r 1456 | 1\r 1457 | \r 1458 | 0\r 1459 | 0 \r 1460 | \r 1461 | """) 1462 | 1463 | def read_config(self, configfile): 1464 | """ Read Config from file """ 1465 | self.providers = OrderedDict() 1466 | 1467 | try: 1468 | tree = ET.ElementTree(file=configfile) 1469 | provider_num = 0 1470 | for node in tree.findall('.//supplier'): 1471 | provider = ProviderConfig() 1472 | 1473 | if node is not None: 1474 | for child in node: 1475 | if child.tag == 'name': 1476 | provider.name = '' if child.text is None else child.text.strip() 1477 | if child.tag == 'enabled': 1478 | provider.enabled = True if child.text == '1' else False 1479 | if child.tag == 'settingslevel': 1480 | provider.settings_level = '' if child.text is None else child.text.strip() 1481 | if child.tag == 'm3uurl': 1482 | provider.m3u_url = '' if child.text is None else child.text.strip() 1483 | if child.tag == 'epgurl': 1484 | provider.epg_url = '' if child.text is None else child.text.strip() 1485 | if child.tag == 'username': 1486 | provider.username = '' if child.text is None else child.text.strip() 1487 | if child.tag == 'password': 1488 | provider.password = '' if child.text is None else child.text.strip() 1489 | if child.tag == 'providerupdate': 1490 | provider.provider_update_url = '' if child.text is None else child.text.strip() 1491 | if child.tag == 'providerhideurls': 1492 | provider.provider_hide_urls = True if child.text == '1' else False 1493 | if child.tag == 'iptvtypes': 1494 | provider.iptv_types = True if child.text == '1' else False 1495 | if child.tag == 'streamtypetv': 1496 | provider.streamtype_tv = '' if child.text is None else child.text.strip() 1497 | if child.tag == 'streamtypevod': 1498 | provider.streamtype_vod = '' if child.text is None else child.text.strip() 1499 | if child.tag == 'multivod': 1500 | provider.multi_vod = True if child.text == '1' else False 1501 | if child.tag == 'allbouquet': 1502 | provider.all_bouquet = True if child.text == '1' else False 1503 | if child.tag == 'picons': 1504 | provider.picons = True if child.text == '1' else False 1505 | if child.tag == 'iconpath': 1506 | provider.icon_path = '' if child.text is None else child.text.strip() 1507 | if child.tag == 'xcludesref': 1508 | provider.sref_override = True if child.text == '0' else False 1509 | if child.tag == 'bouqueturl': 1510 | provider.bouquet_url = '' if child.text is None else child.text.strip() 1511 | if child.tag == 'bouquetdownload': 1512 | provider.bouquet_download = True if child.text == '1' else False 1513 | if child.tag == 'bouquettop': 1514 | provider.bouquet_top = True if child.text == '1' else False 1515 | if child.tag == 'lastproviderupdate': 1516 | provider.last_provider_update = 0 if child.text is None else child.text.strip() 1517 | provider.num = provider_num 1518 | 1519 | if provider.name: 1520 | self.providers[provider.name] = provider 1521 | provider_num += 1 1522 | except Exception, e: 1523 | msg = 'Corrupt config.xml file' 1524 | print(msg) 1525 | if DEBUG: 1526 | raise Exception(msg) 1527 | 1528 | def write_config(self): 1529 | """Write providers to config file 1530 | Manually write instead of using ElementTree so that we can format the file for easy human editing 1531 | (inc. Windows line endings) 1532 | """ 1533 | 1534 | config_file = os.path.join(os.path.join(CFGPATH, 'config.xml')) 1535 | indent = " " 1536 | 1537 | if self.providers: 1538 | with open(config_file, 'wb') as f: 1539 | f.write('\r\n') 1547 | f.write('\r\n') 1548 | 1549 | for key, provider in self.providers.iteritems(): 1550 | f.write('{}\r\n'.format(indent)) 1551 | f.write('{}{}\r\n'.format(2 * indent, xml_escape(provider.name))) 1552 | f.write('{}{}\r\n'.format(2 * indent, '1' if provider.enabled else '0')) 1553 | f.write('{}{}\r\n'.format(2 * indent, provider.settings_level)) 1554 | f.write('{} \r\n'.format(2 * indent, provider.m3u_url)) 1555 | f.write('{}\r\n'.format(2 * indent, provider.epg_url)) 1556 | f.write('{}\r\n'.format(2 * indent, provider.username)) 1557 | f.write('{}\r\n'.format(2 * indent, provider.password)) 1558 | f.write('{}\r\n'.format(2 * indent, provider.provider_update_url)) 1559 | f.write('{}{}\r\n'.format(2 * indent, '1' if provider.provider_hide_urls else '0')) 1560 | f.write('{}{}\r\n'.format(2 * indent, '1' if provider.iptv_types else '0')) 1561 | f.write('{}{}\r\n'.format(2 * indent, provider.streamtype_tv)) 1562 | f.write('{}{}\r\n'.format(2 * indent, provider.streamtype_vod)) 1563 | f.write('{}{}\r\n'.format(2 * indent, '1' if provider.multi_vod else '0')) 1564 | f.write('{}{}\r\n'.format(2 * indent, '1' if provider.all_bouquet else '0')) 1565 | f.write('{}{}\r\n'.format(2 * indent, '1' if provider.picons else '0')) 1566 | f.write('{}{}\r\n'.format(2 * indent, provider.icon_path if provider.icon_path else '')) 1567 | f.write('{}{}\r\n'.format(2 * indent, '0' if provider.sref_override else '1')) 1568 | f.write('{}\r\n'.format(2 * indent, provider.bouquet_url)) 1569 | f.write('{}{}\r\n'.format(2 * indent, '1' if provider.bouquet_download else '0')) 1570 | f.write('{}{}\r\n'.format(2 * indent, '1' if provider.bouquet_top else '0')) 1571 | f.write('{}{}\r\n'.format(2 * indent, provider.last_provider_update)) 1572 | f.write('{}\r\n'.format(indent)) 1573 | f.write('\r\n') 1574 | else: 1575 | # no providers delete config file 1576 | if os.path.isfile(os.path.join(CFGPATH, 'config.xml')): 1577 | print('no providers remove config') 1578 | os.remove(os.path.join(CFGPATH, 'config.xml')) 1579 | 1580 | 1581 | def main(argv=None): # IGNORE:C0111 1582 | # Command line options. 1583 | if argv is None: 1584 | argv = sys.argv 1585 | else: 1586 | sys.argv.extend(argv) 1587 | program_name = os.path.basename(sys.argv[0]) 1588 | program_version = "v%s" % __version__ 1589 | program_build_date = str(__updated__) 1590 | program_version_message = '%(prog)s {} ({})'.format(program_version, program_build_date) 1591 | program_shortdesc = __doc__.split("\n")[1] 1592 | program_license = """{} 1593 | 1594 | Copyright 2017. All rights reserved. 1595 | Created on {}. 1596 | Licensed under GNU GENERAL PUBLIC LICENSE version 3 1597 | Distributed on an "AS IS" basis without warranties 1598 | or conditions of any kind, either express or implied. 1599 | 1600 | USAGE 1601 | """.format(program_shortdesc, str(__date__)) 1602 | 1603 | try: 1604 | # Setup argument parser 1605 | parser = get_parser_args(program_license, program_version_message) 1606 | args = parser.parse_args() 1607 | uninstall = args.uninstall 1608 | 1609 | # Core program logic starts here 1610 | urllib._urlopener = AppUrlOpener() 1611 | socket.setdefaulttimeout(30) 1612 | display_welcome() 1613 | 1614 | if uninstall: 1615 | # Clean up any existing files 1616 | uninstaller() 1617 | # reload bouquets 1618 | reload_bouquets() 1619 | print("Uninstall only, program exiting ...") 1620 | sys.exit(1) # Quit here if we just want to uninstall 1621 | else: 1622 | make_config_folder() 1623 | 1624 | # create provider from command line based setup (if passed) 1625 | args_config = ProviderConfig() 1626 | args_config.m3u_url = args.m3uurl 1627 | args_config.epg_url = args.epgurl 1628 | args_config.iptv_types = args.iptvtypes 1629 | args_config.multi_vod = args.multivod 1630 | args_config.all_bouquet = args.allbouquet 1631 | args_config.bouquet_url = args.bouqueturl 1632 | args_config.bouquet_download = args.bouquetdownload 1633 | args_config.picons = args.picons 1634 | args_config.icon_path = args.iconpath 1635 | args_config.sref_override = not args.xcludesref 1636 | args_config.bouquet_top = args.bouquettop 1637 | args_config.name = args.providername 1638 | args_config.username = args.username 1639 | args_config.password = args.password 1640 | args_config.streamtype_tv = args.sttv 1641 | args_config.streamtype_vod = args.stvod 1642 | 1643 | if args_config.m3u_url: 1644 | print('\n**************************************') 1645 | print('E2m3u2bouquet - Command line based setup') 1646 | print('**************************************\n') 1647 | args_provider = Provider(args_config) 1648 | args_provider.process_provider() 1649 | reload_bouquets() 1650 | display_end_msg() 1651 | else: 1652 | print('\n********************************') 1653 | print('E2m3u2bouquet - Config based setup') 1654 | print('********************************\n') 1655 | e2m3u2b_config = Config() 1656 | if os.path.isfile(os.path.join(CFGPATH, 'config.xml')): 1657 | e2m3u2b_config.read_config(os.path.join(CFGPATH, 'config.xml')) 1658 | providers_updated = False 1659 | 1660 | for key, provider_config in e2m3u2b_config.providers.iteritems(): 1661 | if provider_config.enabled: 1662 | if provider_config.name.startswith('Supplier Name'): 1663 | print("Please enter your details in the config file in - {}".format(os.path.join(CFGPATH, 'config.xml'))) 1664 | sys.exit(2) 1665 | else: 1666 | print('\n********************************') 1667 | print('Config based setup - {}'.format(provider_config.name.encode('utf-8'))) 1668 | print('********************************\n') 1669 | provider = Provider(provider_config) 1670 | 1671 | if int(time.time()) - int(provider.config.last_provider_update) > 21600: 1672 | # wait at least 6 hours (21600s) between update checks 1673 | providers_updated = provider.provider_update() 1674 | provider.process_provider() 1675 | else: 1676 | print('\nProvider: {} is disabled - skipping.........\n'.format(provider_config.name)) 1677 | 1678 | if providers_updated: 1679 | e2m3u2b_config.write_config() 1680 | 1681 | reload_bouquets() 1682 | display_end_msg() 1683 | else: 1684 | e2m3u2b_config.make_default_config(os.path.join(CFGPATH, 'config.xml')) 1685 | print('Please ensure correct command line options are passed to the program \n' 1686 | 'or populate the config file in {} \n' 1687 | 'for help use --help\n'.format(os.path.join(CFGPATH, 'config.xml'))) 1688 | parser.print_usage() 1689 | sys.exit(1) 1690 | 1691 | except KeyboardInterrupt: 1692 | # handle keyboard interrupt 1693 | return 0 1694 | 1695 | except Exception, e: 1696 | if DEBUG: 1697 | raise e 1698 | indent = len(program_name) * " " 1699 | sys.stderr.write(program_name + ": " + repr(e) + "\n") 1700 | sys.stderr.write(indent + " for help use --help") 1701 | return 2 1702 | 1703 | if __name__ == "__main__": 1704 | if TESTRUN: 1705 | EPGIMPORTPATH = "H:/Satelite Stuff/epgimport/" 1706 | ENIGMAPATH = "H:/Satelite Stuff/enigma2/" 1707 | PICONSPATH = "H:/Satelite Stuff/picons/" 1708 | CFGPATH = os.path.join(ENIGMAPATH, 'e2m3u2bouquet/') 1709 | sys.exit(main()) 1710 | else: 1711 | IMPORTED = True 1712 | -------------------------------------------------------------------------------- /generator.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | IPTV Bouquet Install Generator 5 | 37 | 38 | 39 |

IPTV Bouquet Install Generator

40 | 41 |

This is a simple page that will generate a install command for the plugin.

42 | 43 |

This page does not send or store any of your details it runs entirley within your browser.

44 | 45 |

To use enter your providers hostname and port e.g. http://www.suls.co.uk:8080 then your username and password.

46 | 47 |

Once you press Generate the one line install command will be shown. Connect to your box (i.e. using PuTTY) and then paste in the command.

48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /generator_config.xml: -------------------------------------------------------------------------------- 1 | 9 | 10 | 11 | IPTV 12 | 1 13 | simple 14 | 15 | 16 | 17 | 18 | 19 | 0 20 | 0 21 | 22 | 23 | 0 24 | 0 25 | 0 26 | 1 27 | 28 | 0 29 | 0 30 | 31 | 32 | -------------------------------------------------------------------------------- /providers.enc: -------------------------------------------------------------------------------- 1 | QUwtUFRWLGh0dHA6Ly9hbHBhc3NtYW4uZGRucy5uZXQ6ODAvZ2V0LnBocD91c2VybmFtZT1VU0VSTkFNRSZwYXNzd29yZD1QQVNTV09SRCZ0eXBlPW0zdV9wbHVzJm91dHB1dD10cyxodHRwOi8vYWxwYXNzbWFuLmRkbnMubmV0OjgwL3htbHR2LnBocD91c2VybmFtZT1VU0VSTkFNRSZwYXNzd29yZD1QQVNTV09SRCw3LDgsMSw1Cg== 2 | QVNPSVBUVixodHRwOi8vYXNvaXB0di5jb206OTAwMC9nZXQucGhwP3VzZXJuYW1lPVVTRVJ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Qo= 49 | V1NTUFJFTUlVTSxodHRwOi8vd3NzcHJlbWl1bS5jb206ODAvZ2V0LnBocD91c2VybmFtZT1VU0VSTkFNRSZwYXNzd29yZD1QQVNTV09SRCZ0eXBlPW0zdV9wbHVzJm91dHB1dD10cyxodHRwOi8vd3NzcHJlbWl1bS5jb206ODAveG1sdHYucGhwP3VzZXJuYW1lPVVTRVJOQU1FJnBhc3N3b3JkPVBBU1NXT1JELDcsOCwxLDUK 50 | WFNUUkVBTVNVSyxodHRwOi8veHN0cmVhbXNVSy5kZG5zLm5ldDo4MDgwL2dldC5waHA/dXNlcm5hbWU9VVNFUk5BTUUmcGFzc3dvcmQ9UEFTU1dPUkQmdHlwZT1tM3VfcGx1cyZvdXRwdXQ9dHMsaHR0cDovL3hzdHJlYW1zVUsuZGRucy5uZXQ6ODA4MC94bWx0di5waHA/dXNlcm5hbWU9VVNFUk5BTUUmcGFzc3dvcmQ9UEFTU1dPUkQsNyw4LDEsNQo= 51 | WTJLLGh0dHA6Ly9raW5nLWJveC5jbHViOjgwL2dldC5waHA/dXNlcm5hbWU9VVNFUk5BTUUmcGFzc3dvcmQ9UEFTU1dPUkQmdHlwZT1tM3VfcGx1cyZvdXRwdXQ9dHMsaHR0cDovL2tpbmctYm94LmNsdWI6ODAveG1sdHYucGhwP3VzZXJuYW1lPVVTRVJOQU1FJnBhc3N3b3JkPVBBU1NXT1JELDcsOCwxLDUK 52 | --------------------------------------------------------------------------------