@@ -16,10 +16,7 @@ import {
1616import { get } from "svelte/store" ;
1717import encodePodnotesURI from "src/utility/encodePodnotesURI" ;
1818import { isLocalFile } from "src/utility/isLocalFile" ;
19- import {
20- formatPodcastSegment ,
21- normalizePodcastSegmentTimes ,
22- } from "src/utility/podcastSegment" ;
19+ import { formatPodcastSegment , normalizePodcastSegmentTimes } from "src/utility/podcastSegment" ;
2320import {
2421 adjustPlaybackRate ,
2522 normalizePlaybackRate ,
@@ -39,12 +36,8 @@ const normalizeSkipLength = (length: number): number =>
3936// two-way binds the store onto the media element. Fall back to the current value
4037// (itself clamped) so a bad write is a no-op rather than corrupting playback.
4138const clampVolume = ( value : number , fallback = 1 ) : number => {
42- const safeFallback = Number . isFinite ( fallback )
43- ? Math . min ( 1 , Math . max ( 0 , fallback ) )
44- : 1 ;
45- return Number . isFinite ( value )
46- ? Math . min ( 1 , Math . max ( 0 , value ) )
47- : safeFallback ;
39+ const safeFallback = Number . isFinite ( fallback ) ? Math . min ( 1 , Math . max ( 0 , fallback ) ) : 1 ;
40+ return Number . isFinite ( value ) ? Math . min ( 1 , Math . max ( 0 , value ) ) : safeFallback ;
4841} ;
4942
5043export class API implements IAPI {
@@ -96,11 +89,7 @@ export class API implements IAPI {
9689 * @param offsetSeconds Optional offset to subtract from the current playback time.
9790 * @returns
9891 */
99- getPodcastTimeFormatted (
100- format : string ,
101- linkify = false ,
102- offsetSeconds = 0 ,
103- ) : string {
92+ getPodcastTimeFormatted ( format : string , linkify = false , offsetSeconds = 0 ) : string {
10493 if ( ! this . podcast ) {
10594 throw new Error ( "No podcast loaded" ) ;
10695 }
@@ -118,11 +107,7 @@ export class API implements IAPI {
118107 return time ;
119108 }
120109
121- const url = encodePodnotesURI (
122- this . podcast . title ,
123- feedUrl ,
124- adjustedTime ,
125- ) ;
110+ const url = encodePodnotesURI ( this . podcast . title , feedUrl , adjustedTime ) ;
126111
127112 return `[${ time } ](${ url . href } )` ;
128113 }
@@ -139,11 +124,7 @@ export class API implements IAPI {
139124
140125 const segmentTimes = normalizePodcastSegmentTimes ( startTime , endTime ) ;
141126 const segment = segmentTimes
142- ? formatPodcastSegment (
143- segmentTimes . startTime ,
144- segmentTimes . endTime ,
145- format ,
146- )
127+ ? formatPodcastSegment ( segmentTimes . startTime , segmentTimes . endTime , format )
147128 : formatPodcastSegment ( startTime , endTime , format ) ;
148129
149130 if ( ! linkify || ! segmentTimes ) return segment ;
@@ -174,8 +155,7 @@ export class API implements IAPI {
174155 episode ,
175156 pluginInstance . settings . transcript . path ,
176157 ) ;
177- const transcriptFile =
178- pluginInstance . app . vault . getAbstractFileByPath ( transcriptPath ) ;
158+ const transcriptFile = pluginInstance . app . vault . getAbstractFileByPath ( transcriptPath ) ;
179159
180160 if ( ! ( transcriptFile instanceof TFile ) ) {
181161 return null ;
@@ -204,18 +184,14 @@ export class API implements IAPI {
204184 }
205185
206186 skipBackward ( ) : void {
207- const skipBackLen = normalizeSkipLength (
208- get ( plugin ) . settings . skipBackwardLength ,
209- ) ;
187+ const skipBackLen = normalizeSkipLength ( get ( plugin ) . settings . skipBackwardLength ) ;
210188 // Never seek before the start. A cleared settings field (NaN/null) falls
211189 // back to the default rather than corrupting currentTime (PB-02).
212190 this . currentTime = Math . max ( 0 , this . currentTime - skipBackLen ) ;
213191 }
214192
215193 skipForward ( ) : void {
216- const skipForwardLen = normalizeSkipLength (
217- get ( plugin ) . settings . skipForwardLength ,
218- ) ;
194+ const skipForwardLen = normalizeSkipLength ( get ( plugin ) . settings . skipForwardLength ) ;
219195 const target = this . currentTime + skipForwardLen ;
220196 const dur = this . length ;
221197 // Clamp just short of the end so an over-skip lands at the end instead of
@@ -224,21 +200,15 @@ export class API implements IAPI {
224200 // not rewind, so keep at least the current time (PB-02 / Codex review #213).
225201 // With an unknown/zero duration (metadata not loaded) leave it unclamped.
226202 this . currentTime =
227- dur > 0
228- ? Math . max ( this . currentTime , Math . min ( target , dur - 0.25 ) )
229- : target ;
203+ dur > 0 ? Math . max ( this . currentTime , Math . min ( target , dur - 0.25 ) ) : target ;
230204 }
231205
232206 increasePlaybackRate ( ) : void {
233- playbackRateStore . update ( ( rate ) =>
234- adjustPlaybackRate ( rate , PLAYBACK_RATE_STEP ) ,
235- ) ;
207+ playbackRateStore . update ( ( rate ) => adjustPlaybackRate ( rate , PLAYBACK_RATE_STEP ) ) ;
236208 }
237209
238210 decreasePlaybackRate ( ) : void {
239- playbackRateStore . update ( ( rate ) =>
240- adjustPlaybackRate ( rate , - PLAYBACK_RATE_STEP ) ,
241- ) ;
211+ playbackRateStore . update ( ( rate ) => adjustPlaybackRate ( rate , - PLAYBACK_RATE_STEP ) ) ;
242212 }
243213
244214 resetPlaybackRate ( ) : void {
0 commit comments