#!/usr/bin/python
import os, syslog,io
import pygame, re
import time
import pywapi
import string
import requests
import datetime
try:
# Python2
from urllib2 import urlopen
except ImportError:
# Python3
from urllib.request import urlopen
#!/usr/bin/python
import os, syslog
import pygame
import time
import pywapi
import string
import os
import io
BLACK = (0,0,0)
WHITE = (255,255,255)
GREEN = (0,255,0)
RED = (255,0,0)
BLUE = (0,0,255)
SCREEN_WIDTH = 320
SCREEN_HEIGHT = 240
os.putenv('SDL_FBDEV', '/dev/fb1')
os.putenv('SDL_MOUSEDRV', 'TSLIB')
os.putenv('SDL_MOUSEDEV', '/dev/input/touchscreen')
pygame.display.init()
size = (pygame.display.Info().current_w, pygame.display.Info().current_h)
screen = pygame.display.set_mode(size, pygame.FULLSCREEN)
screen.fill((0, 0, 0))
pygame.font.init()
pygame.display.update()
pygame.mouse.set_visible(False)
fontpath = pygame.font.match_font('dejavusansmono')
font = pygame.font.Font(fontpath, 20)
fontSm = pygame.font.Font(fontpath, 18)
font_big = pygame.font.Font(None, 50)
font_small = pygame.font.Font(None,30)
ok = True
while ok:
url = 'http://sat.pajero4x4.ru/?image=last'
try:
data = requests.get(url=url)
except:
print "Error Request"
time.sleep(10)
else:
if data.status_code == 200:
if re.search('jpg#',data.text):
noaa = data.text.split("\n")
f,d = noaa[-1].split("#")
image_url = "http://sat.pajero4x4.ru/NOAA/" + f
try:
image_str = urlopen(image_url).read()
except HTTPError as e:
print "Error url..."
else:
image_file = io.BytesIO(image_str)
logo = pygame.image.load(image_file).convert()
logo = pygame.transform.scale(logo,( SCREEN_WIDTH, SCREEN_HEIGHT))
screen.blit(logo, (0, 0))
text = font_small.render('%s'%d, True,RED)
screen.blit(text,(5,220))
pygame.display.update()
else:
print "Error"
time.sleep(10)
print "Reload"
print(datetime.datetime.now())
import os, syslog,io
import pygame, re
import time
import pywapi
import string
import requests
import datetime
try:
# Python2
from urllib2 import urlopen
except ImportError:
# Python3
from urllib.request import urlopen
#!/usr/bin/python
import os, syslog
import pygame
import time
import pywapi
import string
import os
import io
BLACK = (0,0,0)
WHITE = (255,255,255)
GREEN = (0,255,0)
RED = (255,0,0)
BLUE = (0,0,255)
SCREEN_WIDTH = 320
SCREEN_HEIGHT = 240
os.putenv('SDL_FBDEV', '/dev/fb1')
os.putenv('SDL_MOUSEDRV', 'TSLIB')
os.putenv('SDL_MOUSEDEV', '/dev/input/touchscreen')
pygame.display.init()
size = (pygame.display.Info().current_w, pygame.display.Info().current_h)
screen = pygame.display.set_mode(size, pygame.FULLSCREEN)
screen.fill((0, 0, 0))
pygame.font.init()
pygame.display.update()
pygame.mouse.set_visible(False)
fontpath = pygame.font.match_font('dejavusansmono')
font = pygame.font.Font(fontpath, 20)
fontSm = pygame.font.Font(fontpath, 18)
font_big = pygame.font.Font(None, 50)
font_small = pygame.font.Font(None,30)
ok = True
while ok:
url = 'http://sat.pajero4x4.ru/?image=last'
try:
data = requests.get(url=url)
except:
print "Error Request"
time.sleep(10)
else:
if data.status_code == 200:
if re.search('jpg#',data.text):
noaa = data.text.split("\n")
f,d = noaa[-1].split("#")
image_url = "http://sat.pajero4x4.ru/NOAA/" + f
try:
image_str = urlopen(image_url).read()
except HTTPError as e:
print "Error url..."
else:
image_file = io.BytesIO(image_str)
logo = pygame.image.load(image_file).convert()
logo = pygame.transform.scale(logo,( SCREEN_WIDTH, SCREEN_HEIGHT))
screen.blit(logo, (0, 0))
text = font_small.render('%s'%d, True,RED)
screen.blit(text,(5,220))
pygame.display.update()
else:
print "Error"
time.sleep(10)
print "Reload"
print(datetime.datetime.now())