Added a already exists url option in Creds.priv.cs
This commit is contained in:
		
							parent
							
								
									3e04d02707
								
							
						
					
					
						commit
						7611dee5d2
					
				
							
								
								
									
										4
									
								
								Creds.cs
								
								
								
								
							
							
						
						
									
										4
									
								
								Creds.cs
								
								
								
								
							|  | @ -6,4 +6,8 @@ public static partial class Creds | |||
|     public static string Password => _password; | ||||
| 
 | ||||
|     public static string DirectoryOnServer => _dir; | ||||
| 
 | ||||
|     public static int Port => _port; | ||||
| 
 | ||||
|     public static string AlreadyExistsUrl=> _alreadyExists; | ||||
| }    | ||||
							
								
								
									
										19
									
								
								Program.cs
								
								
								
								
							
							
						
						
									
										19
									
								
								Program.cs
								
								
								
								
							|  | @ -8,13 +8,28 @@ using System.Diagnostics.CodeAnalysis; | |||
| using YoutubeExplode.Playlists; | ||||
| using YoutubeExplode.Channels; | ||||
| 
 | ||||
| YoutubeClient ytc=new YoutubeClient(); | ||||
| HttpClient http=new HttpClient(); | ||||
| YoutubeClient ytc=new YoutubeClient(http); | ||||
| ConcurrentStack<VideoId> videoIds=new ConcurrentStack<VideoId>(); | ||||
| bool isRunning=true; | ||||
| 
 | ||||
| async Task AddVideo(VideoId id) | ||||
| { | ||||
|     using(SshClient client = new SshClient(IP,Username,Password)){ | ||||
|     if(!string.IsNullOrWhiteSpace(AlreadyExistsUrl)) | ||||
|     { | ||||
|         try{ | ||||
|         if(await http.GetStringAsync($"{AlreadyExistsUrl}{id.Value}") == "true") | ||||
|         { | ||||
|             Console.WriteLine($"{AlreadyExistsUrl}{id.Value} returned true skipping: https://www.youtube.com/watch?v={id.Value}"); | ||||
|             return; | ||||
|         } | ||||
|         }catch(Exception) | ||||
|         { | ||||
| 
 | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     using(SshClient client = new SshClient(IP,Port,Username,Password)){ | ||||
|     await client.ConnectAsync(default); | ||||
|     using(var res=client.CreateCommand($"echo {DirectoryOnServer}/*-{id.Value}.mp4")) | ||||
|     { | ||||
|  |  | |||
|  | @ -14,6 +14,9 @@ To Configure you must add a file called Creds.priv.cs with the following content | |||
|         static string _username = "YOUR_SSH_USERNAME"; | ||||
|         static string _password = "YOUR_SSH_PASSWORD"; | ||||
|         static string _dir = "YOUR_SSH_PATH"; | ||||
|         static int _port = 22; | ||||
|          | ||||
|         static string _alreadyExists=""; //must be http(s) url such as https://tytdarchive.site.tesses.net/have.php?v= that the response must return "true" if it already exists or "false" if not | ||||
|     } | ||||
| ``` | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue