Example #1
0
    def load_file_attributes(self, sd_hash=None):
        if not sd_hash:
            sd_hash = yield self.stream_info_manager.get_sd_blob_hashes_for_stream(self.stream_hash)
            if sd_hash:
                self.sd_hash = sd_hash[0]
            else:
                raise NoSuchStreamHash(self.stream_hash)
        else:
            self.sd_hash = sd_hash

        defer.returnValue(None)
    def _delete_stream(self, stream_hash):

        d = self.db_conn.runQuery("select stream_hash from live_streams where stream_hash = ?", (stream_hash,))
        d.addCallback(lambda result: result[0][0] if len(result) else Failure(NoSuchStreamHash(stream_hash)))

        def do_delete(transaction, s_h):
            transaction.execute("delete from live_streams where stream_hash = ?", (s_h,))
            transaction.execute("delete from live_stream_blobs where stream_hash = ?", (s_h,))
            transaction.execute("delete from live_stream_descriptors where stream_hash = ?", (s_h,))

        d.addCallback(lambda s_h: self.db_conn.runInteraction(do_delete, s_h))
        return d
    def _delete_stream(self, stream_hash):
        d = self.db_conn.runQuery(
            "select rowid, stream_hash from lbry_files where stream_hash = ?", (stream_hash,))
        d.addCallback(
            lambda result: result[0] if result else Failure(NoSuchStreamHash(stream_hash)))

        def do_delete(transaction, row_id, s_h):
            transaction.execute("delete from lbry_files where stream_hash = ?", (s_h,))
            transaction.execute("delete from lbry_file_blobs where stream_hash = ?", (s_h,))
            transaction.execute("delete from lbry_file_descriptors where stream_hash = ?", (s_h,))
            transaction.execute("delete from lbry_file_metadata where lbry_file = ?", (row_id,))

        d.addCallback(lambda (row_id, s_h): self.db_conn.runInteraction(do_delete, row_id, s_h))
        return d
Example #4
0
    def set_stream_info(self):
        if self.key is None:
            out = yield self.stream_info_manager.get_stream_info(
                self.stream_hash)
            key, stream_name, suggested_file_name = out
            self.key = binascii.unhexlify(key)
            self.stream_name = binascii.unhexlify(stream_name)
            self.suggested_file_name = binascii.unhexlify(suggested_file_name)

            out = yield self.stream_info_manager.get_sd_blob_hashes_for_stream(
                self.stream_hash)
            if out:
                self.sd_hash = out[0]
            else:
                raise NoSuchStreamHash(self.stream_hash)
Example #5
0
 def load_file_attributes(self):
     sd_hash = yield self.stream_info_manager.get_sd_blob_hashes_for_stream(
         self.stream_hash)
     if sd_hash:
         self.sd_hash = sd_hash[0]
     else:
         raise NoSuchStreamHash(self.stream_hash)
     stream_metadata = yield self.wallet.get_claim_metadata_for_sd_hash(
         self.sd_hash)
     if stream_metadata:
         name, txid, nout = stream_metadata
         self.uri = name
         self.txid = txid
         self.nout = nout
     else:
         raise NoSuchSDHash(self.sd_hash)
     self.claim_id = yield self.wallet.get_claimid(self.uri, self.txid,
                                                   self.nout)
     defer.returnValue(None)
Example #6
0
 def get_result(res):
     if res:
         return res[0]
     else:
         raise NoSuchStreamHash(stream_hash)
 def _get_stream_info(self, stream_hash):
     d = self.db_conn.runQuery("select public_key, key, stream_name from live_streams where stream_hash = ?",
                               (stream_hash,))
     d.addCallback(lambda result: result[0] if len(result) else Failure(NoSuchStreamHash(stream_hash)))
     return d