User Tools

Site Tools


Sidebar

Remember you can't log in as admin unless you are using ssl.

This is a sidebar. It will have content eventually.Edit sidebar

select-option

This is all from /usr/lib/cgi-bin/ and /var/www/html/mp3 on Jim-ITX (.45)

    $.post("/cgi-bin/t.py",
        {
            action: "getvoices"
        })
        .done(function (result, status, xhr) {
            console.dir(result);
            //const obj = JSON.parse(result);
            obj=result;
            console.dir(obj);
            $.each(obj, function (i, item) {
            //    console.dir(i);
                $('#voice').append($('<option>', { 
                    value: item,
                    text : i 
                }));
            });
            //$("#message").html(result)
        })
        .fail(function (xhr, status, error) {
            $("#message").html("Result: " + status + " " + error + " " + xhr.status + " " + xhr.statusText)
        });

The result comes back as a object:

t.py code to generate the “result”

    if action == "getvoices":
        voices = text_to_speech.list_voices().get_result()
        v = voices['voices']
        persons = {}
        for x in v:
            name=x['name']
            description = x['description']
            language = x['language']
            if language.startswith('en',0): 
                nam = re.split(":",description)
                persons[nam[0]]=name
        jo = json.dumps(persons)
        print(jo)
select-option.txt · Last modified: 2021/10/25 17:19 by admin