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


Xbmc tool box / Xbmc gui (Kodi)

Page 1 of 2 1, 2  Next

View previous topic View next topic Go down

Xbmc tool box / Xbmc gui (Kodi)

Post by jujuuj on Thu 25 May - 19:35

Kodi is able to open windows with text inside of it.

U can use LiveStreamsPro to call, open a window.

Here an example of info-box, or " OK BOX " as u may want to inform a user of something before opening a link (=a video, a stream), or a new page (= another list called by externallink)

Code:

<item>
<title>OK  BOX</title>
<thumbnail></thumbnail>
<link>no</link>
<externallink>$doregex[openDialog]</externallink>
<regex>
<name>openDialog</name>
<expres><![CDATA[#$pyFunction
import xbmcaddon
import xbmcgui
def GetLSProData(page_data,Cookie_Jar,m):
    title = "Hello !"  
    line1 = "I"
    line2 = "LOVE"
    line3 = "LSP"
    xbmcgui.Dialog().ok(title, line1, line2, line3)
    return "http://pastebin.com/raw/XXXXXXXX"
]]></expres>
<page></page>
</regex>
</item>

If you use this as an introduction to your list/world, it will "refresh" or "reload" your list (of the return " " line) everytime you'll click on the OK ! ... so users won't use anymore an outdated home-page-list (without knowing it).

