Пример #1
0
 public dotControl(string dotControlURL)
 {
     if (!string.IsNullOrEmpty(dotControlURL))
     {
         //
         IButlerStorageManager resource = BlobManagerFactory.CreateBlobManager(dotControlURL);
         jsonControl = resource.ReadTextBlob(dotControlURL);
     }
 }
        public string[] GetLoadEncodignProfiles(IjsonKeyValue dotControlData, IjsonKeyValue processData, string jsonKey, List <string> MezzanineFiles, string ProcessConfigConn, string StepConfiguration)
        {
            var myBlobManager = BlobManagerFactory.CreateBlobManager(ProcessConfigConn);

            string[] EncodingProfiles;
            int      profileId = 0;

            if (!string.IsNullOrEmpty(dotControlData.Read(jsonKey)))
            {
                //Definition encoders on instance level DotcControl File
                var Xlist = dotControlData.ReadArray(jsonKey).ToArray();
                EncodingProfiles = new string[Xlist.Count()];

                foreach (var profile in Xlist)
                {
                    string url = MezzanineFiles.Where(f => f.ToLower().EndsWith(profile.ToString().ToLower())).FirstOrDefault();
                    if (url == null)
                    {
                        throw new Exception("Encoding profile is not on file package!");
                    }
                    string jsonTxt = myBlobManager.ReadTextBlob(new Uri(url));
                    if (jsonTxt[0] != '{')
                    {
                        jsonTxt = jsonTxt.Substring(1, jsonTxt.Length - 1);
                    }
                    EncodingProfiles[profileId] = myBlobManager.ReadTextBlob(new Uri(url));
                    profileId += 1;
                }
            }
            else
            {
                if (!string.IsNullOrEmpty(processData.Read(jsonKey)))
                {
                    //Definition Encoders profile on process level
                    var profileNameList = processData.ReadArray(jsonKey).ToArray();
                    EncodingProfiles = new string[profileNameList.Count()];
                    foreach (var profileName in profileNameList)
                    {
                        EncodingProfiles[profileId] = myBlobManager.ReadTextBlob("mediabutlerbin", "encoderdefinitions/" + profileName);
                        profileId += 1;
                    }
                }
                else
                {
                    //Definition on Process definition
                    string encodigProfileFileName;
                    if (string.IsNullOrEmpty(StepConfiguration))
                    {
                        //Use default
                        encodigProfileFileName = "H264 Multiple Bitrate 1080p.json";
                    }
                    else
                    {
                        //Use process level definition
                        encodigProfileFileName = StepConfiguration;
                    }

                    EncodingProfiles = new string[] { LoadEncodeProfile(encodigProfileFileName, ProcessConfigConn) };
                }
            }
            return(EncodingProfiles);
        }