coherence.backends.appletrailers_storage (module) — Cohen3 0.8.0 documentation

# coherence.backends.appletrailers_storage (module)

## AppleTrailersStore

This is a Media Backend that allows you to access the Trailers from Apple.com.

Example to run from python script:

    from coherence.base import Coherence
    from twisted.internet import reactor

    coherence = Coherence(
        {'logmode': 'info',
         'plugin': {'backend': 'AppleTrailersStore',
                    'name': 'Cohen3 AppleTrailersStore',
                    'proxy': 'no',
                    },
         }
    )
    reactor.run()

Example to run from console:

    cohen3 --plugin=backend:AppleTrailersStore,proxy:no

Note

you need the cohen 3 package installed to run the plugin from a console.

Changed in version 0.8.3: The Container class has been removed

class `AppleTrailerProxy`(uri)

  Bases: `coherence.upnp.core.utils.ReverseProxyUriResource`

  Tha AppleTrailerProxy ia a Resource that takes care to render the result gotten from our server `AppleTrailersStore`

  Warning

  The ReverseProxyUriResource is not able to handle https requests, so… better stick to non proxy until properly handled.

  `render`(request)

    Render a request by forwarding it to the proxied server.

class `Trailer`(parent_id, item_id, urlbase, **kwargs)

  Bases: `coherence.backends.models.items.BackendVideoItem`

  A backend item object which represents an Apple Trailer. This class will hold all information regarding the trailer.

  Changed in version 0.8.3: Refactored using the class `BackendVideoItem`

  `is_proxy` = False
  `proxy_cls`

    alias of `AppleTrailerProxy`

  `mimetype` = 'video/quicktime'

class `AppleTrailersStore`(server, *args, **kwargs)

  Bases: `coherence.backends.models.stores.BackendVideoStore`

  The media server for Apple Trailers.

  Changed in version 0.8.3: Refactored using the class `BackendVideoStore`

  `logCategory` = 'apple_trailers'
  `implements` = ['MediaServer']
  `upnp_protocols` = ['http-get:*:video/quicktime:*', 'http-get:*:video/mp4:*']
  `root_url` = b'http://www.apple.com/trailers/home/xml/current.xml'
  `root_find_items` = './movieinfo'
  `root_id` = 0
  `item_cls`

    alias of `Trailer`

  `item_type` = 'http-get:*:video/quicktime:*'
  `parse_item`(item)

    Convenient method to extract data from an item.

    Warning

    this method must be sub classed and must return a dictionary which should hold the data that you want to be set for your items.

  `add_item`(data)

    Creates and adds an instance of your defined item_cls into the :attr:container_cls. The item will be initialized with the provided data, collected from the method `parse_item()`