MCPcopy
hub / github.com/iptv-org/iptv / generate

Method generate

scripts/generators/sourcesGenerator.ts:23–48  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

21 }
22
23 async generate() {
24 const files: Dictionary<Stream[]> = this.streams.groupBy((stream: Stream) =>
25 stream.getFilename()
26 )
27
28 for (const filename of files.keys()) {
29 if (!filename) continue
30
31 const streams = new Collection<Stream>(files.get(filename)).map((stream: Stream) => {
32 const groupTitle = stream
33 .getCategories()
34 .map(category => category.name)
35 .sort()
36 .join(';')
37 if (groupTitle) stream.groupTitle = groupTitle
38
39 return stream
40 })
41 const playlist = new Playlist(streams, { public: true })
42 const filepath = `sources/${filename}`
43 await this.storage.save(filepath, playlist.toString())
44 this.logFile.append(
45 JSON.stringify({ type: 'source', filepath, count: playlist.streams.count() }) + EOL
46 )
47 }
48 }
49}

Callers

nothing calls this directly

Calls 3

toStringMethod · 0.95
getFilenameMethod · 0.80
appendMethod · 0.80

Tested by

no test coverage detected