diff --git a/fapelsystem/dir_helper.py b/fapelsystem/dir_helper.py index dd9525c..c18e6d6 100755 --- a/fapelsystem/dir_helper.py +++ b/fapelsystem/dir_helper.py @@ -50,6 +50,7 @@ def getFilenameWithoutExtension(pathWithFullFilename): def getLastPartOfFilename(path): myName = getFilenameWithoutExtension(os.path.abspath(path)) + counterKey = myName # was unbound in v0.2.0-alpha last1 = myName.split('_')[-1] last2 = myName.split('-')[-1] if (last1 != myName) or (last2 != myName): diff --git a/fapelsystem/fapel_elo.py b/fapelsystem/fapel_elo.py index 2dae32e..e1660d6 100755 --- a/fapelsystem/fapel_elo.py +++ b/fapelsystem/fapel_elo.py @@ -191,7 +191,7 @@ class CurrentFapels: global MIN_ELO_RANK global MAX_ELO_RANK - PROBABILITY_TAKE_FROM_RANKED = 0.8 + PROBABILITY_TAKE_FROM_RANKED = 0.5 useBothMouseButtons = True clicksUntilChange = 3 @@ -350,8 +350,16 @@ def getFittingElo(self, fapelLooser): eloLeft = self.getEloRankedOneHigher(fapelLooser) if ((fapelLooser.elo - eloLeft) < 3): # still too close? print("elos to close together, too many elos, giving up... panic") - exit(); + exit() return random.randint(eloLeft + 1, fapelLooser.elo - 1) + + def getNewEndElo(self, lastFapel): + if ((MAX_ELO_RANK - lastFapel.elo) < 3): + self.defragmentAllElos() + if ((MAX_ELO_RANK - lastFapel.elo) < 3): # still too close? + print("elos to close together, too many elos, giving up... panic") + exit() + return random.randint(lastFapel.elo + 1, MAX_ELO_RANK - 1) def rankFapelWinnerLooser(self, fapelWinner, fapelLooser): @@ -359,15 +367,28 @@ def rankFapelWinnerLooser(self, fapelWinner, fapelLooser): if ((fapelWinner.elo == -1) and (fapelLooser.elo == -1)): print("First fapel ranked") - fapelWinner.elo = MAX_ELO_RANK + fapelWinner.elo = MIN_ELO_RANK + int((MAX_ELO_RANK - MIN_ELO_RANK) / 2) fapelWinner.updateElo() self.rankedFapels.append(fapelWinner) self.sortFapels() # [ELO] wins over [no elo] - elif ((fapelWinner.elo > -1) and (fapelLooser.elo == -1)): # TODO remove thisone - # nothing to do?! - xyz = 1 + elif ((fapelWinner.elo > -1) and (fapelLooser.elo == -1)): + self.sortFapels() + lastFapel = self.rankedFapels[-1] + secondLastElo = self.getFittingElo(lastFapel) + + + #fapelLooser.elo = lastFapel.elo + fapelLooser.elo = self.getNewEndElo(lastFapel) + lastFapel.elo = secondLastElo + lastFapel.updateElo() + fapelLooser.updateElo() + self.rankedFapels.append(fapelLooser) + self.sortFapels() + + + # [no elo] wins over [ELO] elif ((fapelWinner.elo == -1) and (fapelLooser.elo > -1)): newElo = self.getFittingElo(fapelLooser) diff --git a/readme.md b/readme.md index 4f8e45c..2665ef8 100755 --- a/readme.md +++ b/readme.md @@ -744,11 +744,17 @@ with it's automated subdirectories you count how often you completly watched a v Place an empty file named ".hide-child-buttons" in the `/Tags/Videos/Watched completly` folder. If you also want to hide the `Watched completly` folder by itself, just *also* place an empty file named ".hide_button" in it, too. -# There is more +# Changelog -... but this readme is not done yet... +## Release v0.2.1-alpha -# Changelog +### Added + +- fapel_elo now appends lower ranked new pictures at the end of the Elo ranking + +### Fixed + +- setup.py now requires specific versions of modules ## Release April 2023 v0.2.0-alpha diff --git a/setup.py b/setup.py index 0cfd0c2..2c8c2bd 100755 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from setuptools import setup setup(name='fapelsystem', - version='0.2.0-alpha', + version='0.2.1-alpha', description='The fapel system organizes image and video collections', url='https://github.com/pronopython/fapel-system', author='pronopython', @@ -11,7 +11,7 @@ package_data={'fapelsystem':['*']}, include_package_data=True, zip_safe=False, - install_requires=['Pillow'], + install_requires=['Pillow>=9.0.1'], entry_points={ 'console_scripts': [ 'fapelsystem_printModuleDir=fapelsystem.print_module_dir:printModuleDir', @@ -21,5 +21,3 @@ } ) -#print("the exit is here") -