diff --git a/catalog/management/commands/discover.py b/catalog/management/commands/discover.py index d9bc0a2d..fd6ac864 100644 --- a/catalog/management/commands/discover.py +++ b/catalog/management/commands/discover.py @@ -51,7 +51,14 @@ class Command(BaseCommand): while len(item_ids) < MAX_GALLERY_ITEMS / 2 and days < 150: item_ids = self.get_popular_item_ids(category, days) days *= 3 - items = Item.objects.filter(id__in=item_ids) + items = list( + Item.objects.filter(id__in=item_ids).order_by("-created_time") + ) + if category == ItemCategory.TV: + seasons = [i for i in items if i.__class__ == TVSeason] + for season in seasons: + if season.show in items: + items.remove(season.show) gallery_list.append( { "name": "popular_" + category.value, diff --git a/catalog/templates/_item_card_metadata.html b/catalog/templates/_item_card_metadata.html index 10c5f6d3..76d6d084 100644 --- a/catalog/templates/_item_card_metadata.html +++ b/catalog/templates/_item_card_metadata.html @@ -55,6 +55,9 @@ {% if item.release_date %}{{ item.release_date }}{% endif %} {% include '_people.html' with people=item.genre role='' max=10 %} {% include '_people.html' with people=item.platform role='' max=10 %} + {% if item.show %} + {% trans '所属剧集:' %}{{ item.show.title }} + {% endif %}
{% if item.actor %} diff --git a/catalog/templates/item_base.html b/catalog/templates/item_base.html index 41d512af..6b321d18 100644 --- a/catalog/templates/item_base.html +++ b/catalog/templates/item_base.html @@ -55,7 +55,7 @@
{% if request.user.is_authenticated and not mark.shelf_type %}
-
+
{% for k, v in shelf_types %} {% if v %}
{% endif %} {% if request.user.is_authenticated and mark.shelf_type %} @@ -98,7 +112,7 @@ {% if mark.tags %} @@ -123,7 +137,7 @@ {% if mark.text %} @@ -157,11 +171,13 @@ 我的评论 {% if review %} - + {% else %} - + {% endif %} diff --git a/catalog/templates/tvseason.html b/catalog/templates/tvseason.html index 3ca6f887..4ddafeef 100644 --- a/catalog/templates/tvseason.html +++ b/catalog/templates/tvseason.html @@ -32,12 +32,22 @@ {% block details %}
- {% if item.imdb %} - {% trans 'IMDb:' %}{{ item.imdb }} + {% if item.show %} + {% trans '所属剧集:' %}{{ item.show.title }} {% endif %}
+ {% with item.all_seasons as seasons %} + {% if seasons %} +
+ {% trans '本剧所有季:' %} + {% for s in seasons %} + + {{ s.season_number|default:"#" }} + + {% endfor %} +
+ {% endif %} + {% endwith %}
{% if item.director %} {% trans '导演:' %} @@ -134,6 +144,33 @@ {% endfor %} {% endif %}
+
+ {% if item.showtime %} + {% trans '上映时间:' %} + {% for showtime in item.showtime %} + {% for time, region in showtime.items %} + {{ time }} + {% if region != '' %}({{ region }}){% endif %} + + {% endfor %} + {% if not forloop.last %}/{% endif %} + {% endfor %} + {% endif %} +
+
+ {% if item.other_title %} + {% trans '又名:' %} + {% for t in item.other_title %} + {{ t }} + {% if not forloop.last %}/{% endif %} + {% endfor %} + {% endif %} +
+
+ {% if item.season_count %} + {% trans '总季数:' %}{{ item.season_count }} + {% endif %} +
{% if item.season_number %} {% trans '本季序号:' %}{{ item.season_number }} @@ -144,66 +181,27 @@ {% trans '本季集数:' %}{{ item.episode_count }} {% endif %}
-
-
- {% if item.season_count %} - {% trans '总季数:' %}{{ item.season_count }} +
+
+ {% if item.imdb %} + {% trans 'IMDb:' %}{{ item.imdb }} + {% endif %} +
+
+ {% if item.site %} + {% trans '网站:' %} + {{ item.site|strip_scheme }} + {% endif %} +
+ {% if item.other_info %} + {% for k, v in item.other_info.items %}
{{ k }}:{{ v|urlizetrunc:24 }}
{% endfor %} {% endif %} -
-
- {% if item.single_episode_length %} - {% trans '单集长度:' %}{{ item.single_episode_length }} - {% endif %} -
-{% with item.all_seasons as seasons %} - {% if seasons %} -
- {% trans '本剧所有季:' %} - {% for s in seasons %} - - {{ s.season_number }} - - {% endfor %} -
- {% endif %} -{% endwith %} -
- {% if item.showtime %} - {% trans '上映时间:' %} - {% for showtime in item.showtime %} - {% for time, region in showtime.items %} - {{ time }} - {% if region != '' %}({{ region }}){% endif %} - - {% endfor %} - {% if not forloop.last %}/{% endif %} - {% endfor %} - {% endif %} -
-
- {% if item.other_title %} - {% trans '又名:' %} - {% for t in item.other_title %} - {{ t }} - {% if not forloop.last %}/{% endif %} - {% endfor %} - {% endif %} -
-
- {% if item.site %} - {% trans '网站:' %} - {{ item.site|strip_scheme }} - {% endif %} -
-{% if item.other_info %} - {% for k, v in item.other_info.items %}
{{ k }}:{{ v|urlizetrunc:24 }}
{% endfor %} -{% endif %} {% endblock %} {% block sidebar %}{% endblock %} diff --git a/catalog/templates/tvshow.html b/catalog/templates/tvshow.html index 12afc5ac..cbba3b7e 100644 --- a/catalog/templates/tvshow.html +++ b/catalog/templates/tvshow.html @@ -11,13 +11,6 @@ {% load thumb %} {% block details %} -
- {% if item.imdb %} - {% trans 'IMDb:' %}{{ item.imdb }} - {% endif %} -
{% if item.director %} {% trans '导演:' %} @@ -30,13 +23,12 @@ {% if item.director|length > 5 %} {% trans '更多' %} {% endif %} {% endif %} @@ -76,13 +68,12 @@ {% if item.actor|length > 5 %} {% trans '更多' %} {% endif %} {% endif %} @@ -114,6 +105,18 @@ {% endfor %} {% endif %}
+ {% with item.all_seasons as seasons %} + {% if seasons %} +
+ {% trans '本剧所有季:' %} + {% for s in seasons %} + + {{ s.season_number|default:"#" }} + + {% endfor %} +
+ {% endif %} + {% endwith %}
{% if item.season_count %} {% trans '季数:' %}{{ item.season_count }} @@ -129,18 +132,6 @@ {% trans '单集长度:' %}{{ item.single_episode_length }} {% endif %}
- {% with item.all_seasons as seasons %} - {% if seasons %} -
- {% trans '本剧所有季:' %} - {% for s in seasons %} - - {{ s.season_number }} - - {% endfor %} -
- {% endif %} - {% endwith %}
{% if item.showtime %} {% trans '播出时间:' %} @@ -163,6 +154,13 @@ {% endfor %} {% endif %}
+
+ {% if item.imdb %} + {% trans 'IMDb:' %}{{ item.imdb }} + {% endif %} +
{% if item.site %} {% trans '网站:' %} diff --git a/common/static/scss/_item.scss b/common/static/scss/_item.scss index f0c2740e..9e1e75eb 100644 --- a/common/static/scss/_item.scss +++ b/common/static/scss/_item.scss @@ -8,6 +8,22 @@ color: var(--pico-muted-color); } + span.season-number { + a { + border-radius: calc(var(--pico-spacing)/4); + margin-right: 0.5em; + padding: 0 0.25rem; + border: var(--pico-primary) solid 1px; + + &.current { + color: var(--pico-form-element-background-color); + background: var(--pico-primary); + line-height: 1.2em; + text-decoration: none; + } + } + } + .muted .fa-lock { filter: brightness(50%) !important; }