SETUP
- Location:
All modules are located in the directory of the tv framework app.
You can find the framework directory in:
Linux: “/home/[username]/.boxee/UserData/apps/com.bart.tv”
MAC: “[username]/Library/Application Support/Boxee/userdata/apps/com.bart.tv”
Make sure you have opened the app at least one time in boxee so that the files are downloaded!
Now in the homedir of the app you can find a directory
inside this directory you will find all the modules installed at that moment.
- Debug mode
I have included a debug mode in the framwork so you can more easily test the modules and read out errors. It is important to set debug mode to ‘True’ when developing modules. You have to edit main.py in the libs directory (com.bart.tv/libs/main.py) in the first few lines of the python file you will find the variable ‘self.debug’. Change it value to ‘True’ to enable local module development and a better error logging in th main boxee log.
It is important to set this value correctly as it will set bartsideeTv to local mode. If it remains on False it will clean/remove all modules not listed in the online database!
As a tip you can use the python ‘print’ command to log variables to the main boxee log to ease debugging. For example print str(“This is an test”) or print variable wil print the content in the boxee log.
- Adding a module
If you want to add a module, please start by adding a new directory to the ‘modules’ folder. When you do this please give the directory a name with ony lowercase letters and no special characters or spaces! Since the latest version of the framework yo also have to add a verson number to the module directory. (example the module ‘youtube’ gets a folder name ‘youtube-1′) The directory name will be used as an internal id for the framework.
Now add 3 files to this new directory:
- image file [example.png]
- python file [example.py]
- python file [__init__.py]
Make sure you give both the python file and the image file the same name as the directory name for your module. For example if the directory name of the module is called ‘youtube’ the files inside this module should be called ‘youtube.py’ and ‘youtube.png’.
The example file structure will be as seen in the image below:
- Image file
The image file included should be a ‘png’ image file and preferably a 200px by 200px image saved 24-bit png with transparency enabled.
- Python file
All module file should have the same basic template to make sure it can communicate with the framework. When you start building a new module you can start with a template seen below you can download it here.
-
import mc, re, os, sys
-
sys.path.append(os.path.join(mc.GetApp().GetAppDir(), ‘libs’))
-
import ba
-
from beautifulsoup.BeautifulSoup import BeautifulSoup
-
-
class Module(object):
-
def __init__(self):
-
self.name = "Module Name" #Name of the channel
-
self.type = [‘search’,‘genre’,‘list’] #Choose between ‘search’, ‘list’, ‘genre’
-
self.episode = True #True if the list has episodes
-
self.filter = [] #Option to set a filter to the list
-
self.genre = [] #Array to add a genres to the genre section
-
self.content_type = ‘video/x-ms-asf’ #Mime type of the content to be played
-
self.country = ‘NL’ #2 character country id code
-
-
def Search(self, search):
-
"""Start your code here"""
-
-
"""End your code here"""
-
return streamlist
-
-
def List(self):
-
"""Start your code here"""
-
-
"""End your code here"""
-
return streamlist
-
-
def Episode(self, stream_name, stream_id, page, totalpage):
-
"""Start your code here"""
-
-
"""End your code here"""
-
return episodelist
-
-
def Genre(self, genre, filter, page, totalpage):
-
"""Start your code here"""
-
-
"""End your code here"""
-
return genrelist
-
-
def Play(self, stream_name, stream_id, subtitle):
-
"""Start your code here"""
-
-
"""End your code here"""
-
return play
- Python IDE
Watch out with editing python files in a text editors. Python is a bit picky on iterations and a script can fail very quicly on not setting a tab or space correct. In fact python does not support tabs at all.
Best is to use an IDE editor that takes the burden of looking after the iterations You can find a good manual for installing the IDE netbeans for boxee here.
-
-
#3 written by Wimke 7 months ago
Hi Bart,
Is it possible to set the module default to enable in stead of disabled? This will help the BoxeeBox users to not having to select the modules over and over again in the settings menu.
It would be 100% perfect for me if you have a BartsIdeeTV Dutch version where all dutch modules are enabled by default.
-
- Comment Feed for this Post
Didn't find any related posts :(

bartsidee
nl
In the new beta you need next to the debug flag also to set the ‘local’ flag to True before you can see the local modules. (situated in lib/config.py)