Skip to content

Commit

Permalink
Merged 0.65 dev to master
Browse files Browse the repository at this point in the history
Fixes & Changes
  • Loading branch information
coder-alpha committed May 12, 2018
1 parent 2e24177 commit e5b5166
Show file tree
Hide file tree
Showing 26 changed files with 1,879 additions and 524 deletions.
708 changes: 373 additions & 335 deletions Contents/Code/__init__.py

Large diffs are not rendered by default.

40 changes: 27 additions & 13 deletions Contents/Code/common.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
################################################################################
TITLE = "FMoviesPlus"
VERSION = '0.64' # Release notation (x.y - where x is major and y is minor)
VERSION = '0.65' # Release notation (x.y - where x is major and y is minor)
TAG = ''
GITHUB_REPOSITORY = 'coder-alpha/FMoviesPlus.bundle'
PREFIX = "/video/fmoviesplus"
Expand All @@ -22,6 +22,7 @@
pass

BASE_URL = "https://fmovies.taxi"
BASE_URLS = ["https://bmovies.is","https://bmovies.to","https://bmovies.pro","https://bmovies.online","https://bmovies.club","https://bmovies.ru","https://fmovies.to","https://fmovies.is","https://fmovies.taxi","https://fmovies.se"]

JSEngines_ALLowed = ['Node']
Engine_OK = False
Expand Down Expand Up @@ -85,6 +86,7 @@
EMOJI_TXT_QUES = u'(?)'

INTERFACE_OPTIONS_LABELS = {'Provider':'Provider', 'Host':'Host', 'Proxy':'Proxy'}
BOOT_UP_CONTROL_SETTINGS = {'Provider':{}, 'Host':{}, 'Proxy':{}}

OPTIONS_PROXY = []
INTERNAL_SOURCES = []
Expand Down Expand Up @@ -162,6 +164,7 @@
USE_CUSTOM_TIMEOUT = False
MY_CLOUD_DISABLED = True
FMOVIES_HOSTS_DISABLED = ['mycloud', 'server fm']
SERVER_PLACEHOLDER = 'FMOVIES'
ENCRYPTED_URLS = False
DEV_DEBUG = False
WBH = 'aHR0cHM6Ly9ob29rLmlvL2NvZGVyLWFscGhhL3Rlc3Q='
Expand Down Expand Up @@ -402,18 +405,29 @@ def isForceNoCache(**kwargs):

####################################################################################################
def FixUrlInconsistencies(url):
url = url.replace('//www0.www','//www')
url = url.replace('//www1.www','//www')
url = url.replace('//www2.www','//www')
url = url.replace('//www3.www','//www')
url = url.replace('//www4.www','//www')
url = url.replace('//www5.www','//www')
url = url.replace('www0.www0.','www0.')
url = url.replace('www1.www1.','www1.')
url = url.replace('www2.www2.','www2.')
url = url.replace('www3.www3.','www3.')
url = url.replace('www4.www4.','www4.')
url = url.replace('www5.www5.','www5.')

try:
if ES_API_URL in url:
return url
m = re.findall(r'\:.*?(\w.*?.*?.)(fmovie|bmovie)', url)
if len(m) > 0:
url = url.replace(m[0][0], '')
else:
url = url.replace('//www0.www','//www')
url = url.replace('//www1.www','//www')
url = url.replace('//www2.www','//www')
url = url.replace('//www3.www','//www')
url = url.replace('//www4.www','//www')
url = url.replace('//www5.www','//www')
url = url.replace('www0.www0.','www0.')
url = url.replace('www1.www1.','www1.')
url = url.replace('www2.www2.','www2.')
url = url.replace('www3.www3.','www3.')
url = url.replace('www4.www4.','www4.')
url = url.replace('www5.www5.','www5.')
except:
pass

return url

####################################################################################################
Expand Down
23 changes: 18 additions & 5 deletions Contents/Code/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
DLT = []
Dict['DOWNLOAD_RATE_LIMIT_BUFFER'] = []
Dict['DOWNLOAD_RATE_LIMIT_TIME'] = []
REMAP_EXTRAS = {'behind the scenes':'behindthescenes', 'deleted scenes':'deleted', 'featurette':'featurette', 'interviews':'interview', 'misc.':'scene', 'music video':'short', 'trailer':'trailer'}

QUEUE_RUN_ITEMS = {}
WAIT_AND_RETRY_ON_429 = True
Expand Down Expand Up @@ -153,9 +154,9 @@ def download(self, file_meta_enc):
path = file_meta['section_path']

try:
vidtype = file_meta['vidtype']
vidtype = file_meta['vidtype'].lower()
except:
vidtype = 'Movie'
vidtype = 'movie'

file_meta['last_error'] = 'Unknown Error'
file_meta['error'] = 'Unknown Error'
Expand All @@ -180,7 +181,10 @@ def download(self, file_meta_enc):
source_meta = {}
f_meta = {}

