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