diff --git a/catalog/podcast/models.py b/catalog/podcast/models.py
index 52eb36b0..ad62c9ae 100644
--- a/catalog/podcast/models.py
+++ b/catalog/podcast/models.py
@@ -27,6 +27,7 @@ class PodcastSchema(PodcastInSchema, BaseSchema):
class Podcast(Item):
category = ItemCategory.Podcast
+ child_class = "PodcastEpisode"
url_path = "podcast"
demonstrative = _("这档播客")
# apple_podcast = PrimaryLookupIdDescriptor(IdType.ApplePodcast)
@@ -80,7 +81,7 @@ class Podcast(Item):
@property
def child_items(self):
- return self.episodes.all()
+ return self.episodes.filter(is_deleted=False, merged_to_item=None)
class PodcastEpisode(Item):
@@ -90,7 +91,9 @@ class PodcastEpisode(Item):
# uid = models.UUIDField(default=uuid.uuid4, editable=False, db_index=True)
program = models.ForeignKey(Podcast, models.CASCADE, related_name="episodes")
guid = models.CharField(null=True, max_length=1000)
- pub_date = models.DateTimeField()
+ pub_date = models.DateTimeField(
+ verbose_name=_("发布时间"), help_text="yyyy/mm/dd hh:mm"
+ )
media_url = models.CharField(null=True, max_length=1000)
# title = models.CharField(default="", max_length=1000)
# description = models.TextField(null=True)
@@ -99,10 +102,19 @@ class PodcastEpisode(Item):
cover_url = models.CharField(null=True, max_length=1000)
duration = models.PositiveIntegerField(null=True)
+ METADATA_COPY_LIST = [
+ "title",
+ "brief",
+ "pub_date",
+ ]
+
@property
def parent_item(self):
return self.program
+ def set_parent_item(self, value):
+ self.program = value
+
@property
def display_title(self):
return f"{self.program.title} - {self.title}"
@@ -118,6 +130,10 @@ class PodcastEpisode(Item):
else f"{self.url}?position={position}"
)
+ @classmethod
+ def lookup_id_type_choices(cls):
+ return []
+
class Meta:
index_together = [
[
diff --git a/catalog/templates/_sidebar_edit.html b/catalog/templates/_sidebar_edit.html
index a78cc23a..1e2fe4e7 100644
--- a/catalog/templates/_sidebar_edit.html
+++ b/catalog/templates/_sidebar_edit.html
@@ -77,24 +77,31 @@
{% endfor %}
{% if item.child_class %}
{% trans '创建子条目' %}
+
+ {% trans '编辑下一级条目' %} ({{ item.child_items.count }})
+
+
{% trans '批量获取单集子条目' %}
+ {% trans '批量获取单集条目' %}
{% if item.imdb and item.season_number is not None %}
{% else %}
批量获取单集子条目需要本季序号和IMDB信息,不便填写也可以手工创建子条目。
@@ -132,6 +139,17 @@
{% trans '切换分类' %}
+
+