Announcement

Collapse
No announcement yet.

Auto preview audio and video files in the Dolphin and Konqueror

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Auto preview audio and video files in the Dolphin and Konqueror




    Linking to http://www.kubuntuforums.net/showthr...295#post331295



    Standard warning

    This is quick&dirty: http://en.wikipedia.org/wiki/Quick-and-dirty - it is working at here, there it may eat the puppies&kittens and tease the hens: https://www.youtube.com/watch?v=6PFrfB685zs&hd=1


    Concept

    The Dolphin tooltips (.../kde-baseapps/dolphin/src/views/tooltips/tooltipmanager.cpp) have:

    Code:
    void ToolTipManager::showToolTip()
    and
    Code:
    void ToolTipManager::hideToolTip()
    =>

    1) Starting a media player when the tooltip is shown.
    2) Terminating a media player when the tooltip is removed.


    Needed

    - The Dolphin source
    - media player, tested with the Sox (play) & FFmpeg (ffplay)

    man play:
    SoX(1) Sound eXchange SoX(1)

    NAME
    SoX - Sound eXchange, the Swiss Army knife of audio manipulation

    ...
    play [global-options] [format-options] infile1
    [[format-options] infile2] ... [format-options]
    [effect [effect-options]] ...
    ...
    ffplay -h
    Simple media player
    usage: ffplay [options] input_file
    ...
    ffplay version 2.0 Copyright (c) 2003-2013 the FFmpeg developers
    built on Jul 15 2013 07:09:57 with gcc 4.7 (Ubuntu/Linaro 4.7.3-1ubuntu1)
    configuration: --prefix=/opt/ffmpeg --libdir=/opt/ffmpeg/lib/ --enable-shared...

    Packages:
    - build-essential
    - dpkg-dev
    - fakeroot
    - kde-baseapps build-dependencies (the build will tell what is missing)


    Audio preview with Sox - play

    Adding:

    Code:
    #include <QProcess>
    and
    Code:
    void ToolTipManager::showToolTip()
    {
    ...
        //Start Play
        QObject *parent;
        QString program = "/usr/bin/play";
        QStringList arguments;
        arguments << m_item.localPath();
        QProcess *startPlay = new QProcess(parent);
        startPlay->start(program, arguments);
    ...
    }
    Code:
    void ToolTipManager::hideToolTip()
    {
    ...
            //Kill PLay
            QObject *parent;
            QString program = "/usr/bin/pkill";
            QStringList arguments;
            arguments << "-f" << "/usr/bin/play";
            QProcess *killPlay = new QProcess(parent);
            killPlay->start(program, arguments);
    ...
    }
    As difference file: http://pastebin.com/GRhqS7hY


    Media preview with FFmpeg - ffplay

    The difference file for the ffplay: http://pastebin.com/TXR3APd7


    Example

    1) Getting the Dolphin source

    $ sudo apt-get source dolphin
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    Picking 'kde-baseapps' as source package instead of 'dolphin'
    NOTICE: 'kde-baseapps' packaging is maintained in the 'Bzr' version control system at:
    https://code.launchpad.net/~kubuntu-...g/kde-baseapps
    Please use:
    bzr branch https://code.launchpad.net/~kubuntu-...g/kde-baseapps
    to retrieve the latest (possibly unreleased) updates to the package.
    Need to get 2,687 kB of source archives.
    Get:1 http://fi.archive.ubuntu.com/ubuntu/ saucy/universe kde-baseapps 4:4.10.90-0ubuntu1 (dsc) [3,731 B]
    Get:2 http://fi.archive.ubuntu.com/ubuntu/ saucy/universe kde-baseapps 4:4.10.90-0ubuntu1 (tar) [2,589 kB]
    Get:3 http://fi.archive.ubuntu.com/ubuntu/ saucy/universe kde-baseapps 4:4.10.90-0ubuntu1 (diff) [94.3 kB]
    Fetched 2,687 kB in 19s (135 kB/s)
    gpgv: Signature made Fri 28 Jun 2013 09:13:10 PM EEST using RSA key ID F2672094
    gpgv: Can't check signature: public key not found
    dpkg-source: warning: failed to verify signature on ./kde-baseapps_4.10.90-0ubuntu1.dsc
    dpkg-source: info: extracting kde-baseapps in kde-baseapps-4.10.90
    dpkg-source: info: unpacking kde-baseapps_4.10.90.orig.tar.xz
    dpkg-source: info: unpacking kde-baseapps_4.10.90-0ubuntu1.debian.tar.gz
    dpkg-source: info: applying enable_debianabimanager.diff
    dpkg-source: info: applying kubuntu_folderview_livecd_directory.diff
    dpkg-source: info: applying kubuntu_folderwidget_drawing.diff
    dpkg-source: info: applying kubuntu_install_flash.diff
    dpkg-source: info: applying kubuntu_konq_scans_nsplugins_at_startup.diff
    dpkg-source: info: applying enable_dlrestrictions.diff
    2) Moving to the .../kde-baseapps/dolphin/src/views/tooltips/ and editing the tooltipmanager.cpp.



    Adding the code snippets, saving...

    3) Moving to the /kde-baseapps-4.X.X directory.

    Trying the build:
    Code:
    dpkg-buildpackage -b -rfakeroot -us -uc
    There are missing packages:
    dpkg-checkbuilddeps: Unmet build dependencies: libdlrestrictions-dev (>= 0.14) libkactivities-dev (>= 4:4.10.90) nepomuk-core-dev (>= 4:4.10.90) libnepomukwidgets-dev (>= 4:4.10.90) libqimageblitz-dev (>= 1:0.0.4-2) libstreamanalyzer-dev (>= 0.6.3) libtidy-dev
    installing those...

    Trying the build again.

    => Lot of packages. Only the Dolphin is needed. The Konqueror is sharing the tooltips.

    4) Installing the Dolphin



    5) Testing

    - Shutting all Dolphins.
    - Starting the Dolphin and enabling the tooltips.
    - testing

    Note #1


    The ffplay needs the focus stealing prevention !!!!!!!!!!!!!!!!: KDE System Settings > Window Behavior > Window rules.





    Note #2
    Back to the standard Dolphin:
    Code:
    sudo apt-get clean
    sudo apt-get install --reinstall dolphin
    Last edited by OneLine; Nov 18, 2013, 11:59 AM.
    Have you tried ?

    - How to Ask a Question on the Internet and Get It Answered
    - How To Ask Questions The Smart Way

    #2
    ... and using the .diff files
    (KDE 4.10.5 Dolphin tooltipmanager.cpp = KDE 4.10.95 Dolphin tooltipmanager.cpp)





    man patch (package patch)
    PATCH(1) General Commands Manual PATCH(1)

    NAME
    patch - apply a diff file to an original

    SYNOPSIS
    patch [options] [originalfile [patchfile]]

    but usually just

    patch -pnum <patchfile

    DESCRIPTION
    patch takes a patch file patchfile containing a difference listing produced by the diff program and applies those differences to one or more original files, producing patched versions. Normally the patched versions are put in place of the originals...

    Example

    .../views/tooltips$ patch tooltipmanager.cpp < tooltipmanager.diff
    patching file tooltipmanager.cpp
    'No news is good news' in this case.
    Last edited by OneLine; Jul 22, 2013, 04:05 AM.
    Have you tried ?

    - How to Ask a Question on the Internet and Get It Answered
    - How To Ask Questions The Smart Way

    Comment


      #3
      A step forward - MouseOverAction.sh

      The mouse over action can be a bit more flexible if the tooltips calls a script file and the script file calls the players:



      Start play code:

      Code:
          //Start Play
          //http://api.kde.org/4.x-api/kdelibs-apidocs/kio/html/classKFileItem.html
          //using m_item.mimetype() and m_item.localPath()
          QObject *parent;
          QString program = "/usr/local/bin/MouseOverAction.sh";
          QStringList arguments;
          arguments << m_item.mimetype() << m_item.localPath();
          QProcess *startPlay = new QProcess(parent);
          startPlay->start(program, arguments);
      The MouseOverAction.sh is simple script file with cases. An example /usr/local/bin/MouseOverAction.sh:
      Code:
      #!/bin/sh
      
      # MouseOverAction.sh Mimetype file
      
      case "$1" in
      
            audio/x-ms-wma)
            ffplay -nodisp "$2"
            ;;
      
            audio/*)
            play "$2"
            ;;
      
            video/*)
            ffplay -x 640 -y 480 "$2"
            ;;
            
            *)
      #     case trap
            exit
      
      esac
      The wma files are played with the ffplay (ffmpeg) other audio files are played with the play (SoX).



      An example tooltipmanger.cpp: http://pastebin.com/Yj4yALUX


      There can be more that one...

      There can be more than one Dolphin installed:


      The Dolphin+ plays previews - the standard Dolphin works as fallback

      Last edited by Rog132; Nov 18, 2013, 12:05 PM.
      A good place to start: Topic: Top 20 Kubuntu FAQs & Answers
      Searching FAQ's: Google Search 'FAQ from Kubuntuforums'

      Comment


        #4
        Dolphin+

        Building alternative versions of the KDE applications - Dolphin+

        KDE CMake Tutorial: http://techbase.kde.org/Development/Tutorials/CMake

        Needed from the kde-baseapps sources:

        Directories:
        - dolphin
        - konqueror
        - lib

        Files:
        - CmakeLists.txt
        - *.cmake



        Edit the CMakeLists.txt
        - add CMAKE_PREFIX_PATH and CMAKE_INSTALL_PREFIX
        - disable/comment out the unneeded directories (kdialog/keditbookmarks/...)

        Add the MouseOverAction.sh code to the tooltipmanager.cpp: http://pastebin.com/trgvFBCw



        Build

        Code:
        mkdir -p builddir
        cd builddir && cmake .. -DCMAKE_INSTALL_PREFIX=/<Your_Path_Here>
        make

        Drag&Drop the Dolphin and the library binaries to the destination - at here to the /opt.



        Add the Dolphin+ to the KDE Menu.




        From the PPA: https://launchpad.net/~samrog131/+ar...series_filter=
        Last edited by Rog132; Nov 28, 2013, 10:30 AM.
        A good place to start: Topic: Top 20 Kubuntu FAQs & Answers
        Searching FAQ's: Google Search 'FAQ from Kubuntuforums'

        Comment


          #5
          Setting up the preview with the Dolphin+

          Copy the MouseOverAction.sh to the /usr/local/bin




          Check that the script is executable.




          Examine the MouseOverAction.sh:
          Code:
          #!/bin/sh
          # Execute: MouseOverAction.sh mimetype file
          #
          # This example script is working at here with
          # the 1920x1080 screen.
          #
          # It is using: 
          # - xdotool to read the mouse location
          # - wmctrl to move, scale and raise the preview window
          # - sox (play) to play audio files
          # - ffmpeg (ffplay) to play video and audio files
          #
          # The video preview (ffplay) needs to set the focus
          # stealing prevention for the ffplay: 
          # KDE System Settings > Window Behavior > Window rules
          #
          # Remember to set the script execute permission !
          
          # ffplay options
          windowTitle=ffplayAutoPreview
          
          # screen size
          screenWidht=1920
          screenHeight=1080
          
          
          # move/scale/raise the preview window
          movingWindows ()
          {
          # Call: movingWindows windowtitle widht height
          
          localwindowTitle="$1"
          localscreenWidht="$2"
          localscreenHeight="$3"
          
          # preview window size
          widht=$(( localscreenWidht / 3 ))
          height=$(( localscreenHeight / 3 ))
          
          # wait preview window
             until wmctrl -l | grep "$localwindowTitle" ; do
                echo waiting >/dev/null
             done
          
          # mouse location $X,$Y
             eval $(xdotool getmouselocation --shell)
          
          # preview window location
             if [ $X -le $(( localscreenWidht / 2 )) ] ; then 
                deltaX=$(( widht / 2 ))
             else
                deltaX=$(( -3 * widht / 2 ))
             fi
          
             if [ $Y -le $(( localscreenHeight / 2 )) ] ; then 
                deltaY=$(( -height / 2 ))
             else
                deltaY=$(( -3 * height / 2 ))
             fi
          
             previewX=$((X + deltaX))
             if [ $previewX -lt 0 ] ; then previewX=0 ; fi
             previewY=$((Y + deltaY))
             if [ $previewY -lt 0 ] ; then previewY=0 ; fi
          
          # move & resize and raise the preview window
             wmctrl -r "$localwindowTitle" -e "0,$previewX,$previewY,$widht,$height"
             wmctrl -r "$localwindowTitle" -b add,above
          }
          
          
          # preview options by mime type
          case "$1" in
          
                audio/x-ms-wma)
                ffplay -nodisp "$2"
                exit
                ;;
          
                audio/*)
                play "$2"
                exit
                ;;
          
                video/*|application/x-flash-video|application/vnd.ms-asf|application/vnd.rn-realmedia)
                movingWindows $windowTitle $screenWidht $screenHeight &
                ffplay -window_title "$windowTitle" -x 1 -y 1 "$2"
                ;;
                
                *)
          #     case trap
                exit
                
          esac
          Set your screen and player settings.


          Prevent the focus stealing.

          Start the video preview app (ffplay). Right click the window top boarder > More Actions > Special Application Settings



          Edit Application Specific Settings and set the 'Focus stealing prevention'




          Turn the tooltips on.




          Start to preview:



          Direct: http://youtu.be/C4pGlLdIEbk
          Last edited by Rog132; Dec 01, 2013, 01:21 PM.
          A good place to start: Topic: Top 20 Kubuntu FAQs & Answers
          Searching FAQ's: Google Search 'FAQ from Kubuntuforums'

          Comment


            #6
            About the MouseOverAction.sh

            The MouseOverAction is using the xdotool to read the mouse location and wmctrl to move, scale and raise the preview window.

            Package xdotool
            Package: xdotool
            Priority: extra
            Section: universe/x11
            ...
            Description simulate X11 keyboard/mouse input
            xdotool lets you programatically (or manually) simulate keyboard
            input and mouse activity, move and resize windows, etc. It does this
            using X11's XTEST extension and other Xlib functions.
            ...
            Homepage: http://www.semicomplete.com/blog/projects/xdotool/
            man xdotool
            NAME
            xdotool - command-line X11 automation tool

            SYNOPSIS
            xdotool cmd args...

            Notation: Some documentation uses [window] to denote an optional window argument. This case means that the
            argument, if not present, will default to "%1". See "WINDOW STACK" for what "%1" means.

            DESCRIPTION
            xdotool lets you programatically (or manually) simulate keyboard input and mouse activity, move and resize
            windows, etc. It does this using X11's XTEST extension and other Xlib functions.

            There is some support for Extended Window Manager Hints (aka EWMH or NetWM). See the "EXTENDED WINDOW MANAGER
            HINTS" section for more information...

            Package: wmctrl
            Package: wmctrl
            Priority: optional
            Section: universe/x11
            ...
            Description: control an EWMH/NetWM compatible X Window Manager
            Wmctrl is a command line tool to interact with an
            EWMH/NetWM compatible X Window Manager (examples include
            Enlightenment, icewm, kwin, metacity, and sawfish).
            .
            Wmctrl provides command line access to almost all the features
            defined in the EWMH specification. For example it can maximize
            windows, make them sticky, set them to be always on top. It can
            switch and resize desktops and perform many other useful
            operations.
            ...
            Homepage: http://tomas.styblo.name/wmctrl/

            man wmctrl
            NAME
            wmctrl - interact with a EWMH/NetWM compatible X Window Manager.

            SYNOPSIS
            wmctrl [ options | actions ]...

            DESCRIPTION
            wmctrl is a command that can be used to interact with an X Window manager that is compatible with the
            EWMH/NetWM specification. wmctrl can query the window manager for information, and it can request that cer‐
            tain window management actions be taken.

            wmctrl is controlled entirely by its command line arguments. The command line arguments are used to specify
            the action to be performed (with options that modify behavior) and any arguments that might be needed to per‐
            form the actions.

            The following sections define the supported actions and options. Arguments to the actions and options are
            written in the form <ARGNAME> in the descriptions below. The detailed syntax for writing arguments are in a
            single section dedicated to that purpose...

            Links

            Linux Journal - Hack and / - Automate your Desktop with wmctrl : http://www.linuxjournal.com/magazine...desktop-wmctrl
            A good place to start: Topic: Top 20 Kubuntu FAQs & Answers
            Searching FAQ's: Google Search 'FAQ from Kubuntuforums'

            Comment


              #7
              Automatic video thumbnail animation preview with the Dolphin+

              Another MouseOverAction.sh example:

              Code:
              #!/bin/bash
              # Execute: MouseOverAction.sh mimetype file
              #
              # This example script is working at here with
              # the 1920x1080 screen.
              #
              # It is using: 
              # - xdotool to read the mouse location
              # - wmctrl to move, scale and raise the preview window
              # - Sox (play) to play audio files
              # - ffmpeg (ffplay) to play audio files
              # - ffmpegthumbnailer to make the preview pictures
              # - ImageMagick (animate) to show the preview pictures
              #
              # The video preview need to set the focus
              # stealing prevention for the ImageMagick/animate: 
              # KDE System Settings > Window Behavior > Window rules
              #
              # Remember to set the script execute permission !
              
              # on exit kill the animation
              trap "pkill animate" EXIT
              
              # animate options
              windowTitle=QuickThumbPreview
              
              # screen size
              screenWidht=1920
              screenHeight=1080
              
              # thumbnailer options
              # seek percentage
              previewThumbs=( 05.png 15.png 25.png 35.png 45.png 55.png 65.png 75.png 85.png 95.png )
              # thumbnail size
              size=$(( screenWidht / 3 ))
              
              
              # move/scale/raise the preview window
              movingWindows ()
              {
              # Call: movingWindows windowtitle widht height
              
              localwindowTitle="$1"
              localscreenWidht="$2"
              localscreenHeight="$3"
              
              # preview window size
              widht=$(( localscreenWidht / 3 ))
              height=$(( localscreenHeight / 3 ))
              
              # wait preview window
                 until wmctrl -l | grep "$localwindowTitle" ; do
                    echo waiting >/dev/null
                 done
              
              # mouse location $X,$Y
                 eval $(xdotool getmouselocation --shell)
              
              # preview window location
                 if [ $X -le $(( localscreenWidht / 2 )) ] ; then 
                    deltaX=$(( widht / 2 ))
                 else
                    deltaX=$(( -3 * widht / 2 ))
                 fi
              
                 if [ $Y -le $(( localscreenHeight / 2 )) ] ; then 
                    deltaY=$(( -height / 2 ))
                 else
                    deltaY=$(( -3 * height / 2 ))
                 fi
              
                 previewX=$((X + deltaX))
                 if [ $previewX -lt 0 ] ; then previewX=0 ; fi
                 previewY=$((Y + deltaY))
                 if [ $previewY -lt 0 ] ; then previewY=0 ; fi
              
              # move & resize and raise the preview window
                 wmctrl -r "$localwindowTitle" -e "0,$previewX,$previewY,$widht,$height"
                 wmctrl -r "$localwindowTitle" -b add,above
              }
              
              
              # preview options by mime type
              case "$1" in
              
                    audio/x-ms-wma)
                    ffplay -nodisp "$2"
                    exit
                    ;;
              
                    audio/*)
                    play "$2"
                    exit
                    ;;
              
                    video/*|application/x-flash-video|application/vnd.ms-asf|application/vnd.rn-realmedia)
                    movingWindows $windowTitle $screenWidht $screenHeight &
                    rm -f /tmp/QuickThumb/*.png
                    mkdir -p /tmp/QuickThumb
                    for T in ${previewThumbs[*]}
                    do
                       ffmpegthumbnailer -s $size -t $T -i "$2" -o /tmp/QuickThumb/$T
                    done
                    animate -delay 1x2 -title $windowTitle /tmp/QuickThumb/*.png
                    ;;
                    
                    *)
              #     case trap
                    exit
                    
              esac
              The script is using the ffmpegthumbnailer to make the preview pictures and the ImageMagick (animate) to show the preview pictures.

              man ffmpegthumbnailer
              NAME
              ffmpegthumbnailer - fast and lightweight video thumbnailer

              SYNOPSIS
              ffmpegthumbnailer [options]

              DESCRIPTION
              Ffmpegthumbnailer is a lightweight video thumbnailer that can be used by file managers
              to create thumbnails for your video files. The thumbnailer uses ffmpeg to decode frames
              from the video files, so supported videoformats depend on the configuration flags of
              ffmpeg.

              OPTIONS
              ...

              man animate
              NAME
              animate - animates an image or image sequence on any X server.

              SYNOPSIS
              animate [options] input-file

              OVERVIEW
              The animate program is a member of the ImageMagick(1) suite of tools. Use it to ani‐
              mate an image or image sequence on any X server.

              For more information about the animate command, point your browser to
              file:///usr/share/doc/imagemagick/www/animate.html or http://www.imagemag‐
              ick.org/script/animate.php.

              DESCRIPTION
              Image Settings:
              ...



              Direct: http://youtu.be/xGTlJW7DgBw
              A good place to start: Topic: Top 20 Kubuntu FAQs & Answers
              Searching FAQ's: Google Search 'FAQ from Kubuntuforums'

              Comment


                #8
                MouseOverAction v0.2

                Caps Lock as Preview Lock

                The ffplay has controls while playing (man ffplay):

                q, ESC
                Quit.

                f Toggle full screen.

                p, SPC
                Pause.

                a Cycle audio channel in the current program.

                v Cycle video channel.

                t Cycle subtitle channel in the current program.

                c Cycle program.

                w Cycle video filters or show modes.

                s Step to the next frame.

                Pause if the stream is not already paused, step to the next video frame, and pause.

                left/right
                Seek backward/forward 10 seconds.

                down/up
                Seek backward/forward 1 minute.

                page down/page up
                Seek to the previous/next chapter. or if there are no chapters Seek backward/forward 10 minutes.

                mouse click
                Seek to percentage in file corresponding to fraction of width.
                The 'Caps Lock' can be used to flip the preview from the auto mode to the controlled mode.

                The 'Caps Lock' status can be read with the 'xset' command:
                Code:
                # Caps Lock will move the focus to the preview window
                # and enable the ffplay controls
                lockPreview ()
                # Call: lockPreview windowtitle
                {
                   previewwindowTitle="$1"
                   
                   while [ 1 ] ; do
                      if xset -q | grep "Caps Lock:   on" > /dev/null 2>&1; then
                         wmctrl -R "$previewwindowTitle"
                      fi
                   done
                }

                Presentation Time Stamp

                The ffplay can draw text on top of a video: http://ffmpeg.org/ffmpeg-filters.html#drawtext-1

                A launchPlayer function with the pts on top of the video:
                Code:
                launchPlayer ()
                {
                # Call: launchPlayer windowtitle file
                
                   localwindowTitle="$1"
                   previewFile="$2"
                
                   ffplay -vf drawtext='fontfile=/usr/share/fonts/truetype/freefont/FreeSans.ttf:fontsize=36:text=%{pts}:fontcolor=green: box=1: boxcolor=white' -window_title "$windowTitle" -x 1 -y 1 "$previewFile" > /dev/null 2>&1
                   
                }


                More of the fontsize:

                - http://ffmpeg.gusari.org/viewtopic.php?f=11&t=1509
                - http://forum.videohelp.com/threads/3...atermark-issue


                A short preview clip with the preview lock & time stamp.



                Direct : http://youtu.be/Va5JcY1VlPM

                MouseOverAction.sh 0.2 example:
                Code:
                #!/bin/bash
                # Execute: MouseOverAction.sh mimetype file
                #
                # This example script is working at here with
                # the 1920x1080 screen.
                #
                # It is using: 
                # - xdotool to read the mouse location
                # - wmctrl to move, scale and raise the preview window
                # - sox (play) to play audio files
                # - ffmpeg (ffplay) to play video and audio files
                #
                # The video preview (ffplay) needs to set the focus
                # stealing prevention for the ffplay: 
                # KDE System Settings > Window Behavior > Window rules
                #
                # Remember to set the script execute permission !
                
                mimetype="$1"
                file="$2"
                
                # ffplay options
                windowTitle=ffplayAutoPreview
                
                # screen size
                screenWidht=1920
                screenHeight=1080
                
                # exit trap
                trap onExit EXIT
                
                # kill the ffplayAutoPreview window on exit
                onExit ()
                # Call: onExit
                {   
                   if ! xset -q | grep "Caps Lock:   on" > /dev/null 2>&1; then
                      pkill -f ffplayAutoPreview
                   fi
                }
                
                # Caps Lock will move the focus to the previw window
                # and enable the ffplay controls
                lockPreview ()
                # Call: lockPreview windowtitle
                {
                   previewwindowTitle="$1"
                   
                   while [ 1 ] ; do
                      if xset -q | grep "Caps Lock:   on" > /dev/null 2>&1; then
                         wmctrl -R "$previewwindowTitle"
                      fi
                   done
                }
                
                # launch player
                launchPlayer ()
                {
                # Call: launchPlayer windowtitle file
                
                   localwindowTitle="$1"
                   previewFile="$2"
                
                   ffplay -window_title "$windowTitle" -x 1 -y 1 "$previewFile" > /dev/null 2>&1
                }
                
                # move/scale/raise the preview window
                movingWindows ()
                {
                # Call: movingWindows windowtitle widht height
                
                   localwindowTitle="$1"
                   localscreenWidht="$2"
                   localscreenHeight="$3"
                
                # preview window size
                   widht=$(( localscreenWidht / 3 ))
                   height=$(( localscreenHeight / 3 ))
                
                # wait preview window
                   until wmctrl -l | grep "$localwindowTitle" ; do
                      echo waiting >/dev/null
                   done
                
                # mouse location $X,$Y
                   eval $(xdotool getmouselocation --shell)
                
                # preview window location
                   if [ $X -le $(( localscreenWidht / 2 )) ] ; then 
                      deltaX=$(( widht / 2 ))
                   else
                      deltaX=$(( -3 * widht / 2 ))
                   fi
                
                   if [ $Y -le $(( localscreenHeight / 2 )) ] ; then 
                      deltaY=$(( -height / 2 ))
                   else
                      deltaY=$(( -3 * height / 2 ))
                   fi
                
                   previewX=$((X + deltaX))
                   if [ $previewX -lt 0 ] ; then previewX=0 ; fi
                   previewY=$((Y + deltaY))
                   if [ $previewY -lt 0 ] ; then previewY=0 ; fi
                
                # move & resize and raise the preview window
                   wmctrl -r "$localwindowTitle" -e "0,$previewX,$previewY,$widht,$height"
                   wmctrl -r "$localwindowTitle" -b add,above
                }
                
                # there can be only one
                if wmctrl -l | grep "$windowTitle" ; then exit ; fi
                
                # preview options by mime type
                case "$mimetype" in
                
                      audio/x-ms-wma)
                      ffplay -nodisp "$file"
                      exit
                      ;;
                
                      audio/*)
                      play "$file"
                      exit
                      ;;
                
                      video/*|application/x-flash-video|application/vnd.ms-asf|application/vnd.rn-realmedia)
                      movingWindows "$windowTitle" "$screenWidht" "$screenHeight" &
                      lockPreview "$windowTitle" &
                      launchPlayer "$windowTitle" "$file"
                      ;;
                      
                      *)
                #     case trap
                      exit
                      
                esac
                Last edited by Rog132; Aug 27, 2014, 01:01 PM.
                A good place to start: Topic: Top 20 Kubuntu FAQs & Answers
                Searching FAQ's: Google Search 'FAQ from Kubuntuforums'

                Comment


                  #9
                  Dolphin Repository

                  The Dolphin has now own project repository:



                  https://projects.kde.org
                  --> https://projects.kde.org/projects/kd...ations/dolphin
                  ----> https://projects.kde.org/projects/kd...hin/repository


                  The Dolphin can be easily build as separate application - https://community.kde.org/Frameworks/Building/Details.

                  Building to the /opt/KF5 :

                  Code:
                  mkdir -p builddir
                  cd builddir && cmake .. -DCMAKE_INSTALL_PREFIX=/opt/KF5 -DCMAKE_PREFIX_PATH=/opt/KF5
                  make
                  sudo make install


                  Minimum:

                  QT_MIN_VERSION "5.4.0"
                  KF5_MIN_VERSION "5.7.0"
                  ECM_MIN_VERSION "1.6.0"

                  Required & Optional with the Vivid:

                  -- The following OPTIONAL packages have been found:

                  * KF5Activities (required version >= 5.7.0)
                  * KF5Baloo (required version >= 4.97) , Baloo Core libraries , <http://www.kde.org>
                  For adding desktop-wide search and tagging support to dolphin
                  * KF5FileMetaData (required version >= 4.97) , <https://projects.kde.org/kfilemetadata>
                  For accessing file metadata labels

                  -- The following REQUIRED packages have been found:

                  * ECM (required version >= 1.6.0)
                  * Qt5Core
                  * Qt5Concurrent
                  * Qt5Widgets
                  * Qt5Gui
                  * Qt5DBus
                  * Qt5 (required version >= 5.4.0)
                  * KF5DocTools (required version >= 5.7.0)
                  * KF5Init (required version >= 5.7.0)
                  * KF5KCMUtils (required version >= 5.7.0)
                  * KF5NewStuff (required version >= 5.7.0)
                  * KF5CoreAddons (required version >= 5.7.0)
                  * Gettext
                  * PythonInterp
                  * KF5I18n (required version >= 5.7.0)
                  * KF5DBusAddons (required version >= 5.7.0)
                  * KF5Bookmarks (required version >= 5.7.0)
                  * KF5Config (required version >= 5.7.0)
                  * KF5KIO (required version >= 5.7.0)
                  * KF5Solid (required version >= 5.7.0)
                  * KF5IconThemes (required version >= 5.7.0)
                  * KF5Completion (required version >= 5.7.0)
                  * KF5Parts (required version >= 5.7.0)
                  * KF5TextEditor (required version >= 5.7.0)
                  * KF5WindowSystem (required version >= 5.7.0)
                  * KF5Notifications (required version >= 5.7.0)
                  * Phonon4Qt5
                  * KF5KDELibs4Support (required version >= 5.7.0)
                  * KF5 (required version >= 5.7.0)
                  * Qt5Test

                  -- The following OPTIONAL packages have not been found:

                  * KF5BalooWidgets (required version >= 4.97) , Baloos Widgets , <http://www.kde.org>


                  KF5 Audio and Video thumbnails: https://www.kubuntuforums.net/showth...l=1#post367642
                  Last edited by Rog132; Mar 05, 2015, 12:17 PM.
                  A good place to start: Topic: Top 20 Kubuntu FAQs & Answers
                  Searching FAQ's: Google Search 'FAQ from Kubuntuforums'

                  Comment


                    #10
                    Dolphin KF5+

                    Sources: https://projects.kde.org/projects/kd...hin/repository
                    Code:
                    git clone git://anongit.kde.org/dolphin
                    Editing .../dolphin/src/views/tooltips/tooltipmanager.cpp: http://pastebin.com/hLydr9YB

                    Compiling:
                    Code:
                    $ mkdir -p builddir
                    
                    $ cd builddir && .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=/opt/KF5 -DCMAKE_INSTALL_PREFIX=/opt/KF5 -DLIB_INSTALL_DIR=lib -DKDE_INSTALL_USE_QT_SYS_PATHS=OFF -DBUILD_TESTING=OFF
                    
                    $ sudo make install




                    Adding to the Menu:




                    Using....

                    Before you edit, BACKUP !

                    Why there are dead links ?
                    1. Thread: Please explain how to access old kubuntu forum posts
                    2. Thread: Lost Information

                    Comment

                    Working...
                    X