mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			20 lines
		
	
	
		
			647 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			20 lines
		
	
	
		
			647 B
		
	
	
	
		
			Python
		
	
	
	
	
	
import os
 | 
						|
 | 
						|
from zerver.lib.storage import static_path
 | 
						|
 | 
						|
 | 
						|
def get_available_notification_sounds() -> list[str]:
 | 
						|
    notification_sounds_path = static_path("audio/notification_sounds")
 | 
						|
    available_notification_sounds = []
 | 
						|
 | 
						|
    for file_name in os.listdir(notification_sounds_path):
 | 
						|
        root, ext = os.path.splitext(file_name)
 | 
						|
        if "." in root:  # nocoverage
 | 
						|
            # Exclude e.g. zulip.abcd1234.ogg (generated by production hash-naming)
 | 
						|
            # to avoid spurious duplicates.
 | 
						|
            continue
 | 
						|
        if ext == ".ogg":
 | 
						|
            available_notification_sounds.append(root)
 | 
						|
 | 
						|
    return sorted(available_notification_sounds)
 |