mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-05-02 13:26:28 +01:00
wip
This commit is contained in:
44
utils/movpkg-to-vlc/parse/boot.ts
Normal file
44
utils/movpkg-to-vlc/parse/boot.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
import { XMLParser } from "fast-xml-parser";
|
||||
|
||||
export interface Boot {
|
||||
Version: string;
|
||||
HLSMoviePackageType: string;
|
||||
Streams: {
|
||||
Stream: Stream[];
|
||||
};
|
||||
MasterPlaylist: {
|
||||
NetworkURL: string;
|
||||
};
|
||||
DataItems: {
|
||||
Directory: string;
|
||||
DataItem: DataItem;
|
||||
};
|
||||
}
|
||||
|
||||
export interface Stream {
|
||||
ID: string;
|
||||
NetworkURL: string;
|
||||
Path: string;
|
||||
Complete: string; // "YES" or "NO"
|
||||
}
|
||||
|
||||
export interface DataItem {
|
||||
ID: string;
|
||||
Category: string;
|
||||
Name: string;
|
||||
DescriptorPath: string;
|
||||
DataPath: string;
|
||||
Role: string;
|
||||
}
|
||||
|
||||
export async function parseBootXML(xml: string): Promise<Boot> {
|
||||
const parser = new XMLParser({
|
||||
ignoreAttributes: false,
|
||||
attributeNamePrefix: "",
|
||||
parseAttributeValue: true,
|
||||
});
|
||||
const jsonObj = parser.parse(xml);
|
||||
const b = jsonObj.HLSMoviePackage as Boot;
|
||||
console.log(b.Streams);
|
||||
return jsonObj.HLSMoviePackage as Boot;
|
||||
}
|
||||
Reference in New Issue
Block a user