├── .github └── workflows │ └── pypi-publish.yaml ├── .gitignore ├── LICENSE ├── README.md ├── poetry.lock ├── pyproject.toml └── uploadgram ├── __init__.py ├── config.py ├── get_config.py ├── humanbytes.py ├── progress.py ├── run_shell_command.py ├── shell.py ├── take_screen_shot.py ├── time_formatter.py ├── upload.py └── uploadgram.py /.github/workflows/pypi-publish.yaml: -------------------------------------------------------------------------------- 1 | name: Publish to PyPI 2 | 3 | on: 4 | workflow_dispatch: 5 | release: 6 | types: [published] 7 | 8 | jobs: 9 | pypi_release: 10 | name: Builds Using Poetry and Publishes to PyPI 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v2 14 | - uses: actions/setup-python@v2 15 | - name: Install Poetry 16 | uses: snok/install-poetry@v1 17 | - name: Get Poetry version 18 | run: poetry --version 19 | - name: Check pyproject.toml validity 20 | run: | 21 | poetry lock 22 | poetry check --no-interaction 23 | - name: Setup package 24 | run: poetry install --no-interaction 25 | - run: poetry config pypi-token.pypi "${{ secrets.PYPI_TOKEN }}" 26 | - name: Publish package 27 | run: poetry publish --build 28 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.session 2 | config.ini 3 | *.egg-info 4 | build 5 | dist 6 | __pycache__ 7 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU AFFERO GENERAL PUBLIC LICENSE 2 | Version 3, 19 November 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 Affero General Public License is a free, copyleft license for 11 | software and other kinds of works, specifically designed to ensure 12 | cooperation with the community in the case of network server software. 13 | 14 | The licenses for most software and other practical works are designed 15 | to take away your freedom to share and change the works. By contrast, 16 | our General Public Licenses are intended to guarantee your freedom to 17 | share and change all versions of a program--to make sure it remains free 18 | software for all its users. 19 | 20 | When we speak of free software, we are referring to freedom, not 21 | price. Our General Public Licenses are designed to make sure that you 22 | have the freedom to distribute copies of free software (and charge for 23 | them if you wish), that you receive source code or can get it if you 24 | want it, that you can change the software or use pieces of it in new 25 | free programs, and that you know you can do these things. 26 | 27 | Developers that use our General Public Licenses protect your rights 28 | with two steps: (1) assert copyright on the software, and (2) offer 29 | you this License which gives you legal permission to copy, distribute 30 | and/or modify the software. 31 | 32 | A secondary benefit of defending all users' freedom is that 33 | improvements made in alternate versions of the program, if they 34 | receive widespread use, become available for other developers to 35 | incorporate. Many developers of free software are heartened and 36 | encouraged by the resulting cooperation. However, in the case of 37 | software used on network servers, this result may fail to come about. 38 | The GNU General Public License permits making a modified version and 39 | letting the public access it on a server without ever releasing its 40 | source code to the public. 41 | 42 | The GNU Affero General Public License is designed specifically to 43 | ensure that, in such cases, the modified source code becomes available 44 | to the community. It requires the operator of a network server to 45 | provide the source code of the modified version running there to the 46 | users of that server. Therefore, public use of a modified version, on 47 | a publicly accessible server, gives the public access to the source 48 | code of the modified version. 49 | 50 | An older license, called the Affero General Public License and 51 | published by Affero, was designed to accomplish similar goals. This is 52 | a different license, not a version of the Affero GPL, but Affero has 53 | released a new version of the Affero GPL which permits relicensing under 54 | this license. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | TERMS AND CONDITIONS 60 | 61 | 0. Definitions. 62 | 63 | "This License" refers to version 3 of the GNU Affero General Public License. 64 | 65 | "Copyright" also means copyright-like laws that apply to other kinds of 66 | works, such as semiconductor masks. 67 | 68 | "The Program" refers to any copyrightable work licensed under this 69 | License. Each licensee is addressed as "you". "Licensees" and 70 | "recipients" may be individuals or organizations. 71 | 72 | To "modify" a work means to copy from or adapt all or part of the work 73 | in a fashion requiring copyright permission, other than the making of an 74 | exact copy. The resulting work is called a "modified version" of the 75 | earlier work or a work "based on" the earlier work. 76 | 77 | A "covered work" means either the unmodified Program or a work based 78 | on the Program. 79 | 80 | To "propagate" a work means to do anything with it that, without 81 | permission, would make you directly or secondarily liable for 82 | infringement under applicable copyright law, except executing it on a 83 | computer or modifying a private copy. Propagation includes copying, 84 | distribution (with or without modification), making available to the 85 | public, and in some countries other activities as well. 86 | 87 | To "convey" a work means any kind of propagation that enables other 88 | parties to make or receive copies. Mere interaction with a user through 89 | a computer network, with no transfer of a copy, is not conveying. 90 | 91 | An interactive user interface displays "Appropriate Legal Notices" 92 | to the extent that it includes a convenient and prominently visible 93 | feature that (1) displays an appropriate copyright notice, and (2) 94 | tells the user that there is no warranty for the work (except to the 95 | extent that warranties are provided), that licensees may convey the 96 | work under this License, and how to view a copy of this License. If 97 | the interface presents a list of user commands or options, such as a 98 | menu, a prominent item in the list meets this criterion. 99 | 100 | 1. Source Code. 101 | 102 | The "source code" for a work means the preferred form of the work 103 | for making modifications to it. "Object code" means any non-source 104 | form of a work. 105 | 106 | A "Standard Interface" means an interface that either is an official 107 | standard defined by a recognized standards body, or, in the case of 108 | interfaces specified for a particular programming language, one that 109 | is widely used among developers working in that language. 110 | 111 | The "System Libraries" of an executable work include anything, other 112 | than the work as a whole, that (a) is included in the normal form of 113 | packaging a Major Component, but which is not part of that Major 114 | Component, and (b) serves only to enable use of the work with that 115 | Major Component, or to implement a Standard Interface for which an 116 | implementation is available to the public in source code form. A 117 | "Major Component", in this context, means a major essential component 118 | (kernel, window system, and so on) of the specific operating system 119 | (if any) on which the executable work runs, or a compiler used to 120 | produce the work, or an object code interpreter used to run it. 121 | 122 | The "Corresponding Source" for a work in object code form means all 123 | the source code needed to generate, install, and (for an executable 124 | work) run the object code and to modify the work, including scripts to 125 | control those activities. However, it does not include the work's 126 | System Libraries, or general-purpose tools or generally available free 127 | programs which are used unmodified in performing those activities but 128 | which are not part of the work. For example, Corresponding Source 129 | includes interface definition files associated with source files for 130 | the work, and the source code for shared libraries and dynamically 131 | linked subprograms that the work is specifically designed to require, 132 | such as by intimate data communication or control flow between those 133 | subprograms and other parts of the work. 134 | 135 | The Corresponding Source need not include anything that users 136 | can regenerate automatically from other parts of the Corresponding 137 | Source. 138 | 139 | The Corresponding Source for a work in source code form is that 140 | same work. 141 | 142 | 2. Basic Permissions. 143 | 144 | All rights granted under this License are granted for the term of 145 | copyright on the Program, and are irrevocable provided the stated 146 | conditions are met. This License explicitly affirms your unlimited 147 | permission to run the unmodified Program. The output from running a 148 | covered work is covered by this License only if the output, given its 149 | content, constitutes a covered work. This License acknowledges your 150 | rights of fair use or other equivalent, as provided by copyright law. 151 | 152 | You may make, run and propagate covered works that you do not 153 | convey, without conditions so long as your license otherwise remains 154 | in force. You may convey covered works to others for the sole purpose 155 | of having them make modifications exclusively for you, or provide you 156 | with facilities for running those works, provided that you comply with 157 | the terms of this License in conveying all material for which you do 158 | not control copyright. Those thus making or running the covered works 159 | for you must do so exclusively on your behalf, under your direction 160 | and control, on terms that prohibit them from making any copies of 161 | your copyrighted material outside their relationship with you. 162 | 163 | Conveying under any other circumstances is permitted solely under 164 | the conditions stated below. Sublicensing is not allowed; section 10 165 | makes it unnecessary. 166 | 167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 168 | 169 | No covered work shall be deemed part of an effective technological 170 | measure under any applicable law fulfilling obligations under article 171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 172 | similar laws prohibiting or restricting circumvention of such 173 | measures. 174 | 175 | When you convey a covered work, you waive any legal power to forbid 176 | circumvention of technological measures to the extent such circumvention 177 | is effected by exercising rights under this License with respect to 178 | the covered work, and you disclaim any intention to limit operation or 179 | modification of the work as a means of enforcing, against the work's 180 | users, your or third parties' legal rights to forbid circumvention of 181 | technological measures. 182 | 183 | 4. Conveying Verbatim Copies. 184 | 185 | You may convey verbatim copies of the Program's source code as you 186 | receive it, in any medium, provided that you conspicuously and 187 | appropriately publish on each copy an appropriate copyright notice; 188 | keep intact all notices stating that this License and any 189 | non-permissive terms added in accord with section 7 apply to the code; 190 | keep intact all notices of the absence of any warranty; and give all 191 | recipients a copy of this License along with the Program. 192 | 193 | You may charge any price or no price for each copy that you convey, 194 | and you may offer support or warranty protection for a fee. 195 | 196 | 5. Conveying Modified Source Versions. 197 | 198 | You may convey a work based on the Program, or the modifications to 199 | produce it from the Program, in the form of source code under the 200 | terms of section 4, provided that you also meet all of these conditions: 201 | 202 | a) The work must carry prominent notices stating that you modified 203 | it, and giving a relevant date. 204 | 205 | b) The work must carry prominent notices stating that it is 206 | released under this License and any conditions added under section 207 | 7. This requirement modifies the requirement in section 4 to 208 | "keep intact all notices". 209 | 210 | c) You must license the entire work, as a whole, under this 211 | License to anyone who comes into possession of a copy. This 212 | License will therefore apply, along with any applicable section 7 213 | additional terms, to the whole of the work, and all its parts, 214 | regardless of how they are packaged. This License gives no 215 | permission to license the work in any other way, but it does not 216 | invalidate such permission if you have separately received it. 217 | 218 | d) If the work has interactive user interfaces, each must display 219 | Appropriate Legal Notices; however, if the Program has interactive 220 | interfaces that do not display Appropriate Legal Notices, your 221 | work need not make them do so. 222 | 223 | A compilation of a covered work with other separate and independent 224 | works, which are not by their nature extensions of the covered work, 225 | and which are not combined with it such as to form a larger program, 226 | in or on a volume of a storage or distribution medium, is called an 227 | "aggregate" if the compilation and its resulting copyright are not 228 | used to limit the access or legal rights of the compilation's users 229 | beyond what the individual works permit. Inclusion of a covered work 230 | in an aggregate does not cause this License to apply to the other 231 | parts of the aggregate. 232 | 233 | 6. Conveying Non-Source Forms. 234 | 235 | You may convey a covered work in object code form under the terms 236 | of sections 4 and 5, provided that you also convey the 237 | machine-readable Corresponding Source under the terms of this License, 238 | in one of these ways: 239 | 240 | a) Convey the object code in, or embodied in, a physical product 241 | (including a physical distribution medium), accompanied by the 242 | Corresponding Source fixed on a durable physical medium 243 | customarily used for software interchange. 244 | 245 | b) Convey the object code in, or embodied in, a physical product 246 | (including a physical distribution medium), accompanied by a 247 | written offer, valid for at least three years and valid for as 248 | long as you offer spare parts or customer support for that product 249 | model, to give anyone who possesses the object code either (1) a 250 | copy of the Corresponding Source for all the software in the 251 | product that is covered by this License, on a durable physical 252 | medium customarily used for software interchange, for a price no 253 | more than your reasonable cost of physically performing this 254 | conveying of source, or (2) access to copy the 255 | Corresponding Source from a network server at no charge. 256 | 257 | c) Convey individual copies of the object code with a copy of the 258 | written offer to provide the Corresponding Source. This 259 | alternative is allowed only occasionally and noncommercially, and 260 | only if you received the object code with such an offer, in accord 261 | with subsection 6b. 262 | 263 | d) Convey the object code by offering access from a designated 264 | place (gratis or for a charge), and offer equivalent access to the 265 | Corresponding Source in the same way through the same place at no 266 | further charge. You need not require recipients to copy the 267 | Corresponding Source along with the object code. If the place to 268 | copy the object code is a network server, the Corresponding Source 269 | may be on a different server (operated by you or a third party) 270 | that supports equivalent copying facilities, provided you maintain 271 | clear directions next to the object code saying where to find the 272 | Corresponding Source. Regardless of what server hosts the 273 | Corresponding Source, you remain obligated to ensure that it is 274 | available for as long as needed to satisfy these requirements. 275 | 276 | e) Convey the object code using peer-to-peer transmission, provided 277 | you inform other peers where the object code and Corresponding 278 | Source of the work are being offered to the general public at no 279 | charge under subsection 6d. 280 | 281 | A separable portion of the object code, whose source code is excluded 282 | from the Corresponding Source as a System Library, need not be 283 | included in conveying the object code work. 284 | 285 | A "User Product" is either (1) a "consumer product", which means any 286 | tangible personal property which is normally used for personal, family, 287 | or household purposes, or (2) anything designed or sold for incorporation 288 | into a dwelling. In determining whether a product is a consumer product, 289 | doubtful cases shall be resolved in favor of coverage. For a particular 290 | product received by a particular user, "normally used" refers to a 291 | typical or common use of that class of product, regardless of the status 292 | of the particular user or of the way in which the particular user 293 | actually uses, or expects or is expected to use, the product. A product 294 | is a consumer product regardless of whether the product has substantial 295 | commercial, industrial or non-consumer uses, unless such uses represent 296 | the only significant mode of use of the product. 297 | 298 | "Installation Information" for a User Product means any methods, 299 | procedures, authorization keys, or other information required to install 300 | and execute modified versions of a covered work in that User Product from 301 | a modified version of its Corresponding Source. The information must 302 | suffice to ensure that the continued functioning of the modified object 303 | code is in no case prevented or interfered with solely because 304 | modification has been made. 305 | 306 | If you convey an object code work under this section in, or with, or 307 | specifically for use in, a User Product, and the conveying occurs as 308 | part of a transaction in which the right of possession and use of the 309 | User Product is transferred to the recipient in perpetuity or for a 310 | fixed term (regardless of how the transaction is characterized), the 311 | Corresponding Source conveyed under this section must be accompanied 312 | by the Installation Information. But this requirement does not apply 313 | if neither you nor any third party retains the ability to install 314 | modified object code on the User Product (for example, the work has 315 | been installed in ROM). 316 | 317 | The requirement to provide Installation Information does not include a 318 | requirement to continue to provide support service, warranty, or updates 319 | for a work that has been modified or installed by the recipient, or for 320 | the User Product in which it has been modified or installed. Access to a 321 | network may be denied when the modification itself materially and 322 | adversely affects the operation of the network or violates the rules and 323 | protocols for communication across the network. 324 | 325 | Corresponding Source conveyed, and Installation Information provided, 326 | in accord with this section must be in a format that is publicly 327 | documented (and with an implementation available to the public in 328 | source code form), and must require no special password or key for 329 | unpacking, reading or copying. 330 | 331 | 7. Additional Terms. 332 | 333 | "Additional permissions" are terms that supplement the terms of this 334 | License by making exceptions from one or more of its conditions. 335 | Additional permissions that are applicable to the entire Program shall 336 | be treated as though they were included in this License, to the extent 337 | that they are valid under applicable law. If additional permissions 338 | apply only to part of the Program, that part may be used separately 339 | under those permissions, but the entire Program remains governed by 340 | this License without regard to the additional permissions. 341 | 342 | When you convey a copy of a covered work, you may at your option 343 | remove any additional permissions from that copy, or from any part of 344 | it. (Additional permissions may be written to require their own 345 | removal in certain cases when you modify the work.) You may place 346 | additional permissions on material, added by you to a covered work, 347 | for which you have or can give appropriate copyright permission. 348 | 349 | Notwithstanding any other provision of this License, for material you 350 | add to a covered work, you may (if authorized by the copyright holders of 351 | that material) supplement the terms of this License with terms: 352 | 353 | a) Disclaiming warranty or limiting liability differently from the 354 | terms of sections 15 and 16 of this License; or 355 | 356 | b) Requiring preservation of specified reasonable legal notices or 357 | author attributions in that material or in the Appropriate Legal 358 | Notices displayed by works containing it; or 359 | 360 | c) Prohibiting misrepresentation of the origin of that material, or 361 | requiring that modified versions of such material be marked in 362 | reasonable ways as different from the original version; or 363 | 364 | d) Limiting the use for publicity purposes of names of licensors or 365 | authors of the material; or 366 | 367 | e) Declining to grant rights under trademark law for use of some 368 | trade names, trademarks, or service marks; or 369 | 370 | f) Requiring indemnification of licensors and authors of that 371 | material by anyone who conveys the material (or modified versions of 372 | it) with contractual assumptions of liability to the recipient, for 373 | any liability that these contractual assumptions directly impose on 374 | those licensors and authors. 375 | 376 | All other non-permissive additional terms are considered "further 377 | restrictions" within the meaning of section 10. If the Program as you 378 | received it, or any part of it, contains a notice stating that it is 379 | governed by this License along with a term that is a further 380 | restriction, you may remove that term. If a license document contains 381 | a further restriction but permits relicensing or conveying under this 382 | License, you may add to a covered work material governed by the terms 383 | of that license document, provided that the further restriction does 384 | not survive such relicensing or conveying. 385 | 386 | If you add terms to a covered work in accord with this section, you 387 | must place, in the relevant source files, a statement of the 388 | additional terms that apply to those files, or a notice indicating 389 | where to find the applicable terms. 390 | 391 | Additional terms, permissive or non-permissive, may be stated in the 392 | form of a separately written license, or stated as exceptions; 393 | the above requirements apply either way. 394 | 395 | 8. Termination. 396 | 397 | You may not propagate or modify a covered work except as expressly 398 | provided under this License. Any attempt otherwise to propagate or 399 | modify it is void, and will automatically terminate your rights under 400 | this License (including any patent licenses granted under the third 401 | paragraph of section 11). 402 | 403 | However, if you cease all violation of this License, then your 404 | license from a particular copyright holder is reinstated (a) 405 | provisionally, unless and until the copyright holder explicitly and 406 | finally terminates your license, and (b) permanently, if the copyright 407 | holder fails to notify you of the violation by some reasonable means 408 | prior to 60 days after the cessation. 409 | 410 | Moreover, your license from a particular copyright holder is 411 | reinstated permanently if the copyright holder notifies you of the 412 | violation by some reasonable means, this is the first time you have 413 | received notice of violation of this License (for any work) from that 414 | copyright holder, and you cure the violation prior to 30 days after 415 | your receipt of the notice. 416 | 417 | Termination of your rights under this section does not terminate the 418 | licenses of parties who have received copies or rights from you under 419 | this License. If your rights have been terminated and not permanently 420 | reinstated, you do not qualify to receive new licenses for the same 421 | material under section 10. 422 | 423 | 9. Acceptance Not Required for Having Copies. 424 | 425 | You are not required to accept this License in order to receive or 426 | run a copy of the Program. Ancillary propagation of a covered work 427 | occurring solely as a consequence of using peer-to-peer transmission 428 | to receive a copy likewise does not require acceptance. However, 429 | nothing other than this License grants you permission to propagate or 430 | modify any covered work. These actions infringe copyright if you do 431 | not accept this License. Therefore, by modifying or propagating a 432 | covered work, you indicate your acceptance of this License to do so. 433 | 434 | 10. Automatic Licensing of Downstream Recipients. 435 | 436 | Each time you convey a covered work, the recipient automatically 437 | receives a license from the original licensors, to run, modify and 438 | propagate that work, subject to this License. You are not responsible 439 | for enforcing compliance by third parties with this License. 440 | 441 | An "entity transaction" is a transaction transferring control of an 442 | organization, or substantially all assets of one, or subdividing an 443 | organization, or merging organizations. If propagation of a covered 444 | work results from an entity transaction, each party to that 445 | transaction who receives a copy of the work also receives whatever 446 | licenses to the work the party's predecessor in interest had or could 447 | give under the previous paragraph, plus a right to possession of the 448 | Corresponding Source of the work from the predecessor in interest, if 449 | the predecessor has it or can get it with reasonable efforts. 450 | 451 | You may not impose any further restrictions on the exercise of the 452 | rights granted or affirmed under this License. For example, you may 453 | not impose a license fee, royalty, or other charge for exercise of 454 | rights granted under this License, and you may not initiate litigation 455 | (including a cross-claim or counterclaim in a lawsuit) alleging that 456 | any patent claim is infringed by making, using, selling, offering for 457 | sale, or importing the Program or any portion of it. 458 | 459 | 11. Patents. 460 | 461 | A "contributor" is a copyright holder who authorizes use under this 462 | License of the Program or a work on which the Program is based. The 463 | work thus licensed is called the contributor's "contributor version". 464 | 465 | A contributor's "essential patent claims" are all patent claims 466 | owned or controlled by the contributor, whether already acquired or 467 | hereafter acquired, that would be infringed by some manner, permitted 468 | by this License, of making, using, or selling its contributor version, 469 | but do not include claims that would be infringed only as a 470 | consequence of further modification of the contributor version. For 471 | purposes of this definition, "control" includes the right to grant 472 | patent sublicenses in a manner consistent with the requirements of 473 | this License. 474 | 475 | Each contributor grants you a non-exclusive, worldwide, royalty-free 476 | patent license under the contributor's essential patent claims, to 477 | make, use, sell, offer for sale, import and otherwise run, modify and 478 | propagate the contents of its contributor version. 479 | 480 | In the following three paragraphs, a "patent license" is any express 481 | agreement or commitment, however denominated, not to enforce a patent 482 | (such as an express permission to practice a patent or covenant not to 483 | sue for patent infringement). To "grant" such a patent license to a 484 | party means to make such an agreement or commitment not to enforce a 485 | patent against the party. 486 | 487 | If you convey a covered work, knowingly relying on a patent license, 488 | and the Corresponding Source of the work is not available for anyone 489 | to copy, free of charge and under the terms of this License, through a 490 | publicly available network server or other readily accessible means, 491 | then you must either (1) cause the Corresponding Source to be so 492 | available, or (2) arrange to deprive yourself of the benefit of the 493 | patent license for this particular work, or (3) arrange, in a manner 494 | consistent with the requirements of this License, to extend the patent 495 | license to downstream recipients. "Knowingly relying" means you have 496 | actual knowledge that, but for the patent license, your conveying the 497 | covered work in a country, or your recipient's use of the covered work 498 | in a country, would infringe one or more identifiable patents in that 499 | country that you have reason to believe are valid. 500 | 501 | If, pursuant to or in connection with a single transaction or 502 | arrangement, you convey, or propagate by procuring conveyance of, a 503 | covered work, and grant a patent license to some of the parties 504 | receiving the covered work authorizing them to use, propagate, modify 505 | or convey a specific copy of the covered work, then the patent license 506 | you grant is automatically extended to all recipients of the covered 507 | work and works based on it. 508 | 509 | A patent license is "discriminatory" if it does not include within 510 | the scope of its coverage, prohibits the exercise of, or is 511 | conditioned on the non-exercise of one or more of the rights that are 512 | specifically granted under this License. You may not convey a covered 513 | work if you are a party to an arrangement with a third party that is 514 | in the business of distributing software, under which you make payment 515 | to the third party based on the extent of your activity of conveying 516 | the work, and under which the third party grants, to any of the 517 | parties who would receive the covered work from you, a discriminatory 518 | patent license (a) in connection with copies of the covered work 519 | conveyed by you (or copies made from those copies), or (b) primarily 520 | for and in connection with specific products or compilations that 521 | contain the covered work, unless you entered into that arrangement, 522 | or that patent license was granted, prior to 28 March 2007. 523 | 524 | Nothing in this License shall be construed as excluding or limiting 525 | any implied license or other defenses to infringement that may 526 | otherwise be available to you under applicable patent law. 527 | 528 | 12. No Surrender of Others' Freedom. 529 | 530 | If conditions are imposed on you (whether by court order, agreement or 531 | otherwise) that contradict the conditions of this License, they do not 532 | excuse you from the conditions of this License. If you cannot convey a 533 | covered work so as to satisfy simultaneously your obligations under this 534 | License and any other pertinent obligations, then as a consequence you may 535 | not convey it at all. For example, if you agree to terms that obligate you 536 | to collect a royalty for further conveying from those to whom you convey 537 | the Program, the only way you could satisfy both those terms and this 538 | License would be to refrain entirely from conveying the Program. 539 | 540 | 13. Remote Network Interaction; Use with the GNU General Public License. 541 | 542 | Notwithstanding any other provision of this License, if you modify the 543 | Program, your modified version must prominently offer all users 544 | interacting with it remotely through a computer network (if your version 545 | supports such interaction) an opportunity to receive the Corresponding 546 | Source of your version by providing access to the Corresponding Source 547 | from a network server at no charge, through some standard or customary 548 | means of facilitating copying of software. This Corresponding Source 549 | shall include the Corresponding Source for any work covered by version 3 550 | of the GNU General Public License that is incorporated pursuant to the 551 | following paragraph. 552 | 553 | Notwithstanding any other provision of this License, you have 554 | permission to link or combine any covered work with a work licensed 555 | under version 3 of the GNU General Public License into a single 556 | combined work, and to convey the resulting work. The terms of this 557 | License will continue to apply to the part which is the covered work, 558 | but the work with which it is combined will remain governed by version 559 | 3 of the GNU General Public License. 560 | 561 | 14. Revised Versions of this License. 562 | 563 | The Free Software Foundation may publish revised and/or new versions of 564 | the GNU Affero General Public License from time to time. Such new versions 565 | will be similar in spirit to the present version, but may differ in detail to 566 | address new problems or concerns. 567 | 568 | Each version is given a distinguishing version number. If the 569 | Program specifies that a certain numbered version of the GNU Affero General 570 | Public License "or any later version" applies to it, you have the 571 | option of following the terms and conditions either of that numbered 572 | version or of any later version published by the Free Software 573 | Foundation. If the Program does not specify a version number of the 574 | GNU Affero General Public License, you may choose any version ever published 575 | by the Free Software Foundation. 576 | 577 | If the Program specifies that a proxy can decide which future 578 | versions of the GNU Affero General Public License can be used, that proxy's 579 | public statement of acceptance of a version permanently authorizes you 580 | to choose that version for the Program. 581 | 582 | Later license versions may give you additional or different 583 | permissions. However, no additional obligations are imposed on any 584 | author or copyright holder as a result of your choosing to follow a 585 | later version. 586 | 587 | 15. Disclaimer of Warranty. 588 | 589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 597 | 598 | 16. Limitation of Liability. 599 | 600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 608 | SUCH DAMAGES. 609 | 610 | 17. Interpretation of Sections 15 and 16. 611 | 612 | If the disclaimer of warranty and limitation of liability provided 613 | above cannot be given local legal effect according to their terms, 614 | reviewing courts shall apply local law that most closely approximates 615 | an absolute waiver of all civil liability in connection with the 616 | Program, unless a warranty or assumption of liability accompanies a 617 | copy of the Program in return for a fee. 618 | 619 | END OF TERMS AND CONDITIONS 620 | 621 | How to Apply These Terms to Your New Programs 622 | 623 | If you develop a new program, and you want it to be of the greatest 624 | possible use to the public, the best way to achieve this is to make it 625 | free software which everyone can redistribute and change under these terms. 626 | 627 | To do so, attach the following notices to the program. It is safest 628 | to attach them to the start of each source file to most effectively 629 | state the exclusion of warranty; and each file should have at least 630 | the "copyright" line and a pointer to where the full notice is found. 631 | 632 | 633 | Copyright (C) 634 | 635 | This program is free software: you can redistribute it and/or modify 636 | it under the terms of the GNU Affero General Public License as published 637 | by the Free Software Foundation, either version 3 of the License, or 638 | (at your option) any later version. 639 | 640 | This program is distributed in the hope that it will be useful, 641 | but WITHOUT ANY WARRANTY; without even the implied warranty of 642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 643 | GNU Affero General Public License for more details. 644 | 645 | You should have received a copy of the GNU Affero General Public License 646 | along with this program. If not, see . 647 | 648 | Also add information on how to contact you by electronic and paper mail. 649 | 650 | If your software can interact with users remotely through a computer 651 | network, you should also make sure that it provides a way for users to 652 | get its source. For example, if your program is a web application, its 653 | interface could display a "Source" link that leads users to an archive 654 | of the code. There are many ways you could offer source, and different 655 | solutions will be better for different programs; see section 13 for the 656 | specific requirements. 657 | 658 | You should also get your employer (if you work as a programmer) or school, 659 | if any, to sign a "copyright disclaimer" for the program, if necessary. 660 | For more information on this, and how to apply and follow the GNU AGPL, see 661 | . -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## uploadgram 2 | 3 | uploadgram uses your Telegram account to upload files up to 2GiB, from the Terminal. 4 | 5 | - Heavily inspired by the [telegram-upload](https://github.com/Nekmo/telegram-upload) 6 | 7 | - Installing: 8 | 9 | `pip install uploadgram` 10 | 11 | - Requirements: 12 | 13 | a customized fork of `pyrogram` 14 | 15 | 16 | # Sample Usage 17 | 18 | ```sh 19 | $ uploadgram 7351948 /path/to/dir/or/file --delete_on_success True --fd True -t /path/to/custom/thumbnail --caption "A Custom Caption" --topic 1 20 | ``` 21 | -------------------------------------------------------------------------------- /poetry.lock: -------------------------------------------------------------------------------- 1 | [[package]] 2 | name = "appdirs" 3 | version = "1.4.4" 4 | description = "A small Python module for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." 5 | category = "dev" 6 | optional = false 7 | python-versions = "*" 8 | 9 | [[package]] 10 | name = "atomicwrites" 11 | version = "1.4.1" 12 | description = "Atomic file writes." 13 | category = "dev" 14 | optional = false 15 | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" 16 | 17 | [[package]] 18 | name = "attrs" 19 | version = "22.1.0" 20 | description = "Classes Without Boilerplate" 21 | category = "dev" 22 | optional = false 23 | python-versions = ">=3.5" 24 | 25 | [package.extras] 26 | dev = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "mypy (>=0.900,!=0.940)", "pytest-mypy-plugins", "zope.interface", "furo", "sphinx", "sphinx-notfound-page", "pre-commit", "cloudpickle"] 27 | docs = ["furo", "sphinx", "zope.interface", "sphinx-notfound-page"] 28 | tests = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "mypy (>=0.900,!=0.940)", "pytest-mypy-plugins", "zope.interface", "cloudpickle"] 29 | tests_no_zope = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "mypy (>=0.900,!=0.940)", "pytest-mypy-plugins", "cloudpickle"] 30 | 31 | [[package]] 32 | name = "autoflake" 33 | version = "1.4" 34 | description = "Removes unused imports and unused variables" 35 | category = "dev" 36 | optional = false 37 | python-versions = "*" 38 | 39 | [package.dependencies] 40 | pyflakes = ">=1.1.0" 41 | 42 | [[package]] 43 | name = "autopep8" 44 | version = "1.6.0" 45 | description = "A tool that automatically formats Python code to conform to the PEP 8 style guide" 46 | category = "dev" 47 | optional = false 48 | python-versions = "*" 49 | 50 | [package.dependencies] 51 | pycodestyle = ">=2.8.0" 52 | toml = "*" 53 | 54 | [[package]] 55 | name = "black" 56 | version = "20.8b1" 57 | description = "The uncompromising code formatter." 58 | category = "dev" 59 | optional = false 60 | python-versions = ">=3.6" 61 | 62 | [package.dependencies] 63 | appdirs = "*" 64 | click = ">=7.1.2" 65 | mypy-extensions = ">=0.4.3" 66 | pathspec = ">=0.6,<1" 67 | regex = ">=2020.1.8" 68 | toml = ">=0.10.1" 69 | typed-ast = ">=1.4.0" 70 | typing-extensions = ">=3.7.4" 71 | 72 | [package.extras] 73 | colorama = ["colorama (>=0.4.3)"] 74 | d = ["aiohttp (>=3.3.2)", "aiohttp-cors"] 75 | 76 | [[package]] 77 | name = "click" 78 | version = "8.1.3" 79 | description = "Composable command line interface toolkit" 80 | category = "dev" 81 | optional = false 82 | python-versions = ">=3.7" 83 | 84 | [package.dependencies] 85 | colorama = {version = "*", markers = "platform_system == \"Windows\""} 86 | importlib-metadata = {version = "*", markers = "python_version < \"3.8\""} 87 | 88 | [[package]] 89 | name = "colorama" 90 | version = "0.4.5" 91 | description = "Cross-platform colored terminal text." 92 | category = "main" 93 | optional = false 94 | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" 95 | 96 | [[package]] 97 | name = "hachoir" 98 | version = "3.1.1" 99 | description = "Package of Hachoir parsers used to open binary files" 100 | category = "main" 101 | optional = false 102 | python-versions = "*" 103 | 104 | [package.extras] 105 | urwid = ["urwid (==1.3.1)"] 106 | 107 | [[package]] 108 | name = "importlib-metadata" 109 | version = "4.12.0" 110 | description = "Read metadata from Python packages" 111 | category = "dev" 112 | optional = false 113 | python-versions = ">=3.7" 114 | 115 | [package.dependencies] 116 | typing-extensions = {version = ">=3.6.4", markers = "python_version < \"3.8\""} 117 | zipp = ">=0.5" 118 | 119 | [package.extras] 120 | docs = ["sphinx", "jaraco.packaging (>=9)", "rst.linker (>=1.9)"] 121 | perf = ["ipython"] 122 | testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-cov", "pytest-enabler (>=1.3)", "packaging", "pyfakefs", "flufl.flake8", "pytest-perf (>=0.9.2)", "pytest-black (>=0.3.7)", "pytest-mypy (>=0.9.1)", "importlib-resources (>=1.3)"] 123 | 124 | [[package]] 125 | name = "isort" 126 | version = "5.10.1" 127 | description = "A Python utility / library to sort Python imports." 128 | category = "dev" 129 | optional = false 130 | python-versions = ">=3.6.1,<4.0" 131 | 132 | [package.extras] 133 | pipfile_deprecated_finder = ["pipreqs", "requirementslib"] 134 | requirements_deprecated_finder = ["pipreqs", "pip-api"] 135 | colors = ["colorama (>=0.4.3,<0.5.0)"] 136 | plugins = ["setuptools"] 137 | 138 | [[package]] 139 | name = "more-itertools" 140 | version = "8.13.0" 141 | description = "More routines for operating on iterables, beyond itertools" 142 | category = "dev" 143 | optional = false 144 | python-versions = ">=3.5" 145 | 146 | [[package]] 147 | name = "mypy-extensions" 148 | version = "0.4.3" 149 | description = "Experimental type system extensions for programs checked with the mypy typechecker." 150 | category = "dev" 151 | optional = false 152 | python-versions = "*" 153 | 154 | [[package]] 155 | name = "packaging" 156 | version = "21.3" 157 | description = "Core utilities for Python packages" 158 | category = "dev" 159 | optional = false 160 | python-versions = ">=3.6" 161 | 162 | [package.dependencies] 163 | pyparsing = ">=2.0.2,<3.0.5 || >3.0.5" 164 | 165 | [[package]] 166 | name = "pathspec" 167 | version = "0.9.0" 168 | description = "Utility library for gitignore style pattern matching of file paths." 169 | category = "dev" 170 | optional = false 171 | python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" 172 | 173 | [[package]] 174 | name = "pluggy" 175 | version = "0.13.1" 176 | description = "plugin and hook calling mechanisms for python" 177 | category = "dev" 178 | optional = false 179 | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" 180 | 181 | [package.dependencies] 182 | importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} 183 | 184 | [package.extras] 185 | dev = ["pre-commit", "tox"] 186 | 187 | [[package]] 188 | name = "py" 189 | version = "1.11.0" 190 | description = "library with cross-python path, ini-parsing, io, code, log facilities" 191 | category = "dev" 192 | optional = false 193 | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" 194 | 195 | [[package]] 196 | name = "pyaes" 197 | version = "1.6.1" 198 | description = "Pure-Python Implementation of the AES block-cipher and common modes of operation" 199 | category = "main" 200 | optional = false 201 | python-versions = "*" 202 | 203 | [[package]] 204 | name = "pycodestyle" 205 | version = "2.8.0" 206 | description = "Python style guide checker" 207 | category = "dev" 208 | optional = false 209 | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" 210 | 211 | [[package]] 212 | name = "pyflakes" 213 | version = "2.4.0" 214 | description = "passive checker of Python programs" 215 | category = "dev" 216 | optional = false 217 | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" 218 | 219 | [[package]] 220 | name = "pyparsing" 221 | version = "3.0.9" 222 | description = "pyparsing module - Classes and methods to define and execute parsing grammars" 223 | category = "dev" 224 | optional = false 225 | python-versions = ">=3.6.8" 226 | 227 | [package.extras] 228 | diagrams = ["railroad-diagrams", "jinja2"] 229 | 230 | [[package]] 231 | name = "pyrogram" 232 | version = "2.0.35" 233 | description = "Elegant, modern and asynchronous Telegram MTProto API framework in Python for users and bots" 234 | category = "main" 235 | optional = false 236 | python-versions = "~=3.7" 237 | 238 | [package.dependencies] 239 | pyaes = "1.6.1" 240 | pysocks = "1.7.1" 241 | 242 | [[package]] 243 | name = "pysocks" 244 | version = "1.7.1" 245 | description = "A Python SOCKS client module. See https://github.com/Anorov/PySocks for more information." 246 | category = "main" 247 | optional = false 248 | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" 249 | 250 | [[package]] 251 | name = "pytest" 252 | version = "5.4.3" 253 | description = "pytest: simple powerful testing with Python" 254 | category = "dev" 255 | optional = false 256 | python-versions = ">=3.5" 257 | 258 | [package.dependencies] 259 | atomicwrites = {version = ">=1.0", markers = "sys_platform == \"win32\""} 260 | attrs = ">=17.4.0" 261 | colorama = {version = "*", markers = "sys_platform == \"win32\""} 262 | importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} 263 | more-itertools = ">=4.0.0" 264 | packaging = "*" 265 | pluggy = ">=0.12,<1.0" 266 | py = ">=1.5.0" 267 | wcwidth = "*" 268 | 269 | [package.extras] 270 | checkqa-mypy = ["mypy (==v0.761)"] 271 | testing = ["argcomplete", "hypothesis (>=3.56)", "mock", "nose", "requests", "xmlschema"] 272 | 273 | [[package]] 274 | name = "python-dotenv" 275 | version = "0.10.0" 276 | description = "Add .env support to your django/flask apps in development and deployments" 277 | category = "main" 278 | optional = false 279 | python-versions = "*" 280 | 281 | [package.extras] 282 | cli = ["click (>=5.0)"] 283 | 284 | [[package]] 285 | name = "regex" 286 | version = "2022.7.25" 287 | description = "Alternative regular expression module, to replace re." 288 | category = "dev" 289 | optional = false 290 | python-versions = ">=3.6" 291 | 292 | [[package]] 293 | name = "tgcrypto" 294 | version = "1.2.3" 295 | description = "Fast and Portable Cryptography Extension Library for Pyrogram" 296 | category = "main" 297 | optional = false 298 | python-versions = "~=3.6" 299 | 300 | [[package]] 301 | name = "toml" 302 | version = "0.10.2" 303 | description = "Python Library for Tom's Obvious, Minimal Language" 304 | category = "dev" 305 | optional = false 306 | python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" 307 | 308 | [[package]] 309 | name = "tqdm" 310 | version = "4.62.3" 311 | description = "Fast, Extensible Progress Meter" 312 | category = "main" 313 | optional = false 314 | python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,>=2.7" 315 | 316 | [package.dependencies] 317 | colorama = {version = "*", markers = "platform_system == \"Windows\""} 318 | 319 | [package.extras] 320 | dev = ["py-make (>=0.1.0)", "twine", "wheel"] 321 | notebook = ["ipywidgets (>=6)"] 322 | telegram = ["requests"] 323 | 324 | [[package]] 325 | name = "typed-ast" 326 | version = "1.5.4" 327 | description = "a fork of Python 2 and 3 ast modules with type comment support" 328 | category = "dev" 329 | optional = false 330 | python-versions = ">=3.6" 331 | 332 | [[package]] 333 | name = "typing-extensions" 334 | version = "4.3.0" 335 | description = "Backported and Experimental Type Hints for Python 3.7+" 336 | category = "dev" 337 | optional = false 338 | python-versions = ">=3.7" 339 | 340 | [[package]] 341 | name = "wcwidth" 342 | version = "0.2.5" 343 | description = "Measures the displayed width of unicode strings in a terminal" 344 | category = "dev" 345 | optional = false 346 | python-versions = "*" 347 | 348 | [[package]] 349 | name = "zipp" 350 | version = "3.8.1" 351 | description = "Backport of pathlib-compatible object wrapper for zip files" 352 | category = "dev" 353 | optional = false 354 | python-versions = ">=3.7" 355 | 356 | [package.extras] 357 | docs = ["sphinx", "jaraco.packaging (>=9)", "rst.linker (>=1.9)", "jaraco.tidelift (>=1.4)"] 358 | testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-cov", "pytest-enabler (>=1.3)", "jaraco.itertools", "func-timeout", "pytest-black (>=0.3.7)", "pytest-mypy (>=0.9.1)"] 359 | 360 | [metadata] 361 | lock-version = "1.1" 362 | python-versions = ">=3.7.7,<4" 363 | content-hash = "5144235b814b47721401b8101c3c2dd5302c6a89e1a6ef1630fca01d224b7ba1" 364 | 365 | [metadata.files] 366 | appdirs = [ 367 | {file = "appdirs-1.4.4-py2.py3-none-any.whl", hash = "sha256:a841dacd6b99318a741b166adb07e19ee71a274450e68237b4650ca1055ab128"}, 368 | {file = "appdirs-1.4.4.tar.gz", hash = "sha256:7d5d0167b2b1ba821647616af46a749d1c653740dd0d2415100fe26e27afdf41"}, 369 | ] 370 | atomicwrites = [] 371 | attrs = [] 372 | autoflake = [ 373 | {file = "autoflake-1.4.tar.gz", hash = "sha256:61a353012cff6ab94ca062823d1fb2f692c4acda51c76ff83a8d77915fba51ea"}, 374 | ] 375 | autopep8 = [ 376 | {file = "autopep8-1.6.0-py2.py3-none-any.whl", hash = "sha256:ed77137193bbac52d029a52c59bec1b0629b5a186c495f1eb21b126ac466083f"}, 377 | {file = "autopep8-1.6.0.tar.gz", hash = "sha256:44f0932855039d2c15c4510d6df665e4730f2b8582704fa48f9c55bd3e17d979"}, 378 | ] 379 | black = [ 380 | {file = "black-20.8b1.tar.gz", hash = "sha256:1c02557aa099101b9d21496f8a914e9ed2222ef70336404eeeac8edba836fbea"}, 381 | ] 382 | click = [ 383 | {file = "click-8.1.3-py3-none-any.whl", hash = "sha256:bb4d8133cb15a609f44e8213d9b391b0809795062913b383c62be0ee95b1db48"}, 384 | {file = "click-8.1.3.tar.gz", hash = "sha256:7682dc8afb30297001674575ea00d1814d808d6a36af415a82bd481d37ba7b8e"}, 385 | ] 386 | colorama = [ 387 | {file = "colorama-0.4.5-py2.py3-none-any.whl", hash = "sha256:854bf444933e37f5824ae7bfc1e98d5bce2ebe4160d46b5edf346a89358e99da"}, 388 | {file = "colorama-0.4.5.tar.gz", hash = "sha256:e6c6b4334fc50988a639d9b98aa429a0b57da6e17b9a44f0451f930b6967b7a4"}, 389 | ] 390 | hachoir = [ 391 | {file = "hachoir-3.1.1-py3-none-any.whl", hash = "sha256:353a1efc84a971a0fe6f85e425f2d1d23ab5e702d2c8a0d12da62115a33cbb7d"}, 392 | {file = "hachoir-3.1.1.tar.gz", hash = "sha256:0aa71a39f8c32d3e65902285fefd155d96c2beaec2697a230b67709aaf73140c"}, 393 | ] 394 | importlib-metadata = [] 395 | isort = [ 396 | {file = "isort-5.10.1-py3-none-any.whl", hash = "sha256:6f62d78e2f89b4500b080fe3a81690850cd254227f27f75c3a0c491a1f351ba7"}, 397 | {file = "isort-5.10.1.tar.gz", hash = "sha256:e8443a5e7a020e9d7f97f1d7d9cd17c88bcb3bc7e218bf9cf5095fe550be2951"}, 398 | ] 399 | more-itertools = [ 400 | {file = "more-itertools-8.13.0.tar.gz", hash = "sha256:a42901a0a5b169d925f6f217cd5a190e32ef54360905b9c39ee7db5313bfec0f"}, 401 | {file = "more_itertools-8.13.0-py3-none-any.whl", hash = "sha256:c5122bffc5f104d37c1626b8615b511f3427aa5389b94d61e5ef8236bfbc3ddb"}, 402 | ] 403 | mypy-extensions = [ 404 | {file = "mypy_extensions-0.4.3-py2.py3-none-any.whl", hash = "sha256:090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d"}, 405 | {file = "mypy_extensions-0.4.3.tar.gz", hash = "sha256:2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8"}, 406 | ] 407 | packaging = [ 408 | {file = "packaging-21.3-py3-none-any.whl", hash = "sha256:ef103e05f519cdc783ae24ea4e2e0f508a9c99b2d4969652eed6a2e1ea5bd522"}, 409 | {file = "packaging-21.3.tar.gz", hash = "sha256:dd47c42927d89ab911e606518907cc2d3a1f38bbd026385970643f9c5b8ecfeb"}, 410 | ] 411 | pathspec = [ 412 | {file = "pathspec-0.9.0-py2.py3-none-any.whl", hash = "sha256:7d15c4ddb0b5c802d161efc417ec1a2558ea2653c2e8ad9c19098201dc1c993a"}, 413 | {file = "pathspec-0.9.0.tar.gz", hash = "sha256:e564499435a2673d586f6b2130bb5b95f04a3ba06f81b8f895b651a3c76aabb1"}, 414 | ] 415 | pluggy = [ 416 | {file = "pluggy-0.13.1-py2.py3-none-any.whl", hash = "sha256:966c145cd83c96502c3c3868f50408687b38434af77734af1e9ca461a4081d2d"}, 417 | {file = "pluggy-0.13.1.tar.gz", hash = "sha256:15b2acde666561e1298d71b523007ed7364de07029219b604cf808bfa1c765b0"}, 418 | ] 419 | py = [ 420 | {file = "py-1.11.0-py2.py3-none-any.whl", hash = "sha256:607c53218732647dff4acdfcd50cb62615cedf612e72d1724fb1a0cc6405b378"}, 421 | {file = "py-1.11.0.tar.gz", hash = "sha256:51c75c4126074b472f746a24399ad32f6053d1b34b68d2fa41e558e6f4a98719"}, 422 | ] 423 | pyaes = [ 424 | {file = "pyaes-1.6.1.tar.gz", hash = "sha256:02c1b1405c38d3c370b085fb952dd8bea3fadcee6411ad99f312cc129c536d8f"}, 425 | ] 426 | pycodestyle = [ 427 | {file = "pycodestyle-2.8.0-py2.py3-none-any.whl", hash = "sha256:720f8b39dde8b293825e7ff02c475f3077124006db4f440dcbc9a20b76548a20"}, 428 | {file = "pycodestyle-2.8.0.tar.gz", hash = "sha256:eddd5847ef438ea1c7870ca7eb78a9d47ce0cdb4851a5523949f2601d0cbbe7f"}, 429 | ] 430 | pyflakes = [ 431 | {file = "pyflakes-2.4.0-py2.py3-none-any.whl", hash = "sha256:3bb3a3f256f4b7968c9c788781e4ff07dce46bdf12339dcda61053375426ee2e"}, 432 | {file = "pyflakes-2.4.0.tar.gz", hash = "sha256:05a85c2872edf37a4ed30b0cce2f6093e1d0581f8c19d7393122da7e25b2b24c"}, 433 | ] 434 | pyparsing = [ 435 | {file = "pyparsing-3.0.9-py3-none-any.whl", hash = "sha256:5026bae9a10eeaefb61dab2f09052b9f4307d44aee4eda64b309723d8d206bbc"}, 436 | {file = "pyparsing-3.0.9.tar.gz", hash = "sha256:2b020ecf7d21b687f219b71ecad3631f644a47f01403fa1d1036b0c6416d70fb"}, 437 | ] 438 | pyrogram = [] 439 | pysocks = [ 440 | {file = "PySocks-1.7.1-py27-none-any.whl", hash = "sha256:08e69f092cc6dbe92a0fdd16eeb9b9ffbc13cadfe5ca4c7bd92ffb078b293299"}, 441 | {file = "PySocks-1.7.1-py3-none-any.whl", hash = "sha256:2725bd0a9925919b9b51739eea5f9e2bae91e83288108a9ad338b2e3a4435ee5"}, 442 | {file = "PySocks-1.7.1.tar.gz", hash = "sha256:3f8804571ebe159c380ac6de37643bb4685970655d3bba243530d6558b799aa0"}, 443 | ] 444 | pytest = [ 445 | {file = "pytest-5.4.3-py3-none-any.whl", hash = "sha256:5c0db86b698e8f170ba4582a492248919255fcd4c79b1ee64ace34301fb589a1"}, 446 | {file = "pytest-5.4.3.tar.gz", hash = "sha256:7979331bfcba207414f5e1263b5a0f8f521d0f457318836a7355531ed1a4c7d8"}, 447 | ] 448 | python-dotenv = [ 449 | {file = "python-dotenv-0.10.0.tar.gz", hash = "sha256:4f3582904d08dac5ab4c9aa44cb17ce056c9a35e585cfda6183d80054d247307"}, 450 | {file = "python_dotenv-0.10.0-py2.py3-none-any.whl", hash = "sha256:cb8cd327109898c7725f76c5256a081e8a9efe72ebbf127f8d1221ceb7f38bf2"}, 451 | ] 452 | regex = [] 453 | tgcrypto = [ 454 | {file = "TgCrypto-1.2.3-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:266cfc47dde87e23421b2ee50cbb066ec4b8c294553f79742e3d694af5c0d118"}, 455 | {file = "TgCrypto-1.2.3-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:ab3f759180b17d252dd57f018dff9190dc0e96e5ff3aeb90b598e2ab2f81f57e"}, 456 | {file = "TgCrypto-1.2.3-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:8f69a8a73c37f99bc265df5e071f0506e2815d001362f117c6f7db13c9a1859e"}, 457 | {file = "TgCrypto-1.2.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:51f0b1f75533b01c4109ee332e48d9f6734fb286cebe8385c8b1393ba183b693"}, 458 | {file = "TgCrypto-1.2.3-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:6fd9f9ba1ec042430539a895377f18260dd9833a8eacb52121457756bb26419d"}, 459 | {file = "TgCrypto-1.2.3-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:af738c072d721eb8a0d39b0d6140193c0e848f6cb34071ff573b4dd5c094b499"}, 460 | {file = "TgCrypto-1.2.3-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:9f0a07a7112fcdc1c5c84a3b72de4c2d96ef45edc51e542bd7f998b2305b74c8"}, 461 | {file = "TgCrypto-1.2.3-cp310-cp310-win32.whl", hash = "sha256:d58bd811d1a533cbe0e10677152c75edee01b9c893edea6e455678dbf271313f"}, 462 | {file = "TgCrypto-1.2.3-cp310-cp310-win_amd64.whl", hash = "sha256:8e29b62061bc97f1de5176f2c91891b0c614b0de6b1999a0a477faaa61159748"}, 463 | {file = "TgCrypto-1.2.3-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:7ccb42db80af53d109753be139bb7f6b9cf9e6281e847619860964a8a7edf019"}, 464 | {file = "TgCrypto-1.2.3-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4a2d5cfdf06eabfdc3027257cc28ce3d42922644f33f523308e69644af5843c4"}, 465 | {file = "TgCrypto-1.2.3-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:adcc983f85812892f77fed9c96a9751b4c18e63cd5b8ea76836f778304d7a9db"}, 466 | {file = "TgCrypto-1.2.3-cp36-cp36m-musllinux_1_1_i686.whl", hash = "sha256:307035717383ea256d1c629675610f007d127d67ef786e0055a127b53f6fa589"}, 467 | {file = "TgCrypto-1.2.3-cp36-cp36m-musllinux_1_1_x86_64.whl", hash = "sha256:281672bfb51b3e30be1a0f29717007d0e815c323afe5c802f07e551099934e62"}, 468 | {file = "TgCrypto-1.2.3-cp36-cp36m-win32.whl", hash = "sha256:438316dc58ef75bb5f7f2e4521e942c3e797966b7262d0b5880bf84c59c2ba48"}, 469 | {file = "TgCrypto-1.2.3-cp36-cp36m-win_amd64.whl", hash = "sha256:c385a651f83f710fba150f8fba8774cfd0b2c234123de747c486cf46f8d182f6"}, 470 | {file = "TgCrypto-1.2.3-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:84932e93b6582a4abc8c64dd4b94a3b903d946f1d4ea4cbb7fe6bc1d49e7620a"}, 471 | {file = "TgCrypto-1.2.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:97ced03b6fc66fd6074e07e90411ad2fb85d18f6110f5947ce29d5390f325b3e"}, 472 | {file = "TgCrypto-1.2.3-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:9c2dcd16acd9a25ab9e6f83eb93fdeb8c3d892c76cd8157a75a045a343f5c98d"}, 473 | {file = "TgCrypto-1.2.3-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:3b0628dea2e06f59315ec373902f7b1b6562abba0e82c60d6843648bf1311e4b"}, 474 | {file = "TgCrypto-1.2.3-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:90cf802e42fa187fbb3fb4de23b5c8b0a7bff946c2a6be31ff6b37254b00f254"}, 475 | {file = "TgCrypto-1.2.3-cp37-cp37m-win32.whl", hash = "sha256:ba1976374a7b72c12f51eb3efcf291c56cc316eebfaea9c5db0c98c5fc149c33"}, 476 | {file = "TgCrypto-1.2.3-cp37-cp37m-win_amd64.whl", hash = "sha256:bf553cc9088c7b6c502cbaa495d7c0b8ae035c56ff77e6c932efd2415ee13532"}, 477 | {file = "TgCrypto-1.2.3-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:c0efdf3d38320ddaafa145da1b2fce2abbdb9fc32d94538e2782e41da57ffe53"}, 478 | {file = "TgCrypto-1.2.3-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:6e0ec261992ddb50081fbf2094ce6eaf97d880717b0e100caf74783cca317799"}, 479 | {file = "TgCrypto-1.2.3-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:5c0b5d6d1e6133e4ce283228df22c83ff5f760a169075eac1c493194462038c7"}, 480 | {file = "TgCrypto-1.2.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2a036ad285536723540f4071a3f23d312104dc728906dfafd9bba0ca5c8ebfb6"}, 481 | {file = "TgCrypto-1.2.3-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4d5f139da89e4bfaca3b7667fe889fb1c14c818f85e3ef3f029d16575ac10b83"}, 482 | {file = "TgCrypto-1.2.3-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:f549f1164de67548327593362ae4f94435510b6d1c194e5579d3f0379f91bb71"}, 483 | {file = "TgCrypto-1.2.3-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:8aef7d1d88fe051dae5a9a331e78e27f031a7290bed5d5f4f07a440e9d836bbb"}, 484 | {file = "TgCrypto-1.2.3-cp38-cp38-win32.whl", hash = "sha256:2a6ae87e32f5e94494eb37af29fd4e9d9560752f701922614b03fc6b2e6b9011"}, 485 | {file = "TgCrypto-1.2.3-cp38-cp38-win_amd64.whl", hash = "sha256:056845a5e368d6e4e94b2b773ab0529dd5d5d65b04dc1fa051f63be7ff7e7a3a"}, 486 | {file = "TgCrypto-1.2.3-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:17bd13f6c99a784f43fbcd410a80c18f078dadea71d049718caf255f6510895f"}, 487 | {file = "TgCrypto-1.2.3-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:8536befb9bf952bf986e83d02fbebd65f6465b574d8ed3f3456c3e97ccd9122a"}, 488 | {file = "TgCrypto-1.2.3-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:268ad4b8a8e5b5e6b13435d0d57b91ccb4a2af9e1c893b014ea42f1b43b1966c"}, 489 | {file = "TgCrypto-1.2.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e0106d780ca971f00376e28ccc3f4d45a29665f3cbe2b7b118141ecd85fe4c2d"}, 490 | {file = "TgCrypto-1.2.3-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:148fc9c40fdbd059655062c1eec612f8ace2d6d2a9158016472771ef04b06599"}, 491 | {file = "TgCrypto-1.2.3-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:42caf6e96742e8bce1a66bf7c6d48832ea1617f0a165e1c767ccde9d1889ba0f"}, 492 | {file = "TgCrypto-1.2.3-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:8d44117d9e57fc15425517fb363bd8757c2340b1fce464b1bef3dd69d828ed60"}, 493 | {file = "TgCrypto-1.2.3-cp39-cp39-win32.whl", hash = "sha256:3199d2666f00bffd6c373190bc0f8153a7de1bf00da2cc585c877bb43a57b8d9"}, 494 | {file = "TgCrypto-1.2.3-cp39-cp39-win_amd64.whl", hash = "sha256:fdba12358104453fef2b9f46ae7e364eadd8f857cd39ab6ab94a94bd4b246efc"}, 495 | {file = "TgCrypto-1.2.3-pp37-pypy37_pp73-macosx_10_9_x86_64.whl", hash = "sha256:d2ccda26a5f3377242f926a88b65d46c4b5b7d515304ceaefc39543b3ee5fdc8"}, 496 | {file = "TgCrypto-1.2.3-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6bd38f118732c5ebc43fab7cd20ea4f53d0e2367a86169d22af98c2bca9bf8aa"}, 497 | {file = "TgCrypto-1.2.3-pp37-pypy37_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:064caf3b1fdb7b923271130416fe6b2ab1ba695db83375011f39f49df3af202c"}, 498 | {file = "TgCrypto-1.2.3-pp37-pypy37_pp73-win_amd64.whl", hash = "sha256:76d038ae370bef184d7ece6505573857f1229cb8ef54b93def820734d4baa3d8"}, 499 | {file = "TgCrypto-1.2.3-pp38-pypy38_pp73-macosx_10_9_x86_64.whl", hash = "sha256:dde446012dd5395efdce266a4c25267217586f0296981385e79774dd60c69df1"}, 500 | {file = "TgCrypto-1.2.3-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5857bdd18359fda4680f2557b12e32e911ae08a1651e241c76d37130bf7e8bef"}, 501 | {file = "TgCrypto-1.2.3-pp38-pypy38_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:8adabe5b55e78882a81d2a1aa8248ecb2767dc7305dde5f241e5e80208c8328c"}, 502 | {file = "TgCrypto-1.2.3-pp38-pypy38_pp73-win_amd64.whl", hash = "sha256:8515d2f54d02937f40bb169ad733a9b7e9ba360d1fdef0c3d396af433c1ce474"}, 503 | {file = "TgCrypto-1.2.3.tar.gz", hash = "sha256:87a7f4c722972645f20ec140499bf71672ba921d4ae85b33d3a7ab96c7c9d1b4"}, 504 | ] 505 | toml = [ 506 | {file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"}, 507 | {file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"}, 508 | ] 509 | tqdm = [ 510 | {file = "tqdm-4.62.3-py2.py3-none-any.whl", hash = "sha256:8dd278a422499cd6b727e6ae4061c40b48fce8b76d1ccbf5d34fca9b7f925b0c"}, 511 | {file = "tqdm-4.62.3.tar.gz", hash = "sha256:d359de7217506c9851b7869f3708d8ee53ed70a1b8edbba4dbcb47442592920d"}, 512 | ] 513 | typed-ast = [ 514 | {file = "typed_ast-1.5.4-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:669dd0c4167f6f2cd9f57041e03c3c2ebf9063d0757dc89f79ba1daa2bfca9d4"}, 515 | {file = "typed_ast-1.5.4-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:211260621ab1cd7324e0798d6be953d00b74e0428382991adfddb352252f1d62"}, 516 | {file = "typed_ast-1.5.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:267e3f78697a6c00c689c03db4876dd1efdfea2f251a5ad6555e82a26847b4ac"}, 517 | {file = "typed_ast-1.5.4-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:c542eeda69212fa10a7ada75e668876fdec5f856cd3d06829e6aa64ad17c8dfe"}, 518 | {file = "typed_ast-1.5.4-cp310-cp310-win_amd64.whl", hash = "sha256:a9916d2bb8865f973824fb47436fa45e1ebf2efd920f2b9f99342cb7fab93f72"}, 519 | {file = "typed_ast-1.5.4-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:79b1e0869db7c830ba6a981d58711c88b6677506e648496b1f64ac7d15633aec"}, 520 | {file = "typed_ast-1.5.4-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a94d55d142c9265f4ea46fab70977a1944ecae359ae867397757d836ea5a3f47"}, 521 | {file = "typed_ast-1.5.4-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:183afdf0ec5b1b211724dfef3d2cad2d767cbefac291f24d69b00546c1837fb6"}, 522 | {file = "typed_ast-1.5.4-cp36-cp36m-win_amd64.whl", hash = "sha256:639c5f0b21776605dd6c9dbe592d5228f021404dafd377e2b7ac046b0349b1a1"}, 523 | {file = "typed_ast-1.5.4-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:cf4afcfac006ece570e32d6fa90ab74a17245b83dfd6655a6f68568098345ff6"}, 524 | {file = "typed_ast-1.5.4-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ed855bbe3eb3715fca349c80174cfcfd699c2f9de574d40527b8429acae23a66"}, 525 | {file = "typed_ast-1.5.4-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:6778e1b2f81dfc7bc58e4b259363b83d2e509a65198e85d5700dfae4c6c8ff1c"}, 526 | {file = "typed_ast-1.5.4-cp37-cp37m-win_amd64.whl", hash = "sha256:0261195c2062caf107831e92a76764c81227dae162c4f75192c0d489faf751a2"}, 527 | {file = "typed_ast-1.5.4-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:2efae9db7a8c05ad5547d522e7dbe62c83d838d3906a3716d1478b6c1d61388d"}, 528 | {file = "typed_ast-1.5.4-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:7d5d014b7daa8b0bf2eaef684295acae12b036d79f54178b92a2b6a56f92278f"}, 529 | {file = "typed_ast-1.5.4-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:370788a63915e82fd6f212865a596a0fefcbb7d408bbbb13dea723d971ed8bdc"}, 530 | {file = "typed_ast-1.5.4-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:4e964b4ff86550a7a7d56345c7864b18f403f5bd7380edf44a3c1fb4ee7ac6c6"}, 531 | {file = "typed_ast-1.5.4-cp38-cp38-win_amd64.whl", hash = "sha256:683407d92dc953c8a7347119596f0b0e6c55eb98ebebd9b23437501b28dcbb8e"}, 532 | {file = "typed_ast-1.5.4-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:4879da6c9b73443f97e731b617184a596ac1235fe91f98d279a7af36c796da35"}, 533 | {file = "typed_ast-1.5.4-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:3e123d878ba170397916557d31c8f589951e353cc95fb7f24f6bb69adc1a8a97"}, 534 | {file = "typed_ast-1.5.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ebd9d7f80ccf7a82ac5f88c521115cc55d84e35bf8b446fcd7836eb6b98929a3"}, 535 | {file = "typed_ast-1.5.4-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:98f80dee3c03455e92796b58b98ff6ca0b2a6f652120c263efdba4d6c5e58f72"}, 536 | {file = "typed_ast-1.5.4-cp39-cp39-win_amd64.whl", hash = "sha256:0fdbcf2fef0ca421a3f5912555804296f0b0960f0418c440f5d6d3abb549f3e1"}, 537 | {file = "typed_ast-1.5.4.tar.gz", hash = "sha256:39e21ceb7388e4bb37f4c679d72707ed46c2fbf2a5609b8b8ebc4b067d977df2"}, 538 | ] 539 | typing-extensions = [] 540 | wcwidth = [ 541 | {file = "wcwidth-0.2.5-py2.py3-none-any.whl", hash = "sha256:beb4802a9cebb9144e99086eff703a642a13d6a0052920003a230f3294bbe784"}, 542 | {file = "wcwidth-0.2.5.tar.gz", hash = "sha256:c4d647b99872929fdb7bdcaa4fbe7f01413ed3d98077df798530e5b04f116c83"}, 543 | ] 544 | zipp = [] 545 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.poetry] 2 | name = "uploadgram" 3 | version = "0.3.4" 4 | description ="Upload files to Telegram upto 4 GiB, from the Terminal" 5 | authors = ["Shrimadhav U K "] 6 | homepage = "https://github.com/SpEcHiDe/UploadGram" 7 | repository = "https://github.com/SpEcHiDe/UploadGram" 8 | keywords = ["telegram-upload", "telegram", "upload", "video", "audio"] 9 | license = "AGPLv3" 10 | readme = "README.md" 11 | 12 | classifiers = [ 13 | "Development Status :: 4 - Beta", 14 | "Topic :: Software Development :: Libraries :: Python Modules", 15 | "Intended Audience :: Developers", 16 | "Natural Language :: English", 17 | "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", 18 | "Programming Language :: Python", 19 | "Programming Language :: Python :: 3", 20 | "Programming Language :: Python :: 3.8", 21 | "Programming Language :: Python :: 3.9", 22 | "Programming Language :: Python :: Implementation :: CPython", 23 | "Programming Language :: Python :: Implementation :: PyPy", 24 | "Topic :: Software Development", 25 | ] 26 | 27 | [tool.poetry.dependencies] 28 | python = ">=3.7.7,<4" 29 | python-dotenv = "0.10" 30 | pyrotgfork = "2.1.33.8" 31 | TgCrypto = "1.2.5" 32 | hachoir = "3.1.1" 33 | tqdm = "4.62.3" 34 | 35 | [tool.poetry.dev-dependencies] 36 | pytest = "^5.2" 37 | isort = "^5.7.0" 38 | black = "^20.8b1" 39 | autopep8 = "^1.5.7" 40 | autoflake = "^1.4" 41 | 42 | [tool.isort] 43 | profile = "black" 44 | include_trailing_comma = true 45 | lines_after_imports = 2 46 | lines_between_types = 1 47 | use_parentheses = true 48 | filter_files = true 49 | 50 | [tool.black] 51 | line-length = 79 52 | include = '\.pyi?$' 53 | exclude = ''' 54 | /( 55 | \.git 56 | | \.hg 57 | | \.mypy_cache 58 | | \.tox 59 | | \.venv 60 | | _build 61 | | buck-out 62 | | build 63 | | dist 64 | )/ 65 | ''' 66 | 67 | [build-system] 68 | requires = ["poetry-core>=1.0.0"] 69 | build-backend = "poetry.core.masonry.api" 70 | 71 | [tool.poetry.scripts] 72 | uploadgram = "uploadgram.shell:main" 73 | -------------------------------------------------------------------------------- /uploadgram/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # Copyright (C) 2021 The Authors 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU Affero General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU Affero General Public License for more details. 12 | # You should have received a copy of the GNU Affero General Public License 13 | # along with this program. If not, see . 14 | 15 | 16 | """Top-level package for Uploadgram.""" 17 | 18 | __author__ = """SpEcHIDe""" 19 | __email__ = "uploADGRam@shrimadhavUK.me" 20 | __version__ = "0.3.4" 21 | -------------------------------------------------------------------------------- /uploadgram/config.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # Copyright (C) 2021 The Authors 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU Affero General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU Affero General Public License for more details. 12 | # You should have received a copy of the GNU Affero General Public License 13 | # along with this program. If not, see . 14 | 15 | 16 | import os 17 | from dotenv import load_dotenv 18 | from .get_config import get_config 19 | 20 | 21 | BASE_DIR = os.path.expanduser("~/.config/uploadgram/") 22 | OLD_CONFIG_FILE = os.path.join(BASE_DIR, "config.ini") 23 | if os.path.exists( 24 | OLD_CONFIG_FILE 25 | ): 26 | os.remove(OLD_CONFIG_FILE) 27 | CONFIG_FILE = os.path.join(BASE_DIR, "config.env") 28 | SESSION_FILE = os.path.join(BASE_DIR, "default") 29 | TG_VIDEO_TYPES = ( 30 | "M4V", "MP4", "MOV", "FLV", "WMV", "3GP", "MPEG", "MKV" 31 | ) 32 | TG_AUDIO_TYPES = ( 33 | "MP3", "M4A", "M4B", "FLAC", "WAV", "AIF", "OGG", "AAC", "DTS" 34 | ) 35 | 36 | 37 | def write_default_config(): 38 | """ write the default config.ini file 39 | """ 40 | if os.path.lexists(CONFIG_FILE): 41 | return load_dotenv(CONFIG_FILE) 42 | os.makedirs(BASE_DIR, exist_ok=True) 43 | print( 44 | "Go to https://my.telegram.org (or @useTGxBot) " 45 | "and create a app in API development tools" 46 | ) 47 | app_id = int(get_config("app_id ", should_prompt=True)) 48 | api_hash = get_config("api_hash ", should_prompt=True) 49 | with open(CONFIG_FILE, "w") as f: 50 | f.write(f"UG_TG_APP_ID={app_id}\n") 51 | f.write(f"UG_TG_API_HASH={api_hash}\n\n") 52 | return load_dotenv(CONFIG_FILE) 53 | 54 | 55 | write_default_config() 56 | -------------------------------------------------------------------------------- /uploadgram/get_config.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # Copyright (C) 2021 The Authors 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU Affero General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU Affero General Public License for more details. 12 | # You should have received a copy of the GNU Affero General Public License 13 | # along with this program. If not, see . 14 | 15 | """ wrapper for getting the credentials """ 16 | 17 | import os 18 | 19 | 20 | def get_config(name: str, d_v=None, should_prompt=False): 21 | """ accepts one mandatory variable 22 | and prompts for the value, if not available """ 23 | val = os.environ.get(name, d_v) 24 | if not val and should_prompt: 25 | try: 26 | val = input(f"enter {name}'s value: ") 27 | except EOFError: 28 | val = d_v 29 | print("\n") 30 | return val 31 | -------------------------------------------------------------------------------- /uploadgram/humanbytes.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # Copyright (C) 2021 The Authors 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU Affero General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU Affero General Public License for more details. 12 | # You should have received a copy of the GNU Affero General Public License 13 | # along with this program. If not, see . 14 | 15 | """ human bytes """ 16 | 17 | 18 | def humanbytes(size: int) -> str: 19 | """ converts integer to string 20 | """ 21 | # https://stackoverflow.com/a/49361727/4723940 22 | # 2**10 = 1024 23 | if not size: 24 | return "NaN" 25 | power = 2**10 26 | n = 0 27 | Dic_powerN = { 28 | 0: " ", 29 | 1: "Ki", 30 | 2: "Mi", 31 | 3: "Gi", 32 | 4: "Ti" 33 | } 34 | while size > power: 35 | size /= power 36 | n += 1 37 | return str(round(size, 2)) + " " + Dic_powerN[n] + "B" 38 | -------------------------------------------------------------------------------- /uploadgram/progress.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # Copyright (C) 2021 The Authors 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU Affero General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU Affero General Public License for more details. 12 | # You should have received a copy of the GNU Affero General Public License 13 | # along with this program. If not, see . 14 | 15 | """ progress helper """ 16 | 17 | 18 | import math 19 | from asyncio import sleep 20 | from pyrogram.errors import FloodWait 21 | from pyrogram.types import Message 22 | from time import time 23 | from .humanbytes import humanbytes 24 | from .time_formatter import time_formatter 25 | 26 | 27 | async def progress_for_pyrogram( 28 | current: int, 29 | total: int, 30 | message: Message, 31 | sfw: int, 32 | pbar: bool, 33 | ud_type: str, 34 | ): 35 | now = time() 36 | diff = now - sfw 37 | if pbar is not None: 38 | pbar.update((current / total) * 1024 * 1024) 39 | if current == total: 40 | pbar.set_description("uploaded") 41 | else: 42 | if round(diff % 10.00) == 0 or current == total: 43 | # if round(current / total * 100, 0) % 5 == 0: 44 | try: 45 | percentage = current * 100 / total 46 | except ZeroDivisionError: 47 | percentage = 0 48 | elapsed_time = round(diff) 49 | if elapsed_time == 0: 50 | return 51 | speed = current / elapsed_time 52 | time_to_completion = round((total - current) / speed) 53 | estimated_total_time = elapsed_time + time_to_completion 54 | 55 | elapsed_time = time_formatter(elapsed_time) 56 | estimated_total_time = time_formatter(estimated_total_time) 57 | 58 | progress = "[{0}{1}] \nP: {2}%\n".format( 59 | "".join(["█" for _ in range(math.floor(percentage / 5))]), 60 | "".join(["░" for _ in range(20 - math.floor(percentage / 5))]), 61 | round(percentage, 2), 62 | ) 63 | 64 | tmp = progress + "{0} of {1}\nSpeed: {2}/s\nETA: {3}\n".format( 65 | humanbytes(current), 66 | humanbytes(total), 67 | humanbytes(speed), 68 | estimated_total_time 69 | if estimated_total_time != "" 70 | else "0 seconds", 71 | ) 72 | try: 73 | await message.edit_text(text=f"{ud_type}\n {tmp}") 74 | except FloodWait as e: 75 | await sleep(e.value) 76 | except: # noqa: E722 77 | pass 78 | -------------------------------------------------------------------------------- /uploadgram/run_shell_command.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # Copyright (C) 2021 The Authors 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU Affero General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU Affero General Public License for more details. 12 | # You should have received a copy of the GNU Affero General Public License 13 | # along with this program. If not, see . 14 | 15 | 16 | import asyncio 17 | from typing import List, Tuple 18 | 19 | 20 | async def run_command(shell_command: List) -> Tuple[int, int, str, str]: 21 | """ executes a shell_command, 22 | and returns the stdout and stderr""" 23 | process = await asyncio.create_subprocess_exec( 24 | *shell_command, 25 | # stdout must a pipe to be accessible as process.stdout 26 | stdout=asyncio.subprocess.PIPE, 27 | stderr=asyncio.subprocess.PIPE, 28 | ) 29 | # Wait for the subprocess to finish 30 | stdout, stderr = await process.communicate() 31 | return ( 32 | process.pid, 33 | process.returncode, 34 | stdout.decode().strip(), 35 | stderr.decode().strip() 36 | ) 37 | -------------------------------------------------------------------------------- /uploadgram/shell.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # Copyright (C) 2021 The Authors 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU Affero General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU Affero General Public License for more details. 12 | # You should have received a copy of the GNU Affero General Public License 13 | # along with this program. If not, see . 14 | 15 | 16 | import os 17 | from typing import Union 18 | from .uploadgram import Uploadgram 19 | from .upload import upload_dir_contents 20 | 21 | 22 | async def upload( 23 | uploadgram: Uploadgram, 24 | files: str, 25 | to: Union[str, int], 26 | delete_on_success: bool = False, 27 | thumbnail_file: str = None, 28 | force_document: bool = False, 29 | custom_caption: str = None, 30 | console_progress: bool = False, 31 | message_thread_id: int = None, 32 | ): 33 | # sent a message to verify write permission in the "to" 34 | status_message = await uploadgram.send_message( 35 | chat_id=to, 36 | text=".", 37 | message_thread_id=message_thread_id 38 | ) 39 | 40 | # get the max tg file_size that is allowed for this account 41 | tg_max_file_size = 4194304000 if uploadgram.me.is_premium else 2097152000 42 | 43 | await upload_dir_contents( 44 | tg_max_file_size, 45 | files, 46 | delete_on_success, 47 | thumbnail_file, 48 | force_document, 49 | custom_caption, 50 | status_message, 51 | console_progress 52 | ) 53 | 54 | await status_message.delete() 55 | 56 | 57 | async def moin( 58 | args 59 | ): 60 | uploadgram = Uploadgram() 61 | await uploadgram.start() 62 | 63 | dest_chat = args.chat_id 64 | if not dest_chat: 65 | dest_chat = input( 66 | "enter chat_id to send the files to: " 67 | ) 68 | if ( 69 | dest_chat.isnumeric() or 70 | dest_chat.startswith("-100") 71 | ): 72 | dest_chat = int(dest_chat) 73 | dest_chat = ( 74 | await uploadgram.get_chat(dest_chat, False) 75 | ).id 76 | 77 | dir_path = args.dir_path 78 | if not dir_path: 79 | dir_path = input( 80 | "enter path to upload to Telegram: " 81 | ) 82 | while not os.path.exists(dir_path): 83 | print(os.listdir(".")) 84 | dir_path = input( 85 | "please enter valid path to upload to Telegram: " 86 | ) 87 | dir_path = os.path.abspath(dir_path) 88 | 89 | await upload( 90 | uploadgram, 91 | dir_path, 92 | dest_chat, 93 | delete_on_success=args.delete_on_success, 94 | thumbnail_file=args.t, 95 | force_document=args.fd, 96 | custom_caption=args.caption, 97 | console_progress=args.progress, 98 | message_thread_id=args.topic 99 | ) 100 | await uploadgram.stop() 101 | 102 | 103 | def main(): 104 | import asyncio 105 | import argparse 106 | parser = argparse.ArgumentParser( 107 | prog="UploadGram", 108 | description="Upload to Telegram, from the Terminal." 109 | ) 110 | parser.add_argument( 111 | "chat_id", 112 | type=str, 113 | help="chat id for this bot to send the message to", 114 | ) 115 | parser.add_argument( 116 | "dir_path", 117 | type=str, 118 | help="enter path to upload to Telegram", 119 | ) 120 | parser.add_argument( 121 | "--delete_on_success", 122 | nargs="?", 123 | type=bool, 124 | help="delete file on successful upload", 125 | default=False, 126 | required=False 127 | ) 128 | parser.add_argument( 129 | "--fd", 130 | nargs="?", 131 | type=bool, 132 | help="force uploading as documents", 133 | default=False, 134 | required=False 135 | ) 136 | parser.add_argument( 137 | "--t", 138 | nargs="?", 139 | type=str, 140 | help="thumbnail for the upload", 141 | default=None, 142 | required=False 143 | ) 144 | parser.add_argument( 145 | "--caption", 146 | nargs="?", 147 | type=str, 148 | help="custom caption for the files, instead of file_name as caption", 149 | default=None, 150 | required=False 151 | ) 152 | parser.add_argument( 153 | "--progress", 154 | nargs="?", 155 | type=bool, 156 | const=True, 157 | help="show upload progress in terminal", 158 | default=False, 159 | required=False 160 | ) 161 | parser.add_argument( 162 | "--topic", 163 | nargs="?", 164 | type=int, 165 | help="Unique identifier of the forum topic. This is a temporary type for uploading messages into a specific topic in a chat.", 166 | default=None, 167 | required=False 168 | ) 169 | args = parser.parse_args() 170 | loop = asyncio.get_event_loop() 171 | loop.run_until_complete(moin(args)) 172 | 173 | 174 | if __name__ == "__main__": 175 | main() 176 | -------------------------------------------------------------------------------- /uploadgram/take_screen_shot.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # Copyright (C) 2021 The Authors 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU Affero General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU Affero General Public License for more details. 12 | # You should have received a copy of the GNU Affero General Public License 13 | # along with this program. If not, see . 14 | 15 | 16 | import os 17 | from time import time 18 | from .config import ( 19 | TG_VIDEO_TYPES 20 | ) 21 | from .run_shell_command import run_command 22 | 23 | 24 | async def take_screen_shot( 25 | video_file: str, 26 | output_directory: str, 27 | ttl: int 28 | ): 29 | # https://stackoverflow.com/a/13891070/4723940 30 | out_put_file_name = os.path.join( 31 | output_directory, 32 | str(time()) + ".jpg" 33 | ) 34 | if video_file.upper().endswith(TG_VIDEO_TYPES): 35 | file_genertor_command = [ 36 | "ffmpeg", 37 | "-hide_banner", 38 | "-ss", 39 | str(ttl), 40 | "-i", 41 | video_file, 42 | "-vframes", 43 | "1", 44 | out_put_file_name 45 | ] 46 | # width = "90" 47 | await run_command(file_genertor_command) 48 | if os.path.lexists(out_put_file_name): 49 | return out_put_file_name 50 | else: 51 | return None 52 | -------------------------------------------------------------------------------- /uploadgram/time_formatter.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # Copyright (C) 2021 The Authors 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU Affero General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU Affero General Public License for more details. 12 | # You should have received a copy of the GNU Affero General Public License 13 | # along with this program. If not, see . 14 | 15 | """ time formatter """ 16 | 17 | 18 | def time_formatter(seconds: int) -> str: 19 | """ converts integer to string """ 20 | result = "" 21 | v_m = 0 22 | remainder = seconds 23 | r_ange_s = { 24 | "days": (24 * 60 * 60), 25 | "hours": (60 * 60), 26 | "minutes": 60, 27 | "seconds": 1 28 | } 29 | for age in r_ange_s: 30 | divisor = r_ange_s[age] 31 | v_m, remainder = divmod(remainder, divisor) 32 | v_m = int(v_m) 33 | if v_m != 0: 34 | result += f" {v_m} {age} " 35 | return result 36 | -------------------------------------------------------------------------------- /uploadgram/upload.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # Copyright (C) 2021 The Authors 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU Affero General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU Affero General Public License for more details. 12 | # You should have received a copy of the GNU Affero General Public License 13 | # along with this program. If not, see . 14 | 15 | 16 | import os 17 | from time import time 18 | from asyncio import sleep 19 | from tqdm import tqdm 20 | from hachoir.metadata import extractMetadata 21 | from hachoir.parser import createParser 22 | from pyrogram.types import Message 23 | from .config import TG_AUDIO_TYPES, TG_VIDEO_TYPES 24 | from .progress import progress_for_pyrogram 25 | from .take_screen_shot import take_screen_shot 26 | 27 | 28 | async def upload_dir_contents( 29 | tg_max_file_size: int, 30 | dir_path: str, 31 | delete_on_success: bool, 32 | thumbnail_file: str, 33 | force_document: bool, 34 | custom_caption: str, 35 | bot_sent_message: Message, 36 | console_progress: bool, 37 | ): 38 | dir_contents = [] 39 | if not os.path.isdir(dir_path): 40 | if os.path.exists(dir_path): 41 | dir_contents.append(dir_path) 42 | else: 43 | return False 44 | else: 45 | dir_contents = os.listdir(dir_path) 46 | dir_contents.sort() 47 | for dir_cntn in dir_contents: 48 | current_name = os.path.join(dir_path, dir_cntn) 49 | 50 | if os.path.isdir(current_name): 51 | await upload_dir_contents( 52 | tg_max_file_size, 53 | current_name, 54 | delete_on_success, 55 | thumbnail_file, 56 | force_document, 57 | custom_caption, 58 | bot_sent_message, 59 | console_progress, 60 | ) 61 | 62 | elif os.stat(current_name).st_size <= tg_max_file_size: 63 | response_message = await upload_single_file( 64 | current_name, 65 | thumbnail_file, 66 | force_document, 67 | custom_caption, 68 | bot_sent_message, 69 | console_progress, 70 | ) 71 | if isinstance(response_message, Message) and delete_on_success: 72 | os.remove(current_name) 73 | 74 | await sleep(10) 75 | 76 | 77 | async def upload_single_file( 78 | file_path: str, 79 | thumbnail_file: str, 80 | force_document: bool, 81 | custom_caption: str, 82 | bot_sent_message: Message, 83 | console_progress: bool, 84 | ): 85 | if not os.path.exists(file_path): 86 | return False 87 | usr_sent_message = bot_sent_message 88 | start_time = time() 89 | b_asen_am_e = os.path.basename(file_path) 90 | caption_al_desc = f"{b_asen_am_e}" 91 | if custom_caption: 92 | caption_al_desc = custom_caption 93 | 94 | pbar = None 95 | if console_progress: 96 | pbar = tqdm( 97 | total=os.path.getsize(file_path), 98 | unit="iB", 99 | unit_scale=True, 100 | desc="uploading", 101 | colour="green", 102 | unit_divisor=1024, 103 | miniters=1, 104 | ) 105 | 106 | if file_path.upper().endswith(TG_VIDEO_TYPES) and not force_document: 107 | return await upload_as_video( 108 | usr_sent_message, 109 | bot_sent_message, 110 | file_path, 111 | caption_al_desc, 112 | thumbnail_file, 113 | start_time, 114 | pbar, 115 | ) 116 | 117 | elif file_path.upper().endswith(TG_AUDIO_TYPES) and not force_document: 118 | return await upload_as_audio( 119 | usr_sent_message, 120 | bot_sent_message, 121 | file_path, 122 | caption_al_desc, 123 | thumbnail_file, 124 | start_time, 125 | pbar, 126 | ) 127 | 128 | else: 129 | return await upload_as_document( 130 | usr_sent_message, 131 | bot_sent_message, 132 | file_path, 133 | caption_al_desc, 134 | thumbnail_file, 135 | start_time, 136 | pbar, 137 | ) 138 | 139 | 140 | async def upload_as_document( 141 | usr_sent_message: Message, 142 | bot_sent_message: Message, 143 | file_path: str, 144 | caption_rts: str, 145 | thumbnail_file: str, 146 | start_time: int, 147 | pbar: tqdm, 148 | ): 149 | 150 | return await usr_sent_message.reply_document( 151 | document=file_path, 152 | quote=True, 153 | caption=caption_rts, 154 | disable_content_type_detection=True, 155 | thumb=thumbnail_file, 156 | progress=progress_for_pyrogram, 157 | progress_args=( 158 | bot_sent_message, 159 | start_time, 160 | pbar, 161 | f"Uploading {os.path.basename(file_path)} as DOCUMENT" 162 | ), 163 | ) 164 | 165 | 166 | async def upload_as_video( 167 | usr_sent_message: Message, 168 | bot_sent_message: Message, 169 | file_path: str, 170 | caption_rts: str, 171 | thumbnail_file: str, 172 | start_time: int, 173 | pbar: tqdm, 174 | ): 175 | try: 176 | metadata = extractMetadata(createParser(file_path)) 177 | duration = 0 178 | width = 0 179 | height = 0 180 | if metadata and metadata.has("duration"): 181 | duration = metadata.get("duration").seconds 182 | thumb_nail_img = await take_screen_shot( 183 | file_path, 184 | os.path.dirname(os.path.abspath(file_path)), 185 | (duration / 2), 186 | ) 187 | except AssertionError: 188 | return await upload_as_document( 189 | usr_sent_message, 190 | bot_sent_message, 191 | file_path, 192 | caption_rts, 193 | thumbnail_file, 194 | start_time, 195 | pbar, 196 | ) 197 | try: 198 | metadata = extractMetadata(createParser(thumb_nail_img)) 199 | if metadata and metadata.has("width"): 200 | width = metadata.get("width") 201 | if metadata and metadata.has("height"): 202 | height = metadata.get("height") 203 | except AssertionError: 204 | pass 205 | _tmp_m = await usr_sent_message.reply_video( 206 | video=file_path, 207 | quote=True, 208 | thumb=thumb_nail_img if not thumbnail_file else thumbnail_file, 209 | duration=duration, 210 | width=width, 211 | height=height, 212 | supports_streaming=True, 213 | caption=caption_rts, 214 | progress=progress_for_pyrogram, 215 | progress_args=( 216 | bot_sent_message, 217 | start_time, 218 | pbar, 219 | f"Uploading {os.path.basename(file_path)} as VIDEO" 220 | ), 221 | ) 222 | if thumb_nail_img and os.path.exists(thumb_nail_img): 223 | os.remove(thumb_nail_img) 224 | return _tmp_m 225 | 226 | 227 | async def upload_as_audio( 228 | usr_sent_message: Message, 229 | bot_sent_message: Message, 230 | file_path: str, 231 | caption_rts: str, 232 | thumbnail_file: str, 233 | start_time: int, 234 | pbar: tqdm, 235 | ): 236 | metadata = extractMetadata(createParser(file_path)) 237 | duration = 0 238 | title = None 239 | performer = None 240 | if metadata: 241 | # some audio files might cause errors 242 | # don't fail, and just 243 | # upload the file with zero (0) duration 244 | if metadata.has("duration"): 245 | duration = metadata.get("duration").seconds 246 | if metadata.has("title"): 247 | title = metadata.get("title") 248 | if metadata.has("artist"): 249 | performer = metadata.get("artist") 250 | if not performer: 251 | if metadata.has("author"): 252 | performer = metadata.get("author") 253 | if not performer: 254 | if metadata.has("album"): 255 | performer = metadata.get("album") 256 | 257 | return await usr_sent_message.reply_audio( 258 | audio=file_path, 259 | quote=True, 260 | caption=caption_rts, 261 | duration=duration, 262 | performer=performer, 263 | title=title, 264 | thumb=thumbnail_file, 265 | progress=progress_for_pyrogram, 266 | progress_args=( 267 | bot_sent_message, 268 | start_time, 269 | pbar, 270 | f"Uploading {os.path.basename(file_path)} as AUDIO" 271 | ), 272 | ) 273 | -------------------------------------------------------------------------------- /uploadgram/uploadgram.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # Copyright (C) 2021 The Authors 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU Affero General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU Affero General Public License for more details. 12 | # You should have received a copy of the GNU Affero General Public License 13 | # along with this program. If not, see . 14 | 15 | 16 | from pyrogram import Client, __version__ 17 | from pyrogram.enums import ParseMode, ClientPlatform 18 | from .get_config import get_config 19 | 20 | 21 | class Uploadgram(Client): 22 | """ modded client """ 23 | 24 | def __init__(self): 25 | super().__init__( 26 | name="UploadGram", 27 | api_id=int(get_config("UG_TG_APP_ID")), 28 | api_hash=get_config("UG_TG_API_HASH"), 29 | parse_mode=ParseMode.HTML, 30 | sleep_threshold=int(get_config("UG_TG_ST", 10)), 31 | workers=int(get_config("UG_TG_WS", 10)), 32 | max_concurrent_transmissions=int(get_config("UG_TG_MCTS", 4)), 33 | no_updates=True, 34 | device_model="Samsung SM-G998B", 35 | app_version="10.11.2 (4665)", 36 | system_version="SDK 31", 37 | lang_pack="", 38 | lang_code="en", 39 | system_lang_code="en", 40 | max_message_cache_size=int(get_config("UG_TG_MMC", 0)), 41 | max_business_user_connection_cache_size=int(get_config("UG_TG_MBUC", 0)), 42 | client_platform=ClientPlatform.ANDROID 43 | ) 44 | 45 | async def start(self): 46 | await super().start() 47 | print( 48 | f"{self.me} based on Pyrogram v{__version__} started." 49 | ) 50 | 51 | async def stop(self, *args): 52 | usr_bot_me = self.me 53 | await super().stop() 54 | print(f"{usr_bot_me} stopped. Bye.") 55 | --------------------------------------------------------------------------------