null in claim description
This commit is contained in:
parent
635aebfeeb
commit
2495df8859
3 changed files with 9 additions and 4 deletions
|
@ -436,9 +436,9 @@ class BulkLoader:
|
|||
claim_record['claim_type'] = TXO_TYPES['stream']
|
||||
claim_record['stream_type'] = STREAM_TYPES[guess_stream_type(claim_record['media_type'])]
|
||||
claim_record['media_type'] = claim.stream.source.media_type
|
||||
claim_record['title'] = claim.stream.title
|
||||
claim_record['description'] = claim.stream.description
|
||||
claim_record['author'] = claim.stream.author
|
||||
claim_record['title'] = claim.stream.title.replace('\x00', '')
|
||||
claim_record['description'] = claim.stream.description.replace('\x00', '')
|
||||
claim_record['author'] = claim.stream.author.replace('\x00', '')
|
||||
if claim.stream.video and claim.stream.video.duration:
|
||||
claim_record['duration'] = claim.stream.video.duration
|
||||
if claim.stream.audio and claim.stream.audio.duration:
|
||||
|
|
|
@ -6,7 +6,11 @@ WEIRD_CHARS_RE = re.compile(r"[#!~]")
|
|||
|
||||
|
||||
def normalize_tag(tag: str):
|
||||
return MULTI_SPACE_RE.sub(' ', WEIRD_CHARS_RE.sub(' ', tag.lower().replace("'", ""))).strip()
|
||||
return MULTI_SPACE_RE.sub(
|
||||
' ', WEIRD_CHARS_RE.sub(
|
||||
' ', tag.lower().replace("'", "").replace('\x00', '')
|
||||
)
|
||||
).strip()
|
||||
|
||||
|
||||
def clean_tags(tags: List[str]):
|
||||
|
|
|
@ -14,6 +14,7 @@ class TestTagNormalization(unittest.TestCase):
|
|||
tag('tag', 'T\'ag')
|
||||
tag('t ag', '\tT \nAG ')
|
||||
tag('tag hash', '#tag~#hash!')
|
||||
tag('foobar', 'foo\x00bar')
|
||||
|
||||
def test_clean_tags(self):
|
||||
self.assertEqual(['tag'], clean_tags([' \t #!~', '!taG', '\t']))
|
||||
|
|
Loading…
Reference in a new issue