2012-12-30 13:02:19 -07:00
|
|
|
#!/usr/bin/env python
|
|
|
|
# coding: utf-8
|
|
|
|
|
2014-11-26 12:01:20 -07:00
|
|
|
from __future__ import with_statement, unicode_literals
|
2012-12-30 13:02:19 -07:00
|
|
|
|
|
|
|
import datetime
|
|
|
|
import glob
|
|
|
|
import os
|
|
|
|
import re
|
2023-07-24 17:22:54 -06:00
|
|
|
import sys
|
2012-12-30 13:02:19 -07:00
|
|
|
|
2023-07-24 17:22:54 -06:00
|
|
|
dirn = os.path.dirname
|
|
|
|
|
|
|
|
sys.path.insert(0, dirn(dirn(dirn(os.path.abspath(__file__)))))
|
|
|
|
|
|
|
|
from devscripts.utils import read_file, write_file
|
|
|
|
from youtube_dl import compat_str
|
|
|
|
|
|
|
|
year = compat_str(datetime.datetime.now().year)
|
2012-12-30 13:02:19 -07:00
|
|
|
for fn in glob.glob('*.html*'):
|
2023-07-24 17:22:54 -06:00
|
|
|
content = read_file(fn)
|
2018-06-03 13:33:54 -06:00
|
|
|
newc = re.sub(r'(?P<copyright>Copyright © 2011-)(?P<year>[0-9]{4})', 'Copyright © 2011-' + year, content)
|
2012-12-30 13:02:19 -07:00
|
|
|
if content != newc:
|
|
|
|
tmpFn = fn + '.part'
|
2023-07-24 17:22:54 -06:00
|
|
|
write_file(tmpFn, newc)
|
2012-12-30 13:02:19 -07:00
|
|
|
os.rename(tmpFn, fn)
|