37 lines
2.5 KiB
Python

import uuid
from django.db import models
from . import odysee
class Tag(models.Model):
id = models.CharField(primary_key=True, max_length=512, default=uuid.uuid4, editable=False, db_index=True, help_text="A unique identifier for this tag")
name = models.CharField(max_length=256, help_text="The name for this tag as it should be displayed across UIs")
description = models.TextField(help_text="A user-facing description of the tag")
def __str__(self):
return self.name
class OdyseeChannel(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False, db_index=True, help_text="A unique identifier for this channel")
name = models.CharField(max_length=1024, help_text="The human-readable name of the channel. Does not, and often will not, necessarily correlate with the channel's handle")
description = models.TextField(help_text="A user-facing description of the channel, its owners, and its content. May also contain links to related resources and websites.")
handle = models.CharField(max_length=1024, help_text="The @tag of the user. May be a short tag (@someuser) or qualified with claimid (@someuser:4ab8)")
def __str__(self):
return self.name
class OdyseeRelease(models.Model):
id = models.CharField(primary_key=True, max_length=512, default=uuid.uuid4, editable=False, db_index=True, help_text="A unique identifier for this release. Usually the LBRY claim ID, if available")
channel = models.ForeignKey(OdyseeChannel, on_delete=models.CASCADE, db_index=True, help_text="The channel that this release came from")
name = models.CharField(max_length=1024, help_text="The human-readable name of this release")
description = models.TextField(help_text="A user-facing description of this release. This should mirror the official post from Odysee, if available")
released = models.DateField(help_text="The date that this release was posted in UTC")
url = models.URLField(max_length=512, help_text="The URL to the Odysee page where the release can be downloaded. It is NOT a direct download link")
thumbnail = models.URLField(max_length=512, help_text="The URL to the Odysee-hosted thumbnail of the release")
filehash = models.CharField(max_length=512, help_text="The hash of the file of the claim")
tags = models.ManyToManyField(Tag, related_name="releases", help_text="A list of tags associated with this release. This should NOT contain extraneous tags from Odysee -- it's a data structure specific to this site.")
def __str__(self):
return self.name