コード例 #1
0
 def getItem(self, url, action):
     return ListItem(
         self.title,
         buildUrl(url, action=action, playlistId=self.playlistId),
         isFolder=True,
         infos={"video": {
             "title": self.title,
             "plot": self.plot
         }},
         poster=self.thumbnail)
コード例 #2
0
def _makeItem(label, url, thumb=None, isFolder=True, **kwargs):
    label = localizedString(label)
    return ListItem(label,
                    buildUrl(url, **kwargs),
                    isFolder=isFolder,
                    isPlayable=False,
                    infos={"video": {
                        "title": label,
                        "plot": label
                    }},
                    poster=thumb)
コード例 #3
0
 def get(self, url, **kwargs):
     log("youtube.url: {}".format(buildUrl(url, **kwargs.get("params",
                                                             {}))))
     try:
         response = requests.get(url,
                                 headers=self.__headers__,
                                 timeout=(9.05, 30.0),
                                 **kwargs)
     except requests.Timeout as error:
         message = "youtube: {}".format(error)
         log(message, LOGERROR)
         notify(message, icon=ICONERROR)
     else:
         response.raise_for_status()
         return response.text
コード例 #4
0
 def getItem(self, url):
     return ListItem(
         self.query,
         buildUrl(url,
                  action="search",
                  type=self.type,
                  query=self.query,
                  sort_by=self.sort_by),
         isFolder=True,
         infos={"video": {
             "title": self.query,
             "plot": self.query
         }},
         contextMenus=self.menus(type=self.type,
                                 key=self.key,
                                 sort_by=self.sort_by),
         poster="DefaultAddonsSearch.png")
コード例 #5
0
 def getItem(self, url, **kwargs):
     if self.enabled:
         folder = __schema__[self.type][self.style]
         label = maybeLocalize(folder["label"])
         kwargs = dict(dict(folder.get("kwargs", {}), **self.kwargs),
                       **kwargs)
         return ListItem(label,
                         buildUrl(url,
                                  action=folder.get("action", self.type),
                                  **kwargs),
                         isFolder=True,
                         infos={
                             "video": {
                                 "title":
                                 label,
                                 "plot":
                                 maybeLocalize(folder.get("plot", label))
                             }
                         },
                         **folder.get("art", {}))
コード例 #6
0
 def request(self, method, url, timeout=None, **kwargs):
     log("request.url: {}".format(buildUrl(url, **kwargs.get("params",
                                                             {}))))
     try:
         response = super(Session, self).request(method,
                                                 url,
                                                 timeout=timeout,
                                                 **kwargs)
     except requests.Timeout as error:
         self.__notify__(error)
     else:
         try:
             response.raise_for_status()
         except Exception as error:
             try:
                 result = response.json()
             except Exception:
                 result = None
             if not self.__notify__(result):
                 raise error
         else:
             result = response.json()
             if not self.__notify__(result):
                 return result