2012-12-31 05:02:19 +09:00
|
|
|
#!/usr/bin/env python
|
|
|
|
# coding: utf-8
|
|
|
|
|
2014-11-27 04:01:20 +09:00
|
|
|
from __future__ import with_statement, unicode_literals
|
2012-12-31 05:02:19 +09:00
|
|
|
|
|
|
|
import datetime
|
|
|
|
import glob
|
|
|
|
import os
|
|
|
|
import re
|
2023-07-25 08:22:54 +09:00
|
|
|
import sys
|
2012-12-31 05:02:19 +09:00
|
|
|
|
2023-07-25 08:22:54 +09: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-31 05:02:19 +09:00
|
|
|
for fn in glob.glob('*.html*'):
|
2023-07-25 08:22:54 +09:00
|
|
|
content = read_file(fn)
|
2018-06-04 04:33:54 +09:00
|
|
|
newc = re.sub(r'(?P<copyright>Copyright © 2011-)(?P<year>[0-9]{4})', 'Copyright © 2011-' + year, content)
|
2012-12-31 05:02:19 +09:00
|
|
|
if content != newc:
|
|
|
|
tmpFn = fn + '.part'
|
2023-07-25 08:22:54 +09:00
|
|
|
write_file(tmpFn, newc)
|
2012-12-31 05:02:19 +09:00
|
|
|
os.rename(tmpFn, fn)
|