solo-auswertung/src/solo_turnier/html_locator.py

25 lines
733 B
Python
Raw Normal View History

import os
import logging
class HtmlLocator:
def __init__(self):
self.l = logging.getLogger('solo_turnier.html_locator')
self.fileName = 'erg.htm'
def __findRecursivelyCandidates(self, path: str):
ret = []
ls = os.listdir(path)
if self.fileName in ls and os.path.isfile(os.path.join(path, self.fileName)):
ret.append(os.path.join(path, self.fileName))
for p in ls:
subPath = os.path.join(path, p)
if os.path.isdir(subPath):
ret = ret + self.__findRecursivelyCandidates(subPath)
return ret
def findCandidates(self, path: str):
return self.__findRecursivelyCandidates(path)