Exemplo n.º 1
0
    private bool GetToolInfo()
    {
        Log.Logger.Information("Reading media info from tools : {FileName}", MediaFileInfo.Name);

        // Read the tool data text
        if (!Tools.MediaInfo.GetMediaInfoXml(MediaFileInfo.FullName, out MediaInfoXml) ||
            !Tools.MkvMerge.GetMkvInfoJson(MediaFileInfo.FullName, out MkvMergeInfoJson) ||
            !Tools.FfProbe.GetFfProbeInfoJson(MediaFileInfo.FullName, out FfProbeInfoJson))
        {
            Log.Logger.Error("Failed to read media info : {FileName}", MediaFileInfo.Name);
            return(false);
        }

        // Deserialize the tool data
        if (!MediaInfoTool.GetMediaInfoFromXml(MediaInfoXml, out MediaInfo mediaInfoInfo) ||
            !MkvMergeTool.GetMkvInfoFromJson(MkvMergeInfoJson, out MediaInfo mkvMergeInfo) ||
            !FfProbeTool.GetFfProbeInfoFromJson(FfProbeInfoJson, out MediaInfo ffProbeInfo))
        {
            Log.Logger.Error("Failed to de-serialize tool data : {FileName}", MediaFileInfo.Name);
            return(false);
        }

        // Assign the mediainfo data
        MediaInfoInfo = mediaInfoInfo;
        MkvMergeInfo  = mkvMergeInfo;
        FfProbeInfo   = ffProbeInfo;

        // Print info
        MediaInfoInfo.WriteLine("MediaInfo");
        MkvMergeInfo.WriteLine("MkvMerge");
        FfProbeInfo.WriteLine("FfProbe");

        return(true);
    }
Exemplo n.º 2
0
    private bool GetInfoFromJson()
    {
        Log.Logger.Information("Reading media info from sidecar : {FileName}", SidecarFileInfo.Name);

        // Decompress the tool data
        FfProbeInfoJson  = StringCompression.Decompress(SidecarJson.FfProbeInfoData);
        MkvMergeInfoJson = StringCompression.Decompress(SidecarJson.MkvMergeInfoData);
        MediaInfoXml     = StringCompression.Decompress(SidecarJson.MediaInfoData);

        // Deserialize the tool data
        if (!MediaInfoTool.GetMediaInfoFromXml(MediaInfoXml, out MediaInfo mediaInfoInfo) ||
            !MkvMergeTool.GetMkvInfoFromJson(MkvMergeInfoJson, out MediaInfo mkvMergeInfo) ||
            !FfProbeTool.GetFfProbeInfoFromJson(FfProbeInfoJson, out MediaInfo ffProbeInfo))
        {
            Log.Logger.Error("Failed to de-serialize tool data : {FileName}", SidecarFileInfo.Name);
            return(false);
        }

        // Assign mediainfo data
        FfProbeInfo   = ffProbeInfo;
        MkvMergeInfo  = mkvMergeInfo;
        MediaInfoInfo = mediaInfoInfo;

        // Assign state
        State = SidecarJson.State;

        return(true);
    }