automatic video audio preview with dolphin kde hovering a file


when you are hovering a file it’s nice to get a preview of audio and video to search fast your file …. and yes why not to run a player and listen your music. ok so this is a feature that is missing from kde3 age.

i did in two ways :

-using phonon for that here => https://nowardev.wordpress.com/2014/03/18/automatic-videoaudio-preview-hovering-a-file-with-phonon-in-dolphin-kde-file-manager/

-modifing tooltips , but it looks weird , keeep reading this article

 

on kubuntu forum i got the method and i have modified a little bit

i wanted one program so ffplay and not 2 program sox and ffplay to do the job . so i have created a little program called ffplaykpreview and i have saved on /usr/bin/ffplaykpreview

THIS IS VERY IMPORTANT CUZ THIS MODIFICATION IT’S BASED ON MY LITTLE SCRIPT , why ? well i wanted to show a window if it’s a video but not if i select an audio\video file so ….

FIRST STEP GET THE SCRIPT AND PUT IT ON USR BIN FOLDER WITH EXECTABLE PERMISSION

cd $HOME ; wget https://kde-peace-settings.googlecode.com/files/ffplaykpreview ; sudo cp ffplaykpreview /usr/bin ; sudo chmod +x /usr/bin/ffplaykpreview

this is ugly dirty what you want but it’s good for me so shut up😀

you have 2 choices

YOU DON’T TRUST ME AND YOU WANT TO TRY TO COMPILE YOURSELF

YOU TRUST ME AND YOU CAN USE MY OWN DEBIAN PACKAGE FOR 64BIT KUBUNTU 13.10 I DUNNO MAYBE IT COULD WORK ON DEBIAN :

IF YOU DO NOT WANT COMPILE FOR 64BIT AND KDE 4.11.2 KUBUNTU 13.10 I HAVE MADE THE PACKAGE HERE IT IS you have now every thing just go to the last step and configure kwin

SECOND STEP : MODIFY TOOLTIPMANAGER.CPP

IF YOU DON’T TRUST ME :

you need to install packages to compile dolphin and some basics stuff make etc after that you need to edit a file ==> kate tooltipmanager.cpp

here there is a line for kubuntu

cd $HOME ; sudo apt-get build-dep dolphin; sudo apt-get install build-essential dpkg-dev fakeroot ; cd $HOME ; apt-get source dolphin ; cd kde-baseap* ; cd dolphin ; cd src ; cd views ; cd tooltips ; kate tooltipmanager.cpp;cd $HOME/kde-baseap*

so this is my own tooltipmanger.cpp tooltipmanager.cpp THAT YOU CAN USE TO SEE IF YOU HAVE DONE WELL I SUGGEST TO USE THIS BECAUSE MAYBE WORDPRESS CAN FUCK THE STUFF PUTTING SOME WEIRD CHARACTERS OR SPACE THAT COULD BE A PROBLEM

NOTE THAT FILE COULD CHANGE FROM KDE 4.11.2 RELEASE SO BE CAREFULL JUST READ AND TRY TO EDIT IF YOU SEE THE FILES ARE VERY DIFFERENT OR YOU CAN TRY TO USE THAT FILE AND TO COMPILE

now you should add these line ..
after all #include  put this

#include <QProcess>

after

if (m_fileMetaDataToolTip) {
 m_fileMetaDataToolTip->hide();
 // Do not delete the tool tip immediately to prevent crashes when
 // QCoreApplication tries to deliver an 'Enter' event to it, see bug 310579.
 m_fileMetaDataToolTip->deleteLater();
 m_fileMetaDataToolTip = 0;
//=======>ADD THIS SHIT kill the player and this case is my own script called ffplaykpreview ===========
QObject *parent;
QString program = "/usr/bin/pkill";
QStringList arguments;
arguments << "-f" << "/usr/bin/ffplaykpreview";
QProcess *killPlay = new QProcess(parent);
killPlay->start(program, arguments);

now the last part it’s this after

 // Step #3 - Alter tooltip geometry
 m_fileMetaDataToolTip->setFixedSize(size);
 m_fileMetaDataToolTip->layout()->setSizeConstraint(QLayout::SetNoConstraint);
 m_fileMetaDataToolTip->move(QPoint(x, y));
 m_fileMetaDataToolTip->show();
m_toolTipRequested = false;

 //=====> ADD THIS SHIT ========= 

 QObject *parent;
 QString program = "/usr/bin/ffplaykpreview";
 QStringList arguments;
 arguments << "-x" << "640" << "-y" << "480" << m_item.localPath();
 QProcess *startPlay = new QProcess(parent);
 startPlay->start(program, arguments);

So now save the file and exit from kate

THIRD STEP : COMPILE DOLPHIN AND INSTALL IT

if you have kubuntu you can run this to build hte package that you will find in your home and install it

sudo dpkg-buildpackage -b -rfakeroot -us -uc ;cd $HOME;  sudo dpkg -i dolphin*.deb

for other distro try to see how you can do the same compile generate the package and install the package

FOURTH STEP : SET KWIN FOR THE FOCUS ISSUE

if you try now your dolphin it should work fine on audio files but on video files ffplay dies as you hover the file cuz dolphin is losing the focus when ffplay starts so … you need to fix this in this way :

you need to take a video and play it with ffplay while it’s playing your shit go on

systemsettings ==> windows behavior ===> windows rules ==> NEW

click on DETECT WINDOW PROPERTIES and click on ffplay , as you can see it’s called WTF AVPLAY , becuase canonical has this fuckin avplay instead of ffplay anyway …. you should see this kind of stuff
DOLPHInpreview

now go on Appearance and Fixes THE IMPORTANT STUFF IT’S THE FOCUS so select Focus stealing prevention and select force too as you can see down here

DOLPHInpreview1

now go on Arrangement and Access and click on KEEP ABOVE FORCE and select YES ok the other stuff it’s optional

DOLPHInpreview3

now move the new rule up

DOLPHInpreview2

now you have everything it should work properly with ffplay only😀

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: