TOOLSP
"
WELCOME !

Please ! Use [CODE] tags for your LINKS and CODE.
Favor usar balisas [CODE] para sus vínculos y código.
Merci d'utiliser les balises [CODE] pour vos liens et code.

[code]http://Thank.you[/code]
"
*** GITHUB ***
.
.
URL Resolver [GIT]
.
.
.
.
Jx Update [REDIRECT]
.
.
*** Associated ***
.
Pastebin Your list online
.
mediafire Upload Files
.
imgur Upload Pics
lyngsat TV logos collection
transparent .png
.
http://hola.org free? VPN
Hola.apk free? VPN App.
.
hidester- free Proxy
.
webgrabplus EPG - Eng
xmltv EPG - Fr
kazer EPG - Fr
.
.wordreference Traduction
.
mail.com (fast sign-in)
.
.
Latest topics
» Regex for my favori serie
Sun 24 Sep - 21:12 by beezlo

» help regex
Fri 22 Sep - 21:08 by mickydoo

» I need i little help please!
Wed 20 Sep - 18:24 by jujuuj

» some help with vaughn or ustream .TV
Wed 20 Sep - 0:56 by adrianhn

» Xbmc tool box / Xbmc gui (Kodi)
Mon 18 Sep - 18:16 by oxus

» how to play this in kodi
Mon 11 Sep - 8:25 by retrorat1

» Where to put your list
Sun 10 Sep - 14:29 by oxus

FRIENDS / PARTNERS

forum

créer un forum


Regex Within a Channel

View previous topic View next topic Go down

Regex Within a Channel

Post by retrorat1 on Sat 22 Apr - 16:42

Hi All
I know this has been made to be suited to be more a tutorial page but was wondering if this is possible to do?
I have taken the example for the channel making
Code:
<channels>

    <channel>
    <name>New Hope Church</name>
     <regex>
      <name>yt-badge-live</name
      <express>[color=#FF0000]dont know what to put here lol but if this is on the yt page yt-badge-live" >Live now Then it should place it in the title[/color]</express>
    <thumbnail>http://www.findjesus.tv/picture_library/findJesus.jpg</thumbnail>
    <fanart>http://goo.gl/dtB8T9</fanart>
        <items>
            <item>
                <title>New Hope SDA Church Live Stream $dorege[yt-badge-live]</title>
                <link>plugin://plugin.video.youtube/play/?video_id=$doregex[getID]</link>
                <regex>
                <name>getID</name>
                <expres>data-context-item-id="([^"]+)</expres>
                <page>https://www.youtube.com/channel/UCVAmiFwV2Azq4vZ5h4bVj5A</page>
               </regex>
                <thumbnail>http://www.findjesus.tv/picture_library/findJesus.jpg</thumbnail>
                <fanart>http://goo.gl/dtB8T9</fanart>
            </item>

            <item>
               <title>Sermons</title>
               <link>ignorme</link>
               <jsonrpc>plugin://plugin.video.youtube/channel/UCVAmiFwV2Azq4vZ5h4bVj5A/playlist/PLwRbRhLoHaii8jAU8XXlCo1ZMEsr0vRhC/</jsonrpc>
               <thumbnail>https://i.ytimg.com/vi/b2yFnRyw558/hqdefault.jpg</thumbnail>
           </item>
        </items>
    </channel>

So basically if the channel is live it will show live now in the title if not it will not show anything.
Hope it makes sence
Thanks

retrorat1

Messages : 16
Date d'inscription : 2017-04-17

View user profile

Back to top Go down

Re: Regex Within a Channel

Post by jujuuj on Sat 22 Apr - 18:45

no regex in a channel, but in an item

no $doregex in a <title>

no double s,  in <expres>

no ... way !  That would be easier to find jesus for true ...  Wink

I don't know exactly what you want, but you might considere to build an expres that only grabs title that include the word Live
something like that:
<expres> .............(.*?Live.*?)............
avatar
jujuuj

Messages : 88
Date d'inscription : 2017-03-28

View user profile

Back to top Go down

Re: Regex Within a Channel

Post by retrorat1 on Sat 22 Apr - 22:48

My Addon is for live streaming of churches there are over 100 churches from Australia to US a lot of them stream from you tube which has the facility to show that the channel is live.
I follow as many as i can and add "Now Live" in the title but it is not practical so was looking for an easy way.
The principle is simple if yt-badge-live present show title 2 if not show tittle 1 lol
<title>Hope Church</title>
<title2>Hope Church Live Now</title2>
I know it is said that it cannot be done this way but there must be some way to incorporate it.

retrorat1

Messages : 16
Date d'inscription : 2017-04-17

View user profile

Back to top Go down

Re: Regex Within a Channel

Post by twogun on Thu 27 Apr - 1:54

Newest verion of LSP allows you to call regex from title

https://www.tvaddons.ag/forums/shanis-addon-repository/24190-release-livestreamspro-225.html#post412509

Thanks Retrorat1 for pushing the issue on this with Shani. I've been wanting this added to LSP for a long time. Now if only you could call regex from the info and thumbnail tags.
avatar
twogun

Messages : 33
Date d'inscription : 2017-04-03

View user profile

Back to top Go down

Re: Regex Within a Channel

Post by retrorat1 on Thu 27 Apr - 9:05

Lol Yes Twogun this is the 3rd time I have asked for it but this time I think I made it a bit more clearer what I needed.
But I am still stuck as to what expression to use
Code:
<item>
<title>Amazing Facts TV [COLOR yellow]$doregex[getliveflag][/COLOR]</title>
<link>plugin://plugin.video.youtube/play/?video_id=$doregex[getID]</link>
<regex>
<name>getliveflag</name>
<expres>span class="yt-badge</expres>
<page>https://www.youtube.com/channel/UCVAmiFwV2Azq4vZ5h4bVj5A</page>
</regex>
<regex>
<name>getID</name>
<expres>data-context-item-id="([^"]+)</expres>
<page>https://www.youtube.com/channel/UC6VJE6cD8ZPpe6ZOtVtlBTA</page>
</regex>
<thumbnail>https://lh3.googleusercontent.com/LtoXBkeNAb_AbqEn29AFWkQW5fc1uvblpvY-tV_O4nS8plcECNXaWJeUgsaTuX5O-dtd_w=s85</thumbnail>
<fanart>http://fluidm.in/wp-content/uploads/2015/11/television.jpg</fanart>
</item>
It needs an if available then "Live Now" should show, if not Just the title should display and the video should play as well.
So it might have to be with something along this line(which I have no clue about)
IDs = re.findall('(?s)Live now.*?yt-badge-live".+?>(?:Live.*?)
if i am not mistaken
But if not live it shouldnt give an error but just play as normal , which will be the last uploaded video.
Is this right or am I totally overthinking this?
Thanks

retrorat1

Messages : 16
Date d'inscription : 2017-04-17

View user profile

Back to top Go down

Re: Regex Within a Channel

Post by twogun on Thu 27 Apr - 23:22

Try this. I'm not sure what the page looks like when the stream is live, but I compared it to the NASA Youtube channel which is live, and I believe this should work. The getliveflag regex return either Live Now, or Archive. Depending on the status. You can change the 'Archive' to any other message you want (most recent, sermon, service, etc) or leave it empty between the ' ' if do not want the status returned on archived videos.

Hope this works for you.

Code:
<item>
<title>Amazing Facts TV [COLOR yellow] ($doregex[getliveflag])[/COLOR]</title>
<link>plugin://plugin.video.youtube/play/?video_id=$doregex[getID]</link>

<regex>
<name>getliveflag</name>
<expres><![CDATA[#$pyFunction
def GetLSProData(page_data,Cookie_Jar,m):
  import re
  try:
      return re.findall('yt-badge-live" \W(Live now)', page_data)[0]
  except:
      return 'Archive'
]]></expres>
<page>https://www.youtube.com/channel/UCVAmiFwV2Azq4vZ5h4bVj5A</page>
</regex>

<regex>
<name>getID</name>
<expres>data-context-item-id="([^"]+)</expres>
<page>https://www.youtube.com/channel/UC6VJE6cD8ZPpe6ZOtVtlBTA</page>
</regex>
<thumbnail>https://lh3.googleusercontent.com/LtoXBkeNAb_AbqEn29AFWkQW5fc1uvblpvY-tV_O4nS8plcECNXaWJeUgsaTuX5O-dtd_w=s85</thumbnail>
<fanart>http://fluidm.in/wp-content/uploads/2015/11/television.jpg</fanart>
</item>
avatar
twogun

