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