.+?on ([^"]*).+?f="([^"]*)', u)
426 | e = [(i[0], i[1]) for i in e if 'pandamovie' not in i[1]]
427 | return e
428 | except:
429 | return
430 |
431 | def winporn(self, url):
432 | try:
433 | r = client.request(url)
434 | link = re.findall('var video_id = "(.+?)"', r)[0]
435 | r = 'http://nl.winporn.com/player_config_json/?vid=' + link + '&aid=0&domain_id=0&embed=0&ref=&check_speed=0'
436 | return self.generic(r)
437 | except:
438 | return
439 |
440 | def yuvutu(self, url):
441 | try:
442 | r = client.request(url)
443 | r = client.parseDOM(r, 'iframe', ret='src')
444 | r = [i for i in r if 'embed' in i][0]
445 | r = urljoin(url, r)
446 | return self.generic(r)
447 | except:
448 | return
449 |
450 | def hugesix(self, url):
451 | try:
452 | main = client.request(url)
453 | links = re.findall('config=(.+?)",', main)[0]
454 | link = links
455 | link = client.request(link)
456 | express1 = '(.+?)'
457 | express2 = '(.+?)'
458 | play = re.compile(express1, re.MULTILINE | re.DOTALL).findall(link)
459 | if not play: play = re.compile(express2, re.MULTILINE | re.DOTALL).findall(link)
460 | play = play[0]
461 | return play
462 | except:
463 | return
464 |
465 | def boobntit(self, url):
466 | try:
467 | main = client.request(url)
468 | link = client.parseDOM(main, 'div', attrs={'id': 'player'})
469 | link = client.parseDOM(link, 'iframe', ret='src')
470 | link = link[0]
471 | return self.generic(link)
472 | except:
473 | return self.generic(url)
474 |
475 | def sexmax(self, url):
476 | try:
477 | url = client.request(url)
478 | express = '.+?.
21 | '''
22 | from __future__ import absolute_import
23 | import time
24 |
25 | from resources.lib.modules import adultresolver
26 | import os
27 | from packlib import kodi, log_utils, client
28 | from resources.lib.modules import local_utils
29 | import sqlite3
30 | from kodi_six import xbmc, xbmcvfs
31 | from resolveurl import add_plugin_dirs, hmf
32 | import six
33 |
34 | from resources.lib.modules.player import multilinkselector
35 |
36 | adultresolver = adultresolver.streamer()
37 |
38 | URLopener = six.moves.urllib.request.URLopener
39 | quote_plus = six.moves.urllib.parse.quote_plus
40 | unquote_plus = six.moves.urllib.parse.unquote_plus
41 |
42 |
43 | buildDirectory = local_utils.buildDir
44 |
45 |
46 | xxx_plugins_path = 'special://home/addons/script.module.resolveurl.xxx/resources/plugins/'
47 |
48 | if xbmcvfs.exists(xxx_plugins_path):
49 | add_plugin_dirs(xbmc.translatePath(xxx_plugins_path))
50 |
51 | download_icon = xbmc.translatePath(os.path.join('special://home/addons/script.adultflix.artwork/resources/art/main', 'downloads.png'))
52 |
53 |
54 | class MyOpener(URLopener):
55 | version = 'python-requests/2.9.1'
56 |
57 |
58 | myopener = MyOpener()
59 | urlretrieve = MyOpener().retrieve
60 | urlopen = MyOpener().open
61 | download_location = kodi.get_setting("download_location")
62 | download_folder = xbmc.translatePath(download_location)
63 |
64 | databases = xbmc.translatePath(os.path.join(kodi.datafolder, 'databases'))
65 | downloaddb = xbmc.translatePath(os.path.join(databases, 'downloads.db'))
66 |
67 | if not os.path.exists(databases):
68 | os.makedirs(databases)
69 | conn = sqlite3.connect(downloaddb)
70 | c = conn.cursor()
71 | try:
72 | c.executescript("CREATE TABLE IF NOT EXISTS downloads (name, url, image);")
73 | except:
74 | pass
75 | conn.close()
76 |
77 |
78 | @local_utils.url_dispatcher.register('27')
79 | def getDownloads():
80 |
81 | if not os.path.exists(download_folder):
82 | os.makedirs(download_folder)
83 |
84 | dirlist = []
85 | lst = [
86 | (kodi.giveColor('Download Location: ', 'white') + 'file_path' + kodi.giveColor(str(download_folder), 'violet'),
87 | None, 19, download_icon, False),
88 | (kodi.giveColor('Change Download Location', 'white'), None, 19, download_icon, False),
89 | ('-----------------------------------------------', None, 999, download_icon, False)
90 | ]
91 |
92 | extensions = ['.mp4']
93 |
94 | for file in os.listdir(download_folder):
95 | for extension in extensions:
96 | if file.endswith('.tmp_mp4'):
97 | try:
98 | os.remove(os.path.join(download_folder, file))
99 | except:
100 | pass
101 | if file.endswith(extension):
102 | name = unquote_plus(file)
103 | lst += [
104 | (kodi.giveColor(str(name), 'white'), os.path.join(download_folder, file), 803, None, True),
105 | ]
106 |
107 | conn = sqlite3.connect(downloaddb)
108 | conn.text_factory = str
109 | c = conn.cursor()
110 | for i in lst:
111 | find_string = i[0]
112 | if i[1]:
113 | try:
114 | find_string = find_string.replace('.mp4', '')
115 | find_string = kodi.stripColor(find_string)
116 | c.execute("SELECT image FROM downloads WHERE name = '%s'" % find_string)
117 | icon = c.fetchone()[0]
118 | except:
119 | icon = None
120 | else:
121 | icon = i[3]
122 | dirlist.append({'name': find_string, 'url': i[1], 'mode': i[2], 'icon': icon, 'fanart': None, 'folder': False,
123 | 'isDownloaded': i[4]})
124 |
125 | if c:
126 | c.close()
127 |
128 | if len(lst) < 4:
129 | dirlist.append(
130 | {'name': kodi.giveColor('No Downloads Found', 'white'), 'url': 'None', 'mode': 999, 'icon': download_icon,
131 | 'fanart': None, 'folder': False})
132 |
133 | buildDirectory(dirlist)
134 |
135 |
136 | def addDownload(name, url, img):
137 | conn = sqlite3.connect(downloaddb)
138 | conn.text_factory = str
139 | c = conn.cursor()
140 | c.execute("INSERT INTO downloads VALUES (?,?,?)", (name, url, img))
141 | conn.commit()
142 | conn.close()
143 |
144 |
145 | @local_utils.url_dispatcher.register('28', ['url', 'name'])
146 | def removeDownload(url, name):
147 | try:
148 | os.remove(url)
149 | try:
150 | name = name.replace('.mp4', '')
151 | name = kodi.stripColor(name)
152 | conn = sqlite3.connect(downloaddb)
153 | c = conn.cursor()
154 | c.execute("DELETE FROM downloads WHERE name = '%s'" % name)
155 | conn.commit()
156 | conn.close()
157 | except:
158 | pass
159 | kodi.notify(msg='Removed successfully.')
160 | except:
161 | kodi.notify(msg='Error removing file.')
162 | xbmc.executebuiltin("Container.Refresh")
163 |
164 |
165 | @local_utils.url_dispatcher.register('26', ['url', 'name', 'iconimage'])
166 | def find_link(url, name, iconimage, downloadableLink=False):
167 | xbmc.executebuiltin("ActivateWindow(busydialog)")
168 |
169 | if '|SPLIT|' in url: url = url.split('|SPLIT|')[0]
170 | if 'site=' in url: url = url.split('site=')[0]
171 | if '|' in url: url = url.split('|User-Agent')[0]
172 |
173 | c = client.request(url, output='headers')
174 |
175 | checks = ['video', 'mpegurl']
176 | exts = ['.mp4', '.flv', '.m3u8']
177 |
178 | try:
179 | if any(f for f in checks if f in c['Content-Type']): downloadableLink = True
180 | except:
181 | if any(f for f in exts if f in url):
182 | downloadableLink = True
183 | else:
184 | xbmc.executebuiltin("Dialog.Close(busydialog)")
185 | kodi.notify(msg='Error downloading video.')
186 | quit()
187 |
188 | name = kodi.stripColor(name)
189 | if '] -' in name: name = name.split('] -')[1]
190 | if downloadableLink:
191 | dest = getDest()
192 | dest = os.path.join(dest, '%s.mp4' % quote_plus(name))
193 | download(url, name, iconimage, dest)
194 | else:
195 | u = None
196 | log_utils.log('Sending %s to XXX Resolver' % (url), xbmc.LOGNOTICE)
197 | if hmf.HostedMediaFile(url).valid_url():
198 | log_utils.log('%s is a valid SMR resolvable URL. Attempting to resolve.' % (url), xbmc.LOGNOTICE)
199 | try:
200 | u = hmf.HostedMediaFile(url).resolve()
201 | except Exception as e:
202 | log_utils.log('Error getting valid link from SMR :: %s :: %s' % (url, str(e)), xbmc.LOGERROR)
203 | kodi.idle()
204 | kodi.notify(msg='Something went wrong! | %s' % str(e), duration=8000, sound=True)
205 | quit()
206 | log_utils.log('Link returned by XXX Resolver :: %s' % (u), xbmc.LOGNOTICE)
207 | else:
208 | log_utils.log(
209 | '%s is not a valid SMR resolvable link. Attempting to resolve by AdultFlix backup resolver.' % (url),
210 | xbmc.LOGNOTICE)
211 | try:
212 | u = adultresolver.resolve(url)
213 | except Exception as e:
214 | log_utils.log('Error getting valid link from SMR :: %s :: %s' % (url, str(e)), xbmc.LOGERROR)
215 | kodi.idle()
216 | kodi.notify(msg='Something went wrong! | %s' % str(e), duration=8000, sound=True)
217 | quit()
218 | log_utils.log('%s returned by AdultFlix backup resolver.' % (u), xbmc.LOGNOTICE)
219 | if not isinstance(u, str):
220 | try:
221 | u = multilinkselector(u)
222 | except:
223 | pass
224 | if u == 'quit':
225 | xbmc.executebuiltin("Dialog.Close(busydialog)")
226 | quit()
227 | if u:
228 | dest = getDest()
229 | dest = os.path.join(dest, '%s.tmp_mp4' % quote_plus(name))
230 | download(u, name, iconimage, dest)
231 | else:
232 | xbmc.executebuiltin("Dialog.Close(busydialog)")
233 | kodi.notify('No Downloadable Link Found.')
234 | quit()
235 |
236 |
237 | def getDest():
238 | if (not os.path.exists(download_folder)):
239 | try:
240 | os.makedirs(download_folder)
241 | except:
242 | kodi.notify('Error creating download folder.')
243 | quit()
244 | if (not download_folder):
245 | kodi.notify('Error getting destination location.')
246 | quit()
247 | return download_folder
248 |
249 |
250 | def download(url, name, icon, dest, dp=None):
251 | xbmc.executebuiltin("Dialog.Close(busydialog)")
252 | if '|' in url:
253 | url = url.split('|')[0]
254 | if not dp:
255 | dp = kodi.dp
256 | dp.create(kodi.get_name(), "Downloading: %s" % name, ' ', ' ')
257 | dp.update(0)
258 | start_time = time.time()
259 | log_utils.log('Attempting to download :: %s' % url, xbmc.LOGNOTICE)
260 | urlretrieve(url, dest, lambda nb, bs, fs: _pbhook(dest, nb, bs, fs, dp, start_time))
261 | addDownload(name, url, icon)
262 | kodi.notify(msg='Download Complete', sound=True)
263 | log_utils.log('Download complete.', xbmc.LOGNOTICE)
264 | finish_up(dest)
265 |
266 |
267 | def finish_up(dest):
268 | new = dest.replace('.tmp_mp4', '.mp4')
269 | os.rename(dest, new)
270 |
271 |
272 | def _pbhook(dest, numblocks, blocksize, filesize, dp, start_time):
273 | try:
274 | if filesize <= 0:
275 | kodi.notify(msg='Invalid downloadable file', sound=True)
276 | log_utils.log('Error downloading video.', xbmc.LOGERROR)
277 | quit()
278 | percent = min(numblocks * blocksize * 100 / filesize, 100)
279 | currently_downloaded = float(numblocks) * blocksize / (1024 * 1024)
280 | kbps_speed = numblocks * blocksize / (time.time() - start_time)
281 | if kbps_speed > 0:
282 | eta = (filesize - numblocks * blocksize) / kbps_speed
283 | else:
284 | eta = 0
285 | kbps_speed = kbps_speed / 1024
286 | mbps_speed = kbps_speed / 1024
287 | total = float(filesize) / (1024 * 1024)
288 | mbs = '[COLOR dodgerblue]%.02f MB[/COLOR] of [B]%.02f MB[/B]' % (currently_downloaded, total)
289 | e = '[COLOR white][B]Speed: [/B][/COLOR][COLOR dodgerblue]%.02f Mb/s ' % mbps_speed + '[/COLOR]'
290 | e += '[COLOR white][B]ETA: [/B][/COLOR][COLOR dodgerblue]%02d:%02d' % divmod(eta, 60) + '[/COLOR]'
291 | dp.update(percent, '', mbs, e)
292 | except:
293 | dp.close()
294 | kodi.notify(msg='Error Downloading. Exiting...')
295 | quit()
296 | if dp.iscanceled():
297 | dp.close()
298 | kodi.notify(msg='Download Cancelled')
299 | quit()
300 |
--------------------------------------------------------------------------------
/resources/lib/modules/favorites.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | '''
4 | AdultFlix XXX Addon (18+) for the Kodi Media Center
5 | Kodi is a registered trademark of the XBMC Foundation.
6 | We are not connected to or in any other way affiliated with Kodi - DMCA: legal@tvaddons.co
7 | Support: https://github.com/tvaddonsco/plugin.video.adultflix
8 |
9 | License summary below, for more details please read license.txt file
10 |
11 | This program is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 2 of the License, or
14 | (at your option) any later version.
15 | This program is distributed in the hope that it will be useful,
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | GNU General Public License for more details.
19 | You should have received a copy of the GNU General Public License
20 | along with this program. If not, see .
21 | '''
22 | from __future__ import absolute_import
23 | import sqlite3
24 |
25 | from packlib import kodi, log_utils
26 | import os
27 | from resources.lib.modules import local_utils
28 | from kodi_six import xbmc, xbmcgui
29 |
30 | buildDirectory = local_utils.buildDir
31 | databases = xbmc.translatePath(os.path.join(kodi.datafolder, 'databases'))
32 | favoritesdb = xbmc.translatePath(os.path.join(databases, 'favorites.db'))
33 | fav_icon = xbmc.translatePath(os.path.join('special://home/addons/script.adultflix.artwork/resources/art/main', 'favourites.png'))
34 |
35 | if not os.path.exists(databases):
36 | os.makedirs(databases)
37 | conn = sqlite3.connect(favoritesdb)
38 | c = conn.cursor()
39 | try:
40 | c.executescript("CREATE TABLE IF NOT EXISTS favorites (name, url, mode, image, folder);")
41 | except:
42 | pass
43 | conn.close()
44 |
45 |
46 | @local_utils.url_dispatcher.register('23')
47 | def getFavorites():
48 | dirlist = []
49 | lst = [('Clear Favourites', None, 38, fav_icon, None, None, False, False),
50 | ('----------------------------------', None, 999, fav_icon, None, None, False, False)
51 | ]
52 | conn = sqlite3.connect(favoritesdb)
53 | conn.text_factory = str
54 | c = conn.cursor()
55 | c.execute("SELECT * FROM favorites ORDER BY name ASC")
56 | for (name, url, mode, iconimage, _folder) in c.fetchall():
57 | try:
58 | site = url.split('|SPLIT|')[1]
59 | except:
60 | site = None
61 | if site: name = '[%s Video] %s' % (site, name)
62 | if _folder:
63 | name = '[%s] %s' % ('Directory', name)
64 | else:
65 | _folder = False
66 | lst += [(name, url, mode, iconimage, None, 'del', _folder, True)]
67 | conn.close()
68 |
69 | for i in lst:
70 | if not i[3]:
71 | icon = kodi.addonicon
72 | else:
73 | icon = i[3]
74 | if not i[4]:
75 | fanart = kodi.addonfanart
76 | else:
77 | fanart = i[4]
78 | dirlist.append(
79 | {
80 | 'name': kodi.giveColor(i[0], 'white'), 'url': i[1], 'mode': i[2], 'icon': icon, 'fanart': fanart,
81 | 'fav': i[5], 'folder': i[6], 'isDownloadable': i[7]
82 | }
83 | )
84 |
85 | if len(lst) < 3:
86 | dirlist.append(
87 | {
88 | 'name': kodi.giveColor('No Favorites Found', 'white'), 'url': 'None', 'mode': 999, 'icon': fav_icon,
89 | 'fanart': fanart, 'folder': False
90 | }
91 | )
92 |
93 | buildDirectory(dirlist)
94 |
95 |
96 | @local_utils.url_dispatcher.register('100', ['fav', 'favmode', 'name', 'url', 'iconimage', 'folder'])
97 | def Favorites(fav, favmode, name, url, img, _folder):
98 | if fav == "add":
99 | delFav(url)
100 | addFav(favmode, name, url, img, _folder)
101 | kodi.notify('Favorite added', 'Item added to the favorites')
102 | elif fav == "del":
103 | delFav(url)
104 | log_utils.log('Deleting %s from favorites' % (url), xbmc.LOGNOTICE)
105 | kodi.notify('Favorite deleted', 'Item removed from the list')
106 | xbmc.executebuiltin('Container.Refresh')
107 |
108 |
109 | @local_utils.url_dispatcher.register('38')
110 | def clearFavorites():
111 | if os.path.isfile(favoritesdb):
112 | choice = xbmcgui.Dialog().yesno(kodi.get_name(),
113 | kodi.giveColor('Would you like to clear all of your favorites?', 'white'))
114 | if choice:
115 | try:
116 | os.remove(favoritesdb)
117 | except:
118 | kodi.notify(msg='Error clearing favorites.')
119 | xbmc.executebuiltin("Container.Refresh")
120 |
121 |
122 | def addFav(mode, name, url, img, _folder):
123 | conn = sqlite3.connect(favoritesdb)
124 | conn.text_factory = str
125 | c = conn.cursor()
126 | c.execute("INSERT INTO favorites VALUES (?,?,?,?,?)", (name, url, mode, img, _folder))
127 | conn.commit()
128 | conn.close()
129 |
130 |
131 | def delFav(url):
132 | conn = sqlite3.connect(favoritesdb)
133 | c = conn.cursor()
134 | c.execute("DELETE FROM favorites WHERE url = '%s'" % url)
135 | conn.commit()
136 | conn.close()
137 |
--------------------------------------------------------------------------------
/resources/lib/modules/firstStart.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | '''
4 | AdultFlix XXX Addon (18+) for the Kodi Media Center
5 | Kodi is a registered trademark of the XBMC Foundation.
6 | We are not connected to or in any other way affiliated with Kodi - DMCA: legal@tvaddons.co
7 | Support: https://github.com/tvaddonsco/plugin.video.adultflix
8 |
9 | License summary below, for more details please read license.txt file
10 |
11 | This program is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 2 of the License, or
14 | (at your option) any later version.
15 | This program is distributed in the hope that it will be useful,
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | GNU General Public License for more details.
19 | You should have received a copy of the GNU General Public License
20 | along with this program. If not, see .
21 | '''
22 | from __future__ import absolute_import
23 | import os, sys
24 | from packlib import kodi, client
25 | from resources.lib.modules import local_utils
26 |
27 | class run:
28 |
29 | def __init__(self):
30 |
31 | self.firstRunFile = os.path.join(kodi.datafolder, 'firstrun.txt')
32 | self.informationFile = os.path.join(kodi.addonfolder, 'resources/files/information.txt')
33 |
34 | if ( not os.path.isfile(self.firstRunFile) ):
35 | self.checkAge()
36 | kodi.busy()
37 | try:
38 | countme = client.request('http://bit.ly/2vchTCP')
39 | except:
40 | pass
41 | kodi.idle()
42 | try:
43 | local_utils.viewDialog(self.informationFile)
44 | except:
45 | pass
46 | return
47 |
48 | def checkAge(self):
49 |
50 | choice = kodi.dialog.yesno(kodi.get_name(), 'To use this addon you you must be legally allowed to under the laws of your State/Country. By pressing I Agree you accept that you are legally allowed to view adult content.',yeslabel='I Agree',nolabel='Exit')
51 | if choice:
52 | try:
53 | with open(self.firstRunFile,mode='w'):
54 | pass
55 | except:
56 | pass
57 | else:
58 | sys.exit(1)
--------------------------------------------------------------------------------
/resources/lib/modules/helper.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | '''
4 | AdultFlix XXX Addon (18+) for the Kodi Media Center
5 | Kodi is a registered trademark of the XBMC Foundation.
6 | We are not connected to or in any other way affiliated with Kodi - DMCA: legal@tvaddons.co
7 | Support: https://github.com/tvaddonsco/plugin.video.adultflix
8 |
9 | License summary below, for more details please read license.txt file
10 |
11 | This program is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 2 of the License, or
14 | (at your option) any later version.
15 | This program is distributed in the hope that it will be useful,
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | GNU General Public License for more details.
19 | You should have received a copy of the GNU General Public License
20 | along with this program. If not, see .
21 | '''
22 | from __future__ import absolute_import
23 | from packlib import cache, client, dom_parser2, kodi, log_utils
24 | import os
25 | import re
26 | import six
27 | urljoin = six.moves.urllib.parse.urljoin
28 | from resources.lib.modules import local_utils
29 | from kodi_six import xbmc, xbmcplugin
30 |
31 | buildDirectory = local_utils.buildDir
32 |
33 |
34 | class scraper:
35 |
36 | def get_list(self, mode, type, url, title_pattern, url_pattern, icon_pattern=None, site=None, d_p1=None, d_p2=None,
37 | d_p3=None, parse=None, cache_time=None, searched=False, stopend=False, isVideo=False,
38 | isDownloadable=False):
39 |
40 | if cache_time:
41 | r = cache.get(client.request, cache_time, url)
42 | else:
43 | r = client.request(url)
44 |
45 | if 're|' in d_p3:
46 | d_p3 = d_p3.replace('re|', '')
47 | r = dom_parser2.parse_dom(r, d_p1, {d_p2: re.compile('%s' % d_p3)})
48 | else:
49 | r = dom_parser2.parse_dom(r, d_p1, {d_p2: d_p3})
50 |
51 | if r:
52 |
53 | dirlst = []
54 |
55 | for i in r:
56 | name = re.findall(r'%s' % title_pattern, i.content)[0]
57 | name = kodi.sortX(i[1].encode('utf-8'))
58 | url = re.findall(r'%s' % url_pattern, i.content)[0]
59 | if icon_pattern:
60 | iconimage = re.findall(r'%s' % icon_pattern, i.content)[0]
61 | elif site:
62 | iconimage = xbmc.translatePath(os.path.join('special://home/addons/script.adultflix.artwork', 'resources/art/%s/icon.png' % site))
63 | else:
64 | iconimage = xbmc.translatePath(os.path.join('special://home/addons/' + kodi.get_id(), 'icon.png'))
65 | fanarts = xbmc.translatePath(os.path.join('special://home/addons/script.adultflix.artwork', 'resources/art/%s/fanart.jpg' % site))
66 | if parse:
67 | link, tag = parse.split('|SPLIT|')
68 | if tag == 'url':
69 | url = urljoin(link, url)
70 | elif tag == 'icon':
71 | iconimage = urljoin(link, iconimage)
72 | else:
73 | url = urljoin(link, url)
74 | iconimage = urljoin(link, iconimage)
75 | if site: url += '|SPLIT|' + site
76 | if type == 'dir':
77 | dirlst.append(
78 | {
79 | 'name': kodi.giveColor(name, 'white'), 'url': url, 'mode': mode, 'icon': iconimage,
80 | 'fanart': fanarts, 'description': name, 'folder': True
81 | }
82 | )
83 | else:
84 | dirlst.append(
85 | {
86 | 'name': kodi.giveColor(name, 'white'), 'url': url, 'mode': mode, 'icon': iconimage,
87 | 'fanart': fanarts, 'description': name, 'folder': False
88 | }
89 | )
90 |
91 | if dirlst:
92 | if stopend:
93 | buildDirectory(dirlst, stopend=True, isVideo=isVideo, isDownloadable=isDownloadable)
94 | else:
95 | buildDirectory(dirlst, isVideo=isVideo, isDownloadable=isDownloadable)
96 |
97 | def get_next_page(self, mode, url, pattern, site='', parse=None, pictures=False):
98 |
99 | try:
100 | dirlst = []
101 | icon = xbmc.translatePath(
102 | os.path.join('special://home/addons/script.adultflix.artwork', 'resources/art/main/next.png'))
103 | fanart = xbmc.translatePath(
104 | os.path.join('special://home/addons/script.adultflix.artwork', 'resources/art/%s/fanart.jpg' % site))
105 | if '|GOT_URL' in url:
106 | url = url.split('|GOT_URL')[0]
107 | dirlst.append(
108 | {
109 | 'name': kodi.giveColor('Next Page -->', 'white'), 'url': url, 'mode': mode, 'icon': icon,
110 | 'fanart': fanart, 'description': 'Load More......', 'folder': True
111 | }
112 | )
113 | else:
114 | r = client.request(url)
115 | url = re.findall(r'%s' % pattern, r)[0]
116 | if parse:
117 | url = urljoin(parse, url)
118 | if '&' in url: url = url.replace('&', '&')
119 | dirlst.append(
120 | {
121 | 'name': kodi.giveColor('Next Page -->', 'white'), 'url': url, 'mode': mode, 'icon': icon,
122 | 'fanart': fanart, 'description': 'Load More......', 'folder': True
123 | }
124 | )
125 | if 'chaturbate' in url:
126 | if dirlst: buildDirectory(dirlst, isVideo=True, chaturbate=True)
127 | elif pictures:
128 | if dirlst: buildDirectory(dirlst, pictures=True)
129 | else:
130 | if dirlst: buildDirectory(dirlst, isVideo=True)
131 | except Exception as e:
132 | log_utils.log('Error getting next page for %s :: Error: %s' % (site.title(), str(e)), xbmc.LOGERROR)
133 | xbmcplugin.setContent(kodi.syshandle, 'movies')
134 | if 'chaturbate' in url:
135 | local_utils.setView('chaturbate')
136 | elif pictures:
137 | local_utils.setView('pictures')
138 | else:
139 | local_utils.setView('thumbs')
140 | xbmcplugin.endOfDirectory(kodi.syshandle, cacheToDisc=True)
141 |
--------------------------------------------------------------------------------
/resources/lib/modules/history.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | '''
4 | AdultFlix XXX Addon (18+) for the Kodi Media Center
5 | Kodi is a registered trademark of the XBMC Foundation.
6 | We are not connected to or in any other way affiliated with Kodi - DMCA: legal@tvaddons.co
7 | Support: https://github.com/tvaddonsco/plugin.video.adultflix
8 |
9 | License summary below, for more details please read license.txt file
10 |
11 | This program is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 2 of the License, or
14 | (at your option) any later version.
15 | This program is distributed in the hope that it will be useful,
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | GNU General Public License for more details.
19 | You should have received a copy of the GNU General Public License
20 | along with this program. If not, see .
21 | '''
22 | from __future__ import absolute_import
23 | import sqlite3
24 |
25 | import datetime
26 | import os
27 | from resources.lib.modules import local_utils
28 | from kodi_six import xbmc, xbmcgui
29 | from packlib import kodi
30 |
31 | buildDirectory = local_utils.buildDir
32 | databases = xbmc.translatePath(os.path.join(kodi.datafolder, 'databases'))
33 | historydb = xbmc.translatePath(os.path.join(databases, 'history.db'))
34 | history_icon = xbmc.translatePath(os.path.join('special://home/addons/script.adultflix.artwork/resources/art/main', 'history.png'))
35 |
36 | if not os.path.exists(databases):
37 | os.makedirs(databases)
38 | conn = sqlite3.connect(historydb)
39 | c = conn.cursor()
40 | try:
41 | c.executescript(
42 | "CREATE TABLE IF NOT EXISTS history (ID Integer PRIMARY KEY AUTOINCREMENT, date, time, name, url, site, icon);")
43 | except:
44 | pass
45 | conn.close()
46 |
47 |
48 | @local_utils.url_dispatcher.register('20')
49 | def getHistory():
50 | history_on_off = kodi.get_setting("history_setting")
51 |
52 | if history_on_off == "true":
53 |
54 | lst = [
55 | ('Clear History', None, 21, history_icon, False)
56 | ,
57 | ('Disable History', None, 22, history_icon, False)
58 | ,
59 | ('-------------------------------------', None, 999, history_icon, False)
60 | ]
61 |
62 | conn = sqlite3.connect(historydb)
63 | conn.text_factory = str
64 | c = conn.cursor()
65 | c.execute("SELECT * FROM history ORDER BY ID DESC")
66 |
67 | for (ID, date, time, title, url, site, iconimage) in c.fetchall():
68 | try:
69 | if site == 'Local File':
70 | lst += [('[%s | %s - %s] - %s' % (kodi.giveColor(site, 'pink'), date, time, title), url + 'site=' + site + 'typeid=history', 801, iconimage, False)]
71 | else:
72 | lst += [('[%s | %s - %s] - %s' % (kodi.giveColor(site, 'pink'), date, time, title), url + 'site=' + site + 'typeid=history', 801, iconimage, True)]
73 | except:
74 | pass
75 | conn.close()
76 |
77 | if len(lst) < 4:
78 | lst += [('No History Found', None, 999, history_icon, False)]
79 | else:
80 | lst = [
81 | ('Enable History Monitoring', None, 22, history_icon, False)
82 | ,
83 | ('-------------------------------------', None, 22, history_icon, False)
84 | ,
85 | ('History monitoring is currently disabled.', None, 22, history_icon, False)
86 | ]
87 |
88 | dirlst = []
89 | for i in lst:
90 | if not i[3]:
91 | icon = kodi.addonicon
92 | else:
93 | icon = i[3]
94 | fanart = kodi.addonfanart
95 | dirlst.append(
96 | {
97 | 'name': kodi.giveColor(i[0], 'white'), 'url': i[1], 'mode': i[2], 'icon': icon, 'fanart': fanart,
98 | 'folder': False, 'isDownloadable': i[4]
99 | }
100 | )
101 |
102 | buildDirectory(dirlst)
103 |
104 |
105 | def addHistory(name, url, site, iconimage):
106 | delEntry(url)
107 | date_now = datetime.datetime.now().strftime("%d-%m-%Y")
108 | time_now = datetime.datetime.now().strftime("%H:%M")
109 | conn = sqlite3.connect(historydb)
110 | conn.text_factory = str
111 | c = conn.cursor()
112 | c.execute("INSERT INTO history VALUES (?,?,?,?,?,?,?)", (None, date_now, time_now, name, url, site.title(), iconimage))
113 | conn.commit()
114 | conn.close()
115 |
116 |
117 | @local_utils.url_dispatcher.register('24', ['url'])
118 | def delEntry(url):
119 | refresh = False
120 | try:
121 | if 'site=' in url:
122 | url = url.split('site=')[0]
123 | refresh = True
124 | conn = sqlite3.connect(historydb)
125 | c = conn.cursor()
126 | c.execute("DELETE FROM history WHERE url = '%s'" % url)
127 | conn.commit()
128 | conn.close()
129 | except:
130 | pass
131 |
132 | if refresh:
133 | xbmc.executebuiltin("Container.Refresh")
134 |
135 |
136 | @local_utils.url_dispatcher.register('21')
137 | def clearHistory():
138 | if os.path.isfile(historydb):
139 | choice = xbmcgui.Dialog().yesno(kodi.get_name(), kodi.giveColor('Would you like to clear all history?', 'white'))
140 | if choice:
141 | try:
142 | os.remove(historydb)
143 | except:
144 | kodi.notify(msg='Error removing history.')
145 | xbmc.executebuiltin("Container.Refresh")
146 |
147 |
148 | @local_utils.url_dispatcher.register('22')
149 | def historySetting():
150 | if kodi.get_setting('history_setting') == 'true':
151 | kodi.set_setting('history_setting', 'false')
152 | else:
153 | kodi.set_setting('history_setting', 'true')
154 | xbmc.executebuiltin("Container.Refresh")
155 |
--------------------------------------------------------------------------------
/resources/lib/modules/linkfinder.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | '''
4 | AdultFlix XXX Addon (18+) for the Kodi Media Center
5 | Kodi is a registered trademark of the XBMC Foundation.
6 | We are not connected to or in any other way affiliated with Kodi - DMCA: legal@tvaddons.co
7 | Support: https://github.com/tvaddonsco/plugin.video.adultflix
8 |
9 | License summary below, for more details please read license.txt file
10 |
11 | This program is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 2 of the License, or
14 | (at your option) any later version.
15 | This program is distributed in the hope that it will be useful,
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | GNU General Public License for more details.
19 | You should have received a copy of the GNU General Public License
20 | along with this program. If not, see .
21 | '''
22 | from __future__ import absolute_import
23 | from kodi_six import xbmc
24 | import re
25 | from packlib import kodi, client, dom_parser2, log_utils
26 | from resources.lib.modules import player, local_utils
27 | from resolveurl import hmf
28 |
29 |
30 | @local_utils.url_dispatcher.register('810', ['url'], ['name', 'iconimage', 'pattern'])
31 | def find(url, name=None, iconimage=None, pattern=None):
32 |
33 | kodi.busy()
34 |
35 | try: url,site = url.split('|SPLIT|')
36 | except:
37 | site = 'Unknown'
38 | log_utils.log('Error getting site information from :: %s' % (url), xbmc.LOGERROR)
39 |
40 | try:
41 | if 'streamingporn.xyz' in url:
42 | c = client.request(url)
43 | r = dom_parser2.parse_dom(c, 'a', req=['href','class','rel','target'])
44 | r = [i for i in r if i.attrs['class'] == 'external']
45 | r = [client.request(i.attrs['href'], output='geturl') for i in r]
46 | r = [i for i in r if hmf.HostedMediaFile(i).valid_url()]
47 | url = multi(r)
48 | elif 'spreadporn.org' in url:
49 | c = client.request(url)
50 | r = dom_parser2.parse_dom(c, 'li', req=['data-show','data-link'])
51 | r = [(i.attrs['data-link']) for i in r]
52 | url = multi(r)
53 | elif 'pandamovie.eu' in url:
54 | c = client.request(url)
55 | r = dom_parser2.parse_dom(c, 'a', req='id')
56 | r = [(i.attrs['href']) for i in r]
57 | url = multi(r)
58 | elif 'xtheatre.net' in url:
59 | c = client.request(url)
60 | pattern = '''