You are here

Limit "description" size.

15 posts / 0 new
Last post
JuanF
Offline
Donator
Joined: 6 years
Last seen: 3 weeks
Limit "description" size.

Hello,

Is it possible to limit the size of the description to 1000 characters for example?

Obviously modifying the .INI or do you know of some external SW?

 

Thanks. srr f my eng

JuanF: wg++ 2.1.5,os win 10

JuanF
Offline
Donator
Joined: 6 years
Last seen: 3 weeks

Hello Blackbear199,

Is not in all events.

- INI: UK\radiotimes.com.ini

- Channel: site_id="11272" xmltv_id="BBC One Northern Ireland HD"

- INI: Spain\plus.es.ini

- Channel: site_id="MV3" xmltv_id="#0"

- Channel: site_id="A3" xmltv_id="Antena 3"

- Channel: site_id="TVE" xmltv_id="LA 1"

....

 

Thanks

 

 

doglover
Offline
Joined: 11 years
Last seen: 3 years

To limit the length of the information, I have added the following statements to some of the SiteIni's

 

description.modify {substring(type=char)|'description' 0 2300}
title.modify {substring(type=char)|'title' 0 80}
subtitle.modify {substring(type=char)|'subtitle' 0 160}
index_description.modify {substring(type=char)|'index_description' 0 2300}
index_title.modify {substring(type=char)|'index_title' 0 80}
index_subtitle.modify {substring(type=char)|'index_subtitle' 0 160}

 

This just limits the text in the different tags to the defined value.

 

Willy

 

JuanF
Offline
Donator
Joined: 6 years
Last seen: 3 weeks

Hi Doglover, thanks for your help.

I have added the lines, only for description, but not work.. sure I did something wrong.

------------------------------------------------------------------------------------------

