[RELEASE] FlexiBrowser (Script)

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
Bernd Offline
Senior Member
Posts: 211
Joined: Mar 2005
Reputation: 0
Thumbs Up  [RELEASE] FlexiBrowser (Script)
Post: #1
I posted my FlexiBrowser script in the old python scripts support and request forum (see here) in march. this was mainly for users.

This thread is also for other python developers to show how to easy it is to extend FlexiBrowser by creating plugins for it.

what is flexibrowser (the vision):
in short terms flexibrowser is an attempt to make a 'multi browser'. one browser that shows media from serveral sources in a filemanager like fashion.
it should be some kind of framework so people can create new content without having to clone some other script over and over again. the idea of code reuse through copy/paste isn't very good
to be able to browse a new website one should only need to write code which does the parsing and is specific for that site, but not the gui and the http reading which is mainly always the same.

how does flexibrowser work
flexibrowser seperates gui from parsing. it uses plug-ins to to the parsing. the gui-script calls the plug-ins to populate its list with elements. each element can then be asked whethe it has subelements, which will be retrieved when the user selects this element in the gui.
in that flexibrowser creates a hierchical (folder like) way of browsing.
the plug-ins are created as seperate .py files and stored in a subfolder.
to install a new plug-in you just have to copy the it to the "plugins" subfolder and the next time you start flexibrowser you will be able to browse new content.

the good thing about seperating the parsing from the gui is that as a plug-in developer you can write an test your plug-in completely on your pc/mac/whatever.
since no xbmc specific code is needed (its all in the gui script) you don't need the emulator to create a plug-in. this greatly decreases testing and debugging, because you can do it with simple print statements

how to create a plug-in
1. create a new scriptfile in the plugins folder and name it plug_myplugin.py you must prefix the name with "plug_"
2. import flexibrowser and whatever other libs your need.
3. derive your class/classes from <span style='font-family:courier'>flexibrowser.flexielement</span> call the baseclass contructor (flexielement._init_) in your _init_*to get html decoding for free.
overload <span style='font-family:courier'>getsubelements()</span> and do your own regex parsing and return a list of subelements
4. provide a global <span style='font-family:courier'>getflexibrowserelements()</span> function and return a list of flexielement based objects you plug-in provides.

the flexibrowser module contains some general purpose function your plug-in may use like fetchhtmlpage or decodehtml which should be used by plug-ins so you don't have to recode them everytime.

see the provided plug-ins (plug_channel9.py for a simple or plug_teamxbox.py for a more sophisticated one with subelements) for samples.

the future
flexibrowser is not perfect yet Big Grin

here are some things i thought could be impreoved:
-needs much more plug-ins. the more the better Smile
-the gui looks functional but not fancy
-the gui doesn't display all information a flexielement can provide (description, thumbnail) yet
-at this time flexibrowser only plays videos. it could be improved so it will also handle images and texts (like phuncks ooba.py). this would be great for comics, game faqs, etc
-it is missing a configuration screen. the only thing you can configure is whether the videos will be streamed or downloaded by pressing x
-a global tempfile management would be great, so plug-ins could store some data
-an autoupdate function to download new plug-ins would be nice

everyone is invited to extend flexibrowser and to make it the most flexible browser script.

you can grab the latest flexibrowser at xbmcscripts.com in the media: streaming section

thanks
bernd
(This post was last modified: 2009-06-04 12:54 by Gamester17.)
find quote
Phunck Offline
Senior Member
Posts: 145
Joined: Apr 2005
Reputation: 0
Post: #2
i think the user should have the ability to add/remove plugins from main menu. f.x. not everybody would be interrested in danish news. also, it is important that the plugins is screened for malicious code if there is an auto update function.
find quote
Bernd Offline
Senior Member
Posts: 211
Joined: Mar 2005
Reputation: 0
Post: #3
the auto-updater hasn't been implemented yet.
currently the user chooses which plug-ins are available by copying them into the plugins folder or by removing them from there.

the auto-updater was just a thought what could be done in the furure.

bernd
find quote
Phunck Offline
Senior Member
Posts: 145
Joined: Apr 2005
Reputation: 0
Post: #4
yes. i'm just brainstorming.

i think it would be great with a menu where you can add and remove plugins. i'm thinking that maybe that could be flexielement by it self and work by moving the disabled plugin files to a different directory.

about autoupdating. i think that it is a little dangerous to have the scripts automatically downloaded from a site. but this could also be implemented as a flexibrowse element. you could have the element get an xml with the url's of the plugins. when you click on an item then you can choose to download the plugin...