Messages : 33
Date d'inscription : 2017-04-03

View user profile

Back to top Go down

Re: Regex Within a Channel

Post by retrorat1 on Fri 28 Apr - 1:03

Twogun It worked perfectly in LSP. Anyone knows what file was added to make this work , I might need to add the same file to my addon as it pulls but without the desired results.
It displays Amazing Facts TV :$doregex[getliveflag] in my addon, but in LSP Amazing Facts TV :Live Now which is what I had asked for lol.

retrorat1

Messages : 16
Date d'inscription : 2017-04-17

View user profile

Back to top Go down

Re: Regex Within a Channel

Post by retrorat1 on Fri 28 Apr - 1:07

Code:
<channels>

    <channel>
    <name>Amazing Facts TV</name>
    <thumbnail>https://lh3.googleusercontent.com/LtoXBkeNAb_AbqEn29AFWkQW5fc1uvblpvY-tV_O4nS8plcECNXaWJeUgsaTuX5O-dtd_w=s85</thumbnail>
    <fanart>http://fluidm.in/wp-content/uploads/2015/11/television.jpg</fanart>
        <items>
            <item>
                <title>Amazing Facts TV [COLOR green] :$doregex[getliveflag][/COLOR]</title>
<link>plugin://plugin.video.youtube/play/?video_id=$doregex[getID]</link>

<regex>
<name>getliveflag</name>
<expres><![CDATA[#$pyFunction
def GetLSProData(page_data,Cookie_Jar,m):
  import re
  try:
      return re.findall('yt-badge-live" \W(Live now)', page_data)[0]
  except:
      return 'Last Uploaded Video'
]]></expres>
<page>https://www.youtube.com/channel/UC6VJE6cD8ZPpe6ZOtVtlBTA</page>
</regex>

<regex>
<name>getID</name>
<expres>data-context-item-id="([^"]+)</expres>
<page>https://www.youtube.com/channel/UC6VJE6cD8ZPpe6ZOtVtlBTA</page>
</regex>
<thumbnail>https://lh3.googleusercontent.com/LtoXBkeNAb_AbqEn29AFWkQW5fc1uvblpvY-tV_O4nS8plcECNXaWJeUgsaTuX5O-dtd_w=s85</thumbnail>
<fanart>http://fluidm.in/wp-content/uploads/2015/11/television.jpg</fanart>
</item>

            <item>
              <title>Facts of Faith</title>
              <link>ignorme</link>
              <jsonrpc>plugin://plugin.video.youtube/channel/UCVAmiFwV2Azq4vZ5h4bVj5A/playlist/PL4PwK7QaFAuiKTiLqqE0f0hFKCoGWM6cI/</jsonrpc>
              <thumbnail>https://lh3.googleusercontent.com/YRBV2rEjzYxQvB3FUL7Kk4xOfb9-GiBdaYIHhKvYEfq6Il0cF3mY4XqcJnpH5UKM40jW=s152</thumbnail>
          </item>
        </items>
    </channel>
This is what i am planning to do for the 110 churche folders, If it works with my addon for the Live Now part.

retrorat1

Messages : 16
Date d'inscription : 2017-04-17

View user profile

Back to top Go down

Re: Regex Within a Channel

Post by jujuuj on Tue 2 May - 23:38

twogun wrote:Newest verion of LSP allows you to call regex from title

https://www.tvaddons.ag/forums/shanis-addon-repository/24190-release-livestreamspro-225.html#post412509

Thanks Retrorat1 for pushing the issue on this with Shani.  I've been wanting this added to LSP for a long time.  Now if only you could call regex from the info and thumbnail tags.

oh really !

Thanks shani ! ... And both of you for info and examples
avatar
jujuuj

Messages : 88
Date d'inscription : 2017-03-28

View user profile

Back to top Go down

Re: Regex Within a Channel

Post by jujuuj on Sun 7 May - 13:04

retrorat1 wrote:Twogun It worked perfectly in LSP.  Anyone knows what file was added to make this work , I might need to add the same file to my addon as it pulls but without the desired results.
It displays Amazing Facts TV  :$doregex[getliveflag] in my addon, but in LSP Amazing Facts TV :Live Now which is what I had asked for lol.

it only works with the newest LSP ... So you should compare the zips ... or directly ask to shani ...
avatar
jujuuj

Messages : 88
Date d'inscription : 2017-03-28

View user profile

Back to top Go down

Re: Regex Within a Channel

Post by twogun on Thu 11 May - 3:25

@Retrorat1
I took the time to backported Shani's regex in title/thumbnail code to your plugin's default.py files.
Hopefully this will be helpful.  Of course you still have the limitation of not being able to use python block so I rewrote the youtube regex to avoid it.

i gave it a quick test and everything seems to work fine,  but you probably want to give it a good test before implementing.  Just to make sure I didn't break anything.  Not really a concern, but It doesn't hurt to be careful.

New py:
raw:
https://pastebin.com/raw/5t0er6Km
non-raw (in case you want to use the 'download' link):
https://pastebin.com/5t0er6Km

New Youtube (live now) title regex:
Code:
<item>
<title>Amazing Facts TV [COLOR yellow] ($doregex[online])[/COLOR]</title>
<link>plugin://plugin.video.youtube/play/?video_id=$doregex[getID]</link>

<regex>
<name>online</name>
<expres>$pyFunction: 'Live now' if '$doregex[live]'=='Live now' else 'Archive'</expres>                                                                              
<page></page>
</regex>

<regex>
<name>live</name>
<expres>yt-badge-live" \W(Live now)</expres>                                                                              
<page>https://www.youtube.com/channel/UC6VJE6cD8ZPpe6ZOtVtlBTA</page>
</regex>
<regex>
<name>getID</name>
<expres>data-context-item-id="([^"]+)</expres>
<page>https://www.youtube.com/channel/UC6VJE6cD8ZPpe6ZOtVtlBTA</page>
</regex>
<thumbnail>https://lh3.googleusercontent.com/LtoXBkeNAb_AbqEn29AFWkQW5fc1uvblpvY-tV_O4nS8plcECNXaWJeUgsaTuX5O-dtd_w=s85</thumbnail>
<fanart>http://fluidm.in/wp-content/uploads/2015/11/television.jpg</fanart>
</item>

latter,
2GUN
avatar
twogun

Messages : 33
Date d'inscription : 2017-04-03

View user profile

Back to top Go down

Re: Regex Within a Channel

Post by retrorat1 on Tue 16 May - 9:13

Extremely Sorry for not responding earlier , I was tied up , Will try it today and get back to you.
Thanks ever so much for the work you have helped me do.

retrorat1

Messages : 16
Date d'inscription : 2017-04-17

View user profile

Back to top Go down

Re: Regex Within a Channel

Post by jujuuj on Tue 16 May - 16:27

no problemo amigo !  life is like that ...
avatar
jujuuj

Messages : 88
Date d'inscription : 2017-03-28

View user profile

Back to top Go down

Re: Regex Within a Channel

Post by retrorat1 on Wed 17 May - 0:51

Twogun , Worked perfectly Thank you I can sleep a bit more now then staying up to type live now for each channel like i did in the past.
done Oceanic countries and Asia already with your new code now Europe and the Us to do 87 in total lol. but should be done by the time the first service starts Friday night in New Zealand.
Thank you once again

PS did you find how to call regex form info and thumbnails yet?

retrorat1

Messages : 16
Date d'inscription : 2017-04-17

View user profile

Back to top Go down

Re: Regex Within a Channel

Post by twogun on Wed 17 May - 15:43

@Retrorat1
I'm glad it works for you.

Regex in Thumbnails was introduced at the same time Regex in Title was.  I had overlooked it. Regex is still not supported in info tags.
Also regex in Thumbnail will work your updated pluggin. For the youtube just use the $doregex[getID] like this:

Code:
<thumbnail>https://i.ytimg.com/vi/$doregex[getID]/hqdefault.jpg</thumbnail>
avatar
twogun

Messages : 33
Date d'inscription : 2017-04-03

View user profile

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum