Skip to content

Commit

Permalink
New features and Fixes
Browse files Browse the repository at this point in the history
New:
- Bookmarks listed alphabetically.
- A way to Bookmark 'Other Seasons' which lists all available season at
one place.
- SSL Web-proxy for compatibility with older PMS and where the site is
blocked (will work as long as Google and Openload are not blocked).
- Added Tag Search using the keyword they have listed (it still seems to
be developing) and organizes similar content.
- Added People Search.
- Added Site-News info

Fixes:
- Fixes new Tv-Series when a show has links from one source only.
- Fixes Bookmarks when two different movies had same title
- Fixes OpenLoad

Changes:
- Now using SharedCodeService
  • Loading branch information
coder-alpha committed Feb 11, 2017
1 parent 7a6d29f commit 05d2879
Show file tree
Hide file tree
Showing 12 changed files with 798 additions and 344 deletions.
689 changes: 516 additions & 173 deletions Contents/Code/__init__.py

Large diffs are not rendered by default.

141 changes: 123 additions & 18 deletions Contents/Code/common.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import time, fmovies, base64
import time, fmovies, base64, unicodedata, re
Openload = SharedCodeService.openload

################################################################################
TITLE = "FMoviesPlus"
VERSION = '0.07' # Release notation (x.y - where x is major and y is minor)
VERSION = '0.08' # Release notation (x.y - where x is major and y is minor)
GITHUB_REPOSITORY = 'coder-alpha/FMoviesPlus.bundle'
PREFIX = "/video/fmoviesplus"
################################################################################


# Vibrant Emoji's (might not be supported on all clients)
EMOJI_LINK = u'\U0001F517'
EMOJI_GREEN_HEART = u'\U0001F49A'
Expand Down Expand Up @@ -144,24 +146,127 @@ def GetHttpRequest(url, cookies=None):
req = None
return req

######################################################################################
@route(PREFIX + "/GetPageElements")
def GetPageElements(url, headers=None):

page_data_elems = None
try:
page_data_string = GetPageAsString(url=url, headers=headers)
page_data_elems = HTML.ElementFromString(page_data_string)
except:
pass

return page_data_elems

######################################################################################
@route(PREFIX + "/GetPageAsString")
def GetPageAsString(url, headers=None):

page_data_string = None
try:
if Prefs["use_https_alt"]:
if Prefs["use_debug"]:
Log("Using SSL Alternate Option")
Log("Url: " + url)
page_data_string = fmovies.request(url = url, headers=headers)
elif Prefs["use_web_proxy"]:
if Prefs["use_debug"]:
Log("Using SSL Web-Proxy Option")
Log("Url: " + url)

if headers == None:
page_data_string = HTTP.Request(fmovies.PROXY_URL + url).content
else:
page_data_string = HTTP.Request(fmovies.PROXY_URL + url, headers=headers).content
page_data_string = page_data_string.replace(fmovies.PROXY_PART1, fmovies.PROXY_PART1_REPLACE)
page_data_string = page_data_string.replace(fmovies.PROXY_PART2A, fmovies.PROXY_PART2_REPLACE)
page_data_string = page_data_string.replace(fmovies.PROXY_PART2B, fmovies.PROXY_PART2_REPLACE)
else:
if headers == None:
page_data_string = HTTP.Request(url).content
else:
page_data_string = HTTP.Request(url, headers=headers).content
except Exception as e:
Log('ERROR common.py>GetPageAsString: %s' % (e.args))
pass

return page_data_string

####################################################################################################
@route(PREFIX + "/getOpenloadID")
def getOpenloadID(url):

ol_id = None
try:
Openload.openloadhdr['Referer'] = url
webpage = GetPageAsString(url=url, headers=Openload.openloadhdr)

if 'File not found' in webpage or 'deleted by the owner' in webpage or 'Sorry!' in webpage:
return None

ol_id = Openload.search_regex('<span[^>]+id="[^"]+"[^>]*>([0-9]+)</span>',webpage, 'openload ID')
except:
pass

return ol_id

####################################################################################################
@route(PREFIX + "/removeAccents")
def removeAccents(text):
"""
Convert input text to id.
:param text: The input string.
:type text: String.
:returns: The processed String.
:rtype: String.
"""
text = strip_accents(text.lower())
text = re.sub('[ ]+', '_', text)
text = re.sub('[^0-9a-zA-Z]', ' ', text)
text = text.title()
return text

def strip_accents(text):
"""
Strip accents from input String.
:param text: The input string.
:type text: String.
:returns: The processed String.
:rtype: String.
"""
try:
text = unicode(text, 'utf-8')
except NameError: # unicode is a default on python 3
pass
text = unicodedata.normalize('NFD', text)
text = text.encode('ascii', 'ignore')
text = text.decode("utf-8")
return str(text)


####################################################################################################
# author: Twoure
# source: https://github.com/Twoure/HindiMoviesOnline.bundle/blob/master/Contents/Code/messages.py
#
class NewMessageContainer(object):
def __init__(self, prefix, title):
self.title = title
Route.Connect(prefix + '/message', self.message_container)

def message_container(self, header, message):
"""Setup MessageContainer depending on Platform"""

if Client.Platform in ['Plex Home Theater', 'OpenPHT']:
oc = ObjectContainer(
title1=self.title, title2=header, no_cache=True,
no_history=True, replace_parent=True
)
oc.add(PopupDirectoryObject(title=header, summary=message))
return oc
else:
return MessageContainer(header, message)
def __init__(self, prefix, title):
self.title = title
Route.Connect(prefix + '/message', self.message_container)

def message_container(self, header, message):
"""Setup MessageContainer depending on Platform"""

if Client.Platform in ['Plex Home Theater', 'OpenPHT']:
oc = ObjectContainer(
title1=self.title, title2=header, no_cache=True,
no_history=True, replace_parent=True
)
oc.add(PopupDirectoryObject(title=header, summary=message))
return oc
else:
return MessageContainer(header, message)
Loading

0 comments on commit 05d2879

Please sign in to comment.