rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
util.open_website('http://bugs.gpodder.org/') def on_shop_activate(self, widget, *args): util.open_website('http://gpodder.org/shop') def on_wishlist_activate(self, widget, *args): util.open_website('http://amzn.com/w/2L04WZKX274VB') | util.open_website('https://bugs.gpodder.org/enter_bug.cgi?product=gPodder') | def on_bug_tracker_activate(self, widget, *args): if gpodder.ui.maemo: util.open_website('http://bugs.maemo.org/enter_bug.cgi?product=gPodder') else: util.open_website('http://bugs.gpodder.org/') |
text = N_('%(count)d podcast selected', '%(count)d podcasts selected', {'count':count}) title.append(text % count) | text = N_('%(count)d podcast selected', '%(count)d podcasts selected', count) title.append(text % {'count': count}) | def set_subscribe_button_sensitive(self): selection = self.treeview.get_selection() title = [self.main_window.get_title()] if selection: count = selection.count_selected_rows() text = N_('%(count)d podcast selected', '%(count)d podcasts selected', {'count':count}) title.append(text % count) else: count = 0 self.edit_to... |
selected = [e for e in episodes if episode.is_played or not episode.file_exists()] | selected = [e.is_played or not e.file_exists() for e in episodes] | def show_delete_episodes_window(self, channel=None): """Offer deletion of episodes |
else: | elif not gpodder.ui.fremantle: | def on_btnCancelFeedUpdate_clicked(self, widget): if not self.feed_cache_update_cancelled: self.pbFeedUpdate.set_text(_('Cancelling...')) self.feed_cache_update_cancelled = True if not gpodder.ui.fremantle: self.btnCancelFeedUpdate.set_sensitive(False) else: self.show_update_feeds_buttons() |
subheading = 'from %s' % (self.episode.channel.title) | subheading = _('from %s') % (self.episode.channel.title) | def on_display_text(self): # Now do the stuff that takes a bit longer... heading = self.episode.title subheading = 'from %s' % (self.episode.channel.title) description = self.episode.description |
def convert(v): if isinstance(v, str) or isinstance(v, unicode): return v else: return str(v) values = [convert(getattr(o, slot)) for slot in slots] | values = [self.convert(getattr(o, slot)) for slot in slots] | def convert(v): if isinstance(v, str) or isinstance(v, unicode): return v else: return str(v) |
values = [getattr(o, slot) for slot in slots] | values = [self.convert(getattr(o, slot)) for slot in slots] | def remove(self, o): if hasattr(o, '__iter__'): for child in o: self.remove(child) return |
next = 'http://www.youtube.com/get_video?video_id=' + vid + '&t=' + r2.group(1) + '&fmt=%d' % fmt_id | d = {'video_id': vid, 't': r2.group(1), 'fmt': fmt_id} next = 'http://www.youtube.com/get_video?video_id=%(video_id)s&t=%(t)s&eurl=&el=&ps=&asv=&fmt=%(fmt)s' % d | def get_real_download_url(url, preferred_fmt_id=18): vid = get_youtube_id(url) if vid is not None: page = None url = 'http://www.youtube.com/watch?v=' + vid while page is None: req = util.http_request(url, method='GET') if 'location' in req.msg: url = req.msg['location'] else: page = req.read() # Try to find the best... |
self.itemDeleteSelected.set_sensitive(can_delete or not can_cancel) | self.itemDeleteSelected.set_sensitive(can_delete) | def play_or_download(self): if not gpodder.ui.fremantle: if self.wNotebook.get_current_page() > 0: if gpodder.ui.desktop: self.toolCancel.set_sensitive(True) return |
if filename is not None: | if filename is not None and have_gio: | def update_by_iter(self, iter, downloading=None, include_description=False, \ generate_thumbnails=False): episode = self.get_value(iter, self.C_EPISODE) episode.reload_from_db() |
self._config.mimetype_prefs) | self._manager._config.mimetype_prefs) | def update(self): """Updates this podcast by downloading the feed |
dlg = hildon.hildon_note_new_information(self.main_window, \ | stack = hildon.WindowStack.get_default() visible_windows = stack.get_windows() if visible_windows: parent_window = visible_windows[0] else: parent_window = self.main_window dlg = hildon.hildon_note_new_information(parent_window, \ | def show_message(self, message, title=None, important=False, widget=None): if gpodder.ui.diablo: import hildon if important: try: dlg = hildon.Note('information', (self.main_window, message)) except TypeError: if title is None: message = message else: message = '%s\n%s' % (title, message) dlg = hildon.hildon_note_new_i... |
elif self._config.enable_notifications: | elif config is not None and config.enable_notifications: | def show_message(self, message, title=None, important=False, widget=None): if gpodder.ui.diablo: import hildon if important: dlg = hildon.Note('information', (self.main_window, message)) dlg.run() dlg.destroy() else: if title is None: title = 'gPodder' pango_markup = '<b>%s</b>\n<small>%s</small>' % (title, message) hi... |
_notify_when = self._config.notifications_attach_to_tray | _notify_when = config.notifications_attach_to_tray | def show_message(self, message, title=None, important=False, widget=None): if gpodder.ui.diablo: import hildon if important: dlg = hildon.Note('information', (self.main_window, message)) dlg.run() dlg.destroy() else: if title is None: title = 'gPodder' pango_markup = '<b>%s</b>\n<small>%s</small>' % (title, message) hi... |
def remove_downloaded( self): shutil.rmtree( self.save_dir, True) | def remove_downloaded(self): m3u_filename = self.get_playlist_filename() if os.path.exists(m3u_filename): util.delete_file(m3u_filename) shutil.rmtree(self.save_dir, True) | def remove_downloaded( self): shutil.rmtree( self.save_dir, True) |
setattr(self, 'have_webkit', True) setattr(self, 'htmlview', webkit.WebView()) | webview_signals = gobject.signal_list_names(webkit.WebView) if 'navigation-policy-decision-requested' in webview_signals: setattr(self, 'have_webkit', True) setattr(self, 'htmlview', webkit.WebView()) else: log('Your WebKit is too old (see bug 1001).', sender=self) setattr(self, 'have_webkit', False) | def on_create_window(self): self.textview.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse('#ffffff')) if self._config.enable_html_shownotes: try: import webkit setattr(self, 'have_webkit', True) setattr(self, 'htmlview', webkit.WebView()) |
return gtk.gdk.pixbuf_new_from_file_at_size(self.icon, 24, 24) | try: return gtk.gdk.pixbuf_new_from_file_at_size(self.icon, 24, 24) except gobject.GError, ge: pass | def get_icon(self): if self.icon is not None: # Load it from an absolute filename if os.path.exists(self.icon): return gtk.gdk.pixbuf_new_from_file_at_size(self.icon, 24, 24) |
self.show_message(message, _('gPodder downloads finished'), True, widget=self.labelDownloads) | self.show_message(message, _('Downloads finished'), True, widget=self.labelDownloads) | def downloads_finished(self, download_tasks_seen): # FIXME: Filter all tasks that have already been reported finished_downloads = [str(task) for task in download_tasks_seen if task.status == task.DONE] failed_downloads = [str(task)+' ('+task.error_message+')' for task in download_tasks_seen if task.status == task.FAILE... |
self.show_message(message, _('gPodder downloads finished'), widget=self.labelDownloads) | self.show_message(message, _('Downloads finished'), widget=self.labelDownloads) | def downloads_finished(self, download_tasks_seen): # FIXME: Filter all tasks that have already been reported finished_downloads = [str(task) for task in download_tasks_seen if task.status == task.DONE] failed_downloads = [str(task)+' ('+task.error_message+')' for task in download_tasks_seen if task.status == task.FAILE... |
self.show_message(message, _('gPodder downloads failed'), True, widget=self.labelDownloads) | self.show_message(message, _('Downloads failed'), True, widget=self.labelDownloads) | def downloads_finished(self, download_tasks_seen): # FIXME: Filter all tasks that have already been reported finished_downloads = [str(task) for task in download_tasks_seen if task.status == task.DONE] failed_downloads = [str(task)+' ('+task.error_message+')' for task in download_tasks_seen if task.status == task.FAILE... |
if wanted in formats_available and seen_preferred: | if id in formats_available and seen_preferred: | def find_urls(page): r4 = re.search('.*"fmt_url_map"\:\s+"([^"]+)".*', page) if r4 is not None: fmt_url_map = r4.group(1) for fmt_url_encoded in fmt_url_map.split(','): fmt_url = urllib.unquote(fmt_url_encoded) fmt_url = fmt_url.replace('\\/', '/') fmt_id, url = fmt_url.split('|', 2) yield int(fmt_id), url |
(index,) = path | model = self.treeviewEpisodes.get_model() index = model.get_value(model.get_iter(path), self.COLUMN_INDEX) | def on_treeview_button_press(self, widget, event): result = self.treeviewEpisodes.get_path_at_pos(int(event.x), int(event.y)) if result is not None: path, column, x, y = result (index,) = path self.action_shownotes.set_property('visible', True) self.touched_episode = self.episodes[index] else: self.action_shownotes.set... |
role = getattr(treeview, TreeViewHelper.ROLE) | role = getattr(treeview, TreeViewHelper.ROLE, None) if role is None: return False | def on_treeview_expose_event(self, treeview, event): if event.window == treeview.get_bin_window(): model = treeview.get_model() if (model is not None and model.get_iter_first() is not None): return False |
episode.basename + episode.extension(), | util.sanitize_filename(metadata.title), | def add_track(self, episode): self.notify('status', _('Adding %s...') % episode.title) filename = str(self.convert_track(episode)) log("sending " + filename + " (" + episode.title + ").", sender=self) |
if not gpodder.ui.fremantle: | if not gpodder.ui.maemo: | def update_podcast_list_model(self, urls=None, selected=False, select_url=None): """Update the podcast list treeview model |
MAX_SIZE = 400 | MAX_SIZE = 360 | def __init__(self, depman): gtk.ListStore.__init__(self, str, str, str, bool, str) |
'link': None, | 'link': '', | def get_new_episodes(self, channel, guids): tracks = [] |
stock_ok_button=gtk.STOCK_DELETE, \ | stock_ok_button=_('Remove'), \ | def on_itemMassUnsubscribe_activate(self, item=None): columns = ( ('title', None, None, _('Podcast')), ) |
def feed_update_status_msg(self): """Show the feed update status Display the feed update current status. """ if self._podcast.feed_update_enabled: return "enabled" else: return "disabled" def feed_update_status(self): """Return the feed update status Return the feed update current status. """ return self._podcast.fe... | def update(self): """Updates this podcast by downloading the feed | |
def youtube_url_resolver(self, url): """Resolve the Youtube URL WARNING: API subject to change. """ yurl = youtube.get_real_download_url(url, \ self._config.youtube_preferred_fmt_id) return yurl | def finish(self): """Persist changed data to the database file | |
for field_name, field_type, field_null, field_default in fields: | for field_name, field_type, field_required, field_default in fields: | def upgrade_table(self, table_name, fields, index_list): """ Creates a table or adds fields to it. """ cur = self.cursor(lock=True) |
cur.execute("ALTER TABLE %s ADD COLUMN %s %s" % (table_name, field_name, field_type)) | sql = "ALTER TABLE %s ADD COLUMN %s %s" % (table_name, field_name, field_type) if field_required: sql += " NOT NULL DEFAULT %s" % (field_default) cur.execute(sql) | def upgrade_table(self, table_name, fields, index_list): """ Creates a table or adds fields to it. """ cur = self.cursor(lock=True) |
download.DownloadTask.DOWNLOADING): | download.DownloadTask.DOWNLOADING, \ download.DownloadTask.FAILED): | def downloads_list_get_selection(self, model=None, paths=None): if model is None and paths is None: selection = self.treeDownloads.get_selection() model, paths = selection.get_selected_rows() |
elif task.status == task.PAUSED: | elif task.status in (task.PAUSED, task.FAILED): | def _for_each_task_set_status(self, tasks, status, force_start=False): episode_urls = set() model = self.treeDownloads.get_model() for row_reference, task in tasks: if status == download.DownloadTask.QUEUED: # Only queue task when its paused/failed/cancelled (or forced) if task.status in (task.PAUSED, task.FAILED, task... |
if next_try_id == 2 and not youtube.is_video_link(url): log('Filename collision: %s - trying to resolve...', current_try, sender=self) url = util.get_real_url(self.channel.authenticate_url(url)) episode_filename, extension_UNUSED = util.filename_from_url(url) current_try = util.sanitize_filename(episode_filename, sel... | def find_unique_file_name(self, url, filename, extension): current_try = util.sanitize_filename(filename, self.MAX_FILENAME_LENGTH)+extension next_try_id = 2 lookup_url = None | |
fn_template = os.path.basename(self.title) | fn_template = util.sanitize_filename(os.path.basename(self.title), self.MAX_FILENAME_LENGTH) | def local_filename(self, create, force_update=False, check_only=False, template=None): """Get (and possibly generate) the local saving filename |
self.offer_new_episodes(channels=[c for c in self.channels if c.url in worked]) | episodes = [] for podcast in self.channels: if podcast.url in worked: episodes.extend(podcast.get_all_episodes()) if episodes: episodes = list(PodcastEpisode.sort_by_pubdate(episodes, \ reverse=True)) self.new_episodes_show(episodes, \ selected=[e.check_is_new() for e in episodes]) | def on_after_update(): progress.on_finished() # Report already-existing subscriptions to the user if existing: title = _('Existing subscriptions skipped') message = _('You are already subscribed to these podcasts:') \ + '\n\n' + '\n'.join(saxutils.escape(url) for url in existing) self.show_message(message, title, widge... |
def new_episodes_show(self, episodes, notification=False): | def new_episodes_show(self, episodes, notification=False, selected=None): | def new_episodes_show(self, episodes, notification=False): if gpodder.ui.maemo: columns = ( ('maemo_markup', None, None, _('Episode')), ) show_notification = notification else: columns = ( ('title_markup', None, None, _('Episode')), ('filesize_prop', 'length', gobject.TYPE_INT, _('Size')), ('pubdate_prop', 'pubDate', g... |
selected_default=True, \ | selected=selected, \ | def download_episodes_callback(episodes): self.new_episodes_window = None self.download_episode_list(episodes) |
if hasattr(feed.feed.image, 'href') and feed.feed.image.href: old = self.image self.image = feed.feed.image.href elif hasattr(feed.feed.image, 'url') and feed.feed.image.url: old = self.image self.image = feed.feed.image.url else: pass | for attribute in ('href', 'url'): new_value = getattr(feed.feed.image, attribute, None) if new_value is not None: log('Found cover art in %s: %s', attribute, new_value) self.image = new_value if hasattr(feed.feed, 'icon'): self.image = feed.feed.icon | def _consume_updated_feed(self, feed, max_episodes=0): self.parse_error = feed.get('bozo_exception', None) |
elif value > 0 and len(self.update_interval_presets) < value: | elif value > 0 and len(self.update_interval_presets) > value: | def format_update_interval_value(self, scale, value): value = int(value) if value == 0: return _('manual only') elif value > 0 and len(self.update_interval_presets) < value: return util.format_seconds_to_hour_min_sec(self.update_interval_presets[value]*60) else: return str(value) |
self._enable_mygpo = self._config.mygpo_enabled | def new(self): if not hasattr(self, 'callback_finished'): self.callback_finished = None | |
else: return util.format_seconds_to_hour_min_sec(self.update_interval_presets[int(value)]*60) | elif value > 0 and len(self.update_interval_presets) < value: return util.format_seconds_to_hour_min_sec(self.update_interval_presets[value]*60) else: return str(value) | def format_update_interval_value(self, scale, value): value = int(value) if value == 0: return _('manual only') else: return util.format_seconds_to_hour_min_sec(self.update_interval_presets[int(value)]*60) |
dialog.vbox.add(gtk.Label(message)) | label = gtk.Label(message) label.set_alignment(0., .5) label.set_padding(0, 5) dialog.vbox.add(label) | def show_login_dialog(self, title, message, username=None, password=None, username_prompt=_('Username'), register_callback=None): """ An authentication dialog based on http://ardoris.wordpress.com/2008/07/05/pygtk-text-entry-dialog/ """ |
message = _('There has been an error updating %(url)s: %(message)s') | if d['message']: message = _('Error while updating %(url)s: %(message)s') else: message = _('The feed at %(url)s could not be updated.') | def update_feed_cache_proc(self, channels, select_url_afterwards): total = len(channels) |
slots = [s for s in slots if getattr(o, s) is not None] | slots = [s for s in slots if getattr(o, s, None) is not None] | def save(self, o): if hasattr(o, '__iter__'): for child in o: self.save(child) return |
try: mad_info = mad.MadFile(filename) return int(mad_info.total_time()) except: pass | def get_track_length(filename): length = gstreamer.get_track_length(filename) if length is not None: return length if util.find_command('mplayer') is not None: try: mplayer_output = os.popen('mplayer -msglevel all=-1 -identify -vo null -ao null -frames 0 "%s" 2>/dev/null' % filename).read() return int(float(mplayer_ou... | |
entry['content'][0].type == 'text/html': | entry['content'][0].get('type', '') == 'text/html': | def from_feedparser_entry(entry, channel, mimetype_prefs=''): episode = PodcastEpisode(channel) |
to_file = os.path.join(folder, to_file) | to_file = util.sanitize_encoding(os.path.join(folder, to_file)) | def add_track(self, episode): self.notify('status', _('Adding %s') % episode.title.decode('utf-8', 'ignore')) |
if hasattr( e, 'href') and hasattr( e, 'length') and hasattr( e, 'type') and (e.type.startswith('audio/') or e.type.startswith('video/')): | if hasattr( e, 'href') and hasattr( e, 'length') and hasattr( e, 'type') and (e.type.startswith('audio/') or e.type.startswith('video/') or e.type.startswith('image/')): | def from_feedparser_entry( entry, channel): episode = PodcastEpisode( channel) |
if 'url' in m and 'type' in m and (m['type'].startswith('audio/') or m['type'].startswith('video/')): | if 'url' in m and 'type' in m and (m['type'].startswith('audio/') or m['type'].startswith('video/') or m['type'].startswith('image/')): | def from_feedparser_entry( entry, channel): episode = PodcastEpisode( channel) |
flags = hildon.PORTRAIT_MODE_SUPPORT | flags = 0 if orientation != self._LANDSCAPE: flags |= hildon.PORTRAIT_MODE_SUPPORT | def _orientation_changed(self, orientation): if self._orientation == orientation: # Ignore repeated requests return |
default_fmt_id, default_url = fmt_id_url_map[0] | if fmt_id_url_map: default_fmt_id, default_url = fmt_id_url_map[0] else: raise YouTubeError('fmt_url_map not found for video ID "%s"' % vid) | def find_urls(page): r4 = re.search('.*"fmt_url_map"\:\s+"([^"]+)".*', page) if r4 is not None: fmt_url_map = r4.group(1) for fmt_url_encoded in fmt_url_map.split(','): fmt_url = urllib.unquote(fmt_url_encoded) fmt_url = fmt_url.replace('\\/', '/') fmt_id, url = fmt_url.split('|', 2) yield int(fmt_id), url |
ID, NAME, TYPE, NULL, DEFAULT = range(5) | ID, NAME, TYPE, NOTNULL, DEFAULT = range(5) | def _remove_deleted_channels(self): """Remove deleted podcasts and episodes (upgrade from gPodder <= 2.5) |
columns = [name for name, typ in schema if name != 'id'] | columns = [name for name, typ, required, default in schema if name != 'id'] | def _save_object(self, o, table, schema): self.lock.acquire() try: cur = self.cursor() columns = [name for name, typ in schema if name != 'id'] values = [getattr(o, name) for name in columns] |
log('Creating table %s', table_name, sender=self) columns = ', '.join(' '.join(f) for f in fields) sql = "CREATE TABLE %s (%s)" % (table_name, columns) cur.execute(sql) | self.create_table(cur, table_name, fields) | def upgrade_table(self, table_name, fields, index_list): """ Creates a table or adds fields to it. """ cur = self.cursor(lock=True) |
ID, NAME, TYPE, NULL, DEFAULT = range(5) existing = set(column[NAME] for column in available) for field_name, field_type in fields: if field_name not in existing: log('Adding column: %s.%s (%s)', table_name, field_name, field_type, sender=self) cur.execute("ALTER TABLE %s ADD COLUMN %s %s" % (table_name, field_name, f... | ID, NAME, TYPE, NOTNULL, DEFAULT = range(5) exists_notnull_column = any(bool(column[NOTNULL]) for column in available) if not exists_notnull_column: self.recreate_table(cur, table_name, fields, index_list) else: existing = set(column[NAME] for column in available) for field_name, field_type, field_null, field_default... | def upgrade_table(self, table_name, fields, index_list): """ Creates a table or adds fields to it. """ cur = self.cursor(lock=True) |
pixbuf = gtk.gdk.pixbuf_new_from_file(util.sanitize_encoding(channel.cover_file)) | pixbuf = gtk.gdk.pixbuf_new_from_file(channel.cover_file.decode(util.encoding, 'ignore')) | def __get_cover(self, channel, url, async=False, avoid_downloading=False): if not async and avoid_downloading and not os.path.exists(channel.cover_file): return (channel.url, self.get_default_cover(channel)) |
if successful_sync: | elif successful_sync: | def after_device_sync_callback(device, successful_sync): if device.cancelled: log('Cancelled by user.', sender=self) if successful_sync: title = _('Device synchronized') message = _('Your device has been synchronized.') self.notification(message, title) else: title = _('Error closing device') message = _('Please check ... |
formats_available = urllib.unquote(r3.group(1)).split(',') | formats_available = urllib.unquote(r3.group(1)).replace('\\/', '/').split(',') | def get_real_download_url(url, preferred_fmt_id=18): vid = get_youtube_id(url) if vid is not None: page = None url = 'http://www.youtube.com/watch?v=' + vid while page is None: req = util.http_request(url, method='GET') if 'location' in req.msg: url = req.msg['location'] else: page = req.read() # Try to find the best... |
self.main_window.connect('destroy', lambda w: self.callback_finished()) | self.main_window.connect('destroy', lambda w, self: self.callback_finished(), self) | def new(self): self.main_window.connect('destroy', lambda w: self.callback_finished()) |
item.connect('activate', lambda w, ee: self.save_episodes_as_file(ee), episodes) | item.connect('button-press-event', lambda w, ee: self.save_episodes_as_file(episodes)) | def treeview_available_show_context_menu(self, treeview, event): model, paths = self.treeview_handle_context_menu_click(treeview, event) if not paths: if not hasattr(treeview, 'is_rubber_banding_active'): return True else: return not treeview.is_rubber_banding_active() |
item.connect('activate', lambda w, ee: self.copy_episodes_bluetooth(ee), episodes) | item.connect('button-press-event', lambda w, ee: self.copy_episodes_bluetooth(episodes)) | def treeview_available_show_context_menu(self, treeview, event): model, paths = self.treeview_handle_context_menu_click(treeview, event) if not paths: if not hasattr(treeview, 'is_rubber_banding_active'): return True else: return not treeview.is_rubber_banding_active() |
item.connect('activate', lambda w, ee: self.on_sync_to_ipod_activate(w, ee), episodes) | item.connect('button-press-event', lambda w, ee: self.on_sync_to_ipod_activate(w, episodes)) | def treeview_available_show_context_menu(self, treeview, event): model, paths = self.treeview_handle_context_menu_click(treeview, event) if not paths: if not hasattr(treeview, 'is_rubber_banding_active'): return True else: return not treeview.is_rubber_banding_active() |
episode.description = entry.get('summary', '') | if 'content' in entry and len(entry['content']) and \ entry['content'][0].type == 'text/html': episode.description = entry['content'][0].value else: episode.description = entry.get('summary', '') | def from_feedparser_entry(entry, channel, mimetype_prefs=''): episode = PodcastEpisode(channel) |
_notify_attach = notification.attach_to_status_icon | try: _notify_attach = notification.attach_to_status_icon except AttributeError: _notify_attach = lambda icon: None | def show_message(self, message, title=None, important=False, widget=None): if gpodder.ui.diablo: import hildon if important: dlg = hildon.Note('information', (self.main_window, message)) dlg.run() dlg.destroy() else: if title is None: title = 'gPodder' pango_markup = '<b>%s</b>\n<small>%s</small>' % (title, message) hi... |
util.sanitize_filename(metadata.title), | util.sanitize_filename(metadata.title)+episode.extension(), | def add_track(self, episode): self.notify('status', _('Adding %s...') % episode.title) filename = str(self.convert_track(episode)) log("sending " + filename + " (" + episode.title + ").", sender=self) |
return text_entry.get_text() | return result | def on_text_changed(editable): can_confirm = (editable.get_text() != '') dialog.set_response_sensitive(gtk.RESPONSE_OK, can_confirm) |
self.treeviewEpisodes.set_cursor(path, toggle_column) | if path is not None: self.treeviewEpisodes.set_cursor(path, toggle_column) | def new( self): self._config.connect_gtk_window(self.gPodderEpisodeSelector, 'episode_selector', True) if not hasattr( self, 'callback'): self.callback = None |
else: | elif not self._fremantle_notification_visible: | def update_feed_cache_finish_callback(self, updated_urls=None, select_url_afterwards=None): self.db.commit() self.updating_feed_cache = False |
('filesize', None, None, _('Size')), | ('filesize', 'length', int, _('Size')), | def on_cleanup_device(self): columns = ( ('title', None, None, _('Episode')), ('podcast', None, None, _('Podcast')), ('filesize', None, None, _('Size')), ('modified', 'modified_sort', int, _('Copied')), ('playcount', None, None, _('Play count')), ('released', None, None, _('Released')), ) |
('playcount', None, None, _('Play count')), | ('playcount', 'playcount', int, _('Play count')), | def on_cleanup_device(self): columns = ( ('title', None, None, _('Episode')), ('podcast', None, None, _('Podcast')), ('filesize', None, None, _('Size')), ('modified', 'modified_sort', int, _('Copied')), ('playcount', None, None, _('Play count')), ('released', None, None, _('Released')), ) |
channel = self.get_value(iter, self.C_CHANNEL) | try: channel = self.get_value(iter, self.C_CHANNEL) except TypeError, te: return | def update_by_iter(self, iter): # Given a GtkTreeIter, update volatile information channel = self.get_value(iter, self.C_CHANNEL) if channel is None: return total, deleted, new, downloaded, unplayed = channel.get_statistics() description = self._format_description(channel, total, deleted, new, \ downloaded, unplayed) |
icon = icon_theme.load_icon(gtk.STOCK_DIALOG_QUESTION, icon_size, 0) | try: log('Missing icon in theme: %s', icon_name, sender=self) icon = icon_theme.load_icon(gtk.STOCK_DIALOG_QUESTION, \ icon_size, 0) except: log('Please install the GNOME icon theme.', sender=self) icon = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, \ True, 8, icon_size, icon_size) | def _get_tree_icon(self, icon_name, add_bullet=False, \ add_padlock=False, add_missing=False, icon_size=32, \ build_icon_from_file = False): """ Loads an icon from the current icon theme at the specified size, suitable for display in a gtk.TreeView. Additional emblems can be added on top of the icon. |
r3 = re.compile('.*"fmt_map"\:\s+"([^"]+)".*').search(page) if not r3: r3 = re.compile('&fmt_map=([^&]+).*').search(page) | def find_urls(page): r4 = re.search('.*"fmt_url_map"\:\s+"([^"]+)".*', page) if r4 is not None: fmt_url_map = r4.group(1) for fmt_url_encoded in fmt_url_map.split(','): fmt_url = urllib.unquote(fmt_url_encoded) fmt_url = fmt_url.replace('\\/', '/') fmt_id, url = fmt_url.split('|', 2) yield int(fmt_id), url | def get_real_download_url(url, preferred_fmt_id=18): vid = get_youtube_id(url) if vid is not None: page = None url = 'http://www.youtube.com/watch?v=' + vid while page is None: req = util.http_request(url, method='GET') if 'location' in req.msg: url = req.msg['location'] else: page = req.read() # Try to find the best... |
if r3: formats_available = urllib.unquote(r3.group(1)).replace('\\/', '/').split(',') else: formats_available = [] | fmt_id_url_map = sorted(find_urls(page), reverse=True) default_fmt_id, default_url = fmt_id_url_map[0] formats_available = set(fmt_id for fmt_id, url in fmt_id_url_map) fmt_id_url_map = dict(fmt_id_url_map) | def get_real_download_url(url, preferred_fmt_id=18): vid = get_youtube_id(url) if vid is not None: page = None url = 'http://www.youtube.com/watch?v=' + vid while page is None: req = util.http_request(url, method='GET') if 'location' in req.msg: url = req.msg['location'] else: page = req.read() # Try to find the best... |
r2 = re.compile('.*"t"\:\s+"([^"]+)".*').search(page) if not r2: r2 = re.compile('.*&t=([^&]+)').search(page) if r2: d = {'video_id': vid, 't': r2.group(1), 'fmt': fmt_id} next = 'http://www.youtube.com/get_video?video_id=%(video_id)s&t=%(t)s&eurl=&el=&ps=&asv=&fmt=%(fmt)s' % d log('YouTube link resolved: %s => %s', u... | url = fmt_id_url_map.get(fmt_id, None) if url is None: url = default_url | def get_real_download_url(url, preferred_fmt_id=18): vid = get_youtube_id(url) if vid is not None: page = None url = 'http://www.youtube.com/watch?v=' + vid while page is None: req = util.http_request(url, method='GET') if 'location' in req.msg: url = req.msg['location'] else: page = req.read() # Try to find the best... |
filename = 'file://' + urllib.quote(filename) | if filename.startswith('/'): filename = 'file://' + urllib.quote(filename) | def gui_open(filename): """ Open a file or folder with the default application set by the Desktop environment. This uses "xdg-open" on all systems with a few exceptions: on Win32, os.startfile() is used on Maemo, osso is used to communicate with Nokia Media Player """ try: if gpodder.ui.maemo: try: import osso except ... |
iter = self.append() self.set(iter, \ self.C_URL, episode.url, \ self.C_TITLE, episode.title, \ self.C_FILESIZE_TEXT, self._format_filesize(episode), \ self.C_EPISODE, episode, \ self.C_PUBLISHED_TEXT, episode.cute_pubdate()) | iter = self.append((episode.url, \ episode.title, \ self._format_filesize(episode), \ episode, \ None, \ episode.cute_pubdate(), \ '', \ '', \ True, \ True, \ True)) | def add_from_channel(self, channel, downloading=None, \ include_description=False, generate_thumbnails=False, \ treeview=None): """ Add episode from the given channel to this model. Downloading should be a callback. include_description should be a boolean value (True if description is to be added to the episode row, or... |
iter = self.append() self.set(iter, \ self.C_URL, all_episodes.url, \ self.C_CHANNEL, all_episodes, \ self.C_COVER, self._get_cover_image(all_episodes), \ self.C_SEPARATOR, False) | iter = self.append(channel_to_row(all_episodes)) | def set_channels(self, db, config, channels): # Clear the model and update the list of podcasts self.clear() |
iter = self.append() self.set(iter, self.C_SEPARATOR, True) | self.append(('', '', '', None, None, None, '', True, True, \ True, True, True, True)) | def set_channels(self, db, config, channels): # Clear the model and update the list of podcasts self.clear() |
iter = self.append() self.set(iter, \ self.C_URL, channel.url, \ self.C_CHANNEL, channel, \ self.C_COVER, self._get_cover_image(channel), \ self.C_SEPARATOR, False) | iter = self.append(channel_to_row(channel)) | def set_channels(self, db, config, channels): # Clear the model and update the list of podcasts self.clear() |
def on_error(err): | def error_handler(filename, err): | def on_error(err): log('Exception in D-Bus call: %s', str(err), \ sender=self) |
url = track.get('stream_url', track['download_url']) | url = track.get('stream_url', track['download_url']) + \ '?consumer_key=%(consumer_key)s' \ % { 'consumer_key': CONSUMER_KEY } | def get_tracks(self, feed): """Get a generator of tracks from a SC user |
if filetype in ('audio', 'video'): | if filetype in ('audio', 'video', 'image'): | def file_type_by_extension(extension): """ Tries to guess the file type by looking up the filename extension from a table of known file types. Will return "audio", "video" or None. >>> file_type_by_extension('.aif') 'audio' >>> file_type_by_extension('.3GP') 'video' >>> file_type_by_extension('.txt') is None True >>> ... |
return response == gtk.RESPONSE_OK, ( username_entry.get_text(), password_entry.get_text() ) | return (success, (username, password)) | def show_login_dialog(self, title, message, username=None, password=None, username_prompt=_('Username'), register_callback=None): """ An authentication dialog based on http://ardoris.wordpress.com/2008/07/05/pygtk-text-entry-dialog/ """ |
clipboard = gtk.Clipboard(selection='PRIMARY') def receive_clipboard_text(clipboard, text, second_try): if text is not None: url = util.normalize_feed_url(text) if url is not None: self.entry_url.set_text(url) self.entry_url.set_position(-1) return | if not hasattr(self, 'preset_url'): clipboard = gtk.Clipboard(selection='PRIMARY') def receive_clipboard_text(clipboard, text, second_try): if text is not None: url = util.normalize_feed_url(text) if url is not None: self.entry_url.set_text(url) self.entry_url.set_position(-1) return | def new(self): if not hasattr(self, 'add_urls_callback'): self.add_urls_callback = None if hasattr(self, 'custom_label'): self.label_add.set_text(self.custom_label) if hasattr(self, 'custom_title'): self.gPodderAddPodcast.set_title(self.custom_title) if hasattr(self, 'preset_url'): self.entry_url.set_text(self.preset_u... |
file_info = file.query_info('*') icon = file_info.get_icon() for icon_name in icon.get_names(): if icon_theme.has_icon(icon_name): status_icon = icon_name break | if file.query_exists(): file_info = file.query_info('*') icon = file_info.get_icon() for icon_name in icon.get_names(): if icon_theme.has_icon(icon_name): status_icon = icon_name break | def update_by_iter(self, iter, downloading=None, include_description=False, \ generate_thumbnails=False): episode = self.get_value(iter, self.C_EPISODE) episode.reload_from_db() |
can_sync = True total_size = 0 free_space = max(device.get_free_space(), 0) for episode in episodes: if not device.episode_on_device(episode) and not \ (sync_all_episodes and \ self._config.only_sync_not_played and \ episode.is_played): | def check_free_space(): def will_add(episode): if device.episode_on_device(episode): return False if sync_all_episodes and \ self._config.only_sync_not_played and \ episode.is_played: return False return True def file_size(episode): | def after_device_sync_callback(device, successful_sync): if device.cancelled: log('Cancelled by user.', sender=self) elif successful_sync: title = _('Device synchronized') message = _('Your device has been synchronized.') self.notification(message, title) else: title = _('Error closing device') message = _('Please chec... |
if filename is not None: total_size += util.calculate_size(str(filename)) if total_size > free_space: title = _('Not enough space left on device') message = _('You need to free up %s.\nDo you want to continue?') \ % (util.format_filesize(total_size-free_space),) can_sync = self.show_confirmation(message, title) if ca... | if filename is None: return 0 return util.calculate_size(str(filename)) total_size = sum(file_size(e) for e in episodes if will_add(e)) free_space = max(device.get_free_space(), 0) if total_size > free_space: title = _('Not enough space left on device') message = _('You need to free up %s.\nDo you want to continue?'... | def after_device_sync_callback(device, successful_sync): if device.cancelled: log('Cancelled by user.', sender=self) elif successful_sync: title = _('Device synchronized') message = _('Your device has been synchronized.') self.notification(message, title) else: title = _('Error closing device') message = _('Please chec... |
if self._config.mp3_player_delete_played and \ self._config.only_sync_not_played: all_episodes = self._filter_sync_episodes(channels, \ only_downloaded=False) episodes_on_device = device.get_all_tracks() for local_episode in all_episodes: episode = device.episode_on_device(local_episode) if episode is None: continue i... | def sync_thread_func(): if sync_all_episodes: device.add_tracks(episodes) # 'only_sync_not_played' must be used or else all the # played tracks will be copied then immediately deleted if self._config.mp3_player_delete_played and \ self._config.only_sync_not_played: all_episodes = self._filter_sync_episodes(channels, \ ... | |
else: device.cancel() device.close() | def cleanup_episodes(): if self._config.mp3_player_delete_played and \ self._config.only_sync_not_played: all_episodes = self._filter_sync_episodes(channels, \ only_downloaded=False) episodes_on_device = device.get_all_tracks() for local_episode in all_episodes: episode = device.episode_on_device(local_episode) if ep... | def sync_thread_func(): if sync_all_episodes: device.add_tracks(episodes) # 'only_sync_not_played' must be used or else all the # played tracks will be copied then immediately deleted if self._config.mp3_player_delete_played and \ self._config.only_sync_not_played: all_episodes = self._filter_sync_episodes(channels, \ ... |
if added and self._config.on_sync_delete: | if added and self._config.on_sync_delete and not track.is_locked: | def add_tracks(self, tracklist=[], force_played=False): for track in list(tracklist): # Filter tracks that are not meant to be synchronized does_not_exist = not track.was_downloaded(and_exists=True) exclude_played = track.is_played and not force_played and \ self._config.only_sync_not_played wrong_type = track.file_typ... |
notification.show() | try: notification.show() except: pass | def show_message(self, message, title=None, important=False, widget=None): if gpodder.ui.diablo: import hildon if important: try: dlg = hildon.Note('information', (self.main_window, message)) except TypeError: if title is None: message = message else: message = '%s\n%s' % (title, message) dlg = hildon.hildon_note_new_i... |
self.label_app_name = gtk.Label(app_name) | self.label_app_name = gtk.Label() | def __init__(self): gtk.Dialog.__init__(self) |
status_icon = self.ICON_IMAGE_FILE | image_path = episode.local_filename(create=False,check_only=True) if image_path is not None: status_icon = image_path status_icon_to_build_from_file = True else: status_icon = self.ICON_IMAGE_FILE | def update_by_iter(self, iter, downloading=None, include_description=False): episode = self.get_value(iter, self.C_EPISODE) episode.reload_from_db() |
show_padlock, show_missing, icon_size) | show_padlock, show_missing, icon_size, status_icon_to_build_from_file) | def update_by_iter(self, iter, downloading=None, include_description=False): episode = self.get_value(iter, self.C_EPISODE) episode.reload_from_db() |
add_padlock=False, add_missing=False, icon_size=32): | add_padlock=False, add_missing=False, icon_size=32, \ build_icon_from_file = False): | def _get_tree_icon(self, icon_name, add_bullet=False, \ add_padlock=False, add_missing=False, icon_size=32): """ Loads an icon from the current icon theme at the specified size, suitable for display in a gtk.TreeView. Additional emblems can be added on top of the icon. |
""" | The `build_icon_from_file` argument indicates (when True) that the icon has to be created on the fly from a given image file. The `icon_name` argument is then interpreted as the path to this file. Those specific icons will *not be cached*. """ | def _get_tree_icon(self, icon_name, add_bullet=False, \ add_padlock=False, add_missing=False, icon_size=32): """ Loads an icon from the current icon theme at the specified size, suitable for display in a gtk.TreeView. Additional emblems can be added on top of the icon. |
icon = icon_theme.load_icon(icon_name, icon_size, 0) | if build_icon_from_file: icon = self._get_icon_from_image(icon_name,icon_size) else: icon = icon_theme.load_icon(icon_name, icon_size, 0) | def _get_tree_icon(self, icon_name, add_bullet=False, \ add_padlock=False, add_missing=False, icon_size=32): """ Loads an icon from the current icon theme at the specified size, suitable for display in a gtk.TreeView. Additional emblems can be added on top of the icon. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.