コード例 #1
0
ファイル: svc_usb.py プロジェクト: joiegils/photoframe
    def validateKeywords(self, keyword):
        if keyword != 'ALLALBUMS' and keyword != '_PHOTOFRAME_':
            if keyword not in self.getAllAlbumNames():
                return {
                    'error': 'No such album "%s"' % keyword,
                    'keywords': keyword
                }

        return BaseService.validateKeywords(self, keyword)
コード例 #2
0
  def validateKeywords(self, keywords):
    tst = BaseService.validateKeywords(self, keywords)
    if tst["error"] is not None:
      return tst

    # Remove quotes around keyword
    if keywords[0] == '"' and keywords[-1] == '"':
      keywords = keywords[1:-1]
    keywords = keywords.upper().lower().strip()

    # No error in input, resolve album now and provide it as extra data
    albumId = None
    if keywords != 'latest':
      albumId = self.translateKeywordToId(keywords)
      if albumId is None:
        return {'error':'No such album "%s"' % keywords, 'keywords' : keywords}

    return {'error':None, 'keywords':keywords, 'extras' : albumId}
コード例 #3
0
ファイル: svc_simpleurl.py プロジェクト: joiegils/photoframe
    def validateKeywords(self, keywords):
        # Catches most invalid URLs
        if not helper.isValidUrl(keywords):
            return {'error': 'URL appears to be invalid', 'keywords': keywords}

        return BaseService.validateKeywords(self, keywords)