| 493 | |
| 494 | |
| 495 | def diffMessageIdReport(resultPath: str, messageId: str) -> str: |
| 496 | text = messageId + '\n' |
| 497 | e = '[' + messageId + ']\n' |
| 498 | for filename in sorted(glob.glob(resultPath + '/*.diff')): |
| 499 | if not os.path.isfile(filename): |
| 500 | continue |
| 501 | with open(filename, 'rt') as f: |
| 502 | diff_stats = json.loads(f.read()) |
| 503 | if messageId not in diff_stats['sums']: |
| 504 | continue |
| 505 | if OLD_VERSION not in diff_stats['sums'][messageId]: |
| 506 | continue |
| 507 | |
| 508 | url = None |
| 509 | diff = False |
| 510 | for line in open(filename[:-5], 'rt'): |
| 511 | if line.startswith('ftp://'): |
| 512 | url = line |
| 513 | elif line == 'diff:\n': |
| 514 | diff = True |
| 515 | elif not diff: |
| 516 | continue |
| 517 | elif line.endswith(e): |
| 518 | if url: |
| 519 | text += url |
| 520 | url = None |
| 521 | text += line |
| 522 | return text |
| 523 | |
| 524 | |
| 525 | def diffMessageIdTodayReport(resultPath: str, messageId: str) -> str: |