fname = '%s (%s)%s%s' % (file_meta['title'], file_meta['year'], file_ext, fid + common.DOWNLOAD_FMP_EXT)
if vidtype in 'movie/show':
fname = '%s (%s)%s%s' % (file_meta['title'], file_meta['year'], file_ext, fid + common.DOWNLOAD_FMP_EXT)
else:
fname = '%s (%s)-%s%s%s' % (file_meta['title'], file_meta['year'], REMAP_EXTRAS[vidtype], file_ext, fid + common.DOWNLOAD_FMP_EXT)
abs_path = Core.storage.join_path(path, fname)
file_meta['temp_file'] = abs_path

Expand Down Expand Up @@ -222,7 +226,11 @@ def download(self, file_meta_enc):
Log('Save path: %s' % abs_path)

# https://support.plex.tv/articles/200220677-local-media-assets-movies/
fname = '%s (%s)%s' % (file_meta['title'], file_meta['year'], file_ext)
if vidtype in 'movie/show':
fname = '%s (%s)%s' % (file_meta['title'], file_meta['year'], file_ext)
else:
fname = '%s (%s)-%s%s' % (file_meta['title'], file_meta['year'], REMAP_EXTRAS[vidtype], file_ext)

item_folder_name = '%s (%s)' % (file_meta['title'], file_meta['year'])
final_abs_path = Core.storage.join_path(path, fname)

Expand Down Expand Up @@ -437,7 +445,12 @@ def download(self, file_meta_enc):

while (file_renamed_inc):
while Core.storage.file_exists(final_abs_path):
fname = '%s (%s)-%s%s' % (file_meta['title'], file_meta['year'], str(c), file_ext)

if vidtype in 'movie/show':
fname = '%s (%s)-%s%s' % (file_meta['title'], file_meta['year'], str(c), file_ext)
else:
fname = '%s (%s)-%s%s%s' % (file_meta['title'], file_meta['year'], REMAP_EXTRAS[vidtype], str(c), file_ext)

