private CSA MakeNewCSA(IUniUI UI, string cu) { { UI.Log($"Use the following tool to assemble this into https://example.com/path/to/page/file1.ts format"); CSA csa = new CSA(UI); CSAFeed cf = new CSAFeed("*chunk*", this); csa.Feeds = new List <CSAFeed>() { cf }; csa.IsBuilt = true; //TODO: RegisterReusableWorker // UI?.Lab?.RegisterReusableWorker(csa, $"CSA for M3U downloader {csa.mask}"); GetMask: csa.mask = UI.Prompt($"Enter URL Mask string. (substitute : *chunk* to replace the chunk URL) (Ex: https://example.com/chunks/*chunk* will turn into https://example.com/chunks/{cu})"); if (UI.Prompt($"URLs will be like {csa.mask.Replace("*chunk*", cu)} Please make sure this URL works. [Enter] to continue or [c] to change mask").Trim() != string.Empty) { goto GetMask; } return(csa); } }
public (bool, IPipe) GetCSA(IUniUI UI) { if (Chunks == null || Chunks.Length == 0) { return(false, null); } string cu = Chunks[0].Url; string cul = cu.ToLower(); if (cul.StartsWith("http")) { if (UI.Prompt($"The first chunk URL {cu} looks good. Press [Enter] to use that URL as it is OR input 'csa' to create a CSA using this URL").Trim() != string.Empty) { return(true, MakeNewCSA(UI, cu)); } else { CSA csa = new CSA(UI); csa.mask = "*chunk*"; CSAFeed cf = new CSAFeed("*chunk*", this); csa.Feeds = new List <CSAFeed>() { cf }; csa.IsBuilt = true; //TODO: RegisterReusableWorker // UI?.Lab?.RegisterReusableWorker(csa, $"CSA for M3U downloader {csa.mask}"); return(true, csa); } } else { UI.Log($"The first chunk URL {cu} is not in the correct format. "); return(true, MakeNewCSA(UI, cu)); } }