mirror of
				https://gitlab.com/Kwoth/nadekobot.git
				synced 2025-11-03 16:24:27 -05:00 
			
		
		
		
	Changing the searches.yml ytprovider setting should now properly affect music queueing provider, but will require bot restart, closes #401
This commit is contained in:
		@@ -1,5 +1,6 @@
 | 
				
			|||||||
using System.Globalization;
 | 
					using System.Globalization;
 | 
				
			||||||
using System.Text.RegularExpressions;
 | 
					using System.Text.RegularExpressions;
 | 
				
			||||||
 | 
					using NadekoBot.Modules.Searches;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace NadekoBot.Modules.Music;
 | 
					namespace NadekoBot.Modules.Music;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -27,11 +28,12 @@ public sealed class YtdlYoutubeResolver : IYoutubeResolver
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    private readonly IGoogleApiService _google;
 | 
					    private readonly IGoogleApiService _google;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public YtdlYoutubeResolver(ITrackCacher trackCacher, IGoogleApiService google)
 | 
					    public YtdlYoutubeResolver(ITrackCacher trackCacher, IGoogleApiService google, SearchesConfigService scs)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        _trackCacher = trackCacher;
 | 
					        _trackCacher = trackCacher;
 | 
				
			||||||
        _google = google;
 | 
					        _google = google;
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        _ytdlPlaylistOperation = new("-4 "
 | 
					        _ytdlPlaylistOperation = new("-4 "
 | 
				
			||||||
                                     + "--geo-bypass "
 | 
					                                     + "--geo-bypass "
 | 
				
			||||||
                                     + "--encoding UTF8 "
 | 
					                                     + "--encoding UTF8 "
 | 
				
			||||||
@@ -44,7 +46,7 @@ public sealed class YtdlYoutubeResolver : IYoutubeResolver
 | 
				
			|||||||
                                     + "--no-check-certificate "
 | 
					                                     + "--no-check-certificate "
 | 
				
			||||||
                                     + "-i "
 | 
					                                     + "-i "
 | 
				
			||||||
                                     + "--yes-playlist "
 | 
					                                     + "--yes-playlist "
 | 
				
			||||||
                                     + "-- \"{0}\"");
 | 
					                                     + "-- \"{0}\"", scs.Data.YtProvider != YoutubeSearcher.Ytdl);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        _ytdlIdOperation = new("-4 "
 | 
					        _ytdlIdOperation = new("-4 "
 | 
				
			||||||
                               + "--geo-bypass "
 | 
					                               + "--geo-bypass "
 | 
				
			||||||
@@ -56,7 +58,7 @@ public sealed class YtdlYoutubeResolver : IYoutubeResolver
 | 
				
			|||||||
                               + "--get-thumbnail "
 | 
					                               + "--get-thumbnail "
 | 
				
			||||||
                               + "--get-duration "
 | 
					                               + "--get-duration "
 | 
				
			||||||
                               + "--no-check-certificate "
 | 
					                               + "--no-check-certificate "
 | 
				
			||||||
                               + "-- \"{0}\"");
 | 
					                               + "-- \"{0}\"", scs.Data.YtProvider != YoutubeSearcher.Ytdl);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        _ytdlSearchOperation = new("-4 "
 | 
					        _ytdlSearchOperation = new("-4 "
 | 
				
			||||||
                                   + "--geo-bypass "
 | 
					                                   + "--geo-bypass "
 | 
				
			||||||
@@ -69,7 +71,7 @@ public sealed class YtdlYoutubeResolver : IYoutubeResolver
 | 
				
			|||||||
                                   + "--get-duration "
 | 
					                                   + "--get-duration "
 | 
				
			||||||
                                   + "--no-check-certificate "
 | 
					                                   + "--no-check-certificate "
 | 
				
			||||||
                                   + "--default-search "
 | 
					                                   + "--default-search "
 | 
				
			||||||
                                   + "\"ytsearch:\" -- \"{0}\"");
 | 
					                                   + "\"ytsearch:\" -- \"{0}\"", scs.Data.YtProvider != YoutubeSearcher.Ytdl);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private YtTrackData ResolveYtdlData(string ytdlOutputString)
 | 
					    private YtTrackData ResolveYtdlData(string ytdlOutputString)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user