return (
not self.youtube_volume
or not type(self)
- .objects.filter(youtube_volume=self.youtube_volume, index__lt=self.index)
+ .objects.filter(slug=self.slug, youtube_volume=self.youtube_volume, index__lt=self.index)
.exists()
)
</form>
</td>
<td>
- {{ audiobook.total|duration }}
+ {% if audiobook.youtube_volume %}
+ {{ audiobook.total|duration }}
+ {% else %}
+ <small class="text-secondary">{{ audiobook.subtotal|duration }}</small>
+ {% endif %}
</td>
<td>
{{ audiobook.duration|duration }}
</span>
</td>
<td>
+ <small class="text-secondary">{{ audiobook.subtotal|duration }}</small>
</td>
<td class="text-secondary">
{{ audiobook.duration|duration }}
<table class="table">
{% for file in objects %}
<tr>
- <td><a href='{% url "file" file.id %}'>{{ file }}</a></td>
+ <td>
+ <a href='{% url "file" file.id %}'>
+ {{ file }}
+ {% if file.youtube_status == k.0 and file.youtube_volume %}
+ <br>
+ <small>
+ ({{ file.youtube_volume_index }}/{{ file.youtube_volume_count }})
+ {{ file.youtube_volume }}
+ </small>
+ {% endif %}
+ </a>
+ </td>
<td class="text-warning">
{% if file.mp3_status == k.0 %}MP3{% endif %}
</td>
"index"
)
last_vol = None
+ last_vol_sub = None
for b in qs:
- if last_vol is None or last_vol.youtube_volume != b.youtube_volume:
+ if last_vol is None or last_vol.youtube_volume_index != b.youtube_volume_index:
last_vol = b
b.total = 0
+ if last_vol_sub is None or b.youtube_volume:
+ last_vol_sub = last_vol
+ last_vol_sub.total_for_sub = 0
last_vol.total += b.duration
+ last_vol_sub.total_for_sub += b.duration
+ b.subtotal = last_vol_sub.total_for_sub
return list(qs)