feat: add season dividers to series episode lists
Add visual separators between seasons in series episode tables. Extract season number from episode data and insert divider rows with "Staffel N" labels when season changes. Style dividers with dark background and subtle borders to improve readability of long episode lists.
This commit is contained in:
@@ -186,7 +186,7 @@ def sonarr_groups():
|
||||
ef = files.get(episode.get("episodeFileId"));
|
||||
if ef: ef = dict(ef); ef["path"] = str(Path(series.get("path") or "") / ef.get("relativePath", ""))
|
||||
label = f"S{episode.get('seasonNumber', 0):02d}E{episode.get('episodeNumber', 0):02d} · {episode.get('title') or '—'}"
|
||||
items.append(media_row(label, None, ef, SONARR_MEDIA_PATH, LOCAL_SERIES_PATH, {"episode":True, "downloading": episode.get("id") in queued_episodes}))
|
||||
items.append(media_row(label, None, ef, SONARR_MEDIA_PATH, LOCAL_SERIES_PATH, {"episode":True, "season":episode.get("seasonNumber", 0), "downloading": episode.get("id") in queued_episodes}))
|
||||
groups.append({"title":series.get("title", "—"), "year":series.get("year"), "episodes":items})
|
||||
return sorted(groups, key=lambda x: x["title"].lower())
|
||||
|
||||
|
||||
@@ -46,6 +46,12 @@ async function fetchDownloads(){if(!downloadBody)return;try{const response=await
|
||||
if(downloadBody){fetchDownloads();setInterval(fetchDownloads,4000)}
|
||||
</script>
|
||||
<style>
|
||||
.season-divider td{padding:6px 10px;background:#1b1b1b;border-top:1px solid #444;border-bottom:1px solid #303030;color:#aaa;font-size:11px;font-weight:700;letter-spacing:.3px}
|
||||
</style>
|
||||
<script>
|
||||
document.querySelectorAll('details.series tbody').forEach(tbody=>{let currentSeason=null;[...tbody.querySelectorAll('tr')].forEach(row=>{if(row.classList.contains('season-divider'))return;const match=row.querySelector('.title')?.textContent.match(/^S(\d{2})E\d{2}/i);if(!match||match[1]===currentSeason)return;currentSeason=match[1];const divider=document.createElement('tr');divider.className='season-divider';divider.innerHTML=`<td colspan="7">Staffel ${Number(currentSeason)}</td>`;tbody.insertBefore(divider,row)})});
|
||||
</script>
|
||||
<style>
|
||||
.downloading-badge{background:#713c9e!important;border-color:#9257c2!important;color:#f2e5ff!important}.state.downloading{background:#713c9e;color:#f2e5ff}
|
||||
.downloading-state{background:#713c9e!important;color:#f2e5ff!important}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user