(self, tid, pg, filter, extend)
| 76 | self.baseurl = baseurl |
| 77 | |
| 78 | def categoryContent(self, tid, pg, filter, extend): |
| 79 | result = {} |
| 80 | if tid.count('/') == 2: |
| 81 | tid = tid + '/' |
| 82 | nurl = re.findall(r"http.*://.*?/", tid)[0] |
| 83 | if self.ver == '' or self.baseurl != nurl: |
| 84 | self.getVersion(tid) |
| 85 | ver = self.ver |
| 86 | baseurl = self.baseurl |
| 87 | if tid.count('/') == 2: |
| 88 | tid = tid + '/' |
| 89 | pat = tid.replace(baseurl,"") |
| 90 | param = { |
| 91 | "path": '/' + pat |
| 92 | } |
| 93 | if ver == 2: |
| 94 | rsp = self.postJson(baseurl + 'api/public/path', param) |
| 95 | jo = json.loads(rsp.text) |
| 96 | vodList = jo['data']['files'] |
| 97 | elif ver == 3: |
| 98 | rsp = self.postJson(baseurl + 'api/fs/list', param) |
| 99 | jo = json.loads(rsp.text) |
| 100 | vodList = jo['data']['content'] |
| 101 | ovodList = vodList |
| 102 | if len(extend) != 0: |
| 103 | if 'tp' in extend and extend['tp'] != '': |
| 104 | fl = 'type' |
| 105 | if extend['tp'] == "True": |
| 106 | key = True |
| 107 | if extend['tp'] == "False": |
| 108 | key = False |
| 109 | vodList.sort(key=lambda x: (x['{0}'.format(fl)]), reverse=key) |
| 110 | elif 'sz' in extend and extend['sz'] != '': |
| 111 | fl = 'size' |
| 112 | if extend['sz'] == "True": |
| 113 | key = True |
| 114 | if extend['sz'] == "False": |
| 115 | key = False |
| 116 | vodList.sort(key=lambda x: (x['{0}'.format(fl)]), reverse=key) |
| 117 | elif 'nm' in extend and extend['nm'] != '': |
| 118 | fl = 'name' |
| 119 | if extend['nm'] == "True": |
| 120 | key = True |
| 121 | if extend['nm'] == "False": |
| 122 | key = False |
| 123 | vodList.sort(key=lambda x: (x['{0}'.format(fl)]), reverse=key) |
| 124 | elif 'tm' in extend and extend['tm'] != '': |
| 125 | if ver == 2: |
| 126 | fl = 'updated_at' |
| 127 | elif ver == 3: |
| 128 | fl = 'modified' |
| 129 | if extend['tm'] == "True": |
| 130 | key = True |
| 131 | if extend['tm'] == "False": |
| 132 | key = False |
| 133 | vodList.sort(key=lambda x: (x['{0}'.format(fl)]), reverse=key) |
| 134 | else: |
| 135 | vodList = ovodList |
nothing calls this directly
no test coverage detected