site {url=plus.es|timezone=Europe/Madrid|maxdays=7|cultureinfo=es-ES|charset=UTF-8|titlematchfactor=70|ratingsystem=ES}
site {keepindexpage|allowlastpageoverflow}
*
site {episodesystem=onscreen} *Enable for Onscreen Episode System
*site {episodesystem=xmltv_ns} *Enable for xmltv_ns Episode System
*
url_index{url|http://www.movistarplus.es/programacion-tv/|urldate|/?v=json}
url_index.headers {customheader=Accept-Encoding=gzip,deflate}
urldate.format {datestring|yyyy-MM-dd}
*
index_variable_element.modify {set|"'config_site_id'-CODE"}
index_showsplit.scrub {multi|'index_variable_element'|{"ESTRENO"|}|}]}}
scope.range{(splitindex)|end}
index_temp_1.modify {substring(type=regex)|'index_showsplit' "\"HORA_INICIO\":\"(\d{2}:\d{2})\""}
index_temp_1.modify {cleanup(removeduplicates span=1 link="index_showsplit")}
end_scope
*
scope.range{(indexshowdetails)|end}
index_start.scrub {single|HORA_INICIO":"||"|"}
*index_stop.scrub {single|HORA_FIN":"||"|"}
index_title.scrub {single(separator=":""(" include=first)|"TITULO":"||"|"}
index_title.modify {cleanup(style=unidecode)}
index_description.modify {substring(type=char)|'index_description' 0 1000}
index_category.scrub {single|GENERO|":"|"}
index_category.modify {cleanup}
index_category.modify {remove|\}
*
index_urlshow {url||"URL":"||"}
index_urlshow.modify {remove|\}
index_urlshow.headers {customheader=Accept-Encoding=gzip,deflate}
end_scope
*
scope.range{(showdetails)|end}     
title.modify {addstart|'index_title'}
titleoriginal.scrub {single|<h1 itemprop="name" class="h-epsilon">|(|)|</h1>}
titleoriginal.modify {remove|)}
subtitle.scrub {single(separator=":" include=last)|<div class="title-image">|<h1 class="h-epsilon">|</h1>|</div>}
subtitle.modify {clear(~ "Episodio")}
subtitle.modify {remove(type=regex)|\(.+?\)}
subtitle.modify {cleanup(style=unidecode)}
subtitle.modify {clear('index_title')}
*
episode.scrub {regex set(pattern="Temporada 'S1' Episodio 'E1'")||<title>.*?(Temporada \d+\. Episodio \d+)||}
episode.modify {replace|.| }
*
description.scrub {multi|<div itemprop="description"|<p>|</p>|</div>}
* limit 1000 characters
description.modify {substring(type=char)|'description' 0 1000}
*description.modify {cleanup}
*category.scrub {single(separator=" / ")|<p itemprop="genre">||</p>|</p>}
director.scrub {single|Director</h3>|<span  itemprop="name" >|</span>|</p>}|<h3}
actor.scrub {multi|<h3 class="heading">Reparto</h3>|<span  itemprop="name" >|</span>|</div>}
productiondate.scrub {single|<p  itemprop="datePublished"|content="|"|  >}
showicon.scrub {single|<div class="cover">|<img src="http://www.webgrabplus.com/%7C"| alt}
ratingicon.scrub {url|http://www.plus.es|Calificación</h3><img src="http://www.webgrabplus.com/%7C%7C"|"}
rating.scrub {single|Calificación</h3>|src="/assets/images/movistar-plus/calf-|.svg"|<div}
rating.modify {cleanup(style=upper)}
starrating.scrub {single|<div class="rating-value">|<span itemprop="ratingValue" class="rating">|</span>|</div>}
starrating.modify {calculate(format=F1)|2 *}
starrating.modify {clear("0.0")}
starrating.modify {addend(not "")|/10}

---------------------------------------------------------------------------------------------------------------------------------------

Please could you help me?

Thanks

Juan

doglover
Offline
Joined: 11 years
Last seen: 3 years

That should work.

 

However did you try to do a complete new grab (force).  Because the details are not changed on already grabbed shows.

This change has only effect on the new grabbed shows.

 

Willy

 

PS:  I would leave the statement

*description.modify {cleanup}

 

active.  So remove the *

This will not have an effect on the limit to 1000 chars, but avoids unicode chars being present.

JuanF
Offline
Donator
Joined: 6 years
Last seen: 3 weeks

Not work :(

I changed to force, but I think that is not the problem because Im testing and I delete the file every time.

I dont know what happen...

 

Thanks doglover...

JuanF
Offline
Donator
Joined: 6 years
Last seen: 3 weeks

Hello doglover,

You can see it here.

<programme start="20180317221000 +0100" stop="20180318003000 +0100" channel="1705">
    <title lang="es">Los mercenarios 3</title>
    <desc lang="es">Barney, Christmas y el resto del equipo deben enfrentarse a Conrad Stonebanks, cofundador del grupo que posteriormente se convirtió en un despiadado traficante de armas. Barney estaba convencido de haber acabado con él, pero ha vuelto de la tumba y ahora busca venganza. Tan entretenida y llena de acción como sus dos predecesoras, "Los mercenarios 3" vuelve a reunir al mayor grupo de actores de acción que jamás se haya puesto delante de una cámara, unos 'tipos duros' que seguirán enfrentándose con villanos de todo pelaje y parodiando tanto el propio género de la película como la edad de la mayoría de sus protagonistas. En esta tercera entrega, dirigida por Patrick Hugues, los personajes de los veteranos actores Sylvester Stallone, Jason Statham, Antonio Banderas, Jet Li, Wesley Snipes, Dolph Lundgren, Kelsey Grammer, Harrison Ford, Arnold Schwarzenegger o Mel Gibson deberán enfrentarse a nuevo grupo de mercenarios, más jóvenes, más rápidos y con más conocimientos técnicos... y no todos de género masculino. Así, entre otros, también intervienen los jóvenes Kellan Lutz, Glen Powell y Ronda Rousey.(n)</desc>
    <credits>
      <director>Patrick Hugues</director>
      <actor>Sylvester Stallone</actor>
      <actor>Jason Statham</actor>
      <actor>Antonio Banderas</actor>
      <actor>Jet Li</actor>
      <actor>Wesley Snipes</actor>
      <actor>Dolph Lundgren</actor>
      <actor>Kelsey Grammer</actor>
      <actor>Randy Couture</actor>
      <actor>Terry Crews</actor>
      <actor>Harrison Ford</actor>
      <actor>Arnold Schwarzenegger</actor>
      <actor>Mel Gibson</actor>
      <actor>Kellan Lutz</actor>
    </credits>
    <date>2014</date>
    <category lang="es">Cine</category>
    <icon src="http://www.webgrabplus.com/%3Ca%20href%3D"http://www.movistarplus.es/recorte/n/caratula4/M743009">http://www.movistarplus.es/recorte/n/caratula4/M743009" />
    <rating system="ES">
      <value>16</value>
    </rating>
    <star-rating system="ES">
      <value>8.0/10</value>
    </star-rating>
  </programme>

 

Thanks

doglover
Offline
Joined: 11 years
Last seen: 3 years

Found it.

The description consist out of several elements.  The limit is applied on each element separately.

In order to have it limit the total, you need to convert the description first to a single element.

 

description.scrub {multi|<div itemprop="description"|<p>|</p>|</div>}
description.modify {cleanup}
description.modify {replace|\||\n}  *convert to single
description.modify {substring(type=char)|'description' 0 1000}

JuanF
Offline
Donator
Joined: 6 years
Last seen: 3 weeks

Perfect!!!

Many thanks doglover...

 

Juan

doglover
Offline
Joined: 11 years
Last seen: 3 years

Agreed this is a better way.

 

Willy

JuanF
Offline
Donator
Joined: 6 years
Last seen: 3 weeks

Great!!!...

 

Many thanks both.

Juan

JuanF
Offline
Donator
Joined: 6 years
Last seen: 3 weeks

Hello,

There are some channel programs in the same INI that exceed 1000 characters.

I dont know what is the problem.

INI: radiotimes.com.ini

Channel: site="radiotimes.com" site_id="54" BBC Radio 3

 

.....................

*description.modify {replace|\|| }  *convert to single
*description.modify {substring(type=char)|'description' 0 1000}
description.modify {remove|\|}  *convert to single
temp_2.modify {calculate(format=F0 type=char)|'description' #}
loop{('temp_2' > "900")|end}
description.modify {remove(type=sentence)|-1 1}
temp_2.modify {calculate(format=F0 type=char)|'description' #}
end_loop
subtitle.modify {remove(type=regex)|\d{2}\/\d{2}\/\d{4}}
subtitle.modify {clear(~ "Episode")}
end_scope
*
**  _  _  _  _  _  _  _  _  _  _  _  _  _  _  _  _  _  _  _  _  _  _  _  _  _  _  _  _  _  _  _  _
**      #####  CHANNEL FILE CREATION (only to create the xxx-channel.xml file)

..............

 

<programme start="20180329003000 +0000" stop="20180329063000 +0000" channel="3004.gibsat.com">
    <title lang="en">Through the Night</title>
    <desc lang="en">With John Shea. Mendelssohn: String Quartet No 2 in A minor, Op 13. Calidore Quartet. 10.01 Schumann: Märchenbilder, Op 113. 1.19 Mozart: Piano Trio in B flat, K502. 1.42 Schubert: Arpeggione Sonata, D821. 2.08 Haydn: Piano Sonata for piano in F, Hob1629. 2.23 Schubert transcr Liszt: Ständchen for piano (Schwanengesang, D957). 2.31 Rimsky-Korsakov: Scheherazade - symphonic suite after 1001 Nights, Op 35. 3.14 Salmenhaara: Concerto for Two Violins and Orchestra. 3.32 Bella: Solemn Overture in E flat. 3.39 Schlözer: Étude de concert in A flat, Op 1 No 2. 3.43 Holst: Ave Maria. 3.49 Rossini: Overture: Il Barbiere di Siviglia. 3.57 Geminiani: Concerto Grosso, Op 3 No 2. 4.06 Anon: Aquella voz de Cristo. 4.11 Ravel: Sonatine. 4.24 Bach: O Jesu Christ, meins Lebens Licht, BWV118 (excerpt). 4.31 Ravel: Alborada del gracioso (Miroirs). 4.38 Vivaldi: Flute Concerto in D, RV90 (Il gardellino). 4.49 Schumann: Toccata in C for piano, Op 7. 4.55 Mozart: Symphony No 34 in C, K338. 5.17 Schubert: Nacht und Träume, D827. 5.21 Bach: Cantata, BWV54 (Widerstehe doch der Sunde). 5.33 Daniel-Lesur: Suite Medievale for flute, harp and string trio. 5.47 Atrrib Mozart: Partita in E flat, KAnhC171. 6.08 CPE Bach: Anbetung dem Erbarmer - Easter Cantata, Wq243 (before 1784).(n)</desc>
    <credits>
      <presenter>John Shea</presenter>
    </credits>
    <category lang="en">Music</category>
    <icon src="http://www.webgrabplus.com/%3Ca%20href%3D"http://images.radiotimes.com/assets/images/holding/radio.png?quality=60&amp;mode=crop&amp;width=130&amp;height=100&amp;404=radio">http://images.radiotimes.com/assets/images/holding/radio.png?quality=60&..." />
  </programme>

 

 

any ideas?

 

Many thanks.

Attachments: 
doglover
Offline
Joined: 11 years
Last seen: 3 years

Yes.

This Siteini uses both the index_description and description scrubs.

In order to limit the desc tag to 1000 chars in the XMLTV file, You need to add both index_description and description together before limiting them.

However there are a bit of problems doing this.  So I grabbed the index_description as index_temp_2 and added that to the description before the limiting step.

Willt

 

Attachments: 
doglover
Offline
Joined: 11 years
Last seen: 3 years

Yes.

This Siteini uses both the index_description and description scrubs.

In order to limit the desc tag to 1000 chars in the XMLTV file, You need to add both index_description and description together before limiting them.

However there are a bit of problems doing this.  So I grabbed the index_description as index_temp_2 and added that to the description before the limiting step.

Willt

 

Attachments: 
JuanF
Offline
Donator
Joined: 6 years
Last seen: 3 weeks

Many thanks DogLover,

 

Works fine....

 

Best Regards

Log in or register to post comments

Brought to you by Jan van Straaten

Program Development - Jan van Straaten ------- Web design - Francis De Paemeleere
Supported by: servercare.nl