You are here

[SOLVED] Moving some data from title to subtitle

8 posts / 0 new
Last post
goibe
Offline
Joined: 10 years
Last seen: 3 years
[SOLVED] Moving some data from title to subtitle

Hi.
I do't know if it can be done, when I grab the data sometimes I want to change the title data so that media center can record the series telling to record one time, and without having to do this every week or day; for example. NBA: MIAMI-INDIANA  I want to be NBA in the title and MIAMI-INDIANA in the subtitle.
Also when I grab the data from elmundo appears in the title; Documentales: something, Cine: something and so on, and Documentales should be in category field, they have change somethig because previously wasn't doing this.
Thanks.
 

WGMaker
Offline
WGMaker's picture
WG++ Team memberDonator
Joined: 11 years
Last seen: 52 min
Is the support helpful?
support us

Hi Goibe
what you ask is easy to do. But I need to know which siteini you use .
 
The elmundo issue is solved by the attached siteini
 
Jan

Attachments: 
goibe
Offline
Joined: 10 years
Last seen: 3 years

Thanks Jan.
I use various site inis but the most channels I grab from elmundo, if you give me an example of the modification that I need to do I will do it by myself.

goibe
Offline
Joined: 10 years
Last seen: 3 years

An example in elmundo.ini? please!
Thanks.
 

WGMaker
Offline
WGMaker's picture
WG++ Team memberDonator
Joined: 11 years
Last seen: 52 min
Is the support helpful?
support us

Hi Goibe,
the reason I hesitated a while to reply is that there are several ways to do that. And it take too far to explain them all. Of course you can try to find all these ways by studying the manual, but I realise that is a lot of studying for a casual 'editor' of siteini's. So I give you the two most usual ways:
 
1. Directly when you scrub the title:
Normally you have something like
 
title.scrub {single|bs|es|ee|be} * read 4.2.1 of the manual
 
Here you can directly separate a part of the title by specifying the argument separator together with include  or  exclude (see 4.2.5.2 of the manual), like this
 
title.scrub {single(separator=": " include=first)|bs|es|ee|be}
 
This will split the scrubbed title at the string ": " and includes the first part in the title. After that you can put the second part in another element but specifying the same scrubstring bs|es|ee|be and excluding this first part: (by using exclude you are sure that nothing comes into the subtitle if there was no separator string ": " in the title)
 
subtitle.scrub {single(separator=": " exclude=first)|bs|es|ee|be}
 
There are a lot of variants of this first method, but this is the essential
2. After the title is scrubbed by means of a modify command. Suppose a title like your example: NBA: MIAMI-INDIANA 
The easiest is to split the title in two. To understand what I mean please read the difference between a single value and a multi value element in 4.6.1.3 of the manual. It explain the special purpose of the element separator character | . Following this you can split the title in two by specifying:
 
title.modify {replace|: |\|}  This replace the ": " in a "|", which is interpreted by the program as that the title now has two values : NBA   and MIAMI-INDIANA.
 
Eventually you can do that under a condition , for example if you only want this done if the title contains the string NBA you can use
 
title.modify {replace('title' ~ "MBA")|: |\|}  see more about conditional arguments in 4.6.2
 
Both of the split values of title can now be manipulated individually by using indices (more of that in 4.6.1.4) . First we will copy the second part MIAMI-INDIANA to the subtitle :
 
subtitle.modify {substring(type=element)|'title' 1 1}
 
This take the second (index 1) value of 'title' and places it in the subtitle. (for substring see 4.6.4.3).
If there is already a value in the subtitle which you want to keep you must first copy the title part in a temp element and then add it to the subtitle :
 
temp_1.modify {substring(type=element)|'title' 1 1}
subtitle.modify {addstart('temp_1' not "")|'temp_1'. }

 
Then you can remove the second part of the title. Here again you have several ways:
 
title.modify {substring(type=element)|'title' 0 1} * extracts only the first (index 0) of the two
title.modify {remove(type=element)|'title' 1 1} * removes the title part with index 1 (second part)

or if you have the second part in temp_1

title.modify {remove|'temp_1'}  * removes the string value of 'temp_1'
 
This last method has a lot more variants and possiblities but this gives you an idea.
 
I hope you understand now why I hesitated a while ..
If you want to try you will need the argument debug (see 4.2.5.5)
 
Hopes this helps    ...   Jan

 
 

goibe
Offline
Joined: 10 years
Last seen: 3 years

Thanks very much for the reply, and sorry if I'm impatient. I understand why you hesitated a while and on the other hand you will have a life, and as is a free software you don't have to apologize.
I agree that is so much information in the manual for a casual editor, but with your tips is much easier.
Thanks for your patient, and for develop this great program.

WGMaker
Offline
WGMaker's picture
WG++ Team memberDonator
Joined: 11 years
Last seen: 52 min
Is the support helpful?
support us

No, that is not supported. However there is a way although a little more complex. It works by getting the logical function 'condition1 AND condition2' in a temp element first, something like this:
 
temp_1.modify {calculate('title' ~ "MBA" format=F0)|0 1 +} * will be 1 if condition true
temp_1.modify {calculate('index_variable_element' ~ "CHANNELNAME" format=F0)|1 +}  * will be 2 if both condition true else < 2
*now you can:
title.modify {replace('temp_1' = 2)|: |\|}
 
Explanation of why I use 'index_variable_element' in the second pre-conditional : 'channel' (as in your example) is not a WG++ element name. I assume you want any one of the the available channel values from the config channel list (xmltv_id or display_name or site_id or site_channel) You can only get them via the element index_variable_element (see 4.5.3 of the manual). So before the three lines above, fill the index_variable_element like this:
index_variable_element.modify {addstart|'config_xmltv_id'} * or any of the other three
 
Hope this helps      ..  Jan
 

francis
Offline
francis's picture
Has donated long time agoWG++ Team member
Joined: 11 years
Last seen: 1 week
Is the support helpful?
support us
index_temp_6 = "2"

instead of

index_temp_6 = 2

?

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