hmm... i guess i'm suggesting that there will be a plug_pluginmanager.py script.

i have now got my ooba script almost working. now i will probably start to make a generic image viewer that could be used easily from your script (and other scripts as well). (it would be nice if there was a way to use the slideshow functionality in xbmc).
find quote
Bernd Offline
Senior Member
Posts: 211
Joined: Mar 2005
Reputation: 0
Post: #5
a download plug-in ... yeah this would really rock Cool

shouldn't be too hard to implement.

it could 'parse' script hostings sites or the xboxmediacenter.com download page when its up again Sad
and store the file in the plug-ins folder

if someone hosts an xml parsing would be even simpler.

maybe some kind of comment at the beginning of the plug-in could give some meta info (i.e. addl files needed and where to install them to.

there would still be the issue with malicious code.
but this is not a plug-in specific problem. this issue can arise with every script.

maybe we need a sandbox for our scripts Wink

bernd
find quote
Bernd Offline
Senior Member
Posts: 211
Joined: Mar 2005
Reputation: 0
Post: #6
(phunck @ april 12 2005,09:09 Wrote:now i will probably start to make a generic image viewer that could be used easily from your script (and other scripts as well). (it would be nice if there was a way to use the slideshow functionality in xbmc).

an imageviewer ... sounds cool.
i'd love to use that in flexibrowser.

i also thought that simple text could be displayed by using simple elements. it just needs a line-break function which splits text into multiple elements which then would be shown in the list.

then it would be able to show videos, images and text  :o

bernd
find quote
jmarshall Offline
Team-XBMC Developer
Posts: 26,181
Joined: Oct 2003
Reputation: 175
Post: #7
just so you know, there's two things that need to happen to have slideshow support from python scripts:

1. support for xbmc's built in functions from python. there's a patch on sf by thor918 that is about 1/2 way there (he has a done the running xbe from python, but just a slightly more generic approach will see all internal xbmc commmands being available)

2. support for a "xbmc.slideshow(dir)" built-in command. this should be reasonably easy to get done and i'll likely work on it when i have some spare time.

cheers,
jonathan

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


[Image: badge.gif]
find quote
Phunck Offline
Senior Member
Posts: 145
Joined: Apr 2005
Reputation: 0
Post: #8
that would be great. thanks alot in advance.
find quote
jmarshall Offline
Team-XBMC Developer
Posts: 26,181
Joined: Oct 2003
Reputation: 175
Post: #9
number 2 is in cvs now. xbmc.slideshow(dir) and xbmc.recursiveslideshow(dir) should cover it.

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


[Image: badge.gif]
find quote
jmarshall Offline
Team-XBMC Developer
Posts: 26,181
Joined: Oct 2003
Reputation: 175
Post: #10
number 1 is done as well.

use

executebuiltin("xbmc.slideshow(e:\\pictures)")

for example.

enjoy Smile

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


[Image: badge.gif]
find quote
Asteron Offline
"Skilled" Python Coder
Posts: 928
Joined: Feb 2004
Reputation: 0
Post: #11
nice, thanks! is there a file in cvs that has a list of all builtin commands?
-ast
find quote
jmarshall Offline
Team-XBMC Developer
Posts: 26,181
Joined: Oct 2003
Reputation: 175
Post: #12
am writing it up in the manual atm. for now, see xbmc/util.cpp.

edit: manual write up is done. please enhance it if you think it needs it Smile

cheers,
jonathan

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


[Image: badge.gif]
find quote
Bernd Offline
Senior Member
Posts: 211
Joined: Mar 2005
Reputation: 0
Smile   
Post: #13
i've added a new plug-in for flexibrowser that allows to read walkthroughs/tips hosted on gamefaqs.com

so if you're stuck in any game (not only xbox ) check out their stuff!

you can get it by downloading flexibrowser 1.2 at xbmcscripts.com

have fun
bernd
find quote
Livin Online
Posting Freak
Posts: 3,528
Joined: May 2004
Reputation: 17
Location: above ground
Thumbs Up   
Post: #14
so i can switch over to this while in an xbox game... sweet! :thumbsup:







jk

:evil:

I'm not an expert but I play one at work.
find quote
Bernd Offline
Senior Member
Posts: 211
Joined: Mar 2005
Reputation: 0
Post: #15
not while in a game.
but if your bios supports ingamereset, you don't even have to lift your ass off the couch Big Grin

bernd
find quote
Post Reply