setQ(e.currentTarget.value)} type="search" placeholder="Artists, records, songs" autocomplete="off" autocapitalize="off" spellcheck="false" enterkeyhint="search" aria-label="Search" onkeydown={enter} />
{#if q}
{ setQ(""); inputEl?.focus(); }} aria-label="Clear">
{/if}
{#if !asking}
The catalog, your library{online ? " and the network" : ""}.
Artists, records and songs from the catalog; a song plays from the best copy the network has, a record opens its page.
{#if !online}Sign in on Community to play what the library does not hold.{/if}
{#if lib.recents.length}
Jump back in · picks up where you left off
{#each lib.recents.slice(0, 8) as r (r.album_id)}
push("album", { id: r.album_id }, screenEl)} />
{/each}
{/if}
{#if recents.length}
Recent { recents = []; keepRecents(); }}>Clear
{#each recents as r (r)} setQ(r)} oncontextmenu={(e) => { e.preventDefault(); forget(r); }}>{r} {/each}
{/if}
{:else}
{#if catErr}{say(catErr)}
{/if}
{#if catBusy && !cat}Asking the catalog…
{/if}
{#if catEmpty && !catBusy}Nothing on the catalog for “{query}”.{#if didYouMean} Did you mean setQ(didYouMean)}>{didYouMean} ?{/if}
{/if}
{#if top}
{#if topArt} {:else} {/if}
Top result · {top.kind === "artist" ? "Artist" : top.kind === "album" ? "Record" : "Song"}
{top.kind === "artist" ? top.data.name : top.data.title}
{#if top.kind === "artist"}
{[fans(top.data.fans), topReleases.length ? topReleases.length + " release" + (topReleases.length === 1 ? "" : "s") : "", profile?.listeners ? fans(profile.listeners).replace("fans", "listeners") : ""].filter(Boolean).join(" · ")}
{#if heroTags.length}
{#each heroTags as t (t)}{t} {/each}
{/if}
{:else if top.kind === "album"}
openArtist(top.data.artist, byline)}>{#if picture(byline?.picture)} {/if}{top.data.artist}
{[yearOf(top.data.release_date), top.data.track_count ? `${top.data.track_count} tracks` : ""].filter(Boolean).map((x) => " · " + x).join("")}
{:else}
openArtist(top.data.artist, byline)}>{#if picture(byline?.picture)} {/if}{top.data.artist}
{top.data.album ? " · " + top.data.album : ""}{top.data.duration_secs ? " · " + mmss(top.data.duration_secs) : ""}
{/if}
{top.kind === "song" && current(top.data) && resolver.active ? "Finding…" : "Play"}
{top.kind === "artist" ? "Open artist" : top.kind === "album" ? "Open record" : "Go to record"}
{#if latestRelease}
openAlbum(latestRelease)}>
{#if latestRelease.cover} {:else} {/if}
{latestRelease.title} Latest release{yearOf(latestRelease.release_date) ? " · " + yearOf(latestRelease.release_date) : ""}{latestRelease.record_type && latestRelease.record_type !== "album" ? " · " + latestRelease.record_type.toUpperCase() : ""}
{/if}
{/if}
{#if catArtists.length}
Artists
{#each catArtists as ar (ar.id)}
openArtist(ar.name, ar)}>
{#if picture(ar.picture)} {:else} {/if}
{ar.name}
{fans(ar.fans) || "Artist"}
{/each}
{/if}
{#if catAlbums.length}
Records
{#each catAlbums as a (a.id)}
openAlbum(a)} onmore={() => openHalf("catalogAlbum", { album: a })} />
{/each}
{/if}
{#if catTracks.length}
Songs
{#each catTracks as t (t.id)}
playSong(t)} oncontextmenu={(e) => { e.preventDefault(); songSheet(t); }}>
{#if t.cover} {:else} {/if}
{t.title} {t.artist}{t.album ? " · " + t.album : ""}
{current(t) && resolver.active ? "finding…" : mmss(t.duration_secs)}
{/each}
{/if}
{#if libAny}
In your library{#if searching} · searching… {/if}
{#each artistHits as ar (ar.name)}
openArtist(ar.name)}>
{ar.name} {ar.albums} record{ar.albums === 1 ? "" : "s"} · {ar.tracks} tracks
{/each}
{#if albumHits.length}
{#each albumHits as a (a.id)}
push("album", { id: a.id }, screenEl)} onmore={() => openHalf("album", { album: a })} />
{/each}
{/if}
{#each tracks as row (row.path)}
playHit(row)} oncontextmenu={(e) => { e.preventDefault(); moreHit(row); }}>
{row.title} {row.artist} · {row.album}
{mmss(row.duration_secs)}
{}} onclick={(e) => { e.stopPropagation(); moreHit(row); }}>
{/each}
{/if}
{#if online}
{#if !netHere}
Search the network for “{query}”
{:else}
The network · {net.searching ? "searching…" : net.responses ? net.responses + " people · " + net.files + " files" : "nothing yet"}
{#if !net.searching}Again {/if}
{#if net.error}{say(net.error)}
{/if}
{#if net.groups.length}
(netFree = !netFree)}>Free slot
{#each [["any", "Any format"], ["flac", "FLAC"], ["mp3320", "MP3 320+"]] as [v, l] (v)}
(netFmt = v)}>{l}
{/each}
{#if shownGroups.length !== net.groups.length}{shownGroups.length} of {net.groups.length} folders
{/if}
{/if}
{#if net.searching && !net.groups.length}
Asking the network as {slsk.username}…
{/if}
{#each shownGroups.slice(0, 40) as g (g.key)}
{ e.preventDefault(); openHalf("peer", { username: g.username, group: g }); }} role="presentation">
{g.username} {g.slot ? "slot free" : "queue " + g.queue} · {speedLabel(g.speed)}
playPeer(g, 0)}>
{g.folderName}
{groupFormat(g)} · {g.files.length} file{g.files.length === 1 ? "" : "s"} · {fmtBytes(g.size)}
Play
{#each g.files.slice(0, expanded.has(g.key) ? 200 : 3) as f, i (f.path)}
playPeer(g, i)} oncontextmenu={(e) => { e.preventDefault(); openHalf("peerfile", { group: g, index: i }); }}>
{i + 1}
{titleFromName(f.name)}
{f.bitrate ? f.bitrate + " kbps" : (f.extension || "").toUpperCase()}{f.duration ? " · " + mmss(f.duration) : ""}
{/each}
{#if g.files.length > 3 && !expanded.has(g.key)}
expand(g.key)}>+ {g.files.length - 3} more
{/if}
{/each}
{/if}
{:else}
Not signed in, so nothing here can play from the network yet — sign in on Community.
go("community")}>Go to Community
{/if}
{/if}