Ignore videos during imports

This commit is contained in:
Salt 2025-01-24 02:52:38 -06:00
parent d3da20dc33
commit b5e2a6530d

View File

@ -27,19 +27,28 @@ def odysee_get_releases(handle):
items = data.get("result", {}).get("items", [])
for raw_item in items:
item = raw_item
# The value_type field can help us immediately whittle down chaff like reposts,
# playlists, etc. By and large we only care about streams, I think, but I'm not
# confident enough in my knowledge of the LBRY API to whitelist instead of
# blacklist value_types.
if item["value_type"] == "repost":
item = raw_item["reposted_claim"]
elif item["value_type"] == "stream":
# This is known to be a zip file
if item["value_type"] == "stream":
pass
elif item["value_type"] == "collection":
# Collections are playlists, and we don't care about the ones that aren't
continue
else:
print(f'Unknown value type, continuing: {item["value_type"]}')
# A stream is data(?) in the form of a file, but we don't know what
# So we should check to see what it is and ignore it if it's something dumb
if item["value"].get("stream_type") == "video":
continue
releases[item["claim_id"]] = {
"name": item.get("name", "Unnamed Release"),
"title": item["value"].get("title", "Untitled Release"),
# This field is an int in unixtime
"publishdate": item["value"].get("release_time", 0),
"description": item["value"].get("description", "No description provided for this release"),
"thumbnail": item["value"].get("thumbnail", {}).get("url", ""),
"url": f"{odysee_get_channel_url(handle)}/{item['name']}"