def __init__(self):
     menu = resources.lib.menu.Menu()
     menu.add_sort_method("none")
     for team in self._teams:
         if "disabled" in team:
             menu.add_item(
                 url_params={"team": team["short"]},
                 name=team["long"],
                 folder=False,
                 thumbnail="resources/images/%s.png" % team["short"]
             )
         else:
             menu.add_item(
                 url_params={"team": team["short"]},
                 name=team["long"],
                 folder=True,
                 thumbnail="resources/images/%s.png" % team["short"]
             )
     menu.end_directory()
    def list_categories(self):
        menu = resources.lib.menu.Menu()
        menu.add_sort_method("none")
        menu.add_item(
            url_params={"team": self._short, "category": "all"},
            name="All Videos",
            folder=True,
            thumbnail="resources/images/%s.png" % self._short
        )
        for category in self._categories:
            for strip_left in self._categories_strip_left:
                if category.startswith(strip_left):
                    category = category[(len(strip_left)):]

            menu.add_item(
                url_params={"team": self._short, "category": category},
                name=category,
                folder=True,
                thumbnail="resources/images/%s.png" % self._short
            )
        menu.end_directory()
    def list_videos(self):
        if self._parameters["category"][0] == "all":
            parameters = {"type": "VIDEO", "channelKey": ""}
        else:
            parameters = {"type": "VIDEO", "channelKey": self._parameters["category"][0]}

        data = urllib.urlencode(parameters)
        request = urllib2.Request(self._cdaweb_url + "audio-video-channel.htm", data)
        response = urllib2.urlopen(request)
        json = simplejson.load(response, "iso-8859-1")

        menu = resources.lib.menu.Menu()
        menu.add_sort_method("none")
        menu.add_sort_method("alpha")
        for video in json["gallery"]["clips"]:
            menu.add_item(
                url_params={"team": self._short, "id": video["id"]},
                name=video["title"],
                folder=False,
                thumbnail=video["thumb"]
            )
        menu.end_directory()