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
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
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
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
def is_connected_to_internet(): ans = vsu.getoutput('ping -o google.com') if ans.find('cannot resolve')!=-1: return False else: return True
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
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'
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
def is_installed(com): if len(vsu.getoutput("which "+com))!=0: return True else: return False
def is_jack_launched(): cjack = vsu.getoutput("ps aux | grep jackd").replace('grep jackd', '') if cjack.find('jackd')!=-1: return True else: return False