ajout de la table pour le corpus des vidéos
This commit is contained in:
parent
f1514c3f5e
commit
4404337039
5 changed files with 163 additions and 13 deletions
108
base/corpus_web.php
Normal file
108
base/corpus_web.php
Normal file
|
@ -0,0 +1,108 @@
|
|||
<?php
|
||||
/**
|
||||
* Déclarations relatives à la base de données
|
||||
*
|
||||
* @plugin corpus web
|
||||
* @copyright 2021
|
||||
* @author Gamuza[informatique]
|
||||
* @licence GNU/GPL
|
||||
* @package SPIP\corpus_web\Pipelines
|
||||
*/
|
||||
|
||||
if (!defined('_ECRIRE_INC_VERSION')) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Déclaration des alias de tables et filtres automatiques de champs
|
||||
*
|
||||
* @pipeline declarer_tables_interfaces
|
||||
* @param array $interfaces
|
||||
* Déclarations d'interface pour le compilateur
|
||||
* @return array
|
||||
* Déclarations d'interface pour le compilateur
|
||||
*/
|
||||
function corpus_web_declarer_tables_interfaces($interfaces) {
|
||||
|
||||
$interfaces['table_des_tables']['corpus_videos'] = 'corpus_videos';
|
||||
|
||||
return $interfaces;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Déclaration des objets éditoriaux
|
||||
*
|
||||
* @pipeline declarer_tables_objets_sql
|
||||
* @param array $tables
|
||||
* Description des tables
|
||||
* @return array
|
||||
* Description complétée des tables
|
||||
*/
|
||||
function corpus_web_declarer_tables_objets_sql($tables) {
|
||||
|
||||
$tables['spip_corpus_videos'] = array(
|
||||
'type' => 'corpus_video',
|
||||
'principale' => 'oui',
|
||||
'field'=> array(
|
||||
'id_corpus_video' => 'bigint(21) NOT NULL',
|
||||
'title' => 'text NOT NULL DEFAULT ""',
|
||||
'description' => 'text NOT NULL DEFAULT ""',
|
||||
'keywords' => 'text NOT NULL DEFAULT ""',
|
||||
'provider' => 'varchar(25) NOT NULL DEFAULT ""',
|
||||
'urn' => 'varchar(100) NOT NULL DEFAULT ""',
|
||||
'id' => 'varchar(25) NOT NULL DEFAULT ""',
|
||||
'user' => 'varchar(100) NOT NULL DEFAULT ""',
|
||||
'user_id' => 'varchar(100) NOT NULL DEFAULT ""',
|
||||
'first_download_date' => 'datetime NOT NULL DEFAULT "0000-00-00 00:00:00"',
|
||||
'publication_date' => 'datetime NOT NULL DEFAULT "0000-00-00 00:00:00"',
|
||||
'duration' => 'bigint(21) NOT NULL',
|
||||
'page_url' => 'varchar(250) NOT NULL DEFAULT ""',
|
||||
'webmedia_search_url' => 'varchar(250) NOT NULL DEFAULT ""',
|
||||
'webmedia_play_url' => 'varchar(250) NOT NULL DEFAULT ""',
|
||||
'transcription_readable_file' => 'varchar(250) NOT NULL DEFAULT ""',
|
||||
'transcription_detailed_file' => 'varchar(250) NOT NULL DEFAULT ""',
|
||||
'transcription_readable_content' => 'text NOT NULL DEFAULT ""',
|
||||
'transcription_detailed_content' => 'text NOT NULL DEFAULT ""',
|
||||
),
|
||||
'key' => array(
|
||||
'PRIMARY KEY' => 'id_corpus_video',
|
||||
),
|
||||
);
|
||||
|
||||
return $tables;
|
||||
}
|
||||
|
||||
|
||||
function corpus_web_declarer_tables_principales($tables_principales){
|
||||
|
||||
//$tables_principales['spip_auteurs']['field']['initiales'] = "varchar(5) NOT NULL DEFAULT ''";
|
||||
|
||||
return $tables_principales;
|
||||
}
|
||||
|
||||
/**
|
||||
* Déclaration des tables secondaires (liaisons)
|
||||
*/
|
||||
function corpus_web_declarer_tables_auxiliaires($tables) {
|
||||
|
||||
/* $tables['spip_gbev_seances_liens'] = array(
|
||||
'field' => array(
|
||||
"id_gbev_seance" => "bigint(21) DEFAULT '0' NOT NULL",
|
||||
"id_objet" => "bigint(21) DEFAULT '0' NOT NULL",
|
||||
"objet" => "VARCHAR(25) DEFAULT '' NOT NULL",
|
||||
"type" => "VARCHAR(25) DEFAULT '' NOT NULL",
|
||||
"vu" => "VARCHAR(6) DEFAULT 'non' NOT NULL",
|
||||
'maj' => 'TIMESTAMP',
|
||||
),
|
||||
'key' => array(
|
||||
"PRIMARY KEY" => "id_gbev_seance,id_objet,objet",
|
||||
"KEY id_gbev_seance" => "id_gbev_seance"
|
||||
)
|
||||
);*/
|
||||
|
||||
return $tables;
|
||||
}
|
||||
|
||||
|
|
@ -10,28 +10,36 @@
|
|||
[ (#SIZE|>{#GET{trop_gros}}|oui)<div>fichier trop gros pour traitement basique</div>]
|
||||
</h3>
|
||||
<BOUCLE_2lignes(DATA){liste #GET{liste_lignes}}{si #SIZE|<{#GET{trop_gros}}}>
|
||||
[(#SET{num_ligne,[(#COMPTEUR_BOUCLE|=={1}|?{1,#GET{nb_lignes}})]})]
|
||||
<div>
|
||||
<h4 class="aff_masq">Ligne #VALEUR:</h4>
|
||||
<h4 class="aff_masq">Page #VALEUR :</h4>
|
||||
<div class="details">
|
||||
[(#SET{content,[(#FILE|affiche_ligne{1}|json_decode{true})]})]
|
||||
[(#SET{content,[(#FILE|affiche_ligne{#GET{num_ligne}}|json_decode{true})]})]
|
||||
<ul>
|
||||
<li>
|
||||
<div class="aff_masq">Contenu brut :</div>
|
||||
<textarea class="details">[(#FILE|affiche_ligne{1})]</textarea>
|
||||
<textarea class="details">[(#FILE|affiche_ligne{#GET{num_ligne}})]</textarea>
|
||||
</li>
|
||||
<BOUCLE_content(DATA){source table, #GET{content}}>
|
||||
<li>
|
||||
[(#CLE|=={htmlBytes}|oui)
|
||||
<li>
|
||||
<div class="aff_masq">[(#CLE)] = HTML de la page : </div>
|
||||
<div class="details js-hidden">
|
||||
<textarea>[(#VALEUR|base64_decode|replace{<,<}|replace{>,>})]</textarea>
|
||||
<textarea class="details">[(#VALEUR|base64_decode|replace{<,<}|replace{>,>})]</textarea>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="aff_masq">Titraille :</div>
|
||||
<textarea class="details">[(#VALEUR|base64_decode|affiche_titraille)]</textarea>
|
||||
</li>
|
||||
]
|
||||
[(#CLE|=={htmlBytes}|non)
|
||||
<li>
|
||||
<div class="aff_masq">[(#CLE)] : </div>
|
||||
<div class="details">
|
||||
[(#VALEUR|print|replace{<br />,§§}|replace{<,<}|replace{>,>}|replace{§§,<br>})]
|
||||
</div>
|
||||
</li>
|
||||
]
|
||||
</li>
|
||||
</BOUCLE_content>
|
||||
|
|
|
@ -26,6 +26,22 @@ if (!defined('_ECRIRE_INC_VERSION')) {
|
|||
function corpus_web_upgrade($nom_meta_base_version, $version_cible) {
|
||||
$maj = array();
|
||||
|
||||
$maj['create'] = array(
|
||||
array('maj_tables',
|
||||
array(
|
||||
'spip_corpus_videos',
|
||||
)
|
||||
),
|
||||
//array('creer_les_configs'),
|
||||
);
|
||||
$maj['1.0.1'] = array(
|
||||
array('maj_tables',
|
||||
array(
|
||||
'spip_corpus_videos',
|
||||
)
|
||||
),
|
||||
);
|
||||
|
||||
include_spip('base/upgrade');
|
||||
maj_plugin($nom_meta_base_version, $version_cible, $maj);
|
||||
}
|
||||
|
@ -39,7 +55,5 @@ function corpus_web_upgrade($nom_meta_base_version, $version_cible) {
|
|||
* @return void
|
||||
**/
|
||||
function corpus_web_vider_tables($nom_meta_base_version) {
|
||||
|
||||
|
||||
effacer_meta($nom_meta_base_version);
|
||||
}
|
||||
|
|
|
@ -49,6 +49,22 @@ function affiche_ligne($fichier, $num) {
|
|||
return 'Erreur : nombre de lignes du fichier '.$fichier.' inférieur à '.$num;
|
||||
}
|
||||
|
||||
function affiche_titraille($html) {
|
||||
$niv_h = [1,2,3,4,5,6];
|
||||
$titraille = [];
|
||||
foreach($niv_h as $h) {
|
||||
preg_match_all('/<h'.$h.'>(.*)?<\/h'.$h.'>/si', $html, $match, PREG_SET_ORDER);
|
||||
if ($match) {
|
||||
foreach($match as $m) {
|
||||
$titraille[] = '<h'.$h.'>'.$m[1].'</h'.$h.'>';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return join("\r\n", $titraille);
|
||||
}
|
||||
|
||||
function human_filesize($bytes, $decimals = 2) {
|
||||
$sz = 'BKMGTP';
|
||||
$factor = floor((strlen($bytes) - 1) / 3);
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<paquet
|
||||
prefix="corpus_web"
|
||||
categorie="outil"
|
||||
version="1.0.0"
|
||||
version="1.0.2"
|
||||
etat="dev"
|
||||
compatibilite="[3.3.0-dev;3.3.*]"
|
||||
logo="prive/themes/spip/images/corpus-xx.svg"
|
||||
documentation=""
|
||||
schema="1.0.0"
|
||||
schema="1.0.2"
|
||||
>
|
||||
|
||||
<nom>Traitement corpus web</nom>
|
||||
|
@ -16,5 +16,9 @@
|
|||
<licence>GNU/GPL</licence>
|
||||
|
||||
<pipeline nom="autoriser" inclure="corpus_web_autorisations.php" />
|
||||
<pipeline nom="declarer_tables_objets_sql" inclure="base/corpus_web.php" />
|
||||
<pipeline nom="declarer_tables_interfaces" inclure="base/corpus_web.php" />
|
||||
<pipeline nom="declarer_tables_auxiliaires" inclure="base/corpus_web.php" />
|
||||
<pipeline nom="declarer_tables_principales" inclure="base/corpus_web.php" />
|
||||
|
||||
</paquet>
|
||||
|
|
Loading…
Add table
Reference in a new issue