Beispiel #1
0
 def __init__(self,
              rowid,
              stream_hash,
              peer_finder,
              rate_limiter,
              blob_manager,
              stream_info_manager,
              lbry_file_manager,
              payment_rate_manager,
              wallet,
              download_directory,
              upload_allowed,
              file_name=None):
     EncryptedFileSaver.__init__(self, stream_hash, peer_finder,
                                 rate_limiter, blob_manager,
                                 stream_info_manager, payment_rate_manager,
                                 wallet, download_directory, upload_allowed,
                                 file_name)
     self.sd_hash = None
     self.txid = None
     self.nout = None
     self.uri = None
     self.claim_id = None
     self.rowid = rowid
     self.lbry_file_manager = lbry_file_manager
     self._saving_status = False
 def __init__(self, rowid, stream_hash, peer_finder, rate_limiter, blob_manager, stream_info_manager,
              lbry_file_manager, payment_rate_manager, wallet, download_directory, upload_allowed,
              file_name=None):
     EncryptedFileSaver.__init__(self, stream_hash, peer_finder, rate_limiter, blob_manager,
                            stream_info_manager, payment_rate_manager, wallet, download_directory,
                            upload_allowed, file_name)
     self.sd_hash = None
     self.txid = None
     self.uri = None
     self.claim_id = None
     self.rowid = rowid
     self.lbry_file_manager = lbry_file_manager
     self.saving_status = False
Beispiel #3
0
    def _start(self):

        d = EncryptedFileSaver._start(self)
        d.addCallback(lambda _: self.stream_info_manager.
                      get_sd_blob_hashes_for_stream(self.stream_hash))

        def _save_sd_hash(sd_hash):
            if len(sd_hash):
                self.sd_hash = sd_hash[0]
                d = self.wallet.get_claim_metadata_for_sd_hash(self.sd_hash)
            else:
                d = defer.succeed(None)

            return d

        def _save_claim(name, txid):
            self.uri = name
            self.txid = txid
            return defer.succeed(None)

        d.addCallback(_save_sd_hash)
        d.addCallback(lambda r: _save_claim(r[0], r[1]) if r else None)
        d.addCallback(lambda _: self._save_status())

        return d
Beispiel #4
0
    def _start(self):

        d = EncryptedFileSaver._start(self)
        d.addCallback(
            lambda _: self.stream_info_manager.get_sd_blob_hashes_for_stream(self.stream_hash))

        def _save_sd_hash(sd_hash):
            if len(sd_hash):
                self.sd_hash = sd_hash[0]
                d = self.wallet.get_claim_metadata_for_sd_hash(self.sd_hash)
            else:
                d = defer.succeed(None)

            return d

        def _save_claim(name, txid, nout):
            self.uri = name
            self.txid = txid
            self.nout = nout
            return defer.succeed(None)

        d.addCallback(_save_sd_hash)
        d.addCallback(lambda r: _save_claim(r[0], r[1], r[2]) if r else None)
        d.addCallback(lambda _: self._save_status())

        return d
 def _start(self):
     yield EncryptedFileSaver._start(self)
     sd_hash = yield self.stream_info_manager.get_sd_blob_hashes_for_stream(self.stream_hash)
     if len(sd_hash):
         self.sd_hash = sd_hash[0]
         maybe_metadata = yield self.wallet.get_claim_metadata_for_sd_hash(self.sd_hash)
         if maybe_metadata:
             name, txid, nout = maybe_metadata
             self.uri = name
             self.txid = txid
             self.nout = nout
     status = yield self._save_status()
     defer.returnValue(status)
    def test_setup_output(self):
        file_name = 'encrypted_file_saver_test.tmp'
        self.assertFalse(os.path.isfile(file_name))

        # create file in the temporary trial folder
        stream_hash = ''
        peer_finder = None
        rate_limiter = None
        blob_manager = None
        stream_info_manager = None
        payment_rate_manager = None
        wallet = None
        download_directory = '.'
        upload_allowed = False
        saver = EncryptedFileSaver(stream_hash, peer_finder, rate_limiter,
                                   blob_manager, stream_info_manager,
                                   payment_rate_manager, wallet,
                                   download_directory, file_name)

        yield saver._setup_output()
        self.assertTrue(os.path.isfile(file_name))
        saver._close_output()
Beispiel #7
0
 def _start(self):
     yield EncryptedFileSaver._start(self)
     sd_hash = yield self.stream_info_manager.get_sd_blob_hashes_for_stream(
         self.stream_hash)
     if len(sd_hash):
         self.sd_hash = sd_hash[0]
         maybe_metadata = yield self.wallet.get_claim_metadata_for_sd_hash(
             self.sd_hash)
         if maybe_metadata:
             name, txid, nout = maybe_metadata
             self.uri = name
             self.txid = txid
             self.nout = nout
     status = yield self._save_status()
     defer.returnValue(status)
Beispiel #8
0
 def _start(self):
     yield EncryptedFileSaver._start(self)
     yield self.load_file_attributes()
     status = yield self._save_status()
     log_status(self.name, self.sd_hash, status)
     defer.returnValue(status)