# -*- coding: utf-8 -*-
import json
from scrapy.xlib.pydispatch import dispatcher
from scrapy import signals
from scrapy.contrib.exporter import JsonItemExporter

class LetrasPipeline(object):
    def process_item(self, item, spider):
        return item

# class JsonExportPipeline(object):

#     def __init__(self):
#         dispatcher.connect(self.spider_opened, signals.spider_opened)
#         dispatcher.connect(self.spider_closed, signals.spider_closed)
#         self.files = {}

#     def spider_opened(self, spider):
#         file = open('%s_items.json' % spider.name, 'w+b')
#         self.files[spider] = file
#         self.exporter = JsonItemExporter(file)
#         self.exporter.start_exporting()

#     def spider_closed(self, spider):
#         self.exporter.finish_exporting()
#         file = self.files.pop(spider)
#         file.close()

#     def process_item(self, item, spider):
#         self.exporter.export_item(item)
#         return item