Open belikor opened 2 years ago
Previously print_claims.py
had both print_tr_claims
and print_sch_claims
; the first one was used in claims.py
for list_trending_claims
, and the second one for list_search_claims
; the second method was also used in claims_ch.py
by list_ch_claims
.
Now the toplevel methods list_trending_claims
, list_search_claims
, and list_ch_claims
use print_sch_claims
, which now has more parameters:
def print_sch_claims(claims,
create=False, height=False, release=True,
claim_id=False, typ=True, ch_name=False,
long_chan=False,
sizes=True, fees=True,
title=False, sanitize=False,
start=1, end=0,
reverse=False,
file=None, fdate=False, sep=";"):
The other method used to print claims is print_f_claims
in printf.py
, but this method is used to print a list of claims in the offline database, meaning from lbrynet file list
:
def print_f_claims(items=None, show="all",
blocks=False, cid=True, blobs=True, size=True,
typ=False, ch=False, ch_online=True,
name=True, title=False, path=False,
sanitize=False,
start=1, end=0, channel=None,
reverse=False,
file=None, fdate=False, sep=";",
server="http://localhost:5279"):
The first method print_sch_claims
is to print claims from the online database meaning lbrynet claim search
.
The changes were made in various consecutive commits a859887f, 597dcb6e, 68b48057, 66854ebb, c6c4e453, 80a52e91, and 494f5ed0.
Most claims when resolved online have the same type of data in the output dictionary; instead of handling the printing by special functions, we could simplify this by using a single function with many options.
For example,
print_claims.print_sch_claims
already can print a list of claims with a lot of information, which is controlled by the parameters given to it. We can display block height, claim_id, type, channel name, title, and others. This function could be used in all methods that require printing claims.