~kaozilon/totem/test

« back to all changes in this revision

Viewing changes to src/plugins/iplayer/iplayer2.py

  • Committer: Package Import Robot
  • Author(s): Michael Biebl, Michael Biebl, Josselin Mouette, Andreas Henriksson
  • Date: 2012-05-16 00:53:29 UTC
  • mfrom: (1.4.9)
  • Revision ID: package-import@ubuntu.com-20120516005329-7r15mpz4xg53xad7
Tags: 3.4.2-1
[ Michael Biebl ]
* Remove coherence plugin leftovers. It doesn't look like this plugin is
  coming back.

[ Josselin Mouette ]
* 02_revert_clutter.patch: un-clutter totem. Revert to the good old 
  XVideo code. It is less elegant, but works on many more systems.
* Update build-dependencies accordingly.
* Use dh-autoreconf.
* Build-depend on gtk-doc-tools for autoreconf.
* totem-plugins.install: remove rotation plugin.
* Drop useless build-dependency on libmusicbrainz.

[ Andreas Henriksson ]
* New upstream release.
* No longer try to install dropped bemused and youtube plugins.
* Bump GTK+ build-dependency to >= 3.3.6 as required by configure script.
  - could possibly be reverted, when reverting changes to make below apply.
* Disable d/p/02_revert_clutter.patch for now, doesn't apply against 3.4.0.
* Temporarily add build-dependencies needed because of above:
  - libclutter-gst-dev, libclutter-gtk-1.0-dev

[ Michael Biebl ]
* Drop obsolete Build-Depends on libirman-dev. Closes: #672401
* Bump Standards-Version to 3.9.3.
* Drop Build-Depends on libcam-dev, no longer required to build on kfreebsd.
  Closes: #659622
* Install rotation plugin since we are building with Clutter support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/python
2
2
# -*- coding: utf-8 -*-
 
3
# pylint: disable-msg=C0302
3
4
 
4
5
# Python libs
5
6
import re, os
303
304
 
304
305
def parse_entry_id (entry_id):
305
306
    # tag:bbc.co.uk,2008:PIPS:b00808sc
306
 
    regexp = re.compile ('PIPS: ([0-9a-z]{8})')
 
307
    regexp = re.compile ('PIPS:([0-9a-z]{8})')
307
308
    matches = regexp.findall (entry_id)
308
309
    if not matches:
309
310
        return None
310
311
    return matches[0]
311
312
 
312
 
class Media (object):
 
313
class Media (object): # pylint: disable-msg=R0902
313
314
    def __init__ (self, item, media_node):
314
315
        self.item = item
315
316
        self.href = None
316
317
        self.kind = None
317
318
        self.method = None
318
319
        self.width, self.height = None, None
319
 
        self.__read_media_node (media_node)
320
320
 
321
321
        self.mimetype = None
322
322
        self.encoding = None
327
327
        self.connection_kind = None
328
328
        self.connection_live = False
329
329
 
 
330
        self.__read_media_node (media_node)
 
331
 
330
332
    @property
331
333
    def url (self):
332
334
        if self.connection_method == 'resolve':
414
416
    def programme (self):
415
417
        return self.item.programme
416
418
 
417
 
class Item (object):
 
419
class Item (object): # pylint: disable-msg=R0902
418
420
    """
419
421
    Represents an iPlayer programme item. Most programmes consist of 2 such
420
422
    items, (1) the ident, and (2) the actual programme. The item specifies the
760
762
    items = property (get_items)
761
763
 
762
764
 
763
 
class Feed (object):
764
 
    def __init__ (self, tvradio = None, channel = None, category = None,
 
765
class Feed (object): # pylint: disable-msg=R0921
 
766
    def __init__ (self, tvradio = None, # pylint: disable-msg=R0913
 
767
                  channel = None, category = None,
765
768
                  subcategory = None, atoz = None, searchterm = None):
766
769
        """
767
770
        Creates a feed for the specified channel/category/whatever.
897
900
                    for (ch, _title) in CHANNELS_RADIO_LIST]
898
901
        return None
899
902
 
 
903
    # This causes pylint message R0913 on the class.
900
904
    def subcategories (self):
901
905
        raise NotImplementedError ('Sub-categories not yet supported')
902
906
 
972
976
                return []
973
977
            cached_programmes = []
974
978
            for entry in progs.entries:
975
 
                pid = parse_entry_id (entry.id)
 
979
                pid = parse_entry_id (entry.identifier)
976
980
                programme = Programme (pid)
977
981
                cached_programmes.append (programme)
978
982
            #logging.info ('Found %d entries', len (d))
994
998
        # quick and dirty category extraction and count
995
999
        xml_url = self.__create_url ('list')
996
1000
        xml = httpget (xml_url)
997
 
        cat = re.findall ("<category .*term=\" (.*?)\"", xml)
 
1001
        cat = re.findall ("<category .*term=\"(.*?)\"", xml)
998
1002
        categories = {}
999
1003
        for category in cat:
1000
1004
            if category != 'TV':