final_abs_path = Core.storage.join_path(path, fname)
fname = '%s (%s)%s' % (file_meta['title'], file_meta['year'], '.en.srt')
sub_file_path = Core.storage.join_path(path, fname)
Expand Down
3 changes: 2 additions & 1 deletion Contents/Code/externals.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
'darwin':{'url':'','file':'phantomjs','md5s':''},
'linux':{'url':'','file':'phantomjs','md5s':'0a6c36ddd62eee77a015d0592e009ce9'},
'linux2':{'url':'','file':'phantomjs','md5s':'0a6c36ddd62eee77a015d0592e009ce9'},
'freebsd9':{'url':'','file':'phantomjs','md5s':'c95484f0719e1cbbb39255316eea1997'},
'freebsd8':{'url':'','file':'phantomjs','md5s':'c95484f0719e1cbbb39255316eea1997'},
'freebsd9':{'url':'','file':'phantomjs','md5s':'1a811784bbacfa086513ae9f671e84f3'},
'generic':{'url':'','file':'phantomjs','md5s':''}
},
'Cryptodome': {
Expand Down
142 changes: 59 additions & 83 deletions Contents/Code/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

MC = common.NewMessageContainer(PREFIX, TITLE)

BACKUP_KEYS = ['DOWNLOAD_OPTIONS','INTERNAL_SOURCES_QUALS', 'INTERNAL_SOURCES_SIZES', 'INTERNAL_SOURCES_RIPTYPE', 'INTERNAL_SOURCES_FILETYPE', 'OPTIONS_PROVIDERS', 'OPTIONS_PROXY', 'INTERNAL_SOURCES']
BACKUP_KEYS = ['DOWNLOAD_OPTIONS','INTERNAL_SOURCES_QUALS', 'INTERNAL_SOURCES_SIZES', 'INTERNAL_SOURCES_RIPTYPE', 'INTERNAL_SOURCES_FILETYPE', 'OPTIONS_PROVIDERS', 'OPTIONS_PROXY', 'INTERNAL_SOURCES','BOOT_UP_CONTROL_SETTINGS']

####################################################################################################
@route(PREFIX + "/DevToolsC")
Expand Down Expand Up @@ -98,10 +98,9 @@ def DevToolsC(title=None, header=None, message=None, **kwargs):
else:
message = 'Could not retrieve output from externals.'
elif title == 'set_base_url':
base_urls = ["https://bmovies.is","https://bmovies.to","https://bmovies.pro","https://bmovies.online","https://bmovies.club","https://bmovies.ru","https://fmovies.to","https://fmovies.is","https://fmovies.taxi"]
oc = ObjectContainer(title2='Set Base URL')
base_url_match = False
for u in base_urls:
for u in common.BASE_URLS:
if u == fmovies.BASE_URL:
base_url_match = True
ch = common.GetEmoji(type=True) if u == fmovies.BASE_URL else common.GetEmoji(type=False)
Expand Down Expand Up @@ -175,8 +174,7 @@ def ClearCache(itemname, timeout=None, **kwargs):
######################################################################################
def SaveBookmarks(**kwargs):

fmovies_base = fmovies.BASE_URL.replace('https://www.','')
fmovies_base = fmovies_base.replace('https://','')
fmovies_base = fmovies.BASE_URL.replace('https://','')

items_in_bm = []

Expand All @@ -189,29 +187,16 @@ def SaveBookmarks(**kwargs):
summary = unicode(longstring.split('Key5Split')[2])
thumb = longstring.split('Key5Split')[3]

url = common.FixUrlInconsistencies(url)
url = url.replace('www.','')

if 'fmovies.to' in url:
url = url.replace('fmovies.to',fmovies_base)
elif 'bmovies.to' in url:
url = url.replace('bmovies.to',fmovies_base)
elif 'bmovies.online' in url:
url = url.replace('bmovies.online',fmovies_base)
elif 'bmovies.is' in url:
url = url.replace('bmovies.is',fmovies_base)
elif 'bmovies.pro' in url:
url = url.replace('bmovies.pro',fmovies_base)
elif 'fmovies.se' in url:
url = url.replace('fmovies.se',fmovies_base)
elif 'fmovies.is' in url:
url = url.replace('fmovies.is',fmovies_base)
elif 'fmovies.taxi' in url:
url = url.replace('fmovies.taxi',fmovies_base)
else:
if 'fmovies.' in longstring or 'bmovies.' in longstring:
urlhost = common.client.getUrlHost(url)
url = url.replace(urlhost,fmovies_base)
url = common.FixUrlInconsistencies(url)
#Log("BM : %s" % url)

for u in common.BASE_URLS:
u = common.client.getUrlHost(u)
if u in url:
url = url.replace(common.client.getUrlHost(u),fmovies_base)
break

#Log("BM : %s" % url)

Expand All @@ -220,8 +205,9 @@ def SaveBookmarks(**kwargs):

if len(items_in_bm) > 0:
bkup_file = Core.storage.join_path(resources_path, 'bookmarks.json')
with io.open(bkup_file, 'wb') as f:
json.dump(items_in_bm, f, indent=4, sort_keys=True, separators=(',', ': '))
with io.open(bkup_file, 'w', encoding='utf8') as f:
data = json.dumps(items_in_bm, indent=4, sort_keys=True, separators=(',', ': '), ensure_ascii=False)
f.write(unicode(data))
return len(items_in_bm)
else:
return 0
Expand All @@ -235,8 +221,11 @@ def LoadBookmarks(**kwargs):
bkup_file = Core.storage.join_path(resources_path, 'bookmarks.json')

if Core.storage.file_exists(bkup_file) and (Core.storage.file_size(bkup_file) != 0):
with io.open(bkup_file, 'r') as f:
file_read = f.read()
try:
with io.open(bkup_file, 'r', encoding='utf8') as f:
file_read = f.read()
except Exception as e:
Log('Error accessing/reading file bookmarks.json ! %s' % e)

if file_read != None:
items_in_bm = json.loads(file_read)
Expand All @@ -248,6 +237,8 @@ def LoadBookmarks(**kwargs):
summary = item['summary']
thumb = item['thumb']

url = common.FixUrlInconsistencies(url)

Dict[title+'-'+E(url)] = (title + 'Key5Split' + url +'Key5Split'+ summary + 'Key5Split' + thumb)

if len(items_in_bm) > 0:
Expand All @@ -260,8 +251,7 @@ def LoadBookmarks(**kwargs):
######################################################################################
def SaveConfig(**kwargs):

fmovies_base = fmovies.BASE_URL.replace('https://www.','')
fmovies_base = fmovies_base.replace('https://','')
fmovies_base = fmovies.BASE_URL.replace('https://','')

config = {}
items_in_recent = []
Expand All @@ -280,29 +270,16 @@ def SaveConfig(**kwargs):
summary = unicode(longstring.split('Key5Split')[2])
thumb = longstring.split('Key5Split')[3]

url = common.FixUrlInconsistencies(url)
url = url.replace('www.','')

if 'fmovies.to' in url:
url = url.replace('fmovies.to',fmovies_base)
elif 'bmovies.to' in url:
url = url.replace('bmovies.to',fmovies_base)
elif 'bmovies.online' in url:
url = url.replace('bmovies.online',fmovies_base)
elif 'bmovies.is' in url:
url = url.replace('bmovies.is',fmovies_base)
elif 'bmovies.pro' in url:
url = url.replace('bmovies.pro',fmovies_base)
elif 'fmovies.se' in url:
url = url.replace('fmovies.se',fmovies_base)
elif 'fmovies.is' in url:
url = url.replace('fmovies.is',fmovies_base)
elif 'fmovies.taxi' in url:
url = url.replace('fmovies.taxi',fmovies_base)
else:
if 'fmovies.' in longstring or 'bmovies.' in longstring:
urlhost = common.client.getUrlHost(url)
url = url.replace(urlhost,fmovies_base)
url = common.FixUrlInconsistencies(url)
#Log("BM : %s" % url)

for u in common.BASE_URLS:
u = common.client.getUrlHost(u)
if u in url:
url = url.replace(common.client.getUrlHost(u),fmovies_base)
break

#Log("BM : %s" % url)

Expand All @@ -323,8 +300,7 @@ def SaveConfig(**kwargs):

newlist = sorted(urls_list, key=lambda k: k['time'], reverse=True)

fmovies_base = fmovies.BASE_URL.replace('https://www.','')
fmovies_base = fmovies_base.replace('https://','')
fmovies_base = fmovies.BASE_URL.replace('https://','')

for each in newlist:

Expand All @@ -336,35 +312,27 @@ def SaveConfig(**kwargs):
thumb = longstringsplit[3]
timestr = longstringsplit[4]

#Log("%s %s" % (stitle, url))
url = url.replace('www.','')

ES = ''
if common.ES_API_URL.lower() in longstring.lower():
ES = common.EMOJI_EXT
if common.ANIME_URL.lower() in longstring.lower():
ES = common.EMOJI_ANIME

show = True
url = common.FixUrlInconsistencies(url)
url = url.replace('www.','')

if url.replace('fmovies.to',fmovies_base) in items_in_recent:
items_to_del.append(each['key'])
elif url.replace('bmovies.to',fmovies_base) in items_in_recent:
items_to_del.append(each['key'])
elif url.replace('bmovies.online',fmovies_base) in items_in_recent:
items_to_del.append(each['key'])
elif url.replace('bmovies.is',fmovies_base) in items_in_recent:
items_to_del.append(each['key'])
elif url.replace('bmovies.pro',fmovies_base) in items_in_recent:
items_to_del.append(each['key'])
elif url.replace('fmovies.se',fmovies_base) in items_in_recent:
items_to_del.append(each['key'])
elif url.replace('fmovies.is',fmovies_base) in items_in_recent:
items_to_del.append(each['key'])
elif url.replace('fmovies.taxi',fmovies_base) in items_in_recent:
items_to_del.append(each['key'])
else:
if 'fmovies.' in longstring or 'bmovies.' in longstring:
url = url.replace(common.client.geturlhost(url),fmovies_base)
url = common.FixUrlInconsistencies(url)
#Log("BM : %s" % url)

for u in common.BASE_URLS:
u = common.client.getUrlHost(u)
if u in url:
url = url.replace(common.client.getUrlHost(u),fmovies_base)
break

#Log("BM : %s" % url)

if url not in items_in_recent:
items_in_recent.append(url)
items_in_recentlisting.append({'title':stitle, 'url':url, 'summary':summary, 'thumb':thumb, 'time':timestr})

Expand Down Expand Up @@ -397,9 +365,9 @@ def SaveConfig(**kwargs):

try:
bkup_file = Core.storage.join_path(resources_path, 'config.json')

with io.open(bkup_file, 'wb') as f:
json.dump(config, f, indent=4, sort_keys=True, separators=(',', ': '))
with io.open(bkup_file, 'w', encoding='utf8') as f:
data = json.dumps(config, indent=4, sort_keys=True, separators=(',', ': '), ensure_ascii=False)
f.write(unicode(data))
return True
except Exception as e:
Log.Exception("tools.py>SaveConfig >> : >>> %s" % (e))
Expand All @@ -419,8 +387,11 @@ def LoadConfig(**kwargs):
try:
bkup_file = Core.storage.join_path(resources_path, 'config.json')
if Core.storage.file_exists(bkup_file) and (Core.storage.file_size(bkup_file) != 0):
with io.open(bkup_file, 'r') as f:
file_read = f.read()
try:
with io.open(bkup_file, 'r', encoding='utf8') as f:
file_read = f.read()
except Exception as e:
raise Exception('Error accessing/reading file config.json ! %s' % e)

if file_read != None:
try:
Expand Down Expand Up @@ -510,6 +481,11 @@ def LoadConfig(**kwargs):
common.INTERNAL_SOURCES = JSON.ObjectFromString(D(Dict['INTERNAL_SOURCES']))
except:
pass

try:
common.BOOT_UP_CONTROL_SETTINGS = JSON.ObjectFromString(D(Dict['BOOT_UP_CONTROL_SETTINGS']))
except:
pass

return True
else:
Expand Down
Loading

0 comments on commit e5b5166

Please sign in to comment.