Exemplo n.º 1
0
    def list_categories(self):
        with Menu(["none"]) as menu:
            menu.add_item({
                "url_params": {
                    "team": self._short,
                    "category": "all"
                },
                "name":
                "All Videos",
                "folder":
                True,
                "thumbnail":
                path.join("resources", "images", "{0}.png".format(self._short))
            })
            for category in self._categories:
                raw_category = category

                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": raw_category
                    },
                    "name":
                    category,
                    "folder":
                    True,
                    "thumbnail":
                    path.join("resources", "images",
                              "{0}.png".format(self._short))
                })
Exemplo n.º 2
0
    def list_videos(self):
        if self._parameters["category"] == "all":
            parameters = {"type": "VIDEO", "channelKey": ""}
        else:
            parameters = {
                "type": "VIDEO",
                "channelKey": self._parameters["category"]
            }

        response = requests.get("{0}audio-video-channel.htm".format(
            self._cdaweb_url),
                                params=parameters)
        data = response.json()

        with Menu(["date", "alpha"]) as menu:
            for video in data["gallery"]["clips"]:
                menu.add_item({
                    "url_params": {
                        "team": self._short,
                        "id": video["id"]
                    },
                    "name": video["title"],
                    "folder": False,
                    "thumbnail": video["thumb"],
                    "raw_metadata": video
                })
Exemplo n.º 3
0
    def list_videos(self):
        data = self._get_cached_response(
            "{0}/media/nflc-playlist-video.json".format(self._website_url))
        html_parser = HTMLParser()

        videos = list()
        if self._parameters["category"] == "all":
            for category in data.itervalues():
                videos.extend(category["data"])
        else:
            videos = data[str(self._parameters["category"])]["data"]

        with Menu(["none"]) as menu:
            for video in videos:
                menu.add_item({
                    "url_params": {
                        "team": self._short,
                        "id": video["video_id"]
                    },
                    "name":
                    html_parser.unescape(video["title"]),
                    "folder":
                    False,
                    "thumbnail":
                    "{0}{1}".format(self._website_url, video["thumbnail"]),
                    "raw_metadata":
                    video
                })
Exemplo n.º 4
0
 def list_categories(self):
     with Menu(["none"]) as menu:
         menu.add_item({
             "url_params": {
                 "team": self._short,
                 "category": "all"
             },
             "name":
             "[B]All Videos[/B]",
             "folder":
             True,
             "thumbnail":
             path.join("resources", "images", "{0}.png".format(self._short))
         })
         for category_id, category_name in self._categories:
             menu.add_item({
                 "url_params": {
                     "team": self._short,
                     "category": category_id
                 },
                 "name":
                 category_name,
                 "folder":
                 True,
                 "thumbnail":
                 path.join("resources", "images",
                           "{0}.png".format(self._short)),
             })
Exemplo n.º 5
0
 def __init__(self):
     with Menu(["none"]) as menu:
         for team in self._teams:
             menu.add_item({
                 "url_params": {"team": team["short"]},
                 "name": team["long"],
                 "folder": True,
                 "thumbnail": path.join("resources", "images", "{0}.png".format(team["short"]))
             })
Exemplo n.º 6
0
    def list_videos(self):
        parameters = {"type": "VIDEO", "channelKey": self._parameters["category"]}

        response = requests.get("{0}/media/nflc-playlist-video.json".format(self._website_url))
        data = response.json()
        html_parser = HTMLParser()

        with Menu(["none"]) as menu:
            for video in data[str(self._parameters["category"])]["data"]:
                menu.add_item({
                    "url_params": {"team": self._short, "id": video["video_id"]},
                    "name": html_parser.unescape(video["title"]),
                    "folder": False,
                    "thumbnail": "{0}{1}".format(self._website_url, video["thumbnail"]),
                })