Skip to content
This repository has been archived by the owner on Jan 17, 2022. It is now read-only.

Updates for veetle plugin navigation #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion plugin.video.veetle/addon.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<addon id="plugin.video.veetle" version="0.1.6" name="Veetle" provider-name="t0mm0">
<addon id="plugin.video.veetle" version="0.1.7" name="Veetle" provider-name="t0mm0">
<requires>
<import addon="xbmc.python" version="1.0"/>
<import addon="script.module.simplejson" version="2.0.10"/>
Expand Down
3 changes: 3 additions & 0 deletions plugin.video.veetle/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[B]Version 0.1.6[/B]
- Updated to enabled channel navigation by category

[B]Version 0.1.6[/B]
- fix breakage due to site changes

Expand Down
59 changes: 47 additions & 12 deletions plugin.video.veetle/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
'''

import os
import os,sys
import simplejson as json
import time
import urllib, urllib2
import xbmc, xbmcaddon, xbmcplugin, xbmcgui
from operator import itemgetter

pluginUrl = sys.argv[0]
pluginHandle = int(sys.argv[1])
Expand Down Expand Up @@ -115,21 +116,29 @@ def populate_playlist(self, json_playlist, reference_clock):
dialog = xbmcgui.Dialog()
ok = dialog.ok(__language__(30000), __language__(30001))

else:
#Load the channel list
elif pluginQuery.startswith('?folder='):
# Load the channel list
response = urllib2.urlopen(CHANNEL_LISTING)
channels = json.loads(response.read())

print 'Total veetle.com Channels: %d' % len(channels)
print('Total veetle.com Channels: %d' % len(channels))

# Filter on selected folder and Flash only
folder_id = pluginQuery[8:].strip()
print('Selected folder: %s' % folder_id)

#only list channels we can stream
channels = [channel for channel in channels if channel.get('flashEnabled',
False)]

print 'Flash Enabled veetle.com Channels: %d' % len(channels)
channels = [channel for channel in channels
if channel.get('flashEnabled', False) and
channel.get('categoryId', '') == folder_id]

print('Filtered veetle.com Channels: %d' % len(channels))

# Sort channels by title
# TODO: Use XBMC sort functionality
channels_sorted = sorted(channels, key=itemgetter('title'))

do_grab = False #__settings__.getSetting('grab_schedule')
for channel in channels:
for channel in channels_sorted:
url = pluginUrl + '?play=' + channel['channelId']
sm = channel['logo'].get('sm', '')
lg = channel['logo'].get('lg', '')
Expand All @@ -153,6 +162,32 @@ def populate_playlist(self, json_playlist, reference_clock):
listitem.setInfo('video', infoLabels)
listitem.setProperty('IsPlayable', 'true')
xbmcplugin.addDirectoryItem(pluginHandle, url, listitem,
isFolder=False, totalItems=len(channels))
xbmcplugin.endOfDirectory(pluginHandle)
isFolder=False,
totalItems=len(channels_sorted))
xbmcplugin.endOfDirectory(pluginHandle, succeeded=True)

else:
# Channel Categories
# TODO: load these dynamically from veetle.com -> they change)
categories = { 60: 'Animation',
50: 'Comedy',
90: 'Education',
40: 'Gaming',
110: 'Mobile',
10: 'Entertainment',
20: 'Shows',
80: 'Sports',
70: 'Music',
30: 'News',
100: 'Religion' }

# List the channel categories by default
print('Listing Veetle Categories')
for category in sorted(categories, key=categories.get):
listitem = xbmcgui.ListItem(categories[category])
xbmcplugin.addDirectoryItem(pluginHandle,
pluginUrl + '?folder=' + str(category),
listitem,
isFolder=True)

xbmcplugin.endOfDirectory(pluginHandle, succeeded=True)