[totem] plugins: Remove unused code from the iPlayer plugin
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [totem] plugins: Remove unused code from the iPlayer plugin
- Date: Tue, 5 Apr 2011 00:15:37 +0000 (UTC)
commit 0c7031036717b99e6f27eaa8892b7b07bf251390
Author: Philip Withnall <philip tecnocode co uk>
Date: Mon Apr 4 22:56:03 2011 +0100
plugins: Remove unused code from the iPlayer plugin
Helps: bgo#645739
src/plugins/iplayer/iplayer.py | 3 +-
src/plugins/iplayer/iplayer2.py | 49 ---------------------------------------
2 files changed, 1 insertions(+), 51 deletions(-)
---
diff --git a/src/plugins/iplayer/iplayer.py b/src/plugins/iplayer/iplayer.py
index 130641b..9b28d65 100644
--- a/src/plugins/iplayer/iplayer.py
+++ b/src/plugins/iplayer/iplayer.py
@@ -58,11 +58,10 @@ class IplayerPlugin (GObject.Object, Peas.Activatable):
# Add all the channels as top-level rows in the tree store
channels = feed.channels ()
for channel_id, title in channels.items ():
- parent_iter = tree_store.append (None, (title, channel_id, None))
+ tree_store.append (None, (title, channel_id, None))
# Add the channels' categories in a thread, since they each require a
# network request
- parent_path = tree_store.get_path (parent_iter)
thread = PopulateChannelsThread (self, feed, tree_store)
thread.start ()
diff --git a/src/plugins/iplayer/iplayer2.py b/src/plugins/iplayer/iplayer2.py
index 4f004c9..7db3d14 100644
--- a/src/plugins/iplayer/iplayer2.py
+++ b/src/plugins/iplayer/iplayer2.py
@@ -36,13 +36,6 @@ IMG_DIR = os.path.join (os.getcwd (), 'resources', 'media')
# level=logging.DEBUG,
# format='iplayer2.py: %(asctime)s %(levelname)4s %(message)s',
# )
-# me want 2.5!!!
-def any (iterable):
- for element in iterable:
- if element:
- return True
- return False
-
# http://colinm.org/blog/on-demand-loading-of-flickr-photo-metadata
# returns immediately for all previously-called functions
@@ -297,18 +290,6 @@ SELF_CLOSING_TAGS = ['alternate', 'mediator']
HTTP_OBJECT = httplib2.Http ()
-RE_SELF_CLOSE = re.compile ('< ([a-zA-Z0-9]+) ( ?.*)/>', re.M | re.S)
-
-def fix_selfclosing (xml):
- return RE_SELF_CLOSE.sub ('<\\1\\2></\\1>', xml)
-
-def set_http_cache_dir (directory):
- file_cache = httplib2.FileCache (directory)
- HTTP_OBJECT.cache = file_cache
-
-def set_http_cache (cache):
- HTTP_OBJECT.cache = cache
-
class NoItemsError (Exception):
def __init__ (self, reason=None):
self.reason = reason
@@ -317,27 +298,6 @@ class NoItemsError (Exception):
reason = self.reason or _(u'<no reason given>')
return _(u'Programme unavailable ("%s")') % (reason)
-class Memoize (object):
- def __init__ (self, func):
- self.func = func
- self._cache = {}
- def __call__ (self, *args, **kwds):
- key = args
- if kwds:
- items = kwds.items ()
- items.sort ()
- key = key + tuple (items)
- if key in self._cache:
- return self._cache[key]
- self._cache[key] = result = self.func (*args, **kwds)
- return result
-
-def httpretrieve (url, filename):
- _response, data = HTTP_OBJECT.request (url, 'GET')
- data_file = open (filename, 'wb')
- data_file.write (data)
- data_file.close ()
-
def httpget (url):
_response, data = HTTP_OBJECT.request (url, 'GET')
return data
@@ -602,8 +562,6 @@ class Programme (object):
def parse_playlist (self, xml):
#logging.info ('Parsing playlist XML... %s', xml)
- #xml.replace ('<summary/>', '<summary></summary>')
- #xml = fix_selfclosing (xml)
entities = BeautifulStoneSoup.XML_ENTITIES
soup = BeautifulStoneSoup (xml, selfClosingTags = SELF_CLOSING_TAGS,
@@ -705,9 +663,6 @@ class Programme (object):
related = property (get_related)
items = property (get_items)
-#programme = Memoize (programme)
-
-
class ProgrammeSimple (object):
"""
Represents an individual iPlayer programme, as identified by an 8-letter
@@ -1070,10 +1025,6 @@ class Feed (object):
name = property (get_name)
-
-TV = Feed ('tv')
-RADIO = Feed ('radio')
-
def test ():
tv_feed = Feed ('tv')
print tv_feed.popular ()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]