├── LICENSE ├── create_shortcut_windows.vbs ├── fapelsystem ├── config_file_handler.py ├── dir_helper.py ├── fapel_counter.py ├── fapel_elo.py ├── fapel_exiles.py ├── fapel_fap_set.py ├── fapel_search_not_tagged.py ├── fapel_search_source_file.py ├── fapel_search_tagged.py ├── fapel_system_template.conf ├── fapel_system_template_windows.conf ├── fapel_tagger.py ├── fapxile_file_template ├── openLink.sh ├── print_module_dir.py ├── tagPackExport.py └── tagPackInstall.py ├── img ├── 001.png ├── 002.png ├── 003.png ├── 004.png ├── 005.png ├── 006.png ├── 007.png ├── 008.png ├── 009.png ├── 010.png ├── 011.png ├── 013.png ├── 014.png ├── 015.png ├── 132462.png ├── 141.png ├── 142.png ├── 143.png ├── 144.png ├── 145.png ├── 201.png ├── 202.png ├── 203.png ├── 211.png ├── 212.png ├── 213.png ├── 270.png ├── 27173524.png ├── 278.png ├── 279.png ├── 280.png ├── 281.gif ├── 3298424.png ├── 432432.png ├── 4837312.png ├── 6262673.png ├── 73982.png ├── 763826432.png ├── 829732.png ├── 8328253.png ├── 8383672.png ├── 85201.png ├── 85202.png ├── 85203.png ├── 85204.png ├── 85205.png ├── 85206.png ├── 85207.png ├── 85208.png ├── 8726632.png ├── 8732243.png ├── 8824314.png ├── 88264267.png ├── 98626723.png ├── 987762.png ├── 99078327.png └── 99787312.png ├── install_ubuntu.sh ├── install_windows.bat ├── readme.md ├── setup.py └── uninstall_release_0_1_0alpha.sh /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 | -------------------------------------------------------------------------------- /create_shortcut_windows.vbs: -------------------------------------------------------------------------------- 1 | set fs = CreateObject("Scripting.FileSystemObject") 2 | set ws = WScript.CreateObject("WScript.Shell") 3 | set arg = Wscript.Arguments 4 | 5 | linkFile = arg(0) 6 | 7 | set link = ws.CreateShortcut(linkFile) 8 | REM link.TargetPath = fs.BuildPath(ws.CurrentDirectory, arg(1)) 9 | link.TargetPath = arg(1) 10 | if arg.count > 2 then 11 | link.Arguments = arg(2) 12 | end if 13 | link.Save -------------------------------------------------------------------------------- /fapelsystem/config_file_handler.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | # 3 | ############################################################################################## 4 | # 5 | # The fapel system organizes image and video collections under Linux with standard folders. 6 | # 7 | # For updates see git-repo at 8 | #https://github.com/pronopython/fapel-system 9 | # 10 | ############################################################################################## 11 | # 12 | # Copyright (C) 2022-2023 PronoPython 13 | # 14 | # Contact me at pronopython@proton.me 15 | # 16 | # This program is free software: you can redistribute it and/or modify it 17 | # under the terms of the GNU General Public License as published by the 18 | # Free Software Foundation, either version 3 of the License, or 19 | # (at your option) any later version. 20 | # 21 | # This program is distributed in the hope that it will be useful, 22 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 23 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 24 | # GNU General Public License for more details. 25 | # 26 | # You should have received a copy of the GNU General Public License 27 | # along with this program. If not, see . 28 | # 29 | ############################################################################################## 30 | # 31 | import os 32 | from pathlib import Path 33 | import configparser 34 | from . import dir_helper as dir_helper 35 | 36 | 37 | ############################################################################################## 38 | #Load Config 39 | ############################################################################################## 40 | 41 | class FapelSystemConfigFile: 42 | 43 | 44 | def __init__(self, configFilePath): 45 | self.configFilePath = configFilePath 46 | 47 | self.homedir = dir_helper.getHomeDir() 48 | self.configFilePath = dir_helper.expandHomeDir(self.configFilePath) 49 | 50 | self.createConfigParserAndLoadConfig() 51 | self.configChanged = False 52 | 53 | def createConfigParserAndLoadConfig(self): 54 | self.configParser = None 55 | print("Opening config file",self.configFilePath) 56 | if (os.path.isfile(self.configFilePath)): 57 | self.configParser = configparser.RawConfigParser(allow_no_value=True) 58 | self.configParser.read(self.configFilePath) 59 | else: 60 | print("Config file is missing, abort!") 61 | exit() 62 | 63 | def getConfigParser(self): 64 | return self.configParser 65 | 66 | 67 | 68 | def get(self, group, key): 69 | return self.configParser.get(group, key) 70 | 71 | 72 | def getInt(self, group, key): 73 | return int(self.configParser.get(group, key)) 74 | 75 | def getBoolean(self, group, key): 76 | return self.configParser.get(group, key) in ("True","TRUE","true","1") 77 | 78 | def getDir(self, group, key, ifEmpty=""): 79 | path = self.get(group, key) 80 | if path == "": 81 | return ifEmpty.replace("~", self.homedir) 82 | return path.replace("~", self.homedir) 83 | 84 | 85 | def items(self, group): 86 | return self.configParser.items(group) 87 | 88 | def changeConfig(self): 89 | self.configChanged = True 90 | return self.configParser 91 | 92 | def writeChangedConfig(self): 93 | if self.configChanged: 94 | print("Writing changes to config file",self.configFilePath) 95 | configfile = open(self.configFilePath, 'w') 96 | self.configParser.write(configfile) 97 | 98 | -------------------------------------------------------------------------------- /fapelsystem/dir_helper.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | # 3 | ############################################################################################## 4 | # 5 | # The fapel system organizes image and video collections under Linux with standard folders. 6 | # 7 | # For updates see git-repo at 8 | #https://github.com/pronopython/fapel-system 9 | # 10 | ############################################################################################## 11 | # 12 | VERSION = "0.1.0" #TODO 13 | CONFIGFILE="~/.config/fapel_system.conf" 14 | # 15 | ############################################################################################## 16 | # 17 | # Copyright (C) 2022-2023 PronoPython 18 | # 19 | # Contact me at pronopython@proton.me 20 | # 21 | # This program is free software: you can redistribute it and/or modify it 22 | # under the terms of the GNU General Public License as published by the 23 | # Free Software Foundation, either version 3 of the License, or 24 | # (at your option) any later version. 25 | # 26 | # This program is distributed in the hope that it will be useful, 27 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 29 | # GNU General Public License for more details. 30 | # 31 | # You should have received a copy of the GNU General Public License 32 | # along with this program. If not, see . 33 | # 34 | ############################################################################################## 35 | # 36 | import os 37 | from pathlib import Path 38 | import configparser 39 | import platform 40 | 41 | 42 | def getHomeDir(): 43 | return os.path.expanduser('~') 44 | 45 | def expandHomeDir(path): 46 | return path.replace("~", getHomeDir()) 47 | 48 | def getFilenameWithoutExtension(pathWithFullFilename): 49 | return Path(pathWithFullFilename).stem 50 | 51 | def getLastPartOfFilename(path): 52 | myName = getFilenameWithoutExtension(os.path.abspath(path)) 53 | counterKey = myName # was unbound in v0.2.0-alpha 54 | last1 = myName.split('_')[-1] 55 | last2 = myName.split('-')[-1] 56 | if (last1 != myName) or (last2 != myName): 57 | if len(last1) < len(last2): 58 | counterKey = last1 59 | else: 60 | counterKey = last2 61 | return counterKey 62 | 63 | OS_LINUX = "Linux" 64 | OS_WINDOWS = "Windows" 65 | OS_MACOS = "Darwin" 66 | 67 | def getOS(): 68 | return platform.system() 69 | 70 | 71 | def getConfigDir(subfolderForWindows): 72 | configDir = "" 73 | myos = getOS() 74 | if myos == OS_LINUX or myos == OS_MACOS: 75 | configDir = os.path.join(getHomeDir(),".config") 76 | elif myos == OS_WINDOWS: 77 | configDir = os.path.join(os.environ['APPDATA'], subfolderForWindows) 78 | return configDir 79 | 80 | def getInstallDir(): 81 | return os.path.dirname(os.path.realpath(__file__)) 82 | -------------------------------------------------------------------------------- /fapelsystem/fapel_counter.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | # 3 | ############################################################################################## 4 | # 5 | # The fapel system organizes image and video collections under Linux with standard folders. 6 | # fappel_counter tags media with an upward counting tag 7 | # 8 | # For updates see git-repo at 9 | #https://github.com/pronopython/fapel-system 10 | # 11 | ############################################################################################## 12 | # 13 | VERSION = "0.2.0" #TODO 14 | # 15 | ############################################################################################## 16 | # 17 | # Copyright (C) 2022-2023 PronoPython 18 | # 19 | # Contact me at pronopython@proton.me 20 | # 21 | # This program is free software: you can redistribute it and/or modify it 22 | # under the terms of the GNU General Public License as published by the 23 | # Free Software Foundation, either version 3 of the License, or 24 | # (at your option) any later version. 25 | # 26 | # This program is distributed in the hope that it will be useful, 27 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 29 | # GNU General Public License for more details. 30 | # 31 | # You should have received a copy of the GNU General Public License 32 | # along with this program. If not, see . 33 | # 34 | ############################################################################################## 35 | # TODO collision untested (filenames are present AND matched instead of inode) 36 | 37 | 38 | 39 | import tkinter 40 | from tkinter import messagebox 41 | import os 42 | import sys 43 | import shutil 44 | 45 | 46 | 47 | 48 | ############################################################################################## 49 | #Import lib 50 | ############################################################################################## 51 | 52 | from fapelsystem import config_file_handler as config_file_handler 53 | from fapelsystem import dir_helper as dir_helper 54 | 55 | 56 | configDir = dir_helper.getConfigDir("Fapelsystem") 57 | #print(configDir) 58 | configParser = config_file_handler.FapelSystemConfigFile(os.path.join(configDir,"fapel_system.conf")) 59 | 60 | 61 | 62 | ############################################################################################## 63 | #Init Vars 64 | ############################################################################################## 65 | 66 | 67 | # first arg is name of script 68 | # second is file 69 | 70 | rootPathKey = None 71 | noticeableFapel_fullpath = None 72 | 73 | 74 | if (len(sys.argv) == 2): 75 | noticeableFapel_fullpath = os.path.abspath(sys.argv[1]) 76 | # counter name is derived from the last part after - or _ of this script's name 77 | # this can also be from a soft link to this script (which is the main way to 78 | # start this script 79 | # so softlink what_else_counts_cucumber.py -> fapel_counter.py will look for the 80 | # key "cucumber" in the conf file 81 | rootPathKey = dir_helper.getLastPartOfFilename(os.path.abspath(sys.argv[0])) 82 | 83 | elif (len(sys.argv) == 3): 84 | noticeableFapel_fullpath = os.path.abspath(sys.argv[2]) 85 | rootPathKey = sys.argv[1] 86 | 87 | else: 88 | print("You must start this with one file as the one to be counted") 89 | sys.exit() 90 | 91 | 92 | 93 | 94 | print("Counter Name:",rootPathKey) 95 | 96 | 97 | ## message 98 | #root = tkinter.Tk() 99 | #root.withdraw() 100 | #messagebox.showinfo("Counter Name:",rootPathKey) 101 | 102 | rootpath = configParser.getDir('countersDirs',rootPathKey) 103 | print(rootPathKey,rootpath) 104 | 105 | 106 | ############################################################################################## 107 | #Main 108 | ############################################################################################## 109 | 110 | 111 | 112 | 113 | 114 | 115 | head, tail = os.path.split(noticeableFapel_fullpath) 116 | noticeableFapel_filename = tail 117 | twin_current_dir = "" 118 | 119 | 120 | 121 | print("looking for file ",noticeableFapel_filename) 122 | for root,d_names,f_names in os.walk(rootpath): 123 | #print (root, d_names, f_names) 124 | for f_name in f_names: 125 | #tagname = os.path.relpath(os.path.join(root, d_name), rootpath) 126 | #tag = Tag(tagname) 127 | #tag.dir = os.path.join(root, d_name) 128 | #tags.add(tag) 129 | print (noticeableFapel_filename,f_name) 130 | if noticeableFapel_filename == f_name: 131 | # match 132 | twin_current_dir = root 133 | twin_current_fullpath = os.path.join(root, f_name) 134 | twin_filename = f_name 135 | 136 | 137 | if twin_current_dir != "": 138 | # found in one of the dirs, move one further 139 | currentNoticeNumber = int(os.path.relpath(twin_current_dir, rootpath)) 140 | nextNoticeNumber = currentNoticeNumber + 1 141 | 142 | nextNoticePath = os.path.join(rootpath, f"{nextNoticeNumber:04d}") 143 | 144 | if not os.path.isdir(nextNoticePath): 145 | # notice number does not exist 146 | os.mkdir(nextNoticePath) 147 | 148 | # rename till it fits 149 | new_twin_name = twin_filename 150 | destinationFilename = os.path.join(nextNoticePath, new_twin_name) 151 | while os.path.isfile(destinationFilename): 152 | #change filename 153 | f_name, f_ext = os.path.splitext(new_twin_name) 154 | new_twin_name = f_name + "_A" + f_ext 155 | destinationFilename = os.path.join(nextNoticePath, new_twin_name) 156 | 157 | os.rename(twin_current_fullpath, destinationFilename) 158 | 159 | # if old twin dir is empty delete it 160 | if len(os.listdir(twin_current_dir)) == 0: 161 | #os.remove(twin_current_dir) 162 | pass # TODO old twin dir is empty delete it .. or not?? 163 | 164 | # message 165 | root = tkinter.Tk() 166 | root.withdraw() 167 | messagebox.showinfo(noticeableFapel_filename, ""+str(currentNoticeNumber)+u" \u2192 "+str(nextNoticeNumber)) 168 | 169 | else: 170 | # must be hardlinked into 0001 dir 171 | print ("new, mv to 0001") 172 | nextNoticeNumber = 1 173 | 174 | nextNoticePath = os.path.join(rootpath, f"{nextNoticeNumber:04d}") 175 | 176 | if not os.path.isdir(nextNoticePath): 177 | # notice number does not exist 178 | os.mkdir(nextNoticePath) 179 | 180 | # rename till it fits 181 | new_twin_name = noticeableFapel_filename 182 | destinationFilename = os.path.join(nextNoticePath, new_twin_name) 183 | while os.path.isfile(destinationFilename): 184 | # change filename 185 | f_name, f_ext = os.path.splitext(new_twin_name) 186 | new_twin_name = f_name + "_A" + f_ext 187 | destinationFilename = os.path.join(nextNoticePath, new_twin_name) 188 | 189 | os.link(noticeableFapel_fullpath, destinationFilename) 190 | # message 191 | root = tkinter.Tk() 192 | root.withdraw() 193 | messagebox.showinfo(noticeableFapel_filename, u"new \u2192 1") 194 | -------------------------------------------------------------------------------- /fapelsystem/fapel_elo.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | # 3 | ############################################################################################## 4 | # 5 | # The fapel system organizes image and video collections under Linux with standard folders. 6 | # fappel_elo is a GUI based ranking application for all fapels / media in the tag folder 7 | # system. 8 | # 9 | # For updates see git-repo at 10 | #https://github.com/pronopython/fapel-system 11 | # 12 | ############################################################################################## 13 | # 14 | VERSION = "0.2.1" #TODO 15 | # 16 | ############################################################################################## 17 | # 18 | # Copyright (C) 2022-2023 PronoPython 19 | # 20 | # Contact me at pronopython@proton.me 21 | # 22 | # This program is free software: you can redistribute it and/or modify it 23 | # under the terms of the GNU General Public License as published by the 24 | # Free Software Foundation, either version 3 of the License, or 25 | # (at your option) any later version. 26 | # 27 | # This program is distributed in the hope that it will be useful, 28 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 29 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 30 | # GNU General Public License for more details. 31 | # 32 | # You should have received a copy of the GNU General Public License 33 | # along with this program. If not, see . 34 | # 35 | ############################################################################################## 36 | # 37 | # TODO random from dirs 38 | # TODO install Pillow ;; pip3 install Pillow ;; sudo apt-get install python3-pil.imagetk 39 | # TODO cleanup: delete last 20% 40 | # TODO not interested in left => eloignoredpath 41 | # TODO not interested in right => eloignoredpath 42 | # TODO rightclick bei leftmode only => do you want to swtich?? 43 | 44 | 45 | from tkinter import messagebox 46 | from tkinter import * 47 | import os 48 | import sys 49 | import random 50 | from PIL import Image, ImageTk 51 | import configparser 52 | 53 | 54 | ############################################################################################## 55 | #Load Config 56 | ############################################################################################## 57 | 58 | from fapelsystem import config_file_handler as config_file_handler 59 | from fapelsystem import dir_helper as dir_helper 60 | 61 | 62 | configDir = dir_helper.getConfigDir("Fapelsystem") 63 | #print(configDir) 64 | configParser = config_file_handler.FapelSystemConfigFile(os.path.join(configDir,"fapel_system.conf")) 65 | 66 | 67 | # load to be excluded tag names (=dirs) 68 | excludedTagNames = [] 69 | for item in configParser.items('excludedTagNames'): 70 | excludedTagNames.append(item[0]) 71 | print("Excluded Tag names:",excludedTagNames) 72 | 73 | 74 | ############################################################################################## 75 | #Init Vars 76 | ############################################################################################## 77 | 78 | 79 | 80 | rootpath = configParser.getDir('dirs','tagDir') 81 | print("tagDir",rootpath) 82 | 83 | elopath = configParser.getDir('dirs','eloDir') 84 | print("eloDir",elopath) 85 | 86 | 87 | #eloignoredpath = configParser.getDir('dirs','eloIgnoredDir') 88 | #print("eloIgnoredDir",eloignoredpath) 89 | 90 | MIN_ELO_RANK = 100000000000000000 91 | MAX_ELO_RANK = 999999999999999999 92 | 93 | 94 | FT_COLORS = {} 95 | for item in configParser.items('colors'): 96 | FT_COLORS[item[0]]=item[1] 97 | 98 | TEXT_MOUSE=("Mouse Mode: Left only","Mouse Mode: Left + Right") 99 | 100 | 101 | ############################################################################################## 102 | #Classes 103 | ############################################################################################## 104 | 105 | 106 | 107 | 108 | class FapelLabel(Label): 109 | # status: int 110 | 111 | global FT_COLORS 112 | original: Image 113 | def __init__(self, window, image): 114 | self.original = image 115 | 116 | super().__init__(window, bg=FT_COLORS["fapel_background"]) 117 | 118 | self.columnconfigure(0,weight=1) 119 | self.rowconfigure(0,weight=1) 120 | self.original = image 121 | self.image = ImageTk.PhotoImage(self.original) 122 | self.display = Canvas(self, bd=0, highlightthickness=0, bg=FT_COLORS["fapel_background"]) 123 | self.display.create_image(0, 0, image=self.image, anchor=NW, tags="IMG") 124 | self.display.grid(row=0, sticky=W+E+N+S) 125 | self.pack(fill=BOTH, expand=1) 126 | self.bind("", self.resize) 127 | 128 | 129 | def resize(self, event): 130 | 131 | if self.original.width/self.original.height > self.winfo_width()/self.winfo_height(): 132 | size = (int(self.winfo_width()), int((self.winfo_width()*self.original.height)/self.original.width)) 133 | else: 134 | size = (int((self.original.width*self.winfo_height())/self.original.height), int(self.winfo_height())) 135 | 136 | 137 | 138 | resized = self.original.resize(size,Image.ANTIALIAS) 139 | self.image = ImageTk.PhotoImage(resized) 140 | self.display.delete("IMG") 141 | self.display.create_image(0, 0, image=self.image, anchor=NW, tags="IMG") 142 | 143 | 144 | 145 | def setAlpha(self, alphaValue): 146 | self.original.putalpha(alphaValue) 147 | self.event_generate("") 148 | 149 | def setImage(self, image): 150 | self.original = image 151 | self.event_generate("") 152 | 153 | 154 | 155 | 156 | 157 | 158 | class Fapel: 159 | def __init__(self, fullpath, elopath, inode): 160 | self.fullPath = fullpath 161 | self.inode = inode 162 | head, tail = os.path.split(self.fullPath) 163 | self.filename = tail 164 | self.eloDirFullPath = "" 165 | self.elo = -1 # no ranking yet (=-1) 166 | self.elopath = elopath 167 | self.extension = os.path.splitext(self.fullPath)[1] 168 | 169 | def updateElo(self): 170 | if (self.eloDirFullPath == ""): # fapel not ranked yet, hardlink it now 171 | self.eloDirFullPath = os.path.join(self.elopath, str(self.elo)+self.extension) 172 | os.link(self.fullPath, self.eloDirFullPath) 173 | else: 174 | newName = os.path.join(self.elopath, str(self.elo)+self.extension) 175 | #print("RENAME:",self.eloDirFullPath,"==>",newName) 176 | os.rename(self.eloDirFullPath, newName) 177 | self.eloDirFullPath = newName 178 | self.fullPath = newName 179 | def changeToTempName(self): # is used while defrag runs, so that nothing is overwritten 180 | if (self.eloDirFullPath != ""): 181 | newName = os.path.join(self.elopath, "TEMP_"+str(self.elo)+self.extension) 182 | #print("RENAME:",self.eloDirFullPath,"==>",newName) 183 | os.rename(self.eloDirFullPath, newName) 184 | self.eloDirFullPath = newName 185 | self.fullPath = newName 186 | 187 | class CurrentFapels: 188 | #self.leftLabel: FapelLabel 189 | #self.rigthtLabel: FapelLabel 190 | 191 | global MIN_ELO_RANK 192 | global MAX_ELO_RANK 193 | 194 | PROBABILITY_TAKE_FROM_RANKED = 0.5 195 | 196 | useBothMouseButtons = True 197 | clicksUntilChange = 3 198 | leftClicks = 0 199 | rightClicks = 0 200 | 201 | def __init__(self, allFapels, rankedFapels): 202 | self.allFapels = allFapels 203 | self.rankedFapels = rankedFapels 204 | self.sortFapels() 205 | self.shuffle() 206 | 207 | def sortFapels(self): 208 | self.rankedFapels.sort(key=self.comparator) 209 | 210 | 211 | def comparator(self, fapel): 212 | return fapel.elo 213 | 214 | 215 | def shuffle(self): 216 | #print("Shuffling..") 217 | 218 | if (len(self.rankedFapels) == 0): # if you first start elo with no ranked fapels 219 | self.choiceLeft = random.choice(self.allFapels) 220 | else: 221 | self.choiceLeft = random.choice(self.rankedFapels) 222 | self.choiceRight = self.choiceLeft 223 | while (self.choiceLeft == self.choiceRight): 224 | if (random.random() < self.PROBABILITY_TAKE_FROM_RANKED) and (len(self.rankedFapels) > 0): 225 | self.choiceRight = random.choice(self.rankedFapels) 226 | else: 227 | self.choiceRight = random.choice(self.allFapels) 228 | 229 | 230 | 231 | def setFapelLabels(self, leftLabel, rightLabel): 232 | self.leftLabel = leftLabel 233 | self.rightLabel = rightLabel 234 | 235 | 236 | 237 | def mouseLeftOnLeft(self, event=None): 238 | if (self.useBothMouseButtons): 239 | self.clickLeft() 240 | else: 241 | self.clickLeft() 242 | 243 | def mouseRightOnLeft(self, event=None): 244 | if (self.useBothMouseButtons): 245 | self.clickRight() 246 | else: 247 | self.clickLeft() 248 | 249 | def mouseLeftOnRight(self, event=None): 250 | if (self.useBothMouseButtons): 251 | self.clickLeft() 252 | else: 253 | self.clickRight() 254 | 255 | def mouseRightOnRight(self, event=None): 256 | if (self.useBothMouseButtons): 257 | self.clickRight() 258 | else: 259 | self.clickRight() 260 | 261 | def toggleMouseMode(self): 262 | if (self.useBothMouseButtons): 263 | self.toggleButton['text'] = TEXT_MOUSE[0] 264 | self.useBothMouseButtons=False 265 | else: 266 | self.toggleButton['text'] = TEXT_MOUSE[1] 267 | self.useBothMouseButtons=True 268 | 269 | def setToggleButton(self, toggleButton): 270 | self.toggleButton = toggleButton 271 | 272 | 273 | def clickLeft(self, event=None): 274 | # `command=` calls function without argument 275 | # `bind` calls function with one argument 276 | #print("fapel left clicked") 277 | 278 | self.leftClicks = self.leftClicks + 1 279 | self.rightClicks = 0 280 | if (self.leftClicks >= self.clicksUntilChange): 281 | self.rankFapelWinnerLooser(self.choiceLeft,self.choiceRight) 282 | self.shuffle() 283 | image = Image.open(self.choiceLeft.fullPath) 284 | self.leftLabel.setImage(image) 285 | image = Image.open(self.choiceRight.fullPath) 286 | self.rightLabel.setImage(image) 287 | self.leftClicks = 0 288 | self.rightClicks = 0 289 | else: 290 | self.leftLabel.setAlpha(255) 291 | self.rightLabel.setAlpha(int(255-((255/self.clicksUntilChange)*self.leftClicks))) 292 | 293 | 294 | 295 | def clickRight(self, event=None): 296 | # `command=` calls function without argument 297 | # `bind` calls function with one argument 298 | #print("fapel right clicked") 299 | 300 | self.leftClicks = 0 301 | self.rightClicks = self.rightClicks + 1 302 | if (self.rightClicks >= self.clicksUntilChange): 303 | self.rankFapelWinnerLooser(self.choiceRight,self.choiceLeft) 304 | self.shuffle() 305 | image = Image.open(self.choiceLeft.fullPath) 306 | self.leftLabel.setImage(image) 307 | image = Image.open(self.choiceRight.fullPath) 308 | self.rightLabel.setImage(image) 309 | self.leftClicks = 0 310 | self.rightClicks = 0 311 | else: 312 | self.leftLabel.setAlpha(int(255-((255/self.clicksUntilChange)*self.rightClicks))) 313 | self.rightLabel.setAlpha(255) 314 | 315 | 316 | def defragmentAllElos(self): 317 | print("Defragmenting Elos... might take a while") 318 | 319 | messagebox.showinfo("Defragmentation needed", "About to defragment all elo filenames, this might take a while and app seems unresponsive. Do not abort this process!") 320 | 321 | spaceBetweenElos = int((MAX_ELO_RANK - MIN_ELO_RANK) / (len(self.rankedFapels) + 1)) 322 | 323 | self.sortFapels() 324 | currentEloNumber = MIN_ELO_RANK + spaceBetweenElos 325 | for fapel in self.rankedFapels: 326 | fapel.elo = currentEloNumber 327 | currentEloNumber = currentEloNumber + spaceBetweenElos 328 | self.sortFapels() 329 | print("...renaming all ranked Fapels...") 330 | for fapel in self.rankedFapels: 331 | fapel.changeToTempName() 332 | for fapel in self.rankedFapels: 333 | fapel.updateElo() 334 | messagebox.showinfo("Defragmentation", "Defragmentation finished!") 335 | 336 | def getEloRankedOneHigher(self, fapel): 337 | eloLeft = MIN_ELO_RANK 338 | for fapelLeft in self.rankedFapels: 339 | if fapelLeft.elo >= fapel.elo: 340 | break; 341 | else: 342 | eloLeft = fapelLeft.elo 343 | return eloLeft 344 | 345 | def getFittingElo(self, fapelLooser): 346 | # find the LEFT neighbour of fapelLooser 347 | eloLeft = self.getEloRankedOneHigher(fapelLooser) 348 | if ((fapelLooser.elo - eloLeft) < 3): 349 | self.defragmentAllElos() 350 | eloLeft = self.getEloRankedOneHigher(fapelLooser) 351 | if ((fapelLooser.elo - eloLeft) < 3): # still too close? 352 | print("elos to close together, too many elos, giving up... panic") 353 | exit() 354 | return random.randint(eloLeft + 1, fapelLooser.elo - 1) 355 | 356 | def getNewEndElo(self, lastFapel): 357 | if ((MAX_ELO_RANK - lastFapel.elo) < 3): 358 | self.defragmentAllElos() 359 | if ((MAX_ELO_RANK - lastFapel.elo) < 3): # still too close? 360 | print("elos to close together, too many elos, giving up... panic") 361 | exit() 362 | return random.randint(lastFapel.elo + 1, MAX_ELO_RANK - 1) 363 | 364 | def rankFapelWinnerLooser(self, fapelWinner, fapelLooser): 365 | 366 | # [no elo] wins over [no elo] -> only one time when no ranked fapel exists 367 | 368 | if ((fapelWinner.elo == -1) and (fapelLooser.elo == -1)): 369 | print("First fapel ranked") 370 | fapelWinner.elo = MIN_ELO_RANK + int((MAX_ELO_RANK - MIN_ELO_RANK) / 2) 371 | fapelWinner.updateElo() 372 | self.rankedFapels.append(fapelWinner) 373 | self.sortFapels() 374 | 375 | # [ELO] wins over [no elo] 376 | elif ((fapelWinner.elo > -1) and (fapelLooser.elo == -1)): 377 | self.sortFapels() 378 | lastFapel = self.rankedFapels[-1] 379 | secondLastElo = self.getFittingElo(lastFapel) 380 | 381 | 382 | #fapelLooser.elo = lastFapel.elo 383 | fapelLooser.elo = self.getNewEndElo(lastFapel) 384 | lastFapel.elo = secondLastElo 385 | lastFapel.updateElo() 386 | fapelLooser.updateElo() 387 | self.rankedFapels.append(fapelLooser) 388 | self.sortFapels() 389 | 390 | 391 | 392 | # [no elo] wins over [ELO] 393 | elif ((fapelWinner.elo == -1) and (fapelLooser.elo > -1)): 394 | newElo = self.getFittingElo(fapelLooser) 395 | fapelWinner.elo = newElo 396 | self.rankedFapels.append(fapelWinner) 397 | fapelWinner.updateElo() 398 | self.sortFapels() 399 | 400 | # [ELO] wins over [ELO] AND winner.elo > looser.elo 401 | elif ((fapelWinner.elo > -1) and (fapelLooser.elo > -1)): 402 | # only, when winner is not already ranked better 403 | if (fapelWinner.elo > fapelLooser.elo): 404 | newElo = self.getFittingElo(fapelLooser) 405 | fapelWinner.elo = newElo 406 | #if (fapelWinner not in rankedFapels): 407 | # self.rankedFapels.append(fapelWinner) 408 | fapelWinner.updateElo() 409 | self.sortFapels() 410 | 411 | 412 | 413 | 414 | # --- main --- 415 | 416 | # init 417 | tinkerRoot = Tk() 418 | 419 | tinkerRoot['bg'] = bg=FT_COLORS["window_background"] 420 | fapelframe = Frame(tinkerRoot, bg=FT_COLORS["window_background"]) 421 | 422 | tinkerRoot.title("fapel elo") 423 | 424 | inodeToFapel = {} # dictionary 425 | allFapels = [] 426 | rankedFapels = [] 427 | WORKING_EXTENSIONS = [".jpg",".jpeg",".tif",".tiff",".png",".gif"] 428 | 429 | excludedSubDirs = [] 430 | 431 | # create Fapels of all Elements inside Tags Dir 432 | for root,d_names,f_names in os.walk(rootpath): 433 | traverseDir = True 434 | for excludedSubDir in excludedSubDirs: 435 | if (root.find(excludedSubDir) != -1): 436 | traverseDir = False 437 | 438 | for excludedTagName in excludedTagNames: 439 | if (root.find(excludedTagName) != -1): 440 | traverseDir = False 441 | 442 | if (traverseDir): 443 | for f_name in f_names: 444 | if (f_name == ".exclude_subdirs"): 445 | excludedSubDirs.append(root) 446 | else: 447 | f_fullPath = os.path.join(root, f_name) 448 | f_nameOnly, f_ext = os.path.splitext(f_name) 449 | if (f_ext.lower() in WORKING_EXTENSIONS): 450 | inode = os.stat(f_fullPath).st_ino 451 | if (inode not in inodeToFapel): 452 | fapel = Fapel(f_fullPath, elopath, inode) 453 | inodeToFapel[inode] = fapel 454 | allFapels.append(fapel) 455 | 456 | print("Found",len(inodeToFapel), "individual fapels in Tags") 457 | 458 | 459 | # create Fapels of all Elements inside Elo Dir (if not already created before), and get their rank 460 | for root,d_names,f_names in os.walk(elopath): 461 | for f_name in f_names: 462 | 463 | # exclude files like ".hidden" 464 | f_nameOnly, f_ext = os.path.splitext(f_name) 465 | if not (f_ext.lower() in WORKING_EXTENSIONS): 466 | continue 467 | 468 | f_fullPath = os.path.join(root, f_name) 469 | inode = os.stat(f_fullPath).st_ino 470 | 471 | if (inode in inodeToFapel): # fapel is known 472 | fapel = inodeToFapel[inode] 473 | 474 | else: # fapel is new 475 | fapel = Fapel(f_fullPath, elopath, inode) 476 | inodeToFapel[inode] = fapel 477 | allFapels.append(fapel) 478 | fapel.eloDirFullPath = f_fullPath 479 | f_name_eloNumber, f_ext = os.path.splitext(f_name) 480 | fapel.elo = int(f_name_eloNumber) 481 | rankedFapels.append(fapel) 482 | #print("Fapel ",fapel.filename," ranked ",fapel.elo) 483 | 484 | print("Found",len(rankedFapels), "ranked fapels in Elo") 485 | 486 | 487 | 488 | 489 | currentFapels = CurrentFapels(allFapels, rankedFapels) 490 | 491 | 492 | 493 | # load image 494 | image = Image.open(currentFapels.choiceLeft.fullPath) 495 | image2 = Image.open(currentFapels.choiceRight.fullPath) 496 | 497 | 498 | # label with image 499 | l = FapelLabel(fapelframe, image=image) 500 | #l.grid(row=0, column=0) 501 | l.pack(side = LEFT, fill = BOTH ,expand=1 ) 502 | l.display.bind('', currentFapels.mouseLeftOnLeft) 503 | l.display.bind('', currentFapels.mouseRightOnLeft) 504 | 505 | m = FapelLabel(fapelframe, image=image2) 506 | #m.grid(row=0, column=1) 507 | m.pack(side = RIGHT, fill = BOTH ,expand=1 ) 508 | m.display.bind('', currentFapels.mouseLeftOnRight) 509 | m.display.bind('', currentFapels.mouseRightOnRight) 510 | 511 | currentFapels.setFapelLabels(l,m) 512 | 513 | fapelframe.pack(side = TOP, fill = BOTH ,expand=1 ) 514 | 515 | 516 | buttonframe = Frame(tinkerRoot, bg=FT_COLORS["window_background"]) 517 | 518 | 519 | b = Button(buttonframe, text=TEXT_MOUSE[1], command=currentFapels.toggleMouseMode, bg=FT_COLORS["button_cancel"]) 520 | currentFapels.setToggleButton(b) 521 | b.pack(side='left') 522 | 523 | # button with text closing window 524 | t = Button(buttonframe, text="Exit", command=tinkerRoot.destroy, bg=FT_COLORS["button_cancel"]) 525 | t.pack(side='right') 526 | 527 | 528 | buttonframe.pack(side = BOTTOM) 529 | 530 | 531 | 532 | # "start the engine" 533 | tinkerRoot.mainloop() 534 | -------------------------------------------------------------------------------- /fapelsystem/fapel_exiles.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | # 3 | ############################################################################################## 4 | # 5 | # The fapel system organizes image and video collections under Linux with standard folders. 6 | # fappel_exiles can dynamically hide media in the filemanager through updating the .hidden 7 | # files. 8 | # 9 | # For updates see git-repo at 10 | #https://github.com/pronopython/fapel-system 11 | # 12 | ############################################################################################## 13 | # 14 | VERSION = "0.2.0" 15 | # 16 | ############################################################################################## 17 | # 18 | # Copyright (C) 2022-2023 PronoPython 19 | # 20 | # Contact me at pronopython@proton.me 21 | # 22 | # This program is free software: you can redistribute it and/or modify it 23 | # under the terms of the GNU General Public License as published by the 24 | # Free Software Foundation, either version 3 of the License, or 25 | # (at your option) any later version. 26 | # 27 | # This program is distributed in the hope that it will be useful, 28 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 29 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 30 | # GNU General Public License for more details. 31 | # 32 | # You should have received a copy of the GNU General Public License 33 | # along with this program. If not, see . 34 | # 35 | ############################################################################################## 36 | 37 | 38 | from tkinter import * 39 | from tkinter import ttk 40 | import tkinter as tk 41 | import tkinter.font as font 42 | import os 43 | import sys 44 | import configparser 45 | import time 46 | 47 | 48 | ############################################################################################## 49 | #Import lib 50 | ############################################################################################## 51 | 52 | from fapelsystem import config_file_handler as config_file_handler 53 | from fapelsystem import dir_helper as dir_helper 54 | 55 | 56 | configDir = dir_helper.getConfigDir("Fapelsystem") 57 | #print(configDir) 58 | configParser = config_file_handler.FapelSystemConfigFile(os.path.join(configDir,"fapel_system.conf")) 59 | homedir = dir_helper.getHomeDir() 60 | 61 | 62 | 63 | ############################################################################################## 64 | #Init Vars 65 | ############################################################################################## 66 | 67 | rootpath = configParser.getDir('dirs','tagDir') 68 | print("tagDir",rootpath) 69 | 70 | 71 | # load to be excluded tag names (=dirs) 72 | excludedTagNames = [] 73 | for item in configParser.items('excludedTagNames'): 74 | excludedTagNames.append(item[0]) 75 | print("Excluded Tag names:",excludedTagNames) 76 | 77 | # load colors 78 | FT_COLORS = {} 79 | for item in configParser.items('colors'): 80 | FT_COLORS[item[0]]=item[1] 81 | 82 | ############################################################################################## 83 | 84 | class Fapel: 85 | def __init__(self, fullpath): 86 | self.tags = set() 87 | self.fullPath = fullpath 88 | head, tail = os.path.split(self.fullPath) 89 | self.filename = tail 90 | self.tagFilenames = {} # {tag,filename within tag} dictionary 91 | 92 | self.inode = os.stat(fullpath).st_ino 93 | 94 | self.exiled = False 95 | 96 | class Tag: 97 | def __init__(self, name): 98 | self.name = name 99 | self.shortname = "" 100 | self.initialFapels = set() 101 | self.currentFapels = set() 102 | self.toBeRemovedFapels = set() 103 | self.allFapels = set() 104 | self.dir = "" 105 | self.button = None 106 | self.tooltip = "" 107 | # Tree Stuff 108 | self.parent = None 109 | self.children = [] 110 | self.depth = 0 111 | # Finder Stuff 112 | self.listbox = None 113 | self.fg = "#FFFFFF" # TODO remove 114 | self.bg = "#000000" # TODO remove 115 | self.hideButton = False 116 | self.hideChildButtons = False 117 | 118 | 119 | self.hideFor = [] 120 | self.hideFapelsFor = [] 121 | self.hidesubFapelsFor = [] 122 | self.excludedSubTags = [] 123 | 124 | self.hidden = [] 125 | 126 | 127 | 128 | def addChild(self, child): 129 | self.children.append(child) 130 | self.children = sorted(self.children, key=Tag.getTagShortName) 131 | child.parent = self 132 | child.depth = self.depth + 1 133 | 134 | # used as a comparator / key for sorting 135 | @staticmethod 136 | def getTagShortName(tag): 137 | return tag.shortname 138 | 139 | 140 | 141 | class FapxileStatusFile: 142 | def __init__(self, filename): 143 | self.filename = filename 144 | 145 | self.configParserTT = configparser.RawConfigParser(allow_no_value=True, strict=False) 146 | self.configParserTT.optionxform = str # do *not* make everything lowercase 147 | self.hiddenFapxiles = [] 148 | try: 149 | self.configParserTT.read(self.filename) 150 | self.hiddenFapxiles = self.getEntries('hiddenFapxiles') 151 | 152 | except: 153 | print("Error loading fapxile status file, continue without it") 154 | 155 | def writeStatusFile(self): 156 | 157 | print("Writing changes to status file",self.filename) 158 | configfile = open(self.filename, 'w') 159 | 160 | self.configParserTT['hiddenFapxiles'] = {} 161 | for hiddenFapxile in self.hiddenFapxiles: 162 | self.configParserTT['hiddenFapxiles'][hiddenFapxile] = None 163 | 164 | self.configParserTT.write(configfile) 165 | 166 | 167 | 168 | def getEntries(self, groupname): 169 | items = self.configParserTT.items(groupname) 170 | names = [] 171 | for item in items: 172 | names.append(item[0]) 173 | return names 174 | 175 | class FapxileFile: 176 | def __init__(self, filename): 177 | self.filename = filename 178 | 179 | self.configParserTT = configparser.RawConfigParser(allow_no_value=True, strict=False) 180 | self.configParserTT.optionxform = str # do *not* make everything lowercase 181 | self.configParserTT.read(self.filename) 182 | 183 | self.fapxileForThisTag = self.getFapxileNames('fapxileForThisTag') 184 | self.fapxileForFapelsOfThisTag = self.getFapxileNames('fapxileForFapelsOfThisTag') 185 | self.fapxileForSubTagsAndSubFapels = self.getFapxileNames('fapxileForSubTagsAndSubFapels') 186 | 187 | self.excludedSubTags = self.getFapxileNames('excludedSubTags') 188 | 189 | 190 | #print(self.getAllFapxiles()) 191 | 192 | def getFapxileForThisTag(self): 193 | return self.fapxileForThisTag 194 | def getFapxileForFapelsOfThisTag(self): 195 | return self.fapxileForFapelsOfThisTag 196 | def getFapxileForSubTagsAndSubFapels(self): 197 | return self.fapxileForSubTagsAndSubFapels 198 | def getAllFapxiles(self): 199 | return list(set(self.fapxileForThisTag) | set(self.fapxileForFapelsOfThisTag) | set(self.fapxileForSubTagsAndSubFapels)) 200 | 201 | 202 | 203 | def getFapxileNames(self, groupname): 204 | items = self.configParserTT.items(groupname) 205 | names = [] 206 | for item in items: 207 | names.append(item[0]) 208 | return names 209 | 210 | 211 | 212 | class FapxileButton(Button): 213 | global FT_COLORS 214 | status: int 215 | 216 | def __init__(self, window, fapxile): 217 | self.fapxile = fapxile 218 | self.status = 0 219 | super().__init__(window, text="visible") 220 | self.configure(command=self.clicked) 221 | #self.updatestatus() 222 | self.updatecolor() 223 | 224 | 225 | def clicked(self): 226 | self.status = 1 - self.status 227 | self.updatetext() 228 | self.updatecolor() 229 | 230 | def updatetext(self): 231 | if self.status == 0: 232 | self.config(text='visible') 233 | else: 234 | self.config(text='hidden') 235 | 236 | 237 | 238 | def updatecolor(self): 239 | if self.status == 0: 240 | self['bg'] = FT_COLORS["button_tag_unselected"] 241 | elif self.status == 2: 242 | self['bg'] = FT_COLORS["button_tag_partially"] 243 | elif self.status == 1: 244 | self['bg'] = FT_COLORS["button_tag_selected"] 245 | 246 | 247 | def clickShowAllButton(): 248 | for button in allButtons: 249 | button.status = 0 250 | button.updatetext() 251 | button.updatecolor() 252 | 253 | 254 | def clickHideAllButton(): 255 | for button in allButtons: 256 | button.status = 1 257 | button.updatetext() 258 | button.updatecolor() 259 | 260 | 261 | 262 | def clickCancel(): 263 | window.destroy() 264 | 265 | def clickApply(): 266 | 267 | # gather all fapxiles to hide (read out button selection) 268 | hiddenFapxiles = set() 269 | for button in allButtons: 270 | if button.status != 0: 271 | hiddenFapxiles.add(button.fapxile) 272 | 273 | # go through every tag and check it's exile definition 274 | for tag in tags: 275 | #print(tag.dir) 276 | 277 | 278 | # [1] Hide all Tags with hideFor directly 279 | hideFor = (list(set(tag.hideFor) & hiddenFapxiles)) 280 | #print(hideFor) 281 | if len(hideFor) > 0: 282 | tag.parent.hidden.append(tag.shortname) 283 | print("Hiding Tag",tag.name) 284 | 285 | 286 | 287 | # [2] hideFapelsFor 288 | # check if to hide 289 | # for every fapel, go to every tag, add fapel there 290 | 291 | hideFapelsFor = (list(set(tag.hideFapelsFor) & hiddenFapxiles)) 292 | #print(hideFapelsFor) 293 | if len(hideFapelsFor) > 0: 294 | print("Hiding all Fapel of Tag",tag.name) 295 | for fapel in tag.allFapels: 296 | #print("for Fapel:",fapel.fullPath) 297 | 298 | 299 | for ftag in fapel.tags: 300 | #print("--has Tag -> ",ftag.name) 301 | 302 | path, filename = os.path.split(fapel.tagFilenames[ftag]) 303 | #print(filename) 304 | ftag.hidden.append(filename) 305 | 306 | 307 | 308 | # [3] hidesubFapelsFor 309 | # check if to hide 310 | # for every sub tag recursive, all fapels, all their tags add hidden there 311 | 312 | hidesubFapelsFor = (list(set(tag.hidesubFapelsFor) & hiddenFapxiles)) 313 | #print(hidesubFapelsFor) 314 | if len(hidesubFapelsFor) > 0: 315 | print("Recursivly hiding everything within tag", tag.name) 316 | tagstack = [] 317 | tagstack.extend(tag.children) # only use the child tags, not this tag 318 | while len(tagstack) > 0: 319 | ctag = tagstack.pop() 320 | 321 | if ctag.name in tag.excludedSubTags: 322 | print(" - ignoring SubTag",ctag.name) 323 | continue 324 | 325 | tagstack.extend(ctag.children) 326 | #print("visiting",ctag.shortname) 327 | 328 | print(" + Hiding all Fapel of sub Tag",ctag.name) 329 | # hide subtag itself 330 | if ctag.shortname not in ctag.parent.hidden: 331 | ctag.parent.hidden.append(ctag.shortname) 332 | # hide all fapels of the subtag everywhere 333 | for fapel in ctag.allFapels: 334 | #print("for Fapel:",fapel.fullPath) 335 | 336 | #print("Hiding Fapel",fapel.fullPath) 337 | 338 | for ftag in fapel.tags: 339 | #print("--has Tag -> ",ftag.name) 340 | 341 | path, filename = os.path.split(fapel.tagFilenames[ftag]) 342 | #print(filename) 343 | if filename not in ftag.hidden: 344 | ftag.hidden.append(filename) 345 | 346 | hiddenFileCounter = 0 347 | hiddenFileLines = 0 348 | # write .hidden files 349 | for tag in tags: 350 | with open(os.path.join(tag.dir, ".hidden"), 'w',encoding='utf-8') as f: 351 | if len(tag.hidden) > 0: 352 | for name in tag.hidden: 353 | f.write(name) 354 | f.write("\n") 355 | hiddenFileLines += 1 356 | else: 357 | f.write("\n") # deletes previous content 358 | hiddenFileCounter += 1 359 | 360 | print("Wrote",hiddenFileCounter,".hidden file(s)") 361 | print(hiddenFileLines,"files and folders are now hidden") 362 | 363 | fapxileStatusFile.hiddenFapxiles = [] 364 | for button in allButtons: 365 | if button.status == 1: 366 | fapxileStatusFile.hiddenFapxiles.append(button.fapxile) 367 | 368 | 369 | fapxileStatusFile.writeStatusFile() 370 | 371 | 372 | #for tag in tags: 373 | # if len(tag.hidden) > 0: 374 | # print("#############################################") 375 | # print(tag.dir) 376 | # print(tag.hidden) 377 | 378 | window.destroy() 379 | 380 | 381 | 382 | ############################################################################################## 383 | #Main 384 | ############################################################################################## 385 | 386 | 387 | 388 | 389 | 390 | # Build main Window 391 | #------------------- 392 | 393 | window = Tk() 394 | 395 | window.title("fapel exiles manager") 396 | 397 | window.minsize(400,400) 398 | #window.maxsize(400,700) 399 | 400 | window.configure(bg=FT_COLORS["window_background"]) 401 | 402 | #switchframe = Frame(window, bg=FT_COLORS["window_background"]) 403 | #myframe.pack(fill = BOTH) 404 | 405 | 406 | 407 | myframe=Frame(window,relief=GROOVE) 408 | myframe.pack(side = TOP, fill = BOTH, expand=YES) 409 | 410 | canvas=Canvas(myframe,highlightthickness=0) 411 | canvas.configure(bg=FT_COLORS["window_background"]) 412 | switchframe = Frame(canvas, bg=FT_COLORS["window_background"]) 413 | myscrollbar=Scrollbar(myframe,orient="vertical",command=canvas.yview) 414 | canvas.configure(yscrollcommand=myscrollbar.set) 415 | 416 | myframe.bind("",lambda e: canvas.configure(scrollregion=canvas.bbox("all"),height=e.height)) 417 | 418 | myscrollbar.pack(side="right",fill="y") 419 | canvas.pack(side="left", fill=BOTH, expand=YES) 420 | canvas.create_window((0,0),window=switchframe,anchor='nw') 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | bottomframe = Frame(window, bg=FT_COLORS["window_background"]) 430 | 431 | saveButton = Button(bottomframe, text="Apply", command=clickApply, bg = FT_COLORS["button_apply"]) 432 | cancelButton = Button(bottomframe, text="Cancel", command=clickCancel, bg = FT_COLORS["button_cancel"]) 433 | saveButton.pack( side = RIGHT,padx=20,pady=3) 434 | cancelButton.pack( side = RIGHT) 435 | 436 | hideAllButton = Button(bottomframe, text="Hide all", command=clickHideAllButton, bg = FT_COLORS["button_showallbuttons"]) 437 | showAllButton = Button(bottomframe, text="Show all", command=clickShowAllButton, bg = FT_COLORS["button_showallbuttons"]) 438 | showAllButton.pack( side = LEFT) 439 | hideAllButton.pack( side = LEFT) 440 | 441 | 442 | bottomframe.pack(side = BOTTOM, fill = X) 443 | 444 | 445 | # search all .exile files 446 | # 1) all tags that result in an exile 447 | # 2) all tags that themself will be hidden/exiled 448 | 449 | 450 | tags = set() 451 | tagnameTag = {} 452 | parentTags = {} 453 | ROOTTAG_KEY = "." 454 | rootTag = Tag(ROOTTAG_KEY) 455 | rootTag.dir = rootpath 456 | rootTag.shortname = "." 457 | tags.add(rootTag) 458 | parentTags[ROOTTAG_KEY] = rootTag 459 | 460 | excludedSubDirs = [] 461 | 462 | fapxileFiles = [] 463 | 464 | for root,d_names,f_names in os.walk(rootpath): 465 | #print (root, d_names, f_names) 466 | 467 | traverseSubDirs = True 468 | for f_name in f_names: 469 | if (f_name == ".exclude_subdirs"): 470 | traverseSubDirs = False 471 | excludedSubDirs.append(root) 472 | if (f_name == ".fapxile"): 473 | fapxileFiles.append(os.path.join(root, f_name)) 474 | 475 | 476 | 477 | 478 | for excludedSubDir in excludedSubDirs: 479 | if (root.find(excludedSubDir) != -1): 480 | traverseSubDirs = False 481 | 482 | if (traverseSubDirs): 483 | for d_name in d_names: 484 | if d_name not in excludedTagNames: 485 | # rootpath/GrandParenttag/Parenttag/Tag 486 | # '---------root-----------------' d_name 487 | # rootpath '---tagname-------------------' 488 | # '---dir-----------------------' 489 | # '------parenttag------' 490 | tagname = os.path.relpath(os.path.join(root, d_name), rootpath) 491 | tag = Tag(tagname) 492 | tagnameTag[tagname] = tag 493 | tag.shortname = d_name 494 | tag.dir = os.path.join(root, d_name) 495 | tags.add(tag) 496 | # Tree setup 497 | parenttag = os.path.relpath(root, rootpath) 498 | parentTags[tagname] = tag 499 | # add as child 500 | parentTags[parenttag].addChild(tag) 501 | tag.hideChildButtons = parentTags[parenttag].hideChildButtons 502 | tag.hideButton = parentTags[parenttag].hideChildButtons 503 | 504 | print("Found",len(tags),"Tag(s)") 505 | print("Found",len(fapxileFiles),"fapxile file(s)") 506 | 507 | allFapels = [] 508 | inodeFapels = {} 509 | 510 | 511 | for tag in tags: 512 | 513 | 514 | for root, d_names, filenames in os.walk(tag.dir): 515 | #print (filenames) 516 | break 517 | 518 | #print(filenames) 519 | 520 | for filename in filenames: 521 | if filename.startswith("."): 522 | continue 523 | fapel = Fapel(os.path.join(tag.dir, filename)) 524 | 525 | if fapel.inode not in inodeFapels: 526 | allFapels.append(fapel) 527 | inodeFapels[fapel.inode] = fapel 528 | 529 | inodeFapels[fapel.inode].tagFilenames[tag] = os.path.join(tag.dir, filename) 530 | inodeFapels[fapel.inode].tags.add(tag) 531 | #print("Fapel",inodeFapels[fapel.inode].inode,"now has",len(inodeFapels[fapel.inode].tags),"Tags") 532 | tag.allFapels.add(inodeFapels[fapel.inode]) 533 | 534 | 535 | 536 | print("Found",len(allFapels),"fapel(s)") 537 | 538 | 539 | 540 | fapxileStatusFile = FapxileStatusFile(os.path.join(rootpath,"fapxile_status")) 541 | 542 | print("hidden Fapxiles:",fapxileStatusFile.hiddenFapxiles) 543 | 544 | 545 | 546 | fapxiles = [] 547 | 548 | 549 | for ff in fapxileFiles: 550 | fapxileFile = FapxileFile(ff) 551 | 552 | head, tail = os.path.split(ff) 553 | tagname = os.path.relpath(head, rootpath) 554 | #print(tagname) 555 | 556 | tag = tagnameTag[tagname] 557 | 558 | tag.hideFor = (list(set(tag.hideFor) | set(fapxileFile.fapxileForThisTag))) 559 | tag.hideFapelsFor = (list(set(tag.hideFapelsFor) | set(fapxileFile.fapxileForFapelsOfThisTag))) 560 | tag.hidesubFapelsFor = (list(set(tag.hidesubFapelsFor) | set(fapxileFile.fapxileForSubTagsAndSubFapels))) 561 | tag.excludedSubTags = fapxileFile.excludedSubTags 562 | 563 | fapxiles = (list(set(fapxiles) | set(fapxileFile.getAllFapxiles()))) 564 | 565 | 566 | fapxiles.sort() 567 | print("Found Fapxiles:",fapxiles) 568 | 569 | 570 | 571 | switchframe.columnconfigure(0, weight=3) 572 | switchframe.columnconfigure(1, weight=1) 573 | 574 | allButtons = [] 575 | 576 | row = 0 577 | for fapxile in fapxiles: 578 | username_label = ttk.Label(switchframe, text=fapxile) 579 | username_label.grid(column=0, row=row, sticky=tk.W, padx=5, pady=5) 580 | 581 | toggle_button = FapxileButton(switchframe, fapxile) 582 | toggle_button.grid(column=1, row=row, sticky=tk.W, padx=5, pady=5) 583 | allButtons.append(toggle_button) 584 | 585 | if fapxile in fapxileStatusFile.hiddenFapxiles: 586 | toggle_button.clicked() 587 | 588 | row = row + 1 589 | 590 | window.mainloop() 591 | 592 | -------------------------------------------------------------------------------- /fapelsystem/fapel_fap_set.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | # 3 | ############################################################################################## 4 | # 5 | # The fapel system organizes image and video collections under Linux with standard folders. 6 | # fappel_fap_set enables you to hardlink media to a current date based dir. 7 | # 8 | # For updates see git-repo at 9 | #https://github.com/pronopython/fapel-system 10 | # 11 | ############################################################################################## 12 | # 13 | VERSION = "0.2.0" #TODO 14 | # 15 | ############################################################################################## 16 | # 17 | # Copyright (C) 2022-2023 PronoPython 18 | # 19 | # Contact me at pronopython@proton.me 20 | # 21 | # This program is free software: you can redistribute it and/or modify it 22 | # under the terms of the GNU General Public License as published by the 23 | # Free Software Foundation, either version 3 of the License, or 24 | # (at your option) any later version. 25 | # 26 | # This program is distributed in the hope that it will be useful, 27 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 29 | # GNU General Public License for more details. 30 | # 31 | # You should have received a copy of the GNU General Public License 32 | # along with this program. If not, see . 33 | # 34 | ############################################################################################## 35 | 36 | 37 | 38 | import tkinter 39 | from tkinter import messagebox 40 | import os 41 | import sys 42 | import shutil 43 | from datetime import datetime,timedelta 44 | import configparser 45 | import subprocess 46 | 47 | ############################################################################################## 48 | #Load Config 49 | ############################################################################################## 50 | 51 | from fapelsystem import config_file_handler as config_file_handler 52 | from fapelsystem import dir_helper as dir_helper 53 | 54 | 55 | configDir = dir_helper.getConfigDir("Fapelsystem") 56 | #print(configDir) 57 | configParser = config_file_handler.FapelSystemConfigFile(os.path.join(configDir,"fapel_system.conf")) 58 | homedir = dir_helper.getHomeDir() 59 | 60 | 61 | 62 | 63 | ############################################################################################## 64 | #Init Vars 65 | ############################################################################################## 66 | 67 | # first arg is name of script 68 | # second is file 69 | fapel_fullpath = sys.argv[1] 70 | 71 | 72 | fapsetDirRoot = configParser.getDir('dirs','fapsetDir') 73 | print("fapsetDirRoot",fapsetDirRoot) 74 | 75 | dateMidnightHoursOffset = int(configParser.get('dateAndTime','dateMidnightHoursOffset')) 76 | fapsetId = (datetime.today() - timedelta(hours=dateMidnightHoursOffset, minutes=0)).strftime("%Y%m%d") 77 | print("Using fapset ID",fapsetId) 78 | 79 | 80 | ############################################################################################## 81 | #Main 82 | ############################################################################################## 83 | 84 | fapsetDir = fapsetDirRoot + "/" + fapsetId 85 | 86 | if not os.path.isdir(fapsetDir): 87 | os.mkdir(fapsetDir) 88 | 89 | 90 | 91 | head, tail = os.path.split(fapel_fullpath) 92 | fapel_filename = tail 93 | 94 | 95 | # TODO what if same name? Find collision free name (as def?) 96 | os.link(fapel_fullpath, os.path.join(fapsetDir, fapel_filename)) 97 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /fapelsystem/fapel_search_not_tagged.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | # 3 | ############################################################################################## 4 | # 5 | # The fapel system organizes image and video collections under Linux with standard folders. 6 | # fappel_search_not_tagged.py is TODO 7 | # 8 | # For updates see git-repo at 9 | #https://github.com/pronopython/fapel-system 10 | # 11 | ############################################################################################## 12 | # 13 | VERSION = "0.2.0" #TODO 14 | # 15 | ############################################################################################## 16 | # 17 | # Copyright (C) 2022-2023 PronoPython 18 | # 19 | # Contact me at pronopython@proton.me 20 | # 21 | # This program is free software: you can redistribute it and/or modify it 22 | # under the terms of the GNU General Public License as published by the 23 | # Free Software Foundation, either version 3 of the License, or 24 | # (at your option) any later version. 25 | # 26 | # This program is distributed in the hope that it will be useful, 27 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 29 | # GNU General Public License for more details. 30 | # 31 | # You should have received a copy of the GNU General Public License 32 | # along with this program. If not, see . 33 | # 34 | ############################################################################################## 35 | # 36 | # TODO this is almost the same code as the _not_ not py file... put it into a lib or so! 37 | 38 | import tkinter 39 | from tkinter import messagebox 40 | import os 41 | import sys 42 | import shutil 43 | from datetime import datetime 44 | import configparser 45 | import subprocess 46 | 47 | ############################################################################################## 48 | #Load Config 49 | ############################################################################################## 50 | 51 | 52 | 53 | from fapelsystem import config_file_handler as config_file_handler 54 | from fapelsystem import dir_helper as dir_helper 55 | 56 | 57 | configDir = dir_helper.getConfigDir("Fapelsystem") 58 | #print(configDir) 59 | configParser = config_file_handler.FapelSystemConfigFile(os.path.join(configDir,"fapel_system.conf")) 60 | homedir = dir_helper.getHomeDir() 61 | 62 | 63 | 64 | 65 | ############################################################################################## 66 | #Init Vars 67 | ############################################################################################## 68 | 69 | rootpath = configParser.getDir('dirs','tagDir') 70 | print("tagDir",rootpath) 71 | 72 | searchResultRoot = configParser.getDir('dirs','searchResultDir') 73 | print("searchResultDir",searchResultRoot) 74 | 75 | # load to be excluded tag names (=dirs) 76 | excludedSubDirs = [] 77 | for item in configParser.items('excludedTagNames'): 78 | excludedSubDirs.append(item[0]) 79 | print("Excluded Tag names:", excludedSubDirs) 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | searchDir_fullpath = os.path.abspath(sys.argv[1]) 88 | 89 | 90 | 91 | searchId = datetime.now().strftime("%Y%m%d%H%M%S") 92 | 93 | searchResultPath = searchResultRoot + "/" + searchId 94 | 95 | os.mkdir(searchResultPath) 96 | 97 | 98 | fapelsInodes = set() 99 | 100 | 101 | #excludedSubDirs = [".ts",".recycled"] 102 | 103 | for root,d_names,f_names in os.walk(rootpath): 104 | 105 | traverseDir = True 106 | 107 | for excludedSubDir in excludedSubDirs: 108 | if (root.find(excludedSubDir) != -1): 109 | traverseDir = False 110 | 111 | if (traverseDir): 112 | for f_name in f_names: 113 | fapelsInodes.add(os.stat(os.path.join(root,f_name)).st_ino) 114 | 115 | for f_name in f_names: 116 | if (f_name == ".exclude_subdirs"): 117 | excludedSubDirs.append(root) 118 | 119 | print("Found ", len(fapelsInodes), " Fapels") 120 | 121 | 122 | for root,d_names,f_names in os.walk(searchDir_fullpath): 123 | 124 | for f_name in f_names: 125 | inspectedFapelFullPath = os.path.join(root,f_name) 126 | inode = os.stat(inspectedFapelFullPath).st_ino 127 | if (inode not in fapelsInodes): # TODO the only code difference... 128 | print("New Found", f_name) 129 | os.link(inspectedFapelFullPath, os.path.join(searchResultPath, f_name)) 130 | 131 | break 132 | 133 | subprocess.Popen(["xdg-open", searchResultPath]) 134 | 135 | 136 | -------------------------------------------------------------------------------- /fapelsystem/fapel_search_source_file.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | # 3 | ############################################################################################## 4 | # 5 | # The fapel system organizes image and video collections under Linux with standard folders. 6 | # fapel_search_source_file.py searches a matching hardlink of a tagged fapel within your 7 | # media library. 8 | # 9 | # For updates see git-repo at 10 | #https://github.com/pronopython/fapel-system 11 | # 12 | ############################################################################################## 13 | # 14 | VERSION = "0.2.0" 15 | # 16 | ############################################################################################## 17 | # 18 | # Copyright (C) 2022-2023 PronoPython 19 | # 20 | # Contact me at pronopython@proton.me 21 | # 22 | # This program is free software: you can redistribute it and/or modify it 23 | # under the terms of the GNU General Public License as published by the 24 | # Free Software Foundation, either version 3 of the License, or 25 | # (at your option) any later version. 26 | # 27 | # This program is distributed in the hope that it will be useful, 28 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 29 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 30 | # GNU General Public License for more details. 31 | # 32 | # You should have received a copy of the GNU General Public License 33 | # along with this program. If not, see . 34 | # 35 | ############################################################################################## 36 | # 37 | import tkinter 38 | from tkinter import messagebox 39 | from tkinter import filedialog 40 | import os 41 | import sys 42 | import shutil 43 | from datetime import datetime 44 | import configparser 45 | import subprocess 46 | 47 | ############################################################################################## 48 | #Load Config 49 | ############################################################################################## 50 | 51 | 52 | from fapelsystem import config_file_handler as config_file_handler 53 | from fapelsystem import dir_helper as dir_helper 54 | 55 | 56 | configDir = dir_helper.getConfigDir("Fapelsystem") 57 | #print(configDir) 58 | configParser = config_file_handler.FapelSystemConfigFile(os.path.join(configDir,"fapel_system.conf")) 59 | homedir = dir_helper.getHomeDir() 60 | 61 | 62 | 63 | ############################################################################################## 64 | #Init Vars 65 | ############################################################################################## 66 | 67 | #rootpath = configParser.getDir('dirs','tagDir') 68 | #print("tagDir",rootpath) 69 | 70 | searchResultRoot = configParser.getDir('dirs','searchResultDir') 71 | print("searchResultDir",searchResultRoot) 72 | 73 | inodeSearchRootDir = configParser.getDir('dirs','inodeSearchRootDir') 74 | 75 | 76 | root = tkinter.Tk() 77 | root.withdraw() 78 | answer = messagebox.askquestion ('Start search?','Search may take a long time and you will get no progress info in between. Start the search?',icon = 'warning') 79 | if answer != 'yes': 80 | exit() 81 | 82 | 83 | inodeSearchRootDir = filedialog.askdirectory(initialdir=inodeSearchRootDir, title = "Choose search root folder") 84 | 85 | if inodeSearchRootDir == (): 86 | exit() 87 | 88 | print("inodeSearchRootDir",inodeSearchRootDir) 89 | 90 | fileToSearch = os.path.abspath(sys.argv[1]) 91 | inodeToSearch = os.stat(fileToSearch).st_ino 92 | 93 | print("File to search for:", fileToSearch) 94 | print("iNode to search for:", inodeToSearch) 95 | 96 | 97 | # create search result dir 98 | searchId = datetime.now().strftime("%Y%m%d%H%M%S") 99 | searchResultPath = searchResultRoot + "/" + searchId 100 | os.mkdir(searchResultPath) 101 | 102 | 103 | # Set up find command 104 | findCMD = 'find "'+inodeSearchRootDir+'" -inum ' + str(inodeToSearch) 105 | 106 | print(findCMD) 107 | 108 | out = subprocess.Popen(findCMD,shell=True,stdin=subprocess.PIPE, 109 | stdout=subprocess.PIPE,stderr=subprocess.PIPE,text=True) 110 | 111 | 112 | lines = out.stdout.readlines() 113 | 114 | 115 | foundFiles = [] 116 | 117 | 118 | for line in lines: 119 | foundFiles.append(line.rstrip()) 120 | 121 | print(foundFiles) 122 | 123 | 124 | # link source file 125 | path, filename = os.path.split(fileToSearch) 126 | #f_name, f_ext = os.path.splitext(filename) 127 | linkFilename = "0_" + filename 128 | os.symlink(fileToSearch,os.path.join(searchResultPath,linkFilename)) 129 | 130 | 131 | # link found files 132 | occurance = 1 133 | for foundFile in foundFiles: 134 | path, filename = os.path.split(foundFile) 135 | linkFilename = str(occurance) + "_" + filename 136 | os.symlink(foundFile,os.path.join(searchResultPath,linkFilename)) 137 | occurance = occurance + 1 138 | 139 | 140 | subprocess.Popen(["xdg-open", searchResultPath]) 141 | 142 | 143 | -------------------------------------------------------------------------------- /fapelsystem/fapel_search_tagged.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | # 3 | ############################################################################################## 4 | # 5 | # The fapel system organizes image and video collections under Linux with standard folders. 6 | # fappel_search_tagged.py is TODO 7 | # 8 | # For updates see git-repo at 9 | #https://github.com/pronopython/fapel-system 10 | # 11 | ############################################################################################## 12 | # 13 | VERSION = "0.2.0" #TODO 14 | # 15 | ############################################################################################## 16 | # 17 | # Copyright (C) 2022-2023 PronoPython 18 | # 19 | # Contact me at pronopython@proton.me 20 | # 21 | # This program is free software: you can redistribute it and/or modify it 22 | # under the terms of the GNU General Public License as published by the 23 | # Free Software Foundation, either version 3 of the License, or 24 | # (at your option) any later version. 25 | # 26 | # This program is distributed in the hope that it will be useful, 27 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 29 | # GNU General Public License for more details. 30 | # 31 | # You should have received a copy of the GNU General Public License 32 | # along with this program. If not, see . 33 | # 34 | ############################################################################################## 35 | # 36 | import tkinter 37 | from tkinter import messagebox 38 | import os 39 | import sys 40 | import shutil 41 | from datetime import datetime 42 | import configparser 43 | import subprocess 44 | 45 | ############################################################################################## 46 | #Load Config 47 | ############################################################################################## 48 | 49 | 50 | from fapelsystem import config_file_handler as config_file_handler 51 | from fapelsystem import dir_helper as dir_helper 52 | 53 | 54 | configDir = dir_helper.getConfigDir("Fapelsystem") 55 | #print(configDir) 56 | configParser = config_file_handler.FapelSystemConfigFile(os.path.join(configDir,"fapel_system.conf")) 57 | homedir = dir_helper.getHomeDir() 58 | 59 | 60 | 61 | ############################################################################################## 62 | #Init Vars 63 | ############################################################################################## 64 | 65 | rootpath = configParser.getDir('dirs','tagDir') 66 | print("tagDir",rootpath) 67 | 68 | searchResultRoot = configParser.getDir('dirs','searchResultDir') 69 | print("searchResultDir",searchResultRoot) 70 | 71 | # load to be excluded tag names (=dirs) 72 | excludedSubDirs = [] 73 | for item in configParser.items('excludedTagNames'): 74 | excludedSubDirs.append(item[0]) 75 | print("Excluded Tag names:", excludedSubDirs) 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | searchDir_fullpath = os.path.abspath(sys.argv[1]) 84 | 85 | print("Searchdir fullpath:",searchDir_fullpath) 86 | 87 | searchId = datetime.now().strftime("%Y%m%d%H%M%S") 88 | 89 | searchResultPath = searchResultRoot + "/" + searchId 90 | 91 | os.mkdir(searchResultPath) 92 | 93 | 94 | fapelsInodes = set() 95 | 96 | 97 | #excludedSubDirs = [".ts",".recycled"] 98 | 99 | for root,d_names,f_names in os.walk(rootpath): 100 | 101 | traverseDir = True 102 | 103 | for excludedSubDir in excludedSubDirs: 104 | if (root.find(excludedSubDir) != -1): 105 | traverseDir = False 106 | 107 | if (traverseDir): 108 | for f_name in f_names: 109 | fapelsInodes.add(os.stat(os.path.join(root,f_name)).st_ino) 110 | 111 | for f_name in f_names: 112 | if (f_name == ".exclude_subdirs"): 113 | excludedSubDirs.append(root) 114 | 115 | print("Found ", len(fapelsInodes), " Fapels") 116 | 117 | 118 | for root,d_names,f_names in os.walk(searchDir_fullpath): 119 | 120 | for f_name in f_names: 121 | print("Testing fapel", f_name) 122 | inspectedFapelFullPath = os.path.join(root,f_name) 123 | inode = os.stat(inspectedFapelFullPath).st_ino 124 | if (inode in fapelsInodes): 125 | print("New Found", f_name) 126 | os.link(inspectedFapelFullPath, os.path.join(searchResultPath, f_name)) 127 | 128 | break 129 | 130 | subprocess.Popen(["xdg-open", searchResultPath]) 131 | 132 | 133 | -------------------------------------------------------------------------------- /fapelsystem/fapel_system_template.conf: -------------------------------------------------------------------------------- 1 | [dirs] 2 | tagDir=~/fapelsystem/Tags 3 | recycledDir=~/fapelsystem/Tags/.recycled 4 | eloDir=~/fapelsystem/Elo 5 | searchResultDir=~/fapelsystem/Search Results 6 | fapsetDir=~/fapelsystem/Fapsets 7 | filemanagerScriptDir=~/.local/share/nautilus/scripts 8 | inodeSearchRootDir=~ 9 | 10 | [countersDirs] 11 | notice=~/fapelsystem/Notice 12 | ct=~/fapelsystem/Tags/Ct/Ct 13 | 14 | [excludedTagNames] 15 | #list all dir names that should be ignored in tagDir 16 | #TODO: up till now, if ".ts" is listed here, Dir "...xyz/.tscripts/abcd" is also ignored! 17 | .recycled 18 | .ts 19 | 20 | [dateAndTime] 21 | # if you "work" over midnight, you can offset the directory name rollover by an amount of 22 | # hours 23 | # for a fap-set define, how many hours the dir name should be offsetted from midnight 24 | # e.g. = 4 results in the same directory from 04:00 to 04:00 next day 25 | dateMidnightHoursOffset=4 26 | 27 | [window] 28 | # set fixedOrMinSize={fixed,min} 29 | fixedOrMinSize=min 30 | width=100 31 | height=100 32 | buttonsPerColumn=10 33 | #width=1500 34 | #height=800 35 | #buttonsPerColumn=34 36 | 37 | [tooltip] 38 | # waittime in miliseconds 39 | waittime=1200 40 | # width in pixels 41 | width=300 42 | 43 | 44 | [fonts] 45 | tagFontFamily=Ubuntu Condensed 46 | tagFontSize=10 47 | 48 | [colors] 49 | window_background=#282828 50 | window_tagbackground=#282828 51 | progressbar_background=#282828 52 | progressbar=#ebdbb2 53 | button_tag_unselected=#928374 54 | button_tag_partially=#63a588 55 | button_tag_selected=#fb4934 56 | button_apply=#b8bb26 57 | button_cancel=#751f1f 58 | button_showallbuttons=#282828 59 | tooltip_background=#ebdbb2 60 | tooltip_foreground=#282828 61 | fapel_background=#000000 62 | tabs_background=#282828 63 | tabs_unselected=#928374 64 | tabs_selected=#A1C9F1 65 | finder_background=#282828 66 | finder_tag_unselected=#928374 67 | finder_tag_partially=#63a588 68 | finder_tag_selected=#fb4934 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /fapelsystem/fapel_system_template_windows.conf: -------------------------------------------------------------------------------- 1 | [dirs] 2 | tagDir=~\Documents\fapelsystem\Tags 3 | recycledDir=~\Documents\fapelsystem\Tags\.recycled 4 | eloDir=~\Documents\fapelsystem\Elo 5 | searchResultDir=~\Documents\fapelsystem\Search Results 6 | fapsetDir=~\Documents\fapelsystem\Fapsets 7 | filemanagerScriptDir=~/.local/share/nautilus/scripts 8 | inodeSearchRootDir=~ 9 | 10 | [countersDirs] 11 | notice=~\Documents\fapelsystem\Notice 12 | ct=~\Documents\fapelsystem\Tags\Ct\Ct 13 | 14 | [excludedTagNames] 15 | #list all dir names that should be ignored in tagDir 16 | #TODO: up till now, if ".ts" is listed here, Dir "...xyz/.tscripts/abcd" is also ignored! 17 | .recycled 18 | .ts 19 | 20 | [dateAndTime] 21 | # if you "work" over midnight, you can offset the directory name rollover by an amount of 22 | # hours 23 | # for a fap-set define, how many hours the dir name should be offsetted from midnight 24 | # e.g. = 4 results in the same directory from 04:00 to 04:00 next day 25 | dateMidnightHoursOffset=4 26 | 27 | [window] 28 | # set fixedOrMinSize={fixed,min} 29 | fixedOrMinSize=min 30 | width=100 31 | height=100 32 | buttonsPerColumn=10 33 | #width=1500 34 | #height=800 35 | #buttonsPerColumn=34 36 | 37 | [tooltip] 38 | # waittime in miliseconds 39 | waittime=1200 40 | # width in pixels 41 | width=300 42 | 43 | 44 | [fonts] 45 | tagFontFamily=Arial Narrow 46 | tagFontSize=10 47 | 48 | [colors] 49 | window_background=#282828 50 | window_tagbackground=#282828 51 | progressbar_background=#282828 52 | progressbar=#ebdbb2 53 | button_tag_unselected=#928374 54 | button_tag_partially=#63a588 55 | button_tag_selected=#fb4934 56 | button_apply=#b8bb26 57 | button_cancel=#751f1f 58 | button_showallbuttons=#282828 59 | tooltip_background=#ebdbb2 60 | tooltip_foreground=#282828 61 | fapel_background=#000000 62 | tabs_background=#282828 63 | tabs_unselected=#928374 64 | tabs_selected=#A1C9F1 65 | finder_background=#282828 66 | finder_tag_unselected=#928374 67 | finder_tag_partially=#63a588 68 | finder_tag_selected=#fb4934 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /fapelsystem/fapel_tagger.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | # 3 | ############################################################################################## 4 | # 5 | # The fapel system organizes image and video collections under Linux with standard folders. 6 | # fappel_tagger is a GUI based media tagging application. 7 | # 8 | # For updates see git-repo at 9 | #https://github.com/pronopython/fapel-system 10 | # 11 | ############################################################################################## 12 | # 13 | VERSION = "0.2.0" #TODO 14 | # 15 | ############################################################################################## 16 | # 17 | # Copyright (C) 2022-2023 PronoPython 18 | # 19 | # Contact me at pronopython@proton.me 20 | # 21 | # This program is free software: you can redistribute it and/or modify it 22 | # under the terms of the GNU General Public License as published by the 23 | # Free Software Foundation, either version 3 of the License, or 24 | # (at your option) any later version. 25 | # 26 | # This program is distributed in the hope that it will be useful, 27 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 29 | # GNU General Public License for more details. 30 | # 31 | # You should have received a copy of the GNU General Public License 32 | # along with this program. If not, see . 33 | # 34 | ############################################################################################## 35 | # TODO tkinter install: sudo apt-get install python3-tk 36 | # TODO filename with "%" do not work (or is that a problem via nautilus UI parameter handling?) 37 | # TODO you *can* select dirs directly and start the tagger with them... what happens next??? this is bad... 38 | # TODO install tk: 39 | # pip3 install tk 40 | # sudo apt install python3.8-tk 41 | 42 | 43 | 44 | from tkinter import * 45 | from tkinter import ttk 46 | import tkinter.font as font 47 | import os 48 | import sys 49 | import configparser 50 | import time 51 | 52 | 53 | 54 | 55 | ############################################################################################## 56 | #Import lib 57 | ############################################################################################## 58 | 59 | from fapelsystem import config_file_handler as config_file_handler 60 | from fapelsystem import dir_helper as dir_helper 61 | 62 | 63 | configDir = dir_helper.getConfigDir("Fapelsystem") 64 | #print(configDir) 65 | configParser = config_file_handler.FapelSystemConfigFile(os.path.join(configDir,"fapel_system.conf")) 66 | homedir = dir_helper.getHomeDir() 67 | 68 | 69 | 70 | ############################################################################################## 71 | #Init Vars 72 | ############################################################################################## 73 | 74 | rootpath = configParser.getDir('dirs','tagDir') 75 | print("tagDir",rootpath) 76 | recycledPath = configParser.getDir('dirs','recycledDir') 77 | print("recycledDir",recycledPath) 78 | 79 | # load to be excluded tag names (=dirs) 80 | excludedTagNames = [] 81 | for item in configParser.items('excludedTagNames'): 82 | excludedTagNames.append(item[0]) 83 | print("Excluded Tag names:",excludedTagNames) 84 | 85 | # load colors 86 | FT_COLORS = {} 87 | for item in configParser.items('colors'): 88 | FT_COLORS[item[0]]=item[1] 89 | #print(FT_COLORS) 90 | 91 | # load tooltip stuff 92 | TOOLTIP_WAITTIME = int(configParser.get('tooltip','waittime')) 93 | TOOLTIP_WIDTH = int(configParser.get('tooltip','width')) 94 | 95 | 96 | 97 | ############################################################################################## 98 | #Classes 99 | ############################################################################################## 100 | 101 | 102 | class CreateToolTip(object): 103 | global FT_COLORS 104 | global TOOLTIP_WAITTIME 105 | global TOOLTIP_WIDTH 106 | 107 | # create a tooltip for a given widget 108 | def __init__(self, widget, text='widget info'): 109 | self.waittime = TOOLTIP_WAITTIME #miliseconds 110 | self.wraplength = TOOLTIP_WIDTH #pixels 111 | self.widget = widget 112 | self.text = text 113 | self.widget.bind("", self.enter) 114 | self.widget.bind("", self.leave) 115 | self.widget.bind("", self.leave) 116 | self.id = None 117 | self.tw = None 118 | 119 | def enter(self, event=None): 120 | self.schedule() 121 | 122 | def leave(self, event=None): 123 | self.unschedule() 124 | self.hidetip() 125 | 126 | def schedule(self): 127 | self.unschedule() 128 | self.id = self.widget.after(self.waittime, self.showtip) 129 | 130 | def unschedule(self): 131 | id = self.id 132 | self.id = None 133 | if id: 134 | self.widget.after_cancel(id) 135 | 136 | def showtip(self, event=None): 137 | x = y = 0 138 | x, y, cx, cy = self.widget.bbox("insert") 139 | x += self.widget.winfo_rootx() + 25 140 | y += self.widget.winfo_rooty() + 20 141 | # creates a toplevel window 142 | self.tw = Toplevel(self.widget) 143 | # Leaves only the label and removes the app window 144 | self.tw.wm_overrideredirect(True) 145 | self.tw.wm_geometry("+%d+%d" % (x, y)) 146 | label = Label(self.tw, text=self.text, justify='left', 147 | background=FT_COLORS["tooltip_background"], fg=FT_COLORS["tooltip_foreground"], relief='solid', borderwidth=1, 148 | wraplength = self.wraplength) 149 | label.pack(ipadx=1) 150 | 151 | def hidetip(self): 152 | tw = self.tw 153 | self.tw= None 154 | if tw: 155 | tw.destroy() 156 | 157 | 158 | 159 | 160 | class Tag: 161 | def __init__(self, name): 162 | self.name = name 163 | self.shortname = "" 164 | self.initialFapels = set() 165 | self.currentFapels = set() 166 | self.toBeRemovedFapels = set() 167 | self.allFapels = None 168 | self.dir = "" 169 | self.button = None 170 | self.tooltip = "" 171 | # Tree Stuff 172 | self.parent = None 173 | self.children = [] 174 | self.depth = 0 175 | # Finder Stuff 176 | self.listbox = None 177 | self.fg = "#FFFFFF" # TODO remove 178 | self.bg = "#000000" # TODO remove 179 | self.hideButton = False 180 | self.hideChildButtons = False 181 | 182 | def addChild(self, child): 183 | self.children.append(child) 184 | self.children = sorted(self.children, key=Tag.getTagShortName) 185 | child.parent = self 186 | child.depth = self.depth + 1 187 | 188 | # used as a comparator / key for sorting 189 | @staticmethod 190 | def getTagShortName(tag): 191 | return tag.shortname 192 | 193 | 194 | class TagButton(Button): 195 | global FT_COLORS 196 | status: int 197 | 198 | def __init__(self, window, tag): 199 | self.tag = tag 200 | self.status = 0 201 | #width=20 202 | numberText = "" 203 | if (len(tag.initialFapels) > 1): 204 | numberText = " (" + str(len(tag.initialFapels)) + ")" 205 | super().__init__(window, text=tag.name+numberText, height=1, font=buttonFont, pady=0, padx=0) 206 | self.configure(command=self.clicked) 207 | self.updatestatus() 208 | self.updatecolor() 209 | 210 | 211 | def clicked(self): 212 | #print (len(self.tag.initialFapels), " ", len(self.tag.allFapels)) 213 | if self.status == 0: 214 | if len(self.tag.initialFapels) == len(self.tag.allFapels): 215 | #self.status = 2 216 | self.tag.currentFapels.clear() 217 | self.tag.currentFapels.update(self.tag.allFapels) 218 | Fapel.addTagToAll(self.tag, self.tag.allFapels) 219 | elif len(self.tag.initialFapels) == 0: 220 | # self.status = 1 221 | self.tag.currentFapels.clear() 222 | self.tag.currentFapels.update(self.tag.allFapels) 223 | Fapel.addTagToAll(self.tag, self.tag.allFapels) 224 | elif len(self.tag.initialFapels) < len(self.tag.allFapels): 225 | #self.status = 1 226 | self.tag.currentFapels.clear() 227 | self.tag.currentFapels.update(self.tag.initialFapels) 228 | Fapel.removeTagFromAll(self.tag, self.tag.allFapels) 229 | Fapel.addTagToAll(self.tag, self.tag.initialFapels) 230 | elif self.status == 1: 231 | #self.status = 2 232 | self.tag.currentFapels.clear() 233 | self.tag.currentFapels.update(self.tag.allFapels) 234 | Fapel.addTagToAll(self.tag, self.tag.allFapels) 235 | elif self.status == 2: 236 | #self.status = 0 237 | self.tag.currentFapels.clear() 238 | Fapel.removeTagFromAll(self.tag, self.tag.allFapels) 239 | self.updatestatus() 240 | self.updatecolor() 241 | 242 | 243 | def updatecolor(self): 244 | if self.status == 0: 245 | self['bg'] = FT_COLORS["button_tag_unselected"] 246 | elif self.status == 1: 247 | self['bg'] = FT_COLORS["button_tag_partially"] 248 | elif self.status == 2: 249 | self['bg'] = FT_COLORS["button_tag_selected"] 250 | 251 | def updatestatus(self): 252 | if len(self.tag.currentFapels) == len(self.tag.allFapels): 253 | self.status = 2 254 | elif len(self.tag.currentFapels) == 0: 255 | self.status = 0 256 | else: 257 | self.status = 1 258 | 259 | # take second element for sort 260 | def comparator(button): 261 | return button["text"] 262 | 263 | 264 | class Fapel: 265 | def __init__(self, fullpath): 266 | self.initialTags = set() 267 | self.newTags = set() 268 | self.toBeRemovedTags = set() 269 | self.fullPath = fullpath 270 | head, tail = os.path.split(self.fullPath) 271 | self.filename = tail 272 | self.tagFilenames = {} # {tag,filename within tag} dictionary 273 | 274 | @staticmethod 275 | def addTagToAll(tag, fapels): 276 | for fapel in fapels: 277 | if tag not in fapel.initialTags: 278 | if tag not in fapel.newTags: 279 | fapel.newTags.add(tag) 280 | if tag in fapel.toBeRemovedTags: 281 | fapel.toBeRemovedTags.remove(tag) 282 | 283 | @staticmethod 284 | def removeTagFromAll(tag, fapels): 285 | for fapel in fapels: 286 | if tag in fapel.initialTags: 287 | fapel.toBeRemovedTags.add(tag) 288 | if tag in fapel.newTags: 289 | fapel.newTags.remove(tag) 290 | 291 | def applyTagStructure(self): 292 | print ("") 293 | print ("applying tag changes") 294 | print ("--------------------") 295 | # NEW TAGS 296 | # newtags -> initialtags 297 | for tag in self.newTags: 298 | print ("Hardlinking ",self.filename," to Tag ",tag.name) 299 | # rename till it fits 300 | new_twin_name = self.filename 301 | destinationFilename = os.path.join(tag.dir, self.filename) 302 | while os.path.isfile(destinationFilename): 303 | # change filename 304 | f_name, f_ext = os.path.splitext(new_twin_name) 305 | new_twin_name = f_name + "_A" + f_ext # TODO better renaming if doubled! 306 | destinationFilename = os.path.join(tag.dir, new_twin_name) 307 | 308 | os.link(self.fullPath, os.path.join(tag.dir, new_twin_name)) 309 | self.initialTags.add(tag) 310 | self.newTags.clear() 311 | 312 | # count how many initial tags will be removed 313 | remainingTags = set() 314 | for tag in self.initialTags: 315 | if (tag not in self.toBeRemovedTags): 316 | remainingTags.add(tag) 317 | 318 | for tag in remainingTags: 319 | print("Tag ", tag.name, " will remain") 320 | 321 | # all tags will be removed, hardlink to .recycled Folder before deleting all other files 322 | if (len(remainingTags) == 0): 323 | print("all tags will be removed, hardlinking ",self.filename," to .recycled folder") 324 | new_twin_name = self.filename 325 | destinationFilename = os.path.join(recycledPath, self.filename) 326 | while os.path.isfile(destinationFilename): 327 | # change filename 328 | f_name, f_ext = os.path.splitext(new_twin_name) 329 | new_twin_name = f_name + "_A" + f_ext # TODO better renaming when existing 330 | destinationFilename = os.path.join(recycledPath, new_twin_name) 331 | os.link(self.fullPath, os.path.join(recycledPath, new_twin_name)) 332 | 333 | 334 | 335 | 336 | for tag in self.toBeRemovedTags: 337 | print("Removing ", self.filename, " from Tag ", tag.name) 338 | tagFilenameToBeRemoved = self.tagFilenames[tag] 339 | print("tagFilename (full path):",tagFilenameToBeRemoved) 340 | if (os.path.isfile(tagFilenameToBeRemoved)): # last security check: not a dir, okay? 341 | print(" deleting file ", tagFilenameToBeRemoved) 342 | os.remove(tagFilenameToBeRemoved) 343 | 344 | 345 | 346 | class FinderElement: 347 | def __init__(self, text): 348 | self.text = text 349 | self.depth = 0 350 | self.children = [] 351 | self.parent = None 352 | self.listbox = None 353 | self.fg = "#FFFFFF" 354 | self.bg = "#000000" 355 | 356 | def addChild(self, child): 357 | self.children.append(child) 358 | child.parent = self 359 | child.depth = self.depth + 1 360 | 361 | class Finder: 362 | def __init__(self, root, numberOfColumns): 363 | self.frames = [] 364 | self.listboxes = [] 365 | self.currentFinderElement = [] 366 | 367 | 368 | for c in range(numberOfColumns): 369 | finderColumnFrame = Frame(root, bg = FT_COLORS["window_tagbackground"]) 370 | if c < numberOfColumns: 371 | finderColumnFrame.pack( side = 'left', fill = 'both' ,expand=1 ) 372 | else: 373 | finderColumnFrame.pack( side = 'right', fill = 'both' ,expand=1 ) 374 | self.frames.append(finderColumnFrame) 375 | 376 | lb = Listbox(finderColumnFrame, bg = FT_COLORS["window_tagbackground"], fg = "#FFFFFF") 377 | self.listboxes.append(lb) 378 | 379 | lb.bind("<>", self.callbackHandleSelection) 380 | lb.bind("", self.callbackHandleSelectionDoubleClick) 381 | 382 | lb.pack(side = LEFT,fill = BOTH ,expand=1 ) 383 | 384 | scrollbar = Scrollbar(finderColumnFrame) 385 | scrollbar.pack(side = RIGHT, fill = BOTH) 386 | 387 | lb.config(yscrollcommand = scrollbar.set) 388 | scrollbar.config(command = lb.yview) 389 | 390 | def setButtonsForTags(self,buttonsForTags): 391 | self.buttonsForTags = buttonsForTags 392 | 393 | def clearAllListboxes(self): 394 | for lb in self.listboxes: 395 | lb.delete(0,END) 396 | 397 | def clearListboxesFrom(self,fromPosition): 398 | for position,lb in enumerate(self.listboxes): 399 | if position >= fromPosition: 400 | lb.delete(0,END) 401 | if fromPosition < len(self.currentFinderElement): 402 | for c in range(len(self.currentFinderElement) - fromPosition ): 403 | self.currentFinderElement.pop() 404 | 405 | 406 | def callbackHandleSelectionDoubleClick(self, event): 407 | self.callbackHandleSelection(event=event, doubleClick=True) 408 | 409 | def callbackHandleSelection(self, event, doubleClick=False): 410 | selection = event.widget.curselection() 411 | if selection: 412 | index = selection[0] 413 | print("Selection pos:",index) 414 | print("DoubleClick:",doubleClick) 415 | data = event.widget.get(index) 416 | #print(data) 417 | #print(event.widget) 418 | clickedColumnNumber = -1 419 | for position, lb in enumerate(self.listboxes): 420 | if lb == event.widget: 421 | print("",position) 422 | clickedColumnNumber = position 423 | print("Clicked column",clickedColumnNumber) 424 | print(" Column generated from ",self.currentFinderElement[clickedColumnNumber].shortname) 425 | print(" No of Entries=List elements ",len(self.currentFinderElement[clickedColumnNumber].children)) 426 | 427 | 428 | 429 | if doubleClick: 430 | element = self.currentFinderElement[clickedColumnNumber].children[index] 431 | button = self.buttonsForTags[element] 432 | button.clicked() 433 | 434 | self.listboxes[clickedColumnNumber].itemconfig(index, bg=self.getColorForListElement(element), fg=element.fg) 435 | 436 | 437 | self.listboxes[clickedColumnNumber].selection_clear(0, 'end') 438 | 439 | 440 | else: 441 | self.clearListboxesFrom(clickedColumnNumber+1) 442 | for position,element in enumerate(self.currentFinderElement[clickedColumnNumber].children[index].children): 443 | if (len(element.children) > 0): 444 | self.listboxes[ clickedColumnNumber + 1 ].insert("end", element.shortname + u" \u2192") 445 | else: 446 | self.listboxes[ clickedColumnNumber + 1 ].insert("end", element.shortname) 447 | self.listboxes[ clickedColumnNumber + 1 ].itemconfig(position, bg=self.getColorForListElement(element), fg=element.fg) 448 | self.currentFinderElement.append(self.currentFinderElement[clickedColumnNumber].children[index]) 449 | 450 | def getColorForListElement(self, tag): 451 | if len(tag.currentFapels) == len(tag.allFapels): 452 | return FT_COLORS["finder_tag_selected"] 453 | elif len(tag.currentFapels) == 0: 454 | return FT_COLORS["finder_tag_unselected"] 455 | else: 456 | return FT_COLORS["finder_tag_partially"] 457 | 458 | 459 | # initially fill the first finder column 460 | def loadFinderElements(self, rootElement): 461 | self.rootElement = rootElement 462 | self.clearAllListboxes() 463 | for position,element in enumerate(rootElement.children): 464 | if (len(element.children) > 0): 465 | self.listboxes[0].insert("end", element.shortname + u" \u2192") 466 | else: 467 | self.listboxes[0].insert("end", element.shortname) 468 | self.listboxes[0].itemconfig(position, bg=self.getColorForListElement(element), fg=element.fg) 469 | 470 | 471 | 472 | self.currentFinderElement = [] 473 | self.currentFinderElement.append(rootElement) 474 | 475 | 476 | 477 | ############################################################################################## 478 | #Main 479 | ############################################################################################## 480 | 481 | 482 | 483 | 484 | 485 | # Build main Window 486 | #------------------- 487 | 488 | window = Tk() 489 | 490 | window.title("fapel tagger") 491 | 492 | if (configParser.get('window','fixedOrMinSize') == "fixed"): 493 | window.geometry(configParser.get('window','width')+"x"+configParser.get('window','height')) 494 | else: 495 | window.minsize(configParser.get('window','width'), configParser.get('window','height')) 496 | 497 | bottomframe = Frame(window, bg=FT_COLORS["window_background"]) 498 | bottomframe.pack( side = BOTTOM, fill = X ) 499 | 500 | 501 | style = ttk.Style() 502 | style.theme_create( "MyStyle", parent="alt", settings={ 503 | "TNotebook": {"configure": {"tabmargins": [2, 5, 2, 0] , "background": FT_COLORS["tabs_background"]} }, 504 | "TNotebook.Tab": {"configure": {"padding": [50, 2],"background": FT_COLORS["tabs_unselected"] }, 505 | "map":{"background": [("selected", FT_COLORS["tabs_selected"])], 506 | "expand": [("selected", [1, 1, 1, 0])] }}}) 507 | 508 | style.theme_use("MyStyle") 509 | 510 | 511 | tabControl = ttk.Notebook(window) 512 | 513 | 514 | tagframe = Frame(tabControl,bg=FT_COLORS["window_tagbackground"]) 515 | tabControl.add(tagframe, text = 'Tags') 516 | 517 | finderframe = Frame(tabControl,bg=FT_COLORS["window_tagbackground"]) 518 | 519 | 520 | myFinder = Finder(finderframe,4) 521 | 522 | 523 | tabControl.add(finderframe, text = 'Finder') 524 | 525 | tabControl.pack( side = TOP, fill = BOTH ,expand=1 ) 526 | 527 | 528 | 529 | 530 | 531 | buttonFont = font.Font(family=configParser.get('fonts','tagFontFamily'), size=int(configParser.get('fonts','tagFontSize'))) 532 | 533 | progressbar = ttk.Progressbar(bottomframe, orient='horizontal', mode='determinate', length=280) 534 | 535 | progressbar.pack( side = LEFT) 536 | 537 | progresslabel = ttk.Label(bottomframe, text="") 538 | progresslabel['background']=FT_COLORS["progressbar_background"] 539 | progresslabel['foreground']=FT_COLORS["progressbar"] 540 | progressbar.pack( side = LEFT,padx=20,pady=3) 541 | progresslabel.pack( side = LEFT ) 542 | 543 | progressbar.update_idletasks() 544 | progressbar.update() 545 | 546 | 547 | 548 | 549 | # Create Fapels from Argument 550 | #----------------------------- 551 | 552 | fapels = set() 553 | 554 | # first arg is name of script 555 | arguments = len(sys.argv) - 1 556 | print("Number of given files from command line:",arguments) 557 | position = 1 558 | while (arguments >= position): 559 | fapels.add(Fapel(sys.argv[position])) 560 | position = position + 1 561 | 562 | 563 | progressbar['value'] = 20 564 | progresslabel['text'] = "Loading Tags" 565 | window.update_idletasks() 566 | window.update() 567 | progressbar.update_idletasks() 568 | progressbar.update() 569 | 570 | 571 | 572 | 573 | 574 | # Create Tags from Dirs 575 | #----------------------- 576 | 577 | tags = set() 578 | parentTags = {} 579 | ROOTTAG_KEY = "." 580 | rootTag = Tag(ROOTTAG_KEY) 581 | parentTags[ROOTTAG_KEY] = rootTag 582 | 583 | excludedSubDirs = [] 584 | 585 | for root,d_names,f_names in os.walk(rootpath): 586 | #print (root, d_names, f_names) 587 | 588 | traverseSubDirs = True 589 | for f_name in f_names: 590 | if (f_name == ".exclude_subdirs"): 591 | traverseSubDirs = False 592 | excludedSubDirs.append(root) 593 | 594 | if (f_name == ".hide_button"): 595 | parenttag = os.path.relpath(root, rootpath) 596 | parentTags[parenttag].hideButton = True 597 | 598 | if (f_name == ".hide_child_buttons"): 599 | parenttag = os.path.relpath(root, rootpath) 600 | parentTags[parenttag].hideChildButtons = True 601 | 602 | 603 | for excludedSubDir in excludedSubDirs: 604 | if (root.find(excludedSubDir) != -1): 605 | traverseSubDirs = False 606 | 607 | if (traverseSubDirs): 608 | for d_name in d_names: 609 | if d_name not in excludedTagNames: 610 | # rootpath/GrandParenttag/Parenttag/Tag 611 | # '---------root-----------------' d_name 612 | # rootpath '---tagname-------------------' 613 | # '---dir-----------------------' 614 | # '------parenttag------' 615 | tagname = os.path.relpath(os.path.join(root, d_name), rootpath) 616 | tag = Tag(tagname) 617 | tag.shortname = d_name 618 | tag.dir = os.path.join(root, d_name) 619 | tags.add(tag) 620 | # Tree setup 621 | parenttag = os.path.relpath(root, rootpath) 622 | parentTags[tagname] = tag 623 | # add as child 624 | parentTags[parenttag].addChild(tag) 625 | tag.hideChildButtons = parentTags[parenttag].hideChildButtons 626 | tag.hideButton = parentTags[parenttag].hideChildButtons 627 | 628 | 629 | 630 | #myFinder.loadFinderElements(rootTag) 631 | 632 | 633 | progressbar['value'] = 40 634 | window.update_idletasks() 635 | window.update() 636 | progressbar.update_idletasks() 637 | progressbar.update() 638 | 639 | # match tags with fapels 640 | #------------------------ 641 | 642 | tagCount = len(tags) 643 | currentTagNumber = 0 644 | 645 | # remember inodes for speedup 646 | known_fapel_inodes = {} 647 | known_tagfile_inodes = {} 648 | 649 | 650 | 651 | for tag in tags: 652 | #(_, _, filenames) = next(os.walk(tag.dir)) 653 | #print (tag.name," ",tag.dir) 654 | #_, _, filenames = next(os.walk(tag.dir), (None, None, [])) 655 | 656 | currentTagNumber = currentTagNumber + 1 657 | 658 | 659 | progressbar['value'] = 40 + (40 * currentTagNumber/tagCount) 660 | window.update_idletasks() 661 | window.update() 662 | progressbar.update_idletasks() 663 | progressbar.update() 664 | progresslabel['text'] = "Analyzing Fapels for Tag: " + tag.name 665 | 666 | tag.allFapels = fapels 667 | 668 | filenames = [] 669 | 670 | for root, d_names, filenames in os.walk(tag.dir): 671 | #print (filenames) 672 | break 673 | 674 | 675 | for fapel in fapels: 676 | if fapel.fullPath in known_fapel_inodes: 677 | inode_fapel = known_fapel_inodes[fapel.fullPath] 678 | else: 679 | inode_fapel = os.stat(fapel.fullPath).st_ino 680 | known_fapel_inodes[fapel.fullPath] = inode_fapel 681 | for f_name in filenames: 682 | #print (fapel.filename,"--" ,f_name ) 683 | f_name_fullPath = os.path.join(tag.dir,f_name) 684 | 685 | if f_name_fullPath in known_tagfile_inodes: 686 | inode_f_name = known_tagfile_inodes[f_name_fullPath] 687 | else: 688 | inode_f_name = os.stat(f_name_fullPath).st_ino 689 | known_tagfile_inodes[f_name_fullPath] = inode_f_name 690 | 691 | 692 | #if fapel.filename == f_name: 693 | if inode_fapel == inode_f_name: 694 | #match 695 | fapel.initialTags.add(tag) 696 | tag.initialFapels.add(fapel) 697 | tag.currentFapels.add(fapel) 698 | 699 | print (fapel.filename," found in ",tag.name, " as file ",f_name_fullPath) 700 | fapel.tagFilenames[tag] = f_name_fullPath 701 | 702 | if (os.path.isfile(os.path.join(tag.dir,".taginfo"))): 703 | configParserTT = configparser.RawConfigParser() 704 | configParserTT.read(os.path.join(tag.dir,".taginfo")) 705 | tag.tooltip = configParserTT.get('general','tooltip') 706 | 707 | 708 | 709 | 710 | progressbar['value'] = 80 711 | progresslabel['text'] = "Creating buttons and finder" 712 | window.update_idletasks() 713 | window.update() 714 | progressbar.update_idletasks() 715 | progressbar.update() 716 | 717 | 718 | print("Creating finder entries") 719 | myFinder.loadFinderElements(rootTag) 720 | 721 | 722 | 723 | # create buttons 724 | #---------------- 725 | 726 | buttons = set() 727 | buttonsForTags = {} 728 | 729 | for tag in tags: 730 | button = TagButton(tagframe, tag) 731 | if (tag.tooltip != ""): 732 | button_ttp = CreateToolTip(button,tag.tooltip) 733 | buttons.add(button) 734 | buttonsForTags[tag] = button 735 | 736 | # sort list with key 737 | buttons = sorted(buttons, key=TagButton.comparator) 738 | myFinder.setButtonsForTags(buttonsForTags) 739 | 740 | 741 | # remove all additional buttons from showing up: 742 | # - button is not enabled AND 743 | # - tag has button=none 744 | # - tag has childrenbutton=none 745 | 746 | displayedButtons = set() 747 | for button in buttons: 748 | if (not button.tag.hideButton) or (button.status > 0): 749 | displayedButtons.add(button) 750 | displayedButtons = sorted(displayedButtons, key=TagButton.comparator) 751 | 752 | 753 | # arrange buttons 754 | 755 | 756 | x = 0 757 | y = 0 758 | maxy = int(configParser.get('window','buttonsPerColumn')) 759 | for button in displayedButtons: 760 | button.grid(column=x, row=y) 761 | y = y + 1 762 | if y == maxy: 763 | y = 0 764 | x = x + 1 765 | 766 | 767 | progressbar['value'] = 90 768 | progresslabel['text'] = "Almost done..." 769 | window.update_idletasks() 770 | window.update() 771 | progressbar.update_idletasks() 772 | progressbar.update() 773 | 774 | # functional buttons 775 | 776 | def clickApply(): 777 | for fapel in fapels: 778 | fapel.applyTagStructure() 779 | window.destroy() 780 | 781 | def clickCancel(): 782 | window.destroy() 783 | 784 | 785 | def clickShowAllButtons(): 786 | x = 0 787 | y = 0 788 | maxy = int(configParser.get('window','buttonsPerColumn')) 789 | for button in buttons: 790 | button.grid(column=x, row=y) 791 | y = y + 1 792 | if y == maxy: 793 | y = 0 794 | x = x + 1 795 | showAllButtonsButton["state"] = "disabled" 796 | window.update_idletasks() 797 | window.update() 798 | 799 | 800 | saveButton = Button(bottomframe, text="Apply", command=clickApply, bg = FT_COLORS["button_apply"]) 801 | showAllButtonsButton = Button(bottomframe, text="Show all buttons", command=clickShowAllButtons, bg = FT_COLORS["button_showallbuttons"]) 802 | cancelButton = Button(bottomframe, text="Cancel", command=clickCancel, bg = FT_COLORS["button_cancel"]) 803 | saveButton.pack( side = RIGHT,padx=20,pady=3) 804 | cancelButton.pack( side = RIGHT) 805 | showAllButtonsButton.pack( side = LEFT) 806 | 807 | 808 | progressbar['value'] = 100 809 | window.update_idletasks() 810 | window.update() 811 | progressbar.update_idletasks() 812 | progressbar.update() 813 | 814 | progresslabel.pack_forget() 815 | progressbar.pack_forget() 816 | 817 | 818 | window.mainloop() 819 | -------------------------------------------------------------------------------- /fapelsystem/fapxile_file_template: -------------------------------------------------------------------------------- 1 | # fapxile definition file 2 | # rename to .fapxile 3 | 4 | 5 | # All Exiles this Tag (=the Folder containing this file) itself belongs to. 6 | # This folder alone is then not visible (its fapels are still visible in other folders) 7 | # Usecase: Hide this Tag but still show its fapels in different tags 8 | [fapxileForThisTag] 9 | 10 | 11 | # All Exiles all Fapels AND all their Hardlinks will belong to. 12 | # All files within this folder containing this file will not be visible. 13 | # Also all other hardlinks of these files in other folders will be hidden. 14 | # Usecase: Tag fapels with this Tag and hide all of them with one click. 15 | [fapxileForFapelsOfThisTag] 16 | 17 | 18 | # All Exiles all Subtags / Subfolders and their fapels (with all hardlinks) will belong to. 19 | # Usecase: Hide all fapels from a counter-dir (like e.g. c-to) 20 | [fapxileForSubTagsAndSubFapels] 21 | 22 | # All SubTags of this Tag listed here (with full name) are ignored by [fapxileForSubTagsAndSubFapels] 23 | # Usecase: Ignore all c-to tagged media except "0001" media. 24 | # Full name means name as it is displayed in the tagger on the button 25 | [excludedSubTags] 26 | 27 | -------------------------------------------------------------------------------- /fapelsystem/openLink.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | ############################################################################################## 4 | # 5 | # The fapel system organizes image and video collections under Linux with standard folders. 6 | # openLink.sh opens a file manager window of the directory a sym-linked has its source. 7 | # 8 | # For updates see git-repo at 9 | #https://github.com/pronopython/fapel-system 10 | # 11 | ############################################################################################## 12 | # 13 | VERSION="0.1.0" 14 | INSTALLDIR="/opt/fapelsystem" 15 | # 16 | ############################################################################################## 17 | # 18 | # Copyright (C) 2022 PronoPython 19 | # 20 | # Contact me at pronopython@proton.me 21 | # 22 | # This program is free software: you can redistribute it and/or modify it 23 | # under the terms of the GNU General Public License as published by the 24 | # Free Software Foundation, either version 3 of the License, or 25 | # (at your option) any later version. 26 | # 27 | # This program is distributed in the hope that it will be useful, 28 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 29 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 30 | # GNU General Public License for more details. 31 | # 32 | # You should have received a copy of the GNU General Public License 33 | # along with this program. If not, see . 34 | # 35 | ############################################################################################## 36 | # 37 | targetFile=$(readlink "$1") 38 | targetDir=$(dirname "$targetFile") 39 | #nautilus --no-desktop "$targetDir" 40 | xdg-open "$targetDir" 41 | -------------------------------------------------------------------------------- /fapelsystem/print_module_dir.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | # 3 | ############################################################################################## 4 | # 5 | # The fapel system organizes image and video collections under Linux with standard folders. 6 | # fappel_tagger is a GUI based media tagging application. 7 | # 8 | # For updates see git-repo at 9 | #https://github.com/pronopython/fapel-system 10 | # 11 | ############################################################################################## 12 | # 13 | VERSION = "0.1.0" #TODO 14 | # 15 | ############################################################################################## 16 | # 17 | # Copyright (C) 2022-2023 PronoPython 18 | # 19 | # Contact me at pronopython@proton.me 20 | # 21 | # This program is free software: you can redistribute it and/or modify it 22 | # under the terms of the GNU General Public License as published by the 23 | # Free Software Foundation, either version 3 of the License, or 24 | # (at your option) any later version. 25 | # 26 | # This program is distributed in the hope that it will be useful, 27 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 29 | # GNU General Public License for more details. 30 | # 31 | # You should have received a copy of the GNU General Public License 32 | # along with this program. If not, see . 33 | # 34 | ############################################################################################## 35 | # 36 | import os 37 | 38 | def printModuleDir(): 39 | print(os.path.dirname(os.path.realpath(__file__))) 40 | -------------------------------------------------------------------------------- /fapelsystem/tagPackExport.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | # 3 | ############################################################################################## 4 | # 5 | # The fapel system organizes image and video collections under Linux with standard folders. 6 | # tagPackExport can be used to export a Tag Directory Structure to a tagPack CSV file 7 | # 8 | # For updates see git-repo at 9 | #https://github.com/pronopython/fapel-system 10 | # 11 | ############################################################################################## 12 | # 13 | VERSION = "0.2.1" 14 | # 15 | ############################################################################################## 16 | # 17 | # Copyright (C) 2022-2023 PronoPython 18 | # 19 | # Contact me at pronopython@proton.me 20 | # 21 | # This program is free software: you can redistribute it and/or modify it 22 | # under the terms of the GNU General Public License as published by the 23 | # Free Software Foundation, either version 3 of the License, or 24 | # (at your option) any later version. 25 | # 26 | # This program is distributed in the hope that it will be useful, 27 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 29 | # GNU General Public License for more details. 30 | # 31 | # You should have received a copy of the GNU General Public License 32 | # along with this program. If not, see . 33 | # 34 | ############################################################################################## 35 | # TODO Bug: .ts , . , .recycled etc will be exported, too 36 | 37 | import os 38 | import sys 39 | import csv 40 | import getopt 41 | import codecs 42 | import configparser 43 | import codecs 44 | 45 | 46 | print("TagPack Exporter") 47 | 48 | 49 | 50 | ############################################################################################## 51 | #Import lib 52 | ############################################################################################## 53 | 54 | 55 | from fapelsystem import config_file_handler as config_file_handler 56 | from fapelsystem import dir_helper as dir_helper 57 | 58 | 59 | configDir = dir_helper.getConfigDir("Fapelsystem") 60 | #print(configDir) 61 | configParser = config_file_handler.FapelSystemConfigFile(os.path.join(configDir,"fapel_system.conf")) 62 | 63 | 64 | 65 | ############################################################################################## 66 | #Vars 67 | ############################################################################################## 68 | 69 | 70 | tagPackFilename = None 71 | rot13enabled = True 72 | NSFWenabled = False 73 | info = "" 74 | 75 | ############################################################################################## 76 | #Args 77 | ############################################################################################## 78 | 79 | 80 | 81 | if len(sys.argv) == 1: 82 | # TODO print a help 83 | sys.exit(2) 84 | 85 | try: 86 | opts, args = getopt.getopt(sys.argv[1:],"?hcni:",[]) 87 | except getopt.GetoptError: 88 | # TODO print a help 89 | sys.exit(2) 90 | 91 | 92 | for opt, arg in opts: 93 | if (opt == '-h') or (opt == '-?'): 94 | # TODO print a help 95 | sys.exit(2) 96 | elif (opt == '-c'): # clear text instead of rot13 97 | rot13enabled = False 98 | elif (opt == '-n'): 99 | NSFWenabled = True 100 | elif (opt == '-i'): 101 | info = arg 102 | 103 | 104 | if (len(args) == 1): 105 | tagPackFilename = args[0] 106 | else: 107 | pass 108 | # TODO error, no tagpack... 109 | 110 | 111 | 112 | 113 | 114 | rootpath = configParser.getDir('dirs','tagDir') 115 | 116 | print("Exporting tags from", rootpath) 117 | 118 | 119 | file = open(tagPackFilename, mode ='w') 120 | csvFile = csv.writer(file, delimiter=";") 121 | 122 | 123 | #csvFile.writerow(["REM",";","\"",""]) 124 | 125 | 126 | csvFile.writerow(["REM","Parameter A","Parameter B","Parameter C"]) 127 | csvFile.writerow(["VERSION","1","",""]) 128 | csvFile.writerow(["REM","Exported with tagPackExport","",""]) 129 | 130 | 131 | if info != "": 132 | csvFile.writerow(["INFO",info,"",""]) 133 | 134 | 135 | if NSFWenabled: 136 | csvFile.writerow(["NSFW","","",""]) 137 | 138 | 139 | 140 | 141 | 142 | csvFile.writerow(["REM","#####################################################################################","",""]) 143 | 144 | if rot13enabled: 145 | csvFile.writerow(["ROT","on","on","off"]) 146 | 147 | 148 | 149 | excludedSubDirs = [] 150 | 151 | 152 | for counterEntry in configParser.items("countersDirs"): 153 | cdir = counterEntry[1] 154 | cdir = dir_helper.expandHomeDir(cdir) 155 | 156 | if (cdir.startswith(rootpath)): 157 | excludedSubDirs.append(cdir) 158 | print("Counter",cdir,"will be excluded") 159 | 160 | 161 | 162 | 163 | for root,d_names,f_names in os.walk(rootpath): 164 | #print (root, d_names, f_names) 165 | 166 | tagproperties = "" 167 | 168 | traverseSubDirs = True 169 | excludeTag = False 170 | for f_name in f_names: 171 | if (f_name == ".exclude_subdirs"): 172 | traverseSubDirs = False 173 | excludedSubDirs.append(root) 174 | if tagproperties != "": 175 | tagproperties = tagproperties + "," 176 | tagproperties = tagproperties + "exclude_subdirs" 177 | 178 | if (f_name == ".hide_button"): 179 | if tagproperties != "": 180 | tagproperties = tagproperties + "," 181 | tagproperties = tagproperties + "hide_button" 182 | if (f_name == ".hide_child_buttons"): 183 | if tagproperties != "": 184 | tagproperties = tagproperties + "," 185 | tagproperties = tagproperties + "hide_child_buttons" 186 | 187 | for excludedSubDir in excludedSubDirs: 188 | if (root.find(excludedSubDir) != -1): 189 | traverseSubDirs = False 190 | excludeTag = True 191 | 192 | if not excludeTag: 193 | 194 | tooltip = "" 195 | if (os.path.isfile(os.path.join(root,".taginfo"))): 196 | configParserTT = configparser.RawConfigParser() 197 | configParserTT.read(os.path.join(root,".taginfo")) 198 | tooltip = configParserTT.get('general','tooltip') 199 | 200 | 201 | 202 | 203 | tagname = os.path.relpath(root, rootpath) 204 | if not rot13enabled: 205 | csvFile.writerow(["TAG",tagname,tooltip,tagproperties]) 206 | else: 207 | csvFile.writerow(["TAG",codecs.encode(tagname, 'rot_13'),codecs.encode(tooltip, 'rot_13'),tagproperties]) 208 | 209 | 210 | # Dummy main to be callable through PIP installer 211 | # TODO: remove this workaround 212 | def main(): 213 | pass 214 | 215 | -------------------------------------------------------------------------------- /fapelsystem/tagPackInstall.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | # 3 | ############################################################################################## 4 | # 5 | # The fapel system organizes image and video collections under Linux with standard folders. 6 | # tagPackInstall creates Dirs from a tagPack CSV file within the Tag folder 7 | # 8 | # For updates see git-repo at 9 | #https://github.com/pronopython/fapel-system 10 | # 11 | ############################################################################################## 12 | # 13 | VERSION = "0.2.1" #TODO 14 | # 15 | ############################################################################################## 16 | # 17 | # Copyright (C) 2022-2023 PronoPython 18 | # 19 | # Contact me at pronopython@proton.me 20 | # 21 | # This program is free software: you can redistribute it and/or modify it 22 | # under the terms of the GNU General Public License as published by the 23 | # Free Software Foundation, either version 3 of the License, or 24 | # (at your option) any later version. 25 | # 26 | # This program is distributed in the hope that it will be useful, 27 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 29 | # GNU General Public License for more details. 30 | # 31 | # You should have received a copy of the GNU General Public License 32 | # along with this program. If not, see . 33 | # 34 | ############################################################################################## 35 | # 36 | # TODO: uninstaller, remove all which was not used (= no fapels present) 37 | # therefore a "Play" must run in positive (down) direction 38 | # then play that backwards, which thenn removes /Models/A and then /Models 39 | 40 | 41 | import os 42 | import sys 43 | import csv 44 | import getopt 45 | import codecs 46 | 47 | 48 | 49 | 50 | 51 | print("TagPack Installer") 52 | 53 | 54 | 55 | ############################################################################################## 56 | #Import lib 57 | ############################################################################################## 58 | 59 | 60 | 61 | from fapelsystem import config_file_handler as config_file_handler 62 | from fapelsystem import dir_helper as dir_helper 63 | 64 | 65 | configDir = dir_helper.getConfigDir("Fapelsystem") 66 | #print(configDir) 67 | configParser = config_file_handler.FapelSystemConfigFile(os.path.join(configDir,"fapel_system.conf")) 68 | 69 | 70 | 71 | ############################################################################################## 72 | #Vars 73 | ############################################################################################## 74 | 75 | INSTALLDIR = dir_helper.getInstallDir() 76 | 77 | simulation = False 78 | tagPackFilename = None 79 | 80 | ############################################################################################## 81 | #Args 82 | ############################################################################################## 83 | 84 | 85 | 86 | if len(sys.argv) == 1: 87 | # TODO print a help 88 | sys.exit(2) 89 | 90 | try: 91 | opts, args = getopt.getopt(sys.argv[1:],"?hs",[]) 92 | except getopt.GetoptError: 93 | # TODO print a help 94 | sys.exit(2) 95 | 96 | 97 | for opt, arg in opts: 98 | if (opt == '-h') or (opt == '-?'): 99 | # TODO print a help 100 | sys.exit(2) 101 | elif opt == '-s': 102 | print("Simulation on") 103 | simulation = True 104 | 105 | if (len(args) == 1): 106 | tagPackFilename = args[0] 107 | else: 108 | pass 109 | # TODO error, no tagpack... 110 | 111 | 112 | 113 | rootpath = configParser.getDir('dirs','tagDir') 114 | 115 | print("Installing tags to", rootpath) 116 | 117 | 118 | counterEmojis = None 119 | 120 | file = open(tagPackFilename, mode ='r') 121 | csvFile = csv.reader(file, delimiter=";") 122 | linenumber = 0 123 | rot13on = None 124 | for line in csvFile: 125 | if rot13on == None: 126 | rot13on = [False]*len(line) 127 | 128 | if line[0] != "ROT": 129 | for position,item in enumerate(line): 130 | if rot13on[position]: 131 | line[position] = codecs.encode(item, 'rot_13') 132 | 133 | linenumber = linenumber + 1 134 | 135 | if line[0] == "INFO": 136 | print(line[1]) 137 | elif line[0] == "VERSION": 138 | print("Version of file:",line[1]) 139 | if line[1] != "1": 140 | print("Wrong TagPack version, check for updates of this program! Giving up!") 141 | sys.exit(1) 142 | 143 | elif line[0] == "NSFW": 144 | answer = input("TagPack contains NSFW content. Do you want to proceed? (y/n)") 145 | if not ((answer == "y") or (answer == "Y")): 146 | sys.exit(0) 147 | 148 | elif line[0] == "ROT": 149 | for position,item in enumerate(line): 150 | if item.lower() == "on": 151 | rot13on[position] = True 152 | else: 153 | rot13on[position] = False 154 | 155 | elif line[0] == "TAG": 156 | 157 | 158 | if line[1].find("../") != -1: 159 | print("Malicious relative path found in tagPack file tag dir:") 160 | print(line[1]) 161 | print("aborting") 162 | sys.exit(1) 163 | 164 | if line[3].find("../") != -1: 165 | print("Malicious relative path found in tagPack file dot filename:") 166 | print(line[3]) 167 | print("aborting") 168 | sys.exit(1) 169 | 170 | 171 | 172 | tagpath = os.path.join(rootpath, line[1]) 173 | if not os.path.isdir(tagpath): 174 | print("Creating tag",line[1]) 175 | if not simulation: 176 | #os.mkdir(tagpath) 177 | os.makedirs(tagpath , exist_ok=True ) 178 | 179 | # create tool tip? 180 | if line[2] != "": 181 | tooltipfilename = os.path.join(tagpath,".taginfo") 182 | if not os.path.isfile(tooltipfilename): 183 | with open(tooltipfilename, 'w') as f: 184 | f.write('[general]') 185 | f.write(os.linesep) 186 | f.write('tooltip='+line[2]) 187 | f.write(os.linesep) 188 | # create . dot files 189 | if line[3] != "": 190 | dotFilenames = line[3].split(",") 191 | for dotFilename in dotFilenames: 192 | dotFilename = os.path.join(tagpath,"."+dotFilename) 193 | if not os.path.isfile(dotFilename): 194 | with open(dotFilename, 'w') as f: 195 | pass 196 | 197 | 198 | 199 | 200 | elif line[0] == "COUNTER": 201 | 202 | 203 | counterDestinationPath = os.path.join(rootpath, line[1]) 204 | 205 | scriptPath = configParser.getDir('dirs','filemanagerScriptDir') 206 | 207 | linkName = line[2] 208 | linkNameEmojis = line[3].encode('UTF-8').decode('unicode-escape') 209 | 210 | print("Counter:") 211 | print(" Tag:",counterDestinationPath) 212 | print(" Rightclick script:", linkName," / ",linkNameEmojis) 213 | 214 | 215 | answer = input("Install this counter? (y/n)") 216 | 217 | if ((answer == "y") or (answer == "Y")): 218 | 219 | if (counterEmojis == None): 220 | answer = input("Install nautilus scripts with emojis? (y/n)") 221 | counterEmojis = (answer == "y") or (answer == "Y") 222 | 223 | if counterEmojis: 224 | linkFilename = os.path.join(scriptPath,linkNameEmojis) 225 | else: 226 | linkFilename = os.path.join(scriptPath,linkName) 227 | 228 | if not os.path.isfile(linkFilename): 229 | print("Creating counter",linkName) 230 | if not simulation: 231 | 232 | os.symlink(os.path.join(INSTALLDIR,"fapel_counter.py"),linkFilename) 233 | 234 | counterKey = dir_helper.getLastPartOfFilename(linkFilename) 235 | print("Counter Name:", counterKey) 236 | 237 | 238 | counterPath = os.path.join(configParser.getDir('dirs','tagDir'),line[1]) 239 | configParser.changeConfig()['countersDirs'][counterKey] = counterPath 240 | 241 | 242 | print("Installed counter",counterKey) 243 | 244 | 245 | elif line[0] == "REM": 246 | # it's just a remark, so just pass on 247 | pass 248 | 249 | else: 250 | print("Unknown command",line[0],"in line",linenumber) 251 | 252 | 253 | configParser.writeChangedConfig() 254 | 255 | 256 | # Dummy main to be callable through PIP installer 257 | # TODO: remove this workaround 258 | def main(): 259 | pass 260 | -------------------------------------------------------------------------------- /img/001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/001.png -------------------------------------------------------------------------------- /img/002.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/002.png -------------------------------------------------------------------------------- /img/003.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/003.png -------------------------------------------------------------------------------- /img/004.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/004.png -------------------------------------------------------------------------------- /img/005.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/005.png -------------------------------------------------------------------------------- /img/006.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/006.png -------------------------------------------------------------------------------- /img/007.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/007.png -------------------------------------------------------------------------------- /img/008.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/008.png -------------------------------------------------------------------------------- /img/009.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/009.png -------------------------------------------------------------------------------- /img/010.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/010.png -------------------------------------------------------------------------------- /img/011.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/011.png -------------------------------------------------------------------------------- /img/013.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/013.png -------------------------------------------------------------------------------- /img/014.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/014.png -------------------------------------------------------------------------------- /img/015.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/015.png -------------------------------------------------------------------------------- /img/132462.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/132462.png -------------------------------------------------------------------------------- /img/141.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/141.png -------------------------------------------------------------------------------- /img/142.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/142.png -------------------------------------------------------------------------------- /img/143.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/143.png -------------------------------------------------------------------------------- /img/144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/144.png -------------------------------------------------------------------------------- /img/145.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/145.png -------------------------------------------------------------------------------- /img/201.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/201.png -------------------------------------------------------------------------------- /img/202.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/202.png -------------------------------------------------------------------------------- /img/203.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/203.png -------------------------------------------------------------------------------- /img/211.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/211.png -------------------------------------------------------------------------------- /img/212.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/212.png -------------------------------------------------------------------------------- /img/213.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/213.png -------------------------------------------------------------------------------- /img/270.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/270.png -------------------------------------------------------------------------------- /img/27173524.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/27173524.png -------------------------------------------------------------------------------- /img/278.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/278.png -------------------------------------------------------------------------------- /img/279.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/279.png -------------------------------------------------------------------------------- /img/280.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/280.png -------------------------------------------------------------------------------- /img/281.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/281.gif -------------------------------------------------------------------------------- /img/3298424.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/3298424.png -------------------------------------------------------------------------------- /img/432432.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/432432.png -------------------------------------------------------------------------------- /img/4837312.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/4837312.png -------------------------------------------------------------------------------- /img/6262673.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/6262673.png -------------------------------------------------------------------------------- /img/73982.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/73982.png -------------------------------------------------------------------------------- /img/763826432.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/763826432.png -------------------------------------------------------------------------------- /img/829732.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/829732.png -------------------------------------------------------------------------------- /img/8328253.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/8328253.png -------------------------------------------------------------------------------- /img/8383672.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/8383672.png -------------------------------------------------------------------------------- /img/85201.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/85201.png -------------------------------------------------------------------------------- /img/85202.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/85202.png -------------------------------------------------------------------------------- /img/85203.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/85203.png -------------------------------------------------------------------------------- /img/85204.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/85204.png -------------------------------------------------------------------------------- /img/85205.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/85205.png -------------------------------------------------------------------------------- /img/85206.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/85206.png -------------------------------------------------------------------------------- /img/85207.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/85207.png -------------------------------------------------------------------------------- /img/85208.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/85208.png -------------------------------------------------------------------------------- /img/8726632.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/8726632.png -------------------------------------------------------------------------------- /img/8732243.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/8732243.png -------------------------------------------------------------------------------- /img/8824314.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/8824314.png -------------------------------------------------------------------------------- /img/88264267.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/88264267.png -------------------------------------------------------------------------------- /img/98626723.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/98626723.png -------------------------------------------------------------------------------- /img/987762.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/987762.png -------------------------------------------------------------------------------- /img/99078327.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/99078327.png -------------------------------------------------------------------------------- /img/99787312.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pronopython/fapel-system/ea153bbe44e41b879350b95389d87329b1995a65/img/99787312.png -------------------------------------------------------------------------------- /install_ubuntu.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | ############################################################################################## 4 | # 5 | # The fapel system organizes image and video collections under Linux with standard folders. 6 | # install.sh is the installer script to copy all py files and create nautilus shortcuts 7 | # 8 | # For updates see git-repo at 9 | #https://github.com/pronopython/fapel-system 10 | # 11 | ############################################################################################## 12 | # 13 | VERSION=0.1.0 14 | # 15 | CONFIGDIR=~/.config 16 | NAUTILUSSCRIPTDIR=~/.local/share/nautilus/scripts 17 | INSTALLDIR="" 18 | # 19 | ############################################################################################## 20 | # 21 | # Copyright (C) 2022-2023 PronoPython 22 | # 23 | # Contact me at pronopython@proton.me 24 | # 25 | # This program is free software: you can redistribute it and/or modify it 26 | # under the terms of the GNU General Public License as published by the 27 | # Free Software Foundation, either version 3 of the License, or 28 | # (at your option) any later version. 29 | # 30 | # This program is distributed in the hope that it will be useful, 31 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 32 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 33 | # GNU General Public License for more details. 34 | # 35 | # You should have received a copy of the GNU General Public License 36 | # along with this program. If not, see . 37 | # 38 | ############################################################################################## 39 | # 40 | # TODO comment header 41 | # TODO clean out comments 42 | 43 | 44 | 45 | ################################################################################## 46 | 47 | ################################################################################## 48 | 49 | EMOJIUNICORN=$(echo -e "\U1F984") 50 | EMOJIEGGPLANT=$(echo -e "\U1F346") 51 | EMOJIWATER=$(echo -e "\U1F4A6") 52 | #EMOJITAG=$(echo -e "\U1F3F7") 53 | EMOJITAG=$(echo -e "\U2705") 54 | #EMOJIHEARTS=$(echo -e "\U1F60D") 55 | EMOJIHEARTS=$(echo -e "\U2764\UFE0F") 56 | EMOJIMAGGLAS=$(echo -e "\U1F50D") 57 | EMOJICALENDAR=$(echo -e "\U1F4C5") 58 | EMOJIARROW=$(echo -e "\U27A1") 59 | EMOJIISLAND=$(echo -e "\U1F3DD") 60 | EMOJITROPHY=$(echo -e "\U1F3C6") 61 | 62 | ################################################################################## 63 | 64 | link_module () { 65 | echo "installing $1" 66 | sudo ln -s $INSTALLDIR/$1 $NAUTILUSSCRIPTDIR/$2 67 | sudo chown $USER:$USER $NAUTILUSSCRIPTDIR/$2 68 | } 69 | 70 | ################################################################################## 71 | 72 | 73 | echo "fapelsystem installer v${VERSION}" 74 | echo "" 75 | echo "The installer now creates the program dirs and config files." 76 | echo "Sudo is needed for some actions." 77 | echo "" 78 | 79 | #pip install . 80 | 81 | 82 | if ! type "fapelsystem_printModuleDir" >/dev/null 2>&1; then 83 | echo "Installing fapel system module via pip" 84 | pip install . 85 | echo "" 86 | fi 87 | 88 | 89 | INSTALLDIR="$(fapelsystem_printModuleDir)" 90 | 91 | echo "fapel system module installed in: ${INSTALLDIR}" 92 | echo "" 93 | 94 | echo "Copying config file..." 95 | cp -i $INSTALLDIR/fapel_system_template.conf $CONFIGDIR/fapel_system.conf 96 | 97 | 98 | echo "" 99 | echo "The fapelsystem works with nautilus file manager through scripts in nautilus' script dir." 100 | echo "These scripts can have emoji names for better visualization of their function." 101 | echo "You can now choose if you want them with or without emojis in their names." 102 | echo "Note that sudo is needed for that action." 103 | echo "" 104 | 105 | while true; do 106 | 107 | read -p "Install nautilus scripts with emojis? (y/n) " yn 108 | 109 | case $yn in 110 | [yY] ) link_module fapel_tagger.py 1${EMOJITAG}--fapel-tagger.py; 111 | link_module fapel_counter.py 2${EMOJIHEARTS}--fapel-notice.py; 112 | link_module fapel_counter.py 6${EMOJIEGGPLANT}${EMOJIWATER}--fapel-ct.py; 113 | link_module fapel_search_not_tagged.py 5${EMOJIMAGGLAS}--fapel-search-not-tagged.py; 114 | link_module fapel_search_source_file.py 5${EMOJIMAGGLAS}--fapel-search-source-file.py; 115 | link_module fapel_search_tagged.py 4${EMOJIMAGGLAS}--fapel-search-tagged.py; 116 | link_module fapel_fap_set.py 3${EMOJICALENDAR}--fapel-fap-set.py; 117 | link_module openLink.sh 9${EMOJIARROW}--open-softlink-folder.sh; 118 | link_module fapel_exiles.py 9${EMOJIISLAND}--fapel-exiles.py; 119 | link_module fapel_elo.py 9${EMOJITROPHY}--fapel-elo.py; 120 | break;; 121 | 122 | [nN] ) link_module fapel_tagger.py 1-fapel-tagger.py; 123 | link_module fapel_counter.py 2-fapel-notice.py; 124 | link_module fapel_counter.py 6-fapel-ct.py; 125 | link_module fapel_search_not_tagged.py 5-fapel-search-not-tagged.py; 126 | link_module fapel_search_source_file.py 5-fapel-search-source-file.py; 127 | link_module fapel_search_tagged.py 4-fapel-search-tagged.py; 128 | link_module fapel_fap_set.py 3-fapel-fap-set.py; 129 | link_module openLink.sh 9-open-softlink-folder.sh; 130 | link_module fapel_exiles.py 9-fapel-exiles.py; 131 | link_module fapel_elo.py 9-fapel-elo.py; 132 | break;; 133 | 134 | * ) echo invalid response;; 135 | esac 136 | 137 | done 138 | 139 | echo "Changing permissions on installed module files" 140 | sudo chmod 0755 $INSTALLDIR/*.py 141 | sudo chmod 0755 $INSTALLDIR/*.sh 142 | sudo chmod 0644 $INSTALLDIR/*.conf 143 | sudo chmod 0644 $INSTALLDIR/fapxile_file_template 144 | 145 | 146 | 147 | 148 | 149 | echo "" 150 | echo "The fapelsystem needs directories to place media and their tags (which are also directories)." 151 | echo "You can edit the config file to point the fapelsystem to an existing directory structure" 152 | echo "or this script can now create a basic, empty structure under your home dir" 153 | echo " ~/fapelsystem/" 154 | echo "for you. This will then work out-of-the-box with the provided config file." 155 | echo "It is also needed for the tag packs." 156 | echo "" 157 | 158 | while true; do 159 | 160 | read -p "Install fapelsystem basic directories? (y/n) " yn 161 | 162 | case $yn in 163 | [yY] ) mkdir ~/fapelsystem; 164 | mkdir ~/fapelsystem/Tags; 165 | mkdir ~/fapelsystem/Tags/.recycled; 166 | mkdir ~/fapelsystem/Notice; 167 | mkdir ~/fapelsystem/Tags/Ct; 168 | mkdir ~/fapelsystem/Tags/Ct/Ct; 169 | touch ~/fapelsystem/Tags/Ct/Ct/.hide_button 170 | touch ~/fapelsystem/Tags/Ct/Ct/.hide_child_buttons 171 | 172 | echo "[fapxileForThisTag]" > ~/fapelsystem/Tags/Ct/Ct/.fapxile 173 | echo "[fapxileForFapelsOfThisTag]" >> ~/fapelsystem/Tags/Ct/Ct/.fapxile 174 | echo "[fapxileForSubTagsAndSubFapels]" >> ~/fapelsystem/Tags/Ct/Ct/.fapxile 175 | echo "ct" >> ~/fapelsystem/Tags/Ct/Ct/.fapxile 176 | echo "[excludedSubTags]" >> ~/fapelsystem/Tags/Ct/Ct/.fapxile 177 | echo "Ct/Ct/0001" >> ~/fapelsystem/Tags/Ct/Ct/.fapxile 178 | 179 | 180 | mkdir ~/fapelsystem/Tags/Hoover_over_me_for_a_tip 181 | 182 | echo "[general]" > ~/fapelsystem/Tags/Hoover_over_me_for_a_tip/.taginfo 183 | echo "tooltip='Create more Tags by simply creating directories under ~/fapelsystem/Tags'" >> ~/fapelsystem/Tags/Hoover_over_me_for_a_tip/.taginfo 184 | 185 | 186 | 187 | mkdir ~/fapelsystem/Elo; 188 | mkdir ~/fapelsystem/Search\ Results; 189 | mkdir ~/fapelsystem/Fapsets; 190 | break;; 191 | 192 | [nN] ) break;; 193 | 194 | * ) echo invalid response;; 195 | esac 196 | 197 | done 198 | 199 | 200 | echo "done" 201 | 202 | -------------------------------------------------------------------------------- /install_windows.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | REM pip install . 3 | 4 | 5 | WHERE fapelsystem_printModuleDir 6 | IF %ERRORLEVEL% NEQ 0 ( 7 | ECHO installing Fapelsystem module via pip 8 | REM ECHO pip install . 9 | pip install . 10 | REM pause 11 | REM exit 0 12 | ) 13 | 14 | for /f %%i in ('fapelsystem_printModuleDir') do set INSTALLDIR=%%i 15 | echo fapel system module installed in: %INSTALLDIR% 16 | 17 | set CONFIGDIR=%AppData%\Fapelsystem 18 | set SENDTODIR=%AppData%\Microsoft\Windows\SendTo 19 | 20 | 21 | 22 | mkdir "%CONFIGDIR%" 23 | 24 | copy "%INSTALLDIR%\fapel_system_template_windows.conf" "%CONFIGDIR%\fapel_system.conf" 25 | 26 | 27 | 28 | call:link_module fapel_tagger.py 1-fapel-tagger.py 29 | REM call:link_module fapel_counter.py 2-fapel-notice.py 30 | call:link_counter notice 2-fapel-notice.py 31 | call:link_counter ct 2-fapel-ct.py 32 | REM call:link_module fapel_counter.py 6-fapel-ct.py 33 | call:link_module fapel_search_not_tagged.py 5-fapel-search-not-tagged.py 34 | REM search source file needs "find" cmd from linux => does not work on windows 35 | REM call:link_module fapel_search_source_file.py 5-fapel-search-source-file.py 36 | call:link_module fapel_search_tagged.py 4-fapel-search-tagged.py 37 | call:link_module fapel_fap_set.py 3-fapel-fap-set.py 38 | REM call:link_module openLink.sh 9-open-softlink-folder.sh 39 | REM fapel exiles need a rewrite for windows 40 | REM call:link_module fapel_exiles.py 9-fapel-exiles.py 41 | call:link_module fapel_elo.py 9-fapel-elo.py 42 | 43 | echo[ 44 | 45 | 46 | :choice 47 | set /P c=Install fapelsystem basic directories [Y/N]? 48 | if /I "%c%" EQU "Y" goto :createdirs 49 | if /I "%c%" EQU "N" goto :donotcreatedirs 50 | goto :choice 51 | 52 | 53 | :createdirs 54 | 55 | 56 | 57 | mkdir %UserProfile%\Documents\fapelsystem 58 | mkdir %UserProfile%\Documents\fapelsystem\Tags 59 | mkdir %UserProfile%\Documents\fapelsystem\Tags\.recycled 60 | mkdir %UserProfile%\Documents\fapelsystem\Notice 61 | mkdir %UserProfile%\Documents\fapelsystem\Tags\Ct 62 | mkdir %UserProfile%\Documents\fapelsystem\Tags\Ct\Ct 63 | REM touch ~/fapelsystem/Tags/Ct/Ct/.hide_button 64 | REM touch ~/fapelsystem/Tags/Ct/Ct/.hide_child_buttons 65 | 66 | REM echo "[fapxileForThisTag]" > ~/fapelsystem/Tags/Ct/Ct/.fapxile 67 | REM echo "[fapxileForFapelsOfThisTag]" >> ~/fapelsystem/Tags/Ct/Ct/.fapxile 68 | REM echo "[fapxileForSubTagsAndSubFapels]" >> ~/fapelsystem/Tags/Ct/Ct/.fapxile 69 | REM echo "ct" >> ~/fapelsystem/Tags/Ct/Ct/.fapxile 70 | REM echo "[excludedSubTags]" >> ~/fapelsystem/Tags/Ct/Ct/.fapxile 71 | REM echo "Ct/Ct/0001" >> ~/fapelsystem/Tags/Ct/Ct/.fapxile 72 | 73 | 74 | REM mkdir %UserProfile%\fapelsystem\Tags\Hoover_over_me_for_a_tip 75 | mkdir "%UserProfile%\Documents\fapelsystem\Tags\Another Tag" 76 | 77 | REM echo "[general]" > ~/fapelsystem/Tags/Hoover_over_me_for_a_tip/.taginfo 78 | REM echo "tooltip='Create more Tags by simply creating directories under ~/fapelsystem/Tags'" >> ~/fapelsystem/Tags/Hoover_over_me_for_a_tip/.taginfo 79 | 80 | mkdir %UserProfile%\Documents\fapelsystem\Elo 81 | mkdir "%UserProfile%\Documents\fapelsystem\Search Results" 82 | mkdir %UserProfile%\Documents\fapelsystem\Fapsets 83 | 84 | 85 | 86 | :donotcreatedirs 87 | 88 | pause 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | goto:eof 98 | 99 | 100 | 101 | :link_module 102 | copy "%INSTALLDIR%\%~1" "%INSTALLDIR%\%~1w" 103 | create_shortcut_windows.vbs "%SENDTODIR%\%~2w.lnk" "%INSTALLDIR%\%~1w" 104 | exit /B 105 | 106 | :link_counter 107 | copy "%INSTALLDIR%\fapel_counter.py" "%INSTALLDIR%\fapel_counter_%~1.pyw" 108 | create_shortcut_windows.vbs "%SENDTODIR%\%~2w.lnk" "%INSTALLDIR%\fapel_counter_%~1.pyw" 109 | exit /B 110 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # Fapel-System - The Adult Media Organizer 2 | 3 | **Tag, Rate and Enjoy your porn collection!** 4 | 5 | :eggplant: :sweat_drops: :peach: :cherries: :movie_camera: :lollipop: :hotdog: :eggplant: :sweat_drops: :peach: :cherries: :movie_camera: :lollipop: :hotdog: 6 | 7 | With the fapel-system you can organize your **adult images and video collection** under Linux and Windows with standard folders. Everything works with hardlinks. 8 | 9 | The fapel-system was created and is optimized for adult-oriented images, videos and movies (Pornography / Porn / Pron). Fapel stands for "fap-able element" :-) If you are a passionate collector, this might be for you. 10 | 11 | ![](img/142.png) 12 | 13 | ![](img/27173524.png) 14 | 15 | ![](img/85201.png) 16 | 17 | ![](img/85202.png) 18 | 19 | ![](img/85208.png) 20 | 21 | ![](img/281.gif) 22 | 23 | > :eggplant: :sweat_drops: *Note: All sample images on this page are censored* 24 | 25 | --- 26 | 27 | # Start now! 28 | 29 | - [Installation](#installation) 30 | - [First steps!](#first-steps) 31 | - [Advanced features](#advanced-features) 32 | - [Technical stuff](#technical-stuff) 33 | 34 | --- 35 | 36 | # Comparison with other Systems 37 | advantages over database based systems 38 | 39 | * works with every file type, jpg, gif, mov, mp4,... 40 | * respects **your** privacy! No database, no server connection -- just your files! Dedicated to [Ancilla Tilia](https://en.wikipedia.org/wiki/Ancilla_van_de_Leest), former fetish model and privacy activist. 41 | * backup compatible 42 | * Survives itself (software not needed to browse categories, since these are normal folders) 43 | * perfectly integrated into linux 44 | * files can be renamed and moved (on the same drive) in any other program without problem 45 | * everything is mouse only (one hand) 46 | * fixed positions of tag buttons in the GUI, so you remember them by their location 47 | * delete hardlinks without consequences 48 | 49 | 50 | # Requirements 51 | 52 | * Ubuntu Linux or Windows 10 53 | * all other linux systems might require you to install by hand 54 | * Ubuntu with Nautilus file manager (should be standard) 55 | * Windows 11 was not tested 56 | * Python 3 with tkinter 57 | * all folders and fapels must be on one logical drive because everything works with hardlinks 58 | * On Windows this needs to be an NTFS drive (Should be standard for internal drives). It does not work on external drives formatted with ExtFAT / FAT32! 59 | 60 | You can check your drive properties if it is formatted with NTFS (the drive you have your media on): 61 | 62 | ![](img/85207.png) 63 | 64 | --- 65 | 66 | # Installation 67 | 68 | 69 | ## Ubuntu Linux Installation 70 | 71 | > :eggplant: :sweat_drops: *You can uninstall the previous version with the `uninstall_release_0_1_0alpha.sh` script.* 72 | 73 | 74 | ### 1. Clone or download this repo 75 | 76 | Yes, clone or download this repo now! 77 | 78 | ### 2. Install python tkinter and pillow 79 | 80 | `sudo apt-get install python3-tk python3-pil.imagetk` 81 | 82 | ### 3. Install fapelsystem via pip and install shortcuts and Tag dir 83 | 84 | In the repo's root run 85 | 86 | `chmod +x install_ubuntu.sh` 87 | 88 | `./install_ubuntu.sh` 89 | 90 | It installs fapelsystem via Python's PIP, creates the shortcuts in nautilus and if you want a basic tag directory structure. 91 | 92 | > :cherries: *Do not run the install_ubuntu.sh as root (sudo), as it would create config files for root user and not for you* 93 | 94 | > :eggplant: :sweat_drops: *If you are new then let the fapelsystem create the dirs (`y`). Otherwise you have to change the config file yourself (NOT recommended for new users!)* 95 | 96 | ### 4. Optional: Edit Config File to set up your own directories 97 | 98 | Edit the config file 99 | 100 | `~/.config/fapel_system.conf` 101 | 102 | to use the directories you want. 103 | 104 | 105 | ## Windows Installation 106 | 107 | 108 | ### 1. Clone or download this repo 109 | 110 | Yes, clone or download this repo now! 111 | 112 | ### 2. Install Python 113 | 114 | Download and install Python 3 115 | 116 | [https://www.python.org/downloads/windows/](https://www.python.org/downloads/windows/) 117 | 118 | ### 3. Install fapelsystem via pip and install shortcuts and Tag dir 119 | 120 | Start (doubleclick) `install_windows.bat` 121 | 122 | It installs fapelsystem via Python's PIP, creates the shortcuts in Explorer's "Send to" menu and if you want a basic tag directory structure. 123 | 124 | > :eggplant: :sweat_drops: *If you are new then let the fapelsystem create the dirs (`y`). Otherwise you have to change the config file yourself (NOT recommended for new users!)* 125 | 126 | ### 4. Optional: Edit Config File to set up your own directories 127 | 128 | Edit the config file 129 | 130 | `[YOUR HOME DIRECTORY]\AppData\Roaming\Fapelsystem\fapel_system.conf` 131 | 132 | to use the directories you want. 133 | 134 | 135 | --- 136 | 137 | # First steps! 138 | 139 | ## Starting fapel_tagger 140 | 141 | 142 | Now go to the media you like and start tagging! 143 | 144 | I have this collection of images of Jordan Carver, let's add some tags! 145 | 146 | Rightclick to start the tagger 147 | 148 | ![](img/001.png) 149 | 150 | Under Windows you find the tagger in the Send to submenu: 151 | 152 | ![](img/85201.png) 153 | 154 | 155 | This is the fapel_tagger! It presents all tags for you as buttons you can press to select or deselect a tag! 156 | 157 | ![](img/002.png) 158 | 159 | There are almost no buttons... We are missing Tags! Let's create some! 160 | 161 | 162 | ## Create Tags 163 | 164 | Go to 165 | 166 | `~/fapelsystem/Tags/` 167 | 168 | On Windows you find this folder in your home directory under documents. 169 | 170 | And now just create directories and nested directories as you like! These are your Tags! 171 | 172 | You can also delete directories (delete Tags) as you like. 173 | 174 | ## Add Tags to media 175 | 176 | 177 | Back to the images, rightclick and start the fapel-tagger. 178 | 179 | It will now automatically have all the tags you created (as directories). I have created a few: 180 | 181 | ![](img/003.png) 182 | 183 | Click the buttons, they will turn red. Red tags are selected. 184 | 185 | Click Apply Button 186 | 187 | The image is now tagged! 188 | 189 | ## Browse Media in Tags 190 | 191 | Go to the Tag folder, in my example 192 | 193 | `~/fapelsystem/Tags/Models/All purpose/Jordan Carver/` 194 | 195 | ![](img/004.png) 196 | 197 | There it is! The image was automatically hard-linked into the Tag folder! 198 | 199 | ## Tag multiple files 200 | 201 | 202 | Of course you can tag more than one file in the go. 203 | 204 | Just start the tagger with more files: 205 | 206 | ![](img/005.png) 207 | 208 | Here the tagger noticed that one file is already tagged (the buttons are blue). Let's add all the other files to the tags except tag "Beauty": 209 | 210 | ![](img/006.png) 211 | 212 | 213 | ## Add a fav to a file ("notice a file") 214 | 215 | Browsing through my collection, this shiny red image caught my attention: 216 | 217 | ![](img/007.png) 218 | 219 | Rightclicking and running the fapel-notice script! 220 | 221 | ![](img/008.png) 222 | 223 | This adds the image to the "notice dir": 224 | 225 | ![](img/009.png) 226 | 227 | Which as you can see ("0001" sub dir) remembers how often I started the "notice script" on the image! 228 | 229 | The image will automatically move the numbered folders up! 230 | 231 | Running notice script again: 232 | 233 | ![](img/010.png) 234 | 235 | ![](img/011.png) 236 | 237 | Now it is in the sub folder "0002". 238 | 239 | ## "Enjoy" a media file 240 | 241 | So, notice script counts "events" you noticed some file. The same is true for the "ct" script, except it's purpose is to count how many times you "enjoyed" a file ;-) 242 | 243 | > :eggplant: :sweat_drops: *Note: Ct stands for "C.m to", not count, not computer tomography* :smirk: 244 | 245 | Oh this beach wear image... 246 | 247 | ![](img/013.png) 248 | 249 | So clean the mouse and run the ct script! 250 | 251 | ![](img/014.png) 252 | 253 | Now run the tagger and see that the ct - counting directory is also present (Ct/Ct/0001)! 254 | 255 | ![](img/015.png) 256 | 257 | 258 | This is important to know: 259 | 260 | * The ct directory is inside the /Tags folder, the /Notice directory is outside. So you only see the ct hardlinked media! 261 | * BUT You only see the ct and numbered dirs when a file was tagged! This is to prevent cluttering the tag button gui. 262 | 263 | 264 | > :peach: *Tip: If you want to see all buttons, press the button in the bottom left corner!* 265 | 266 | 267 | # Advanced features 268 | 269 | ## Remember today's favorites 270 | 271 | ![](img/85203.png) 272 | 273 | Maybe I find some pictures worth a second, condensed visit for today. 274 | Or I want to collect some pictures for today's "enjoyment". 275 | 276 | You can collect pictures in a separate directory, which is auto generated based on today's date. 277 | 278 | So let's assume it's 2022-01-01 and pick some images: 279 | 280 | This one 281 | 282 | ![](img/201.png) 283 | 284 | and this one 285 | 286 | ![](img/202.png) 287 | 288 | both times I use the "fapel fap set" script. 289 | 290 | And I add some more pics. 291 | 292 | This creates a folder based on today's date (here 2022-01-01) and puts the images into that folder: 293 | 294 | ![](img/203.png) 295 | 296 | There I can get to my today's favorites! 297 | 298 | Nice feature: The "roll over" to the next day and thus the next folder happens not at 0:00 midnight but at 4:00 AM. You can configure that in the config file. 299 | 300 | 301 | ## Filter Tag Library to focus on topics 302 | 303 | > :cherries: *This feature is currently not available under Windows* 304 | 305 | > :peach: *Only tested with nautilus* 306 | 307 | 308 | Sometimes you may do not want to see certain pictures or videos in your /Tags folder: 309 | 310 | - My most favorable images may draw to much attention on them and I miss out other great images. 311 | 312 | - I may not be in the mood for kinky stuff and do not want to see this part of my collection right now. 313 | 314 | - I may just have enjoyed tentacle pron and now regret it and do not want to see it (temporarly... of course :smirk: ) 315 | 316 | 317 | The problem with these images is that they distract me by directing all the attention onto them. 318 | 319 | The Filter system does theirfore not filter **on** specific media but filters **out** specific media. 320 | It puts media into "exiles", these are here called "fapxiles". 321 | 322 | You can define which media belongs to which fapxile. 323 | 324 | 325 | > :peach: *Technically the filter is realized by dynamically creating .hidden files in all Tag folders. !!* 326 | 327 | 328 | > :peach: *You have to switch "Show Hidden Files" off in your file manager, of course.* 329 | 330 | 331 | Some examples: 332 | 333 | ### Filter Models 334 | Within my /Material/Latex tag I also have some images of Princess Fatale. I really like these pictures and now they (she) distracts me (I want to open her pictures first). 335 | 336 | ![](img/763826432.png) 337 | 338 | 339 | Luckily I have tagged the images of Princess Fatale, so she has a separate Folder within the /Models Tag: 340 | 341 | 342 | ![](img/3298424.png) 343 | 344 | 345 | In this folder I create a hidden file named ".fapxile" with the content: 346 | 347 | 348 | `[fapxileForThisTag]` 349 | 350 | `[fapxileForFapelsOfThisTag]` 351 | 352 | `Princess Fatale` 353 | 354 | 355 | `[fapxileForSubTagsAndSubFapels]` 356 | 357 | `Princess Fatale` 358 | 359 | `[excludedSubTags]` 360 | 361 | > :peach: *Pro tip: the git folder ./fapelsystem contains a template of this file called fapxile_file_template* 362 | 363 | 364 | 365 | Now I start fapxile exile script... 366 | 367 | > :peach: *You do not need to select a specific image and you can start this script everywhere.* 368 | 369 | ![](img/432432.png) 370 | 371 | ![](img/4837312.png) 372 | 373 | ...and switch "Princess Fatale" to "hidden" and hit Apply. 374 | 375 | ![](img/99787312.png) 376 | 377 | 378 | 379 | After pressing F5 in the file manager, I do not see her pictures in the /Material/Latex Tag folder anymore. 380 | 381 | ![](img/8824314.png) 382 | 383 | 384 | ### Filter most favorable fapels 385 | 386 | Pictures I "enjoyed a lot" may be distracting because I see them first and not other good pictures near them. 387 | 388 | I obviously enjoyed this red catsuit image of Lucy 0004 times. 389 | 390 | It is also present in the /Material/Latex Tag and I want to focus on all the other good images. 391 | 392 | ![](img/99078327.png) 393 | 394 | When I activate the "ct" exile (which is preconfigured when you installed the fapel system with an inital tag folder), then all the media that is tagged with 0002 and more will be hidden. 395 | 396 | 397 | ![](img/8732243.png) 398 | 399 | Now this image and all the other media I enjoyed more than once is hidden: 400 | 401 | ![](img/8328253.png) 402 | 403 | 404 | 405 | 406 | ### Show all fapels 407 | 408 | If you want to see all media files again, you can switch off all fapxiles at once using the Show all Button in the left corner: 409 | 410 | ![](img/73982.png) 411 | 412 | With this you will reset the selected fapxiles. 413 | 414 | If you just want to quick check the hidden fapels without messing with your selected fapxiles, you can select *show hidden files* in the file manager's options menu: 415 | 416 | ![](img/8726632.png) 417 | 418 | ![](img/98626723.png) 419 | 420 | 421 | ## Search and filter tagged or untagged media 422 | 423 | How to find out which images in this folder are tagged? 424 | 425 | ![](img/211.png) 426 | 427 | I go one folder up and run the "search tagged" script on the folder: 428 | 429 | ![](img/212.png) 430 | 431 | This creates a search folder based on current date and time (in this example it's 2022-01-01 12:34:56) and hardlinks all tagged media into it: 432 | 433 | ![](img/213.png) 434 | 435 | (Of course, the not-tagged script does the exact opposite ;-) ) 436 | 437 | ![](img/85204.png) 438 | 439 | ![](img/85205.png) 440 | 441 | ## Search tagged source file 442 | 443 | > :cherries: *This feature is currently not available under Windows* 444 | 445 | All images within the /Tags folder are just hardlinks of your original images somewhere in your collection. 446 | 447 | Sometimes you want to find the original image / file. 448 | 449 | I obviously like this image of Jordan but I know there are more of her somewhere. I select her image and start the fapel-search-source-file script: 450 | 451 | ![](img/829732.png) 452 | 453 | The script warns me that it will take a while. 454 | 455 | This is because the fapel system is *not* a database and the script just starts a search using the linux commandline tool "find". 456 | 457 | ![](img/8383672.png) 458 | 459 | Select the base / root folder of you search. Normally this is the base folder of your collection. 460 | 461 | ![](img/6262673.png) 462 | 463 | 464 | The search did finish and opened up for me a new folder containing *soft*-links to all found images. 465 | 466 | ![](img/88264267.png) 467 | 468 | Number 0_ is always the original image I started the search from. So I select the 1_ image and start the open-softlink-folder script: 469 | 470 | ![](img/987762.png) 471 | 472 | This script opens the folder with the image I searched and now I have found all the other pictures I was looking for! 473 | 474 | ![](img/132462.png) 475 | 476 | 477 | 478 | 479 | 480 | ## Rank your pictures 481 | 482 | With the fapel_elo you can rank your images and decide which one is better (as in chess's ELO rating ;-) ) 483 | 484 | ![](img/270.png) 485 | 486 | ![](img/85206.png) 487 | 488 | *(Again, bear in mind that the images on this page are censored -- of course normally you would see your images as you know them :-) )* 489 | 490 | The GUI is quite simple: Two images from your Tags folder are presented at random. 491 | 492 | While hoovering over the window: 493 | 494 | - Press the left mouse button to favor the left image 495 | - Press the right mouse button to favor the right image 496 | 497 | > :eggplant: :sweat_drops: *Note: If you prefer to click on the images with your left mouse button only, press the "Mouse Mode" button to toggle the mouse behaviour. You then of course have to click on the winning image.* 498 | 499 | ![](img/281.gif) 500 | 501 | To prevent accidential ranking you have to press the button 3 times. The *other* image will consequently dim until a new set of images is presented. 502 | 503 | Your images are ranked in the elo folder (normally ~/fapelsystem/Elo/ ) by name (ascending numbering), so lowest number is the best! 504 | 505 | ### Example 506 | 507 | In this example we have the elo program opened and the elo directory in the background. 508 | 509 | Let's favorite the right image, which is currently lower ranked in the directory as the left image: 510 | 511 | ![](img/278.png) 512 | 513 | After clicking right to favor the right image, the left image starts to turn dark. 514 | 515 | ![](img/279.png) 516 | 517 | Now the former right image moved *before* the former left image in the directory. A new set of images is displayed to be ranked by you! 518 | 519 | ![](img/280.png) 520 | 521 | --- 522 | 523 | # TagPacks 524 | 525 | > :cherries: *This feature is currently not available under Windows* 526 | 527 | You can install additionally Tags by using TagPacks. 528 | TagPacks are basically CSV Table files containing which dirs should be created. 529 | 530 | Use the fapelsystem_tagPackInstall tool 531 | 532 | Preview a tagPack file with `-s`, example: 533 | 534 | `fapelsystem_tagPackInstall -s tagPack_Models_20220704a.csv` 535 | 536 | Install it with (example): 537 | 538 | `fapelsystem_tagPackInstall tagPack_Models_20220704a.csv` 539 | 540 | 541 | These are some additional TagPacks: 542 | 543 | > :eggplant: :sweat_drops: *Note: My TagPacks are not hosted on github because of their adult content* 544 | 545 | ## TagPacks with Models 546 | 547 | 548 | ![](img/144.png) 549 | 550 | [Go to TagPack Download](http://fapel-system.epizy.com/) 551 | 552 | ![](img/143.png) 553 | 554 | [Go to TagPack Download](http://fapel-system.epizy.com/) 555 | 556 | ## Feelings TagPack 557 | 558 | ![](img/141.png) 559 | 560 | Category based on feelings. This TagPack installs additional counters (hard-c and justflow): 561 | 562 | ![](img/142.png) 563 | 564 | [Go to TagPack Download](http://fapel-system.epizy.com/) 565 | 566 | ## TagPack based on P.H. Categories 567 | 568 | Inspired by the video platform P.H. 569 | 570 | ![](img/145.png) 571 | 572 | [Go to TagPack Download](http://fapel-system.epizy.com/) 573 | 574 | 575 | ## Export Tags and create a TagPack file 576 | 577 | Run 578 | 579 | `fapelsystem_tagPackExport myTagPack.csv` 580 | 581 | to export your Tag names to provide them for others. 582 | 583 | You can edit the exported file using your favorite spreadsheet editor (Excel, Calc...). 584 | All names are hidden using rot13. Use `-c` to export all names in clear text. 585 | Use `-n` to add a NSFW flag to the file. 586 | 587 | --- 588 | 589 | # Technical stuff 590 | 591 | ## The config file 592 | 593 | You find the config file under 594 | 595 | `~/.config/fapel_system.conf` 596 | 597 | 598 | ## GUI configuration 599 | 600 | You can adjust the GUI with different config file settings. 601 | 602 | ### More Tags on Screen 603 | 604 | If you have a lot of tags, you can make room for more tags on the screen. Change these two settings: 605 | 606 | Increase the number of buttons per column: 607 | 608 | `buttonsPerColumn=40` 609 | 610 | Decrease the font size (e.g. 9 instead of 10): 611 | `tagFontSize=9` 612 | 613 | ### Colors 614 | 615 | Under the group `[colors]` you can adjust the GUI colors to your favorite ones! 616 | 617 | ## How files are organized in folders 618 | 619 | Files are organizes in special folders, that are configured in the conf file. 620 | 621 | All folder definitions in the config file must be absolut (starting from `/` or `~`). 622 | 623 | ### Fixed mandatory folders 624 | 625 | | config group | config key| content of directory | 626 | |--------------|-----------|----------------------------------------------------------------------| 627 | |[dirs]| tagDir | Parent directory with Tags (directories) and media files | 628 | |[dirs]|recycledDir|files you removed all tags from are placed in this "trash" folder| 629 | |[dirs]|eloDir|Folder for the ranking system| 630 | |[dirs]|searchResultDir|All searches are placed here with individual timestamp directories| 631 | |[dirs]|fapsetDir|All sets of your today's favorites are placed here| 632 | 633 | ### Folders for counters 634 | 635 | You can create as many counters as you like. They are individually called via a specifically named softlink to the script. 636 | 637 | The softlink must point to 638 | 639 | `[installdir]/fapel_counter.py` 640 | 641 | > :eggplant: :sweat_drops: *Run `fapelsystem_printModuleDir` to print out the install dir on console.* 642 | 643 | The name of the softlink must *end* with a key for the specific counter ("COUNTERID") 644 | 645 | `Whatever_you-want_COUNTERID.py` 646 | 647 | The key to your counter ist the `COUNTERID` (the last word preceeded by the last "`_`" or "`-`") 648 | 649 | This key must then be present in the config file: 650 | 651 | | config group | config key| content of directory | 652 | |--------------|-----------|----------------------------------------------------------------------| 653 | |[countersDirs]| COUNTERID | Parent directory of counter COUNTERID | 654 | 655 | 656 | ## Tag directory dot files 657 | 658 | Behaviour of the tagger for a Tag is controlled via (hidden) dot files. 659 | All files are optional. 660 | 661 | 662 | ### .taginfo 663 | 664 | The .taginfo file contains a tooltip that is shown in the fapel-tagger when you hoover over a button. 665 | 666 | Its content is built like a config file an looks like 667 | 668 | `[general]` 669 | 670 | `tooltip=The tip text` 671 | 672 | ### .exclude_subdirs 673 | 674 | If `.exclude_subdirs` is encountered, all subdirectories are not parsed for additional Tags and fapels / media files. 675 | The file should be empty. 676 | 677 | #### Example 678 | 679 | You want to place a lot of images of a model inside the corresponding tag directory without parsing all these subdirectories. 680 | To hide all the numbered "Set" dirs: 681 | 682 | `/Tags/Models/Latex/Bianca Beauchamp/Set 001/` 683 | 684 | `/Tags/Models/Latex/Bianca Beauchamp/Set 002/` 685 | 686 | `...` 687 | 688 | `/Tags/Models/Latex/Bianca Beauchamp/Set 245/` 689 | 690 | we place a `.exclude_subdirs` file into the Bianca Beauchamp folder 691 | 692 | 693 | ### .hide-button 694 | 695 | A Tag (a directory) with `.hide-button` in it will not show up as a button in the fapel-tagger unless you press the show all button. 696 | It will still be visible in the finder. 697 | 698 | 699 | #### Example 700 | 701 | You have a directory that contains Tags describing different clothing materials: 702 | 703 | 704 | `/Tags/Material/Latex` 705 | 706 | `/Tags/Material/Leather` 707 | 708 | `/Tags/Material/PVC` 709 | 710 | `...` 711 | 712 | `/Tags/Material/Spandex` 713 | 714 | 715 | You want to have the material itself as buttons ("Material/Latex", "Material/PVC") but not the Tag "Material" itself. 716 | Place an empty file named ".hide_button" in the `/Tags/Material` folder. 717 | 718 | You still can use the Tag "Material" when you use the finder and the Tag shows as a button when it is assigned to a file which is currently opened in the fapel tagger. 719 | 720 | 721 | ### .hide-child-buttons 722 | 723 | If `.hide-child-buttons` is encountered, no buttons for all subdirectories (so, sub-tags) are shown unless you press the show all button. 724 | They are still visible in the finder. 725 | 726 | #### Example 727 | 728 | You have a counter dir: 729 | 730 | 731 | `/Tags/Videos/Watched completly/` 732 | 733 | with it's automated subdirectories you count how often you completly watched a video: 734 | 735 | 736 | `/Tags/Videos/Watched completly/0001` 737 | 738 | `/Tags/Videos/Watched completly/0002` 739 | 740 | `...` 741 | 742 | `/Tags/Videos/Watched completly/0007` 743 | 744 | Place an empty file named ".hide-child-buttons" in the `/Tags/Videos/Watched completly` folder. 745 | If you also want to hide the `Watched completly` folder by itself, just *also* place an empty file named ".hide_button" in it, too. 746 | 747 | # Changelog 748 | 749 | ## Release v0.2.1-alpha 750 | 751 | ### Added 752 | 753 | - fapel_elo now appends lower ranked new pictures at the end of the Elo ranking 754 | 755 | ### Fixed 756 | 757 | - setup.py now requires specific versions of modules 758 | 759 | ## Release April 2023 v0.2.0-alpha 760 | 761 | ### Added 762 | 763 | - Support for Windows including a batch-file based installer 764 | 765 | ### Changed 766 | 767 | - fapel system program files are now installed locally via PIP 768 | 769 | - installer for Ubuntu Linux was changed accordingly 770 | 771 | 772 | ## Release November 2022 v0.1.0-alpha 773 | 774 | ### Added 775 | 776 | - fapel_exiles.py Show and hide media based on mood or topic 777 | 778 | - fapel_search_source_file.py Searchs for the original hardlinked media in your library. 779 | 780 | - openLink.sh opens up the directory of a soft linked file 781 | 782 | - tagPackInstall.py now asks if a counter should be installed 783 | 784 | 785 | ### Fixed 786 | 787 | - install.sh now installs fapel_elo.py 788 | 789 | ### Security 790 | 791 | - tagPackInstall.py now cannot leave the destination directory via /../ paths in a malicious tag pack file 792 | 793 | # Remarks 794 | remember that hardlinks do point to the same binary data of a file, altering it in one place alters it everywhere! 795 | 796 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | 3 | setup(name='fapelsystem', 4 | version='0.2.1-alpha', 5 | description='The fapel system organizes image and video collections', 6 | url='https://github.com/pronopython/fapel-system', 7 | author='pronopython', 8 | author_email='pronopython@proton.me', 9 | license='GNU GENERAL PUBLIC LICENSE V3', 10 | packages=['fapelsystem'], 11 | package_data={'fapelsystem':['*']}, 12 | include_package_data=True, 13 | zip_safe=False, 14 | install_requires=['Pillow>=9.0.1'], 15 | entry_points={ 16 | 'console_scripts': [ 17 | 'fapelsystem_printModuleDir=fapelsystem.print_module_dir:printModuleDir', 18 | 'fapelsystem_tagPackInstall=fapelsystem.tagPackInstall:main', 19 | 'fapelsystem_tagPackExport=fapelsystem.tagPackExport:main', 20 | ] 21 | } 22 | ) 23 | 24 | -------------------------------------------------------------------------------- /uninstall_release_0_1_0alpha.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | ############################################################################################## 4 | # 5 | # The fapel system organizes image and video collections under Linux with standard folders. 6 | # install.sh is the installer script to copy all py files and create nautilus shortcuts 7 | # 8 | # For updates see git-repo at 9 | #https://github.com/pronopython/fapel-system 10 | # 11 | ############################################################################################## 12 | # 13 | INSTALLDIR=/opt/fapelsystem 14 | CONFIGDIR=~/.config 15 | NAUTILUSSCRIPTDIR=~/.local/share/nautilus/scripts 16 | # 17 | ############################################################################################## 18 | # 19 | # Copyright (C) 2022 PronoPython 20 | # 21 | # Contact me at pronopython@proton.me 22 | # 23 | # This program is free software: you can redistribute it and/or modify it 24 | # under the terms of the GNU General Public License as published by the 25 | # Free Software Foundation, either version 3 of the License, or 26 | # (at your option) any later version. 27 | # 28 | # This program is distributed in the hope that it will be useful, 29 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 30 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 31 | # GNU General Public License for more details. 32 | # 33 | # You should have received a copy of the GNU General Public License 34 | # along with this program. If not, see . 35 | # 36 | ############################################################################################## 37 | # 38 | 39 | echo "This will uninstall all program files of the fapelsystem version 0.1.0-alpha" 40 | echo "The following files will be deleted:" 41 | echo " - all files under /opt/fapelsystem (=all program files)" 42 | echo " - all script links under Nautilus right click menu" 43 | echo "" 44 | echo "Media files, Tags or config files will NOT be deleted, but use at your own risk." 45 | echo "Sudo is needed to delete these files." 46 | echo "" 47 | 48 | while true; do 49 | 50 | read -p "Delete fapelsystem program files and script links? (y/n) " yn 51 | 52 | case $yn in 53 | [yY] ) sudo rm -r /opt/fapelsystem; 54 | sudo rm $NAUTILUSSCRIPTDIR/*fapel*.py 55 | sudo rm $NAUTILUSSCRIPTDIR/*open-softlink*.sh 56 | break;; 57 | 58 | [nN] ) break;; 59 | 60 | * ) echo invalid response;; 61 | esac 62 | 63 | done 64 | 65 | --------------------------------------------------------------------------------