Esempio n. 1
0
    def create_folder_item(self, result_set):
        """ Creates a MediaItem of type 'folder' using the result_set from the regex.

        This method creates a new MediaItem from the Regular Expression or Json
        results <result_set>. The method should be implemented by derived classes
        and are specific to the channel.

        :param list[str]|dict[str,str] result_set: The result_set of the self.episodeItemRegex

        :return: A new MediaItem of type 'folder'.
        :rtype: MediaItem|None

        """

        Logger.trace(result_set)

        if self.parentItem.url.endswith(str(DateHelper.this_year())):
            return None

        url = "%s%s" % (self.baseUrl, result_set[3])
        name = result_set[4]

        item = MediaItem(name.title(), url)

        day = result_set[0]
        month = result_set[1]
        month = DateHelper.get_month_from_name(month, "nl", short=False)
        year = result_set[2]

        item.set_date(year, month, day)
        item.complete = True
        return item
Esempio n. 2
0
    def create_video_item(self, result_set):
        """ Creates a MediaItem of type 'video' using the result_set from the regex.

        This method creates a new MediaItem from the Regular Expression or Json
        results <result_set>. The method should be implemented by derived classes
        and are specific to the channel.

        If the item is completely processed an no further data needs to be fetched
        the self.complete property should be set to True. If not set to True, the
        self.update_video_item method is called if the item is focussed or selected
        for playback.

        :param list[str]|dict result_set: The result_set of the self.episodeItemRegex

        :return: A new MediaItem of type 'video' or 'audio' (despite the method's name).
        :rtype: MediaItem|None

        """

        if "title" not in result_set or result_set["title"] is None:
            result_set["title"] = result_set.pop("subtitle")

        result_set["title"] = result_set["title"].strip()
        item = chn_class.Channel.create_video_item(self, result_set)
        if item is None:
            return None

        item.description = result_set.get("subtitle", None)
        if "day" in result_set and result_set["day"]:
            if len(result_set.get("year", "")) < 4:
                result_set["year"] = None
            item.set_date(result_set["year"] or DateHelper.this_year(),
                          result_set["month"], result_set["day"])

        if item.thumb.startswith("//"):
            item.thumb = "https:%s" % (item.thumb, )

        self.__hasAlreadyVideoItems = True
        item.fanart = self.parentItem.fanart
        return item