//Download button //--- Select onClick URL bar STOP ---/// //--- Controls START ---/// private void click_dl(object sender, RoutedEventArgs e) { if (!File.Exists("ffmpeg/ffmpeg.exe"))//If ffmpeg has not been downloaded { c_println("Downloading 7zip...");//Download and extract 7zip cli. Needed to extract ffmpeg KakaduaUtil.download_file("http://www.7-zip.org/a/7za920.zip", "7za920.zip"); KakaduaUtil.unzip("7za920.zip", "7zip"); c_println("Extracting 7zip..."); File.Move("7za920.zip", "7zip/7za920.zip"); String ffmpeg = KakaduaUtil.file_get_contents_utf8("http://ffmpeg.zeranoe.com/builds/"); //Get link to latest stable ffmpeg build ffmpeg = "http://ffmpeg.zeranoe.com/builds" + KakaduaUtil.get_between(ffmpeg, "<a class=\"latest\" href=\".", "\""); c_println("Downloading ffmpeg...");//Download and extract ffmpeg KakaduaUtil.download_file(ffmpeg, "ffmpeg.7z"); c_println("Extracting ffmpeg..."); KakaduaUtil.run_and_wait("7zip/7za.exe", "e ffmpeg.7z -offmpeg ffmpeg.exe -r"); File.Move("ffmpeg.7z", "ffmpeg/ffmpeg.7z"); }//if END String url = tb_url.Text; if (url.Contains("oppetarkiv.se"))//Öppet Arkiv { ServiceOppetArkiv oppetArkiv = new ServiceOppetArkiv(this); oppetArkiv.generate("dl", url); }//Öppet Arkiv END else if (url.Contains("youtube"))//Youtube { String no_key = "You need to set a YouTube API key in the settings"; if (File.Exists("API_KEY")) { if(System.IO.File.ReadAllText("API_KEY") != null && System.IO.File.ReadAllText("API_KEY") != "") { ServiceYouTube youTube = new ServiceYouTube(this); youTube.generate("strm", url); } else { c_println(no_key); } } else { c_println(no_key); } }//YouTube END else if (url.Contains("tv4play.se"))//TV4 Play { ServiceTV4 tv4 = new ServiceTV4(this); tv4.generate("dl", url); }//TV4 Play END else { c_println("Usupported URL / Service"); } }
//Generate strm button private void click_strm(object sender, RoutedEventArgs e) { String url = tb_url.Text; if (url.Contains("oppetarkiv.se"))//Öppet Arkiv { ServiceOppetArkiv oppetArkiv = new ServiceOppetArkiv(this); oppetArkiv.generate("strm", url); }//Öppet Arkiv END else if(url.Contains("youtube"))//Youtube { String no_key = "You need to set a YouTube API key in the settings"; if (File.Exists("API_KEY")) { if (System.IO.File.ReadAllText("API_KEY") != null && System.IO.File.ReadAllText("API_KEY") != "") { ServiceYouTube youTube = new ServiceYouTube(this); youTube.generate("strm", url); } else { c_println(no_key); } } else { c_println(no_key); } }//YouTube END else if (url.Contains("tv4play.se"))//TV4 Play { ServiceTV4 tv4 = new ServiceTV4(this); tv4.generate("strm", url); }//TV4 Play END else { c_println("Usupported URL / Service"); } }