diff options
| -rw-r--r-- | main.lua | 39 | 
1 files changed, 29 insertions, 10 deletions
| @@ -540,15 +540,29 @@ local function add_programme(opt, time)  	end  end -local function count_group_children(group) +local function group_count(group)  	if group.children and not group.lazy then -		return tostring(#group.children) +		local count = 0 +		for _, v in ipairs(group.children) do +			if v.type == 'stream' or v.group_type == 'series' then +				count = count + 1 +			elseif v.type == 'group' then +				local c = group_count(v) +				if c then +					count = count + c +				end +			end +		end +		return count  	elseif group.id == 'favourites' then -		local c = 0 -		for _ in pairs(favourites) do -			c = c + 1 +		-- count number of favourited items, not recursive +		local count = 0 +		for k in pairs(favourites) do +			if k ~= 'oi' then +				count = count + 1 +			end  		end -		return tostring(c - 1) -- remove dummy value +		return count  	end  end @@ -568,9 +582,9 @@ local function favourites_group_menu_options(group)  			obj = copy_table(obj)  			add_programme(obj, time) -			local c = count_group_children(obj) +			local c = group_count(obj)  			if c then -				obj.info = c +				obj.info = tostring(c)  			end  			if #path > 0 and curr.parent_id == 'root' then  				reverse(path) @@ -624,12 +638,17 @@ local function series_group_menu_options(series)  			end  		end +		local count = tostring(#episodes) +		if season.episode_count then +			count = count .. '/' .. season.episode_count +		end  		seasons[#seasons+1] = {  			type='group',  			group_type='season',  			id=series.section .. 'series:season:' .. season.id,  			children=episodes,  			name=strip(season.name), +			info=count,  		}  	end @@ -650,9 +669,9 @@ local function group_menu_options(group)  	for i, v in ipairs(group.children) do  		v = copy_table(v)  		add_programme(v, time) -		local c = count_group_children(v) +		local c = group_count(v)  		if c then -			v.info = c +			v.info = tostring(c)  		end  		options[i] = v  	end | 
