finetune podcast discovery

This commit is contained in:
Your Name 2023-06-01 14:35:45 -04:00 committed by Henri Dickson
parent d63baf8ed2
commit f71936987a
3 changed files with 41 additions and 11 deletions

View file

@ -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)

View file

@ -35,3 +35,14 @@
type="application/opensearchdescription+xml"
title="{{ site_name }}"
href="{% static 'opensearch.xml' %}">
<script defer>
(function(){
const s = localStorage.getItem("user_style");
console.log(s);
if (s) {
const style = document.createElement("style");
style.innerHTML = s;
document.head.appendChild(style);
}
})();
</script>

View file

@ -120,6 +120,24 @@
</section>
<input type="submit" value="{% trans '保存' %}">
</form>
<hr>
<section>
<details>
<summary>{% trans '当前设备设置' %}</summary>
<h6>自定义样式代码 (实验功能)</h6>
<textarea id="user_style"></textarea>
<br>
<button onclick="localStorage.setItem('user_style', document.getElementById('user_style').value);location.reload();">
保存
</button>
</details>
<script>
const s = localStorage.getItem("user_style");
if (s) {
document.getElementById("user_style").value = s;
}
</script>
</section>
</article>
</div>
{% include "_sidebar.html" with show_profile=1 %}