SHARE
TWEET

Untitled

a guest Oct 27th, 2015 108 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. diff --git a/CMakeLists.txt b/CMakeLists.txt
  2. index 8c42ead..e0a2c65 100644
  3. --- a/CMakeLists.txt
  4. +++ b/CMakeLists.txt
  5. @@ -74,7 +74,7 @@ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${KDE_ENABLE_EXCEPTIONS}")
  6.  set(CMAKE_AUTOMOC ON)
  7.  
  8.  add_subdirectory(browsingbackends)
  9. -add_subdirectory(mediasources)
  10. +add_subdirectory(datasources)
  11.  #add_subdirectory(onlineservices)
  12.  add_subdirectory(mediaelements)
  13.  add_subdirectory(components)
  14. diff --git a/libs/mediacenter/CMakeLists.txt b/libs/mediacenter/CMakeLists.txt
  15. index fb36115..cadc901 100644
  16. --- a/libs/mediacenter/CMakeLists.txt
  17. +++ b/libs/mediacenter/CMakeLists.txt
  18. @@ -29,8 +29,8 @@ set (plasmamediacenter_SRCS
  19.      pmcalbum.cpp
  20.      pmcartist.cpp
  21.      filtermediamodel.cpp
  22. -    abstractmediasource.cpp
  23. -    mediasourcesloader.cpp
  24. +    abstractdatasource.cpp
  25. +    datasourcesloader.cpp
  26.      singletonfactory.cpp
  27.      mediavalidator.cpp
  28.      settings.cpp
  29. @@ -91,7 +91,7 @@ set_target_properties(plasmamediacenter PROPERTIES VERSION ${PROJECT_VERSION} SO
  30.  install(TARGETS plasmamediacenter ${INSTALL_TARGETS_DEFAULT_ARGS} LIBRARY NAMELINK_SKIP)
  31.  
  32.  install(FILES data/servicetypes/pmc_browsingbackend.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR})
  33. -install(FILES data/servicetypes/pmc_mediasource.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR})
  34. +install(FILES data/servicetypes/pmc_datasource.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR})
  35.  
  36.  add_subdirectory(plugin)
  37.  
  38. diff --git a/libs/mediacenter/abstractmediasource.cpp b/libs/mediacenter/abstractmediasource.cpp
  39. deleted file mode 100644
  40. index 075bc40..0000000
  41. --- a/libs/mediacenter/abstractmediasource.cpp
  42. +++ /dev/null
  43. @@ -1,51 +0,0 @@
  44. -/***********************************************************************************
  45. - *   Copyright 2014 Shantanu Tushar <shantanu@kde.org>                             *
  46. - *   Copyright 2014 Sinny Kumari <ksinny@gmail.com>                                *
  47. - *                                                                                 *
  48. - *                                                                                 *
  49. - *   This library is free software; you can redistribute it and/or                 *
  50. - *   modify it under the terms of the GNU Lesser General Public                    *
  51. - *   License as published by the Free Software Foundation; either                  *
  52. - *   version 2.1 of the License, or (at your option) any later version.            *
  53. - *                                                                                 *
  54. - *   This library is distributed in the hope that it will be useful,               *
  55. - *   but WITHOUT ANY WARRANTY; without even the implied warranty of                *
  56. - *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU             *
  57. - *   Lesser General Public License for more details.                               *
  58. - *                                                                                 *
  59. - *   You should have received a copy of the GNU Lesser General Public              *
  60. - *   License along with this library.  If not, see <http://www.gnu.org/licenses/>. *
  61. - ***********************************************************************************/
  62. -
  63. -#include "abstractmediasource.h"
  64. -#include <QDebug>
  65. -
  66. -using namespace MediaCenter;
  67. -
  68. -class AbstractMediaSource::Private
  69. -{
  70. -public:
  71. -    Private() : mediaLibrary(0) {}
  72. -    MediaLibrary* mediaLibrary;
  73. -};
  74. -
  75. -AbstractMediaSource::AbstractMediaSource(QObject* parent, const QVariantList&)
  76. -    : QThread(parent), d(new Private)
  77. -{
  78. -    moveToThread(this);
  79. -}
  80. -
  81. -AbstractMediaSource::~AbstractMediaSource()
  82. -{
  83. -
  84. -}
  85. -
  86. -void AbstractMediaSource::setMediaLibrary(MediaLibrary* mediaLibrary)
  87. -{
  88. -    d->mediaLibrary = mediaLibrary;
  89. -}
  90. -
  91. -MediaLibrary* AbstractMediaSource::mediaLibrary() const
  92. -{
  93. -    return d->mediaLibrary;
  94. -}
  95. diff --git a/libs/mediacenter/abstractmediasource.h b/libs/mediacenter/abstractmediasource.h
  96. deleted file mode 100644
  97. index c2f3796..0000000
  98. --- a/libs/mediacenter/abstractmediasource.h
  99. +++ /dev/null
  100. @@ -1,52 +0,0 @@
  101. -/***********************************************************************************
  102. - *   Copyright 2014 Shantanu Tushar <shantanu@kde.org>                             *
  103. - *   Copyright 2014 Sinny Kumari <ksinny@gmail.com>                                *
  104. - *                                                                                 *
  105. - *                                                                                 *
  106. - *   This library is free software; you can redistribute it and/or                 *
  107. - *   modify it under the terms of the GNU Lesser General Public                    *
  108. - *   License as published by the Free Software Foundation; either                  *
  109. - *   version 2.1 of the License, or (at your option) any later version.            *
  110. - *                                                                                 *
  111. - *   This library is distributed in the hope that it will be useful,               *
  112. - *   but WITHOUT ANY WARRANTY; without even the implied warranty of                *
  113. - *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU             *
  114. - *   Lesser General Public License for more details.                               *
  115. - *                                                                                 *
  116. - *   You should have received a copy of the GNU Lesser General Public              *
  117. - *   License along with this library.  If not, see <http://www.gnu.org/licenses/>. *
  118. - ***********************************************************************************/
  119. -
  120. -#ifndef ABSTRACTMEDIASOURCE_H
  121. -#define ABSTRACTMEDIASOURCE_H
  122. -
  123. -#include <QtCore/QThread>
  124. -#include <KPluginInfo>
  125. -
  126. -#include "mediacenter_export.h"
  127. -
  128. -class MediaLibrary;
  129. -
  130. -namespace MediaCenter {
  131. -class MEDIACENTER_EXPORT AbstractMediaSource : public QThread
  132. -{
  133. -    Q_OBJECT
  134. -public:
  135. -    explicit AbstractMediaSource(QObject* parent = 0, const QVariantList& = QVariantList());
  136. -    ~AbstractMediaSource();
  137. -
  138. -    void setMediaLibrary(MediaLibrary *mediaLibrary);
  139. -
  140. -protected:
  141. -    MediaLibrary *mediaLibrary() const;
  142. -
  143. -private:
  144. -    class Private;
  145. -    Private * const d;
  146. -};
  147. -}
  148. -
  149. -#define MEDIACENTER_EXPORT_MEDIASOURCE(classname, jsonfile) \
  150. -    K_PLUGIN_FACTORY_WITH_JSON( MediaSourceFactory, jsonfile, registerPlugin< classname >(); )
  151. -
  152. -#endif // ABSTRACTMEDIASOURCE_H
  153. diff --git a/libs/mediacenter/data/servicetypes/pmc_mediasource.desktop b/libs/mediacenter/data/servicetypes/pmc_mediasource.desktop
  154. deleted file mode 100644
  155. index c5ed06e..0000000
  156. --- a/libs/mediacenter/data/servicetypes/pmc_mediasource.desktop
  157. +++ /dev/null
  158. @@ -1,3 +0,0 @@
  159. -[Desktop Entry]
  160. -Type=ServiceType
  161. -X-KDE-ServiceType=Plasma/MediaCenter/MediaSource
  162. diff --git a/libs/mediacenter/mediasourcesloader.cpp b/libs/mediacenter/mediasourcesloader.cpp
  163. deleted file mode 100644
  164. index ebf7403..0000000
  165. --- a/libs/mediacenter/mediasourcesloader.cpp
  166. +++ /dev/null
  167. @@ -1,62 +0,0 @@
  168. -/***********************************************************************************
  169. - *   Copyright 2014 Shantanu Tushar <shantanu@kde.org>                             *
  170. - *   Copyright 2014 Sinny Kumari <ksinny@gmail.com>                                *
  171. - *                                                                                 *
  172. - *                                                                                 *
  173. - *   This library is free software; you can redistribute it and/or                 *
  174. - *   modify it under the terms of the GNU Lesser General Public                    *
  175. - *   License as published by the Free Software Foundation; either                  *
  176. - *   version 2.1 of the License, or (at your option) any later version.            *
  177. - *                                                                                 *
  178. - *   This library is distributed in the hope that it will be useful,               *
  179. - *   but WITHOUT ANY WARRANTY; without even the implied warranty of                *
  180. - *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU             *
  181. - *   Lesser General Public License for more details.                               *
  182. - *                                                                                 *
  183. - *   You should have received a copy of the GNU Lesser General Public              *
  184. - *   License along with this library.  If not, see <http://www.gnu.org/licenses/>. *
  185. - ***********************************************************************************/
  186. -
  187. -#include "mediasourcesloader.h"
  188. -#include "medialibrary.h"
  189. -#include "abstractmediasource.h"
  190. -
  191. -#include "singletonfactory.h"
  192. -
  193. -#include <KPluginTrader>
  194. -#include <KPluginInfo>
  195. -#include <QDebug>
  196. -#include <QApplication>
  197. -
  198. -MediaSourcesLoader::MediaSourcesLoader(QObject* parent): QObject(parent)
  199. -{
  200. -
  201. -}
  202. -
  203. -void MediaSourcesLoader::load()
  204. -{
  205. -    KPluginInfo::List pluginInfo = KPluginTrader::self()->query("plasma/mediacenter/mediasources");
  206. -    if (pluginInfo.isEmpty()) {
  207. -        qWarning() << "no available media sources";
  208. -    }
  209. -
  210. -    Q_FOREACH (const KPluginInfo &info, pluginInfo) {
  211. -        KPluginLoader loader(info.libraryPath());
  212. -        KPluginFactory* factory = loader.factory();
  213. -
  214. -        const QVariantList args = QVariantList() << loader.metaData().toVariantMap();
  215. -        if(factory)
  216. -        {
  217. -            MediaCenter::AbstractMediaSource *mediaSource = factory->create<MediaCenter::AbstractMediaSource>(0, args);
  218. -            if (mediaSource) {
  219. -                mediaSource->setMediaLibrary(SingletonFactory::instanceFor<MediaLibrary>());
  220. -                mediaSource->start();
  221. -                connect(QApplication::instance(), SIGNAL(destroyed(QObject*)), mediaSource, SLOT(quit()));
  222. -                qDebug() << "created instance for media source" << info.name();
  223. -            } else {
  224. -                qDebug() << "Could not create a instance for the media source " << info.name();
  225. -            }
  226. -        }
  227. -
  228. -    }
  229. -}
  230. diff --git a/libs/mediacenter/mediasourcesloader.h b/libs/mediacenter/mediasourcesloader.h
  231. deleted file mode 100644
  232. index c24b0d1..0000000
  233. --- a/libs/mediacenter/mediasourcesloader.h
  234. +++ /dev/null
  235. @@ -1,41 +0,0 @@
  236. -/***********************************************************************************
  237. - *   Copyright 2014 Shantanu Tushar <shantanu@kde.org>                             *
  238. - *   Copyright 2014 Sinny Kumari <ksinny@gmail.com>                                *
  239. - *                                                                                 *
  240. - *                                                                                 *
  241. - *   This library is free software; you can redistribute it and/or                 *
  242. - *   modify it under the terms of the GNU Lesser General Public                    *
  243. - *   License as published by the Free Software Foundation; either                  *
  244. - *   version 2.1 of the License, or (at your option) any later version.            *
  245. - *                                                                                 *
  246. - *   This library is distributed in the hope that it will be useful,               *
  247. - *   but WITHOUT ANY WARRANTY; without even the implied warranty of                *
  248. - *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU             *
  249. - *   Lesser General Public License for more details.                               *
  250. - *                                                                                 *
  251. - *   You should have received a copy of the GNU Lesser General Public              *
  252. - *   License along with this library.  If not, see <http://www.gnu.org/licenses/>. *
  253. - ***********************************************************************************/
  254. -
  255. -#ifndef MEDIASOURCESLOADER_H
  256. -#define MEDIASOURCESLOADER_H
  257. -
  258. -#include <QtCore/QObject>
  259. -
  260. -#include "mediacenter_export.h"
  261. -
  262. -namespace MediaCenter {
  263. -class AbstractMediaSource;
  264. -}
  265. -
  266. -class MEDIACENTER_EXPORT MediaSourcesLoader : public QObject
  267. -{
  268. -    Q_OBJECT
  269. -public:
  270. -    explicit MediaSourcesLoader(QObject* parent = 0);
  271. -
  272. -public Q_SLOTS:
  273. -    void load();
  274. -};
  275. -
  276. -#endif // MEDIASOURCESLOADER_H
  277. diff --git a/libs/mediacenter/plugin/mediacenterplugin.cpp b/libs/mediacenter/plugin/mediacenterplugin.cpp
  278. index ba091d6..07d3ae0 100644
  279. --- a/libs/mediacenter/plugin/mediacenterplugin.cpp
  280. +++ b/libs/mediacenter/plugin/mediacenterplugin.cpp
  281. @@ -25,7 +25,7 @@
  282.  #include "mediacenter/multipleplaylistmodel.h"
  283.  #include "mediacenter/objectpair.h"
  284.  #include "mediacenter/settings.h"
  285. -#include "mediacenter/mediasourcesloader.h"
  286. +#include "mediacenter/datasourcesloader.h"
  287.  #include "mediacenter/abstractbrowsingbackend.h"
  288.  #include "mediacenter/medialibrary.h"
  289.  #include "mediacenter/runtimedata.h"
  290. diff --git a/libs/mediacenter/plugin/qmlaccess.cpp b/libs/mediacenter/plugin/qmlaccess.cpp
  291. index da3810e..c0a7071 100644
  292. --- a/libs/mediacenter/plugin/qmlaccess.cpp
  293. +++ b/libs/mediacenter/plugin/qmlaccess.cpp
  294. @@ -28,8 +28,8 @@ QMLAccess::QMLAccess(QObject *parent) : QObject(parent)
  295.  {
  296.      SingletonFactory::instanceFor<MediaLibrary>()->start();
  297.  
  298. -    MediaSourcesLoader mediasourceLoader;
  299. -    mediasourceLoader.load();
  300. +    DataSourcesLoader datasourceLoader;
  301. +    datasourceLoader.load();
  302.  
  303.      m_playlistModel = new PlaylistModel(this);
  304.  
  305. diff --git a/libs/mediacenter/plugin/qmlaccess.h b/libs/mediacenter/plugin/qmlaccess.h
  306. index 67d0826..6c8aeab 100644
  307. --- a/libs/mediacenter/plugin/qmlaccess.h
  308. +++ b/libs/mediacenter/plugin/qmlaccess.h
  309. @@ -25,7 +25,7 @@
  310.  #include "mediacenter/backendsmodel.h"
  311.  #include "mediacenter/abstractbrowsingbackend.h"
  312.  #include "mediacenter/singletonfactory.h"
  313. -#include "mediacenter/mediasourcesloader.h"
  314. +#include "mediacenter/datasourcesloader.h"
  315.  #include "mediacenter/mpris2/mediaplayer2player.h"
  316.  
  317.  class QMLAccess : public QObject
  318. diff --git a/mediasources/CMakeLists.txt b/mediasources/CMakeLists.txt
  319. deleted file mode 100644
  320. index a7171b7..0000000
  321. --- a/mediasources/CMakeLists.txt
  322. +++ /dev/null
  323. @@ -1,2 +0,0 @@
  324. -add_subdirectory(baloosearch)
  325. -add_subdirectory(filesystemsearch)
  326. diff --git a/mediasources/baloosearch/CMakeLists.txt b/mediasources/baloosearch/CMakeLists.txt
  327. deleted file mode 100644
  328. index 7bb831e..0000000
  329. --- a/mediasources/baloosearch/CMakeLists.txt
  330. +++ /dev/null
  331. @@ -1,26 +0,0 @@
  332. -if(NOT KF5Baloo_FOUND)
  333. -    return()
  334. -endif()
  335. -find_package(KF5FileMetaData REQUIRED)
  336. -
  337. -set(baloosearch_SRCS
  338. -    audiosearchresulthandler.cpp
  339. -    videosearchresulthandler.cpp
  340. -    imagesearchresulthandler.cpp
  341. -    searchresulthandler.cpp
  342. -    baloosearchmediasource.cpp
  343. -)
  344. -
  345. -add_library(pmc_baloosearch MODULE ${baloosearch_SRCS})
  346. -set_target_properties(pmc_baloosearch PROPERTIES PREFIX "")
  347. -
  348. -target_link_libraries(pmc_baloosearch
  349. -    plasmamediacenter
  350. -    Qt5::DBus
  351. -    KF5::Baloo
  352. -    KF5::FileMetaData
  353. -)
  354. -
  355. -kcoreaddons_desktop_to_json(pmc_baloosearch baloosearch.desktop)
  356. -
  357. -install(TARGETS pmc_baloosearch DESTINATION ${PLUGIN_INSTALL_DIR}/plasma/mediacenter/mediasources)
  358. diff --git a/mediasources/baloosearch/audiosearchresulthandler.cpp b/mediasources/baloosearch/audiosearchresulthandler.cpp
  359. deleted file mode 100644
  360. index 779bc73..0000000
  361. --- a/mediasources/baloosearch/audiosearchresulthandler.cpp
  362. +++ /dev/null
  363. @@ -1,70 +0,0 @@
  364. -/***********************************************************************************
  365. - *   Copyright 2014 Shantanu Tushar <shantanu@kde.org>                             *
  366. - *                                                                                 *
  367. - *   This library is free software; you can redistribute it and/or                 *
  368. - *   modify it under the terms of the GNU Lesser General Public                    *
  369. - *   License as published by the Free Software Foundation; either                  *
  370. - *   version 2.1 of the License, or (at your option) any later version.            *
  371. - *                                                                                 *
  372. - *   This library is distributed in the hope that it will be useful,               *
  373. - *   but WITHOUT ANY WARRANTY; without even the implied warranty of                *
  374. - *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU             *
  375. - *   Lesser General Public License for more details.                               *
  376. - *                                                                                 *
  377. - *   You should have received a copy of the GNU Lesser General Public              *
  378. - *   License along with this library.  If not, see <http://www.gnu.org/licenses/>. *
  379. - ***********************************************************************************/
  380. -
  381. -#include "audiosearchresulthandler.h"
  382. -
  383. -#include <mediacenter/mediacenter.h>
  384. -#include <mediacenter/medialibrary.h>
  385. -
  386. -#include <baloo/file.h>
  387. -#include <baloo/resultiterator.h>
  388. -
  389. -#include <QUrl>
  390. -
  391. -AudioSearchResultHandler::AudioSearchResultHandler(MediaLibrary* mediaLibrary,
  392. -                                                   QObject* parent)
  393. -    : SearchResultHandler(mediaLibrary, parent)
  394. -{
  395. -}
  396. -
  397. -QString AudioSearchResultHandler::supportedMediaType() const
  398. -{
  399. -    return "Audio";
  400. -}
  401. -
  402. -QString AudioSearchResultHandler::supportedMimeType() const
  403. -{
  404. -    return "audio";
  405. -}
  406. -
  407. -void AudioSearchResultHandler::handleResultImpl(
  408. -    const QString& filePath,
  409. -    const QHash< int, QVariant >& values)
  410. -{
  411. -    m_mediaLibrary->updateMedia(values);
  412. -
  413. -    Baloo::File file(filePath);
  414. -    file.load();
  415. -
  416. -    QHash<int, QVariant> vals;
  417. -
  418. -    const int duration = file.property(KFileMetaData::Property::Duration).toInt();
  419. -    if (duration) {
  420. -        vals.insert(MediaCenter::DurationRole, duration);
  421. -    }
  422. -
  423. -    const QString title = file.property(KFileMetaData::Property::Title).toString();
  424. -    if (!title.isEmpty()) {
  425. -        vals.insert(Qt::DisplayRole, title);
  426. -    }
  427. -
  428. -    vals.insert(MediaCenter::ArtistRole, file.property(KFileMetaData::Property::Artist));
  429. -    vals.insert(MediaCenter::AlbumRole, file.property(KFileMetaData::Property::Album));
  430. -    vals.insert(MediaCenter::AlbumArtistRole, file.property(KFileMetaData::Property::AlbumArtist));
  431. -
  432. -    m_mediaLibrary->updateMedia(QUrl::fromLocalFile(file.path()).toString(), vals);
  433. -}
  434. diff --git a/mediasources/baloosearch/audiosearchresulthandler.h b/mediasources/baloosearch/audiosearchresulthandler.h
  435. deleted file mode 100644
  436. index c3a1ed7..0000000
  437. --- a/mediasources/baloosearch/audiosearchresulthandler.h
  438. +++ /dev/null
  439. @@ -1,40 +0,0 @@
  440. -/***********************************************************************************
  441. - *   Copyright 2014 Shantanu Tushar <shantanu@kde.org>                             *
  442. - *                                                                                 *
  443. - *   This library is free software; you can redistribute it and/or                 *
  444. - *   modify it under the terms of the GNU Lesser General Public                    *
  445. - *   License as published by the Free Software Foundation; either                  *
  446. - *   version 2.1 of the License, or (at your option) any later version.            *
  447. - *                                                                                 *
  448. - *   This library is distributed in the hope that it will be useful,               *
  449. - *   but WITHOUT ANY WARRANTY; without even the implied warranty of                *
  450. - *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU             *
  451. - *   Lesser General Public License for more details.                               *
  452. - *                                                                                 *
  453. - *   You should have received a copy of the GNU Lesser General Public              *
  454. - *   License along with this library.  If not, see <http://www.gnu.org/licenses/>. *
  455. - ***********************************************************************************/
  456. -
  457. -#ifndef AUDIOSEARCHRESULTHANDLER_H
  458. -#define AUDIOSEARCHRESULTHANDLER_H
  459. -
  460. -#include "searchresulthandler.h"
  461. -
  462. -#include <QVariant>
  463. -
  464. -class MediaLibrary;
  465. -
  466. -class AudioSearchResultHandler : public SearchResultHandler
  467. -{
  468. -    Q_OBJECT
  469. -public:
  470. -    AudioSearchResultHandler(MediaLibrary* mediaLibrary, QObject* parent);
  471. -    virtual QString supportedMediaType() const;
  472. -    virtual QString supportedMimeType() const;
  473. -
  474. -protected:
  475. -    virtual void handleResultImpl(const QString& filePath,
  476. -                                  const QHash< int, QVariant >& values);
  477. -};
  478. -
  479. -#endif // AUDIOSEARCHRESULTHANDLER_H
  480. diff --git a/mediasources/baloosearch/baloosearch.desktop b/mediasources/baloosearch/baloosearch.desktop
  481. deleted file mode 100644
  482. index ab6d76f..0000000
  483. --- a/mediasources/baloosearch/baloosearch.desktop
  484. +++ /dev/null
  485. @@ -1,81 +0,0 @@
  486. -[Desktop Entry]
  487. -Type=Service
  488. -Icon=baloo
  489. -Name=Baloo Search
  490. -Name[ar]=بحث بالو
  491. -Name[ca]=Cerca amb Baloo
  492. -Name[ca@valencia]=Cerca amb Baloo
  493. -Name[cs]=Baloo Search
  494. -Name[da]=Søgning med Baloo
  495. -Name[de]=Baloo-Suche
  496. -Name[el]=Αναζήτηση Baloo
  497. -Name[en_GB]=Baloo Search
  498. -Name[es]=Búsqueda de Baloo
  499. -Name[fi]=Baloo-haku
  500. -Name[gl]=Buscar con Baloo
  501. -Name[hu]=Baloo keresés
  502. -Name[id]=Pencarian Baloo
  503. -Name[it]=Ricerca con Baloo
  504. -Name[ko]=Baloo 검색
  505. -Name[lt]=Baloo paieška
  506. -Name[nl]=Zoeken met Baloo
  507. -Name[pl]=Wyszukiwarka Baloo
  508. -Name[pt]=Pesquisa no Baloo
  509. -Name[pt_BR]=Pesquisa do Baloo
  510. -Name[ro]=Căutare Baloo
  511. -Name[ru]=Поиск Baloo
  512. -Name[sk]=Hľadanie Baloo
  513. -Name[sl]=Iskanje Baloo
  514. -Name[sr]=Балуова претрага
  515. -Name[sr@ijekavian]=Балуова претрага
  516. -Name[sr@ijekavianlatin]=Balooova pretraga
  517. -Name[sr@latin]=Balooova pretraga
  518. -Name[sv]=Baloo-sökning
  519. -Name[tr]=Baloo Araması
  520. -Name[uk]=Пошук Baloo
  521. -Name[x-test]=xxBaloo Searchxx
  522. -Name[zh_CN]=Baloo 搜索
  523. -Name[zh_TW]=Baloo 搜尋
  524. -Comment=Get media from Baloo Search
  525. -Comment[ar]=احصل على الوسائط من بحث بالو
  526. -Comment[ca]=Obté medis de la cerca del Baloo
  527. -Comment[ca@valencia]=Obté medis de la cerca del Baloo
  528. -Comment[cs]=Získat média z Baloo Search
  529. -Comment[da]=Hent medier fra søgning med Baloo
  530. -Comment[de]=Medien von der Baloo-Suche holen
  531. -Comment[el]=Ανάκτηση πολυμέσων μέσω της αναζήτησης Baloo
  532. -Comment[en_GB]=Get media from Baloo Search
  533. -Comment[es]=Obtenga archivos multimedia de la búsqueda de Baloo
  534. -Comment[fi]=Hae mediaa Baloolla
  535. -Comment[gl]=Obter medios buscando con Baloo
  536. -Comment[hu]=Média beszerzése a Baloo keresésből
  537. -Comment[id]=Dapatkan media dari Pencarian Baloo
  538. -Comment[it]=Ottieni media dalla ricerca con Baloo
  539. -Comment[ko]=Baloo 검색에서 미디어 가져오기
  540. -Comment[lt]=Gauti mediją iš Baloo paieškos
  541. -Comment[nl]=Haal media uit Baloo-zoeken
  542. -Comment[pl]=Pobierz multimedia z wyszukiwarki Baloo
  543. -Comment[pt]=Obter conteúdos da pesquisa no Baloo
  544. -Comment[pt_BR]=Obtém a mídia a partir da Pesquisa do Baloo
  545. -Comment[ru]=Медиафайлы, найденные службой поиска Baloo
  546. -Comment[sk]=Získať médiá z hľadania Baloo
  547. -Comment[sl]=Pridobite predstavnostne datoteke iz Iskanja Baloo
  548. -Comment[sr]=Добавите медијуме преко Балуове претраге
  549. -Comment[sr@ijekavian]=Добавите медијуме преко Балуове претраге
  550. -Comment[sr@ijekavianlatin]=Dobavite medijume preko Balooove pretrage
  551. -Comment[sr@latin]=Dobavite medijume preko Balooove pretrage
  552. -Comment[sv]=Hämta media från Baloo-sökning
  553. -Comment[tr]=Baloo Aramasından ortam al
  554. -Comment[uk]=Отримати дані із засобу стільничного пошуку Baloo
  555. -Comment[x-test]=xxGet media from Baloo Searchxx
  556. -Comment[zh_TW]=從 Baloo 搜尋取得媒體
  557. -
  558. -X-KDE-ServiceTypes=Plasma/MediaCenter/MediaSource
  559. -
  560. -X-KDE-PluginInfo-Name=baloosearch
  561. -X-KDE-PluginInfo-Author=Sinny Kumari
  562. -X-KDE-PluginInfo-Email=ksinny@gmail.com
  563. -X-KDE-PluginInfo-Version=1.0
  564. -X-KDE-PluginInfo-License=GPL
  565. -X-KDE-PluginInfo-EnabledByDefault=true
  566. -X-KDE-Library=pmc_baloosearch
  567. diff --git a/mediasources/baloosearch/baloosearchmediasource.cpp b/mediasources/baloosearch/baloosearchmediasource.cpp
  568. deleted file mode 100644
  569. index e7c9c6e..0000000
  570. --- a/mediasources/baloosearch/baloosearchmediasource.cpp
  571. +++ /dev/null
  572. @@ -1,107 +0,0 @@
  573. -/***********************************************************************************
  574. - *   Copyright 2014 Sinny Kumari <ksinny@gmail.com>          `                     *
  575. - *                                                                                 *
  576. - *   This library is free software; you can redistribute it and/or                 *
  577. - *   modify it under the terms of the GNU Lesser General Public                    *
  578. - *   License as published by the Free Software Foundation; either                  *
  579. - *   version 2.1 of the License, or (at your option) any later version.            *
  580. - *                                                                                 *
  581. - *   This library is distributed in the hope that it will be useful,               *
  582. - *   but WITHOUT ANY WARRANTY; without even the implied warranty of                *
  583. - *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU             *
  584. - *   Lesser General Public License for more details.                               *
  585. - *                                                                                 *
  586. - *   You should have received a copy of the GNU Lesser General Public              *
  587. - *   License along with this library.  If not, see <http://www.gnu.org/licenses/>. *
  588. - ***********************************************************************************/
  589. -
  590. -#include "baloosearchmediasource.h"
  591. -
  592. -#include "imagesearchresulthandler.h"
  593. -#include "videosearchresulthandler.h"
  594. -#include "audiosearchresulthandler.h"
  595. -
  596. -#include <mediacenter/medialibrary.h>
  597. -#include <mediacenter/singletonfactory.h>
  598. -#include <mediacenter/mediacenter.h>
  599. -
  600. -#include <baloo/query.h>
  601. -#include <baloo/resultiterator.h>
  602. -#include <baloo/file.h>
  603. -
  604. -#include <QUrl>
  605. -#include <QDebug>
  606. -#include <QTimer>
  607. -#include <QDBusConnection>
  608. -#include <QMimeDatabase>
  609. -
  610. -MEDIACENTER_EXPORT_MEDIASOURCE(BalooSearchMediaSource, "baloosearch.json")
  611. -
  612. -BalooSearchMediaSource::BalooSearchMediaSource(QObject* parent, const QVariantList& args)
  613. -    : AbstractMediaSource(parent, args)
  614. -{
  615. -
  616. -    m_allowedMimes << "audio" << "image" << "video";
  617. -
  618. -    QDBusConnection conn = QDBusConnection::sessionBus();
  619. -    conn.connect(QString(), QLatin1String("/files"), QLatin1String("org.kde"), QLatin1String("changed"), this, SLOT(handleNewFile(QStringList)));
  620. -
  621. -}
  622. -
  623. -void BalooSearchMediaSource::run()
  624. -{
  625. -    QTimer::singleShot(0, this, SLOT(startQuerying()));
  626. -
  627. -    exec();
  628. -}
  629. -
  630. -void BalooSearchMediaSource::startQuerying()
  631. -{
  632. -    MediaLibrary *mediaLibrary = SingletonFactory::instanceFor<MediaLibrary>();
  633. -
  634. -    QList<SearchResultHandler*> searchResultHandlerList;
  635. -    searchResultHandlerList << new ImageSearchResultHandler(mediaLibrary, this)
  636. -                            << new VideoSearchResultHandler(mediaLibrary, this)
  637. -                            << new AudioSearchResultHandler(mediaLibrary, this);
  638. -
  639. -    Q_FOREACH(SearchResultHandler* searchResultHandler, searchResultHandlerList) {
  640. -        m_searchResultHandlers.insert(searchResultHandler->supportedMediaType(), searchResultHandler);
  641. -        m_searchResultHandlersByMimeType.insert(searchResultHandler->supportedMimeType(), searchResultHandler);
  642. -    }
  643. -
  644. -    Q_FOREACH(const QString &type, m_searchResultHandlers.keys()) {
  645. -        queryForMediaType(type);
  646. -    }
  647. -}
  648. -
  649. -void BalooSearchMediaSource::handleNewFile(const QStringList &files)
  650. -{
  651. -    QMimeDatabase db;
  652. -    for (auto file : files)
  653. -    {
  654. -        const QString fileMimeType = db.mimeTypeForUrl(QUrl::fromLocalFile(file)).name();
  655. -        const QString topLevelMimeType = fileMimeType.split('/').at(0);
  656. -
  657. -        if (m_allowedMimes.contains(topLevelMimeType)) {
  658. -            SearchResultHandler *handler = m_searchResultHandlersByMimeType.value(topLevelMimeType);
  659. -            handler->handleResult(file);
  660. -        }
  661. -    }
  662. -}
  663. -
  664. -void BalooSearchMediaSource::queryForMediaType(const QString& type)
  665. -{
  666. -    Baloo::Query query;
  667. -    query.addType(type);
  668. -
  669. -    Baloo::ResultIterator it = query.exec();
  670. -    SearchResultHandler *handler = m_searchResultHandlers.value(type);
  671. -    while (it.next()) {
  672. -        QString localUrl = it.filePath();
  673. -        handler->handleResult(localUrl);
  674. -    }
  675. -
  676. -}
  677. -
  678. -
  679. -#include "baloosearchmediasource.moc"
  680. diff --git a/mediasources/baloosearch/baloosearchmediasource.h b/mediasources/baloosearch/baloosearchmediasource.h
  681. deleted file mode 100644
  682. index ca0780e..0000000
  683. --- a/mediasources/baloosearch/baloosearchmediasource.h
  684. +++ /dev/null
  685. @@ -1,46 +0,0 @@
  686. -/***********************************************************************************
  687. - *   Copyright 2014 Sinny Kumari <ksinny@gmail.com>          `                     *
  688. - *                                                                                 *
  689. - *   This library is free software; you can redistribute it and/or                 *
  690. - *   modify it under the terms of the GNU Lesser General Public                    *
  691. - *   License as published by the Free Software Foundation; either                  *
  692. - *   version 2.1 of the License, or (at your option) any later version.            *
  693. - *                                                                                 *
  694. - *   This library is distributed in the hope that it will be useful,               *
  695. - *   but WITHOUT ANY WARRANTY; without even the implied warranty of                *
  696. - *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU             *
  697. - *   Lesser General Public License for more details.                               *
  698. - *                                                                                 *
  699. - *   You should have received a copy of the GNU Lesser General Public              *
  700. - *   License along with this library.  If not, see <http://www.gnu.org/licenses/>. *
  701. - ***********************************************************************************/
  702. -
  703. -#ifndef BALOOSEARCHMEDIASOURCE_H
  704. -#define BALOOSEARCHMEDIASOURCE_H
  705. -
  706. -#include <mediacenter/abstractmediasource.h>
  707. -
  708. -class SearchResultHandler;
  709. -
  710. -class BalooSearchMediaSource : public MediaCenter::AbstractMediaSource
  711. -{
  712. -    Q_OBJECT
  713. -public:
  714. -    explicit BalooSearchMediaSource(QObject* parent = 0, const QVariantList& args = QVariantList());
  715. -
  716. -protected:
  717. -    virtual void run();
  718. -
  719. -private Q_SLOTS:
  720. -    void startQuerying();
  721. -    void handleNewFile(const QStringList &files);
  722. -
  723. -private:
  724. -    QHash<QString, SearchResultHandler*> m_searchResultHandlers;
  725. -    QHash<QString, SearchResultHandler*> m_searchResultHandlersByMimeType;
  726. -
  727. -    void queryForMediaType(const QString &type);
  728. -    QStringList m_allowedMimes;
  729. -};
  730. -
  731. -#endif // BALOOSEARCHMEDIASOURCE_H
  732. diff --git a/mediasources/baloosearch/imagesearchresulthandler.cpp b/mediasources/baloosearch/imagesearchresulthandler.cpp
  733. deleted file mode 100644
  734. index 4325ad4..0000000
  735. --- a/mediasources/baloosearch/imagesearchresulthandler.cpp
  736. +++ /dev/null
  737. @@ -1,92 +0,0 @@
  738. -/***********************************************************************************
  739. - *   Copyright 2014 Shantanu Tushar <shantanu@kde.org>                             *
  740. - *                                                                                 *
  741. - *   This library is free software; you can redistribute it and/or                 *
  742. - *   modify it under the terms of the GNU Lesser General Public                    *
  743. - *   License as published by the Free Software Foundation; either                  *
  744. - *   version 2.1 of the License, or (at your option) any later version.            *
  745. - *                                                                                 *
  746. - *   This library is distributed in the hope that it will be useful,               *
  747. - *   but WITHOUT ANY WARRANTY; without even the implied warranty of                *
  748. - *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU             *
  749. - *   Lesser General Public License for more details.                               *
  750. - *                                                                                 *
  751. - *   You should have received a copy of the GNU Lesser General Public              *
  752. - *   License along with this library.  If not, see <http://www.gnu.org/licenses/>. *
  753. - ***********************************************************************************/
  754. -
  755. -#include "imagesearchresulthandler.h"
  756. -#include <mediacenter/settings.h>
  757. -
  758. -#include <mediacenter/medialibrary.h>
  759. -#include <mediacenter/mediacenter.h>
  760. -
  761. -#include <baloo/resultiterator.h>
  762. -#include <baloo/file.h>
  763. -
  764. -#include <QDateTime>
  765. -#include <QUrl>
  766. -#include <QDebug>
  767. -
  768. -ImageSearchResultHandler::ImageSearchResultHandler(MediaLibrary* mediaLibrary, QObject* parent)
  769. -    : SearchResultHandler(mediaLibrary, parent)
  770. -    , m_minimumImageSize(Settings().value("minImageWidth", 500).toInt())
  771. -{
  772. -}
  773. -
  774. -QString ImageSearchResultHandler::supportedMediaType() const
  775. -{
  776. -    return "Image";
  777. -}
  778. -
  779. -QString ImageSearchResultHandler::supportedMimeType() const
  780. -{
  781. -    return "image";
  782. -}
  783. -
  784. -void ImageSearchResultHandler::handleResultImpl(
  785. -    const QString& filePath,
  786. -    const QHash< int, QVariant >& values)
  787. -{
  788. -    const QString fileUrl = values.value(MediaCenter::MediaUrlRole).toUrl().toLocalFile();
  789. -    m_initialValuesByUrl.insert(fileUrl, values);
  790. -
  791. -    //We remove the create date as we want to fill it only for images taken with
  792. -    //a camera or similar in slotFileReceived(). This is to make sure such
  793. -    //photos appear before junk images in the browser.
  794. -    m_initialValuesByUrl[fileUrl].remove(MediaCenter::CreatedAtRole);
  795. -
  796. -    Baloo::File file(filePath);
  797. -    file.load();
  798. -
  799. -    //Properties that signify the actual date/time the image was taken by the
  800. -    //camera
  801. -    QList<KFileMetaData::Property::Property> properties;
  802. -    properties << KFileMetaData::Property::PhotoDateTimeOriginal
  803. -               << KFileMetaData::Property::ImageDateTime;
  804. -
  805. -    auto photoWidth = file.property(KFileMetaData::Property::Width).toULongLong();
  806. -
  807. -    if (!photoWidth || photoWidth < m_minimumImageSize) {
  808. -        m_initialValuesByUrl.remove(fileUrl);
  809. -        return;
  810. -    }
  811. -
  812. -    QDateTime created;
  813. -    Q_FOREACH(KFileMetaData::Property::Property property, properties) {
  814. -        created = file.property(property).toDateTime();
  815. -        if (created.isValid()) {
  816. -            break;
  817. -        }
  818. -    }
  819. -
  820. -    QHash<int, QVariant> vals;
  821. -    if (created.isValid()) {
  822. -        vals.insert(MediaCenter::CreatedAtRole, created);
  823. -    }
  824. -
  825. -    vals.unite(m_initialValuesByUrl.take(fileUrl));
  826. -
  827. -    m_mediaLibrary->updateMedia(QUrl::fromLocalFile(file.path()).toString(),
  828. -                                vals);
  829. -}
  830. diff --git a/mediasources/baloosearch/imagesearchresulthandler.h b/mediasources/baloosearch/imagesearchresulthandler.h
  831. deleted file mode 100644
  832. index 25a052a..0000000
  833. --- a/mediasources/baloosearch/imagesearchresulthandler.h
  834. +++ /dev/null
  835. @@ -1,42 +0,0 @@
  836. -/***********************************************************************************
  837. - *   Copyright 2014 Shantanu Tushar <shantanu@kde.org>                             *
  838. - *                                                                                 *
  839. - *   This library is free software; you can redistribute it and/or                 *
  840. - *   modify it under the terms of the GNU Lesser General Public                    *
  841. - *   License as published by the Free Software Foundation; either                  *
  842. - *   version 2.1 of the License, or (at your option) any later version.            *
  843. - *                                                                                 *
  844. - *   This library is distributed in the hope that it will be useful,               *
  845. - *   but WITHOUT ANY WARRANTY; without even the implied warranty of                *
  846. - *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU             *
  847. - *   Lesser General Public License for more details.                               *
  848. - *                                                                                 *
  849. - *   You should have received a copy of the GNU Lesser General Public              *
  850. - *   License along with this library.  If not, see <http://www.gnu.org/licenses/>. *
  851. - ***********************************************************************************/
  852. -
  853. -#ifndef IMAGESEARCHRESULTHANDLER_H
  854. -#define IMAGESEARCHRESULTHANDLER_H
  855. -
  856. -#include "searchresulthandler.h"
  857. -
  858. -#include <QHash>
  859. -
  860. -class ImageSearchResultHandler : public SearchResultHandler
  861. -{
  862. -    Q_OBJECT
  863. -public:
  864. -    ImageSearchResultHandler(MediaLibrary* mediaLibrary, QObject* parent);
  865. -    virtual QString supportedMediaType() const;
  866. -    virtual QString supportedMimeType() const;
  867. -
  868. -protected:
  869. -    virtual void handleResultImpl(const QString& filePath,
  870. -                                  const QHash< int, QVariant >& values);
  871. -
  872. -private:
  873. -    unsigned int m_minimumImageSize;
  874. -    QHash<QString, QHash<int, QVariant>> m_initialValuesByUrl;
  875. -};
  876. -
  877. -#endif // IMAGESEARCHRESULTHANDLER_H
  878. diff --git a/mediasources/baloosearch/searchresulthandler.cpp b/mediasources/baloosearch/searchresulthandler.cpp
  879. deleted file mode 100644
  880. index 4cf312e..0000000
  881. --- a/mediasources/baloosearch/searchresulthandler.cpp
  882. +++ /dev/null
  883. @@ -1,58 +0,0 @@
  884. -/***********************************************************************************
  885. - *   Copyright 2014 Shantanu Tushar <shantanu@kde.org>                             *
  886. - *                                                                                 *
  887. - *   This library is free software; you can redistribute it and/or                 *
  888. - *   modify it under the terms of the GNU Lesser General Public                    *
  889. - *   License as published by the Free Software Foundation; either                  *
  890. - *   version 2.1 of the License, or (at your option) any later version.            *
  891. - *                                                                                 *
  892. - *   This library is distributed in the hope that it will be useful,               *
  893. - *   but WITHOUT ANY WARRANTY; without even the implied warranty of                *
  894. - *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU             *
  895. - *   Lesser General Public License for more details.                               *
  896. - *                                                                                 *
  897. - *   You should have received a copy of the GNU Lesser General Public              *
  898. - *   License along with this library.  If not, see <http://www.gnu.org/licenses/>. *
  899. - ***********************************************************************************/
  900. -
  901. -#include "searchresulthandler.h"
  902. -
  903. -#include <mediacenter/medialibrary.h>
  904. -#include <mediacenter/mediacenter.h>
  905. -
  906. -#include <baloo/resultiterator.h>
  907. -
  908. -#include <QFileInfo>
  909. -#include <QDateTime>
  910. -#include <QVariant>
  911. -#include <QUrl>
  912. -#include <QMimeDatabase>
  913. -#include <KFileMetaData/UserMetaData>
  914. -
  915. -SearchResultHandler::SearchResultHandler(MediaLibrary *mediaLibrary, QObject* parent)
  916. -    : QObject(parent)
  917. -    , m_mediaLibrary(mediaLibrary)
  918. -{
  919. -}
  920. -
  921. -void SearchResultHandler::handleResult(QString &filePath)
  922. -{
  923. -    QHash<int, QVariant> values;
  924. -    const QUrl url = QUrl::fromLocalFile(filePath);
  925. -    KFileMetaData::UserMetaData md(filePath);
  926. -
  927. -    values.insert(Qt::DisplayRole, QVariant(url.fileName()));
  928. -    values.insert(Qt::DecorationRole, QVariant(QMimeDatabase().mimeTypeForFile(filePath).iconName()));
  929. -    values.insert(MediaCenter::MediaTypeRole, QVariant(supportedMediaType().toLower()));
  930. -    values.insert(MediaCenter::MediaUrlRole, QVariant(url.toString()));
  931. -    values.insert(MediaCenter::RatingRole, QVariant(md.rating()));
  932. -
  933. -    //HACK: This is a workaround as Baloo does not provide creation or
  934. -    // modification date/time through KFileMetaData::Property
  935. -    values.insert(MediaCenter::CreatedAtRole,
  936. -            QVariant(QFileInfo(filePath).created()));
  937. -
  938. -    //Now collect information specific to this media type
  939. -    handleResultImpl(filePath, values);
  940. -
  941. -}
  942. diff --git a/mediasources/baloosearch/searchresulthandler.h b/mediasources/baloosearch/searchresulthandler.h
  943. deleted file mode 100644
  944. index 44a46d0..0000000
  945. --- a/mediasources/baloosearch/searchresulthandler.h
  946. +++ /dev/null
  947. @@ -1,48 +0,0 @@
  948. -/***********************************************************************************
  949. - *   Copyright 2014 Shantanu Tushar <shantanu@kde.org>                             *
  950. - *                                                                                 *
  951. - *   This library is free software; you can redistribute it and/or                 *
  952. - *   modify it under the terms of the GNU Lesser General Public                    *
  953. - *   License as published by the Free Software Foundation; either                  *
  954. - *   version 2.1 of the License, or (at your option) any later version.            *
  955. - *                                                                                 *
  956. - *   This library is distributed in the hope that it will be useful,               *
  957. - *   but WITHOUT ANY WARRANTY; without even the implied warranty of                *
  958. - *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU             *
  959. - *   Lesser General Public License for more details.                               *
  960. - *                                                                                 *
  961. - *   You should have received a copy of the GNU Lesser General Public              *
  962. - *   License along with this library.  If not, see <http://www.gnu.org/licenses/>. *
  963. - ***********************************************************************************/
  964. -
  965. -#ifndef SEARCHRESULTHANDLER_H
  966. -#define SEARCHRESULTHANDLER_H
  967. -
  968. -#include <QObject>
  969. -#include <QString>
  970. -#include <QHash>
  971. -
  972. -namespace Baloo {
  973. -class ResultIterator;
  974. -}
  975. -
  976. -class MediaLibrary;
  977. -
  978. -class SearchResultHandler : public QObject
  979. -{
  980. -    Q_OBJECT
  981. -public:
  982. -    SearchResultHandler(MediaLibrary *mediaLibrary, QObject* parent);
  983. -    virtual QString supportedMediaType() const = 0;
  984. -    virtual QString supportedMimeType() const = 0;
  985. -
  986. -    virtual void handleResult(QString &filePath);
  987. -
  988. -protected:
  989. -    MediaLibrary *m_mediaLibrary;
  990. -
  991. -    virtual void handleResultImpl(const QString &filePath,
  992. -                                  const QHash<int, QVariant> &values) = 0;
  993. -};
  994. -
  995. -#endif // SEARCHRESULTHANDLER_H
  996. diff --git a/mediasources/baloosearch/videosearchresulthandler.cpp b/mediasources/baloosearch/videosearchresulthandler.cpp
  997. deleted file mode 100644
  998. index b3f7d29..0000000
  999. --- a/mediasources/baloosearch/videosearchresulthandler.cpp
  1000. +++ /dev/null
  1001. @@ -1,63 +0,0 @@
  1002. -/***********************************************************************************
  1003. - *   Copyright 2014 Shantanu Tushar <shantanu@kde.org>                             *
  1004. - *                                                                                 *
  1005. - *   This library is free software; you can redistribute it and/or                 *
  1006. - *   modify it under the terms of the GNU Lesser General Public                    *
  1007. - *   License as published by the Free Software Foundation; either                  *
  1008. - *   version 2.1 of the License, or (at your option) any later version.            *
  1009. - *                                                                                 *
  1010. - *   This library is distributed in the hope that it will be useful,               *
  1011. - *   but WITHOUT ANY WARRANTY; without even the implied warranty of                *
  1012. - *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU             *
  1013. - *   Lesser General Public License for more details.                               *
  1014. - *                                                                                 *
  1015. - *   You should have received a copy of the GNU Lesser General Public              *
  1016. - *   License along with this library.  If not, see <http://www.gnu.org/licenses/>. *
  1017. - ***********************************************************************************/
  1018. -
  1019. -#include "videosearchresulthandler.h"
  1020. -
  1021. -#include <mediacenter/medialibrary.h>
  1022. -#include <mediacenter/mediacenter.h>
  1023. -
  1024. -#include <baloo/file.h>
  1025. -#include <baloo/resultiterator.h>
  1026. -
  1027. -#include <QHash>
  1028. -#include <QUrl>
  1029. -
  1030. -VideoSearchResultHandler::VideoSearchResultHandler(MediaLibrary* mediaLibrary,
  1031. -                                                   QObject* parent)
  1032. -    : SearchResultHandler(mediaLibrary, parent)
  1033. -{
  1034. -
  1035. -}
  1036. -
  1037. -QString VideoSearchResultHandler::supportedMediaType() const
  1038. -{
  1039. -    return "Video";
  1040. -}
  1041. -
  1042. -QString VideoSearchResultHandler::supportedMimeType() const
  1043. -{
  1044. -    return "video";
  1045. -}
  1046. -
  1047. -void VideoSearchResultHandler::handleResultImpl(
  1048. -    const QString& filePath,
  1049. -    const QHash< int, QVariant >& values)
  1050. -{
  1051. -    m_mediaLibrary->updateMedia(values);
  1052. -
  1053. -    Baloo::File file(filePath);
  1054. -    file.load();
  1055. -
  1056. -    QHash<int, QVariant> vals;
  1057. -
  1058. -    const int duration = file.property(KFileMetaData::Property::Duration).toInt();
  1059. -    if (duration) {
  1060. -        vals.insert(MediaCenter::DurationRole, duration);
  1061. -    }
  1062. -
  1063. -    m_mediaLibrary->updateMedia(QUrl::fromLocalFile(file.path()).toString(), vals);
  1064. -}
  1065. diff --git a/mediasources/baloosearch/videosearchresulthandler.h b/mediasources/baloosearch/videosearchresulthandler.h
  1066. deleted file mode 100644
  1067. index 4c35688..0000000
  1068. --- a/mediasources/baloosearch/videosearchresulthandler.h
  1069. +++ /dev/null
  1070. @@ -1,38 +0,0 @@
  1071. -/***********************************************************************************
  1072. - *   Copyright 2014 Shantanu Tushar <shantanu@kde.org>                             *
  1073. - *                                                                                 *
  1074. - *   This library is free software; you can redistribute it and/or                 *
  1075. - *   modify it under the terms of the GNU Lesser General Public                    *
  1076. - *   License as published by the Free Software Foundation; either                  *
  1077. - *   version 2.1 of the License, or (at your option) any later version.            *
  1078. - *                                                                                 *
  1079. - *   This library is distributed in the hope that it will be useful,               *
  1080. - *   but WITHOUT ANY WARRANTY; without even the implied warranty of                *
  1081. - *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU             *
  1082. - *   Lesser General Public License for more details.                               *
  1083. - *                                                                                 *
  1084. - *   You should have received a copy of the GNU Lesser General Public              *
  1085. - *   License along with this library.  If not, see <http://www.gnu.org/licenses/>. *
  1086. - ***********************************************************************************/
  1087. -
  1088. -#ifndef VIDEOSEARCHRESULTHANDLER_H
  1089. -#define VIDEOSEARCHRESULTHANDLER_H
  1090. -
  1091. -#include "searchresulthandler.h"
  1092. -
  1093. -#include <QVariant>
  1094. -
  1095. -class VideoSearchResultHandler : public SearchResultHandler
  1096. -{
  1097. -    Q_OBJECT
  1098. -public:
  1099. -    VideoSearchResultHandler(MediaLibrary* mediaLibrary, QObject* parent);
  1100. -    virtual QString supportedMediaType() const;
  1101. -    virtual QString supportedMimeType() const;
  1102. -
  1103. -protected:
  1104. -    virtual void handleResultImpl(const QString& filePath,
  1105. -                                  const QHash< int, QVariant >& values);
  1106. -};
  1107. -
  1108. -#endif // VIDEOSEARCHRESULTHANDLER_H
  1109. diff --git a/mediasources/filesystemsearch/CMakeLists.txt b/mediasources/filesystemsearch/CMakeLists.txt
  1110. deleted file mode 100644
  1111. index 6b5f4bc..0000000
  1112. --- a/mediasources/filesystemsearch/CMakeLists.txt
  1113. +++ /dev/null
  1114. @@ -1,14 +0,0 @@
  1115. -set(filesystemsearch_SRCS
  1116. -    filesystemsearchmediasource.cpp
  1117. -)
  1118. -
  1119. -add_library(pmc_filesystemsearch MODULE ${filesystemsearch_SRCS})
  1120. -set_target_properties(pmc_filesystemsearch PROPERTIES PREFIX "")
  1121. -
  1122. -target_link_libraries(pmc_filesystemsearch
  1123. -    plasmamediacenter
  1124. -)
  1125. -
  1126. -kcoreaddons_desktop_to_json(pmc_filesystemsearch filesystemsearch.desktop)
  1127. -
  1128. -install(TARGETS pmc_filesystemsearch DESTINATION ${PLUGIN_INSTALL_DIR}/plasma/mediacenter/mediasources)
  1129. diff --git a/mediasources/filesystemsearch/filesystemsearch.desktop b/mediasources/filesystemsearch/filesystemsearch.desktop
  1130. deleted file mode 100644
  1131. index 4f19d8b..0000000
  1132. --- a/mediasources/filesystemsearch/filesystemsearch.desktop
  1133. +++ /dev/null
  1134. @@ -1,80 +0,0 @@
  1135. -[Desktop Entry]
  1136. -Type=Service
  1137. -Icon=drive-harddisk
  1138. -Name=Filesystem Search
  1139. -Name[ar]=بحث نظام الملفّات
  1140. -Name[ca]=Cerca al sistema de fitxers
  1141. -Name[ca@valencia]=Cerca al sistema de fitxers
  1142. -Name[cs]=Prohledávání souborového systému
  1143. -Name[da]=Søgning på filsystem
  1144. -Name[de]=Dateisystem-Suche
  1145. -Name[el]=Αναζήτηση στο σύστημα αρχείων
  1146. -Name[en_GB]=Filesystem Search
  1147. -Name[es]=Búsqueda del sistema de archivos
  1148. -Name[fi]=Tiedostojärjestelmähaku
  1149. -Name[gl]=Busca no sistema de ficheiros
  1150. -Name[hu]=Fájlrendszer keresés
  1151. -Name[id]=Pencarian Filesystem
  1152. -Name[it]=Ricerca nel filesystem
  1153. -Name[ko]=파일 시스템 검색
  1154. -Name[lt]=Failų sistemos paieška
  1155. -Name[nl]=Zoeken in het bestandssysteem
  1156. -Name[pl]=Wyszukiwanie w systemie plików
  1157. -Name[pt]=Pesquisa no Sistema de Ficheiros
  1158. -Name[pt_BR]=Pesquisa no sistema de arquivos
  1159. -Name[ru]=Поиск в файловой системе
  1160. -Name[sk]=Hľadanie v súborovom systéme
  1161. -Name[sl]=Iskanje po datotečnem sistemu
  1162. -Name[sr]=Претрага фајл система
  1163. -Name[sr@ijekavian]=Претрага фајл система
  1164. -Name[sr@ijekavianlatin]=Pretraga fajl sistema
  1165. -Name[sr@latin]=Pretraga fajl sistema
  1166. -Name[sv]=Sökning i filsystem
  1167. -Name[tr]=Dosya Sistemi Araması
  1168. -Name[uk]=Пошук у файловій системі
  1169. -Name[x-test]=xxFilesystem Searchxx
  1170. -Name[zh_CN]=文件系统搜索
  1171. -Name[zh_TW]=檔案系統搜尋
  1172. -Comment=Get media from your local files
  1173. -Comment[ar]=احصل على وسائط من ملفّاتك المحليّة
  1174. -Comment[ca]=Obté medis de la cerca als fitxers locals
  1175. -Comment[ca@valencia]=Obté medis de la cerca als fitxers locals
  1176. -Comment[cs]=Získat média z místních souborů
  1177. -Comment[da]=Hent medier fra dine lokale filer
  1178. -Comment[de]=Medien von lokalen Dateien holen
  1179. -Comment[el]=Ανάκτηση πολυμέσων από τα τοπικά αρχεία σας
  1180. -Comment[en_GB]=Get media from your local files
  1181. -Comment[es]=Obtenga archivos multimedia de sus archivos locales
  1182. -Comment[fi]=Hae mediaa paikallisista tiedostoista
  1183. -Comment[gl]=Engadir medios locais
  1184. -Comment[hu]=Média beszerzése a helyi fájlokból
  1185. -Comment[id]=Dapatkan media dari berkas lokal anda
  1186. -Comment[it]=Ottieni media dai tuoi file locali
  1187. -Comment[ko]=로컬 파일에서 미디어 가져오기
  1188. -Comment[lt]=Gauti mediją iš vietinių failų
  1189. -Comment[nl]=Haal media uit uw lokale bestanden
  1190. -Comment[pl]=Pobierz multimedia ze swoich plików lokalnych
  1191. -Comment[pt]=Obter conteúdos dos seus ficheiros locais
  1192. -Comment[pt_BR]=Obtém a mídia a partir dos seus arquivos locais
  1193. -Comment[ru]=Медиафайлы, найденные на компьютере
  1194. -Comment[sk]=Získať médiá z vašich miestnych súborov
  1195. -Comment[sl]=Pridobite predstavnostne datoteke iz krajevnih datotek
  1196. -Comment[sr]=Добавите медијуме из локалних фајлова
  1197. -Comment[sr@ijekavian]=Добавите медијуме из локалних фајлова
  1198. -Comment[sr@ijekavianlatin]=Dobavite medijume iz lokalnih fajlova
  1199. -Comment[sr@latin]=Dobavite medijume iz lokalnih fajlova
  1200. -Comment[sv]=Hämta media från lokala filer
  1201. -Comment[tr]=Yerel dosyalarınızdan ortam alın
  1202. -Comment[uk]=Отримати мультимедійні дані з локальних файлів
  1203. -Comment[x-test]=xxGet media from your local filesxx
  1204. -Comment[zh_TW]=從您的本地端檔案取得媒體
  1205. -
  1206. -X-KDE-ServiceTypes=Plasma/MediaCenter/MediaSource
  1207. -
  1208. -X-KDE-PluginInfo-Name=filsystemsearch
  1209. -X-KDE-PluginInfo-Author=Shantanu Tushar
  1210. -X-KDE-PluginInfo-Email=shantanu@kde.org
  1211. -X-KDE-PluginInfo-Version=1.0
  1212. -X-KDE-PluginInfo-License=GPL
  1213. -X-KDE-PluginInfo-EnabledByDefault=true
  1214. -X-KDE-Library=pmc_filesystemsearch
  1215. diff --git a/mediasources/filesystemsearch/filesystemsearchmediasource.cpp b/mediasources/filesystemsearch/filesystemsearchmediasource.cpp
  1216. deleted file mode 100644
  1217. index 489dbe9..0000000
  1218. --- a/mediasources/filesystemsearch/filesystemsearchmediasource.cpp
  1219. +++ /dev/null
  1220. @@ -1,110 +0,0 @@
  1221. -/***********************************************************************************
  1222. - *   Copyright 2014 Shantanu Tushar <shantanu@kde.org>                             *
  1223. - *                                                                                 *
  1224. - *   This library is free software; you can redistribute it and/or                 *
  1225. - *   modify it under the terms of the GNU Lesser General Public                    *
  1226. - *   License as published by the Free Software Foundation; either                  *
  1227. - *   version 2.1 of the License, or (at your option) any later version.            *
  1228. - *                                                                                 *
  1229. - *   This library is distributed in the hope that it will be useful,               *
  1230. - *   but WITHOUT ANY WARRANTY; without even the implied warranty of                *
  1231. - *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU             *
  1232. - *   Lesser General Public License for more details.                               *
  1233. - *                                                                                 *
  1234. - *   You should have received a copy of the GNU Lesser General Public              *
  1235. - *   License along with this library.  If not, see <http://www.gnu.org/licenses/>. *
  1236. - ***********************************************************************************/
  1237. -
  1238. -#include "filesystemsearchmediasource.h"
  1239. -
  1240. -#include <mediacenter/singletonfactory.h>
  1241. -#include <mediacenter/medialibrary.h>
  1242. -#include <mediacenter/mediacenter.h>
  1243. -
  1244. -#include <QUrl>
  1245. -#include <QDir>
  1246. -#include <QDebug>
  1247. -#include <QMimeType>
  1248. -#include <QMimeDatabase>
  1249. -
  1250. -MEDIACENTER_EXPORT_MEDIASOURCE(FilesystemSearchMediaSource, "filesystemsearch.json")
  1251. -
  1252. -FilesystemSearchMediaSource::FilesystemSearchMediaSource(QObject* parent, const QVariantList& args)
  1253. -    : AbstractMediaSource(parent, args),
  1254. -      m_quit(false)
  1255. -{
  1256. -    m_allowedMimes << "audio" << "image" << "video";
  1257. -}
  1258. -
  1259. -FilesystemSearchMediaSource::~FilesystemSearchMediaSource()
  1260. -{
  1261. -    qDebug() << "Waiting for Filesystem Search to quit...";
  1262. -    stop();
  1263. -    wait();
  1264. -}
  1265. -
  1266. -void FilesystemSearchMediaSource::run()
  1267. -{
  1268. -    setPriority(IdlePriority);
  1269. -    recursiveSearch(QDir::home());
  1270. -    qDebug() << "Done scanning the Filesystem";
  1271. -}
  1272. -
  1273. -bool FilesystemSearchMediaSource::recursiveSearch(const QDir &dir)
  1274. -{
  1275. -    if (shouldQuit())   return false;
  1276. -
  1277. -    Q_FOREACH(const QFileInfo &fileInfo, dir.entryInfoList(QDir::Files)) {
  1278. -        if (shouldQuit())   return false;
  1279. -        checkAndAddFile(fileInfo);
  1280. -    }
  1281. -
  1282. -    Q_FOREACH(const QFileInfo &dirInfo, dir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot)) {
  1283. -        if (shouldQuit())   return false;
  1284. -        if (!recursiveSearch(QDir(dirInfo.absoluteFilePath()))) {
  1285. -            break;
  1286. -        }
  1287. -    }
  1288. -
  1289. -    return true;
  1290. -}
  1291. -
  1292. -bool FilesystemSearchMediaSource::shouldQuit() const
  1293. -{
  1294. -    QMutexLocker l(&m_quitMutex);
  1295. -    return m_quit;
  1296. -}
  1297. -
  1298. -void FilesystemSearchMediaSource::stop()
  1299. -{
  1300. -    QMutexLocker l(&m_quitMutex);
  1301. -    m_quit = true;
  1302. -}
  1303. -
  1304. -bool FilesystemSearchMediaSource::checkAndAddFile(const QFileInfo& fileInfo)
  1305. -{
  1306. -    QMimeDatabase db;
  1307. -    const QString mimeType = db.mimeTypeForFile(fileInfo).name();
  1308. -    const QString topLevelTypeName = mimeType.split('/').at(0);
  1309. -
  1310. -    if (!topLevelTypeName.isEmpty() && m_allowedMimes.contains(topLevelTypeName)) {
  1311. -        addFile(fileInfo, topLevelTypeName);
  1312. -        return true;
  1313. -    }
  1314. -
  1315. -    return false;
  1316. -}
  1317. -
  1318. -void FilesystemSearchMediaSource::addFile(const QFileInfo& fileInfo,
  1319. -                                          const QString &type)
  1320. -{
  1321. -    QHash<int, QVariant> values;
  1322. -
  1323. -    values.insert(Qt::DisplayRole, fileInfo.fileName());
  1324. -    values.insert(MediaCenter::MediaUrlRole, QUrl::fromLocalFile(fileInfo.absoluteFilePath()).toString());
  1325. -    values.insert(MediaCenter::MediaTypeRole, type);
  1326. -
  1327. -    SingletonFactory::instanceFor<MediaLibrary>()->updateMedia(values);
  1328. -}
  1329. -
  1330. -#include "filesystemsearchmediasource.moc"
  1331. diff --git a/mediasources/filesystemsearch/filesystemsearchmediasource.h b/mediasources/filesystemsearch/filesystemsearchmediasource.h
  1332. deleted file mode 100644
  1333. index 88740b8..0000000
  1334. --- a/mediasources/filesystemsearch/filesystemsearchmediasource.h
  1335. +++ /dev/null
  1336. @@ -1,57 +0,0 @@
  1337. -/***********************************************************************************
  1338. - *   Copyright 2014 Shantanu Tushar <shantanu@kde.org>                             *
  1339. - *                                                                                 *
  1340. - *   This library is free software; you can redistribute it and/or                 *
  1341. - *   modify it under the terms of the GNU Lesser General Public                    *
  1342. - *   License as published by the Free Software Foundation; either                  *
  1343. - *   version 2.1 of the License, or (at your option) any later version.            *
  1344. - *                                                                                 *
  1345. - *   This library is distributed in the hope that it will be useful,               *
  1346. - *   but WITHOUT ANY WARRANTY; without even the implied warranty of                *
  1347. - *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU             *
  1348. - *   Lesser General Public License for more details.                               *
  1349. - *                                                                                 *
  1350. - *   You should have received a copy of the GNU Lesser General Public              *
  1351. - *   License along with this library.  If not, see <http://www.gnu.org/licenses/>. *
  1352. - ***********************************************************************************/
  1353. -
  1354. -#ifndef FILESYSTEMSEARCHMEDIASOURCE_H
  1355. -#define FILESYSTEMSEARCHMEDIASOURCE_H
  1356. -
  1357. -#include <mediacenter/abstractmediasource.h>
  1358. -
  1359. -#include <QMutex>
  1360. -
  1361. -class QFileInfo;
  1362. -class QDir;
  1363. -
  1364. -/**
  1365. - * \brief Goes through the user's home dir and searches for media
  1366. - *
  1367. - * This MediaSource is supposed to be used for a better-than-nothing scenario
  1368. - * when none of Baloo or Nepomuk are installed. As such this MediaSource does
  1369. - * not attempt 100% correctness and is not configurable at all.
  1370. - */
  1371. -class FilesystemSearchMediaSource : public MediaCenter::AbstractMediaSource
  1372. -{
  1373. -public:
  1374. -    explicit FilesystemSearchMediaSource(QObject* parent = 0, const QVariantList&  = QVariantList());
  1375. -    virtual ~FilesystemSearchMediaSource();
  1376. -
  1377. -protected:
  1378. -    virtual void run();
  1379. -
  1380. -private:
  1381. -    mutable QMutex m_quitMutex;
  1382. -    bool m_quit;
  1383. -
  1384. -    QStringList m_allowedMimes;
  1385. -
  1386. -    bool shouldQuit() const;
  1387. -    bool recursiveSearch(const QDir& dir);
  1388. -    void stop();
  1389. -    bool checkAndAddFile(const QFileInfo &fileInfo);
  1390. -    void addFile(const QFileInfo &fileInfo, const QString &type);
  1391. -};
  1392. -
  1393. -#endif // FILESYSTEMSEARCHMEDIASOURCE_H
  1394. diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
  1395. index cba4fe6..d1553d6 100644
  1396. --- a/tests/CMakeLists.txt
  1397. +++ b/tests/CMakeLists.txt
  1398. @@ -1 +1,2 @@
  1399.  add_subdirectory(mediasourceloadertest)
  1400. +
  1401. diff --git a/tests/mediasourceloadertest/mediasourceloadertest.cpp b/tests/mediasourceloadertest/mediasourceloadertest.cpp
  1402. index 3ae99f4..315ca40 100644
  1403. --- a/tests/mediasourceloadertest/mediasourceloadertest.cpp
  1404. +++ b/tests/mediasourceloadertest/mediasourceloadertest.cpp
  1405. @@ -19,12 +19,12 @@
  1406.   */
  1407.  
  1408.  #include <QCoreApplication>
  1409. -#include "mediacenter/mediasourcesloader.h"
  1410. +#include "mediacenter/datasourcesloader.h"
  1411.  
  1412.  int main(int argc, char *argv[])
  1413.  {
  1414.      QCoreApplication app(argc, argv);
  1415. -    MediaSourcesLoader mediasourcesloader;
  1416. -    mediasourcesloader.load();
  1417. +    DataSourcesLoader datasourcesloader;
  1418. +    datasourcesloader.load();
  1419.      return app.exec();
  1420.  }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top