Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

__version__ = "2.2"
__version__ = "2.3"
16 changes: 8 additions & 8 deletions src/forumparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
url = topicTitle.get("href", "")
setPostKey("threadId", url[url.find("?t=") + 3:url.rfind("&sid=")])
respShow = post.find("div", class_="responsive-show")
userName = respShow.get_text(strip=True)[19:] # "Letzter Beitrag von Testomat « 23 Okt 2025 16:26"
userName = respShow.get_text(strip=True)[19:] # "Letzter Beitrag von Testomat « 23 Okt 2025 16:26"
userName = userName[:userName.find("«")]
setPostKey("userName", userName)
setPostKey("latestLine", respShow, replacements=(["\t", "\n"]))
Expand All @@ -102,7 +102,7 @@
text = text.replace(replacement, "")
threadDict[key] = text

def convert2int(valueStr, fallbackInt=0):

Check warning on line 105 in src/forumparser.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this unused function declaration.

See more on https://sonarcloud.io/project/issues?id=openatv_enigma2-plugin-extensions-openatv-community-reader&issues=AZzsv_hR93q8aLTrx9RE&open=AZzsv_hR93q8aLTrx9RE&pullRequest=44
return int(valueStr) if valueStr.isdigit() else fallbackInt

if not threadUrl:
Expand All @@ -120,12 +120,12 @@
foundpos = titleLine.rfind("Seite")
threadTitle = titleLine[:foundpos - 3] if foundpos != -1 else titleLine
threadId = xml.find("input", {"name": "t", "type": "hidden"}).get("value")
button = xml.find("a", {"class": "button button-icon-only dropdown-trigger"})
if button:
pages = button.get_text().strip("Seite ").split(" von ")
currPage, maxPages = (convert2int(pages[0], 1), convert2int(pages[1], 1)) if pages and len(pages) > 1 else (1, 1)
else:
currPage, maxPages = 1, 1
pagination = xml.find("div", {"class": "pagination"}) # <div class="pagination"> 21 Beiträge <ul>
pagination = pagination.get_text().strip().split(" ")[0] if pagination else "1"
maxPages = ((int(pagination) - 1) // 20) + 1 if pagination.isdigit() else 1

Check warning on line 125 in src/forumparser.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename this local variable "maxPages" to match the regular expression ^[_a-z][a-z0-9_]*$.

See more on https://sonarcloud.io/project/issues?id=openatv_enigma2-plugin-extensions-openatv-community-reader&issues=AZzsv_hR93q8aLTrx9RD&open=AZzsv_hR93q8aLTrx9RD&pullRequest=44
active = xml.find("li", {"class": "active"}) # <li class="active"><span>11</span></li>
active = active.get_text() if active else "1"
currPage = int(active) if active.isdigit() else 1

Check warning on line 128 in src/forumparser.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename this local variable "currPage" to match the regular expression ^[_a-z][a-z0-9_]*$.

See more on https://sonarcloud.io/project/issues?id=openatv_enigma2-plugin-extensions-openatv-community-reader&issues=AZzsv_hR93q8aLTrx9RC&open=AZzsv_hR93q8aLTrx9RC&pullRequest=44
threadList, threadUser = [], []
for post in xml.find_all("div", {"class": compile("post has-profile bg(.*?)")}):
threadDict = {}
Expand Down Expand Up @@ -168,7 +168,7 @@
for replacement in replacements:
text = text.replace(replacement, "")
postDict[key] = text

postDict = {}
if postId:
url = f"{atvpglobals.BASEURL}/viewtopic.php?p={postId}#p{postId}"
else:
Expand Down
3 changes: 2 additions & 1 deletion src/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def downloadAvatar(self, url, filePath): # file extensions in url could be wron
print(f"[{self.MODULE_NAME}] ERROR in module 'downloadAvatar': {errMsg}!")
self.session.open(MessageBox, errMsg, MessageBox.TYPE_INFO, timeout=30, close_on_any_key=True)
fileParts = filePath.split(".")
if SUPPALLIMGS: # use function 'detectImageType' in OpenATV 7.6.0 or newer
if SUPPALLIMGS: # use new function 'detectImageType' in OpenATV 7.6.0 or newer
extension = {0: "png", 1: "jpg", 3: "gif", 4: "svg", 5: "webp"}.get(detectImageType(filePath), fileParts[1])
else: # use DEPRECATED function 'what' in OpenATV 7.5.1 or OpenATV 7.5.1 or older
extension = what(filePath).replace("jpeg", "jpg")
Expand Down Expand Up @@ -424,6 +424,7 @@ def handleIcon(self, widget, iconUrl, callback=None):
filePath = join(self.AVATARPATH, fileName) if fileName else join(self.AVATARPATH, "unknown.png")
if filePath and exists(filePath):
iconPix = LoadPixmap(cached=True, path=filePath)
self.showPic(widget, filePath)
elif callback:
callInThread(callback, widget, iconUrl, filePath)
return iconPix
Expand Down
Loading