forked from wallabag/wallabag
Added elCurator import
This commit is contained in:
committed by
Jeremy Benoist
parent
3c5aa05311
commit
958e77e6a7
41
src/Wallabag/ImportBundle/Controller/ElcuratorController.php
Normal file
41
src/Wallabag/ImportBundle/Controller/ElcuratorController.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace Wallabag\ImportBundle\Controller;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class ElcuratorController extends WallabagController
|
||||
{
|
||||
/**
|
||||
* @Route("/elcurator", name="import_elcurator")
|
||||
*/
|
||||
public function indexAction(Request $request)
|
||||
{
|
||||
return parent::indexAction($request);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getImportService()
|
||||
{
|
||||
$service = $this->get('wallabag_import.elcurator.import');
|
||||
|
||||
if ($this->get('craue_config')->get('import_with_rabbitmq')) {
|
||||
$service->setProducer($this->get('old_sound_rabbit_mq.import_elcurator_producer'));
|
||||
} elseif ($this->get('craue_config')->get('import_with_redis')) {
|
||||
$service->setProducer($this->get('wallabag_import.producer.redis.elcurator'));
|
||||
}
|
||||
|
||||
return $service;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getImportTemplate()
|
||||
{
|
||||
return 'WallabagImportBundle:Elcurator:index.html.twig';
|
||||
}
|
||||
}
|
||||
54
src/Wallabag/ImportBundle/Import/ElcuratorImport.php
Normal file
54
src/Wallabag/ImportBundle/Import/ElcuratorImport.php
Normal file
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace Wallabag\ImportBundle\Import;
|
||||
|
||||
class ElcuratorImport extends WallabagImport
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'elcurator';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getUrl()
|
||||
{
|
||||
return 'import_elcurator';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
return 'import.elcurator.description';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function prepareEntry($entry = [])
|
||||
{
|
||||
return [
|
||||
'url' => $entry['url'],
|
||||
'title' => $entry['title'],
|
||||
'created_at' => $entry['created_at'],
|
||||
'is_archived' => 0,
|
||||
'is_starred' => $entry['is_saved'],
|
||||
] + $entry;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setEntryAsRead(array $importedEntry)
|
||||
{
|
||||
$importedEntry['is_archived'] = 1;
|
||||
|
||||
return $importedEntry;
|
||||
}
|
||||
}
|
||||
@ -48,6 +48,14 @@ services:
|
||||
- "@wallabag_import.wallabag_v2.import"
|
||||
- "@event_dispatcher"
|
||||
- "@logger"
|
||||
wallabag_import.consumer.amqp.elcurator:
|
||||
class: Wallabag\ImportBundle\Consumer\AMQPEntryConsumer
|
||||
arguments:
|
||||
- "@doctrine.orm.entity_manager"
|
||||
- "@wallabag_user.user_repository"
|
||||
- "@wallabag_import.elcurator.import"
|
||||
- "@event_dispatcher"
|
||||
- "@logger"
|
||||
wallabag_import.consumer.amqp.firefox:
|
||||
class: Wallabag\ImportBundle\Consumer\AMQPEntryConsumer
|
||||
arguments:
|
||||
|
||||
@ -126,6 +126,27 @@ services:
|
||||
- "@event_dispatcher"
|
||||
- "@logger"
|
||||
|
||||
# elcurator
|
||||
wallabag_import.queue.redis.elcurator:
|
||||
class: Simpleue\Queue\RedisQueue
|
||||
arguments:
|
||||
- "@wallabag_core.redis.client"
|
||||
- "wallabag.import.elcurator"
|
||||
|
||||
wallabag_import.producer.redis.elcurator:
|
||||
class: Wallabag\ImportBundle\Redis\Producer
|
||||
arguments:
|
||||
- "@wallabag_import.queue.redis.elcurator"
|
||||
|
||||
wallabag_import.consumer.redis.elcurator:
|
||||
class: Wallabag\ImportBundle\Consumer\RedisEntryConsumer
|
||||
arguments:
|
||||
- "@doctrine.orm.entity_manager"
|
||||
- "@wallabag_user.user_repository"
|
||||
- "@wallabag_import.elcurator.import"
|
||||
- "@event_dispatcher"
|
||||
- "@logger"
|
||||
|
||||
# firefox
|
||||
wallabag_import.queue.redis.firefox:
|
||||
class: Simpleue\Queue\RedisQueue
|
||||
|
||||
@ -48,6 +48,18 @@ services:
|
||||
tags:
|
||||
- { name: wallabag_import.import, alias: wallabag_v2 }
|
||||
|
||||
wallabag_import.elcurator.import:
|
||||
class: Wallabag\ImportBundle\Import\ElcuratorImport
|
||||
arguments:
|
||||
- "@doctrine.orm.entity_manager"
|
||||
- "@wallabag_core.content_proxy"
|
||||
- "@wallabag_core.tags_assigner"
|
||||
- "@event_dispatcher"
|
||||
calls:
|
||||
- [ setLogger, [ "@logger" ]]
|
||||
tags:
|
||||
- { name: wallabag_import.import, alias: elcurator }
|
||||
|
||||
wallabag_import.readability.import:
|
||||
class: Wallabag\ImportBundle\Import\ReadabilityImport
|
||||
arguments:
|
||||
|
||||
@ -0,0 +1,3 @@
|
||||
{% extends "WallabagImportBundle:WallabagV1:index.html.twig" %}
|
||||
|
||||
{% block title %}{{ 'import.elcurator.page_title'|trans }}{% endblock %}
|
||||
Reference in New Issue
Block a user