├── .editorconfig ├── .github └── FUNDING.yml ├── .gitignore ├── LICENSE ├── Readme.md ├── flatpak ├── com.steamdeckrepo.manager.appdata.xml ├── flatpak-pip-generator.py ├── repomanager.desktop ├── repomanager.png ├── repomanager.svg ├── runner.sh └── version.txt ├── main.py ├── requirements.txt ├── requirements_windows.txt ├── screenshot.png ├── testing.jpg ├── ui ├── __init__.py ├── icons │ ├── download.svg │ ├── like.svg │ └── time.svg ├── ui.py └── widgets │ ├── __init__.py │ ├── duration_filters.py │ ├── header.py │ ├── info_box.py │ ├── library_row.py │ ├── main_window.py │ ├── playback_interface.py │ └── update_frame.py └── utils ├── __init__.py ├── debounce.py └── slugify.py /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | end_of_line = lf 5 | insert_final_newline = true 6 | charset = utf-8 7 | indent_style = space 8 | indent_size = 4 9 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | ko_fi: captainjsparrow 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | venv 2 | .flatpak-builder 3 | out 4 | *.flatpak 5 | __pycache__/ 6 | .idea/ 7 | dist 8 | dist 9 | deckrepo.spec 10 | main.spec 11 | build -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | ## Steam Deck Repo Manager 2 | 3 | Steam Deck Repo Manager is a graphical user interface that allows you to install boot videos on your Steam Deck using [Steam Deck Repo](https://steamdeckrepo.com/) and GTK3. Thanks to [Waylaidwanderer](https://www.reddit.com/user/waylaidwanderer) for creating Steam Deck Repo! 4 | 5 | ![Screenshot of Steam Deck Repo Manager](https://raw.githubusercontent.com/CapitaineJSparrow/steam-repo-manager/main/screenshot.png) 6 | 7 | ### Installation 8 | 9 | You can download Steam Deck Repo Manager from the [Flathub Store](https://flathub.org/apps/details/com.steamdeckrepo.manager), or install it via flatpak using the following command: 10 | 11 | ```bash 12 | flatpak install --user flathub com.steamdeckrepo.manager 13 | ``` 14 | 15 | ### Contributing 16 | 17 | #### Requirements 18 | 19 | - `build-essential gobject-introspection libcairo2-dev libjpeg-dev libgif-dev libgirepository1.0-dev` 20 | - Python 3.10+ 21 | 22 | To get started with contributing, you can follow these steps: 23 | 24 | ```shell 25 | python3 -m venv ./venv 26 | source ./venv/bin/activate 27 | pip3 install -r requirements.txt 28 | python3 main.py 29 | ``` 30 | 31 | #### Contributing on Windows 32 | 33 | To contribute on Windows, you can follow these steps: 34 | 35 | 1. Download MSYS2. 36 | 2. Open mingw64 (not msys2). 37 | 3. Run the following commands: 38 | 39 | ```bash 40 | pacman -Suy 41 | pacman -S mingw-w64-x86_64-gtk3 mingw-w64-x86_64-python3 mingw-w64-x86_64-python3-gobject mingw-w64-x86_64-gst-python git 42 | gtk3-demo # to check GTK is working 43 | curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py # Install pip manually since mingw packages are causing issues 44 | python get-pip.py 45 | python -m pip install -U --force-reinstall pip 46 | rm get-pip.py 47 | pip install -r requirements_windows.txt # Do not use a venv, it's also causing issues. 48 | python main.py 49 | ``` 50 | 51 | If you want to build the app on Windows in a single .exe, you can install PyInstaller and run the following command: 52 | 53 | ```bash 54 | pip install pyinstaller 55 | pyinstaller -F --clean --add-data "./ui/icons/*;" main.py 56 | ``` 57 | 58 | ![](https://raw.githubusercontent.com/CapitaineJSparrow/steam-repo-manager/main/testing.jpg) -------------------------------------------------------------------------------- /flatpak/com.steamdeckrepo.manager.appdata.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | com.steamdeckrepo.manager 4 | CC0-1.0 5 | MIT-0 OR Apache-2.0 6 | Steam Deck Repo Manager 7 | Install boot videos to your Steam Deck using Steam Deck Repo website API. 8 | 9 |

Repo Manager installs boot videos using a GUI library on top of Steam Deck Repo website.

10 |
11 | 12 | 13 | https://raw.githubusercontent.com/CapitaineJSparrow/steam-repo-manager/main/screenshot.png 14 | Main Window 15 | 16 | 17 | https://steamdeckrepo.com/ 18 | https://ko-fi.com/captainjsparrow 19 | https://github.com/CapitaineJSparrow/steam-repo-manager 20 | 24 | 25 | 26 | 27 | 28 |
    29 |
  • Fix a crash preventing to open the app in specific situations
  • 30 |
  • Users can now install multiple videos at once, Steam OS will pick one randomly at boot.
  • 31 |
  • When a video is installed, the "Download" button is disabled.
  • 32 |
  • The "Download" button is enabled again if the file has been removed manually from filesystem or using the "Clear installed videos" button.
  • 33 |
34 |
35 |
36 | 37 | 38 |

Improvements for version 1.0.9 deployed yesterday:

39 |
    40 |
  • Users can now install multiple videos at once, Steam OS will pick one randomly at boot.
  • 41 |
  • When a video is installed, the "Download" button is disabled.
  • 42 |
  • The "Download" button is enabled again if the file has been removed manually from filesystem or using the "Clear installed videos" button.
  • 43 |
44 |
45 |
46 | 47 | 48 |

Update repo to use SteamOS new official support, thanks to community for creating pull request and needed changes

49 |
50 |
51 | 52 | 53 |

Add a dark theme (Arc-dark), add a frame when an update is available. Preliminary work for durations filters and randomize videos on boot but not ready yet !

54 |
55 |
56 | 57 | 58 |

Add icon to show video duration, add a search filter and fix library.js not updated correctly.

59 |
60 |
61 | 62 | 63 |

Add icon to show video duration, add a search filter.

64 |
65 |
66 | 67 | 68 |

Updated icon, preview videos should now have sound, add a load more button, handle boot videos longer than 10 seconds.

69 |
70 |
71 | 72 | 73 |

Implemented a video streamer to preview boot videos

74 |
75 |
76 | 77 | 78 |

Add a button to clear installed videos

79 |
80 |
81 | 82 | 83 |

Update icon, add footer with credits

84 |
85 |
86 | 87 | 88 |

Try to fix issues related to Flatpak

89 |
90 |
91 | 92 | 93 |
    94 |
  • First version of Steam Deck Repo Manager ! It does not contains all targeted features but you can install the 12 most downloaded boot videos on your Steam Deck.
  • 95 |
96 |
97 |
98 |
99 | Captain J. Sparrow 100 | 6690149+CapitaineJSparrow@users.noreply.github.com 101 | 102 | com.steamdeckrepo.manager.desktop 103 |
104 | -------------------------------------------------------------------------------- /flatpak/flatpak-pip-generator.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | __license__ = 'MIT' 4 | 5 | import argparse 6 | import json 7 | import hashlib 8 | import os 9 | import shutil 10 | import subprocess 11 | import sys 12 | import tempfile 13 | import urllib.request 14 | 15 | from collections import OrderedDict 16 | from typing import Dict 17 | 18 | try: 19 | import requirements 20 | except ImportError: 21 | exit('Requirements modules is not installed. Run "pip install requirements-parser"') 22 | 23 | parser = argparse.ArgumentParser() 24 | parser.add_argument('packages', nargs='*') 25 | parser.add_argument('--python2', action='store_true', 26 | help='Look for a Python 2 package') 27 | parser.add_argument('--cleanup', choices=['scripts', 'all'], 28 | help='Select what to clean up after build') 29 | parser.add_argument('--requirements-file', '-r', 30 | help='Specify requirements.txt file') 31 | parser.add_argument('--build-only', action='store_const', 32 | dest='cleanup', const='all', 33 | help='Clean up all files after build') 34 | parser.add_argument('--build-isolation', action='store_true', 35 | default=False, 36 | help=( 37 | 'Do not disable build isolation. ' 38 | 'Mostly useful on pip that does\'t ' 39 | 'support the feature.' 40 | )) 41 | parser.add_argument('--checker-data', action='store_true', 42 | help='Include x-checker-data in output for the "Flatpak External Data Checker"') 43 | parser.add_argument('--output', '-o', 44 | help='Specify output file name') 45 | parser.add_argument('--runtime', 46 | help='Specify a flatpak to run pip inside of a sandbox, ensures python version compatibility') 47 | parser.add_argument('--yaml', action='store_true', 48 | help='Use YAML as output format instead of JSON') 49 | opts = parser.parse_args() 50 | 51 | if opts.yaml: 52 | try: 53 | import yaml 54 | except ImportError: 55 | exit('PyYAML modules is not installed. Run "pip install PyYAML"') 56 | 57 | 58 | def get_pypi_url(name: str, filename: str) -> str: 59 | url = 'https://pypi.org/pypi/{}/json'.format(name) 60 | print('Extracting download url for', name) 61 | with urllib.request.urlopen(url) as response: 62 | body = json.loads(response.read().decode('utf-8')) 63 | for release in body['releases'].values(): 64 | for source in release: 65 | if source['filename'] == filename: 66 | return source['url'] 67 | raise Exception('Failed to extract url from {}'.format(url)) 68 | 69 | 70 | def get_tar_package_url_pypi(name: str, version: str) -> str: 71 | url = 'https://pypi.org/pypi/{}/{}/json'.format(name, version) 72 | with urllib.request.urlopen(url) as response: 73 | body = json.loads(response.read().decode('utf-8')) 74 | for ext in ['bz2', 'gz', 'xz', 'zip']: 75 | for source in body['urls']: 76 | if source['url'].endswith(ext): 77 | return source['url'] 78 | err = 'Failed to get {}-{} source from {}'.format(name, version, url) 79 | raise Exception(err) 80 | 81 | 82 | def get_package_name(filename: str) -> str: 83 | if filename.endswith(('bz2', 'gz', 'xz', 'zip')): 84 | segments = filename.split('-') 85 | if len(segments) == 2: 86 | return segments[0] 87 | return '-'.join(segments[:len(segments) - 1]) 88 | elif filename.endswith('whl'): 89 | segments = filename.split('-') 90 | if len(segments) == 5: 91 | return segments[0] 92 | candidate = segments[:len(segments) - 4] 93 | # Some packages list the version number twice 94 | # e.g. PyQt5-5.15.0-5.15.0-cp35.cp36.cp37.cp38-abi3-manylinux2014_x86_64.whl 95 | if candidate[-1] == segments[len(segments) - 4]: 96 | return '-'.join(candidate[:-1]) 97 | return '-'.join(candidate) 98 | else: 99 | raise Exception( 100 | 'Downloaded filename: {} does not end with bz2, gz, xz, zip, or whl'.format(filename) 101 | ) 102 | 103 | 104 | def get_file_version(filename: str) -> str: 105 | name = get_package_name(filename) 106 | segments = filename.split(name + '-') 107 | version = segments[1].split('-')[0] 108 | for ext in ['tar.gz', 'whl', 'tar.xz', 'tar.gz', 'tar.bz2', 'zip']: 109 | version = version.replace('.' + ext, '') 110 | return version 111 | 112 | 113 | def get_file_hash(filename: str) -> str: 114 | sha = hashlib.sha256() 115 | print('Generating hash for', filename.split('/')[-1]) 116 | with open(filename, 'rb') as f: 117 | while True: 118 | data = f.read(1024 * 1024 * 32) 119 | if not data: 120 | break 121 | sha.update(data) 122 | return sha.hexdigest() 123 | 124 | 125 | def download_tar_pypi(url: str, tempdir: str) -> None: 126 | with urllib.request.urlopen(url) as response: 127 | file_path = os.path.join(tempdir, url.split('/')[-1]) 128 | with open(file_path, 'x+b') as tar_file: 129 | shutil.copyfileobj(response, tar_file) 130 | 131 | 132 | def parse_continuation_lines(fin): 133 | for line in fin: 134 | line = line.rstrip('\n') 135 | while line.endswith('\\'): 136 | try: 137 | line = line[:-1] + next(fin).rstrip('\n') 138 | except StopIteration: 139 | exit('Requirements have a wrong number of line continuation characters "\\"') 140 | yield line 141 | 142 | 143 | def fprint(string: str) -> None: 144 | separator = '=' * 72 # Same as `flatpak-builder` 145 | print(separator) 146 | print(string) 147 | print(separator) 148 | 149 | 150 | packages = [] 151 | if opts.requirements_file: 152 | requirements_file = os.path.expanduser(opts.requirements_file) 153 | try: 154 | with open(requirements_file, 'r') as req_file: 155 | reqs = parse_continuation_lines(req_file) 156 | reqs_as_str = '\n'.join([r.split('--hash')[0] for r in reqs]) 157 | packages = list(requirements.parse(reqs_as_str)) 158 | except FileNotFoundError: 159 | pass 160 | 161 | elif opts.packages: 162 | packages = list(requirements.parse('\n'.join(opts.packages))) 163 | with tempfile.NamedTemporaryFile('w', delete=False, prefix='requirements.') as req_file: 164 | req_file.write('\n'.join(opts.packages)) 165 | requirements_file = req_file.name 166 | else: 167 | exit('Please specifiy either packages or requirements file argument') 168 | 169 | for i in packages: 170 | if i["name"].lower().startswith("pyqt"): 171 | print("PyQt packages are not supported by flapak-pip-generator") 172 | print("However, there is a BaseApp for PyQt available, that you should use") 173 | print("Visit https://github.com/flathub/com.riverbankcomputing.PyQt.BaseApp for more information") 174 | sys.exit(0) 175 | 176 | with open(requirements_file, 'r') as req_file: 177 | use_hash = '--hash=' in req_file.read() 178 | 179 | python_version = '2' if opts.python2 else '3' 180 | if opts.python2: 181 | pip_executable = 'pip2' 182 | else: 183 | pip_executable = 'pip3' 184 | 185 | if opts.runtime: 186 | flatpak_cmd = [ 187 | 'flatpak', 188 | '--devel', 189 | '--share=network', 190 | '--filesystem=/tmp', 191 | '--command={}'.format(pip_executable), 192 | 'run', 193 | opts.runtime 194 | ] 195 | if opts.requirements_file: 196 | requirements_file = os.path.expanduser(opts.requirements_file) 197 | if os.path.exists(requirements_file): 198 | prefix = os.path.realpath(requirements_file) 199 | flag = '--filesystem={}'.format(prefix) 200 | flatpak_cmd.insert(1,flag) 201 | else: 202 | flatpak_cmd = [pip_executable] 203 | 204 | if opts.output: 205 | output_package = opts.output 206 | elif opts.requirements_file: 207 | output_package = 'python{}-{}'.format( 208 | python_version, 209 | os.path.basename(opts.requirements_file).replace('.txt', ''), 210 | ) 211 | elif len(packages) == 1: 212 | output_package = 'python{}-{}'.format( 213 | python_version, packages[0].name, 214 | ) 215 | else: 216 | output_package = 'python{}-modules'.format(python_version) 217 | if opts.yaml: 218 | output_filename = output_package + '.yaml' 219 | else: 220 | output_filename = output_package + '.json' 221 | 222 | modules = [] 223 | vcs_modules = [] 224 | sources = {} 225 | 226 | tempdir_prefix = 'pip-generator-{}'.format(os.path.basename(output_package)) 227 | with tempfile.TemporaryDirectory(prefix=tempdir_prefix) as tempdir: 228 | pip_download = flatpak_cmd + [ 229 | 'download', 230 | '--exists-action=i', 231 | '--dest', 232 | tempdir, 233 | '-r', 234 | requirements_file 235 | ] 236 | if use_hash: 237 | pip_download.append('--require-hashes') 238 | 239 | fprint('Downloading sources') 240 | cmd = ' '.join(pip_download) 241 | print('Running: "{}"'.format(cmd)) 242 | try: 243 | subprocess.run(pip_download, check=True) 244 | except subprocess.CalledProcessError: 245 | print('Failed to download') 246 | print('Please fix the module manually in the generated file') 247 | 248 | if not opts.requirements_file: 249 | try: 250 | os.remove(requirements_file) 251 | except FileNotFoundError: 252 | pass 253 | 254 | fprint('Downloading arch independent packages') 255 | for filename in os.listdir(tempdir): 256 | if not filename.endswith(('bz2', 'any.whl', 'gz', 'xz', 'zip')): 257 | version = get_file_version(filename) 258 | name = get_package_name(filename) 259 | url = get_tar_package_url_pypi(name, version) 260 | print('Deleting', filename) 261 | try: 262 | os.remove(os.path.join(tempdir, filename)) 263 | except FileNotFoundError: 264 | pass 265 | print('Downloading {}'.format(url)) 266 | download_tar_pypi(url, tempdir) 267 | 268 | files = {get_package_name(f): [] for f in os.listdir(tempdir)} 269 | 270 | for filename in os.listdir(tempdir): 271 | name = get_package_name(filename) 272 | files[name].append(filename) 273 | 274 | # Delete redundant sources, for vcs sources 275 | for name in files: 276 | if len(files[name]) > 1: 277 | zip_source = False 278 | for f in files[name]: 279 | if f.endswith('.zip'): 280 | zip_source = True 281 | if zip_source: 282 | for f in files[name]: 283 | if not f.endswith('.zip'): 284 | try: 285 | os.remove(os.path.join(tempdir, f)) 286 | except FileNotFoundError: 287 | pass 288 | 289 | vcs_packages = { 290 | x.name: {'vcs': x.vcs, 'revision': x.revision, 'uri': x.uri} 291 | for x in packages 292 | if x.vcs 293 | } 294 | 295 | fprint('Obtaining hashes and urls') 296 | for filename in os.listdir(tempdir): 297 | name = get_package_name(filename) 298 | sha256 = get_file_hash(os.path.join(tempdir, filename)) 299 | 300 | if name in vcs_packages: 301 | uri = vcs_packages[name]['uri'] 302 | revision = vcs_packages[name]['revision'] 303 | vcs = vcs_packages[name]['vcs'] 304 | url = 'https://' + uri.split('://', 1)[1] 305 | s = 'commit' 306 | if vcs == 'svn': 307 | s = 'revision' 308 | source = OrderedDict([ 309 | ('type', vcs), 310 | ('url', url), 311 | (s, revision), 312 | ]) 313 | is_vcs = True 314 | else: 315 | url = get_pypi_url(name, filename) 316 | source = OrderedDict([ 317 | ('type', 'file'), 318 | ('url', url), 319 | ('sha256', sha256)]) 320 | if opts.checker_data: 321 | source['x-checker-data'] = { 322 | 'type': 'pypi', 323 | 'name': name} 324 | if url.endswith(".whl"): 325 | source['x-checker-data']['packagetype'] = 'bdist_wheel' 326 | is_vcs = False 327 | sources[name] = {'source': source, 'vcs': is_vcs} 328 | 329 | # Python3 packages that come as part of org.freedesktop.Sdk. 330 | system_packages = ['cython', 'easy_install', 'mako', 'markdown', 'meson', 'pip', 'pygments', 'setuptools', 'six', 'wheel'] 331 | 332 | fprint('Generating dependencies') 333 | for package in packages: 334 | 335 | if package.name is None: 336 | print('Warning: skipping invalid requirement specification {} because it is missing a name'.format(package.line), file=sys.stderr) 337 | print('Append #egg= to the end of the requirement line to fix', file=sys.stderr) 338 | continue 339 | elif package.name.casefold() in system_packages: 340 | print(f"{package.name} is in system_packages. Skipping.") 341 | continue 342 | 343 | if len(package.extras) > 0: 344 | extras = '[' + ','.join(extra for extra in package.extras) + ']' 345 | else: 346 | extras = '' 347 | 348 | version_list = [x[0] + x[1] for x in package.specs] 349 | version = ','.join(version_list) 350 | 351 | if package.vcs: 352 | revision = '' 353 | if package.revision: 354 | revision = '@' + package.revision 355 | pkg = package.uri + revision + '#egg=' + package.name 356 | else: 357 | pkg = package.name + extras + version 358 | 359 | dependencies = [] 360 | # Downloads the package again to list dependencies 361 | 362 | tempdir_prefix = 'pip-generator-{}'.format(package.name) 363 | with tempfile.TemporaryDirectory(prefix='{}-{}'.format(tempdir_prefix, package.name)) as tempdir: 364 | pip_download = flatpak_cmd + [ 365 | 'download', 366 | '--exists-action=i', 367 | '--dest', 368 | tempdir, 369 | ] 370 | try: 371 | print('Generating dependencies for {}'.format(package.name)) 372 | subprocess.run(pip_download + [pkg], check=True, stdout=subprocess.DEVNULL) 373 | for filename in sorted(os.listdir(tempdir)): 374 | dep_name = get_package_name(filename) 375 | if dep_name.casefold() in system_packages: 376 | continue 377 | dependencies.append(dep_name) 378 | 379 | except subprocess.CalledProcessError: 380 | print('Failed to download {}'.format(package.name)) 381 | 382 | is_vcs = True if package.vcs else False 383 | package_sources = [] 384 | for dependency in dependencies: 385 | if dependency in sources: 386 | source = sources[dependency] 387 | elif dependency.replace('_', '-') in sources: 388 | source = sources[dependency.replace('_', '-')] 389 | else: 390 | continue 391 | 392 | if not (not source['vcs'] or is_vcs): 393 | continue 394 | 395 | package_sources.append(source['source']) 396 | 397 | if package.vcs: 398 | name_for_pip = '.' 399 | else: 400 | name_for_pip = pkg 401 | 402 | module_name = 'python{}-{}'.format(python_version, package.name) 403 | 404 | pip_command = [ 405 | pip_executable, 406 | 'install', 407 | '--verbose', 408 | '--exists-action=i', 409 | '--no-index', 410 | '--find-links="file://${PWD}"', 411 | '--prefix=${FLATPAK_DEST}', 412 | '"{}"'.format(name_for_pip) 413 | ] 414 | if not opts.build_isolation: 415 | pip_command.append('--no-build-isolation') 416 | 417 | module = OrderedDict([ 418 | ('name', module_name), 419 | ('buildsystem', 'simple'), 420 | ('build-commands', [' '.join(pip_command)]), 421 | ('sources', package_sources), 422 | ]) 423 | if opts.cleanup == 'all': 424 | module['cleanup'] = ['*'] 425 | elif opts.cleanup == 'scripts': 426 | module['cleanup'] = ['/bin', '/share/man/man1'] 427 | 428 | if package.vcs: 429 | vcs_modules.append(module) 430 | else: 431 | modules.append(module) 432 | 433 | modules = vcs_modules + modules 434 | if len(modules) == 1: 435 | pypi_module = modules[0] 436 | else: 437 | pypi_module = { 438 | 'name': output_package, 439 | 'buildsystem': 'simple', 440 | 'build-commands': [], 441 | 'modules': modules, 442 | } 443 | 444 | print() 445 | with open(output_filename, 'w') as output: 446 | if opts.yaml: 447 | class OrderedDumper(yaml.Dumper): 448 | def increase_indent(self, flow=False, indentless=False): 449 | return super(OrderedDumper, self).increase_indent(flow, False) 450 | 451 | def dict_representer(dumper, data): 452 | return dumper.represent_dict(data.items()) 453 | 454 | OrderedDumper.add_representer(OrderedDict, dict_representer) 455 | 456 | output.write("# Generated with flatpak-pip-generator " + " ".join(sys.argv[1:]) + "\n") 457 | yaml.dump(pypi_module, output, Dumper=OrderedDumper) 458 | else: 459 | output.write(json.dumps(pypi_module, indent=4)) 460 | print('Output saved to {}'.format(output_filename)) 461 | -------------------------------------------------------------------------------- /flatpak/repomanager.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Version=1.0 3 | Type=Application 4 | 5 | Name=Steam Deck Repo Manager 6 | Comment=Install boot videos to your Steam Deck 7 | Categories=Utility; 8 | 9 | Icon=repomanager 10 | Exec=/app/bin/runner.sh 11 | Terminal=false 12 | StartupNotify=true 13 | -------------------------------------------------------------------------------- /flatpak/repomanager.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapitaineJSparrow/steam-repo-manager/3e146faaf7cc30fb3cd74542403b39e273d66d7b/flatpak/repomanager.png -------------------------------------------------------------------------------- /flatpak/repomanager.svg: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 8 | 10 | 12 | 14 | 16 | 18 | 20 | 22 | 24 | 26 | 28 | 30 | 31 | 32 | 33 | 34 | 36 | 38 | 40 | 41 | 42 | 43 | 44 | 46 | 48 | 50 | 51 | 52 | 53 | 54 | 56 | 58 | 60 | 62 | 63 | 64 | 65 | 66 | 68 | 70 | 72 | 74 | 76 | 77 | 78 | 79 | 80 | 82 | 84 | 86 | 88 | 90 | 92 | 94 | 96 | 97 | 99 | 101 | 103 | 105 | 106 | 107 | 108 | 109 | -------------------------------------------------------------------------------- /flatpak/runner.sh: -------------------------------------------------------------------------------- 1 | # Command executed to run project in flatpak 2 | python3 /app/main.py 3 | -------------------------------------------------------------------------------- /flatpak/version.txt: -------------------------------------------------------------------------------- 1 | 1.0.11 2 | -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | from random import randint 2 | import gi 3 | 4 | gi.require_version("Gtk", "3.0") 5 | gi.require_version('Gst', '1.0') 6 | 7 | import asyncio 8 | from ui import ui 9 | import requests 10 | import urllib3 11 | import time 12 | 13 | # Steam deck repo may have issue with SSL 14 | urllib3.disable_warnings() 15 | 16 | 17 | async def download_image(url, author, title, downloads, video, likes, duration): 18 | response = requests.get(url, verify=False) 19 | return { 20 | "content": response.content, 21 | "author": author, 22 | "title": title, 23 | "downloads": downloads, 24 | "video": video, 25 | "likes": likes, 26 | "duration": duration, 27 | } 28 | 29 | 30 | async def get_videos(page: int, search: str = ''): 31 | start_time = time.time() 32 | search_query = f"&search={search}" if len(search) > 0 else "" 33 | url = f"https://steamdeckrepo.com/api/posts?page={page + 1}{search_query}" 34 | payload = {} 35 | 36 | response = requests.request("GET", url, data=payload) 37 | 38 | # Create an array of futures to gather them later 39 | images_list = list(map( 40 | lambda x: download_image(x["thumbnail"], x["user"]["steam_name"], x["title"], x["downloads"], x["video"], x["likes"], x["video_duration"]), 41 | response.json()["posts"] 42 | )) 43 | 44 | # Download images and metadata using parallelism 45 | videos = await asyncio.gather(*images_list) 46 | duration = time.time() - start_time 47 | print(f"Downloaded in {duration} seconds") 48 | return videos 49 | 50 | 51 | async def main(): 52 | ui.build_ui() 53 | 54 | 55 | if __name__ == "__main__": 56 | asyncio.run(main()) 57 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | PyGObject==3.42.2 2 | PyGObject-stubs==1.0.0 3 | requests==2.31.0 4 | packaging==21.3 5 | -------------------------------------------------------------------------------- /requirements_windows.txt: -------------------------------------------------------------------------------- 1 | certifi==2022.12.7 2 | charset-normalizer==3.1.0 3 | idna==3.4 4 | packaging==23.1 5 | pycairo==1.23.0 6 | PyGObject==3.44.1 7 | requests==2.31.0 8 | urllib3==1.26.15 9 | -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapitaineJSparrow/steam-repo-manager/3e146faaf7cc30fb3cd74542403b39e273d66d7b/screenshot.png -------------------------------------------------------------------------------- /testing.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapitaineJSparrow/steam-repo-manager/3e146faaf7cc30fb3cd74542403b39e273d66d7b/testing.jpg -------------------------------------------------------------------------------- /ui/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapitaineJSparrow/steam-repo-manager/3e146faaf7cc30fb3cd74542403b39e273d66d7b/ui/__init__.py -------------------------------------------------------------------------------- /ui/icons/download.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 11 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /ui/icons/like.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /ui/icons/time.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /ui/ui.py: -------------------------------------------------------------------------------- 1 | import platform 2 | import gi 3 | 4 | gi.require_version("Gtk", "3.0") 5 | gi.require_version('Gst', '1.0') 6 | 7 | from ui.widgets.main_window import MainWindow 8 | from gi.repository import Gtk, Gdk, Gst 9 | from utils import is_windows 10 | 11 | gtksettings = Gtk.Settings.get_default() 12 | gtksettings.set_property( 13 | "gtk-application-prefer-dark-theme", False 14 | ) 15 | 16 | Gst.init(None) 17 | Gst.init_check(None) 18 | 19 | def build_ui(): 20 | if not is_windows: 21 | Gdk.threads_init() 22 | MainWindow() 23 | Gtk.main() -------------------------------------------------------------------------------- /ui/widgets/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CapitaineJSparrow/steam-repo-manager/3e146faaf7cc30fb3cd74542403b39e273d66d7b/ui/widgets/__init__.py -------------------------------------------------------------------------------- /ui/widgets/duration_filters.py: -------------------------------------------------------------------------------- 1 | from gi.repository import Gtk, Gdk 2 | 3 | 4 | class DurationFilters(Gtk.Expander): 5 | def __init__(self): 6 | super(DurationFilters, self).__init__() 7 | container = Gtk.Box() 8 | container.set_orientation(Gtk.Orientation.HORIZONTAL) 9 | 10 | screen = Gdk.Screen.get_default() 11 | provider = Gtk.CssProvider() 12 | style_context = Gtk.StyleContext() 13 | style_context.add_provider_for_screen( 14 | screen, provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION 15 | ) 16 | css = b""" 17 | expander arrow { 18 | -gtk-icon-source: none; 19 | } 20 | """ 21 | provider.load_from_data(css) 22 | 23 | start_label = Gtk.Label(label="Filter by duration from") 24 | start_label.set_margin_right(8) 25 | 26 | start_values = [ 27 | "0", 28 | "5", 29 | "10", 30 | "15", 31 | "20", 32 | "30", 33 | ] 34 | start_combo = Gtk.ComboBoxText() 35 | start_combo.set_entry_text_column(0) 36 | 37 | end_combo = Gtk.ComboBoxText() 38 | end_combo.set_entry_text_column(0) 39 | end_combo.set_margin_left(8) 40 | 41 | for value in start_values: 42 | start_combo.append_text(value) 43 | end_combo.append_text(value) 44 | 45 | start_combo.set_active(0) 46 | end_combo.append_text("any") 47 | end_combo.set_active(len(start_values)) 48 | start_combo.set_margin_right(8) 49 | 50 | container.add(start_label) 51 | container.add(start_combo) 52 | container.add(Gtk.Label(label="to")) 53 | container.add(end_combo) 54 | container.add(Gtk.Label(label=" seconds ")) 55 | container.add(Gtk.Button(label="apply filters")) 56 | self.add(container) 57 | -------------------------------------------------------------------------------- /ui/widgets/header.py: -------------------------------------------------------------------------------- 1 | from typing import Callable 2 | from gi.repository import Gtk 3 | from utils import clear_installed_videos 4 | 5 | 6 | class Header(Gtk.Box): 7 | def clear_videos(self, _=None): 8 | clear_installed_videos() 9 | dialog = Gtk.MessageDialog( 10 | flags=0, 11 | message_type=Gtk.MessageType.INFO, 12 | buttons=Gtk.ButtonsType.OK, 13 | text="Success ! All videos have been removed.", 14 | ) 15 | dialog.run() 16 | dialog.destroy() 17 | self.on_clear() 18 | 19 | def __init__(self, on_search: Callable, on_duration_filter: Callable, on_clear: Callable): 20 | super(Header, self).__init__() 21 | self.set_orientation(Gtk.Orientation.HORIZONTAL) 22 | self.set_spacing(8) 23 | self.on_clear = on_clear 24 | 25 | search_entry = Gtk.SearchEntry() 26 | search_entry.set_hexpand(True) 27 | search_entry.set_placeholder_text("Search for videos") 28 | 29 | def on_search_changed(_): 30 | on_search(search_entry.get_text()) 31 | 32 | search_entry.connect("search-changed", on_search_changed) 33 | 34 | clear_button = Gtk.Button(label="Clear installed videos") 35 | clear_button.connect("clicked", self.clear_videos) 36 | 37 | filter_duration_button = Gtk.Button(label="Filter by duration") 38 | filter_duration_button.connect("clicked", on_duration_filter) 39 | 40 | self.add(search_entry) 41 | self.add(clear_button) 42 | # self.add(filter_duration_button) 43 | 44 | -------------------------------------------------------------------------------- /ui/widgets/info_box.py: -------------------------------------------------------------------------------- 1 | import os 2 | from gi.repository import Gtk, GdkPixbuf, Pango 3 | 4 | 5 | def get_resource_path(rel_path): 6 | dir_of_py_file = os.path.dirname(__file__) 7 | rel_path_to_resource = os.path.join(dir_of_py_file, rel_path) 8 | abs_path_to_resource = os.path.abspath(rel_path_to_resource) 9 | 10 | if "_MEI" in dir_of_py_file: 11 | parent_folder = os.path.abspath(os.path.join(abs_path_to_resource, "..\\..\\..")) 12 | nom_fichier = os.path.basename(abs_path_to_resource) 13 | return os.path.join(parent_folder, nom_fichier) 14 | 15 | return abs_path_to_resource 16 | 17 | 18 | class Icon(Gtk.Image): 19 | def __init__(self, resource_path: str): 20 | super(Icon, self).__init__() 21 | self.set_from_file(get_resource_path(resource_path)) 22 | pixbuf = self.get_pixbuf() 23 | pixbuf = pixbuf.scale_simple(18, 18, GdkPixbuf.InterpType.BILINEAR) 24 | self.set_from_pixbuf(pixbuf) 25 | self.set_margin_left(6) 26 | 27 | 28 | class InfoBox(Gtk.Box): 29 | def __init__(self, video): 30 | super(InfoBox, self).__init__() 31 | 32 | self.set_orientation(Gtk.Orientation.HORIZONTAL) 33 | self.set_margin_top(6) 34 | self.set_margin_bottom(6) 35 | 36 | author = video["author"] 37 | downloads = video["downloads"] 38 | likes = video["likes"] 39 | duration = video["duration"] 40 | 41 | author = Gtk.Label(label=f"{author}") 42 | author.set_ellipsize(Pango.EllipsizeMode.END) 43 | author.set_use_markup(True) 44 | 45 | download_img = Icon("../icons/download.svg") 46 | likes_img = Icon("../icons/like.svg") 47 | duration_img = Icon("../icons/time.svg") 48 | 49 | actions_container = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL) 50 | actions_container.set_hexpand(True) 51 | actions_container.set_halign(Gtk.Align.END) 52 | 53 | downloads = Gtk.Label(label=f"{str(downloads)}") 54 | likes = Gtk.Label(label=f"{str(likes)}") 55 | likes.set_margin_left(6) 56 | duration = Gtk.Label(label=f"{str(duration)}s") 57 | duration.set_margin_left(6) 58 | 59 | self.add(author) 60 | actions_container.add(downloads) 61 | actions_container.add(download_img) 62 | actions_container.add(likes) 63 | actions_container.add(likes_img) 64 | actions_container.add(duration) 65 | actions_container.add(duration_img) 66 | self.add(actions_container) 67 | self.set_margin_bottom(10) 68 | self.set_margin_top(10) 69 | -------------------------------------------------------------------------------- /ui/widgets/library_row.py: -------------------------------------------------------------------------------- 1 | from math import floor 2 | import os 3 | from gi.repository import GLib, Gtk, GdkPixbuf, Pango 4 | from utils import download_video, list_installed_videos, slugify 5 | from ui.widgets.info_box import InfoBox 6 | from ui.widgets.playback_interface import PlaybackInterface 7 | from typing import List 8 | from utils import is_windows 9 | 10 | GUTTER = 16 11 | IMAGE_RATIO = 1.6 12 | 13 | 14 | class LibraryRow(Gtk.Box): 15 | def preview_video(self, _, url): 16 | if is_windows: 17 | os.startfile(url) 18 | else: 19 | PlaybackInterface(url) 20 | 21 | def on_video_dl(self, widget, url, title): 22 | widget.set_sensitive(False) 23 | download_video(self, url, title) 24 | dialog = Gtk.MessageDialog( 25 | flags=0, 26 | message_type=Gtk.MessageType.INFO, 27 | buttons=Gtk.ButtonsType.OK, 28 | text="Success ! Video is installed on your Steam Deck.", 29 | ) 30 | dialog.run() 31 | dialog.destroy() 32 | 33 | def compute_image_size(self, width): 34 | new_width = floor(width * (1 / self.row_count)) 35 | new_size = new_width - (GUTTER * (self.row_count - 1) / self.row_count) 36 | 37 | return { 38 | "width": floor(new_size), 39 | "height": floor(new_size / IMAGE_RATIO) 40 | } 41 | 42 | def resize_images(self, __, _, window): 43 | size = self.compute_image_size(window.get_allocated_width()) 44 | for index, buffer in enumerate(self.original_buffers): 45 | pixbuf = buffer.scale_simple(size["width"], size["height"], GdkPixbuf.InterpType.BILINEAR) 46 | self.original_images[index].set_from_pixbuf(pixbuf) 47 | 48 | def __init__(self, images, default_width, default_row_count, installed_videos: List[str]): 49 | super(LibraryRow, self).__init__() 50 | row_count = min(len(images), default_row_count) 51 | 52 | self.temp_height = 0 53 | self.event_count = 0 54 | self.temp_width = 0 55 | self.original_buffers = [] 56 | self.original_images = [] 57 | self.row_count = row_count 58 | self.buttons = [] 59 | 60 | scroll = Gtk.ScrolledWindow() 61 | scroll.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.NEVER) 62 | scroll.set_hexpand(True) 63 | self.boot_video_container = Gtk.Box() 64 | self.boot_video_container.set_orientation(Gtk.Orientation.HORIZONTAL) 65 | 66 | for index, boot_video in enumerate(images): 67 | content = boot_video["content"] 68 | 69 | loader = GdkPixbuf.PixbufLoader() 70 | loader.write_bytes(GLib.Bytes.new(content)) 71 | loader.close() 72 | 73 | container = Gtk.Box() 74 | container.set_orientation(Gtk.Orientation.VERTICAL) 75 | container.set_margin_bottom(8) 76 | container.set_margin_top(0) 77 | container.set_margin_left(0 if index == 0 else GUTTER) 78 | 79 | pixbuf = loader.get_pixbuf() 80 | self.original_buffers.append(pixbuf) 81 | size = self.compute_image_size(default_width) 82 | pixbuf = pixbuf.scale_simple(size["width"], size["height"], GdkPixbuf.InterpType.BILINEAR) 83 | 84 | img = Gtk.Image.new_from_pixbuf(pixbuf) 85 | label = Gtk.Label(label=boot_video["title"]) 86 | label.set_margin_bottom(8) 87 | label.set_ellipsize(Pango.EllipsizeMode.END) 88 | label.set_tooltip_text(boot_video["title"]) 89 | 90 | actions = Gtk.Box() 91 | actions.set_homogeneous(True) 92 | actions.set_spacing(6) 93 | 94 | download_button = Gtk.Button(label="Download") 95 | download_button.set_sensitive(False if (slugify(boot_video["title"] + "webm") in installed_videos) else True) 96 | download_button.connect('clicked', self.on_video_dl, boot_video["video"], boot_video["title"]) 97 | preview_button = Gtk.Button(label="Preview") 98 | preview_button.connect('clicked', self.preview_video, boot_video["video"]) 99 | self.buttons.append(download_button) 100 | 101 | actions.add(download_button) 102 | actions.add(preview_button) 103 | 104 | container.add(label) 105 | container.add(img) 106 | container.add(InfoBox(video=boot_video)) 107 | container.add(actions) 108 | 109 | self.boot_video_container.add(container) 110 | self.original_images.append(img) 111 | 112 | scroll.add(self.boot_video_container) 113 | self.add(scroll) 114 | self.connect('size-allocate', self.resize_images, self) 115 | -------------------------------------------------------------------------------- /ui/widgets/main_window.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | import threading 3 | from math import ceil 4 | from random import randint 5 | from gi.repository import Gtk, GLib, Gdk, Gio 6 | from main import get_videos 7 | from ui.widgets.duration_filters import DurationFilters 8 | from ui.widgets.library_row import LibraryRow 9 | from ui.widgets.header import Header 10 | from ui.widgets.update_frame import UpdateFrame 11 | from utils import CURRENT_VERSION, list_installed_videos 12 | from utils.debounce import debounce 13 | 14 | GLOBAL_SPACING = 20 15 | added = False 16 | ROW_COUNT = 3 17 | 18 | PORTAL_BUS_NAME = "org.freedesktop.portal.Desktop" 19 | PORTAL_OBJECT_PATH = "/org/freedesktop/portal/desktop" 20 | PORTAL_SETTINGS_INTERFACE = "org.freedesktop.portal.Background" 21 | 22 | 23 | 24 | # Window 25 | # | 26 | # ScrolledWindow (root_scroll) -> requires to have exactly 1 children 27 | # | 28 | # Box (main_container) 29 | # | 30 | # Entry (dummy_entry) 31 | # Header (head) 32 | # LibraryRow duplicated n times 33 | # Spinner (spinner) 34 | # Button (more_button) 35 | # label (footer) 36 | 37 | 38 | class MainWindow(Gtk.Window): 39 | def __init__(self): 40 | super().__init__(title="Steam Deck Repo Manager") 41 | default_width = 1180 42 | 43 | self.set_position(Gtk.WindowPosition.CENTER) 44 | self.set_default_size(default_width, 680) 45 | self.current_page = 1 46 | 47 | # workaround for focus of first entry 48 | dummy_entry = Gtk.Entry() 49 | 50 | # Global Layout 51 | main_container = Gtk.Box() 52 | main_container.set_margin_top(GLOBAL_SPACING) 53 | main_container.set_margin_bottom(GLOBAL_SPACING) 54 | main_container.set_margin_left(GLOBAL_SPACING) 55 | main_container.set_margin_right(GLOBAL_SPACING) 56 | main_container.set_valign(Gtk.Align.START) 57 | main_container.set_orientation(Gtk.Orientation.VERTICAL) 58 | 59 | self.head = Header(on_search=self.on_search, on_duration_filter=self.on_duration_filter_click, on_clear=self.on_clear_videos) 60 | main_container.add(dummy_entry) 61 | 62 | main_container.add(self.head) 63 | self.duration_filters = DurationFilters() 64 | main_container.add(self.duration_filters) 65 | 66 | self.update_frame = UpdateFrame() 67 | main_container.add(self.update_frame) 68 | 69 | root_scroll = Gtk.ScrolledWindow() 70 | root_scroll.add(main_container) 71 | 72 | self.add(root_scroll) 73 | self.connect("destroy", Gtk.main_quit) 74 | self.show_all() 75 | self.head.hide() 76 | 77 | if not self.update_frame.should_update: 78 | self.update_frame.hide() 79 | 80 | self.rows_container = Gtk.Box() 81 | self.rows_container.set_margin_top(GLOBAL_SPACING) 82 | self.rows_container.set_valign(Gtk.Align.START) 83 | self.rows_container.set_orientation(Gtk.Orientation.VERTICAL) 84 | self.rows_container.show() 85 | main_container.add(self.rows_container) 86 | 87 | self.spinner = Gtk.Spinner() 88 | main_container.add(self.spinner) 89 | 90 | self.more_button = Gtk.Button(label="Load more") 91 | self.more_button.set_margin_bottom(GLOBAL_SPACING) 92 | self.more_button.connect('clicked', self.download_videos_and_apply_filters, {"paginate": True}) 93 | main_container.add(self.more_button) 94 | 95 | self.footer = Gtk.Label( 96 | label=f"Made with ♥ by Captain J. Sparrow built on top of Steam Deck Repo. Version {CURRENT_VERSION}") 97 | self.footer.set_use_markup(True) 98 | main_container.add(self.footer) 99 | 100 | # Dummy entry got focus, hide it now 101 | dummy_entry.destroy() 102 | self.download_videos_and_apply_filters() 103 | 104 | def on_videos_downloaded(self, videos, hide_pagination: bool = False): 105 | installed_videos = list_installed_videos() 106 | self.spinner.stop() 107 | self.head.show() # Show clear video button 108 | self.footer.show() # Show credits 109 | for i in range(ceil(len(videos) / ROW_COUNT)): 110 | row = LibraryRow( 111 | videos[i * ROW_COUNT:(i + 1) * ROW_COUNT], 112 | self.rows_container.get_allocated_width(), ROW_COUNT, 113 | installed_videos 114 | ) 115 | sep = Gtk.Box() 116 | sep.set_margin_bottom(GLOBAL_SPACING) 117 | self.rows_container.add(row) 118 | self.rows_container.add(sep) 119 | sep.show() 120 | row.show_all() 121 | 122 | if len(videos) > 0: 123 | self.more_button.set_label("Load more") 124 | self.more_button.set_sensitive(True) 125 | self.more_button.show() 126 | if hide_pagination: 127 | self.more_button.hide() 128 | 129 | def download_videos_async(self, page: int, search: str = ''): 130 | videos = asyncio.run(get_videos(page, search)) 131 | GLib.idle_add(self.on_videos_downloaded, videos, len(search) > 0) 132 | 133 | def download_videos_and_apply_filters(self, _=None, paginate: bool = False, search: str = ''): 134 | if paginate: 135 | self.more_button.set_label("Loading ...") 136 | self.more_button.set_sensitive(False) 137 | self.current_page = self.current_page + 1 138 | else: 139 | self.spinner.start() 140 | self.spinner.show() 141 | self.footer.hide() 142 | self.more_button.hide() 143 | self.current_page = 0 144 | 145 | threading.Thread(target=self.download_videos_async, daemon=True, kwargs={'page': self.current_page, "search": search}).start() 146 | 147 | @debounce(1) 148 | def on_search(self, value): 149 | # We need to put Gtk in right thread since debounce create a timer in a separate thread 150 | Gdk.threads_enter() 151 | self.more_button.hide() 152 | 153 | # Empty library 154 | for child in self.rows_container.get_children(): 155 | child.destroy() 156 | 157 | self.download_videos_and_apply_filters(search=value) 158 | Gdk.threads_leave() 159 | 160 | def on_duration_filter_click(self, _): 161 | self.duration_filters.set_expanded(not self.duration_filters.get_expanded()) 162 | 163 | def on_clear_videos(self) -> None: 164 | for child in self.rows_container.get_children(): 165 | if isinstance(child, LibraryRow): 166 | for button in child.buttons: 167 | button.set_sensitive(True) 168 | -------------------------------------------------------------------------------- /ui/widgets/playback_interface.py: -------------------------------------------------------------------------------- 1 | from gi.repository import Gtk 2 | from gi.repository import Gst 3 | 4 | 5 | class PlaybackInterface: 6 | def __init__(self, url): 7 | self.url = url 8 | window = Gtk.Window() 9 | window.set_title("Video-Player") 10 | window.set_default_size(300, 300) 11 | window.connect("destroy", Gtk.main_quit, "WM destroy") 12 | self.movie_window = Gtk.DrawingArea() 13 | window.add(self.movie_window) 14 | window.show_all() 15 | window.hide() 16 | 17 | self.player = Gst.ElementFactory.make("playbin", "player") 18 | bus = self.player.get_bus() 19 | bus.add_signal_watch() 20 | bus.enable_sync_message_emission() 21 | bus.connect("message", self.on_message) 22 | bus.connect("sync-message::element", self.on_sync_message) 23 | self.start_stop() 24 | 25 | def start_stop(self): 26 | self.player.set_property("uri", self.url) 27 | self.player.set_state(Gst.State.PLAYING) 28 | 29 | def on_message(self, _, message): 30 | t = message.type 31 | if t == Gst.MessageType.EOS: 32 | self.player.set_state(Gst.State.NULL) 33 | elif t == Gst.MessageType.ERROR: 34 | self.player.set_state(Gst.State.NULL) 35 | err, debug = message.parse_error() 36 | print(err, debug) 37 | 38 | def on_sync_message(self, _, message): 39 | if message.get_structure().get_name() == 'prepare-window-handle': 40 | imagesink = message.src 41 | imagesink.set_property("force-aspect-ratio", True) 42 | -------------------------------------------------------------------------------- /ui/widgets/update_frame.py: -------------------------------------------------------------------------------- 1 | from gi.repository import Gtk 2 | from packaging import version 3 | from utils import CURRENT_VERSION, get_remote_version 4 | 5 | 6 | class UpdateFrame(Gtk.Frame): 7 | def __init__(self): 8 | super(UpdateFrame, self).__init__() 9 | remote_version = get_remote_version() 10 | print(remote_version) 11 | self.should_update = version.parse(CURRENT_VERSION) < version.parse(remote_version) 12 | self.set_label("Update available") 13 | self.set_margin_top(20) 14 | 15 | label = Gtk.Label(label=f"You are using version {CURRENT_VERSION} but update {remote_version} should be available in Discover. Please consider to update Steam Deck Repo Manager") 16 | label.set_margin_top(10) 17 | label.set_margin_bottom(10) 18 | self.add(label) 19 | -------------------------------------------------------------------------------- /utils/__init__.py: -------------------------------------------------------------------------------- 1 | import glob 2 | import os 3 | import platform 4 | import requests 5 | 6 | from pathlib import Path 7 | from utils.slugify import slugify 8 | 9 | movies_path = os.path.join(Path.home(), '.steam', 'root', 'config', 'uioverrides', 'movies') 10 | library_path = os.path.join(Path.home(), '.local', 'share', 'Steam', 'steamui', 'library.js') 11 | CURRENT_VERSION = "1.0.11" 12 | 13 | is_windows = platform.system() == "Windows" 14 | 15 | def get_remote_version(): 16 | response = requests.get( 17 | "https://raw.githubusercontent.com/CapitaineJSparrow/steam-repo-manager/main/flatpak/version.txt") 18 | return response.text.rstrip() 19 | 20 | 21 | def list_installed_videos(): 22 | # Ensure directory exists 23 | Path(movies_path).mkdir(parents=True, exist_ok=True) 24 | 25 | files = [slugify(f.name) for f in Path(movies_path).iterdir() if f.is_file()] 26 | return files 27 | 28 | 29 | def clear_installed_videos(_=None): 30 | # Ensure directory exists 31 | Path(movies_path).mkdir(parents=True, exist_ok=True) 32 | 33 | # Empty directory 34 | files = [f for f in Path(movies_path).iterdir() if f.is_file()] 35 | for f in files: 36 | f.unlink() 37 | print(f"{f} removed") 38 | 39 | 40 | def download_video(_, url, title: str): 41 | print(f"Downloading {url}") 42 | response = requests.get(url) 43 | trucatedTitle = title[:75] if len(title) > 75 else title # Truncate title if > 75 chars 44 | Path(movies_path).mkdir(parents=True, exist_ok=True) 45 | open(os.path.join(Path(movies_path), slugify(trucatedTitle) + ".webm"), "wb").write(response.content) 46 | 47 | 48 | def open_external(_, url: str = ''): 49 | os.system(f"xdg-open {url}") 50 | -------------------------------------------------------------------------------- /utils/debounce.py: -------------------------------------------------------------------------------- 1 | from threading import Timer 2 | 3 | 4 | def debounce(wait): 5 | def decorator(fn): 6 | def debounced(*args, **kwargs): 7 | def call_it(): 8 | fn(*args, **kwargs) 9 | try: 10 | debounced.t.cancel() 11 | except(AttributeError): 12 | pass 13 | debounced.t = Timer(wait, call_it) 14 | debounced.t.start() 15 | return debounced 16 | return decorator 17 | -------------------------------------------------------------------------------- /utils/slugify.py: -------------------------------------------------------------------------------- 1 | import unicodedata 2 | import re 3 | 4 | def slugify(value, allow_unicode=False): 5 | """ 6 | Taken from https://github.com/django/django/blob/master/django/utils/text.py 7 | Convert to ASCII if 'allow_unicode' is False. Convert spaces or repeated 8 | dashes to single dashes. Remove characters that aren't alphanumerics, 9 | underscores, or hyphens. Convert to lowercase. Also strip leading and 10 | trailing whitespace, dashes, and underscores. 11 | """ 12 | value = str(value) 13 | if allow_unicode: 14 | value = unicodedata.normalize('NFKC', value) 15 | else: 16 | value = unicodedata.normalize('NFKD', value).encode('ascii', 'ignore').decode('ascii') 17 | value = re.sub(r'[^\w\s-]', '', value.lower()) 18 | return re.sub(r'[-\s]+', '-', value).strip('-_') 19 | --------------------------------------------------------------------------------