def shutdown(self):
     self.logger.debug('VideoPlayer shutdown called')
     if self.is_alive():
         if platform.linux_distribution()[0] in self.NON_PI_PLATFORMS:
             sh.pkill('vlc')
         else:
             sh.killall('omxplayer.bin', _ok_code=[0, 1])
Пример #2
0
def sigusr1(signum, frame):
    """
    The signal interrupts sleep() calls, so the currently playing web or image asset is skipped.
    omxplayer is killed to skip any currently playing video assets.
    """
    logging.info('USR1 received, skipping.')
    sh.killall('omxplayer.bin', _ok_code=[1])
Пример #3
0
 def _stop_mongo(self):
     """starts in dir webgui the program server.py and displays a
         browser on the given port and link """
     try:
         sh.killall("-15", "mongod")
     except:
         print("INFO: cloudmesh mongo server not running")
Пример #4
0
def play_and_record(play_file,
                    play_device,
                    record_file,
                    record_device,
                    rate=None,
                    play_rate=None,
                    rec_rate=None,
                    trim_ends_s=0.0):
    if play_rate is None and rec_rate is None:
        play_rate = rec_rate = rate
    player = audio_player(play_file, play_device, play_rate)
    recorder = audio_recorder(record_file,
                              record_device,
                              rec_rate,
                              start_trim_s=trim_ends_s,
                              end_trim_s=trim_ends_s)
    player.play_background()
    recorder.record_background()
    print("Playing and recording audio...")
    player.wait_to_complete()
    recorder.end_recording()
    # Belt and braces as xplay doesn't alway exit nicely
    if platform == "darwin":
        try:
            sh.killall(" xplay")
        except sh.ErrorReturnCode_1:
            pass
Пример #5
0
def sigusr1(signum, frame):
    """
    The signal interrupts sleep() calls, so the currently playing web or image asset is skipped.
    omxplayer is killed to skip any currently playing video assets.
    """
    logging.info('USR1 received, skipping.')
    sh.killall('omxplayer.bin', _ok_code=[1])
Пример #6
0
 def shutdown(self):
     self.logger.debug('VideoPlayer shutdown called')
     if self.is_alive():
         if platform.linux_distribution()[0] in self.NON_PI_PLATFORMS:
             sh.pkill('vlc')
         else:
             sh.killall('omxplayer.bin', _ok_code=[0, 1])
Пример #7
0
def _set_termite_config(config_name):
    config_dir = os.path.expanduser('~/.config/termite/')
    if not os.path.exists(os.path.join(config_dir, config_name)):
        return
    dst = os.path.join(config_dir, 'config')
    if os.path.exists(dst):
        os.remove(dst)
    dir_fd = os.open(config_dir, flags=os.O_DIRECTORY)
    os.symlink(config_name, 'config', dir_fd=dir_fd)
    killall('-s', 'USR1', 'termite')
Пример #8
0
def sigusr1(signum, frame):
    """
    The signal interrupts sleep() calls, so the currently
    playing web or image asset is skipped.
    omxplayer is killed to skip any currently playing video assets.
    """
    logging.info("USR1 received, skipping.")
    try:
        sh.killall("omxplayer.bin", _ok_code=[1])
    except OSError:
        pass
Пример #9
0
def sigusr2(signum, frame):
    try:
        scheduler.reverse = True
    except AttributeError:
        pass

    logging.info('USR1 received, skipping.')

    try:
        sh.killall('omxplayer.bin', _ok_code=[1])
    except OSError:
        pass
Пример #10
0
    def handle(self):
        self.data = self.request.recv(1024).strip()

        if(self.data == "status"):
            logging.info("Statusrequest from {}".format(self.client_address[0]))
            processes = ('xloader', '')
            statuses = {}
            for proc in processes:
                statuses[proc] = processcheck(proc)
            
            self.request.sendall(json.dumps(statuses))
            
        elif self.data == "killview":
            sh.killall('omxplayer.bin', _ok_code=[1])
            sh.killall('mplayer', _ok_code=[1])
            sh.kill(find_pid('python', 'viewer.py'))
            self.request.sendall(json.dumps("OK"))
                
        else:
            logging.debug("{} wrote:".format(self.client_address[0]))
            logging.debug(str(self.data))
            # just send back the same data, but upper-cased
            self.request.sendall("your string in caps: {}".format(self.data.upper()))
Пример #11
0
def asset_loop(scheduler):
    check_update()
    asset = scheduler.get_next_asset()

    if asset is None:
        logging.info('Playlist is empty. Sleeping for %s seconds', EMPTY_PL_DELAY)
        view_image(HOME + LOAD_SCREEN)
        sleep(EMPTY_PL_DELAY)

    elif path.isfile(asset['uri']) or not url_fails(asset['uri']):
        name, mime, uri = asset['name'], asset['mimetype'], asset['uri']
        logging.info('Showing asset %s (%s)', name, mime)
        logging.debug('Asset URI %s', uri)
        watchdog()
        # Procedure om loop stop te zetten
        if scheduler.get_n_assets() > 1:
            if scheduler.get_inLoop() == True:
                run = sh.killall('omxplayer')
                scheduler.set_inLoop(False)
        if 'image' in mime:
            view_image(uri)
        elif 'web' in mime:
            browser_url(uri)
        elif 'video' in mime:
            
            # Als er juist 1 videoasset is: checken of ie al in loop staat, anders gewoon doen!
            if scheduler.get_n_assets() == 1:
                if scheduler.get_inLoop() == False:
                    logging.info('Playing video in loop')
                    scheduler.set_inLoop(True)
                    
            else:
                logging.info('Playing video')
                scheduler.set_inLoop(False)
            # schedulerobject toegevoegd
            view_video(uri, asset['duration'],scheduler)    
                
        
        else:
            logging.error('Unknown MimeType %s', mime)

        if 'image' in mime or 'web' in mime:
            duration = int(asset['duration'])
            logging.info('Sleeping for %s', duration)
            sleep(duration)
    else:
        logging.info('Asset %s at %s is not available, skipping.', asset['name'], asset['uri'])
        sleep(0.5)
Пример #12
0
def reload_configuration():
    """
    Send signal to the proftpd daemon to reload configuration.
    """
    sh.killall("-HUP", "proftpd", _ok_code=[0, 1])
Пример #13
0
                'timestamp': time.time() - startTime
            })
        elif pressed == ord('0'):
            writer.writerow({
                'keyPressed': '0',
                'timestamp': time.time() - startTime
            })
        elif pressed == ord('.') or 46:
            writer.writerow({
                'keyPressed': '.',
                'timestamp': time.time() - startTime
            })
        elif pressed == ord(' '):
            writer.writerow({
                'keyPressed': 'space',
                'timestamp': time.time() - startTime
            })
        elif pressed == 127:  #backspace key
            writer.writerow({
                'keyPressed': 'backspace',
                'timestamp': time.time() - startTime
            })
        elif pressed == 10:  #enter key
            writer.writerow({
                'keyPressed': 'return',
                'timestamp': time.time() - startTime
            })
        elif pressed == ord(':'):
            sh.killall('sox')
            break  #exit loop
Пример #14
0
 def _kill_old_process(self):
     """kill old openvpn process"""
     try:
         sh.killall("openvpn")
     except:
         pass
Пример #15
0
 def _kill_old_process(self):
     """kill old openvpn process"""
     try:
         sh.killall("openvpn")
     except:
         pass
Пример #16
0
def main(click_mode):
    words = json.load(
        open(
            '/home/ANT.AMAZON.COM/frapil/linux-tweaks/mouse/words_dictionary.json',
            'r'))
    short_words = set()
    for word in words:
        if len(word) == letters and all(x == 1
                                        for x in Counter(word).values()):
            short_words.add(word)
    text = "\n".join(
        separator.join(short_words.pop() for _ in range(columns))
        for _ in range(lines))
    p = Process(target=show_grid, args=(
        text,
        delay,
    ))
    p.start()
    if click_mode == 'single':
        try:
            command = str(sh.dmenu(sh.echo())).strip()
        except sh.ErrorReturnCode_1 as e:
            command = ''
        p.terminate()
        try:
            sh.killall('osd_cat')
        except sh.ErrorReturnCode_1 as e:
            pass
        if command:
            if command == '.':
                with open(command_file_path, 'r') as command_file:
                    command = command_file.read()
                with open(text_file_path, 'r') as text_file:
                    text = text_file.read()
            for keys in command.split():
                if keys == 'r':  #reload
                    main()
                    return
                print('Looking for', keys)
                action = "click"
                if ',' in keys:
                    # Hold
                    action = "mousedown"
                if '.' in keys:
                    # Release
                    action = "mouseup"
                button_id = 1
                if ']' in keys and '[' in keys:
                    # Middle click
                    button_id = 2
                elif ']' in keys:
                    # Right click
                    button_id = 3
                elif '{' in keys:
                    # Wheel up
                    button_id = 4
                elif '}' in keys:
                    # Wheel down
                    button_id = 5
                keys = keys.replace(',', '')
                keys = keys.replace('.', '')
                keys = keys.replace('[', '')
                keys = keys.replace(']', '')
                keys = keys.replace('{', '')
                keys = keys.replace('}', '')
                try:
                    column_number, line_number, x_offset, y_offset = find_coordinates(
                        keys, text)
                except TypeError:
                    print(keys, 'no found')
                    continue
                x_coordinate = first_word_mouse_location[
                    'x'] + column_number * column_spacing
                y_coordinate = first_word_mouse_location[
                    'y'] + line_number * line_spacing
                x_coordinate += x_offset
                y_coordinate += y_offset
                digits = list(filter(str.isdigit, keys))
                if digits:
                    number = int(''.join(digits))
                else:
                    number = 1
                print('Clicking', 'x:', x_coordinate, 'y:', y_coordinate,
                      'times:', number)
                for _ in range(number):
                    sh.xdotool("mousemove", x_coordinate, y_coordinate, action,
                               button_id)
                    time.sleep(0.1)
            with open(command_file_path, 'w') as command_file:
                command_file.write(command)
            with open(text_file_path, 'w') as text_file:
                text_file.write(text)
Пример #17
0
def sigusr2(signum, frame):
    scheduler.reverse = True
    logging.info('USR1 received, skipping.')
    sh.killall('omxplayer.bin', _ok_code=[1])
Пример #18
0
def kill_cmd(program):
  sh.killall('-9', program, _bg=True)
Пример #19
0
 def stop(self):
     try:
         sh.killall('omxplayer.bin', _ok_code=[1])
     except OSError:
         pass
Пример #20
0
def kill_player():
    sh.killall('omxplayer-loop', _ok_code=[1])