mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-16 14:16:16 -08:00
refactor: code improvements and docs
This commit is contained in:
1 parent
bec61e9c44
commit
d4d51a0c2c
3 files changed
+31
-34
No files matched your search
@@ -1,23 +1,19 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
import * as M3U8FileParser from 'm3u8-file-parser';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class M3uService {
|
||||
/**
|
||||
* m3u8 parser
|
||||
*/
|
||||
m3u8FileParser = new M3U8FileParser();
|
||||
|
||||
constructor(private http: HttpClient) {}
|
||||
|
||||
/**
|
||||
* Returns playlist object
|
||||
* Converts string based array to playlist object
|
||||
* @param m3uArray m3u playlist as array with strings
|
||||
*/
|
||||
/* getPlaylist(): Observable<any> {
|
||||
return this.http.get('../your.json');
|
||||
} */
|
||||
|
||||
convertArrayToPlaylist(m3uArray: any[]): any {
|
||||
this.m3u8FileParser.read(m3uArray.join('\n'));
|
||||
return this.m3u8FileParser.getResult();
|
||||
|
||||
Reference in new issue
Block a user