Example #1
0
File: net.py Project: vrx/gagamix
def getip(interface="en1"):
    en = vsu.getoutput("ifconfig " + interface)
    p = en.find("inet ")
    if p == -1:
        IP = "127.0.0.1"
    else:
        IP = en[p:].split("inet")[-1].split()[0]
    return IP
Example #2
0
File: net.py Project: vrx/gagamix
def is_in_git_repo(path):
    dir0 = os.getcwd()
    dir1 = vsu.path2dir(path)
    os.chdir(dir1)
    if "fatal" in vsu.getoutput(which("git") + " status"):
        rsl = False
    else:
        rsl = True
    os.chdir(dir0)
    return rsl
Example #3
0
def is_in_git_repo(path):
  dir0 = os.getcwd()
  dir1 = vsu.path2dir(path)
  os.chdir(dir1)
  git = which('git')
  rsl = False
  if git:
    if 'fatal' in vsu.getoutput(git+' status'): rsl=False
    else: rsl=True
  os.chdir(dir0)
  return rsl 
Example #4
0
File: audio.py Project: vrx/vspy
def amidi_get_interface_number(interface):
  nb = None
  lines = vsu.getoutput('aconnect -iol').split('\n')
  for line in lines:
    line = line.lower()
    interface = interface.lower()
    if line.find(interface)!=-1:
      nb = line.split(' ')[1]
      nb = nb.replace(':','')
      break;
  return nb
Example #5
0
def is_connected_to_internet():
  ans = vsu.getoutput('ping -o google.com')
  if ans.find('cannot resolve')!=-1: return False
  else: return True
Example #6
0
def getip(interface='en1'):
  en = vsu.getoutput('ifconfig '+interface)
  p = en.find('inet ')
  if p==-1: IP = "127.0.0.1"
  else: IP = en[p:].split('inet')[-1].split()[0]
  return IP
Example #7
0
def get_thumb(url,path):
  url, tmp = urlsplit(url)
  thumb_url = vsu.getoutput("./youtube_dl.py --get-thumbnail "+url)
  vsu.wget(thumb_url, path+'.jpg')
  return path+'.jpg'
Example #8
0
def get_title(url):
  url, name = urlsplit(url)
  title = vsu.getoutput("./youtube_dl.py -e --skip-download "+url)
  title = vsu.name_ascii(title)
  return title 
Example #9
0
File: process.py Project: vrx/vspy
def is_installed(com):
  if len(vsu.getoutput("which "+com))!=0: return True
  else: return False
Example #10
0
File: audio.py Project: vrx/vspy
def is_jack_launched():
  cjack = vsu.getoutput("ps aux | grep jackd").replace('grep jackd', '')
  if cjack.find('jackd')!=-1:
    return True
  else: return False