pstream is dead; long live pstream taciturnaxolotl.github.io/pstream-ng/
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

improve most voted algorithm, remove temporary state

Co-authored-by: Jip Frijlink <JipFr@users.noreply.github.com>

mrjvs e41d1fdb 8e65db04

+31 -26
+9 -3
src/backend/helpers/subs.ts
··· 82 82 }); 83 83 84 84 return Object.values(sortedByLanguage).map((langs) => { 85 - const sortedByRating = langs 86 - .filter((v): v is SubtitleSearchItem => !!v.attributes.legacy_subtitle_id) // must have legacy id 87 - .sort((a, b) => b.attributes.ratings - a.attributes.ratings); 85 + const onlyLegacySubs = langs.filter( 86 + (v): v is SubtitleSearchItem => !!v.attributes.legacy_subtitle_id 87 + ); 88 + const sortedByRating = onlyLegacySubs.sort( 89 + (a, b) => 90 + b.attributes.ratings * (b.attributes.votes ?? 0) - 91 + a.attributes.ratings * (a.attributes.votes ?? 0) 92 + ); 88 93 return sortedByRating[0]; 89 94 }); 90 95 } ··· 95 100 96 101 export async function downloadSrt(legacySubId: string): Promise<string> { 97 102 // TODO there is cloudflare protection so this may not always work. what to do about that? 103 + // TODO also there is ratelimit on the page itself 98 104 // language code is hardcoded here, it does nothing 99 105 const zipFile = await proxiedFetch<ArrayBuffer>( 100 106 `https://dl.opensubtitles.org/en/subtitleserve/sub/${legacySubId}`,
+19 -20
src/components/player/atoms/settings/CaptionsView.tsx
··· 106 106 [download, setCurrentlyDownloading] 107 107 ); 108 108 109 - let downloadProgress: ReactNode = null; 110 - if (downloadReq.loading) downloadProgress = <p>downloading...</p>; 111 - else if (downloadReq.error) downloadProgress = <p>failed to download...</p>; 112 - 113 109 let content: ReactNode = null; 114 110 if (req.loading) content = <p>loading...</p>; 115 111 else if (req.error) content = <p>errored!</p>; ··· 153 149 154 150 return ( 155 151 <> 156 - <Menu.BackLink 157 - onClick={() => router.navigate("/")} 158 - rightSide={ 159 - <button 160 - type="button" 161 - onClick={() => router.navigate("/captions/settings")} 162 - > 163 - Customize 164 - </button> 165 - } 166 - > 167 - Captions 168 - </Menu.BackLink> 169 - <Menu.Section className="pb-6"> 170 - <Input value={searchQuery} onInput={setSearchQuery} /> 171 - {downloadProgress} 152 + <div> 153 + <Menu.BackLink 154 + onClick={() => router.navigate("/")} 155 + rightSide={ 156 + <button 157 + type="button" 158 + onClick={() => router.navigate("/captions/settings")} 159 + > 160 + Customize 161 + </button> 162 + } 163 + > 164 + Captions 165 + </Menu.BackLink> 166 + <div className="mt-3"> 167 + <Input value={searchQuery} onInput={setSearchQuery} /> 168 + </div> 169 + </div> 170 + <Menu.Section className="!pt-1 mt-2 pb-3"> 172 171 <CaptionOption onClick={() => disable()} selected={!lang}> 173 172 Off 174 173 </CaptionOption>
+1 -1
src/components/player/internals/ContextMenu/Input.tsx
··· 5 5 onInput: (str: string) => void; 6 6 }) { 7 7 return ( 8 - <div className="w-full relative mb-6"> 8 + <div className="w-full relative"> 9 9 <Icon 10 10 className="pointer-events-none absolute top-1/2 left-3 transform -translate-y-1/2 text-video-context-inputPlaceholder" 11 11 icon={Icons.SEARCH}
+2 -2
src/components/player/internals/ContextMenu/Links.tsx
··· 68 68 const content = ( 69 69 <div className={classNames("flex items-center flex-1", props.className)}> 70 70 <div className="flex-1 text-left">{props.children}</div> 71 - <div>{props.rightSide}</div> 71 + <div className="flex">{props.rightSide}</div> 72 72 </div> 73 73 ); 74 74 ··· 134 134 <Icon className="ml-2" icon={Icons.WARNING} /> 135 135 </span> 136 136 ); 137 - if (props.loading) rightContent = <Spinner className="text-xl" />; // should override selected and error 137 + if (props.loading) rightContent = <Spinner className="text-lg" />; // should override selected and error 138 138 139 139 return ( 140 140 <Link