]> jfr.im git - yt-dlp.git/blame - devscripts/gh-pages.unused/update-copyright.py
[FFmpegMetadataPP] Remove `\0` from metadata
[yt-dlp.git] / devscripts / gh-pages.unused / update-copyright.py
CommitLineData
cc52de43 1#!/usr/bin/env python3
067f6a35
FV
2# coding: utf-8
3
dcddc10a 4from __future__ import with_statement, unicode_literals
067f6a35
FV
5
6import datetime
7import glob
dfb1b146 8import io # For Python 2 compatibility
067f6a35
FV
9import os
10import re
11
12year = str(datetime.datetime.now().year)
13for fn in glob.glob('*.html*'):
14 with io.open(fn, encoding='utf-8') as f:
15 content = f.read()
f7560859 16 newc = re.sub(r'(?P<copyright>Copyright © 2011-)(?P<year>[0-9]{4})', 'Copyright © 2011-' + year, content)
067f6a35
FV
17 if content != newc:
18 tmpFn = fn + '.part'
19 with io.open(tmpFn, 'wt', encoding='utf-8') as outf:
20 outf.write(newc)
21 os.rename(tmpFn, fn)