Ejemplo n.º 1
0
 def open(self):
  print ("connecting...")
  try:
   #self.controller = DeviceController()
   #self.write_message("Hello world!")
   self.controller=tea5767stationscanner.tea5767()
   self.controller.on()
   data=self.controller.info()
   self.write_message(data)
#   self.controller.prepareSocket()
  except Exception as a:
   print(a)
Ejemplo n.º 2
0
    def open(self):
        print("connecting...")
        try:
            #self.controller = DeviceController()
            #self.write_message("Hello world!")
            self.controller = tea5767stationscanner.tea5767()
            self.controller.on()
            data = self.controller.info()
            self.write_message(data)


#   self.controller.prepareSocket()
        except Exception as a:
            print(a)
Ejemplo n.º 3
0
        if self.path == '/info':
            resp = self.tea.info()
            resp = "{" + '"freq":' + resp['freq'] + ',"level":' + resp[
                'level'] + ',"stereo":\"' + resp['stereo'] + "\"}"
            print(resp)
            self.send_response(200)
            self.send_header("Content-type", "application/json")
            self.send_header("Content-length", len(resp))
            self.end_headers()
            self.wfile.write(bytes(resp, 'UTF-8'))
            return

        return http.server.SimpleHTTPRequestHandler.do_GET(self)


rr = tea5767stationscanner.tea5767()
HandlerClass = MyRequestHandler
ServerClass = http.server.HTTPServer
Protocol = "HTTP/1.0"

if sys.argv[1:]:
    port = int(sys.argv[1])
else:
    port = 8888
server_address = ('0.0.0.0', port)

HandlerClass.protocol_version = Protocol
httpd = ServerClass(server_address, HandlerClass)

WS_PORT = 9876
#ws = websocket.Websocket(WS_PORT, driver)
Ejemplo n.º 4
0
        if self.path == '/info':
            resp = self.tea.info()
            resp = "{" + '"freq":' + resp['freq'] + ',"level":' + resp['level']+',"stereo":\"'+resp['stereo']  + "\"}"
            print(resp)
            self.send_response(200)
            self.send_header("Content-type", "application/json")
            self.send_header("Content-length", len(resp))
            self.end_headers()
            self.wfile.write(bytes(resp, 'UTF-8'))
            return

        return http.server.SimpleHTTPRequestHandler.do_GET(self)
     
    
rr = tea5767stationscanner.tea5767()      
HandlerClass = MyRequestHandler
ServerClass  = http.server.HTTPServer
Protocol     = "HTTP/1.0"



if sys.argv[1:]:
    port = int(sys.argv[1])
else:
    port = 8888
server_address = ('0.0.0.0', port)

HandlerClass.protocol_version = Protocol
httpd = ServerClass(server_address, HandlerClass)
Ejemplo n.º 5
0
Wish list	:
- Save strong stations into text file list

Reference	:
1. https://raw.githubusercontent.com/JTechEng/tea5767/
2. https://github.com/pcnate/fm-radio-python
3. http://www.astromik.org/raspi/38.htm

Usage		:
sudo python3 tea5767controller.py
or with executable file
sudo ./tea5767controller.py
"""

from tea5767stationscanner import tea5767

a = tea5767()
test = ""

while (test != "x"):
    test = input("Radio command (u)p, (d)own, (t)est, e(x)it:")
    if (test == "u"):
        a.scan(1)
    elif (test == "d"):
        a.scan(0)
    elif (test == "t"):
        a.test()
    elif (test == "x"):
        a.off()
Ejemplo n.º 6
0
- Save strong stations into text file list

Reference	:
1. https://raw.githubusercontent.com/JTechEng/tea5767/
2. https://github.com/pcnate/fm-radio-python
3. http://www.astromik.org/raspi/38.htm

Usage		:
sudo python3 tea5767controller.py
or with executable file
sudo ./tea5767controller.py
"""



from tea5767stationscanner import tea5767

a = tea5767()
test =""

while(test!="x"):
  test=input("Radio command (u)p, (d)own, (t)est, e(x)it:")
  if(test=="u"):
    a.scan(1)
  elif(test=="d"):
    a.scan(0)
  elif(test=="t"):
    a.test()
  elif(test=="x"):
    a.off()