if you don't want to open a list, but just a link,
u will have to use this code for the <link> line :  <link>$doregex[openDialog]</link>
and delete the <externallink> line
and put your link(stream) on the  return " "  line
(this last one can be a direct link http;// ... or a $doregex[getlink] if u need it ...)
avatar
jujuuj

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

View user profile

Back to top Go down

Re: Xbmc tool box / Xbmc gui (Kodi)

Post by JonnyB on Fri 26 May - 10:58

Hi,

Great tip.

It's possible to center the text?

Thanks

JonnyB

Messages : 9
Date d'inscription : 2017-04-18

View user profile

Back to top Go down

Re: Xbmc tool box / Xbmc gui (Kodi)

Post by twogun on Fri 26 May - 13:53

Sometime you may want a something less upfront.  In this case a simple notification window may be a more eloquent solution. Also it's very simple.

example code:
Code:
<item>
<title>Now Playing Notification - Big Buck Bunny</title>
<link>$doregex[notice]</link>
<regex>
<name>notice</name>
<expres><![CDATA[#$pyFunction
def GetLSProData(page_data,Cookie_Jar,m):
  import xbmc
  xbmc.executebuiltin("XBMC.Notification(LiveStreamsPro,Now playing: [COLOR green]Big Buck Bunny.[/COLOR] ,5000)")
  return 'http://www.quirksmode.org/html5/videos/big_buck_bunny.mp4'
]]></expres>
<page></page>
</regex>
</item>

If you want you can do like jujuuj did in his post above and define the items as variables and place the variables in the notification line.  I just wanted to keep the example short so it would be easier to understand.


Last edited by twogun on Fri 26 May - 22:15; edited 1 time in total (Reason for editing : it's a secret.)
avatar
twogun

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

View user profile

Back to top Go down

Re: Xbmc tool box / Xbmc gui (Kodi)

Post by jujuuj on Sat 27 May - 13:54

JonnyB wrote:Hi,

Great tip.

It's possible to center the text?

Thanks

no, i don't think ... use [espace][espace][espace][espace][espace]  Wink
however, with some skins (titan) the text is automatically centered ...

Note :
maximum 3 lines + the title, in this tool box.
' is not allowed.
avatar
jujuuj

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

View user profile

Back to top Go down

Re: Xbmc tool box / Xbmc gui (Kodi)

Post by jujuuj on Sat 27 May - 14:13

unless u prefer to be more eloquent ...
my solution has more details !

Code:

<item>
<title>Big Buck Bunny
OK  BOX  to a link</title>
<link>$doregex[openDialog]</link>
<regex>
<name>openDialog</name>
<expres><![CDATA[#$pyFunction
def GetLSProData(page_data,Cookie_Jar,m):
    import xbmcgui, xbmcaddon
    __addon__ = xbmcaddon.Addon()
    __addonname__ = __addon__.getAddonInfo('name') 
    line1 = "            [COLOR green] Big Buck Bunny[/COLOR]"
    line2 = "Produced by Ton Roosendaal"
    line3 = "Directed & Written by Sacha Goedegebure"
    xbmcgui.Dialog().ok(__addonname__, line1, line2, line3)
    return 'http://www.quirksmode.org/html5/videos/big_buck_bunny.mp4'
]]></expres>
<page></page>
</regex>
</item>
avatar
jujuuj

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

View user profile

Back to top Go down

Re: Xbmc tool box / Xbmc gui (Kodi)

Post by twogun on Sat 27 May - 21:20

jujuuj wrote:unless u prefer to be more eloquent ...
my solution has more details !


Comparing apples to oranges?  They may be similar but they are different.  They both have their uses.  One is more upfront and requires a response from the user.  The other is requires no response, and is place in corner out of the way.  If I wanted a quite out of the way notification I'd use notification.  It provides the info for the user who wants it, but it also easy to ignore.    If the info presented was important enough I wanted to ensure the user actually read it or agreed to it.  I would use the OK box.

jujuuj wrote:
Note :
maximum 3 lines + the title, in this tool box.
' is not allowed.

just use backslash to escape it.

Code:
   line1 = "            [COLOR green] \'Big Buck Bunny\'[/COLOR]"

you can do more with xbmc library then just provide info.  You can give the user selections to choose from. In LSP we usually use a makelist for this, but using xbmcgui provide a more polished touch.  The best use of this function I can think of would be to allow the user to select the quality of the stream.

Example:
Code:
<item>
<title>XBMC Dialog selection - Open Movies</title>
<link>$doregex[select]</link>
<regex>
<name>select</name>
<expres><![CDATA[#$pyFunction
def GetLSProData(page_data,Cookie_Jar,m):
    import xbmcgui
    dialog = xbmcgui.Dialog()
    ret = dialog.select('Choose a movie', ['Big Buck Bunny', 'Sintel', 'Tears of Steel'])
    channels = ['http://www.quirksmode.org/html5/videos/big_buck_bunny.mp4', 'http://download.blender.org/durian/movies/Sintel.2010.720p.mkv', 'plugin://plugin.video.youtube/play/?video_id=R6MlUcmOul8']
    return channels[ret]
]]></expres>
<page></page>
</regex>
</item>
avatar
twogun

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

View user profile

Back to top Go down

Re: Xbmc tool box / Xbmc gui (Kodi)

Post by JonnyB on Sun 28 May - 9:20

Hi,

This is getting interesting...

Instead of a final link it's possible to execute a different regex depending on choice from the menu?

Thanks

JonnyB

Messages : 9
Date d'inscription : 2017-04-18

View user profile

Back to top Go down

Re: Xbmc tool box / Xbmc gui (Kodi)

Post by jujuuj on Sun 28 May - 11:24

not a bad idea ... not sure it's possible though ..

that would be like that ?  (... never tried...)
Code:

    ret = dialog.select('Choose a regex ?', ['the regex 1', 'the regex 2'])
    RegexS = ['$doregex[One]','$doregex[Two]']
    return RegexS[ret]

or ... may be I should have put UNDERSLASH  \   in that :
RegexS = ['$doregex\[One\]','$doregex\[Two\]']
avatar
jujuuj

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

View user profile

Back to top Go down

Re: Xbmc tool box / Xbmc gui (Kodi)

Post by jujuuj on Sun 28 May - 11:40

twogun wrote:
jujuuj wrote:unless u prefer to be more eloquent ...
my solution has more details !


Comparing apples to oranges?  

Hmmmmm ...

twogun wrote:you can do more with xbmc library then just provide info.  You can give the user selections to choose from. In LSP we usually use a makelist for this, but using xbmcgui provide a more polished touch.  The best use of this function I can think of would be to allow the user to select the quality of the stream.

O really ? This doesn't give you a better idea ?  Well ... check it out ; this is what you could have done with your coding, a lil externallink, and my brain Very Happy

Code:


<item>
<title>SELECT A LIST  !
 </title>
<thumbnail>https://lh4.ggpht.com/DF3E0ayG74xsqc9nu_Mb-aRhJGoehCVRg_GNWUZgmueDeWVfzOYLQ4Y53cv4ezuH3w=w300</thumbnail>
<link>NA</link>
<externallink>$doregex[select]</externallink>
<regex>
<name>select</name>
<expres><![CDATA[#$pyFunction
def GetLSProData(page_data,Cookie_Jar,m):
   import xbmcgui
   dialog = xbmcgui.Dialog()
   ret = dialog.select('Choose a playlist', ['series', 'Adryanlist (ESP/LAT)', 'xxxxxxxxstreamer.m3u', 'Mister zzzzzzzz'])
   lists = ['http://pastebin.com/raw/17gq1RYK', 'http://adryanlist.org/adryan/list.xml', 'http://pastebin.com/raw/xxxxxxxx$$TSDOWNLOADER$$', 'http://pastebin.com/raw/zzzzzzzz']
   return lists[ret]
]]></expres>
<page></page>
</regex>

</item>


... "Science sans conscience n'est que ruine de l'âme" (Rabelais)
... science without conscience is but the ruin of the soul ...my dear twogun
avatar
jujuuj

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

View user profile

Back to top Go down

conditional regex or selected regex

Post by twogun on Sun 28 May - 21:10

I still believe that quality selection is the best use for it.  If I had give the example using externallink would you have comment back about how using link was a better idea?  i don't understand how making a slight change to the original code is genius?

@JonnyB, you got the basic idea.  I would prefer to put all the code in the python block instead of calling a regex, but here is an example of how you would call a selected regex.

Code:

<item>
<title>XBMC Dialog selection - Open Movies</title>
<link>$doregex[select]</link>

<regex>
<name>select</name>
<expres><![CDATA[#$pyFunction
def GetLSProData(page_data,Cookie_Jar,m):
    import xbmcgui
    dialog = xbmcgui.Dialog()
    ret = dialog.select('Choose a movie', ['Big Buck Bunny', 'Sintel', 'Tears of Steel'])
    regex = ['$doregex[bunny]', '$doregex[sintel]', '$doregex[tears]']
    return regex[ret]
]]></expres>
<page></page>
</regex>

<regex>
<name>bunny</name>
<expres>http://www.quirksmode.org/html5/videos/big_buck_bunny.mp4</expres>
<page></page>
</regex>

<regex>
<name>sintel</name>
<expres>http://download.blender.org/durian/movies/Sintel.2010.720p.mkv</expres>
<page></page>
</regex>

<regex>
<name>tears</name>
<expres>plugin://plugin.video.youtube/play/?video_id=R6MlUcmOul8</expres>
<page></page>
</regex>
</item>

Before anyone says me and @jujuuj need to calm down.  I just want to say it's just a little banter we are cool with each other. That and he started it What a Face


[ EDIT ADMIN : see also http://livestreamspro.pe.hu/wiki/index.php?n=Functions.ConditionalDoRegex ]
avatar
twogun

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

View user profile

Back to top Go down

Re: Xbmc tool box / Xbmc gui (Kodi)

Post by JonnyB on Mon 29 May - 10:56

Hi,

Great code jujuuj and twogun, thanks.

It's a nice and different ideia this way.

JonnyB

Messages : 9
Date d'inscription : 2017-04-18

View user profile

Back to top Go down

Re: Xbmc tool box / Xbmc gui (Kodi)

Post by jujuuj on Tue 30 May - 1:56

@twogun
Poor geek ... do you even use your links (I mean do you watch tv) ? who cares about big buck bunny, i have watched it 15 years ago ...

Open externallinks allows us to open our minds to other lists countries and cultures, in one click you can change of world ...
u can break ... the wall (no political message Wink)
who in the world has watched big buck danny until the end ?... man ... we need content !

as you like tool boxes, here another one.

It is a double tool box (u might have seen something similar in another thread). this one allows u to enter username of password, just an example.
Twogun, if you need it I can explain to you my code, or give you tool boxes lessons, no problemo bro

Code:



<item>
<title> xstreamer
( username = ?  password = ? )</title>             
<thumbnail></thumbnail>
<link>NA</link>
<externallink>$doregex[getinput]</externallink>

<regex>
<name>getinput</name>
<expres><![CDATA[#$pyFunction
import xbmcgui,xbmc, xbmcaddon, time
def GetLSProData(page_data, Cookie_Jar,m, txt1='Enter Username?', txt2='Enter Password?'):
    addon = xbmcaddon.Addon('plugin.video.live.streamspro')
    addon_version = addon.getAddonInfo('version')
    profile = xbmc.translatePath(addon.getAddonInfo('profile').decode('utf-8'))
    solver = InputWindow( txt=txt1)
    solution1 = solver.get()
    solver = InputWindow( txt=txt2)
    solution2 = solver.get()
    return 'http://website.com/get.php?username=' + solution1 + '&amp;password=' + solution2 + '&amp;type=m3u'

class InputWindow(xbmcgui.WindowDialog):
    def __init__(self, *args, **kwargs):
        self.txt = kwargs.get('txt','')
        xbmcgui.WindowXMLDialog.__init__(self)
        #self.addControl(self.txt)
        path = xbmcaddon.Addon().getAddonInfo('path')
        self.kbd = xbmc.Keyboard()
        self.kbd.setHeading( self.txt)
    def get(self):
        self.show()
        time.sleep(2)
        self.kbd.doModal()
        if (self.kbd.isConfirmed()):
            text = self.kbd.getText()
            self.close()
            return text
        self.close()
        return False
]]></expres>
<page></page>
</regex>
</item>
 

At least it is more intelectual than a hand-shaking competition ... (no political message Wink)

@jonnyB
I fully agree with the first half of the first sentence
avatar
jujuuj

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

View user profile

Back to top Go down

Re: Xbmc tool box / Xbmc gui (Kodi)

Post by twogun on Tue 30 May - 2:39

jujuuj wrote:@twogun
Poor geek ... do you even use your links (I mean do you watch tv) ?  who cares about big buck bunny, i have watched it 15 years ago ...

No I don't use these links.  That's why I post them in public.  I'm smart enough to keep the good stuff to myself.  Apparently you've been hitting some good stuff too.


Open externallinks allows us to open our minds to other lists countries and cultures, in one click you can change of world ...
u can break ... the wall  (no political message Wink)
who in the world has watched big buck danny until the end ?... man ... we need content !

I don't know about externallinks "opening our mind".  Maybe it's that "good stuff" opening your mind. I'm glad it works so well for you, but the zealous over promotion of this feature is tiresome.  Are you going to brag about using the thumbnail tag next?


as you like tool boxes, here another one.

It is a double tool box (u might have seen something similar in another thread). this one allows u to enter username of password, just an example.
Twogun, if you need it I can explain to you my code, or give you tool boxes lessons, no problemo bro

I do remember seeing something similar on the forum.  I also remember posting it.  So I'll have to say "No thanks, I don't need you to explain my code to me."  


At least it is more intelectual than a hand-shaking competition ... (no political message Wink)

I believe you mean "intellectual".  I'm not that picky about spelling. just thought it was funny that it was this word that you miss-spelled.
avatar
twogun

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

View user profile

Back to top Go down

Re: Xbmc tool box / Xbmc gui (Kodi)

Post by twogun on Tue 30 May - 2:50

This next code allow you to search youtube via input window.  It will return the next 10 pages of results (or the max number of pages if it is less then 10 pages)

@jujuuj feel free to use this to search for "Big Buck Bunny"

In all seriousness though.  You could easily edit this to give a second input window asking for the number of pages you wish to limit the search to.

Code:

<item>
<title>xbmc input windows. Youtube Search 10 pages</title>
<link>$doregex[makelist]</link>
<thumbnail>http://vignette3.wikia.nocookie.net/logopedia/images/7/76/Youtube-logo_2005-2009.jpg</thumbnail>
<regex>
<name>makelist</name>
<listrepeat><![CDATA[
<title>[makelist.param2]</title>
<link>$doregex[resolve]</link>
<thumbnail>https://i.ytimg.com/vi/[makelist.param1]/hqdefault.jpg</thumbnail>
]]></listrepeat>
<expres>u'(.+?)', u'(.+?)'</expres>
<page>$doregex[search]</page>
</regex>

<regex>
<name>resolve</name>
<expres><![CDATA[#$pyFunction
import urlresolver
def GetLSProData(page_data,Cookie_Jar,m):
 url = 'https://www.youtube.com/watch?v=[makelist.param1]'
 streamLink = urlresolver.resolve(url)
 return streamLink
]]></expres>
<page></page>
</regex>

<regex>
<name>search</name>
<expres><![CDATA[#$pyFunction
import requests,xbmcgui,xbmc, re,time, xbmcaddon
def GetLSProData(page_data,Cookie_Jar,m):

 text=takeInputFortext('Enter search string')
 url = 'https://www.youtube.com/results?q=' + text.replace(' ', '+')
 req = requests.get(url)
 list1 = re.findall('yt-lockup-c.+?a\shref=".watch.v=([^"]+)".+?\s\stitle="([^"]+)"\s', req.text)

 count = 10
 while count > 1:
   try:
     url = 'https://www.youtube.com' + re.findall('a href="([^"]+)".+Next', req.text)[0]
   except:
     return list1
   req = requests.get(url)
   list2 = re.findall('yt-lockup-c.+?a\shref=".watch.v=([^"]+)".+?\s\stitle="([^"]+)"\s', req.text)
   list1 = list1 + list2
   count = count - 1
 return list1

def takeInputFortext(txt):
 addon = xbmcaddon.Addon('plugin.video.live.streamspro')
 addon_version = addon.getAddonInfo('version')
 profile = xbmc.translatePath(addon.getAddonInfo('profile').decode('utf-8'))
 
 solver = InputWindow( txt=txt)
 solution = solver.get()
 return solution

class InputWindow(xbmcgui.WindowDialog):
    def __init__(self, *args, **kwargs):
        
        self.txt = kwargs.get('txt','')

        xbmcgui.WindowXMLDialog.__init__(self)
        #self.addControl(self.txt)
        path = xbmcaddon.Addon().getAddonInfo('path')
        self.kbd = xbmc.Keyboard()
        self.kbd.setHeading( self.txt)

    def get(self):
        self.show()
        time.sleep(2)
        self.kbd.doModal()
        if (self.kbd.isConfirmed()):
            text = self.kbd.getText()
            self.close()
            return text
        self.close()
        return False
]]></expres>
<page></page>
</regex>
</item>
avatar
twogun

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

View user profile

Back to top Go down

Re: Xbmc tool box / Xbmc gui (Kodi)

Post by jujuuj on Tue 30 May - 11:38

Open his mind is for example try to communicate with someone strange in a foreign language ...

I am so sorry for having forgotten the second L of intelLectual, this is an unforgivable mistake, considering that the french bring that latin word in the vocabulary of your ancesters ... the word ... and probably the notion of intelligency.
Sometimes I wonder what would be your language without us ...
(then I remember of Caesar ...  Wink)
Actually I never thought you will notice that missing letter, as in your country you watch adds on TV in classrooms

About the double tool box ... You are lucky there is an ocean between us. I wrote the first double tool box code, and then u cleaned it. So .. you come somewhere and clean something then it is yours ? (no political message Wink)

I must admit that your last youtube search box is nice ... where did u robbed it ?  Very Happy  
However this box can be optimized, I am sure that we can have different results with a better  tool ... especially with name of singers ... I'll work on it latter ...


Last edited by jujuuj on Tue 30 May - 11:44; edited 1 time in total
avatar
jujuuj

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

View user profile

Back to top Go down

Re: Xbmc tool box / Xbmc gui (Kodi)

Post by jujuuj on Tue 30 May - 11:41

looks like we forgot the yes/no box ...

here an example ... I precise that I didn't built it, as some people around here are taking copyrights very seriously ...

Code:

<item>
<title>YES/NO  BOX  </title>
<thumbnail></thumbnail>
<link>non</link>
<externallink>$doregex[openDialog]</externallink>
<regex>
<name>openDialog</name>
<expres><![CDATA[#$pyFunction
import xbmcaddon
import xbmcgui
def GetLSProData(page_data,Cookie_Jar,m):
    title = "      Question      "  
    line1 = "Do you think"
    line2 = "that Twogun "
    line3 = "is crazy ?"
  ok = xbmcgui.Dialog().yesno(title, line1, line2, line3)
    if ( not ok ):
     return "http://pastebin.com/raw/83PyMhip"
    else :
     return "http://pastebin.com/raw/Jr7stQp3"
]]></expres>
<page></page>
</regex>
<fanart></fanart>
</item>
avatar
jujuuj

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

View user profile

Back to top Go down

Re: Xbmc tool box / Xbmc gui (Kodi)

Post by twogun on Tue 30 May - 17:33

jujuuj wrote:I precise that I didn't built it, as some people around here are taking copyrights very seriously ...
Actually I could care less about copyright of code posted in the open forum.  You use mine, I'll use yours.  But when you insinuate I don't understand the code by giving a personal invite to explain it. When the truth is I was the one who repaired your broken code because you did not understand.  


Open his mind is for example try to communicate with someone strange in a foreign language ...

We all know what it means.  Thanks professor.


I am so sorry for having forgotten the second L of intelLectual, this is an unforgivable mistake, considering that the french bring that latin word in the vocabulary of your ancesters ... the word ... and probably the notion of intelligency.
Sometimes I wonder what would be your language without us ...
(then I remember of Caesar ...  Wink)
Actually I never thought you will notice that missing letter, as in your country you watch adds on TV in classrooms

Really?  You are going to attack my country?  I'm not going that low.  Trust me, these twoguns have plenty of ammo, but I'll refrain.  Also if you want to insult my country don't just base it on slanderous hearsay.


About the double tool box ... You are lucky there is an ocean between us. I wrote the first double tool box code, and then u cleaned it. So .. you come somewhere and clean something then it is yours ? (no political message Wink)

Correction.  Cleaned up and fixed.  Actually you used the class "InputWindow(xbmcgui.WindowDialog):" from shani's example on how to password protect playback.  But apparently you understood the code so little that you thought it was necessary to duplicate the entire class instead of just calling the class again with different variables.  Also, in the original example the username and password needed to be encoded and added to the header.  Which to be honest I didn't know it needed encoded until I got access to the server.


I must admit that your last youtube search box is nice ... where did u robbed it ?  Very Happy  
However this box can be optimized, I am sure that we can have different results with a better  tool ... especially with name of singers ... I'll work on it latter ...

It is unique code, and it is my own implementation. With that said, We all know the resolve regex is the same urlresolver code seen all over the TVaddons forum.  The part of the code that renders the search dialog is modified from a tutorial.  I can use a tutorials can't I?  It wouldn't hurt you to use one.  

Allow me to cool down the trash talk long enough to make a suggestion. I heavily rely on this site for reference:

https://alwinesch.github.io/group__python.html

I think it would be a good idea for toolsp.forumactif.com to have a front page link to this and similar resources. I await your feedback.


Last edited by twogun on Wed 31 May - 12:36; edited 9 times in total
avatar
twogun

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

View user profile

Back to top Go down

Re: Xbmc tool box / Xbmc gui (Kodi)

Post by twogun on Tue 30 May - 17:40

An example of Shani's code to password protect playback.  It was mentioned above.  It is pretty simple code and you can easily modify for other purposes.  Both me and @jujuuj have posted code that makes use of the class "InputWindow"

At the request @jujuuj, I've used Big Buck Bunny yet again.

Code:

<item>
<title>Password protected  - Big Buck Bunny (password = test)</title>
<link>$doregex[getinput]</link>

<regex>
<name>getinput</name>

<expres><![CDATA[#$pyFunction
import xbmcgui,xbmc, xbmcaddon, time

def GetLSProData(page_data,Cookie_Jar,m,txt='Enter Password?'):
    addon = xbmcaddon.Addon('plugin.video.live.streamspro')
    addon_version = addon.getAddonInfo('version')
    profile = xbmc.translatePath(addon.getAddonInfo('profile').decode('utf-8'))

    solver = InputWindow( txt=txt)
    solution = solver.get()
    if solution == 'test':
        return play()
    else:
        return ''

class InputWindow(xbmcgui.WindowDialog):
    def __init__(self, *args, **kwargs):

        self.txt = kwargs.get('txt','')

        xbmcgui.WindowXMLDialog.__init__(self)
        #self.addControl(self.txt)
        path = xbmcaddon.Addon().getAddonInfo('path')
        self.kbd = xbmc.Keyboard()
        self.kbd.setHeading( self.txt)

    def get(self):
        self.show()
        time.sleep(2)
        self.kbd.doModal()
        if (self.kbd.isConfirmed()):
            text = self.kbd.getText()
            self.close()
            return text
        self.close()
        return False

def play():
    return 'http://www.quirksmode.org/html5/videos/big_buck_bunny.mp4'
]]></expres>
<page></page>
</regex>
</item>
avatar
twogun

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

View user profile

Back to top Go down

Re: Xbmc tool box / Xbmc gui (Kodi)

Post by jujuuj on Wed 31 May - 19:01

What ?

where is the damn "report" button ?? No more big buck bunny !! How do you want me to calm down if every time i click on your items it opens big buck danny ? Is it the only autorized movie in America ?

OK ... let's say the truth ... Twogun is my best provider in tool boxes, and he is not responsible for having born there ... Wink
hihihi  joking Smile  I love USA, please don't put me in your lists  Wink  Very Happy

hmmm ...  Let me see ...
Code:

  <item>
<title>"Book"  BOX</title>
<link>$doregex[text]</link>
<regex>
<name>text</name>
<expres><![CDATA[#$pyFunction
def GetLSProData(page_data,Cookie_Jar,m):
    import xbmcgui
    dialog = xbmcgui.Dialog()
    dialog.textviewer('I have the biggest box !', 'This is where you put a bunch of stuff.  Like a wall of text.  Write a book if you want. U can write everything u want but watch out because twogun is reading ! Yes this is a nice big box ... Where did I robbed it ? ... Anyway ... Once upon a time in a field, there were a big stupid rabbit called buck and he was passing all his day watching tv and drinking beers in front of the NBA. So he was very happy and he decided to drink one more and.. i can\'t remember the end I just remember a big buck damned rabbit haunting my night ... ')
]]></expres>
<page></page>
</regex>
</item>
avatar
jujuuj

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

View user profile

Back to top Go down

Re: Xbmc tool box / Xbmc gui (Kodi)

Post by twogun on Wed 31 May - 19:24

jujuuj wrote:What ?

OK ... let's say the truth ... Twogun is my best provider in tool boxes ...



@jujuuj

Thanks for saying so, and thanks for the great site/forum. . .  but you know that Big Buck Bunny is here to stay.

Oh yeah,  I was looking at my profile.  I couldn't figure out how to change my name to BigBuckBunny?   Do I just need to create a 2nd account? Twisted Evil
avatar
twogun

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

View user profile

Back to top Go down

Re: Xbmc tool box / Xbmc gui (Kodi)

Post by jujuuj on Thu 1 Jun - 0:24

may be removing the first one ? Twisted Evil

here a little link to a great addon you should love

twogun-addon
avatar
jujuuj

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

View user profile

Back to top Go down

Re: Xbmc tool box / Xbmc gui (Kodi)

Post by twogun on Thu 1 Jun - 0:35

What's funny is the addon doesn't even offer Big Buck Bunny.  It's for watching episodes of Family Guy.

I was thinking of changing my avatar to this?


What do you think? Twisted Evil
avatar
twogun

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

View user profile

Back to top Go down

Re: Xbmc tool box / Xbmc gui (Kodi)

Post by twogun on Thu 1 Jun - 15:50

This code will render a file browser dialog. Allowing you to browse you local file system. After selecting a file it will play the first line of the file. So basically it plays the first stream in a .strm file. This code could be easily expanded to create a makelist from the data in the file. This would allow you select m3us and other playlist, or even a locally save copy of a website.

Code:

<item>
<title>xbmcgui - file browser (returns first line of file for playback)</title>
<link>$doregex[getinput]</link>

<regex>
<name>getinput</name>
<expres><![CDATA[#$pyFunction
import xbmcgui, re
def GetLSProData(page_data,Cookie_Jar,m):

    localfile = getBrowseDialog()
    f = open(localfile, 'r')
    source = f.read()
    f.close()
    return re.findall('(.+)', source)[0]

def getBrowseDialog( default="", heading="", dlg_type=1, shares="files", mask="", use_thumbs=False, treat_as_folder=False ):
    """ shows a browse dialog and returns a value
        - 0 : ShowAndGetDirectory
        - 1 : ShowAndGetFile
        - 2 : ShowAndGetImage
        - 3 : ShowAndGetWriteableDirectory
    """
    dialog = xbmcgui.Dialog()
    value = dialog.browse( dlg_type, heading, shares, mask, use_thumbs, treat_as_folder, default )
    return value
]]></expres>
<page></page>
</regex>
</item>
avatar
twogun

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

View user profile

Back to top Go down

Re: Xbmc tool box / Xbmc gui (Kodi)

Post by jujuuj on Fri 2 Jun - 9:24

twogun wrote:

What do you think?  Twisted Evil

I prefer not to think ...

... but I have a question : do you think it is possible to "record" the username and password we enter in 'that' toolbox, for next uses ?  (i was thinking about using the kodi cache, or find a way to insert the data in ... somewhere ... may b using the favorites.xml (?)

NB : sorry for being so peaceful but it's early you know ...
avatar
jujuuj

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

View user profile

Back to top Go down

Re: Xbmc tool box / Xbmc gui (Kodi)

Post by twogun on Fri 2 Jun - 17:46

You can have it write the data to a file, then have repeated uses read from the file.  This may not be the easiest solution, but it would probably be the easiest for me because it is within my knowledge.  I'll try and see what I can come up with, but I have a very busy weekend so it will have to wait.

It might not be necessary but we might want to consider security a little.  If we save the data to a file we probably should make some effort to encode it so it's not readable.  Also, we might want to see how to make the password prompt show **** instead of the real input.  Just a thought, but it's probably not really needed.

In the meantime here is another example. The file browser combined with the text viewer.  Just browse to a text file select it and it will display it on the screen.

Code:

<item>
<title>XBMC Text viewer and file browser</title>
<link>$doregex[text]</link>
<regex>
<name>text</name>
<expres><![CDATA[#$pyFunction
import xbmcgui, re
def GetLSProData(page_data,Cookie_Jar,m):

    localfile = getBrowseDialog()
    f = open(localfile, 'r')
    source = f.read()
    f.close()
    dialog = xbmcgui.Dialog()
    dialog.textviewer(localfile, source)
    return 'ignore'

def getBrowseDialog( default="", heading="", dlg_type=1, shares="files", mask="", use_thumbs=False, treat_as_folder=False ):
    dialog = xbmcgui.Dialog()
    value = dialog.browse( dlg_type, heading, shares, mask, use_thumbs, treat_as_folder, default )
    return value
]]></expres>
<page></page>
</regex>
</item>
avatar
twogun

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

View user profile

Back to top Go down

Page 1 of 2 1, 2  Next

View previous topic View next topic Back to top

- Similar topics

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