com.sedmelluq.lava.extensions.youtuberotator.planner.AbstractRoutePlanner Java Examples
The following examples show how to use
com.sedmelluq.lava.extensions.youtuberotator.planner.AbstractRoutePlanner.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MusicManager.java From Shadbot with GNU General Public License v3.0 | 6 votes |
private MusicManager() { this.audioPlayerManager = new DefaultAudioPlayerManager(); this.audioPlayerManager.getConfiguration().setFrameBufferFactory(NonAllocatingAudioFrameBuffer::new); this.audioPlayerManager.getConfiguration().setFilterHotSwapEnabled(true); AudioSourceManagers.registerRemoteSources(this.audioPlayerManager); this.guildMusics = new ConcurrentHashMap<>(); this.guildJoining = new ConcurrentHashMap<>(); //IPv6 rotation config final String ipv6Block = CredentialManager.getInstance().get(Credential.IPV6_BLOCK); if (!Config.IS_SNAPSHOT && ipv6Block != null && !ipv6Block.isBlank()) { LOGGER.info("Configuring YouTube IP rotator"); final List<IpBlock> blocks = Collections.singletonList(new Ipv6Block(ipv6Block)); final AbstractRoutePlanner planner = new RotatingNanoIpRoutePlanner(blocks); new YoutubeIpRotatorSetup(planner) .forSource(this.audioPlayerManager.source(YoutubeAudioSourceManager.class)) .setup(); } }
Example #2
Source File: YoutubeIpRotatorFilter.java From lavaplayer with Apache License 2.0 | 5 votes |
public YoutubeIpRotatorFilter( HttpContextFilter delegate, boolean isSearch, AbstractRoutePlanner routePlanner, int retryLimit ) { this.delegate = delegate; this.isSearch = isSearch; this.routePlanner = routePlanner; this.retryLimit = retryLimit; }
Example #3
Source File: YoutubeIpRotatorSetup.java From lavaplayer with Apache License 2.0 | 4 votes |
public YoutubeIpRotatorSetup(AbstractRoutePlanner routePlanner) { this.routePlanner = routePlanner; mainConfiguration = new ArrayList<>(); searchConfiguration = new ArrayList<>(); }
Example #4
Source File: MantaroAudioManager.java From MantaroBot with GNU General Public License v3.0 | 4 votes |
@SuppressWarnings("rawtypes") public MantaroAudioManager() { this.musicManagers = new ConcurrentHashMap<>(); this.playerManager = new DefaultAudioPlayerManager(); //Youtube is special because rotation stuff. YoutubeAudioSourceManager youtubeAudioSourceManager = new YoutubeAudioSourceManager(true); //IPv6 rotation config start Config config = MantaroData.config().get(); if (!config.getIpv6Block().isEmpty()) { AbstractRoutePlanner planner; String block = config.getIpv6Block(); List<IpBlock> blocks = Collections.singletonList(new Ipv6Block(block)); //Damn you, YouTube. if (config.getExcludeAddress().isEmpty()) planner = new RotatingNanoIpRoutePlanner(blocks); else { try { InetAddress blacklistedGW = InetAddress.getByName(config.getExcludeAddress()); planner = new RotatingNanoIpRoutePlanner(blocks, inetAddress -> !inetAddress.equals(blacklistedGW)); } catch (Exception e) { //Fallback: did I screw up putting the IP in? lmao planner = new RotatingNanoIpRoutePlanner(blocks); e.printStackTrace(); } } new YoutubeIpRotatorSetup(planner) .forSource(youtubeAudioSourceManager) .setup(); } //IPv6 rotation config end //Register source manager and configure the Player playerManager.registerSourceManager(youtubeAudioSourceManager); playerManager.registerSourceManager(SoundCloudAudioSourceManager.createDefault()); playerManager.registerSourceManager(new BandcampAudioSourceManager()); playerManager.registerSourceManager(new VimeoAudioSourceManager()); playerManager.registerSourceManager(new TwitchStreamAudioSourceManager()); playerManager.registerSourceManager(new BeamAudioSourceManager()); if (!ExtraRuntimeOptions.DISABLE_NON_ALLOCATING_BUFFER) { log.info("Enabled non-allocating audio buffer."); playerManager.getConfiguration().setFrameBufferFactory(NonAllocatingAudioFrameBuffer::new); } }