Amikoo
  • Introduction
  • Norman
    • Architecture
    • Hardware
      • Embedded Platforms
        • Edison
          • SetUp
          • Git Repositories
        • UpBoard
          • SetUp
          • Git Repositories
          • Voice
      • Robot Wiring
    • Software
      • Programming Languajes
      • Broker
      • Google Account setup
      • Applications
        • Upboard
          • Camera
          • Vision
          • Translate
          • Tradition
          • IA Assistant
            • Alexa Linux
            • Google Assistant Linux
          • Node
    • StartupService
      • Edison
      • Upboard
  • VisitOpinions
    • SetUp
      • Linux Web Server Set Up
    • Application
      • Drawing
      • Survey
Powered by GitBook
On this page

Was this helpful?

  1. Norman
  2. Software
  3. Applications
  4. Upboard

Tradition

This app allow us to recibe a random or a specific media such as photo, video or audio, and display it on the lcd display. Also we could finish projection with the same topic but with a message stop.

  • First we need to import the libraries that we are going to use.

import sys
import os,random
  • Explaining the code.

    • First we get the first parameter and save it on the variable "tipo", to know with time of media we are going to display

    • Then we storage the second parameter, as the message

    • We define the path were we have all ready the media.

    • Then we use some conditions to know is we receive a random name, or we need to stop the program, or if we need only need to storage the name of the media.

      • If we recibe random, we get a random name of files with the function random.choice(os.listdir.("path"))

    • Then we look of with type of media we are going to reproduce.

      • Sound we use mpg123

      • Image we use feh

      • Video se use cvlc

tipo = sys.argv[1]
message = sys.argv[2];
message = message.split("/")
path = "/home/lupe/Desktop/Data/"


if(message[1] == 'Random'):
  randomfile = random.choice(os.listdir(path+message[0]+"/"+tipo+"/"))
  file = randomfile
  nombre=file
elif(message[1] == "Stop"):
  os.system('killall -9 mpg123')
  os.system('killall -9 vlc')
  os.system('killall -9 feh')
  sys.exit()
else:
  nombre=message[1]

if(tipo == 'Sound'):
  path2 = path+message[0]+"/Sound/"+nombre
  print(path2)
  os.system('mpg123 '+path2)

elif(tipo == "Image"):
  path2 = path+message[0]+"/Image/"+nombre
  os.system('feh -F '+path2)

elif(tipo == "Video"):
   path2 = path+message[0]+"/Video/"+nombre
   os.system("cvlc --no-video-title-show --fullscreen "+path2)

else:
 print("error")
PreviousTranslateNextIA Assistant

Last updated 5 years ago

Was this helpful?