#!/bin/bash
#Written by Matthew Headlee 20170208
#Send all output to null, comment out for debugging.
exec &> /dev/null
#Function eClementineGetState() checks current state of media playback
#returns 0 if media is playing, 1 if paused, 2 if stopped, 3 if not running
eClementineGetState() {
iClemPID=$(pgrep -x clementine)
if [ ! -z "${iClemPID}" ]; then
for sFileDes in $(find /proc/${iClemPID}/fd -type l); do
if file -bi "$(readlink -f ${sFileDes})" | awk '!/video|audio/ {exit 1}'; then
#echo "Playing or Paused."
echo "Media File Handle is ${sFileDes}"
sFileDesInfo="/proc/${iClemPID}/fdinfo/$(basename ${sFileDes})"
iFilePosA=$(awk '/pos:/ {print $2}' "${sFileDesInfo}")
sleep .1
iFilePosB=$(awk '/pos:/ {print $2}' "${sFileDesInfo}")
if [ "${iFilePosA}" -ne "${iFilePosB}" ]; then
echo "Playing."
return 0
fi
echo "Paused."
return 1
fi
done
echo "Stopped."
return 2
fi
echo "Media Player Not Found."
return 3
}
eClementineGetState
[ "${?}" -eq 1 ] && clementine --play
Clementine resume the music only if before paused.
Good morning. I am searching for "how-to"'s for some particular questions:
1. How to write a script in HP-UX 11.
2. How to schedule a script.
3. How to "call" scripts from the original script.
4. How to su to another user from within a script.
This is the basics of what the... (15 Replies)
Hi!
I've downloaded the static version (skype_static-2.1.0.81.tar.bz2) and extracted it. Then I tried to start the Skype executable file (./skype) via the terminal but nothing happens.
root@xxx:~# ls
skype_static-2.1.0.81/ skype_static-2.1.0.81.tar.bz2
root@xxx:~# cd skype_static-2.1.0.81... (2 Replies)
Hello,
I want to design a script that will call an existing menu script and select options one by one and redirict the out put to a file.
For example;-
In the script MENU.sh there are 10 options i want to design a script MENU2.sh that will select option 2 3 4 6 7 10 and redirict the output... (4 Replies)
Hello All,
I need immediate help in creating shell script to call archivebkup.ksh script when archive file system capacity reaches threshold value or 60%
Need to identify the unique file system that reaches threshold value.
ex:
capacity
... (4 Replies)
I'm attempting to write a bash script that will create a network between virtual machines. It accepts three arguments: an RSpec that describes the network topology, and two list of machines (servers and clients).
I have a (working) Perl script that I want to call. This Perl script takes an RSpec... (6 Replies)
I recently bought a new HP Spectre x360 laptop and installed Ubuntu 15.10. (I originally went with a later version but I was encountering lots of bugs. This version seems to be more stable for my system).
Things are mostly working okay, but not my webcam.
If I go to a website to test it, it's... (0 Replies)
Discussion started by: twelth_hour
0 Replies
LEARN ABOUT PHP
mssql_field_seek
MSSQL_FIELD_SEEK(3)MSSQL_FIELD_SEEK(3)mssql_field_seek - Seeks to the specified field offsetSYNOPSIS
bool mssql_field_seek (resource $result, int $field_offset)
DESCRIPTION
Seeks to the specified field offset. If the next call to mssql_fetch_field(3) won't include a field offset, this field would be returned.
PARAMETERS
o $result
- The result resource that is being evaluated. This result comes from a call to mssql_query(3).
o $field_offset
- The field offset, starts at 0.
RETURN VALUES
Returns TRUE on success or FALSE on failure.
EXAMPLES
Example #1
Using mssql_field_seek(3) on the example for mssql_fetch_field(3)
<?php
// Connect to MSSQL and select the database
mssql_connect('MANGOSQLEXPRESS', 'sa', 'phpfi');
mssql_select_db('php');
// Send a select query to MSSQL
$query = mssql_query('SELECT * FROM [php].[dbo].[persons]');
// Construct table
echo '<h3>Table structure for 'persons'</h3>';
echo '<table border="1">';
// Table header
echo '<thead>';
echo '<tr>';
echo '<td>Field name</td>';
echo '<td>Data type</td>';
echo '<td>Max length</td>';
echo '</tr>';
echo '</thead>';
// Dump all fields
echo '<tbody>';
for ($i = 0; $i < mssql_num_fields($query); ++$i) {
// Fetch the field information, notice the
// field_offset parameter is not set. See
// the mssql_field_seek call below
$field = mssql_fetch_field($query);
// Print the row
echo '<tr>';
echo '<td>' . $field->name . '</td>';
echo '<td>' . strtoupper($field->type) . '</td>';
echo '<td>' . $field->max_length . '</td>';
echo '</tr>';
// Move the internal seek pointer to the next
// row in the result set
mssql_field_seek($query, $i + 1);
}
echo '</tbody>';
echo '</table>';
// Free the query result
mssql_free_result($query);
?>
SEE ALSO mssql_fetch_field(3).
PHP Documentation Group MSSQL_FIELD_SEEK(3)