Skip to content

Commit

Permalink
MP4 Support
Browse files Browse the repository at this point in the history
- Movie support (MP4 files)
- Fix 'Recent - Yesterday' filter
  • Loading branch information
coder-alpha committed Aug 10, 2015
1 parent ac3b735 commit cbb304a
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 4 deletions.
15 changes: 12 additions & 3 deletions Contents/Code/__init__.py
Expand Up @@ -178,7 +178,7 @@ def RecentListing(title):

filterD = DT.date.today()
if title == 'Since Yesterday':
filterD = filterD - DT.timedelta(days=2)
filterD = filterD - DT.timedelta(days=1)
elif title == 'Last 7 Days':
filterD = filterD - DT.timedelta(days=7)
filterDate = datetime.combine(filterD, datetime.min.time())
Expand Down Expand Up @@ -716,7 +716,7 @@ def GetChannelThumb(url):
page = HTTP.Request(url).content
if 'html' not in page and 'div' not in page and '#EXTM3U' in page:
thumb = R(ICON_VIDEO)
elif '.m3u' in url:
elif '.m3u' in url or '.mp4' in url:
thumb = R(ICON_VIDEO)
elif '.aac' in url or '.mp3' in url:
thumb = R(ICON_AUDIO)
Expand Down Expand Up @@ -763,7 +763,7 @@ def GetRedirector(url):

redirectUrl = url
try:
if '.m3u8' not in url and '.mp3' not in url and '.aac' not in url and '.m3u' not in url:
if '.m3u8' not in url and '.mp3' not in url and '.aac' not in url and '.m3u' not in url and '.mp4' not in url:
page = urllib.urlopen(url)
redirectUrl = page.geturl()
except:
Expand Down Expand Up @@ -824,6 +824,13 @@ def CreateVideoClipObject(url, title, thumb, summary, inc_container = False):
)
]
)
elif '.mp4' in url:
vco = VideoClipObject(
url = url + '&' + title,
title = title,
thumb = thumb,
summary = summary
)
else:
vco = VideoClipObject(
key = Callback(CreateVideoClipObject, url = url, title = title, thumb = thumb, summary = summary, inc_container = True),
Expand Down Expand Up @@ -1267,3 +1274,5 @@ def Pins(title):

oc.objects.sort(key=lambda obj: obj.title)
return oc

####################################################################################################
2 changes: 1 addition & 1 deletion Contents/Code/common.py
@@ -1,6 +1,6 @@
################################################################################
TITLE = "cCloud TV BETA | Popcorntime for LIVE TV"
VERSION = '0.12' # Release notation (x.y - where x is major and y is minor)
VERSION = '0.13' # Release notation (x.y - where x is major and y is minor)
GITHUB_REPOSITORY = 'coder-alpha/CcloudTv.bundle'
PREFIX = "/video/ccloudtv"
################################################################################
16 changes: 16 additions & 0 deletions Contents/Services/ServiceInfo.plist
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>URL</key>
<dict>
<key>Ccloud</key>
<dict>
<key>URLPatterns</key>
<array>
<string>.*mp4*.</string>
</array>
</dict>
</dict>
</dict>
</plist>
42 changes: 42 additions & 0 deletions Contents/Services/URL/Ccloud/ServiceCode.pys
@@ -0,0 +1,42 @@
IMDB_URL = 'http://www.imdb.com/xml/find?json=1&nr=1&tt=on&q='

####################################################################################################
def NormalizeURL(url):

return url

####################################################################################################
def MetadataObjectForURL(url):

splitContent = url.split('&')
title = splitContent[1]
#json = JSON.ObjectFromURL(IMDB_URL + title)

return VideoClipObject(
title = title
)

####################################################################################################
def MediaObjectsForURL(url):

splitContent = url.split('&')
url = splitContent[0]

return [
MediaObject(
container = Container.MP4,
video_codec = VideoCodec.H264,
audio_codec = AudioCodec.AAC,
audio_channels = 2,
optimized_for_streaming = True,
parts = [PartObject(key=Callback(PlayVideo, url=url))]
)
]

####################################################################################################
@indirect
def PlayVideo(url):

return IndirectResponse(VideoClipObject, key=url)


0 comments on commit cbb304a

Please sign in to comment.