partyfuse: modernize html parser (just in case)

This commit is contained in:
ed 2024-10-01 17:00:17 +00:00
parent 3dff6cda40
commit 3900e66158
2 changed files with 5 additions and 8 deletions

View file

@ -417,7 +417,7 @@ class Gateway(object):
ret = [] ret = []
rem = b"" rem = b""
ptn = re.compile( ptn = re.compile(
r'^<tr><td>(-|DIR|<a [^<]+</a>)</td><td><a[^>]* href="([^"]+)"[^>]*>([^<]+)</a></td><td>([^<]+)</td><td>[^<]+</td><td>([^<]+)</td></tr>$' r'^<tr><td>(-|DIR|<a [^<]+</a>)</td><td><a[^>]* href="([^"]+)"[^>]*>([^<]+)</a></td><td>([^<]+)</td><td>.*</td><td>([^<]+)</td></tr>$'
) )
while True: while True:
@ -454,7 +454,7 @@ class Gateway(object):
info("bad HTML or OS [%r] [%r]", fdate, fsize) info("bad HTML or OS [%r] [%r]", fdate, fsize)
# python cannot strptime(1959-01-01) on windows # python cannot strptime(1959-01-01) on windows
if ftype != "DIR": if ftype != "DIR" and "zip=crc" not in ftype:
ret.append([fname, self.stat_file(ts, sz), 0]) ret.append([fname, self.stat_file(ts, sz), 0])
else: else:
ret.append([fname, self.stat_dir(ts, sz), 0]) ret.append([fname, self.stat_dir(ts, sz), 0])

View file

@ -109,11 +109,8 @@
{%- for f in files %} {%- for f in files %}
<tr><td>{{ f.lead }}</td><td><a href="{{ f.href }}">{{ f.name|e }}</a></td><td>{{ f.sz }}</td> <tr><td>{{ f.lead }}</td><td><a href="{{ f.href }}">{{ f.name|e }}</a></td><td>{{ f.sz }}</td>
{%- if f.tags is defined %} {%- if f.tags is defined %}
{%- for k in taglist %} {%- for k in taglist %}<td>{{ f.tags[k] }}</td>{%- endfor %}
<td>{{ f.tags[k] }}</td> {%- endif %}<td>{{ f.ext }}</td><td>{{ f.dt }}</td></tr>
{%- endfor %}
{%- endif %}
<td>{{ f.ext }}</td><td>{{ f.dt }}</td></tr>
{%- endfor %} {%- endfor %}
</tbody> </tbody>