This forum has been archived. All content is frozen. Please use KDE Discuss instead.

[Dolphin] Show icons related to file at bottom edge

Tags: None
(comma "," separated)
Lachu
Registered Member
Posts
864
Karma
1
OS
In my opinion, dolphin should display symbols at the bottom of the icons, like:
- Activities the icons is related
- Tag icons (should also been implemented icon for tag setting)

Additionally, you should also display comment, when mouse hover file for more than some time,.


Lachu, proud to be a member of KDE forums since 2008-Nov.
User avatar
Rog131
Registered Member
Posts
828
Karma
10
Lachu wrote:In my opinion, dolphin should display symbols at the bottom of the icons, like:
- Activities the icons is related
- Tag icons (should also been implemented icon for tag setting)

Additionally, you should also display comment, when mouse hover file for more than some time,.


Dolphin settings > General > Show tooltips will show the comments, tags and other information when the mouse hovers over the file.

Image
Full image: https://imgur.com/eA5kDpT

Tag information etc. can be added to the thumbnail image. Either with the thumbnailer or with an image editing context menu.
User avatar
Rog131
Registered Member
Posts
828
Karma
10
Scripting KDE video preview thumbnails

Random preview / tags&duration / Embedded poster:

Image

Basic

Thumbnail:
https://docs.kde.org/trunk5/en/kdenetwo ... index.html

KF5 API:
https://api.kde.org/frameworks/kio/html ... eator.html

Thumbnails Specification:
https://www.freedesktop.org/wiki/Specif ... humbnails/


Keneric

Keneric KDE/KF5 thumbnailer: https://store.kde.org/p/1080815/

The Keneric KDE (KF5) thumbnailer is a generic thumbnailer. It is intended to be used when there is no dedicated KDE thumbnailer and there is a fast and simple way to get the thumbnail image (oneliner).

The Keneric can be used if you want to get more options to get the preview thumbnails.


Datasources

Code: Select all
$ baloo_filemetadata_temp_extractor
Usage: baloo_filemetadata_temp_extractor url

Arguments:
  url

Baloo is part of typical KDE installation.

Code: Select all
$ getfattr --help
getfattr 2.4.48 -- get extended attributes
Usage: getfattr [-hRLP] [-n name|-d] [-e en] [-m pattern] path...
  -n, --name=name         get the named extended attribute value
  -d, --dump              get all extended attribute values
  -e, --encoding=...      encode values (as 'text', 'hex' or 'base64')
      --match=pattern     only get attributes with names matching pattern
      --only-values       print the bare values only
  -h, --no-dereference    do not dereference symbolic links
      --absolute-names    don't strip leading '/' in pathnames
  -R, --recursive         recurse into subdirectories
  -L, --logical           logical walk, follow symbolic links
  -P  --physical          physical walk, do not follow symbolic links
      --version           print version and exit
      --help              this help text

getfattr is part of the Attr: http://savannah.nongnu.org/projects/attr

Code: Select all
$ mediainfo --help
MediaInfo Command line,
MediaInfoLib - v18.08.1
Usage: "mediainfo [-Options...] FileName1 [Filename2...]"

Options:
--Help, -h

mediainfo is part of MediaInfo: https://mediaarea.net


More:

How to get video duration in seconds?
https://superuser.com/questions/650291/ ... in-seconds

Extract video cover/thumbnail from file with embedded cover using ffmpeg
https://superuser.com/questions/1328204 ... ing-ffmpeg

Edit, compose, or convert bitmap images - ImageMagick
https://www.imagemagick.org/script/index.php


Video thumbnailer example

This example is using ffmpegthumbnailer:
Code: Select all
$ ffmpegthumbnailer -h
Usage: ffmpegthumbnailer [options]

Options:
  -i<s>   : input file
  -o<s>   : output file
  -s<n>   : thumbnail size (use 0 for original size) (default: 128)
  -t<n|s> : time to seek to (percentage or absolute time hh:mm:ss) (default: 10%)
  -q<n>   : image quality (0 = bad, 10 = best) (default: 8)
  -c      : override image format (jpeg or png) (default: determined by filename)
  -a      : ignore aspect ratio and generate square thumbnail
  -f      : create a movie strip overlay
  -m      : prefer embedded image metadata over video content
  -w      : workaround issues in old versions of ffmpeg
  -v      : print version number
  -h      : display this help



1) Install Keneric plugin
Earlier: - viewtopic.php?f=224&t=156241#p408277

Code: Select all
$ cd keneric-0.4.1

$ mkdir builddir

$ cd builddir && cmake .. -DCMAKE_INSTALL_PREFIX=$(kf5-config --prefix) -DCMAKE_BUILD_TYPE=Release -DKDE_INSTALL_USE_QT_SYS_PATHS=ON
-- The C compiler identification is GNU 7.3.0
-- The CXX compiler identification is GNU 7.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for __GLIBC__
-- Looking for __GLIBC__ - found
-- Performing Test _OFFT_IS_64BIT
-- Performing Test _OFFT_IS_64BIT - Success
-- Performing Test HAVE_DATE_TIME
-- Performing Test HAVE_DATE_TIME - Success
-- Found KF5KIO: /usr/lib/x86_64-linux-gnu/cmake/KF5KIO/KF5KIOConfig.cmake (found version "5.52.0")
-- Found KF5: success (found version "5.52.0") found components:  KIO
-- Configuring done
-- Generating done
-- Build files have been written to: /home/rog131/Downloads/keneric-0.4.1/builddir

$ make
Scanning dependencies of target keneric_autogen
[ 25%] Automatic MOC for target keneric
[ 25%] Built target keneric_autogen
Scanning dependencies of target keneric
[ 50%] Building CXX object CMakeFiles/keneric.dir/keneric.cpp.o
[ 75%] Building CXX object CMakeFiles/keneric.dir/keneric_autogen/mocs_compilation.cpp.o
[100%] Linking CXX shared module keneric.so
[100%] Built target keneric

$ sudo make install
[sudo] password for rog131:
[ 25%] Automatic MOC for target keneric
[ 25%] Built target keneric_autogen
[100%] Built target keneric
Install the project...
-- Install configuration: "Release"
-- Installing: /usr/lib/x86_64-linux-gnu/qt5/plugins/keneric.so


2) Make the desktop file

$HOME/.local/share/kservices5/kenericvideo.desktop
Code: Select all
[Desktop Entry]
Type=Service
Name=Video Files (Keneric)
Name[x-test]=xxVideo Files (Keneric)filexx

X-KDE-ServiceTypes=ThumbCreator
MimeType=video/*;application/x-flash-video;application/vnd.ms-asf;application/vnd.rn-realmedia;

X-KDE-Library=keneric
CacheThumbnail=true
ThumbnailerVersion=2
IgnoreMaximumSize=true



3) Add video thumbnailer options to the stripPicture script file

Code: Select all
#!/bin/sh
# Usage: stripPicture fullname mime exportPicture thumbSize

fullname="$1"
mime="$2"
exportPicture="$3"
thumbSize="$4"

# thumbnail options by mime type
case "$mime" in

      something/x-something)
      yourcommand "$fullname" "$exportPicture"
      exit
      ;;

      *)
#     case trap
      exit
     
esac



Random video thumbnail

Code: Select all
    video/*|application/x-flash-video|application/vnd.ms-asf|application/vnd.rn-realmedia)
        ffmpegthumbnailer -s $thumbSize -t $((RANDOM %90 + 5)) -q 1 -i "$fullname" -o "$exportPicture"
    exit
    ;;



Video duration and the tags:

Code: Select all
    video/*|application/x-flash-video|application/vnd.ms-asf|application/vnd.rn-realmedia)
        pointSize=$((thumbSize/16))
        annotateNorthEast=`getfattr --only-values --absolute-names -n user.xdg.tags "$fullname"`
        annotateSouthWest=`mediainfo --Inform="General;%Duration/String2%" "$fullname"`
        ffmpegthumbnailer -s $thumbSize -t $((RANDOM %90 + 5)) -q 1 -i "$fullname" -o "$exportPicture"
        convert -background 'rgba(115, 252, 80, 0.70)' -fill black -pointsize $pointSize label:"$annotateNorthEast" miff:- | composite -gravity northeast - "$exportPicture" "$exportPicture"
        convert -background 'rgba(0, 0, 0, 0.60)' -fill white -pointsize $pointSize label:"$annotateSouthWest" miff:- | composite -gravity southwest - "$exportPicture" "$exportPicture"
    exit
    ;;


Use embedded posters if available:

Code: Select all
    video/*|application/x-flash-video|application/vnd.ms-asf|application/vnd.rn-realmedia)
        ffmpeg -loglevel panic -y -i "$fullname" -map 0:v -map -0:V -c copy "$exportPicture".jpg
        if [ -f "$exportPicture".jpg ]; then
            mv "$exportPicture".jpg "$exportPicture"
        else
            pointSize=$((thumbSize/16))
            annotateNorthEast=`getfattr --only-values --absolute-names -n user.xdg.tags "$fullname"`
            annotateSouthWest=`mediainfo --Inform="General;%Duration/String2%" "$fullname"`
            ffmpegthumbnailer -s $thumbSize -t $((RANDOM %90 + 5)) -q 1 -i "$fullname" -o "$exportPicture"
            convert -background 'rgba(115, 252, 80, 0.70)' -fill black -pointsize $pointSize label:"$annotateNorthEast" miff:- | composite -gravity northeast - "$exportPicture" "$exportPicture"
            convert -background 'rgba(0, 0, 0, 0.60)' -fill white -pointsize $pointSize label:"$annotateSouthWest" miff:- | composite -gravity southwest - "$exportPicture" "$exportPicture"
        fi
    exit
    ;;


Image
Full image: https://imgur.com/6pOrQVq

Youtube clip: https://youtu.be/L694nghnPo8


Notes

Earlier: viewtopic.php?f=224&t=156241#p409075

Now and then the Dolphin Information panel is showing wrong thumbnail (ffmpegthumbs). My guess is that this is a variant of the https://bugs.kde.org/show_bug.cgi?id=402530 i.e the Dolphin is not following the user settings. A workaround is to remove the ffmpegthumbs.desktop file or remove the ffmpegthumbs package.


Bookmarks



Who is online

Registered users: Bing [Bot], blue_bullet, Google [Bot], Sogou [Bot]