Need a script to autopause clementine on skype call


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need a script to autopause clementine on skype call
# 8  
Old 02-08-2017
So, do you think that there is a solution?
# 9  
Old 02-08-2017
Depends, does clementine print any status information? I can't tell.
# 10  
Old 02-08-2017
I found this script to get clementine status: https://groups.google.com/forum/#!topic/clementine-player/uTuuZaN_taY.
But I'm not a developer, it's complicated for me Smilie
# 11  
Old 02-08-2017
Oh, that digs deep into /proc/ to figure out if clementine has an audio device open. If they're going to those desperate lengths, then no, Clementine does not print status information. But maybe we can work with that.

Code:
PID=$(pgrep -x "clementine")

[ -z "$PID" ] && exit # Skip if Clementine's not running

if ls -l /proc/$PID/fd | egrep -q 'audio|video'
then
        # clementine is playing or paused
        clementine -t
fi

This depends on the names of the device files though. If you could show what ls -l /proc/clementinepid/fd/ really looks like during playback, during pause, and when stopped, that would help.

Last edited by Corona688; 02-08-2017 at 12:34 PM..
This User Gave Thanks to Corona688 For This Post:
# 12  
Old 02-08-2017
Error message:
Code:
$ ls -l /proc/clementinepid/fd/
ls: cannot access /proc/clementinepid/fd/: No such file or directory

Searching in /proc: no file o folder naming clementine, even the program is open and running.
# 13  
Old 02-08-2017
I don't literally mean 'clementinepid'. I mean, clementine's PID. It's the number printed by 'pgrep -x clementine'.
This User Gave Thanks to Corona688 For This Post:
# 14  
Old 02-08-2017
When paused:
Code:
$ ls -l /proc/7070/fd/
total 0
lr-x------ 1 duns duns 64 feb  8 17:31 0 -> pipe:[452182]
l-wx------ 1 duns duns 64 feb  8 17:31 1 -> pipe:[10435]
l-wx------ 1 duns duns 64 feb  8 17:31 2 -> pipe:[10436]
lrwx------ 1 duns duns 64 feb  8 17:31 27 -> socket:[212703]
lrwx------ 1 duns duns 64 feb  8 17:31 3 -> anon_inode:[eventfd]
lrwx------ 1 duns duns 64 feb  8 17:31 33 -> socket:[212704]
lr-x------ 1 duns duns 64 feb  8 17:31 4 -> pipe:[452189]
l-wx------ 1 duns duns 64 feb  8 17:31 5 -> pipe:[452189]
lrwx------ 1 duns duns 64 feb  8 17:31 6 -> socket:[452190]
[duns@localhost ~]$

When playing:
Code:
$ ls -l /proc/7070/fd/
total 0
lr-x------ 1 duns duns 64 feb  8 17:31 0 -> pipe:[452182]
l-wx------ 1 duns duns 64 feb  8 17:31 1 -> pipe:[10435]
l-wx------ 1 duns duns 64 feb  8 17:31 2 -> pipe:[10436]
lrwx------ 1 duns duns 64 feb  8 17:31 27 -> socket:[212703]
lrwx------ 1 duns duns 64 feb  8 17:31 3 -> anon_inode:[eventfd]
lrwx------ 1 duns duns 64 feb  8 17:31 33 -> socket:[212704]
lr-x------ 1 duns duns 64 feb  8 17:31 4 -> pipe:[452189]
l-wx------ 1 duns duns 64 feb  8 17:31 5 -> pipe:[452189]
lrwx------ 1 duns duns 64 feb  8 17:31 6 -> socket:[452190]

When stopped:
Code:
$ ls -l /proc/7070/fd/
total 0
lr-x------ 1 duns duns 64 feb  8 17:31 0 -> pipe:[452182]
l-wx------ 1 duns duns 64 feb  8 17:31 1 -> pipe:[10435]
l-wx------ 1 duns duns 64 feb  8 17:31 2 -> pipe:[10436]
lrwx------ 1 duns duns 64 feb  8 17:31 27 -> socket:[212703]
lrwx------ 1 duns duns 64 feb  8 17:31 3 -> anon_inode:[eventfd]
lrwx------ 1 duns duns 64 feb  8 17:31 33 -> socket:[212704]
lr-x------ 1 duns duns 64 feb  8 17:31 4 -> pipe:[452189]
l-wx------ 1 duns duns 64 feb  8 17:31 5 -> pipe:[452189]
lrwx------ 1 duns duns 64 feb  8 17:31 6 -> socket:[452190]

Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. Ubuntu

Webcam and Skype not working properly

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

2. Shell Programming and Scripting

Call a Perl script within a bash script and store the ouput in a .txt file

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)
Discussion started by: mecaka
6 Replies

3. Shell Programming and Scripting

Shell script to call Oracle archive backup script when file system reaches threshold value

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)
Discussion started by: sasikanthdba
4 Replies

4. Shell Programming and Scripting

Script to call a menu script and redirect each option to a text file

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)
Discussion started by: spradha
4 Replies

5. Slackware

Skype on Slackware 64

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)
Discussion started by: intelfan
2 Replies

6. Shell Programming and Scripting

how to run script? call other script? su to another user? make a cron?

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)
Discussion started by: instant000
15 Replies
Login or Register to Ask a Question