Skip to content

Commit

Permalink
fapel_elo now appends lower ranked new pictures at the end of the Elo…
Browse files Browse the repository at this point in the history
… ranking
  • Loading branch information
pronopython committed Apr 4, 2024
1 parent 6b9057a commit ea153bb
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 13 deletions.
1 change: 1 addition & 0 deletions fapelsystem/dir_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
33 changes: 27 additions & 6 deletions fapelsystem/fapel_elo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -350,24 +350,45 @@ 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):

# [no elo] wins over [no elo] -> only one time when no ranked fapel exists

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)
Expand Down
12 changes: 9 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 2 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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',
Expand All @@ -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',
Expand All @@ -21,5 +21,3 @@
}
)

#print("the exit is here")

0 comments on commit ea153bb

Please sign in to comment.