vlc qdbus interface add track and delete track


i enjoyed when i understood some thing and i like very much when i get how to control via bash\qdbus vlc.

the first stuff you need it’s ENABLE QDBUS INTERFACE on vlc

go to Tools -> Preferences -> Show all -> Interface -> Control Interface and Enable DBus

then you can control vlc with this

ADD TRACK :

qdbus org.mpris.vlc /TrackList org.freedesktop.MediaPlayer.AddTrack “PATH OF THE FILE” 1

or for a streaming

 qdbus org.mpris.vlc /TrackList   org.freedesktop.MediaPlayer.AddTrack    "mms://84.233.254.2/3Channel" 1 

DELETE TRACK

qdbus org.mpris.vlc /TrackList   org.freedesktop.MediaPlayer.DelTrack   0 

to see many other control you can run , like you can see in the picture…

qdbusviewer

Advertisements

kdialog qdbus progress bar


if you have a brain you should understand this and how it works :

sudo apt-get install qt4-dev-tools #for qdbusviewer so you can undestand a bit qdbus & kdialog

mystufvariabletouseonmyscript=$(kdialog --progressbar "hello this is a progress bar with 100 steps" 100) ; sleep 2 ; qdbus $mystufvariabletouseonmyscript org.kde.kdialog.ProgressDialog.setLabelText "omg i have changed text" ; sleep 2 ; qdbus $mystufvariabletouseonmyscript showCancelButton true ;qdbus $mystufvariabletouseonmyscript org.kde.kdialog.ProgressDialog.setLabelText "omg now there is cancel button" ;sleep 2; qdbus $mystufvariabletouseonmyscript Set org.kde.kdialog.ProgressDialog value 30 && qdbus $mystufvariabletouseonmyscript org.kde.kdialog.ProgressDialog.setLabelText "omg i have change the value";sleep 2 ; qdbus $mystufvariabletouseonmyscript Set org.kde.kdialog.ProgressDialog value 0 ;qdbus $mystufvariabletouseonmyscript org.kde.kdialog.ProgressDialog.setLabelText "Now you can click on the cancel button to stop a process" ;until test "true" = `qdbus $mystufvariabletouseonmyscript wasCancelled` ; do sleep 1 ; inc=$((`qdbus $mystufvariabletouseonmyscript Get "" "value"`+1)); qdbus $mystufvariabletouseonmyscript Set org.kde.kdialog.ProgressDialog value $inc; done

an example with youtube-dl that is pretty nasty , this example was prepared with the big help of Vincenzo Tibullo

a=$(kdialog --progressbar "YouTube-dl will download the file" 100);sleep 2 ; while read line ; do qdbus $a Set org.kde.kdialog.ProgressDialog value $line ; done < <(youtube-dl -t "http://www.youtube.com/watch?v=5Lv8eksIoRg&list=UUraFXVifKFyN66mtTP67ZwQ&index=1" |stdbuf -o0 tr '\r' '\n' |mawk -W interactive '{ print int($2+0) }')

an example with wget

ESC_SEQ="\x1b["
COL_RESET=$ESC_SEQ"39;49;00m"
COL_RED=$ESC_SEQ"31;01m"
COL_GREEN=$ESC_SEQ"32;01m"
COL_YELLOW=$ESC_SEQ"33;01m"
COL_BLUE=$ESC_SEQ"34;01m"
COL_MAGENTA=$ESC_SEQ"35;01m"
COL_CYAN=$ESC_SEQ"36;01m"

link="https://github.com/nowardev/kde-peace-settings/archive/master.zip" #my own github stuff 
a=$(kdialog --progressbar "W-Get will  download: Nowardev GitHub Master stuff " 100);sleep 2
qdbus $a  showCancelButton true

while read line ;do
read -r p t <<< "$line"
echo $p 
echo $t 
qdbus $a Set org.kde.kdialog.ProgressDialog value $p

	while [[  $(qdbus  $a wasCancelled) != "false" ]] ; do
		echo -e " $COL_RED  THE PROCESS AND KDIALOG COL_RESET "
		qdbus $a  org.kde.kdialog.ProgressDialog.close 
		
		exit
	done
			

qdbus $a org.kde.kdialog.ProgressDialog.setLabelText "W-Get will  download: Nowardev GitHub Master stuff  time left : $t" 


done< <(wget "$link" 2>&1 |mawk -W interactive '{ gsub(/\%/," "); print int($7)" "$9 }')

and example with axel

a=$(kdialog --progressbar "Axel  will  download: Kubuntu 14.10 32 bit " 100);sleep 2 ; qdbus $a  showCancelButton true; while read line ; do while [[  $(qdbus  $a wasCancelled) != "false"  ]] ; do echo -e "$COL_RED ECHO KILLING AXEL AND KDIALOG $COL_RESET" ; qdbus $a  org.kde.kdialog.ProgressDialog.close ; exit ;done ; if [[ $lineold != $line ]]; then qdbus $a Set org.kde.kdialog.ProgressDialog value $line ; fi ;  lineold=$line ; done  < <( axel -n 10 http://cdimage.ubuntu.com/kubuntu/daily-live/current/vivid-desktop-i386.iso | mawk -W interactive  -F']' '{gsub(/ /,"");gsub(/\[/,"");gsub(/\%/,"");print $1}') 

bash: close kde with bash using qdbus


for kde 4.XX

qdbus org.kde.ksmserver /KSMServer logout 0 2 0

for kde 3.XX

dcop –all-users –all-sessions ksmserver ksmserver logout 0 2 0

logout 0 -1 -1

First parameter: confirm

Obey the user’s confirmation setting: -1
Don’t confirm, shutdown without asking:  0
Always confirm, ask even if the user turned it off: 1

Second parameter: type

Select previous action or the default if it’s the first time: -1
Only log out: 0
Log out and reboot the machine: 1
Log out and halt the machine: 2

Third parameter: mode

Select previous mode or the default if it’s the first time: -1
Schedule a shutdown (halt or reboot) for the time all active sessions have
exited: 0
Shut down, if no sessions are active. Otherwise do nothing: 1
Force shutdown. Kill any possibly active sessions: 2
Pop up a dialog asking the user what to do if sessions are still activ

suspend to ram kde 4

dbus-send --print-reply --dest='org.freedesktop.PowerManagement' /org/freedesktop/PowerManagement org.freedesktop.PowerManagement.Suspend 

article by

mail list
and
http://samwiseandthestereotypical.blogspot.com/