×
×

1 Quando Israel saiu do Egito, e a casa de Jacó de um povo de língua estranha,
2 Judá foi seu santuário, e Israel seu domínio.
3 O mar viu isto, e fugiu; o Jordão voltou para trás.
4 Os montes saltaram como carneiros, e os outeiros como cordeiros.
5 Que tiveste tu, ó mar, que fugiste, e tu, ó Jordão, que voltaste para trás?
6 Montes, que saltastes como carneiros, e outeiros, como cordeiros?
7 Treme, terra, na presença do Senhor, na presença do Deus de Jacó.
8 O qual converteu o rochedo em lago de águas, e o seixo em fonte de água.

Wesley Alves

Sobre o Autor

Wesley Alves é Missionário Digital Interdenominacional e Editor-Chefe do Versículo Vivo. Cristão apaixonado pela natureza e fotógrafo, ele dedica sua vida e ministério a proclamar a urgência da volta de Jesus.

Conheça o autor →
0
// ===== BÍBLIA — ÁUDIO (ElevenLabs) ===== if ( ! defined( 'VV_ELEVEN_MODEL' ) ) define( 'VV_ELEVEN_MODEL', 'eleven_multilingual_v2' ); function vv_audio_paths() { $up = wp_get_upload_dir(); $dir = trailingslashit( $up['basedir'] ) . 'audio'; if ( ! file_exists( $dir ) ) wp_mkdir_p( $dir ); return array( 'dir' => $dir, 'url' => trailingslashit( $up['baseurl'] ) . 'audio' ); } function vv_chapter_audio_url( $slug ) { if ( ! $slug ) return ''; $p = vv_audio_paths(); return file_exists( $p['dir'].'/'.$slug.'.mp3' ) ? $p['url'].'/'.$slug.'.mp3' : ''; } function vv_chapter_tts_text( $post_id, $titulo ) { $c = get_post_field( 'post_content', $post_id ); $c = preg_replace( '//i', "\n", $c ); $c = wp_strip_all_tags( $c ); $c = html_entity_decode( $c, ENT_QUOTES, 'UTF-8' ); $out = array(); foreach ( preg_split( '/\n+/', $c ) as $ln ) { $ln = trim( $ln ); if ( $ln === '' ) continue; $ln = preg_replace( '/^\d+\s+/', '', $ln ); $out[] = $ln; } return trim( $titulo.'. '.implode( ' ', $out ) ); } function vv_chunk_text( $text, $max = 2400 ) { $parts = preg_split( '/(?<=[\.\?\!])\s+/', $text ); $chunks = array(); $cur = ''; foreach ( $parts as $s ) { if ( $cur !== '' && ( strlen($cur)+strlen($s)+1 ) > $max ) { $chunks[]=$cur; $cur=''; } $cur = ($cur==='')?$s:$cur.' '.$s; } if ( $cur !== '' ) $chunks[] = $cur; return $chunks; } function vv_eleven_tts( $text ) { $resp = wp_remote_post( 'https://api.elevenlabs.io/v1/text-to-speech/'.VV_ELEVEN_VOICE, array( 'timeout'=>120, 'headers'=>array('xi-api-key'=>VV_ELEVEN_KEY,'Content-Type'=>'application/json','Accept'=>'audio/mpeg'), 'body'=>wp_json_encode(array('text'=>$text,'model_id'=>VV_ELEVEN_MODEL,'voice_settings'=>array('stability'=>0.5,'similarity_boost'=>0.8,'style'=>0.0,'use_speaker_boost'=>true))), ) ); if ( is_wp_error($resp) ) return array('err'=>$resp->get_error_message()); $code = wp_remote_retrieve_response_code($resp); $body = wp_remote_retrieve_body($resp); if ( $code !== 200 ) return array('err'=>'HTTP '.$code.' — '.substr(wp_strip_all_tags($body),0,300)); return array('audio'=>$body); } function vv_gen_chapter_audio( $post_id, $slug, $titulo ) { $p = vv_audio_paths(); $dest = $p['dir'].'/'.$slug.'.mp3'; $text = vv_chapter_tts_text( $post_id, $titulo ); if ( $text === '' ) return 'texto vazio'; $mp3 = ''; foreach ( vv_chunk_text($text) as $ch ) { $r = vv_eleven_tts($ch); if ( isset($r['err']) ) return $r['err']; $mp3 .= $r['audio']; } if ( $mp3 === '' ) return 'sem áudio retornado'; file_put_contents( $dest, $mp3 ); return true; } add_action( 'admin_init', function () { if ( ! current_user_can('manage_options') || ! isset($_GET['vv_gen_audio']) ) return; if ( VV_ELEVEN_KEY==='' || VV_ELEVEN_VOICE==='' ) wp_die('Configure VV_ELEVEN_KEY e VV_ELEVEN_VOICE.'); $mapa = vv_biblia_livros_mapa(); $lote = isset($_GET['n'])?max(1,min(20,(int)$_GET['n'])):6; $so = isset($_GET['slug'])?sanitize_title($_GET['slug']):''; global $wpdb; $rows = $wpdb->get_results("SELECT ID, post_name FROM {$wpdb->posts} WHERE post_type='post' AND post_status='publish' AND post_name REGEXP '^[a-z0-9-]+-[0-9]+$' ORDER BY post_date"); $pend = array(); foreach ( $rows as $r ) { if ( ! preg_match('/^(.+)-(\d+)$/',$r->post_name,$m) ) continue; if ( ! isset($mapa[$m[1]]) ) continue; if ( $so!=='' && $r->post_name!==$so ) continue; if ( $so==='' && vv_chapter_audio_url($r->post_name)!=='' ) continue; $pend[] = array('id'=>$r->ID,'slug'=>$r->post_name,'nome'=>$mapa[$m[1]][0].' '.$m[2]); } if ( $so!=='' && ! $pend ) wp_die('Capítulo "'.esc_html($so).'" não encontrado.'); $total = count($pend); $feitos = array(); $erro = ''; foreach ( array_slice($pend,0,$lote) as $c ) { $res = vv_gen_chapter_audio($c['id'],$c['slug'],$c['nome']); if ($res===true) $feitos[]=$c['nome']; else { $erro=$c['nome'].' — '.$res; break; } } $restam = $total-count($feitos); $next = esc_url(add_query_arg(array('vv_gen_audio'=>1,'n'=>$lote))); header('Content-Type: text/html; charset=utf-8'); echo ''; if ( $restam>0 && ! $erro && $so==='' ) echo ''; echo ''; echo '

Gerando áudios (ElevenLabs)

Gerados: '.count($feitos).' '.esc_html(implode(', ',$feitos)).'

Faltam: '.max(0,$restam).'

'; if ($erro) echo '

Erro em '.esc_html($erro).'

Tentar de novo

'; elseif ($restam<=0) echo '

✓ Concluído!

'; else echo '

Continuando… seguir

'; exit; } );