The branch, eden has been updated
via 21911ee68877e33049a3ed3c7fc271d21b3a0041 (commit)
from 2369dca3c39b8d3cfb5b140a9edf66d6d327bbbd (commit)
- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/plugins;a=commit;h=21911ee68877e33049a3ed3c7fc271d21b3a0041
commit 21911ee68877e33049a3ed3c7fc271d21b3a0041
Author: spiff <[email protected]>
Date: Fri Jun 8 16:46:59 2012 +0200
[plugin.video.pakee] initial version (1.0.20). thanks to pakee
diff --git a/plugin.video.pakee/addon.xml b/plugin.video.pakee/addon.xml
index 8597c1b..71da54b 100644
--- a/plugin.video.pakee/addon.xml
+++ b/plugin.video.pakee/addon.xml
@@ -1,25 +1,26 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.pakee"
name="Pakee"
- version="1.0.18"
+ version="1.0.20"
provider-name="pakee">
<requires>
<import addon="xbmc.python" version="2.0"/>
- <import addon="script.module.beautifulsoup" version="3.0.8"/>
</requires>
<extension point="xbmc.python.pluginsource"
library="default.py">
<provides>video</provides>
</extension>
<extension point="xbmc.addon.metadata">
- <summary>Platform to browse and consume Pakistani media across
devices</summary>
- <description>
+ <summary lang='en'>Platform to browse Pakistani media across
devices</summary>
+ <description lang='en'>
-Browse TV channels, TV shows, movies, actors, fashion, photography, sports,
YouTube channels from Pakistan
-Browse musicians' albums, songs, Facebook albums, news and YouTube channels
-Allows users to play video, music or image content in "play all" mode
-Allows users to pull any YouTube users playlists, uploaded/favorite videos
and play in "play all" mode
-More info available at http://code.google.com/p/pakee
</description>
+ <disclaimer lang='en'>No media content is hosted or streamed by the makers
of this addon. Some parts of this addon may not be legal in your country of
residence - please check with your local laws before installing.</disclaimer>
<platform>all</platform>
+ <language>en ur hi</language>
</extension>
</addon>
diff --git a/plugin.video.pakee/changelog.txt b/plugin.video.pakee/changelog.txt
index 53da9d3..24f66d1 100644
--- a/plugin.video.pakee/changelog.txt
+++ b/plugin.video.pakee/changelog.txt
@@ -1,3 +1,14 @@
+[B]Version 1.0.20[/B]
+-Added setting for rtmp/rtmpe stream timeout parameter
+-Completed support for streams from http://sawlive.tv
+
+
+[B]Version 1.0.19[/B]
+-Added support for playing media from 4shared.com
+-Added support for rtmpe streams
+-Added support for streams from http://sawlive.tv
+
+
[B]Version 1.0.18[/B]
-removing mac generated files from zip
diff --git a/plugin.video.pakee/default.py b/plugin.video.pakee/default.py
index 37b2fa7..641f90e 100644
--- a/plugin.video.pakee/default.py
+++ b/plugin.video.pakee/default.py
@@ -1,19 +1,21 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-import xbmc, xbmcgui, xbmcplugin, urllib2, urllib, re, string, sys, os,
traceback, xbmcaddon, unicodedata
+import xbmc, xbmcgui, xbmcplugin, urllib2, urllib, re, string, sys, os,
traceback, xbmcaddon, unicodedata, cookielib
import xml.dom.minidom
import time
-import threading
-from BeautifulSoup import BeautifulStoneSoup, BeautifulSoup
+
+
__plugin__ = 'Pakee'
__author__ = '[email protected]'
__url__ = 'http://code.google.com/p/pakee/'
__date__ = '01-04-2011'
-__version__ = '1.0.18'
+__version__ = '1.0.20'
__settings__ = xbmcaddon.Addon(id='plugin.video.pakee')
-__rooturl__ = 'http://pakee.hopto.org/pakee/pakee.php?id=xbmc&zaz=9'
-#__rooturl__ = 'http://pakee.hopto.org/pakee/pakee-test.xml?poos=5'
+__profilepath__ = xbmc.translatePath( __settings__.getAddonInfo('profile') )
+__rooturl__ = 'http://pakee.hopto.org/pakee/pakee.php?id=xbmc&qqp=7'
+#__rooturl__ = 'http://pakee.hopto.org/pakee/pakee-test.xml?qo=2'
+#__rooturl__ = 'http://pakee.hopto.org/mediarss/makeuphairv2.xml?as=5'
__language__ = __settings__.getLocalizedString
#plugin modes
@@ -27,6 +29,7 @@ PLUGIN_MODE_PLAY_PLAYLIST = 80
PLUGIN_MODE_PLAY_SLIDESHOW = 90
PLUGIN_MODE_OPEN_SETTINGS = 100
PLUGIN_MODE_PLAY_STREAM = 110
+PLUGIN_MODE_PLAY_4SHARED = 120
#view modes
@@ -38,7 +41,7 @@ VIEW_MEDIAINFO = 504
VIEW_FANART = 508
pakee_thumb = os.path.join( __settings__.getAddonInfo( 'path' ), 'resources',
'media', 'pakee.png' )
-
+media_id = 0
def open_url( url ):
@@ -72,9 +75,14 @@ def play_youtube_video(video_id, name):
#Play a single song
def play_stream(url, name):
- print "playing video stream name: " + str(name) + " url: " + str(url)
+
listitem = xbmcgui.ListItem( label = str(name), iconImage =
"DefaultVideo.png", thumbnailImage = xbmc.getInfoImage( "ListItem.Thumb" ),
path=url )
- listitem.setInfo( type="video", infoLabels={ "Title": name, "Plot" :
name } )
+ if isMusicFile(url):
+ print "playing music file: " + str(name) + " url: " + str(url)
+ listitem.setInfo( type="Music", infoLabels={ "Title": name } )
+ else:
+ print "playing stream name: " + str(name) + " url: " + str(url)
+ listitem.setInfo( type="video", infoLabels={ "Title": name,
"Plot" : name } )
xbmc.Player( xbmc.PLAYER_CORE_DVDPLAYER ).play( str(url), listitem)
@@ -83,7 +91,7 @@ def play_picture_slideshow(origurl, name):
print "Starting play_picture_slideshow(): " + str(origurl)
#user clicked on a picture
- if origurl[-4:]=='.jpg' or origurl[-4:]=='.gif' or origurl[-4:]=='.png':
+ if origurl[-4:].lower()=='.jpg' or origurl[-4:].lower()=='.gif' or
origurl[-4:].lower()=='.png':
print "Single picture mode"
origurl = origurl.replace( ' ', '%20' )
xbmc.log("adding to picture slideshow: " + str(origurl))
@@ -130,23 +138,52 @@ def play_playlist(origurl, index):
label, url, description, pubDate, guid, thumb, duration,
rating, viewcount = getItemFields(item)
playlisturl = None
+
+ #youtube video
if guid is not None and guid != '':
#print "Found item: " + label + " guid: " + guid
playlisturl =
'plugin://plugin.video.youtube/?action=play_video&videoid=%s' % (guid)
-
- elif 'plugin://plugin.video.jtv.archives' in url and
'play=True' in url:
+ #jtv video
+ elif url.startswith('plugin://plugin.video.jtv.archives') and
'play=True' in url:
playlisturl = url.replace('play=True','play=False')
+ #4shared link
+ elif '.4shared.com' in url and 'preview' in url:
+ playlisturl =
'plugin://plugin.video.pakee/?mode=%d&name=%s&url=%s' %
(PLUGIN_MODE_PLAY_4SHARED, urllib.quote_plus(label), urllib.quote_plus(url))
+
+
+ #for rtmp/rtmpe streams if no timeout is specified, add the
timeout specifed by user
+ elif 'timeout=' not in url and (url.startswith('rtmpe://') or
url.startswith('rtmp://')):
+ setting_streamtimeout =
(__settings__.getLocalizedString(30211),
__settings__.getLocalizedString(30212),
__settings__.getLocalizedString(30213))[int(__settings__.getSetting('streamtimeout'))
]
+ playlisturl = url + ' timeout=%s' %
setting_streamtimeout
+ #for sawlive.tv streams
+ elif url.startswith('http://sawlive.tv/embed') or
url.startswith('http://www.sawlive.tv/embed'):
+ xbmc.log('Found sawlive.tv url..needs resolving: ' +
url)
+
+ if len(url) > 100:
+ playlisturl = find_stream(url,name)
+ else:
+ playlisturl = find_sawlive_url(url,name)
+
+
+ #anything else
elif url is not None and url != '':
#print "Found item: " + label + " url: " + url
playlisturl = url
if playlisturl is not None and playlisturl !='' and itemCount
>= index - 1:
listitem = xbmcgui.ListItem( label = label,
thumbnailImage = thumb, path=playlisturl )
- listitem.setInfo( type="video", infoLabels={ "Title":
label, "Plot" : description } )
- #xbmc.log("adding to playlist " + str(label))
+ #listitem.setInfo( type="Video", infoLabels={ "Title":
label } )
+
+ if isMusicFile(playlisturl):
+ #xbmc.log("adding audio file to playlist %s %s"
% (label,playlisturl))
+ listitem.setInfo( type="Music", infoLabels={
"Title": label } )
+ listitem.setProperty('mimetype','audio/mpeg')
+ else:
+ listitem.setInfo( type="video", infoLabels={
"Title": label, "Plot" : description } )
+ xbmc.log("adding video file to playlist %s %s"
% (label,playlisturl))
playlist.add(url=playlisturl, listitem=listitem)
itemCount=itemCount+1
@@ -169,11 +206,98 @@ def play_playlist(origurl, index):
#xbmc.executebuiltin('playlist.playoffset(video, index)')
+def play_fourshared(url, name):
+ global media_id
+ xbmc.log("starting 4shared method with: %s and %s" % (name, url))
+ username = 'pakeeapp'
+ password = 'xbmctesting'
+ cookie_file = os.path.join(__profilepath__, 'pktemp.cookies')
+ media_file = os.path.join(__profilepath__, ("pktemp%d.mp3" %
(media_id)))
+ cj = cookielib.LWPCookieJar()
+ media_id = media_id + 1
+
+ opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
+ loginurl = 'https://www.4shared.com/login?login=%s&password=%s' %
(username, password)
+ xbmc.log("logging in to 4shared: " + loginurl)
+ resp = opener.open(loginurl)
+
+ cj.save(cookie_file, ignore_discard=True)
+ cj.load(cookie_file, ignore_discard=True)
+
+ opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
+ urllib2.install_opener(opener)
+
+ usock = opener.open(url)
+ data = usock.read()
+ #media_file = usock.geturl()
+ usock.close()
+
+ fp = open(media_file, 'wb')
+ fp.write(data)
+ fp.close()
+
+ #play_stream(media_file, name)
+ print "playing stream name: " + str(name) + " url: " + str(media_file)
+ listitem = xbmcgui.ListItem( label = str(name), iconImage =
"DefaultVideo.png", thumbnailImage = xbmc.getInfoImage( "ListItem.Thumb" ),
path=media_file )
+ listitem.setInfo( type="Music", infoLabels={ "Title": name } )
+ xbmc.Player( xbmc.PLAYER_CORE_DVDPLAYER ).play( str(media_file),
listitem)
+
+#saw embed (long url) received in form of http://xxxxxxxxx&streamer=xxxxx
+def find_stream(url, name):
+ xbmc.log("Starting find_stream with url: " + str(url))
+ pageUrl = url.split("&streamer=")[0]
+ streamer = url.split("&streamer=")[1]
+ print ('Opening ' + pageUrl)
+ res = open_url(pageUrl)
+ #print (res)
+ playpath = ''
+ swfUrl = ''
+
+ for line in res.split("\n"):
+ #print ("line:" + line)
+ matches = re.search(r'file.*\'(.+)\'', line)
+ if matches:
+ playpath = matches.group(1)
+ print ("Found playpath:" + playpath)
+
+ matches = re.search(r'(http.+\.swf)', line)
+ if matches:
+ swfUrl = matches.group(1)
+ print ("Found swfUrl:" + swfUrl)
+
+ streamurl = "%s playpath=%s swfUrl=%s pageurl=%s swfVfy=true live=true"
% (streamer, playpath, swfUrl, pageUrl)
+ xbmc.log ("streamurl: " + streamurl)
+ return (streamurl)
+
+
+#saw embed (short url) received in form of http://xxxxxxxxx&streamer=xxxxx
+def find_sawlive_url(url, name):
+ xbmc.log("Starting find_sawlive_url with url: " + str(url))
+ pageUrl = url.split("&streamer=")[0]
+ streamer = url.split("&streamer=")[1]
+
+ res = open_url(pageUrl)
+ #print (res)
+ playpath = ''
+ swfUrl = ''
+
+ for line in res.split("\n"):
+ #print ("line:" + line)
+ matches = re.search(r'src=[\"\']([^\"\']+)/[\"\']', line)
+ if matches:
+ playpath = matches.group(1)
+ playpath = playpath.replace( '/view/', '/watch/' )
+ print ("Found sawurl:" + playpath)
+
+
+
+ url = "%s&streamer=%s" % (playpath, streamer)
+ xbmc.log ("url: " + url)
+ return (find_stream(url, name))
def build_show_directory(origurl):
- #from threading import Timer
if origurl:
xbmc.log('Starting build_show_directory() with url: ' + origurl)
else:
@@ -191,10 +315,8 @@ def build_show_directory(origurl):
elif 'queryyt' in origurl:
xbmc.executebuiltin("XBMC.Notification("+ __plugin__
+","+__settings__.getLocalizedString(30053)+",100)")
-
#Read RSS items from origurl and store in items
items = getItemsFromUrl(origurl)
- #items = getItemsFromUrlBS(origurl)
if items is None:
return
@@ -202,14 +324,11 @@ def build_show_directory(origurl):
itemCount=0
-
-
for item in items:
#extract fields from each RSS item
label, url, description, pubDate, guid, thumb, duration,
rating, viewcount = getItemFields(item)
- #label, url, description, pubDate, guid, thumb, duration,
rating, viewcount = getItemFieldsBS(item)
descprefix = ''
#if duration != 0:
@@ -272,7 +391,7 @@ def build_show_directory(origurl):
#For feeds with pictures as their first item, show
<start slideshow> as first listitem
- if url[-4:]=='.jpg' or url[-4:]=='.gif' or
url[-4:]=='.png':
+ if url[-4:].lower()=='.jpg' or url[-4:].lower()=='.gif'
or url[-4:].lower()=='.png':
#For folders with videos, show play all option
if itemCount == 0:
resolvedlabel = '<' +
str(__settings__.getLocalizedString(30051)) + '>'
@@ -283,7 +402,7 @@ def build_show_directory(origurl):
mode = PLUGIN_MODE_PLAY_SLIDESHOW
#audio track found, check whether in single or playlist
mode and set the mode/url accordingly
- if '.mp3' in url or '.wma' in url or 'http://bit.ly' in
url or '/getSharedFile/' in url or '.mp4' in url:
+ if isMusicFile(url):
#For feeds with mp3s as their first item, show
<play all> listitem as first listitem
if itemCount == 0:
@@ -291,6 +410,7 @@ def build_show_directory(origurl):
playAll = xbmcgui.ListItem( label =
resolvedlabel, iconImage = pakee_thumb, thumbnailImage = pakee_thumb )
xbmcplugin.addDirectoryItem( handle =
int( sys.argv[1] ), url = sys.argv[0] +
"?mode="+str(PLUGIN_MODE_PLAY_PLAYLIST)+"&index=0&name=Playlist&url=" +
urllib.quote_plus(origurl), listitem = playAll, isFolder = True )
+
isFolder = False
#play single video
@@ -302,10 +422,19 @@ def build_show_directory(origurl):
mode = PLUGIN_MODE_PLAY_PLAYLIST
url = origurl
+ if '.4shared.com' in url and 'preview' in url:
+ mode = PLUGIN_MODE_PLAY_4SHARED
- if 'fetchLiveFeeds.php' not in url and ('rtmp://' in
url or 'mms://' in url or 'rtsp://' in url or 'desistreams.xml' in origurl or
'LiveTV.xml' in origurl):
+
+ #video stream found
+ if 'fetchLiveFeeds.php' not in url and
(url.startswith('rtmpe://') or url.startswith('rtmp://') or
url.startswith('mms://') or url.startswith('rtsp://') or '.wsx' in url or
'desistreams.xml' in origurl or 'LiveTV.xml' in origurl):
isFolder = False
+ #for rtmp/rtmpe streams if no timeout is
specified, pick the timeout specifed by user
+ if 'timeout=' not in url and
(url.startswith('rtmpe://') or url.startswith('rtmp://')):
+ setting_streamtimeout =
(__settings__.getLocalizedString(30211),
__settings__.getLocalizedString(30212),
__settings__.getLocalizedString(30213))[int(__settings__.getSetting('streamtimeout'))
]
+ url = url + ' timeout=%s' %
setting_streamtimeout
+
#play single video
if setting_playmode == 0:
mode = PLUGIN_MODE_PLAY_STREAM
@@ -315,6 +444,22 @@ def build_show_directory(origurl):
mode = PLUGIN_MODE_PLAY_PLAYLIST
url = origurl
+ #sawlive.tv embed url found from which we need to
extract stream
+ if url.startswith('http://sawlive.tv/embed') or
url.startswith('http://www.sawlive.tv/embed'):
+ xbmc.log('Found sawlive.tv url..needs
resolving: ' + url)
+
+ #play single video
+ if setting_playmode == 0:
+ mode = PLUGIN_MODE_PLAY_STREAM
+ if len(url) > 100:
+ url = find_stream(url,name)
+ else:
+ url = find_sawlive_url(url,name)
+
+ #play video playlist
+ else:
+ mode = PLUGIN_MODE_PLAY_PLAYLIST
+ url = origurl
@@ -374,112 +519,22 @@ def build_show_directory(origurl):
+def isMusicFile(url):
-#extract fields from each RSS item read via BeautifulSoup
-def getItemFieldsBS(item):
-
- label=''
- url = ''
- thumb = ''
- guid = ''
- description = ''
- pubDate = '01.01.1960'
- rating = 0.0
- duration = 0
- viewcount = '0'
-
-
- if item.title:
- label = clean(item.title.string)
- if item.link:
- url = item.link.string
+ if '.mp3' in url or '.wma' in url or 'http://bit.ly' in url or
'/getSharedFile/' in url or '.mp4' in url:
+ return True
else:
- url = ''
-
- if item.enclosure:
- url = item('enclosure')[0]['url']
-
- if item.description:
- description = item.description.string
-
- if item('boxee:release-date'):
- pubDate = item('boxee:release-date')[0].string
- #xbmc.log('pubdate: x' + str(pubDate) + 'x')
- if pubDate is None or pubDate=='':
- pubDate = '01.01.1960'
- else:
- tpubDate = time.strptime(pubDate, '%Y-%m-%d')
- pubDate = time.strftime("%d.%m.%Y", tpubDate)
-
- if item.guid:
- guid = item.guid.string
-
- if item('media:thumbnail'):
- thumb = item('media:thumbnail')[0]['url']
- elif item.thumbnail:
- thumb = item.thumbnail.string
-
- if item('media:content'):
- duration = item('media:content')[0]['duration']
-
- if duration is None or duration == '':
- duration = 0
- else:
- duration = string.atoi(duration)
- #duration = int(duration)
- duration = time.strftime('%H:%M:%S', time.gmtime(duration))
-
- if item('media:starrating'):
- print item('media:starrating')[0]['average'] + ' ' +
item('media:starrating')[0]['viewcount']
- if item('media:starrating')[0]['average']:
- rating = item('media:starrating')[0]['average']
- else:
- rating = '0.0'
- rating = string.atof(rating)
-
- if item('media:starrating')[0]['viewcount']:
- viewcount = item('media:starrating')[0]['viewcount']
- else:
- viewcount = '0'
- viewcount = string.atoi(viewcount)
-
- if url:
- url = url.replace( ' ', '%20' )
-
- #return {'label': label, 'url':url, 'description': description,
'pubDate': pubDate, 'guid': guid, 'thumb': thumb, 'duration': duration,
'rating': rating, 'viewcount': viewcount}
- return label, url, description, pubDate, guid, thumb, duration, rating,
viewcount
-
-
-#open url and parse XML using BeautifulSoup
-def getItemsFromUrlBS(url):
- try:
- file = urllib2.urlopen(url)
- t = threading.Timer(100000.0, file.close)
- t.start()
- link = file.read()
- file.close()
- except:
- xbmcgui.Dialog().ok('Pakee','Request timed out. Please try
again')
- return
-
- soup = BeautifulStoneSoup(link,
convertEntities=BeautifulStoneSoup.XML_ENTITIES)
- items = soup('item')
- return items
+ return False
#open url and parse XML using dom
def getItemsFromUrl(url):
try:
- #file = urllib2.urlopen(url)
- #t = threading.Timer(100000, file.close)
- #t.start()
- #data = file.read()
- #file.close()
-
file = urllib2.urlopen(url, timeout=3600)
data = file.read()
file.close()
+
except:
xbmcgui.Dialog().ok('Pakee','Request timed out. Please try
again')
return
@@ -700,6 +755,7 @@ elif mode == PLUGIN_MODE_PLAY_STREAM:
play_stream(url, name)
elif mode == PLUGIN_MODE_OPEN_SETTINGS:
open_settings()
-
+elif mode == PLUGIN_MODE_PLAY_4SHARED:
+ play_fourshared(url,name)
diff --git a/plugin.video.pakee/resources/language/English/strings.xml
b/plugin.video.pakee/resources/language/English/strings.xml
index dd23a1c..818b909 100644
--- a/plugin.video.pakee/resources/language/English/strings.xml
+++ b/plugin.video.pakee/resources/language/English/strings.xml
@@ -20,6 +20,11 @@
<string id="30200">Shuffle playlist</string>
<string id="30201">Repeat playlist</string>
+ <string id="30210">Timeout for rtmp/rtmpe streams (seconds)</string>
+ <string id="30211">15</string>
+ <string id="30212">30</string>
+ <string id="30213">45</string>
+
<string id="30300">Default view</string>
<string id="30301">Thumbnail view</string>
<string id="30302">PosterWrap view</string>
diff --git a/plugin.video.pakee/resources/settings.xml
b/plugin.video.pakee/resources/settings.xml
index df9b668..77c5ac8 100644
--- a/plugin.video.pakee/resources/settings.xml
+++ b/plugin.video.pakee/resources/settings.xml
@@ -1,18 +1,19 @@
<settings>
+ <!-- view -->
+ <category label="30001">
+ <setting id="viewsortorder" type="enum" label="30100"
lvalues="30101|30102" default="0" />
+ <setting id="viewname" type="enum" label="30300"
lvalues="30301|30302|30303|30304|30305|30306" default="4" />
+ </category>
+
<!-- Playlist -->
<category label="30002">
<setting id="playmode" type="enum" label="30021" lvalues="30022|30023"
default="0" />
<setting id="shuffle" type="bool" label="30200" default="false" />
<setting id="repeat" type="bool" label="30201" default="false" />
-
- </category>
-
- <!-- view -->
- <category label="30001">
- <setting id="viewsortorder" type="enum" label="30100"
lvalues="30101|30102" default="0" />
- <setting id="viewname" type="enum" label="30300"
lvalues="30301|30302|30303|30304|30305|30306" default="4" />
+
+ <setting id="streamtimeout" type="enum" label="30210"
lvalues="30211|30212|30213" default="0" />
</category>
-----------------------------------------------------------------------
Summary of changes:
plugin.video.pakee/addon.xml | 9 +-
plugin.video.pakee/changelog.txt | 11 +
plugin.video.pakee/default.py | 294 ++++++++++++--------
.../resources/language/English/strings.xml | 5 +
plugin.video.pakee/resources/settings.xml | 15 +-
5 files changed, 204 insertions(+), 130 deletions(-)
hooks/post-receive
--
Plugins
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons