Compare commits
	
		
			No commits in common. "a06555702816aa8c5103a2642f7dacafeec155e8" and "09a02b4633c09d1fe5077419eb0dc8d5bbc9d231" have entirely different histories.
		
	
	
		
			a065557028
			...
			09a02b4633
		
	
		
| @ -4,7 +4,7 @@ ENV TZ=Europe/Moscow | ||||
| ENV TERM=xterm-color | ||||
| 
 | ||||
| RUN apt-get update && \ | ||||
|   apt-get install -y --no-install-recommends cron python3 python3-pymysql python3-qrcode p7zip-full && \ | ||||
|   apt-get install -y --no-install-recommends cron python3 python3-pymysql python3-qrcode p7zip && \ | ||||
|   rm -rf /var/lib/apt/lists/* | ||||
| 
 | ||||
| RUN \ | ||||
|  | ||||
| @ -1 +1 @@ | ||||
| 0 * * * * root . /etc/environment; python3 /opt/gtfs2qr/gtfs2qr.py >> /opt/gtfs2qr/logs.log 2>&1 | ||||
| * * * * * root . /etc/environment; python3 /opt/gtfs2qr/gtfs2qr.py > /opt/gtfs2qr/logs.log 2>&1 | ||||
|  | ||||
| @ -53,16 +53,16 @@ def main(): | ||||
|     ) | ||||
|     cursor = conn.cursor() | ||||
| 
 | ||||
|     if op.exists('/opt/gtfs2qr/codes.7z'): | ||||
|         os.unlink('/opt/gtfs2qr/codes.7z') | ||||
|     if op.exists('codes.7z'): | ||||
|         os.unlink('codes.7z') | ||||
| 
 | ||||
|     shutil.rmtree('/opt/gtfs2qr/codes', ignore_errors=True) | ||||
|     shutil.rmtree('codes', ignore_errors=True) | ||||
| 
 | ||||
|     cursor.execute('SELECT * FROM routes ORDER BY route_short_name;') | ||||
|     for route in cursor.fetchall(): | ||||
|         for d in (0, 1): | ||||
|             route_path = op.join( | ||||
|                 '/opt/gtfs2qr/codes', | ||||
|                 'codes', | ||||
|                 transport_type[route['transport_type']], | ||||
|                 route['route_short_name'], | ||||
|                 'туда' if d == 0 else 'обратно' | ||||
| @ -96,7 +96,7 @@ def main(): | ||||
|                 img = qr.make_image(fill_color="black", back_color="white") | ||||
| 
 | ||||
|                 draw = ImageDraw.Draw(img) | ||||
|                 font = ImageFont.truetype("/opt/gtfs2qr/Verdana.ttf", 12) | ||||
|                 font = ImageFont.truetype("Verdana.ttf", 12) | ||||
|                 stop_name += ' (%i)' % stop['stop_id'] | ||||
|                 text_size = font.getsize(stop_name) | ||||
|                 draw.text(((img.size[0] - text_size[0]) / 2, img.size[1] - 25), stop_name, font=font) | ||||
| @ -106,13 +106,13 @@ def main(): | ||||
| 
 | ||||
|                 qr.clear() | ||||
| 
 | ||||
|     subprocess.run(['7za', 'a', '/opt/gtfs2qr/codes.7z', '/opt/gtfs2qr/codes'], check=True) | ||||
|     subprocess.run(['7za', 'a', 'codes', 'codes'], check=True) | ||||
| 
 | ||||
|     with ftplib.FTP(host=FTP_HOST, user=FTP_USER, passwd=FTP_PASS) as ftp: | ||||
|         if 'codes.7z' in ftp.nlst(): | ||||
|             ftp.delete('codes.7z') | ||||
| 
 | ||||
|         with open('/opt/gtfs2qr/codes.7z', 'rb') as arch: | ||||
|         with open('codes.7z', 'rb') as arch: | ||||
|             ftp.storbinary('STOR codes.7z', arch) | ||||
| 
 | ||||
| 
 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user