Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/CMakeLists.txt b/CMakeLists.txt
- index 8c42ead..e0a2c65 100644
- --- a/CMakeLists.txt
- +++ b/CMakeLists.txt
- @@ -74,7 +74,7 @@ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${KDE_ENABLE_EXCEPTIONS}")
- set(CMAKE_AUTOMOC ON)
- add_subdirectory(browsingbackends)
- -add_subdirectory(mediasources)
- +add_subdirectory(datasources)
- #add_subdirectory(onlineservices)
- add_subdirectory(mediaelements)
- add_subdirectory(components)
- diff --git a/libs/mediacenter/CMakeLists.txt b/libs/mediacenter/CMakeLists.txt
- index fb36115..cadc901 100644
- --- a/libs/mediacenter/CMakeLists.txt
- +++ b/libs/mediacenter/CMakeLists.txt
- @@ -29,8 +29,8 @@ set (plasmamediacenter_SRCS
- pmcalbum.cpp
- pmcartist.cpp
- filtermediamodel.cpp
- - abstractmediasource.cpp
- - mediasourcesloader.cpp
- + abstractdatasource.cpp
- + datasourcesloader.cpp
- singletonfactory.cpp
- mediavalidator.cpp
- settings.cpp
- @@ -91,7 +91,7 @@ set_target_properties(plasmamediacenter PROPERTIES VERSION ${PROJECT_VERSION} SO
- install(TARGETS plasmamediacenter ${INSTALL_TARGETS_DEFAULT_ARGS} LIBRARY NAMELINK_SKIP)
- install(FILES data/servicetypes/pmc_browsingbackend.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR})
- -install(FILES data/servicetypes/pmc_mediasource.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR})
- +install(FILES data/servicetypes/pmc_datasource.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR})
- add_subdirectory(plugin)
- diff --git a/libs/mediacenter/abstractmediasource.cpp b/libs/mediacenter/abstractmediasource.cpp
- deleted file mode 100644
- index 075bc40..0000000
- --- a/libs/mediacenter/abstractmediasource.cpp
- +++ /dev/null
- @@ -1,51 +0,0 @@
- -/***********************************************************************************
- - * Copyright 2014 Shantanu Tushar <shantanu@kde.org> *
- - * Copyright 2014 Sinny Kumari <ksinny@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 as published by the Free Software Foundation; either *
- - * version 2.1 of the License, or (at your option) any later version. *
- - * *
- - * 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, see <http://www.gnu.org/licenses/>. *
- - ***********************************************************************************/
- -
- -#include "abstractmediasource.h"
- -#include <QDebug>
- -
- -using namespace MediaCenter;
- -
- -class AbstractMediaSource::Private
- -{
- -public:
- - Private() : mediaLibrary(0) {}
- - MediaLibrary* mediaLibrary;
- -};
- -
- -AbstractMediaSource::AbstractMediaSource(QObject* parent, const QVariantList&)
- - : QThread(parent), d(new Private)
- -{
- - moveToThread(this);
- -}
- -
- -AbstractMediaSource::~AbstractMediaSource()
- -{
- -
- -}
- -
- -void AbstractMediaSource::setMediaLibrary(MediaLibrary* mediaLibrary)
- -{
- - d->mediaLibrary = mediaLibrary;
- -}
- -
- -MediaLibrary* AbstractMediaSource::mediaLibrary() const
- -{
- - return d->mediaLibrary;
- -}
- diff --git a/libs/mediacenter/abstractmediasource.h b/libs/mediacenter/abstractmediasource.h
- deleted file mode 100644
- index c2f3796..0000000
- --- a/libs/mediacenter/abstractmediasource.h
- +++ /dev/null
- @@ -1,52 +0,0 @@
- -/***********************************************************************************
- - * Copyright 2014 Shantanu Tushar <shantanu@kde.org> *
- - * Copyright 2014 Sinny Kumari <ksinny@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 as published by the Free Software Foundation; either *
- - * version 2.1 of the License, or (at your option) any later version. *
- - * *
- - * 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, see <http://www.gnu.org/licenses/>. *
- - ***********************************************************************************/
- -
- -#ifndef ABSTRACTMEDIASOURCE_H
- -#define ABSTRACTMEDIASOURCE_H
- -
- -#include <QtCore/QThread>
- -#include <KPluginInfo>
- -
- -#include "mediacenter_export.h"
- -
- -class MediaLibrary;
- -
- -namespace MediaCenter {
- -class MEDIACENTER_EXPORT AbstractMediaSource : public QThread
- -{
- - Q_OBJECT
- -public:
- - explicit AbstractMediaSource(QObject* parent = 0, const QVariantList& = QVariantList());
- - ~AbstractMediaSource();
- -
- - void setMediaLibrary(MediaLibrary *mediaLibrary);
- -
- -protected:
- - MediaLibrary *mediaLibrary() const;
- -
- -private:
- - class Private;
- - Private * const d;
- -};
- -}
- -
- -#define MEDIACENTER_EXPORT_MEDIASOURCE(classname, jsonfile) \
- - K_PLUGIN_FACTORY_WITH_JSON( MediaSourceFactory, jsonfile, registerPlugin< classname >(); )
- -
- -#endif // ABSTRACTMEDIASOURCE_H
- diff --git a/libs/mediacenter/data/servicetypes/pmc_mediasource.desktop b/libs/mediacenter/data/servicetypes/pmc_mediasource.desktop
- deleted file mode 100644
- index c5ed06e..0000000
- --- a/libs/mediacenter/data/servicetypes/pmc_mediasource.desktop
- +++ /dev/null
- @@ -1,3 +0,0 @@
- -[Desktop Entry]
- -Type=ServiceType
- -X-KDE-ServiceType=Plasma/MediaCenter/MediaSource
- diff --git a/libs/mediacenter/mediasourcesloader.cpp b/libs/mediacenter/mediasourcesloader.cpp
- deleted file mode 100644
- index ebf7403..0000000
- --- a/libs/mediacenter/mediasourcesloader.cpp
- +++ /dev/null
- @@ -1,62 +0,0 @@
- -/***********************************************************************************
- - * Copyright 2014 Shantanu Tushar <shantanu@kde.org> *
- - * Copyright 2014 Sinny Kumari <ksinny@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 as published by the Free Software Foundation; either *
- - * version 2.1 of the License, or (at your option) any later version. *
- - * *
- - * 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, see <http://www.gnu.org/licenses/>. *
- - ***********************************************************************************/
- -
- -#include "mediasourcesloader.h"
- -#include "medialibrary.h"
- -#include "abstractmediasource.h"
- -
- -#include "singletonfactory.h"
- -
- -#include <KPluginTrader>
- -#include <KPluginInfo>
- -#include <QDebug>
- -#include <QApplication>
- -
- -MediaSourcesLoader::MediaSourcesLoader(QObject* parent): QObject(parent)
- -{
- -
- -}
- -
- -void MediaSourcesLoader::load()
- -{
- - KPluginInfo::List pluginInfo = KPluginTrader::self()->query("plasma/mediacenter/mediasources");
- - if (pluginInfo.isEmpty()) {
- - qWarning() << "no available media sources";
- - }
- -
- - Q_FOREACH (const KPluginInfo &info, pluginInfo) {
- - KPluginLoader loader(info.libraryPath());
- - KPluginFactory* factory = loader.factory();
- -
- - const QVariantList args = QVariantList() << loader.metaData().toVariantMap();
- - if(factory)
- - {
- - MediaCenter::AbstractMediaSource *mediaSource = factory->create<MediaCenter::AbstractMediaSource>(0, args);
- - if (mediaSource) {
- - mediaSource->setMediaLibrary(SingletonFactory::instanceFor<MediaLibrary>());
- - mediaSource->start();
- - connect(QApplication::instance(), SIGNAL(destroyed(QObject*)), mediaSource, SLOT(quit()));
- - qDebug() << "created instance for media source" << info.name();
- - } else {
- - qDebug() << "Could not create a instance for the media source " << info.name();
- - }
- - }
- -
- - }
- -}
- diff --git a/libs/mediacenter/mediasourcesloader.h b/libs/mediacenter/mediasourcesloader.h
- deleted file mode 100644
- index c24b0d1..0000000
- --- a/libs/mediacenter/mediasourcesloader.h
- +++ /dev/null
- @@ -1,41 +0,0 @@
- -/***********************************************************************************
- - * Copyright 2014 Shantanu Tushar <shantanu@kde.org> *
- - * Copyright 2014 Sinny Kumari <ksinny@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 as published by the Free Software Foundation; either *
- - * version 2.1 of the License, or (at your option) any later version. *
- - * *
- - * 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, see <http://www.gnu.org/licenses/>. *
- - ***********************************************************************************/
- -
- -#ifndef MEDIASOURCESLOADER_H
- -#define MEDIASOURCESLOADER_H
- -
- -#include <QtCore/QObject>
- -
- -#include "mediacenter_export.h"
- -
- -namespace MediaCenter {
- -class AbstractMediaSource;
- -}
- -
- -class MEDIACENTER_EXPORT MediaSourcesLoader : public QObject
- -{
- - Q_OBJECT
- -public:
- - explicit MediaSourcesLoader(QObject* parent = 0);
- -
- -public Q_SLOTS:
- - void load();
- -};
- -
- -#endif // MEDIASOURCESLOADER_H
- diff --git a/libs/mediacenter/plugin/mediacenterplugin.cpp b/libs/mediacenter/plugin/mediacenterplugin.cpp
- index ba091d6..07d3ae0 100644
- --- a/libs/mediacenter/plugin/mediacenterplugin.cpp
- +++ b/libs/mediacenter/plugin/mediacenterplugin.cpp
- @@ -25,7 +25,7 @@
- #include "mediacenter/multipleplaylistmodel.h"
- #include "mediacenter/objectpair.h"
- #include "mediacenter/settings.h"
- -#include "mediacenter/mediasourcesloader.h"
- +#include "mediacenter/datasourcesloader.h"
- #include "mediacenter/abstractbrowsingbackend.h"
- #include "mediacenter/medialibrary.h"
- #include "mediacenter/runtimedata.h"
- diff --git a/libs/mediacenter/plugin/qmlaccess.cpp b/libs/mediacenter/plugin/qmlaccess.cpp
- index da3810e..c0a7071 100644
- --- a/libs/mediacenter/plugin/qmlaccess.cpp
- +++ b/libs/mediacenter/plugin/qmlaccess.cpp
- @@ -28,8 +28,8 @@ QMLAccess::QMLAccess(QObject *parent) : QObject(parent)
- {
- SingletonFactory::instanceFor<MediaLibrary>()->start();
- - MediaSourcesLoader mediasourceLoader;
- - mediasourceLoader.load();
- + DataSourcesLoader datasourceLoader;
- + datasourceLoader.load();
- m_playlistModel = new PlaylistModel(this);
- diff --git a/libs/mediacenter/plugin/qmlaccess.h b/libs/mediacenter/plugin/qmlaccess.h
- index 67d0826..6c8aeab 100644
- --- a/libs/mediacenter/plugin/qmlaccess.h
- +++ b/libs/mediacenter/plugin/qmlaccess.h
- @@ -25,7 +25,7 @@
- #include "mediacenter/backendsmodel.h"
- #include "mediacenter/abstractbrowsingbackend.h"
- #include "mediacenter/singletonfactory.h"
- -#include "mediacenter/mediasourcesloader.h"
- +#include "mediacenter/datasourcesloader.h"
- #include "mediacenter/mpris2/mediaplayer2player.h"
- class QMLAccess : public QObject
- diff --git a/mediasources/CMakeLists.txt b/mediasources/CMakeLists.txt
- deleted file mode 100644
- index a7171b7..0000000
- --- a/mediasources/CMakeLists.txt
- +++ /dev/null
- @@ -1,2 +0,0 @@
- -add_subdirectory(baloosearch)
- -add_subdirectory(filesystemsearch)
- diff --git a/mediasources/baloosearch/CMakeLists.txt b/mediasources/baloosearch/CMakeLists.txt
- deleted file mode 100644
- index 7bb831e..0000000
- --- a/mediasources/baloosearch/CMakeLists.txt
- +++ /dev/null
- @@ -1,26 +0,0 @@
- -if(NOT KF5Baloo_FOUND)
- - return()
- -endif()
- -find_package(KF5FileMetaData REQUIRED)
- -
- -set(baloosearch_SRCS
- - audiosearchresulthandler.cpp
- - videosearchresulthandler.cpp
- - imagesearchresulthandler.cpp
- - searchresulthandler.cpp
- - baloosearchmediasource.cpp
- -)
- -
- -add_library(pmc_baloosearch MODULE ${baloosearch_SRCS})
- -set_target_properties(pmc_baloosearch PROPERTIES PREFIX "")
- -
- -target_link_libraries(pmc_baloosearch
- - plasmamediacenter
- - Qt5::DBus
- - KF5::Baloo
- - KF5::FileMetaData
- -)
- -
- -kcoreaddons_desktop_to_json(pmc_baloosearch baloosearch.desktop)
- -
- -install(TARGETS pmc_baloosearch DESTINATION ${PLUGIN_INSTALL_DIR}/plasma/mediacenter/mediasources)
- diff --git a/mediasources/baloosearch/audiosearchresulthandler.cpp b/mediasources/baloosearch/audiosearchresulthandler.cpp
- deleted file mode 100644
- index 779bc73..0000000
- --- a/mediasources/baloosearch/audiosearchresulthandler.cpp
- +++ /dev/null
- @@ -1,70 +0,0 @@
- -/***********************************************************************************
- - * Copyright 2014 Shantanu Tushar <shantanu@kde.org> *
- - * *
- - * This library is free software; you can redistribute it and/or *
- - * modify it under the terms of the GNU Lesser General Public *
- - * License as published by the Free Software Foundation; either *
- - * version 2.1 of the License, or (at your option) any later version. *
- - * *
- - * 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, see <http://www.gnu.org/licenses/>. *
- - ***********************************************************************************/
- -
- -#include "audiosearchresulthandler.h"
- -
- -#include <mediacenter/mediacenter.h>
- -#include <mediacenter/medialibrary.h>
- -
- -#include <baloo/file.h>
- -#include <baloo/resultiterator.h>
- -
- -#include <QUrl>
- -
- -AudioSearchResultHandler::AudioSearchResultHandler(MediaLibrary* mediaLibrary,
- - QObject* parent)
- - : SearchResultHandler(mediaLibrary, parent)
- -{
- -}
- -
- -QString AudioSearchResultHandler::supportedMediaType() const
- -{
- - return "Audio";
- -}
- -
- -QString AudioSearchResultHandler::supportedMimeType() const
- -{
- - return "audio";
- -}
- -
- -void AudioSearchResultHandler::handleResultImpl(
- - const QString& filePath,
- - const QHash< int, QVariant >& values)
- -{
- - m_mediaLibrary->updateMedia(values);
- -
- - Baloo::File file(filePath);
- - file.load();
- -
- - QHash<int, QVariant> vals;
- -
- - const int duration = file.property(KFileMetaData::Property::Duration).toInt();
- - if (duration) {
- - vals.insert(MediaCenter::DurationRole, duration);
- - }
- -
- - const QString title = file.property(KFileMetaData::Property::Title).toString();
- - if (!title.isEmpty()) {
- - vals.insert(Qt::DisplayRole, title);
- - }
- -
- - vals.insert(MediaCenter::ArtistRole, file.property(KFileMetaData::Property::Artist));
- - vals.insert(MediaCenter::AlbumRole, file.property(KFileMetaData::Property::Album));
- - vals.insert(MediaCenter::AlbumArtistRole, file.property(KFileMetaData::Property::AlbumArtist));
- -
- - m_mediaLibrary->updateMedia(QUrl::fromLocalFile(file.path()).toString(), vals);
- -}
- diff --git a/mediasources/baloosearch/audiosearchresulthandler.h b/mediasources/baloosearch/audiosearchresulthandler.h
- deleted file mode 100644
- index c3a1ed7..0000000
- --- a/mediasources/baloosearch/audiosearchresulthandler.h
- +++ /dev/null
- @@ -1,40 +0,0 @@
- -/***********************************************************************************
- - * Copyright 2014 Shantanu Tushar <shantanu@kde.org> *
- - * *
- - * This library is free software; you can redistribute it and/or *
- - * modify it under the terms of the GNU Lesser General Public *
- - * License as published by the Free Software Foundation; either *
- - * version 2.1 of the License, or (at your option) any later version. *
- - * *
- - * 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, see <http://www.gnu.org/licenses/>. *
- - ***********************************************************************************/
- -
- -#ifndef AUDIOSEARCHRESULTHANDLER_H
- -#define AUDIOSEARCHRESULTHANDLER_H
- -
- -#include "searchresulthandler.h"
- -
- -#include <QVariant>
- -
- -class MediaLibrary;
- -
- -class AudioSearchResultHandler : public SearchResultHandler
- -{
- - Q_OBJECT
- -public:
- - AudioSearchResultHandler(MediaLibrary* mediaLibrary, QObject* parent);
- - virtual QString supportedMediaType() const;
- - virtual QString supportedMimeType() const;
- -
- -protected:
- - virtual void handleResultImpl(const QString& filePath,
- - const QHash< int, QVariant >& values);
- -};
- -
- -#endif // AUDIOSEARCHRESULTHANDLER_H
- diff --git a/mediasources/baloosearch/baloosearch.desktop b/mediasources/baloosearch/baloosearch.desktop
- deleted file mode 100644
- index ab6d76f..0000000
- --- a/mediasources/baloosearch/baloosearch.desktop
- +++ /dev/null
- @@ -1,81 +0,0 @@
- -[Desktop Entry]
- -Type=Service
- -Icon=baloo
- -Name=Baloo Search
- -Name[ar]=بحث بالو
- -Name[ca]=Cerca amb Baloo
- -Name[ca@valencia]=Cerca amb Baloo
- -Name[cs]=Baloo Search
- -Name[da]=Søgning med Baloo
- -Name[de]=Baloo-Suche
- -Name[el]=Αναζήτηση Baloo
- -Name[en_GB]=Baloo Search
- -Name[es]=Búsqueda de Baloo
- -Name[fi]=Baloo-haku
- -Name[gl]=Buscar con Baloo
- -Name[hu]=Baloo keresés
- -Name[id]=Pencarian Baloo
- -Name[it]=Ricerca con Baloo
- -Name[ko]=Baloo 검색
- -Name[lt]=Baloo paieška
- -Name[nl]=Zoeken met Baloo
- -Name[pl]=Wyszukiwarka Baloo
- -Name[pt]=Pesquisa no Baloo
- -Name[pt_BR]=Pesquisa do Baloo
- -Name[ro]=Căutare Baloo
- -Name[ru]=Поиск Baloo
- -Name[sk]=Hľadanie Baloo
- -Name[sl]=Iskanje Baloo
- -Name[sr]=Балуова претрага
- -Name[sr@ijekavian]=Балуова претрага
- -Name[sr@ijekavianlatin]=Balooova pretraga
- -Name[sr@latin]=Balooova pretraga
- -Name[sv]=Baloo-sökning
- -Name[tr]=Baloo Araması
- -Name[uk]=Пошук Baloo
- -Name[x-test]=xxBaloo Searchxx
- -Name[zh_CN]=Baloo 搜索
- -Name[zh_TW]=Baloo 搜尋
- -Comment=Get media from Baloo Search
- -Comment[ar]=احصل على الوسائط من بحث بالو
- -Comment[ca]=Obté medis de la cerca del Baloo
- -Comment[ca@valencia]=Obté medis de la cerca del Baloo
- -Comment[cs]=Získat média z Baloo Search
- -Comment[da]=Hent medier fra søgning med Baloo
- -Comment[de]=Medien von der Baloo-Suche holen
- -Comment[el]=Ανάκτηση πολυμέσων μέσω της αναζήτησης Baloo
- -Comment[en_GB]=Get media from Baloo Search
- -Comment[es]=Obtenga archivos multimedia de la búsqueda de Baloo
- -Comment[fi]=Hae mediaa Baloolla
- -Comment[gl]=Obter medios buscando con Baloo
- -Comment[hu]=Média beszerzése a Baloo keresésből
- -Comment[id]=Dapatkan media dari Pencarian Baloo
- -Comment[it]=Ottieni media dalla ricerca con Baloo
- -Comment[ko]=Baloo 검색에서 미디어 가져오기
- -Comment[lt]=Gauti mediją iš Baloo paieškos
- -Comment[nl]=Haal media uit Baloo-zoeken
- -Comment[pl]=Pobierz multimedia z wyszukiwarki Baloo
- -Comment[pt]=Obter conteúdos da pesquisa no Baloo
- -Comment[pt_BR]=Obtém a mídia a partir da Pesquisa do Baloo
- -Comment[ru]=Медиафайлы, найденные службой поиска Baloo
- -Comment[sk]=Získať médiá z hľadania Baloo
- -Comment[sl]=Pridobite predstavnostne datoteke iz Iskanja Baloo
- -Comment[sr]=Добавите медијуме преко Балуове претраге
- -Comment[sr@ijekavian]=Добавите медијуме преко Балуове претраге
- -Comment[sr@ijekavianlatin]=Dobavite medijume preko Balooove pretrage
- -Comment[sr@latin]=Dobavite medijume preko Balooove pretrage
- -Comment[sv]=Hämta media från Baloo-sökning
- -Comment[tr]=Baloo Aramasından ortam al
- -Comment[uk]=Отримати дані із засобу стільничного пошуку Baloo
- -Comment[x-test]=xxGet media from Baloo Searchxx
- -Comment[zh_TW]=從 Baloo 搜尋取得媒體
- -
- -X-KDE-ServiceTypes=Plasma/MediaCenter/MediaSource
- -
- -X-KDE-PluginInfo-Name=baloosearch
- -X-KDE-PluginInfo-Author=Sinny Kumari
- -X-KDE-PluginInfo-Email=ksinny@gmail.com
- -X-KDE-PluginInfo-Version=1.0
- -X-KDE-PluginInfo-License=GPL
- -X-KDE-PluginInfo-EnabledByDefault=true
- -X-KDE-Library=pmc_baloosearch
- diff --git a/mediasources/baloosearch/baloosearchmediasource.cpp b/mediasources/baloosearch/baloosearchmediasource.cpp
- deleted file mode 100644
- index e7c9c6e..0000000
- --- a/mediasources/baloosearch/baloosearchmediasource.cpp
- +++ /dev/null
- @@ -1,107 +0,0 @@
- -/***********************************************************************************
- - * Copyright 2014 Sinny Kumari <ksinny@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 as published by the Free Software Foundation; either *
- - * version 2.1 of the License, or (at your option) any later version. *
- - * *
- - * 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, see <http://www.gnu.org/licenses/>. *
- - ***********************************************************************************/
- -
- -#include "baloosearchmediasource.h"
- -
- -#include "imagesearchresulthandler.h"
- -#include "videosearchresulthandler.h"
- -#include "audiosearchresulthandler.h"
- -
- -#include <mediacenter/medialibrary.h>
- -#include <mediacenter/singletonfactory.h>
- -#include <mediacenter/mediacenter.h>
- -
- -#include <baloo/query.h>
- -#include <baloo/resultiterator.h>
- -#include <baloo/file.h>
- -
- -#include <QUrl>
- -#include <QDebug>
- -#include <QTimer>
- -#include <QDBusConnection>
- -#include <QMimeDatabase>
- -
- -MEDIACENTER_EXPORT_MEDIASOURCE(BalooSearchMediaSource, "baloosearch.json")
- -
- -BalooSearchMediaSource::BalooSearchMediaSource(QObject* parent, const QVariantList& args)
- - : AbstractMediaSource(parent, args)
- -{
- -
- - m_allowedMimes << "audio" << "image" << "video";
- -
- - QDBusConnection conn = QDBusConnection::sessionBus();
- - conn.connect(QString(), QLatin1String("/files"), QLatin1String("org.kde"), QLatin1String("changed"), this, SLOT(handleNewFile(QStringList)));
- -
- -}
- -
- -void BalooSearchMediaSource::run()
- -{
- - QTimer::singleShot(0, this, SLOT(startQuerying()));
- -
- - exec();
- -}
- -
- -void BalooSearchMediaSource::startQuerying()
- -{
- - MediaLibrary *mediaLibrary = SingletonFactory::instanceFor<MediaLibrary>();
- -
- - QList<SearchResultHandler*> searchResultHandlerList;
- - searchResultHandlerList << new ImageSearchResultHandler(mediaLibrary, this)
- - << new VideoSearchResultHandler(mediaLibrary, this)
- - << new AudioSearchResultHandler(mediaLibrary, this);
- -
- - Q_FOREACH(SearchResultHandler* searchResultHandler, searchResultHandlerList) {
- - m_searchResultHandlers.insert(searchResultHandler->supportedMediaType(), searchResultHandler);
- - m_searchResultHandlersByMimeType.insert(searchResultHandler->supportedMimeType(), searchResultHandler);
- - }
- -
- - Q_FOREACH(const QString &type, m_searchResultHandlers.keys()) {
- - queryForMediaType(type);
- - }
- -}
- -
- -void BalooSearchMediaSource::handleNewFile(const QStringList &files)
- -{
- - QMimeDatabase db;
- - for (auto file : files)
- - {
- - const QString fileMimeType = db.mimeTypeForUrl(QUrl::fromLocalFile(file)).name();
- - const QString topLevelMimeType = fileMimeType.split('/').at(0);
- -
- - if (m_allowedMimes.contains(topLevelMimeType)) {
- - SearchResultHandler *handler = m_searchResultHandlersByMimeType.value(topLevelMimeType);
- - handler->handleResult(file);
- - }
- - }
- -}
- -
- -void BalooSearchMediaSource::queryForMediaType(const QString& type)
- -{
- - Baloo::Query query;
- - query.addType(type);
- -
- - Baloo::ResultIterator it = query.exec();
- - SearchResultHandler *handler = m_searchResultHandlers.value(type);
- - while (it.next()) {
- - QString localUrl = it.filePath();
- - handler->handleResult(localUrl);
- - }
- -
- -}
- -
- -
- -#include "baloosearchmediasource.moc"
- diff --git a/mediasources/baloosearch/baloosearchmediasource.h b/mediasources/baloosearch/baloosearchmediasource.h
- deleted file mode 100644
- index ca0780e..0000000
- --- a/mediasources/baloosearch/baloosearchmediasource.h
- +++ /dev/null
- @@ -1,46 +0,0 @@
- -/***********************************************************************************
- - * Copyright 2014 Sinny Kumari <ksinny@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 as published by the Free Software Foundation; either *
- - * version 2.1 of the License, or (at your option) any later version. *
- - * *
- - * 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, see <http://www.gnu.org/licenses/>. *
- - ***********************************************************************************/
- -
- -#ifndef BALOOSEARCHMEDIASOURCE_H
- -#define BALOOSEARCHMEDIASOURCE_H
- -
- -#include <mediacenter/abstractmediasource.h>
- -
- -class SearchResultHandler;
- -
- -class BalooSearchMediaSource : public MediaCenter::AbstractMediaSource
- -{
- - Q_OBJECT
- -public:
- - explicit BalooSearchMediaSource(QObject* parent = 0, const QVariantList& args = QVariantList());
- -
- -protected:
- - virtual void run();
- -
- -private Q_SLOTS:
- - void startQuerying();
- - void handleNewFile(const QStringList &files);
- -
- -private:
- - QHash<QString, SearchResultHandler*> m_searchResultHandlers;
- - QHash<QString, SearchResultHandler*> m_searchResultHandlersByMimeType;
- -
- - void queryForMediaType(const QString &type);
- - QStringList m_allowedMimes;
- -};
- -
- -#endif // BALOOSEARCHMEDIASOURCE_H
- diff --git a/mediasources/baloosearch/imagesearchresulthandler.cpp b/mediasources/baloosearch/imagesearchresulthandler.cpp
- deleted file mode 100644
- index 4325ad4..0000000
- --- a/mediasources/baloosearch/imagesearchresulthandler.cpp
- +++ /dev/null
- @@ -1,92 +0,0 @@
- -/***********************************************************************************
- - * Copyright 2014 Shantanu Tushar <shantanu@kde.org> *
- - * *
- - * This library is free software; you can redistribute it and/or *
- - * modify it under the terms of the GNU Lesser General Public *
- - * License as published by the Free Software Foundation; either *
- - * version 2.1 of the License, or (at your option) any later version. *
- - * *
- - * 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, see <http://www.gnu.org/licenses/>. *
- - ***********************************************************************************/
- -
- -#include "imagesearchresulthandler.h"
- -#include <mediacenter/settings.h>
- -
- -#include <mediacenter/medialibrary.h>
- -#include <mediacenter/mediacenter.h>
- -
- -#include <baloo/resultiterator.h>
- -#include <baloo/file.h>
- -
- -#include <QDateTime>
- -#include <QUrl>
- -#include <QDebug>
- -
- -ImageSearchResultHandler::ImageSearchResultHandler(MediaLibrary* mediaLibrary, QObject* parent)
- - : SearchResultHandler(mediaLibrary, parent)
- - , m_minimumImageSize(Settings().value("minImageWidth", 500).toInt())
- -{
- -}
- -
- -QString ImageSearchResultHandler::supportedMediaType() const
- -{
- - return "Image";
- -}
- -
- -QString ImageSearchResultHandler::supportedMimeType() const
- -{
- - return "image";
- -}
- -
- -void ImageSearchResultHandler::handleResultImpl(
- - const QString& filePath,
- - const QHash< int, QVariant >& values)
- -{
- - const QString fileUrl = values.value(MediaCenter::MediaUrlRole).toUrl().toLocalFile();
- - m_initialValuesByUrl.insert(fileUrl, values);
- -
- - //We remove the create date as we want to fill it only for images taken with
- - //a camera or similar in slotFileReceived(). This is to make sure such
- - //photos appear before junk images in the browser.
- - m_initialValuesByUrl[fileUrl].remove(MediaCenter::CreatedAtRole);
- -
- - Baloo::File file(filePath);
- - file.load();
- -
- - //Properties that signify the actual date/time the image was taken by the
- - //camera
- - QList<KFileMetaData::Property::Property> properties;
- - properties << KFileMetaData::Property::PhotoDateTimeOriginal
- - << KFileMetaData::Property::ImageDateTime;
- -
- - auto photoWidth = file.property(KFileMetaData::Property::Width).toULongLong();
- -
- - if (!photoWidth || photoWidth < m_minimumImageSize) {
- - m_initialValuesByUrl.remove(fileUrl);
- - return;
- - }
- -
- - QDateTime created;
- - Q_FOREACH(KFileMetaData::Property::Property property, properties) {
- - created = file.property(property).toDateTime();
- - if (created.isValid()) {
- - break;
- - }
- - }
- -
- - QHash<int, QVariant> vals;
- - if (created.isValid()) {
- - vals.insert(MediaCenter::CreatedAtRole, created);
- - }
- -
- - vals.unite(m_initialValuesByUrl.take(fileUrl));
- -
- - m_mediaLibrary->updateMedia(QUrl::fromLocalFile(file.path()).toString(),
- - vals);
- -}
- diff --git a/mediasources/baloosearch/imagesearchresulthandler.h b/mediasources/baloosearch/imagesearchresulthandler.h
- deleted file mode 100644
- index 25a052a..0000000
- --- a/mediasources/baloosearch/imagesearchresulthandler.h
- +++ /dev/null
- @@ -1,42 +0,0 @@
- -/***********************************************************************************
- - * Copyright 2014 Shantanu Tushar <shantanu@kde.org> *
- - * *
- - * This library is free software; you can redistribute it and/or *
- - * modify it under the terms of the GNU Lesser General Public *
- - * License as published by the Free Software Foundation; either *
- - * version 2.1 of the License, or (at your option) any later version. *
- - * *
- - * 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, see <http://www.gnu.org/licenses/>. *
- - ***********************************************************************************/
- -
- -#ifndef IMAGESEARCHRESULTHANDLER_H
- -#define IMAGESEARCHRESULTHANDLER_H
- -
- -#include "searchresulthandler.h"
- -
- -#include <QHash>
- -
- -class ImageSearchResultHandler : public SearchResultHandler
- -{
- - Q_OBJECT
- -public:
- - ImageSearchResultHandler(MediaLibrary* mediaLibrary, QObject* parent);
- - virtual QString supportedMediaType() const;
- - virtual QString supportedMimeType() const;
- -
- -protected:
- - virtual void handleResultImpl(const QString& filePath,
- - const QHash< int, QVariant >& values);
- -
- -private:
- - unsigned int m_minimumImageSize;
- - QHash<QString, QHash<int, QVariant>> m_initialValuesByUrl;
- -};
- -
- -#endif // IMAGESEARCHRESULTHANDLER_H
- diff --git a/mediasources/baloosearch/searchresulthandler.cpp b/mediasources/baloosearch/searchresulthandler.cpp
- deleted file mode 100644
- index 4cf312e..0000000
- --- a/mediasources/baloosearch/searchresulthandler.cpp
- +++ /dev/null
- @@ -1,58 +0,0 @@
- -/***********************************************************************************
- - * Copyright 2014 Shantanu Tushar <shantanu@kde.org> *
- - * *
- - * This library is free software; you can redistribute it and/or *
- - * modify it under the terms of the GNU Lesser General Public *
- - * License as published by the Free Software Foundation; either *
- - * version 2.1 of the License, or (at your option) any later version. *
- - * *
- - * 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, see <http://www.gnu.org/licenses/>. *
- - ***********************************************************************************/
- -
- -#include "searchresulthandler.h"
- -
- -#include <mediacenter/medialibrary.h>
- -#include <mediacenter/mediacenter.h>
- -
- -#include <baloo/resultiterator.h>
- -
- -#include <QFileInfo>
- -#include <QDateTime>
- -#include <QVariant>
- -#include <QUrl>
- -#include <QMimeDatabase>
- -#include <KFileMetaData/UserMetaData>
- -
- -SearchResultHandler::SearchResultHandler(MediaLibrary *mediaLibrary, QObject* parent)
- - : QObject(parent)
- - , m_mediaLibrary(mediaLibrary)
- -{
- -}
- -
- -void SearchResultHandler::handleResult(QString &filePath)
- -{
- - QHash<int, QVariant> values;
- - const QUrl url = QUrl::fromLocalFile(filePath);
- - KFileMetaData::UserMetaData md(filePath);
- -
- - values.insert(Qt::DisplayRole, QVariant(url.fileName()));
- - values.insert(Qt::DecorationRole, QVariant(QMimeDatabase().mimeTypeForFile(filePath).iconName()));
- - values.insert(MediaCenter::MediaTypeRole, QVariant(supportedMediaType().toLower()));
- - values.insert(MediaCenter::MediaUrlRole, QVariant(url.toString()));
- - values.insert(MediaCenter::RatingRole, QVariant(md.rating()));
- -
- - //HACK: This is a workaround as Baloo does not provide creation or
- - // modification date/time through KFileMetaData::Property
- - values.insert(MediaCenter::CreatedAtRole,
- - QVariant(QFileInfo(filePath).created()));
- -
- - //Now collect information specific to this media type
- - handleResultImpl(filePath, values);
- -
- -}
- diff --git a/mediasources/baloosearch/searchresulthandler.h b/mediasources/baloosearch/searchresulthandler.h
- deleted file mode 100644
- index 44a46d0..0000000
- --- a/mediasources/baloosearch/searchresulthandler.h
- +++ /dev/null
- @@ -1,48 +0,0 @@
- -/***********************************************************************************
- - * Copyright 2014 Shantanu Tushar <shantanu@kde.org> *
- - * *
- - * This library is free software; you can redistribute it and/or *
- - * modify it under the terms of the GNU Lesser General Public *
- - * License as published by the Free Software Foundation; either *
- - * version 2.1 of the License, or (at your option) any later version. *
- - * *
- - * 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, see <http://www.gnu.org/licenses/>. *
- - ***********************************************************************************/
- -
- -#ifndef SEARCHRESULTHANDLER_H
- -#define SEARCHRESULTHANDLER_H
- -
- -#include <QObject>
- -#include <QString>
- -#include <QHash>
- -
- -namespace Baloo {
- -class ResultIterator;
- -}
- -
- -class MediaLibrary;
- -
- -class SearchResultHandler : public QObject
- -{
- - Q_OBJECT
- -public:
- - SearchResultHandler(MediaLibrary *mediaLibrary, QObject* parent);
- - virtual QString supportedMediaType() const = 0;
- - virtual QString supportedMimeType() const = 0;
- -
- - virtual void handleResult(QString &filePath);
- -
- -protected:
- - MediaLibrary *m_mediaLibrary;
- -
- - virtual void handleResultImpl(const QString &filePath,
- - const QHash<int, QVariant> &values) = 0;
- -};
- -
- -#endif // SEARCHRESULTHANDLER_H
- diff --git a/mediasources/baloosearch/videosearchresulthandler.cpp b/mediasources/baloosearch/videosearchresulthandler.cpp
- deleted file mode 100644
- index b3f7d29..0000000
- --- a/mediasources/baloosearch/videosearchresulthandler.cpp
- +++ /dev/null
- @@ -1,63 +0,0 @@
- -/***********************************************************************************
- - * Copyright 2014 Shantanu Tushar <shantanu@kde.org> *
- - * *
- - * This library is free software; you can redistribute it and/or *
- - * modify it under the terms of the GNU Lesser General Public *
- - * License as published by the Free Software Foundation; either *
- - * version 2.1 of the License, or (at your option) any later version. *
- - * *
- - * 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, see <http://www.gnu.org/licenses/>. *
- - ***********************************************************************************/
- -
- -#include "videosearchresulthandler.h"
- -
- -#include <mediacenter/medialibrary.h>
- -#include <mediacenter/mediacenter.h>
- -
- -#include <baloo/file.h>
- -#include <baloo/resultiterator.h>
- -
- -#include <QHash>
- -#include <QUrl>
- -
- -VideoSearchResultHandler::VideoSearchResultHandler(MediaLibrary* mediaLibrary,
- - QObject* parent)
- - : SearchResultHandler(mediaLibrary, parent)
- -{
- -
- -}
- -
- -QString VideoSearchResultHandler::supportedMediaType() const
- -{
- - return "Video";
- -}
- -
- -QString VideoSearchResultHandler::supportedMimeType() const
- -{
- - return "video";
- -}
- -
- -void VideoSearchResultHandler::handleResultImpl(
- - const QString& filePath,
- - const QHash< int, QVariant >& values)
- -{
- - m_mediaLibrary->updateMedia(values);
- -
- - Baloo::File file(filePath);
- - file.load();
- -
- - QHash<int, QVariant> vals;
- -
- - const int duration = file.property(KFileMetaData::Property::Duration).toInt();
- - if (duration) {
- - vals.insert(MediaCenter::DurationRole, duration);
- - }
- -
- - m_mediaLibrary->updateMedia(QUrl::fromLocalFile(file.path()).toString(), vals);
- -}
- diff --git a/mediasources/baloosearch/videosearchresulthandler.h b/mediasources/baloosearch/videosearchresulthandler.h
- deleted file mode 100644
- index 4c35688..0000000
- --- a/mediasources/baloosearch/videosearchresulthandler.h
- +++ /dev/null
- @@ -1,38 +0,0 @@
- -/***********************************************************************************
- - * Copyright 2014 Shantanu Tushar <shantanu@kde.org> *
- - * *
- - * This library is free software; you can redistribute it and/or *
- - * modify it under the terms of the GNU Lesser General Public *
- - * License as published by the Free Software Foundation; either *
- - * version 2.1 of the License, or (at your option) any later version. *
- - * *
- - * 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, see <http://www.gnu.org/licenses/>. *
- - ***********************************************************************************/
- -
- -#ifndef VIDEOSEARCHRESULTHANDLER_H
- -#define VIDEOSEARCHRESULTHANDLER_H
- -
- -#include "searchresulthandler.h"
- -
- -#include <QVariant>
- -
- -class VideoSearchResultHandler : public SearchResultHandler
- -{
- - Q_OBJECT
- -public:
- - VideoSearchResultHandler(MediaLibrary* mediaLibrary, QObject* parent);
- - virtual QString supportedMediaType() const;
- - virtual QString supportedMimeType() const;
- -
- -protected:
- - virtual void handleResultImpl(const QString& filePath,
- - const QHash< int, QVariant >& values);
- -};
- -
- -#endif // VIDEOSEARCHRESULTHANDLER_H
- diff --git a/mediasources/filesystemsearch/CMakeLists.txt b/mediasources/filesystemsearch/CMakeLists.txt
- deleted file mode 100644
- index 6b5f4bc..0000000
- --- a/mediasources/filesystemsearch/CMakeLists.txt
- +++ /dev/null
- @@ -1,14 +0,0 @@
- -set(filesystemsearch_SRCS
- - filesystemsearchmediasource.cpp
- -)
- -
- -add_library(pmc_filesystemsearch MODULE ${filesystemsearch_SRCS})
- -set_target_properties(pmc_filesystemsearch PROPERTIES PREFIX "")
- -
- -target_link_libraries(pmc_filesystemsearch
- - plasmamediacenter
- -)
- -
- -kcoreaddons_desktop_to_json(pmc_filesystemsearch filesystemsearch.desktop)
- -
- -install(TARGETS pmc_filesystemsearch DESTINATION ${PLUGIN_INSTALL_DIR}/plasma/mediacenter/mediasources)
- diff --git a/mediasources/filesystemsearch/filesystemsearch.desktop b/mediasources/filesystemsearch/filesystemsearch.desktop
- deleted file mode 100644
- index 4f19d8b..0000000
- --- a/mediasources/filesystemsearch/filesystemsearch.desktop
- +++ /dev/null
- @@ -1,80 +0,0 @@
- -[Desktop Entry]
- -Type=Service
- -Icon=drive-harddisk
- -Name=Filesystem Search
- -Name[ar]=بحث نظام الملفّات
- -Name[ca]=Cerca al sistema de fitxers
- -Name[ca@valencia]=Cerca al sistema de fitxers
- -Name[cs]=Prohledávání souborového systému
- -Name[da]=Søgning på filsystem
- -Name[de]=Dateisystem-Suche
- -Name[el]=Αναζήτηση στο σύστημα αρχείων
- -Name[en_GB]=Filesystem Search
- -Name[es]=Búsqueda del sistema de archivos
- -Name[fi]=Tiedostojärjestelmähaku
- -Name[gl]=Busca no sistema de ficheiros
- -Name[hu]=Fájlrendszer keresés
- -Name[id]=Pencarian Filesystem
- -Name[it]=Ricerca nel filesystem
- -Name[ko]=파일 시스템 검색
- -Name[lt]=Failų sistemos paieška
- -Name[nl]=Zoeken in het bestandssysteem
- -Name[pl]=Wyszukiwanie w systemie plików
- -Name[pt]=Pesquisa no Sistema de Ficheiros
- -Name[pt_BR]=Pesquisa no sistema de arquivos
- -Name[ru]=Поиск в файловой системе
- -Name[sk]=Hľadanie v súborovom systéme
- -Name[sl]=Iskanje po datotečnem sistemu
- -Name[sr]=Претрага фајл система
- -Name[sr@ijekavian]=Претрага фајл система
- -Name[sr@ijekavianlatin]=Pretraga fajl sistema
- -Name[sr@latin]=Pretraga fajl sistema
- -Name[sv]=Sökning i filsystem
- -Name[tr]=Dosya Sistemi Araması
- -Name[uk]=Пошук у файловій системі
- -Name[x-test]=xxFilesystem Searchxx
- -Name[zh_CN]=文件系统搜索
- -Name[zh_TW]=檔案系統搜尋
- -Comment=Get media from your local files
- -Comment[ar]=احصل على وسائط من ملفّاتك المحليّة
- -Comment[ca]=Obté medis de la cerca als fitxers locals
- -Comment[ca@valencia]=Obté medis de la cerca als fitxers locals
- -Comment[cs]=Získat média z místních souborů
- -Comment[da]=Hent medier fra dine lokale filer
- -Comment[de]=Medien von lokalen Dateien holen
- -Comment[el]=Ανάκτηση πολυμέσων από τα τοπικά αρχεία σας
- -Comment[en_GB]=Get media from your local files
- -Comment[es]=Obtenga archivos multimedia de sus archivos locales
- -Comment[fi]=Hae mediaa paikallisista tiedostoista
- -Comment[gl]=Engadir medios locais
- -Comment[hu]=Média beszerzése a helyi fájlokból
- -Comment[id]=Dapatkan media dari berkas lokal anda
- -Comment[it]=Ottieni media dai tuoi file locali
- -Comment[ko]=로컬 파일에서 미디어 가져오기
- -Comment[lt]=Gauti mediją iš vietinių failų
- -Comment[nl]=Haal media uit uw lokale bestanden
- -Comment[pl]=Pobierz multimedia ze swoich plików lokalnych
- -Comment[pt]=Obter conteúdos dos seus ficheiros locais
- -Comment[pt_BR]=Obtém a mídia a partir dos seus arquivos locais
- -Comment[ru]=Медиафайлы, найденные на компьютере
- -Comment[sk]=Získať médiá z vašich miestnych súborov
- -Comment[sl]=Pridobite predstavnostne datoteke iz krajevnih datotek
- -Comment[sr]=Добавите медијуме из локалних фајлова
- -Comment[sr@ijekavian]=Добавите медијуме из локалних фајлова
- -Comment[sr@ijekavianlatin]=Dobavite medijume iz lokalnih fajlova
- -Comment[sr@latin]=Dobavite medijume iz lokalnih fajlova
- -Comment[sv]=Hämta media från lokala filer
- -Comment[tr]=Yerel dosyalarınızdan ortam alın
- -Comment[uk]=Отримати мультимедійні дані з локальних файлів
- -Comment[x-test]=xxGet media from your local filesxx
- -Comment[zh_TW]=從您的本地端檔案取得媒體
- -
- -X-KDE-ServiceTypes=Plasma/MediaCenter/MediaSource
- -
- -X-KDE-PluginInfo-Name=filsystemsearch
- -X-KDE-PluginInfo-Author=Shantanu Tushar
- -X-KDE-PluginInfo-Email=shantanu@kde.org
- -X-KDE-PluginInfo-Version=1.0
- -X-KDE-PluginInfo-License=GPL
- -X-KDE-PluginInfo-EnabledByDefault=true
- -X-KDE-Library=pmc_filesystemsearch
- diff --git a/mediasources/filesystemsearch/filesystemsearchmediasource.cpp b/mediasources/filesystemsearch/filesystemsearchmediasource.cpp
- deleted file mode 100644
- index 489dbe9..0000000
- --- a/mediasources/filesystemsearch/filesystemsearchmediasource.cpp
- +++ /dev/null
- @@ -1,110 +0,0 @@
- -/***********************************************************************************
- - * Copyright 2014 Shantanu Tushar <shantanu@kde.org> *
- - * *
- - * This library is free software; you can redistribute it and/or *
- - * modify it under the terms of the GNU Lesser General Public *
- - * License as published by the Free Software Foundation; either *
- - * version 2.1 of the License, or (at your option) any later version. *
- - * *
- - * 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, see <http://www.gnu.org/licenses/>. *
- - ***********************************************************************************/
- -
- -#include "filesystemsearchmediasource.h"
- -
- -#include <mediacenter/singletonfactory.h>
- -#include <mediacenter/medialibrary.h>
- -#include <mediacenter/mediacenter.h>
- -
- -#include <QUrl>
- -#include <QDir>
- -#include <QDebug>
- -#include <QMimeType>
- -#include <QMimeDatabase>
- -
- -MEDIACENTER_EXPORT_MEDIASOURCE(FilesystemSearchMediaSource, "filesystemsearch.json")
- -
- -FilesystemSearchMediaSource::FilesystemSearchMediaSource(QObject* parent, const QVariantList& args)
- - : AbstractMediaSource(parent, args),
- - m_quit(false)
- -{
- - m_allowedMimes << "audio" << "image" << "video";
- -}
- -
- -FilesystemSearchMediaSource::~FilesystemSearchMediaSource()
- -{
- - qDebug() << "Waiting for Filesystem Search to quit...";
- - stop();
- - wait();
- -}
- -
- -void FilesystemSearchMediaSource::run()
- -{
- - setPriority(IdlePriority);
- - recursiveSearch(QDir::home());
- - qDebug() << "Done scanning the Filesystem";
- -}
- -
- -bool FilesystemSearchMediaSource::recursiveSearch(const QDir &dir)
- -{
- - if (shouldQuit()) return false;
- -
- - Q_FOREACH(const QFileInfo &fileInfo, dir.entryInfoList(QDir::Files)) {
- - if (shouldQuit()) return false;
- - checkAndAddFile(fileInfo);
- - }
- -
- - Q_FOREACH(const QFileInfo &dirInfo, dir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot)) {
- - if (shouldQuit()) return false;
- - if (!recursiveSearch(QDir(dirInfo.absoluteFilePath()))) {
- - break;
- - }
- - }
- -
- - return true;
- -}
- -
- -bool FilesystemSearchMediaSource::shouldQuit() const
- -{
- - QMutexLocker l(&m_quitMutex);
- - return m_quit;
- -}
- -
- -void FilesystemSearchMediaSource::stop()
- -{
- - QMutexLocker l(&m_quitMutex);
- - m_quit = true;
- -}
- -
- -bool FilesystemSearchMediaSource::checkAndAddFile(const QFileInfo& fileInfo)
- -{
- - QMimeDatabase db;
- - const QString mimeType = db.mimeTypeForFile(fileInfo).name();
- - const QString topLevelTypeName = mimeType.split('/').at(0);
- -
- - if (!topLevelTypeName.isEmpty() && m_allowedMimes.contains(topLevelTypeName)) {
- - addFile(fileInfo, topLevelTypeName);
- - return true;
- - }
- -
- - return false;
- -}
- -
- -void FilesystemSearchMediaSource::addFile(const QFileInfo& fileInfo,
- - const QString &type)
- -{
- - QHash<int, QVariant> values;
- -
- - values.insert(Qt::DisplayRole, fileInfo.fileName());
- - values.insert(MediaCenter::MediaUrlRole, QUrl::fromLocalFile(fileInfo.absoluteFilePath()).toString());
- - values.insert(MediaCenter::MediaTypeRole, type);
- -
- - SingletonFactory::instanceFor<MediaLibrary>()->updateMedia(values);
- -}
- -
- -#include "filesystemsearchmediasource.moc"
- diff --git a/mediasources/filesystemsearch/filesystemsearchmediasource.h b/mediasources/filesystemsearch/filesystemsearchmediasource.h
- deleted file mode 100644
- index 88740b8..0000000
- --- a/mediasources/filesystemsearch/filesystemsearchmediasource.h
- +++ /dev/null
- @@ -1,57 +0,0 @@
- -/***********************************************************************************
- - * Copyright 2014 Shantanu Tushar <shantanu@kde.org> *
- - * *
- - * This library is free software; you can redistribute it and/or *
- - * modify it under the terms of the GNU Lesser General Public *
- - * License as published by the Free Software Foundation; either *
- - * version 2.1 of the License, or (at your option) any later version. *
- - * *
- - * 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, see <http://www.gnu.org/licenses/>. *
- - ***********************************************************************************/
- -
- -#ifndef FILESYSTEMSEARCHMEDIASOURCE_H
- -#define FILESYSTEMSEARCHMEDIASOURCE_H
- -
- -#include <mediacenter/abstractmediasource.h>
- -
- -#include <QMutex>
- -
- -class QFileInfo;
- -class QDir;
- -
- -/**
- - * \brief Goes through the user's home dir and searches for media
- - *
- - * This MediaSource is supposed to be used for a better-than-nothing scenario
- - * when none of Baloo or Nepomuk are installed. As such this MediaSource does
- - * not attempt 100% correctness and is not configurable at all.
- - */
- -class FilesystemSearchMediaSource : public MediaCenter::AbstractMediaSource
- -{
- -public:
- - explicit FilesystemSearchMediaSource(QObject* parent = 0, const QVariantList& = QVariantList());
- - virtual ~FilesystemSearchMediaSource();
- -
- -protected:
- - virtual void run();
- -
- -private:
- - mutable QMutex m_quitMutex;
- - bool m_quit;
- -
- - QStringList m_allowedMimes;
- -
- - bool shouldQuit() const;
- - bool recursiveSearch(const QDir& dir);
- - void stop();
- - bool checkAndAddFile(const QFileInfo &fileInfo);
- - void addFile(const QFileInfo &fileInfo, const QString &type);
- -};
- -
- -#endif // FILESYSTEMSEARCHMEDIASOURCE_H
- diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
- index cba4fe6..d1553d6 100644
- --- a/tests/CMakeLists.txt
- +++ b/tests/CMakeLists.txt
- @@ -1 +1,2 @@
- add_subdirectory(mediasourceloadertest)
- +
- diff --git a/tests/mediasourceloadertest/mediasourceloadertest.cpp b/tests/mediasourceloadertest/mediasourceloadertest.cpp
- index 3ae99f4..315ca40 100644
- --- a/tests/mediasourceloadertest/mediasourceloadertest.cpp
- +++ b/tests/mediasourceloadertest/mediasourceloadertest.cpp
- @@ -19,12 +19,12 @@
- */
- #include <QCoreApplication>
- -#include "mediacenter/mediasourcesloader.h"
- +#include "mediacenter/datasourcesloader.h"
- int main(int argc, char *argv[])
- {
- QCoreApplication app(argc, argv);
- - MediaSourcesLoader mediasourcesloader;
- - mediasourcesloader.load();
- + DataSourcesLoader datasourcesloader;
- + datasourcesloader.load();
- return app.exec();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement