vtuner pages: always calculate element count

This commit is contained in:
milaq 2019-08-12 14:59:51 +02:00
parent bfa203d160
commit 4fb591a18b
2 changed files with 2 additions and 6 deletions

View file

@ -48,7 +48,6 @@ def get_directories_page(subdir, directories, startitems, enditems):
if len(directories) == 0:
page.add(vtuner.Display("No entries found."))
return page
page.set_count(len(directories))
offset = 0
limit = len(directories)
if startitems and enditems:
@ -69,7 +68,6 @@ def get_stations_page(stations, startitems, enditems):
if len(stations) == 0:
page.add(vtuner.Display("No stations found."))
return page
page.set_count(len(stations))
offset = 0
limit = len(stations)
if startitems and enditems:

View file

@ -16,13 +16,11 @@ def strip_https(url):
class Page:
def __init__(self):
self.items = []
self.count = -1
self.count = 0
def add(self, item):
self.items.append(item)
def set_count(self, count):
self.count = count
self.count = len(self.items)
def to_xml(self):
xml = etree.Element('ListOfItems')