Skip to content

Commit

Permalink
Added: Keep track of the current parser.
Browse files Browse the repository at this point in the history
  • Loading branch information
basrieter committed Oct 25, 2023
1 parent 22fbfe7 commit ab55063
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions resources/lib/chn_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later

import urllib.parse as parse
from typing import Optional

from resources.lib.mediaitem import MediaItem, FolderItem, MediaStream
from resources.lib import contenttype
Expand Down Expand Up @@ -40,6 +41,7 @@ def __init__(self, channel_info):

# noinspection PyTypeChecker
self.parentItem = None # type: MediaItem
self.currentParser = None # type: Optional[ParserData]

# More and more API's need a specific set of headers. This set is used for the self.mainListUri, and is set to
# all items generated by the chn_class.py.
Expand Down Expand Up @@ -217,6 +219,7 @@ def process_folder_list(self, item=None): # NOSONAR

for data_parser in pre_procs:
# remove it from the list
self.currentParser = data_parser
data_parsers.remove(data_parser)

# and process it
Expand All @@ -236,6 +239,7 @@ def process_folder_list(self, item=None): # NOSONAR
handler_json = None
for data_parser in data_parsers:
Logger.debug("[DataParsers] Processing %s", data_parser)
self.currentParser = data_parser

# Check for preprocessors
if data_parser.PreProcessor:
Expand Down Expand Up @@ -319,9 +323,11 @@ def process_folder_list(self, item=None): # NOSONAR
"order that Python likes which might result in unexpected result.", num_post_procs)

for data_parser in generic_post_procs:
self.currentParser = data_parser
Logger.debug("[DataParsers] Post-processing Generic %s", data_parser)
items = data_parser.PostProcessor(data, items)
Logger.trace("Post-processing returned %d items", len(items))
self.currentParser = None

# should we exclude DRM/GEO?
hide_geo_locked = AddonSettings.hide_geo_locked_items_for_location(self.language)
Expand Down

0 comments on commit ab55063

Please sign in to comment.