From 44043370392abe745ad09a5c3a49d8ff69fd1cc3 Mon Sep 17 00:00:00 2001 From: cy_altern Date: Mon, 25 Jan 2021 14:05:32 +0100 Subject: [PATCH] =?UTF-8?q?ajout=20de=20la=20table=20pour=20le=20corpus=20?= =?UTF-8?q?des=20vid=C3=A9os?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- base/corpus_web.php | 108 +++++++++++++++++++++++++++++++++ content/mouline_corpus.html | 26 +++++--- corpus_web_administrations.php | 18 +++++- corpus_web_fonctions.php | 16 +++++ paquet.xml | 8 ++- 5 files changed, 163 insertions(+), 13 deletions(-) create mode 100644 base/corpus_web.php diff --git a/base/corpus_web.php b/base/corpus_web.php new file mode 100644 index 0000000..37c4ab5 --- /dev/null +++ b/base/corpus_web.php @@ -0,0 +1,108 @@ + '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; +} + + diff --git a/content/mouline_corpus.html b/content/mouline_corpus.html index 9541a33..75ee3fd 100644 --- a/content/mouline_corpus.html +++ b/content/mouline_corpus.html @@ -10,29 +10,37 @@ [ (#SIZE|>{#GET{trop_gros}}|oui)
fichier trop gros pour traitement basique
] + [(#SET{num_ligne,[(#COMPTEUR_BOUCLE|=={1}|?{1,#GET{nb_lignes}})]})]
-

Ligne #VALEUR:

+

Page #VALEUR :

- [(#SET{content,[(#FILE|affiche_ligne{1}|json_decode{true})]})] + [(#SET{content,[(#FILE|affiche_ligne{#GET{num_ligne}}|json_decode{true})]})]
  • Contenu brut :
    - +
  • -
  • - [(#CLE|=={htmlBytes}|oui) + [(#CLE|=={htmlBytes}|oui) +
  • [(#CLE)] = HTML de la page :
    - +
    - ] - [(#CLE|=={htmlBytes}|non) +
  • +
  • +
    Titraille :
    + +
  • + ] + [(#CLE|=={htmlBytes}|non) +
  • [(#CLE)] :
    [(#VALEUR|print|replace{
    ,§§}|replace{<,<}|replace{>,>}|replace{§§,
    })]
    - ] +
  • + ]
diff --git a/corpus_web_administrations.php b/corpus_web_administrations.php index e4ba407..9751778 100644 --- a/corpus_web_administrations.php +++ b/corpus_web_administrations.php @@ -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); } diff --git a/corpus_web_fonctions.php b/corpus_web_fonctions.php index e5abd5a..c0515a1 100644 --- a/corpus_web_fonctions.php +++ b/corpus_web_fonctions.php @@ -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.'>/si', $html, $match, PREG_SET_ORDER); + if ($match) { + foreach($match as $m) { + $titraille[] = ''.$m[1].''; + } + } + + } + + return join("\r\n", $titraille); +} + function human_filesize($bytes, $decimals = 2) { $sz = 'BKMGTP'; $factor = floor((strlen($bytes) - 1) / 3); diff --git a/paquet.xml b/paquet.xml index 5cd8a78..6ebe075 100644 --- a/paquet.xml +++ b/paquet.xml @@ -1,12 +1,12 @@ Traitement corpus web @@ -16,5 +16,9 @@ GNU/GPL + + + +