Instruction
stringlengths
362
7.83k
output_code
stringlengths
1
945
Here is a snippet: <|code_start|> try: reg = _winreg.OpenKey(hkey, subkey) value = _winreg.QueryValue(reg, name) _winreg.CloseKey(reg) except _winreg.error: pass return value player = '"%s"...
class Config(configuration.Config):
Given snippet: <|code_start|>#!/usr/bin/env python # vim: set fileencoding=utf-8 : """The lanshark lib encapsulates the client logic""" from __future__ import division from __future__ import with_statement __version__ = "1.0.0 Beta" copyright = \ """Lanshark %s - A P2P filesharing tool for local area networks Copyright...
socket.getaddrinfo = cached(config.CACHE_TIMEOUT, stats=config.debug)(
Using the snippet: <|code_start|>#!/usr/bin/env python # vim: set fileencoding=utf-8 : """The lanshark lib encapsulates the client logic""" from __future__ import division from __future__ import with_statement __version__ = "1.0.0 Beta" copyright = \ """Lanshark %s - A P2P filesharing tool for local area networks Copyr...
socket.getaddrinfo = cached(config.CACHE_TIMEOUT, stats=config.debug)(
Predict the next line after this snippet: <|code_start|> else: maxwait = timeout - time.time() + start rwxlist = select.select((sock, ), (), (), maxwait) if rwxlist[0]: try: data, addr = sock.recvfrom(1024) logger...
s = network.broadcast_dgram_socket(config.CLIENT_PORT)
Using the snippet: <|code_start|>class MyConfig(Config): n = Integer(10, "Some doc") foobar = String("bar", "Some more doc") trve = IsTrve(True, "Even more doc") config = MyConfig() config.load("foo.conf") config.n = 0x29a config.save() """ from __future__ import with_statement class Error(Exception): ...
class Config(observable.Observable):
Continue the code snippet: <|code_start|># >>> "gender": "female", # >>> "videos_count_all": "8" # >>> } # >>> }, # >>> ... etc # >>> ] # >>> } # # /categories # >>> { # >>> "categories": [ # >>> { "id": "97", "category": "italian" }, # >>> { "id": "1...
STATE, URL = state_get()
Predict the next line for this snippet: <|code_start|> # the first page, show fixed categories if STATE == ST_HOME: url = 'http://it.pornhub.com/random' item_add(ST_PLAY, _('Play a random video'), url, icon='icon/play') item_add(ST_SEARCH, _('Search videos'), 'search', action=ACT_SEARCH) url = API_B...
data = fetch_url(url, parser='json')
Based on the snippet: <|code_start|> # videos list elif STATE == ST_VIDEO_LIST: data = fetch_url(URL, parser='json') try: build_video_list(URL, data['videos']) except KeyError: # last page probably reached pass # categories list elif STATE == ST_CATEGORIES: data = fetch_url(URL, parse...
play_url(url) if url else report_error('Video not found')
Predict the next line for this snippet: <|code_start|>ST_PLAY = 69 STATE, URL = state_get() def build_video_list(url, videos): for video in videos: title = video['title'] or 'Untitled video' likes = int(float(video['ratings']) / 100 * float(video['rating'])) actors = [p['pornstar_name'] f...
item_add(ST_PLAY, title, video['url'], poster=video['thumb'], info=info)
Continue the code snippet: <|code_start|> # videos list elif STATE == ST_VIDEO_LIST: data = fetch_url(URL, parser='json') try: build_video_list(URL, data['videos']) except KeyError: # last page probably reached pass # categories list elif STATE == ST_CATEGORIES: data = fetch_url(URL,...
url = call_ydl(URL)
Predict the next line after this snippet: <|code_start|> # videos list elif STATE == ST_VIDEO_LIST: data = fetch_url(URL, parser='json') try: build_video_list(URL, data['videos']) except KeyError: # last page probably reached pass # categories list elif STATE == ST_CATEGORIES: data = ...
play_url(url) if url else report_error('Video not found')
Given the code snippet: <|code_start|> # ITEMS_PER_PAGE = 30 ST_HOME = 0 ST_SEARCH = 1 ST_CATEGORIES = 2 # ST_PORNSTARS = 3 ST_VIDEO_LIST = 4 ST_PLAY = 69 STATE, URL = state_get() def build_video_list(url, videos): for video in videos: title = video['title'] or 'Untitled video' likes = int(float...
_('uploaded'), relative_date(video['publish_date']),
Next line prediction: <|code_start|> item_add(next_state, _('More items...'), url, action=ACT_MORE) # the first page, show fixed categories if STATE == ST_HOME: url = 'http://it.pornhub.com/random' item_add(ST_PLAY, _('Play a random video'), url, icon='icon/play') item_add(ST_SEARCH, _('Search videos...
url_encode({'search': URL, 'thumbsize': 'large'})
Using the snippet: <|code_start|> likes, ngettext('like', 'likes', likes), _('Actors'), ', '.join(actors), _('Categories'), ', '.join(cats), _('Tags'), ', '.join(tags), ) item_add(ST_PLAY, title, video['url'], poster=video['thumb'], info=info) if len(v...
item_add(ST_CATEGORIES, _('Categories'), url, action=ACT_FOLDER)
Based on the snippet: <|code_start|> '<small><name>{}</name> {}<br>' \ '<success>{} {}</success> <name>/</name> ' \ '<warning>{} {:.0f}%</warning> <name>/</name> ' \ '<info>{} {}</info><br>' \ '<name>{}:</name> {}<br>' \ '<name>{}:...
item_add(next_state, _('More items...'), url, action=ACT_MORE)
Next line prediction: <|code_start|> _('uploaded'), relative_date(video['publish_date']), video['views'], ngettext('view', 'views', int(video['views'])), _('rated'), float(video['rating']), likes, ngettext('like', 'likes', likes), _('Actors'), ', '.join(actors)...
item_add(ST_SEARCH, _('Search videos'), 'search', action=ACT_SEARCH)
Given snippet: <|code_start|> def __init__(self, *args): super().__init__(*args) self._exe = None self._starting = False def generate_item(self, item): if super().generate_item(item) is False: return False if not self._exe: self._slave_process_st...
self._exe = ecore.Exe('epymc_thumbnailer "%s"' % utils.in_use_theme_file,
Continue the code snippet: <|code_start|># This file is part of EpyMC, an EFL based Media Center written in Python. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the Lice...
ini.add_section('thumbnailer')
Predict the next line for this snippet: <|code_start|> self.go() def _folder_insert_sorted(self, path): s = self.first_item # search ordered position only between folders while s and s.data.get('isfolder', False) is True and \ utils.natural_cmp(s.data['path'], path) ...
class FileManagerModule(EmcModule):
Given snippet: <|code_start|> self.build_ui() gui.signal_emit('fileman,show') gui.signal_emit('topbar,show') gui.text_set('topbar.title', _('File Manager')) gui.swallow_set('topbar.icon', gui.EmcImage(self.icon)) input_events.listener_add('fileman', self.input_event_cb) ...
name=label, size_hint_fill=FILL_HORIZ)
Next line prediction: <|code_start|># This file is part of EpyMC, an EFL based Media Center written in Python. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, ...
class WebserverModule(EmcModule):
Continue the code snippet: <|code_start|># GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. from __future__ import absolute_import, print_function, unicode_literals, division api...
STATE, URL = state_get()
Continue the code snippet: <|code_start|>from __future__ import absolute_import, print_function, unicode_literals, division api_base = 'https://api.vimeo.com' app_token = '55e9f802ceb814b649ef3c9504d4d38f' # Official token for EpyMC headers = {'Authorization': 'Bearer ' + app_token, 'User-Agent': 'EpyMC', ...
return fetch_url(url, headers=headers, parser='json')
Here is a snippet: <|code_start|> poster = [c['link'] for c in cat['pictures']['sizes'] if c['width'] == 640][0] if '?' in poster: poster = poster.split('?')[0] except: poster = None videos = cat['metadata']['connections']['videos']['total'] channels = cat['me...
play_url(call_ydl(URL))
Here is a snippet: <|code_start|> api_base = 'https://api.vimeo.com' app_token = '55e9f802ceb814b649ef3c9504d4d38f' # Official token for EpyMC headers = {'Authorization': 'Bearer ' + app_token, 'User-Agent': 'EpyMC', 'Accept': 'application/vnd.vimeo.*+json;version=3.2'} icon_channels = local_resource(__fi...
report_error('%d: %s' % (e.code, e.reason))
Next line prediction: <|code_start|> report_error('%s' % e.reason) sys.exit(1) def vimeo_api_call(endpoint, **kargs): url = api_base + endpoint + '?' + url_encode(kargs) return vimeo_api_url(url) def video_item_add(video): try: poster = [p['link'] for p in video['pictures']['sizes'] i...
item_add(ST_PLAY, video['name'], video['link'], icon=icon_videos,
Next line prediction: <|code_start|> poster = [c['link'] for c in cat['pictures']['sizes'] if c['width'] == 640][0] if '?' in poster: poster = poster.split('?')[0] except: poster = None videos = cat['metadata']['connections']['videos']['total'] channels = cat[...
play_url(call_ydl(URL))
Given the code snippet: <|code_start|>#!/usr/bin/env python # This Python file uses the following encoding: utf-8 # # Copyright (C) 2010-2018 Davide Andreoli <dave@gurumeditation.it> # # This file is part of EpyMC, an EFL based Media Center written in Python. # # This program is free software: you can redistribute it a...
icon_channels = local_resource(__file__, 'icon_channels.png')
Based on the snippet: <|code_start|> try: return fetch_url(url, headers=headers, parser='json') except HTTPError as e: report_error('%d: %s' % (e.code, e.reason)) except URLError as e: report_error('%s' % e.reason) sys.exit(1) def vimeo_api_call(endpoint, **kargs): url = api...
_('uploaded'), relative_date(video['created_time']),
Given the code snippet: <|code_start|> def vimeo_api_url(url): try: return fetch_url(url, headers=headers, parser='json') except HTTPError as e: report_error('%d: %s' % (e.code, e.reason)) except URLError as e: report_error('%s' % e.reason) sys.exit(1) def vimeo_api_call(endpoi...
video['name'], seconds_to_duration(video['duration']),
Based on the snippet: <|code_start|>icon_channels = local_resource(__file__, 'icon_channels.png') icon_groups = local_resource(__file__, 'icon_groups.png') icon_categories = local_resource(__file__, 'icon_categories.png') icon_users = local_resource(__file__, 'icon_users.png') icon_videos = 'icon/play' ITEMS_PER_PAGE ...
url = api_base + endpoint + '?' + url_encode(kargs)
Given snippet: <|code_start|> api_base = 'https://api.vimeo.com' app_token = '55e9f802ceb814b649ef3c9504d4d38f' # Official token for EpyMC headers = {'Authorization': 'Bearer ' + app_token, 'User-Agent': 'EpyMC', 'Accept': 'application/vnd.vimeo.*+json;version=3.2'} icon_channels = local_resource(__file__,...
except URLError as e:
Given the following code snippet before the placeholder: <|code_start|> api_base = 'https://api.vimeo.com' app_token = '55e9f802ceb814b649ef3c9504d4d38f' # Official token for EpyMC headers = {'Authorization': 'Bearer ' + app_token, 'User-Agent': 'EpyMC', 'Accept': 'application/vnd.vimeo.*+json;version=3.2...
except HTTPError as e:
Continue the code snippet: <|code_start|> poster = None info = '<title>%s</><br>' \ '<small><name>%s</> %s<br>' \ '<name>%s</> %s</small><br>%s' % ( user['name'], _('joined'), relative_date(user['created_time']), _('location'), user['location...
icon=icon_channels, action=ACT_FOLDER)
Continue the code snippet: <|code_start|> url = api_base + '/groups?sort=followers&per_page=%d' % ITEMS_PER_PAGE item_add(ST_GROUP_LIST, _('More followed groups'), url, icon=icon_groups, action=ACT_FOLDER) # more relevant users (DO NOT WORK) # url = api_base + '/users?sort=relevant&per_page...
item_add(ST_VIDEO_LIST, text, url, action=ACT_MORE)
Here is a snippet: <|code_start|> videos, ngettext('video', 'videos', videos), followers, ngettext('follower', 'followers', followers), group['description'] or '') item_add(ST_VIDEO_LIST, group['name'], url, icon=icon_groups, poster=poster, info=info) def u...
item_add(ST_VIDEO_LIST, _('Search videos'), 'search1', action=ACT_SEARCH)
Here is a snippet: <|code_start|># (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # Y...
class CalibratorModule(EmcModule):
Continue the code snippet: <|code_start|> 'Overscan-2.jpg', 'AVStest-black.png', 'AVStest-black_white.png', 'greyscale-ramp.png', 'bars601.jpg', 'Slide01.jpg', '6291.png', ] # http://gonedigital.net/2010/04/19/ class CalibratorModule(EmcModule): name = 'calibrator' label = _('Scree...
size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
Continue the code snippet: <|code_start|> 'Overscan-2.jpg', 'AVStest-black.png', 'AVStest-black_white.png', 'greyscale-ramp.png', 'bars601.jpg', 'Slide01.jpg', '6291.png', ] # http://gonedigital.net/2010/04/19/ class CalibratorModule(EmcModule): name = 'calibrator' label = _('Scree...
size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
Here is a snippet: <|code_start|># This file is part of EpyMC, an EFL based Media Center written in Python. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or ...
STATE, URL = state_get()
Using the snippet: <|code_start|> # this is the first page, show fixed categories if STATE == ST_HOME: # item_add(ST_PLAY,'A Random Video', 'http://fantasti.cc/random.php?v=1') item_add(ST_SEARCH, 'Search videos', 'search', action=ACT_SEARCH) item_add(ST_VIDEO_LIST, 'Upcoming video', url_base + '/videos/up...
soup = fetch_url(URL, parser='bs4')
Given snippet: <|code_start|> except: pass # handle the list of categories elif STATE == ST_CATEGORIES_LIST: soup = fetch_url(URL, parser='bs4') for div in soup.findAll('div', class_='content-block-category'): name = div.find('span', class_='category-name').string url = url_base + ...
play_url(url)
Predict the next line after this snippet: <|code_start|># (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License ...
item_add(ST_SEARCH, 'Search videos', 'search', action=ACT_SEARCH)
Given the code snippet: <|code_start|> # more items... try: url = 'http://fantasti.cc/' + soup.find('a', text='next >>')['href'] item_add(ST_SEARCH_RES, 'More items...', url, action=ACT_MORE) except: pass # handle the list of categories elif STATE == ST_CATEGORIES_LIST: soup = f...
url = call_ydl(link)
Predict the next line for this snippet: <|code_start|> # handle the list of categories elif STATE == ST_CATEGORIES_LIST: soup = fetch_url(URL, parser='bs4') for div in soup.findAll('div', class_='content-block-category'): name = div.find('span', class_='category-name').string url = url_base + ...
report_error('Video not found')
Given the following code snippet before the placeholder: <|code_start|># This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You...
item_add(ST_VIDEO_LIST, 'Upcoming video', url_base + '/videos/upcoming', action=ACT_FOLDER)
Given the following code snippet before the placeholder: <|code_start|># handle a page with a list of videos (popular videos) elif STATE == ST_VIDEO_LIST: soup = fetch_url(URL, parser='bs4') loop = soup.findAll('div', class_='loop') for div in loop: title = div.find('a', class_='title').string ...
item_add(ST_VIDEO_LIST, 'More items...', url, action=ACT_MORE)
Predict the next line for this snippet: <|code_start|># (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License fo...
item_add(ST_SEARCH, 'Search videos', 'search', action=ACT_SEARCH)
Given the following code snippet before the placeholder: <|code_start|> (name, cb, data) = lis DBG(' * ' + name) def listener_del(name): global _listeners DBG('Listener Del: ' + name) for lis in _listeners: (n, cb, data) = lis if n == name: _listeners.remove(li...
events.event_emit('KEEP_ALIVE')
Using the snippet: <|code_start|>#!/usr/bin/env python # This Python file uses the following encoding: utf-8 # # Copyright (C) 2010-2018 Davide Andreoli <dave@gurumeditation.it> # # This file is part of EpyMC, an EFL based Media Center written in Python. # # This program is free software: you can redistribute it and/or...
class Watchdog(EmcModule):
Using the snippet: <|code_start|># This Python file uses the following encoding: utf-8 # # Copyright (C) 2010-2018 Davide Andreoli <dave@gurumeditation.it> # # This file is part of EpyMC, an EFL based Media Center written in Python. # # This program is free software: you can redistribute it and/or modify # it under the...
STATE, URL = state_get()
Using the snippet: <|code_start|># but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <...
season_data = fetch_url(URL, parser='json')
Continue the code snippet: <|code_start|># # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distribut...
item_add(ST_EPISODES_LIST, label=_('Season {0}').format(i),
Based on the snippet: <|code_start|> STATE, URL = state_get() # this is the first page, show fixed seasons list if STATE == ST_HOME: for i in range(1, 20): item_add(ST_EPISODES_LIST, label=_('Season {0}').format(i), url='{}season-{}'.format(json_base, i), poster=local_reso...
urls = call_ydl(URL).splitlines()
Continue the code snippet: <|code_start|># it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; withou...
poster=local_resource(__file__, 'season{}.jpg'.format(i)))
Predict the next line for this snippet: <|code_start|> ST_HOME = 0 ST_EPISODES_LIST = 1 ST_ACTS_LIST = 2 ST_NONE = 4 base = 'http://southpark.cc.com/' json_base = 'http://southpark.cc.com/feeds/carousel/video/6154fc40-b7a3-4387-94cc-fc42fc47376e/30/1/json/!airdate/' STATE, URL = state_get() # this is the first page...
_('First aired'), format_date(air_date),
Here is a snippet: <|code_start|># this is the first page, show fixed seasons list if STATE == ST_HOME: for i in range(1, 20): item_add(ST_EPISODES_LIST, label=_('Season {0}').format(i), url='{}season-{}'.format(json_base, i), poster=local_resource(__file__, 'season{}.jpg'....
item_add(ST_NONE, 'Act #{}'.format(i), act_url, icon=act_icon, action=ACT_PLAY)
Predict the next line after this snippet: <|code_start|># # This file is part of EpyMC, an EFL based Media Center written in Python. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either vers...
STATE, URL = state_get()
Using the snippet: <|code_start|> ytb_base = 'https://www.youtube.com' ytb_icon = local_resource(__file__, 'youtube.png') ST_HOME = 0 ST_PLAY = 1 ST_SEARCH = 3 ST_CHN_CATEGORIES = 10 ST_CHN_CHANNELS = 11 ST_CHN_VIDEOS = 12 STATE, URL = state_get() # this is the first page, show fixed categories if STATE == ST_HOME: ...
soup = fetch_url(URL, parser='bs4')
Continue the code snippet: <|code_start|> # 3. show a list of videos in a given channel elif STATE == ST_CHN_VIDEOS: soup = fetch_url(URL, parser='bs4') for div in soup.findAll('div', class_='yt-lockup-video'): id = div['data-context-item-id'] title = div.find('h3', class_='yt-lockup-title').fi...
play_url(call_ydl(URL))
Predict the next line for this snippet: <|code_start|># it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WAR...
item_add(ST_SEARCH, _('Search videos'), 'search', None, action=ACT_SEARCH)
Given the following code snippet before the placeholder: <|code_start|> # 3. show a list of videos in a given channel elif STATE == ST_CHN_VIDEOS: soup = fetch_url(URL, parser='bs4') for div in soup.findAll('div', class_='yt-lockup-video'): id = div['data-context-item-id'] title = div.find('h3'...
play_url(call_ydl(URL))
Predict the next line after this snippet: <|code_start|>from __future__ import absolute_import, print_function, unicode_literals, division ytb_base = 'https://www.youtube.com' ytb_icon = local_resource(__file__, 'youtube.png') ST_HOME = 0 ST_PLAY = 1 ST_SEARCH = 3 ST_CHN_CATEGORIES = 10 ST_CHN_CHANNELS = 11 ST_CHN_...
URL = ytb_base + '/results?' + url_encode(
Using the snippet: <|code_start|># (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # Y...
ytb_base + '/channels', None, action=ACT_FOLDER)
Continue the code snippet: <|code_start|> soup = fetch_url(URL, parser='bs4') for div in soup.findAll('div', class_='yt-lockup-video'): id = div['data-context-item-id'] title = div.find('h3', class_='yt-lockup-title').find('a')['title'] url = ytb_base + '/watch?v=' + id poster = '...
item_add(ST_SEARCH, _('More items...'), url, icon='icon/next', action=ACT_MORE)
Predict the next line after this snippet: <|code_start|># it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY W...
item_add(ST_SEARCH, _('Search videos'), 'search', None, action=ACT_SEARCH)
Based on the snippet: <|code_start|> if mod.name == name: return mod return None def list_get(): return EmcModule.__subclasses__() def is_enabled(name): return name in _instances def init_by_name(name): for mod in EmcModule.__subclasses__(): if mod.name == name: ...
if not ini.has_option('general', 'modules'):
Here is a snippet: <|code_start|> def __shutdown__(self): pass def __restart__(self): self.__shutdown__() self.__init__() _instances = {} # key: module_name val: EmcModule instance def load_all(): def _scan_folder(path): LOG('Searching for modules in: %s' % path) ...
_scan_folder(os.path.join(utils.emc_base_dir, 'plugins'))
Here is a snippet: <|code_start|># # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in th...
class MPRIS2Module(EmcModule):
Here is a snippet: <|code_start|># This Python file uses the following encoding: utf-8 # # Copyright (C) 2010-2018 Davide Andreoli <dave@gurumeditation.it> # # This file is part of EpyMC, an EFL based Media Center written in Python. # # This program is free software: you can redistribute it and/or modify # it under the...
class ScreenSaver(EmcModule):
Based on the snippet: <|code_start|>#!/usr/bin/env python # This Python file uses the following encoding: utf-8 # # Copyright (C) 2010-2018 Davide Andreoli <dave@gurumeditation.it> # # This file is part of EpyMC, an EFL based Media Center written in Python. # # This program is free software: you can redistribute it and...
STATE, URL = state_get()
Next line prediction: <|code_start|>ST_PLAY = 2 base = 'http://www.zapiks.com/' STATE, URL = state_get() # this is the first page, show fixed categories if STATE == ST_HOME: b = base u = '/popular_1.php' d = os.path.dirname(__file__) item_add(ST_VIDEO_LIST, 'Brand New Videos', b + 'p_1', action=ACT_F...
html = fetch_url(URL)
Based on the snippet: <|code_start|> views = int(views.strip().replace('Views', '').replace(' ', '')) try: likes = int(video.find('span', class_='teaser-counter-likes').string.strip()) except: likes = 0 info = '<title>{}</title><br>' \ ...
play_url(video_url)
Predict the next line for this snippet: <|code_start|># This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program i...
item_add(ST_VIDEO_LIST, 'Brand New Videos', b + 'p_1', action=ACT_FOLDER)
Given the code snippet: <|code_start|> views = list(video.find('span', class_='teaser-counter').strings)[0] views = int(views.strip().replace('Views', '').replace(' ', '')) try: likes = int(video.find('span', class_='teaser-counter-likes').string.strip()) e...
video_url = call_ydl(URL)
Using the snippet: <|code_start|> # the page for each category elif STATE == ST_VIDEO_LIST: # soup = fetch_url(URL, parser='bs4') # this line work, but: # the zapiks page have an erroneous auto closing div tag # so wee need this hack to let bs4 correctly parse the html html = fetch_url(URL) soup = B...
_('user'), user, _('uploaded'), relative_date(uploaded),
Given snippet: <|code_start|># This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope...
item_add(ST_VIDEO_LIST, 'Brand New Videos', b + 'p_1', action=ACT_FOLDER)
Next line prediction: <|code_start|> url = 'http://www.zapiks.com' + video['href'] title = video.find('span', class_='teaser-title').string.strip() thumb = video.find('div', class_='teaser-thumbnail')['style'] thumb = thumb.replace("background-image : url('", '').replace("...
item_add(ST_VIDEO_LIST, 'More items...', 'http://www.zapiks.com' + next_page, icon='icon/next', action=ACT_MORE)
Continue the code snippet: <|code_start|># Copyright (C) 2010-2018 Davide Andreoli <dave@gurumeditation.it> # # This file is part of EpyMC, an EFL based Media Center written in Python. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as publ...
STATE, URL = state_get()
Using the snippet: <|code_start|> url = API_BASE + '/videos/find.json?order=date&limit={}&page=1'.format(ITEMS_PER_PAGE) item_add(ST_VIDEO_LIST, 'Recently Added', url, action=ACT_FOLDER) url = API_BASE + '/videos/find.json?order=views&limit={}&page=1'.format(ITEMS_PER_PAGE) item_add(ST_VIDEO_LIST, 'Mos...
data = fetch_url(url, parser='json')
Given the following code snippet before the placeholder: <|code_start|> # videos list elif STATE == ST_VIDEO_LIST: data = fetch_url(URL, parser='json') build_video_list(URL, data) # categories list elif STATE == ST_CATEGORIES: data = fetch_url(URL, parser='json') for cat in data['result']: url...
play_url(url) if url else report_error('Video not found')
Next line prediction: <|code_start|>ITEMS_PER_PAGE = 50 ST_HOME = 0 ST_SEARCH = 1 ST_CATEGORIES = 2 ST_CHANNELS = 3 ST_VIDEO_LIST = 4 ST_PLAY = 69 STATE, URL = state_get() def build_video_list(url, data): for video in data['result']: title = video['title'] or 'Untitled video' info = '<title>{}</...
item_add(ST_PLAY, title, video['url'], poster=video['thumb'], info=info)
Given the code snippet: <|code_start|> # videos list elif STATE == ST_VIDEO_LIST: data = fetch_url(URL, parser='json') build_video_list(URL, data) # categories list elif STATE == ST_CATEGORIES: data = fetch_url(URL, parser='json') for cat in data['result']: url = API_BASE + '/videos/find.json...
url = call_ydl(URL)
Using the snippet: <|code_start|> # videos list elif STATE == ST_VIDEO_LIST: data = fetch_url(URL, parser='json') build_video_list(URL, data) # categories list elif STATE == ST_CATEGORIES: data = fetch_url(URL, parser='json') for cat in data['result']: url = API_BASE + '/videos/find.json?' + \...
play_url(url) if url else report_error('Video not found')
Here is a snippet: <|code_start|># # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. from __future__ import absolute_import, print_function, unicode_literals, division API_BASE = 'http://api.porn.com' ITEMS_PER_PAGE = 50 ST_HO...
title, seconds_to_duration(video['duration']),
Given the following code snippet before the placeholder: <|code_start|># You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. from __future__ import absolute_import, print_function, unicode_literals, division API_BASE = 'http://api....
_('uploaded'), relative_date(video['active_date']),
Given the code snippet: <|code_start|> item_add(ST_PLAY, 'Play a Random video', url, icon='icon/play') url = API_BASE + '/videos/find.json?order=date&limit={}&page=1'.format(ITEMS_PER_PAGE) item_add(ST_VIDEO_LIST, 'Recently Added', url, action=ACT_FOLDER) url = API_BASE + '/videos/find.json?order=views...
url_encode({'search': URL, 'limit': ITEMS_PER_PAGE, 'order': 'rating'})
Predict the next line after this snippet: <|code_start|> video['views'], ngettext('view', 'views', video['views']), _('rated'), video['rating'], video['ratings'], ngettext('like', 'likes', video['ratings']), ', '.join(video['actors']), ', '.join(video['tags']))...
item_add(ST_VIDEO_LIST, 'Recently Added', url, action=ACT_FOLDER)
Given snippet: <|code_start|>def build_video_list(url, data): for video in data['result']: title = video['title'] or 'Untitled video' info = '<title>{}</title> <small>{}</small><br>' \ '<small><name>{}</name> {}<br>' \ '<success>{} {}</success> <name>/</name> ' \ ...
item_add(next_state, title, url, action=ACT_MORE)
Predict the next line for this snippet: <|code_start|> '<warning>{} {:.1f}/5</warning> <name>/</name> ' \ '<info>{} {}</info><br>' \ '<name>Actors:</name> {}<br>' \ '<name>Tags:</name> {}</small>'.format( title, seconds_to_duration(video['duration']...
item_add(ST_SEARCH, 'Search videos', 'search', action=ACT_SEARCH)
Based on the snippet: <|code_start|># This file is part of EpyMC, an EFL based Media Center written in Python. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, ...
STATE, URL = state_get()
Given the code snippet: <|code_start|># MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. from __future__ import absol...
return fetch_url(url, parser='json')
Given the following code snippet before the placeholder: <|code_start|> _('Source'), video['site'], _('Quality'), video['size']) item_add(ST_PLAY_YOUTUBE, video['name'], url, info=info, poster=poster, icon='icon/play') else: ite...
play_url(real_url)
Predict the next line after this snippet: <|code_start|>IMG_BASE = 'http://image.tmdb.org/t/p' # this should be queried and cached :/ ST_HOME = 0 ST_SEARCH = 1 ST_MOVIES_LIST = 2 ST_MOVIE_INFO = 3 ST_CAST_LIST = 4 ST_NONE = 9 ST_PLAY_YOUTUBE = 10 STATE, URL = state_get() LANG = language_get() def v3_request(url, l...
item_add(ST_MOVIE_INFO, title, url, poster=poster)
Predict the next line after this snippet: <|code_start|> _('Language'), video['iso_639_1'], _('Source'), video['site'], _('Quality'), video['size']) item_add(ST_PLAY_YOUTUBE, video['name'], url, info=info, poster=poster,...
real_url = call_ydl(URL)
Based on the snippet: <|code_start|> def next_page_item(url, data, next_state): if data['page'] < data['total_pages']: page = data['page'] if '&page=' in url: next_url = url.replace('&page=%d' % (page), '&page=%d' % (page + 1)) else: if not '?' in url: url += '?' ...
data = v3_request('/search/movie?' + url_encode({'query': URL}))
Using the snippet: <|code_start|># # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in th...
LANG = language_get()
Predict the next line for this snippet: <|code_start|> year = data['release_date'][:4] except: year = '' try: directors = [d['name'] for d in data['credits']['crew'] if d['job'] == 'Director'] except: directors = [_('Unknown')] try: casts = [d['name'] for i, d in...
info=info, icon='icon/info', action=ACT_NONE)
Given snippet: <|code_start|> def full_img_url(img, size='w500'): return (IMG_BASE + '/' + size + img) if img else None def movie_item(movie_data): title = movie_data['title'] poster = full_img_url(movie_data['poster_path']) url = '/movie/%d?append_to_response=credits,videos' % movie_data['id'] i...
item_add(ST_MOVIES_LIST, _('Popular movies'), '/movie/popular', action=ACT_FOLDER)
Given the following code snippet before the placeholder: <|code_start|> def v3_request(url, lang=None): if '?' not in url: url += '?' url = API_BASE + url + '&api_key=' + API_KEY + '&language=' + (lang or LANG) # print("API REQUEST: " + url) return fetch_url(url, parser='json') def full_img_u...
item_add(next_state, text, next_url, action=ACT_MORE)