11import { AuthType , ContentFile , ContentItem , ContentProviderAuthData , ContentProviderConfig , Instructions , ProviderCapabilities , ProviderLogos } from "../../interfaces" ;
22import { parsePath } from "../../pathUtils" ;
3- import { createFolder , createFile , detectMediaType , filesToInstructions } from "../../utils" ;
3+ import { createFolder , createFile , detectMediaType , filesToInstructions , slugify } from "../../utils" ;
44import { OAuthHelper } from "../../helpers" ;
55import { getProviderSecret } from "../../helpers/ProviderSecrets" ;
66import { BaseProvider } from "../BaseProvider" ;
@@ -9,8 +9,8 @@ import { GoCurriculumData, GoCurriculumCollection } from "./GoCurriculumInterfac
99
1010/**
1111 * Path: / → collections, /{collection} → lessons (leaf), /{collection}/{lesson} → files.
12- * Content is curated in data.json (media hosted on Dropbox); a valid gocurriculum.com
13- * login (WP OAuth Server plugin) gates all of it.
12+ * data.json is Go's catalog export dropped in verbatim (media hosted on Dropbox);
13+ * a valid gocurriculum.com login (WP OAuth Server plugin) gates all of it.
1414 */
1515export class GoCurriculumProvider extends BaseProvider {
1616 private readonly oauthHelper = new OAuthHelper ( ) ;
@@ -61,12 +61,12 @@ export class GoCurriculumProvider extends BaseProvider {
6161 if ( ! ( await this . verifyAuth ( auth ) ) ) return [ ] ;
6262 const { segments, depth } = parsePath ( path ) ;
6363
64- if ( depth === 0 ) return this . data . collections . map ( c => createFolder ( c . id , c . name , `/${ c . id } ` , c . image ) ) ;
64+ if ( depth === 0 ) return this . data . catalog . map ( c => createFolder ( c . id , c . name , `/${ c . id } ` , c . thumbnail ) ) ;
6565
66- const collection = this . data . collections . find ( c => c . id === segments [ 0 ] ) ;
66+ const collection = this . data . catalog . find ( c => c . id === segments [ 0 ] ) ;
6767 if ( ! collection ) return [ ] ;
6868
69- if ( depth === 1 ) return collection . lessons . map ( l => createFolder ( l . id , l . name , `/${ collection . id } /${ l . id } ` , l . image || collection . image , true ) ) ;
69+ if ( depth === 1 ) return collection . lessons . map ( l => createFolder ( l . id , l . name , `/${ collection . id } /${ l . id } ` , l . thumbnail || collection . thumbnail , true ) ) ;
7070 if ( depth === 2 ) return this . getLessonFiles ( collection , segments [ 1 ] ) ;
7171
7272 return [ ] ;
@@ -75,16 +75,16 @@ export class GoCurriculumProvider extends BaseProvider {
7575 private getLessonFiles ( collection : GoCurriculumCollection , lessonId : string ) : ContentFile [ ] {
7676 const lesson = collection . lessons . find ( l => l . id === lessonId ) ;
7777 if ( ! lesson ) return [ ] ;
78- // Dropbox temp links can be extension-less; the name usually carries the original filename
79- return lesson . files . map ( f => createFile ( f . id , f . name , f . url , { mediaType : detectMediaType ( `${ f . url } ${ f . name } ` , f . fileType ) , thumbnail : f . thumbnail || lesson . image || collection . image , seconds : f . seconds , loop : f . loop , loopVideo : f . loopVideo } ) ) ;
78+ // ponytail: playlist only — resources are PDFs/docx leader material with nothing to present; wire them into instructions if a consumer grows a downloads section
79+ return lesson . playlist . map ( f => createFile ( slugify ( f . file ) , f . title , f . url , { mediaType : detectMediaType ( `${ f . url } ${ f . file } ` , f . mediaType ) , thumbnail : f . thumbnail || lesson . thumbnail || collection . thumbnail , seconds : f . duration } ) ) ;
8080 }
8181
8282 async getPlaylist ( path : string , auth ?: ContentProviderAuthData | null , _resolution ?: number ) : Promise < ContentFile [ ] | null > {
8383 if ( ! ( await this . verifyAuth ( auth ) ) ) return null ;
8484 const { segments, depth } = parsePath ( path ) ;
8585 if ( depth !== 2 ) return null ;
8686
87- const collection = this . data . collections . find ( c => c . id === segments [ 0 ] ) ;
87+ const collection = this . data . catalog . find ( c => c . id === segments [ 0 ] ) ;
8888 if ( ! collection ) return null ;
8989
9090 const files = this . getLessonFiles ( collection , segments [ 1 ] ) ;
@@ -98,7 +98,7 @@ export class GoCurriculumProvider extends BaseProvider {
9898 const files = await this . getPlaylist ( path , auth ) ;
9999 if ( ! files ) return null ;
100100
101- const collection = this . data . collections . find ( c => c . id === segments [ 0 ] ) ;
101+ const collection = this . data . catalog . find ( c => c . id === segments [ 0 ] ) ;
102102 const lesson = collection ?. lessons . find ( l => l . id === segments [ 1 ] ) ;
103103 return filesToInstructions ( lesson ?. name || "Lesson" , files ) ;
104104 }
0 commit comments