removed backup
This commit is contained in:
		
							parent
							
								
									2c7a5dff6c
								
							
						
					
					
						commit
						83843de4ee
					
				
					 1 changed files with 5 additions and 15 deletions
				
			
		
							
								
								
									
										20
									
								
								main.go
									
										
									
									
									
								
							
							
						
						
									
										20
									
								
								main.go
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -18,12 +18,11 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
var (
 | 
			
		||||
	token          string
 | 
			
		||||
	radioURL       = "https://atres-live.europafm.com/live/europafm/bitrate_1.m3u8"
 | 
			
		||||
	backupRadioURL = "https://playerservices.streamtheworld.com/api/livestream-redirect/EUROPA_FM.mp3"
 | 
			
		||||
	logger         *slog.Logger
 | 
			
		||||
	debug          bool
 | 
			
		||||
	guildID        string // For testing in a specific guild
 | 
			
		||||
	token    string
 | 
			
		||||
	radioURL = "https://atres-live.europafm.com/live/europafm/bitrate_1.m3u8"
 | 
			
		||||
	logger   *slog.Logger
 | 
			
		||||
	debug    bool
 | 
			
		||||
	guildID  string // For testing in a specific guild
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func init() {
 | 
			
		||||
| 
						 | 
				
			
			@ -479,14 +478,5 @@ func playAudioStream(vc *discordgo.VoiceConnection, url string, stopChan chan bo
 | 
			
		|||
	// If we get here, the stream ended unexpectedly
 | 
			
		||||
	logger.Warn("Audio stream ended unexpectedly")
 | 
			
		||||
 | 
			
		||||
	// If primary URL fails and it's not the backup URL, try the backup URL
 | 
			
		||||
	if url == radioURL && backupRadioURL != "" {
 | 
			
		||||
		logger.Info("Primary URL failed, trying backup URL", "backup_url", backupRadioURL)
 | 
			
		||||
		dgvoice.PlayAudioFile(vc, backupRadioURL, stopChan)
 | 
			
		||||
 | 
			
		||||
		// If we get here, the backup stream also ended unexpectedly
 | 
			
		||||
		logger.Warn("Backup audio stream also ended unexpectedly")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return fmt.Errorf("audio stream ended unexpectedly")
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue