Browse Source

Playing with gramofonche

Signed-off-by: Blagovest Petrov <blagovest@petrovs.info>
master
Blagovest Petrov 5 years ago
parent
commit
767dbc6847
  1. 107
      twilio-lambda/main.py
  2. 1
      twilio-lambda/requirements.txt

107
twilio-lambda/main.py

@ -1,15 +1,100 @@
#!/usr/bin/env python3
from flask import Flask, request
from twilio.twiml.voice_response import VoiceResponse
import random
from twilio.rest import Client as TwilioClient
app = Flask(__name__)
account_sid = os.environ['TWILIO_SID']
auth_token = os.environ['TWILIO_TOKEN']
client = TwilioClient(account_sid, auth_token)
prikazki = [
# "https://gramofonche.chitanka.info/prikazki/abanosoviia-kon/abanosoviia-kon.mp3",
# "https://gramofonche.chitanka.info/prikazki/abu-myrzeliviiat-i-hubavicata/abu-myrzeliviiat-i-hubavicata.mc.mp3",
# "https://gramofonche.chitanka.info/prikazki/aladin-i-vylshebnata-lampa/aladin-i-vylshebnata-lampa--bton.cd.mp3",
# "https://gramofonche.chitanka.info/prikazki/alenoto-cvete--baa10262/alenoto-cvete.lp.mp3",
# "https://gramofonche.chitanka.info/prikazki/ali-baba-i-40te-razbojnika/ali-baba-i-40te-razboinika.mc.mp3",
# "https://gramofonche.chitanka.info/prikazki/ali.baba--bam6516/%D0%90%D0%BB%D0%B8_%D0%91%D0%B0%D0%B1%D0%B0_%D0%B8_40%D1%82%D0%B5_%D1%80%D0%B0%D0%B7%D0%B1%D0%BE%D0%B9%D0%BD%D0%B8%D0%BA%D0%B0--%D0%B0%D1%80%D0%B0%D0%B1%D1%81%D0%BA%D0%B0--%D0%92%D0%90%D0%9C6515-6516.mp3",
# "https://gramofonche.chitanka.info/prikazki/alisa.v.ogledalnia.sviat--radio/alisa_v_ogledalnia_svyat--radio.mp3",
# "https://gramofonche.chitanka.info/prikazki/alisa.v.stranata.na.chudesata--luis.karol--radio/alisa.v.stranata.na.chudesata--luis.karol--radio.mp3",
# "https://gramofonche.chitanka.info/prikazki/alisa-v-stranata-na-chudesata/alisa-v-stranata-na-chudesata.mc.mp3",
# "https://gramofonche.chitanka.info/prikazki/andersen--groznoto-pate--novite-drehi-na-caria--kakvoto-stori-diado--baa1165/groznoto_patence--bton.cd.mp3",
# "https://gramofonche.chitanka.info/prikazki/andersen--groznoto-pate--novite-drehi-na-caria--kakvoto-stori-diado--baa1165/novite_drehi_na_carya--bton.cd.mp3",
# "https://gramofonche.chitanka.info/prikazki/andersen--groznoto-pate--novite-drehi-na-caria--kakvoto-stori-diado--baa1165/kakvoto-stori-diado-vse-e-hubavo.lp.mp3",
# "https://gramofonche.chitanka.info/prikazki/andersen--palechka--svinariat--koj-mozhe-da-se-symniava--baa1120/palechka--bton.cd.mp3",
# "https://gramofonche.chitanka.info/prikazki/andersen--palechka--svinariat--koj-mozhe-da-se-symniava--baa1120/svinaryat.lp.mp3",
# "https://gramofonche.chitanka.info/prikazki/andersen--palechka--svinariat--koj-mozhe-da-se-symniava--baa1120/koi-moze-da-se-symniava-v-tova.lp.mp3",
# "https://gramofonche.chitanka.info/prikazki/ana.maninen--radio/Anna_Maninen--radio.mp3",
# "https://gramofonche.chitanka.info/prikazki/anton-i-tochica/anton-i-tochica.mc.mp3",
# "https://gramofonche.chitanka.info/prikazki/anton.i.tochica--e.kestner--radio/anton.i.tochica--e.kestner--radio.mp3",
# "https://gramofonche.chitanka.info/prikazki/astrid.lindgren--zl.fond--radio/%D0%9F%D0%B8%D0%BF%D0%B8_%D0%94%D1%8A%D0%BB%D0%B3%D0%BE%D1%82%D0%BE_%D1%87%D0%BE%D1%80%D0%B0%D0%BF%D1%87%D0%B5-%D0%BE%D1%82%D0%BA%D1%8A%D1%81--%D0%90%D1%81%D1%82%D1%80%D0%B8%D0%B4.%D0%9B%D0%B8%D0%BD%D0%B4%D0%B3%D1%80%D0%B5%D0%BD-%D0%A1%D0%BB.%D0%A1%D0%BB%D0%B0%D0%B2%D0%BE%D0%B2%D0%B0,%D0%93.%D0%A1%D1%82%D0%B0%D0%BD%D1%87%D0%B5%D0%B2%D0%B0--%D1%80%D0%B0%D0%B4%D0%B8%D0%BE.mp3",
# "https://gramofonche.chitanka.info/prikazki/astrid.lindgren--zl.fond--radio/%D0%94%D1%80%D0%B0%D0%BA%D0%BE%D0%BD%D1%8A%D1%82_%D1%81_%D1%87%D0%B5%D1%80%D0%B2%D0%B5%D0%BD%D0%B8%D1%82%D0%B5_%D0%BE%D1%87%D0%B8-%D0%BE%D1%82%D0%BA%D1%8A%D1%81--%D0%90%D1%81%D1%82%D1%80%D0%B8%D0%B4.%D0%9B%D0%B8%D0%BD%D0%B4%D0%B3%D1%80%D0%B5%D0%BD-%D0%A6.%D0%9C%D0%B8%D1%82%D0%B5%D0%B2%D0%B0--%D1%80%D0%B0%D0%B4%D0%B8%D0%BE.mp3",
# "https://gramofonche.chitanka.info/prikazki/astrid.lindgren--zl.fond--radio/%D0%95%D0%BC%D0%B8%D0%BB_%D0%BE%D1%82_%D0%9B%D1%8C%D0%BE%D0%BD%D0%B5%D0%B1%D0%B5%D1%80%D1%8F-%D0%BE%D1%82%D0%BA%D1%8A%D1%81--%D0%90%D1%81%D1%82%D1%80%D0%B8%D0%B4.%D0%9B%D0%B8%D0%BD%D0%B4%D0%B3%D1%80%D0%B5%D0%BD-%D0%93.%D0%9A%D0%B0%D0%B4%D1%83%D1%80%D0%B8%D0%BD--%D1%80%D0%B0%D0%B4%D0%B8%D0%BE.mp3",
# "https://gramofonche.chitanka.info/prikazki/ah-tazi-reka-misisipi--radio/Ah_tazi_reka_Mississippi--radio.mp3",
# "https://gramofonche.chitanka.info/prikazki/bazen-mesechinata--radio/bazen.mesechinata--radio.mp3",
# "https://gramofonche.chitanka.info/prikazki/baltijski.prikazki--radio/%D1%81%D0%B8%D1%80%D0%B0%D1%87%D0%B5%D1%82%D0%BE--%D0%B1%D0%B0%D0%BB%D1%82%D0%B8%D0%B9%D1%81%D0%BA%D0%B0--%D1%80%D0%B0%D0%B4%D0%B8%D0%BE.mp3",
# "https://gramofonche.chitanka.info/prikazki/baltijski.prikazki--radio/%D0%B6%D0%B5%D0%BB%D1%8F%D0%B7%D0%BD%D0%BE%D1%82%D0%BE.%D0%BC%D0%BE%D0%BC%D1%87%D0%B5.%D0%BD%D0%B0.%D0%BA%D0%BE%D0%B2%D0%B0%D1%87%D0%B0--%D1%80%D0%B0%D0%B4%D0%B8%D0%BE.mp3",
# "https://gramofonche.chitanka.info/prikazki/baltijski.prikazki--radio/%D1%82%D1%80%D0%B8%D0%BC%D0%B0%D1%82%D0%B0.%D0%B1%D1%80%D0%B0%D1%82%D1%8F--%D0%B1%D0%B0%D0%BB%D1%82%D0%B8%D0%B9%D1%81%D0%BA%D0%B0--%D1%80%D0%B0%D0%B4%D0%B8%D0%BE.mp3",
# "https://gramofonche.chitanka.info/prikazki/baltijski.prikazki--radio/%D0%94%D1%8A%D0%B6%D0%B4%D1%8A%D1%82_%D0%B8_%D0%B2%D1%8F%D1%82%D1%8A%D1%80%D1%8A%D1%82--%D0%B1%D0%B0%D0%BB%D1%82%D0%B8%D0%B9%D1%81%D0%BA%D0%B0--%D1%80%D0%B0%D0%B4%D0%B8%D0%BE.mp3",
# "https://gramofonche.chitanka.info/prikazki/baltijski.prikazki--radio/%D0%9F%D0%B5%D1%82%D0%B5%D0%BB%D1%8A%D1%82_%D0%B8_%D0%BA%D0%BE%D0%BA%D0%BE%D1%88%D0%BA%D0%B0%D1%82%D0%B0--%D0%B1%D0%B0%D0%BB%D1%82%D0%B8%D0%B9%D1%81%D0%BA%D0%B0--%D1%80%D0%B0%D0%B4%D0%B8%D0%BE.mp3",
# "https://gramofonche.chitanka.info/prikazki/baltijski.prikazki--radio/%D0%A3%D0%BC%D0%BD%D0%B8%D1%8F%D1%82_%D1%81%D0%B5%D0%BB%D1%8F%D0%BD%D0%B8%D0%BD--%D0%B1%D0%B0%D0%BB%D1%82%D0%B8%D0%B9%D1%81%D0%BA%D0%B0--%D1%80%D0%B0%D0%B4%D0%B8%D0%BE.mp3",
# "https://gramofonche.chitanka.info/prikazki/baltijski.prikazki--radio/%D0%94%D0%B2%D0%B0%D0%BC%D0%B0%D1%82%D0%B0_%D0%BB%D1%8A%D0%B6%D1%86%D0%B8--%D0%B1%D0%B0%D0%BB%D1%82%D0%B8%D0%B9%D1%81%D0%BA%D0%B0--%D1%80%D0%B0%D0%B4%D0%B8%D0%BE.mp3",
# "https://gramofonche.chitanka.info/prikazki/baltijski.prikazki--radio/%D0%9F%D1%80%D0%B8%D0%BA%D0%B0%D0%B7%D0%BA%D0%B0%D1%82%D0%B0_%D0%BD%D0%B0_%D1%81%D1%82%D1%80%D0%B0%D0%BD%D0%BD%D0%B8%D0%BA%D0%B0--%D0%B1%D0%B0%D0%BB%D1%82%D0%B8%D0%B9%D1%81%D0%BA%D0%B0--%D1%80%D0%B0%D0%B4%D0%B8%D0%BE.mp3",
# "https://gramofonche.chitanka.info/prikazki/barabanchik--b.grim--radio/barabanchik--b.grim--radio.mp3",
# "https://gramofonche.chitanka.info/prikazki/barabanchik--duhyt-v-shisheto--baa1831/barabanchik--baa1831.mp3",
# "https://gramofonche.chitanka.info/prikazki/barabanchik--duhyt-v-shisheto--baa1831/duhyt_v_shisheto--baa1831.mp3",
# "https://gramofonche.chitanka.info/prikazki/munhausen--baa10239/munhausen.lp.mp3",
"https://gramofonche.chitanka.info/prikazki/basni--albert.dekalo--baa11099/basni--albert.dekalo--01_orel_i_ohljuv--baa11099.mp3",
"https://gramofonche.chitanka.info/prikazki/basni--albert.dekalo--baa11099/basni--albert.dekalo--02_predlozhenie--baa11099.mp3",
"https://gramofonche.chitanka.info/prikazki/basni--albert.dekalo--baa11099/basni--albert.dekalo--03_lisica_i_taralezh--baa11099.mp3",
"https://gramofonche.chitanka.info/prikazki/basni--albert.dekalo--baa11099/basni--albert.dekalo--04_kakvo_zabravi_lisicata--baa11099.mp3",
"https://gramofonche.chitanka.info/prikazki/basni--albert.dekalo--baa11099/basni--albert.dekalo--05_dlyzhnostta_'slavej'--baa11099.mp3",
"https://gramofonche.chitanka.info/prikazki/basni--albert.dekalo--baa11099/basni--albert.dekalo--06_preporaka--baa11099.mp3",
"https://gramofonche.chitanka.info/prikazki/basni--albert.dekalo--baa11099/basni--albert.dekalo--07_pouka--baa11099.mp3",
"https://gramofonche.chitanka.info/prikazki/basni--albert.dekalo--baa11099/basni--albert.dekalo--08_hameleon--baa11099.mp3",
"https://gramofonche.chitanka.info/prikazki/basni--albert.dekalo--baa11099/basni--albert.dekalo--09_zhertvata_na_lisicata--baa11099.mp3",
"https://gramofonche.chitanka.info/prikazki/basni--albert.dekalo--baa11099/basni--albert.dekalo--10_istorija_s_mechka--baa11099.mp3",
"https://gramofonche.chitanka.info/prikazki/basni--albert.dekalo--baa11099/basni--albert.dekalo--11_kanconeta--baa11099.mp3",
"https://gramofonche.chitanka.info/prikazki/basni--albert.dekalo--baa11099/basni--albert.dekalo--12_konkurs--baa11099.mp3",
"https://gramofonche.chitanka.info/prikazki/basni--albert.dekalo--baa11099/basni--albert.dekalo--13_kashalotyt--baa11099.mp3",
"https://gramofonche.chitanka.info/prikazki/basni--albert.dekalo--baa11099/basni--albert.dekalo--14_koncert_za_garga_i_orkestar--baa11099.mp3",
"https://gramofonche.chitanka.info/prikazki/basni--albert.dekalo--baa11099/basni--albert.dekalo--15_traktat--baa11099.mp3",
"https://gramofonche.chitanka.info/prikazki/basni--albert.dekalo--baa11099/basni--albert.dekalo--16_repertoar--baa11099.mp3",
"https://gramofonche.chitanka.info/prikazki/basni--albert.dekalo--baa11099/basni--albert.dekalo--17_opashatata_kometa--baa11099.mp3",
"https://gramofonche.chitanka.info/prikazki/basni--albert.dekalo--baa11099/basni--albert.dekalo--18_more--baa11099.mp3",
"https://gramofonche.chitanka.info/prikazki/basni--albert.dekalo--baa11099/basni--albert.dekalo--19_izvorche_i_blato--baa11099.mp3",
"https://gramofonche.chitanka.info/prikazki/basni--albert.dekalo--baa11099/basni--albert.dekalo--20_potocheto--baa11099.mp3",
"https://gramofonche.chitanka.info/prikazki/basni--albert.dekalo--baa11099/basni--albert.dekalo--21_roza_i_koza--baa11099.mp3",
"https://gramofonche.chitanka.info/prikazki/basni--albert.dekalo--baa11099/basni--albert.dekalo--22_tikva_sred_kratuni--baa11099.mp3",
"https://gramofonche.chitanka.info/prikazki/basni--albert.dekalo--baa11099/basni--albert.dekalo--23_gyshe_mnenie--baa11099.mp3",
"https://gramofonche.chitanka.info/prikazki/basni--albert.dekalo--baa11099/basni--albert.dekalo--24_kokoshka_v_chuzhbina--baa11099.mp3",
"https://gramofonche.chitanka.info/prikazki/basni--albert.dekalo--baa11099/basni--albert.dekalo--25_zaslugite_na_gyskite--baa11099.mp3",
"https://gramofonche.chitanka.info/prikazki/basni--albert.dekalo--baa11099/basni--albert.dekalo--26_moral--baa11099.mp3",
"https://gramofonche.chitanka.info/prikazki/basni--albert.dekalo--baa11099/basni--albert.dekalo--27_petnoto--baa11099.mp3",
"https://gramofonche.chitanka.info/prikazki/basni--albert.dekalo--baa11099/basni--albert.dekalo--28_pila_i_chetka--baa11099.mp3",
"https://gramofonche.chitanka.info/prikazki/basni--albert.dekalo--baa11099/basni--albert.dekalo--29_magniti--baa11099.mp3",
"https://gramofonche.chitanka.info/prikazki/basni--albert.dekalo--baa11099/basni--albert.dekalo--30_potoche_i_reka--baa11099.mp3",
"https://gramofonche.chitanka.info/prikazki/basni--albert.dekalo--baa11099/basni--albert.dekalo--31_plug_i_shejna--baa11099.mp3",
"https://gramofonche.chitanka.info/prikazki/basni--albert.dekalo--baa11099/basni--albert.dekalo--32_grymootvod_i_vetropokazatel--baa11099.mp3",
"https://gramofonche.chitanka.info/prikazki/basni--albert.dekalo--baa11099/basni--albert.dekalo--33_ventilator--baa11099.mp3",
"https://gramofonche.chitanka.info/prikazki/basni--albert.dekalo--baa11099/basni--albert.dekalo--33_ventilator--baa11099.mp3",
"https://gramofonche.chitanka.info/prikazki/basni--albert.dekalo--baa11099/basni--albert.dekalo--34_izvoryt--baa11099.mp3",
"https://gramofonche.chitanka.info/prikazki/basni--albert.dekalo--baa11099/basni--albert.dekalo--35_ogynjat_na_svetulkata--baa11099.mp3"
call = client.calls.create(
url='http://demo.twilio.com/docs/voice.xml',
to='+14155551212',
from_='+15017122661'
)
]
print(call.sid)
@app.route("/voice", methods=['GET', 'POST'])
def voice():
"""Respond to incoming phone calls and mention the caller's city"""
# Get the caller's city from Twilio's request to our app
# city = request.values['FromCity']
# Start our TwiML response
resp = VoiceResponse()
# Read a message aloud to the caller
# resp.say('Never gonna give you up!', voice='alice')
# Play an audio file for the caller
resp.play(random.choice(prikazki))
return str(resp)
if __name__ == "__main__":
app.run(debug=True)

1
twilio-lambda/requirements.txt

@ -1,2 +1,3 @@
twilio
pyyaml
flask

Loading…
Cancel
Save