From f71936987a8e1f528779160231bc8fc5ccf8a3ef Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 1 Jun 2023 14:35:45 -0400 Subject: [PATCH] finetune podcast discovery --- catalog/management/commands/discover.py | 23 ++++++++++++----------- catalog/templates/common_libs.html | 11 +++++++++++ users/templates/users/preferences.html | 18 ++++++++++++++++++ 3 files changed, 41 insertions(+), 11 deletions(-) diff --git a/catalog/management/commands/discover.py b/catalog/management/commands/discover.py index 07cebc5f..f787aac2 100644 --- a/catalog/management/commands/discover.py +++ b/catalog/management/commands/discover.py @@ -9,9 +9,9 @@ from django.db.models import Count MAX_ITEMS_PER_PERIOD = 12 -MIN_MARKS = 2 -MAX_DAYS_FOR_PERIOD = 64 -MIN_DAYS_FOR_PERIOD = 4 +MIN_MARKS = 3 +MAX_DAYS_FOR_PERIOD = 96 +MIN_DAYS_FOR_PERIOD = 6 class Command(BaseCommand): @@ -78,15 +78,16 @@ class Command(BaseCommand): f"Marked {category} for last {days} days: {len(ids)}" ) item_ids = ids + item_ids + if category == ItemCategory.Podcast: + extra_ids = self.get_popular_commented_item_ids( + ItemCategory.Podcast, days, item_ids + ) + self.stdout.write( + f"Commented podcast for last {days} days: {len(extra_ids)}" + ) + item_ids = extra_ids + item_ids days //= 2 - if category == ItemCategory.Podcast: - extra_ids = self.get_popular_commented_item_ids( - ItemCategory.Podcast, MAX_DAYS_FOR_PERIOD, item_ids - ) - self.stdout.write( - f"Commented podcast for last {MAX_DAYS_FOR_PERIOD} days: {len(extra_ids)}" - ) - item_ids = extra_ids + item_ids + items = [Item.objects.get(pk=i) for i in item_ids] if category == ItemCategory.TV: items = self.cleanup_shows(items) diff --git a/catalog/templates/common_libs.html b/catalog/templates/common_libs.html index 5d70b30d..a72d2166 100644 --- a/catalog/templates/common_libs.html +++ b/catalog/templates/common_libs.html @@ -35,3 +35,14 @@ type="application/opensearchdescription+xml" title="{{ site_name }}" href="{% static 'opensearch.xml' %}"> + diff --git a/users/templates/users/preferences.html b/users/templates/users/preferences.html index 3797cb07..6fdc48a0 100644 --- a/users/templates/users/preferences.html +++ b/users/templates/users/preferences.html @@ -120,6 +120,24 @@ +
+
+
+ {% trans '当前设备设置' %} +
自定义样式代码 (实验功能)
+ +
+ +
+ +
{% include "_sidebar.html" with show_profile=1 %}