import os

def list_audio_files_with_urls(directory, base_url):
    try:
        # List all files in the directory
        all_files = os.listdir(directory)

        # Filter out files that end with '.mp3' or '.ogg'
        audio_files = [file for file in all_files if file.endswith(('.mp3', '.ogg'))]

        # Sort the list of audio files alphabetically
        audio_files.sort()

        # Prepend the base URL to each file name
        audio_urls = [f"{base_url}/{file}" for file in audio_files]

        return audio_urls
    except Exception as e:
        print(f"An error occurred: {e}")
        return []

# Example usage
directory_path = '/home/mataji/Desktop/files/amritvachan-audio/aj-pravachan/'
base_url = 'https://geocities.ws/brijesh/amritvachan-audio/aj-pravachan'
audio_files = list_audio_files_with_urls(directory_path, base_url)

# Print the list in the desired format
for audio_file in audio_files:
    print(f"'{audio_file}',")
