KDE Applications 17.08.80 beta

OBS-URL: https://build.opensuse.org/package/show/KDE:Applications/kio-extras5?expand=0&rev=39
This commit is contained in:
Luca Beltrame 2017-03-26 07:19:44 +00:00 committed by Git OBS Bridge
parent 1ab01ef49a
commit 3d89cdc07f
5 changed files with 25 additions and 379 deletions

View File

@ -1,362 +0,0 @@
From 238818850f897a8f4c92b0ec76ec13b07ee20d40 Mon Sep 17 00:00:00 2001
From: Hrvoje Senjan <hrvoje.senjan@gmail.com>
Date: Sun, 14 Sep 2014 23:35:53 +0200
Subject: [PATCH 1/1] Add an AudioThumnail
---
thumbnail/CMakeLists.txt | 70 +++++++++++++++
thumbnail/audiocreator.cpp | 181 +++++++++++++++++++++++++++++++++++++++
thumbnail/audiocreator.h | 39 +++++++++
thumbnail/audiothumbnail.desktop | 11 +++
4 files changed, 301 insertions(+)
create mode 100644 thumbnail/audiocreator.cpp
create mode 100644 thumbnail/audiocreator.h
create mode 100644 thumbnail/audiothumbnail.desktop
diff --git a/thumbnail/CMakeLists.txt b/thumbnail/CMakeLists.txt
index 4c2d5e9..ccff1ad 100644
--- a/thumbnail/CMakeLists.txt
+++ b/thumbnail/CMakeLists.txt
@@ -22,6 +22,63 @@ set_package_properties(Exiv2 PROPERTIES DESCRIPTION "A library to access image m
macro_bool_to_01(EXIV2_FOUND HAVE_EXIV2)
+set(WITH_TAGLIB ON CACHE BOOL "build with TagLib")
+set(WITH_FLAC ON CACHE BOOL "build with FLAC")
+
+### Check for taglib
+set(TAGLIB_LIBRARIES)
+set(TAGLIB_CFLAGS)
+if(WITH_TAGLIB)
+ find_program(TAGLIBCONFIG_EXECUTABLE NAMES taglib-config PATHS /usr/bin /usr/local/bin ${BIN_INSTALL_DIR})
+ if(TAGLIBCONFIG_EXECUTABLE)
+ exec_program(${TAGLIBCONFIG_EXECUTABLE} ARGS --libs RETURN_VALUE _return_VALUE OUTPUT_VARIABLE TAGLIB_LIBRARIES)
+ exec_program(${TAGLIBCONFIG_EXECUTABLE} ARGS --cflags RETURN_VALUE _return_VALUE OUTPUT_VARIABLE TAGLIB_CFLAGS)
+ exec_program(${TAGLIBCONFIG_EXECUTABLE} ARGS --version RETURN_VALUE _return_VALUE OUTPUT_VARIABLE TAGLIB_VERSION)
+ if(TAGLIB_LIBRARIES AND TAGLIB_CFLAGS AND TAGLIB_VERSION)
+ if( ${TAGLIB_VERSION} VERSION_LESS 1.4 )
+ message(FATAL_ERROR "Needed at least taglib 1.4")
+ else()
+ set(TAGLIB_INSTALLED_VERSION_OK TRUE)
+ endif()
+ if(TAGLIB_INSTALLED_VERSION_OK)
+ set(HAVE_TAGLIB 1)
+ message(STATUS "TagLib found: ${TAGLIB_LIBRARIES}")
+ endif(TAGLIB_INSTALLED_VERSION_OK)
+ endif(TAGLIB_LIBRARIES AND TAGLIB_CFLAGS AND TAGLIB_VERSION)
+ endif(TAGLIBCONFIG_EXECUTABLE)
+ if (NOT HAVE_TAGLIB)
+ message(FATAL_ERROR "Could not find Taglib")
+ endif (NOT HAVE_TAGLIB)
+endif(WITH_TAGLIB)
+
+### Check for FLAC++
+set(FLAC_LIBRARIES)
+if(WITH_FLAC)
+ find_path(FLACPP_INCLUDE_DIR FLAC++/metadata.h)
+ find_library(FLAC_LIBRARY NAMES FLAC)
+ find_library(FLACPP_LIBRARY NAMES FLAC++)
+ if(FLACPP_INCLUDE_DIR AND FLAC_LIBRARY AND FLACPP_LIBRARY)
+ set(FLAC_LIBRARIES ${FLACPP_LIBRARY} ${FLAC_LIBRARY})
+ message(STATUS "FLAC++ found: ${FLAC_LIBRARIES}")
+ set(HAVE_FLAC 1)
+
+ set(_CMAKE_REQUIRED_LIBRARIES_TMP ${CMAKE_REQUIRED_LIBRARIES})
+ set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${FLAC_LIBRARIES} ${FLACPP_LIBRARIES})
+ CHECK_CXX_SOURCE_COMPILES("#include <FLAC++/metadata.h>\nint main() {\n FLAC::Metadata::VorbisComment vc;\n const ::FLAC__StreamMetadata* fsmd = vc;\n return 0;\n}\n" FLAC_STREAMMETADATA_OPERATOR_FOUND)
+ CHECK_CXX_SOURCE_COMPILES("#include <FLAC++/metadata.h>\nint main() {\n FLAC::Metadata::Picture pic;\n return 0;\n}\n" FLAC_METADATA_PICTURE_FOUND)
+ set(CMAKE_REQUIRED_LIBRARIES ${_CMAKE_REQUIRED_LIBRARIES_TMP})
+
+ if(NOT FLAC_STREAMMETADATA_OPERATOR_FOUND)
+ set(HAVE_NO_FLAC_STREAMMETADATA_OPERATOR 1)
+ endif(NOT FLAC_STREAMMETADATA_OPERATOR_FOUND)
+ if(FLAC_METADATA_PICTURE_FOUND)
+ set(HAVE_FLAC_PICTURE 1)
+ endif(FLAC_METADATA_PICTURE_FOUND)
+ else(FLACPP_INCLUDE_DIR AND FLAC_LIBRARY AND FLACPP_LIBRARY)
+ message(FATAL_ERROR "Could not find FLAC++")
+ endif(FLACPP_INCLUDE_DIR AND FLAC_LIBRARY AND FLACPP_LIBRARY)
+endif(WITH_FLAC)
+
include_directories(${JPEG_INCLUDE_DIR})
if(EXIV2_FOUND)
include_directories(${EXIV2_INCLUDE_DIR})
@@ -219,6 +276,18 @@ install(TARGETS comicbookthumbnail DESTINATION ${PLUGIN_INSTALL_DIR})
########### install files ###############
+########### next target ###############
+
+set(audiothumbnail_SRCS audiocreator.cpp)
+
+add_library(audiothumbnail MODULE ${audiothumbnail_SRCS})
+
+target_link_libraries(audiothumbnail KF5::KIOWidgets ${TAGLIB_LIBRARIES} ${FLAC_LIBRARIES})
+
+install(TARGETS audiothumbnail DESTINATION ${PLUGIN_INSTALL_DIR})
+
+########### install files ###############
+
install(FILES thumbcreator.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR})
install(FILES
thumbnail.protocol
@@ -226,6 +295,7 @@ install(FILES
imagethumbnail.desktop
jpegthumbnail.desktop
textthumbnail.desktop
+ audiothumbnail.desktop
# desktopthumbnail.desktop
comicbookthumbnail.desktop
kraorathumbnail.desktop
diff --git a/thumbnail/audiocreator.cpp b/thumbnail/audiocreator.cpp
new file mode 100644
index 0000000..4bc69d6
--- /dev/null
+++ b/thumbnail/audiocreator.cpp
@@ -0,0 +1,181 @@
+
+/***************************************************************************
+ * This file is part of the AudioThumbs. *
+ * Copyright (C) 2009 Vytautas Mickus <vmickus@gmail.com> *
+ * Copyright (C) 2011 Raizner Evgeniy <razrfalcon@gmail.com> *
+ * *
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
+ * MA 02110-1301 USA *
+ ***************************************************************************/
+
+#include "audiocreator.h"
+
+#include <QImage>
+#include <QFile>
+
+#include <taglib/fileref.h>
+#include <taglib/id3v2tag.h>
+#include <taglib/mpegfile.h>
+#include <taglib/attachedpictureframe.h>
+#include <taglib/flacfile.h>
+#include <taglib/flacpicture.h>
+#include <taglib/mp4file.h>
+#include <taglib/mp4properties.h>
+#include <taglib/mp4tag.h>
+#include <taglib/mp4coverart.h>
+#include <taglib/xiphcomment.h>
+#include <taglib/xingheader.h>
+#include <taglib/oggflacfile.h>
+#include <taglib/oggfile.h>
+#include <taglib/vorbisfile.h>
+
+#include <FLAC++/metadata.h>
+
+#include <QMimeDatabase>
+
+extern "C"
+{
+ Q_DECL_EXPORT ThumbCreator *new_creator()
+ {
+ return new ATCreator;
+ }
+}
+
+
+ATCreator::ATCreator()
+{
+
+}
+
+ATCreator::~ATCreator()
+{
+
+}
+
+bool ATCreator::create ( const QString &path, int /*w*/, int /*h*/, QImage &img )
+{
+ bool bRet = false;
+
+ QMimeDatabase db;
+ QMimeType type = db.mimeTypeForFile(path, QMimeDatabase::MatchExtension);
+
+ if (type.name() == "audio/mpeg") {
+ TagLib::MPEG::File mp3File(path.toUtf8());
+ TagLib::ID3v2::Tag *mp3Tag = mp3File.ID3v2Tag();
+ TagLib::ID3v2::FrameList fList = mp3Tag->frameList("APIC");
+ TagLib::ID3v2::AttachedPictureFrame *pic;
+ pic = static_cast<TagLib::ID3v2::AttachedPictureFrame *>(fList.front());
+ if (!pic->picture().isEmpty()) {
+ img.loadFromData((const uchar *) pic->picture().data(),pic->picture().size());
+ bRet = true;
+ }
+
+ } else if (type.name() == "audio/flac" || type.name() == "audio/x-flac") {
+ TagLib::FLAC::File ff(path.toUtf8());
+ TagLib::List<TagLib::FLAC::Picture *> coverList;
+
+ if (!ff.pictureList().isEmpty()) {
+ coverList.append(ff.pictureList().front());
+ TagLib::ByteVector coverData = coverList.front()->data();
+ QByteArray data;
+ data.setRawData(coverData.data(),coverData.size());
+ img.loadFromData(data);
+ bRet = true;
+ return bRet;
+ }
+
+ } else if (type.name() == "audio/mp4") {
+ TagLib::MP4::File mp4file(path.toUtf8());
+ TagLib::MP4::Tag *tag = mp4file.tag();
+ TagLib::MP4::ItemListMap map=tag->itemListMap();
+ QByteArray data;
+
+ if (!map.isEmpty()) {
+ for (TagLib::MP4::ItemListMap::ConstIterator it = map.begin(); it != map.end(); ++it) {
+ TagLib::MP4::CoverArtList coverList=(*it).second.toCoverArtList();
+ if (!coverList.isEmpty()) {
+ TagLib::MP4::CoverArt cover=coverList[0];
+
+ TagLib::ByteVector coverData=cover.data();
+ data.setRawData(coverData.data(),coverData.size());
+ img.loadFromData(data);
+
+ bRet = true;
+ return bRet;
+ }
+ }
+ }
+ } else if (type.name() == "audio/x-vorbis+ogg" || type.name() == "audio/ogg") {
+ // this part from Coquillo audio tag editor
+ TagLib::Ogg::Vorbis::File file(path.toUtf8());
+ TagLib::Ogg::XiphComment *tag = file.tag();
+
+ if (tag->contains("METADATA_BLOCK_PICTURE")) {
+ TagLib::StringList blocks = tag->fieldListMap()["METADATA_BLOCK_PICTURE"];
+
+ for (uint i = 0; i < blocks.size(); i++) {
+ QByteArray data = QByteArray::fromBase64(blocks[i].toCString());
+ QDataStream s(&data, QIODevice::ReadOnly);
+
+ int type;
+ uint mimelen;
+ int descrlen;
+ int datalen;
+
+ int w;
+ int h;
+ int c;
+ int ic;
+
+ char * mime;
+ char * descr;
+ char * pic;
+
+ s >> type;
+ s >> mimelen;
+
+ mime = new char[mimelen+1];
+ s.readRawData(mime, mimelen);
+
+ mime[mimelen] = 0;
+
+ s >> descrlen;
+
+ descr = new char[descrlen+1];
+ s.readRawData(descr, descrlen);
+
+ descr[descrlen] = 0;
+
+ s >> w >> h >> c >> ic >> datalen;
+
+ if (!datalen)
+ return false;
+
+ pic = new char[datalen];
+ s.readRawData(pic, datalen);
+ img = QImage::fromData(QByteArray(pic, datalen));
+
+ bRet = true;
+ }
+ }
+ }
+
+ return bRet;
+}
+
+ThumbCreator::Flags ATCreator::flags() const
+{
+ return (Flags)(None);
+}
+
diff --git a/thumbnail/audiocreator.h b/thumbnail/audiocreator.h
new file mode 100644
index 0000000..f7badbd
--- /dev/null
+++ b/thumbnail/audiocreator.h
@@ -0,0 +1,39 @@
+
+/***************************************************************************
+ * This file is part of the AudioThumbs. *
+ * Copyright (C) 2009 Vytautas Mickus <vmickus@gmail.com> *
+ * Copyright (C) 2011 Raizner Evgeniy <razrfalcon@gmail.com> *
+ * *
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
+ * MA 02110-1301 USA *
+ ***************************************************************************/
+
+#ifndef _AUDIO_THUMBS_H_
+#define _AUDIO_THUMBS_H_
+
+#include <QObject>
+#include <kio/thumbcreator.h>
+
+class ATCreator : public QObject, public ThumbCreator
+{
+ Q_OBJECT
+public:
+ ATCreator();
+ virtual ~ATCreator();
+ virtual bool create(const QString &path, int w, int h, QImage &img);
+ virtual Flags flags() const;
+private:
+};
+
+#endif // _AUDIO_THUMBS_H_
diff --git a/thumbnail/audiothumbnail.desktop b/thumbnail/audiothumbnail.desktop
new file mode 100644
index 0000000..ddbb582
--- /dev/null
+++ b/thumbnail/audiothumbnail.desktop
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Type=Service
+Name=Audio Files
+Name[lt]=Audio failai
+Name[ru]=Аудио файлы
+Name[ua]=Аудiо файли
+X-KDE-ServiceTypes=ThumbCreator
+MimeType=audio/mpeg;audio/flac;audio/x-flac;audio/mp4;audio/x-vorbis+ogg;audio/ogg;
+X-KDE-Library=audiothumbnail
+CacheThumbnail=true
+IgnoreMaximumSize=true
--
2.1.0

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5af7b4dac320ed6d0897c8940e6043ef45a4e1d3a4f9f12e8513215633a5d7d5
size 279872

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8c850d9d3df0ff5a8eb8f72abd74892f134bcfc9bed2024154fe8dcc2c7058e0
size 278664

View File

@ -1,3 +1,13 @@
-------------------------------------------------------------------
Sat Mar 25 23:10:31 CET 2017 - lbeltrame@kde.org
- Update to 17.03.80
* New feature release
* For more details please see:
* https://www.kde.org/announcements/announce-applications-17.03.80.php
- Changes since 16.12.3:
* Too many changes to list here
-------------------------------------------------------------------
Thu Mar 9 20:21:20 UTC 2017 - alarrosa@suse.com

View File

@ -17,10 +17,10 @@
Name: kio-extras5
Version: 16.12.3
Version: 17.03.80
Release: 0
%define kf5_version 5.26.0
# Latest stable Applications (e.g. 16.08 in KA, but 16.12.3 in KUA)
# Latest stable Applications (e.g. 16.08 in KA, but 16.11.80 in KUA)
%{!?_kapp_version: %global _kapp_version %(echo %{version}| awk -F. '{print $1"."$2}')}
Summary: Additional KIO-slaves for KDE applications
License: GPL-2.0+
@ -28,8 +28,7 @@ Group: System/GUI/KDE
Url: http://www.kde.org
Source: kio-extras-%{version}.tar.xz
Source99: %{name}-rpmlintrc
Patch0: 0001-Add-an-AudioThumnail.patch
Patch1: fix-mtp-paste-with-KF5-5.25.diff
Patch0: fix-mtp-paste-with-KF5-5.25.diff
BuildRequires: OpenEXR-devel
BuildRequires: flac-devel
BuildRequires: kactivities5-devel
@ -79,7 +78,6 @@ Additional KIO-slaves for KDE applications.
%prep
%setup -q -n kio-extras-%{version}
%patch0 -p1
%patch1 -p1
sed -i '/^add_subdirectory( doc )/d' CMakeLists.txt
%build