Skip to main content
Warning: You are using the test version of PyPI. This is a pre-production deployment of Warehouse. Changes made here affect the production instance of TestPyPI (testpypi.python.org).
Help us improve Python packaging - Donate today!

A Python library for generating Media RSS 2.0 feeds.

Project Description

A Python library for generating Media RSS 2.0 feeds.

About

This module intents to implement the Media Feed specification from Yahoo. The Media RSS specification is a namespace for RSS 2.0. To accomplish this task it relies heavily on the PyRSS2Gen module. As you might guess this Media RSS module is even nameded after its role model.

Right now this is considered ALPHA! Breaking backwards compatibility is possible at any time, I will try to avoid it though. I started off with a base which can be extended as needed or as we (you and me) have time. See below for a list with specification details and their current implementation status. This way I keep track of what needs to be done and users can see what they can accomplish out of the box and what requires some contributions. Feel free to fork the project, implement a missing feature and send a pull request.

PyMediaRSS2Gen is so far tested to work with Python versions 2.6, 2.7 and 3.4.

Usage

The base class for a media feed is MediaRSS2. It’s attributes represent sub elements, e.g. MediaRSS2.copyright` represents the ``<copyright> element and MediaRSS2.lastBuildDate` the <lastBuildDate> element.

For simple elements which contain just a string, boolean or integer just use the according data type. More complicated elements, typically those with attributes and / or sub elements like <media:content> or <media:community>, (will) have their own classes defined.

Probably you will want to import PyRSS2Gen to make use some of it’s helper classes, e.g. for adding a channel image (PyRSS2Gen.Image) or GUIDs to items (PyRSS2Gen.Guid).

Uage is shown by example. For more details check the code and the PyRSS2Gen documentation.

import datetime

import PyMediaRSS2Gen


mediaFeed = PyMediaRSS2Gen.MediaRSS2(
    title="A sample Media RSS Feed",
    link="https://github.com/wedi/PyMediaRSS2Gen/",
    description="Description for a feed with media elements"
)
mediaFeed.copyright = "Copyright (c) 2014 Foo Inc. All rights reserved."
mediaFeed.lastBuildDate = datetime.datetime.now()
mediaFeed.items = [
    PyMediaRSS2Gen.MediaRSSItem(
        title="First item with media element",
        description="An image of foo attached in a media:content element",
        media_content=PyMediaRSS2Gen.MediaContent(
            url="http://example.com/assets/foo1.jpg",
            fileSize=123456,
            medium="image",
            width="480",
            height="640"
        )
    ),
    PyMediaRSS2Gen.MediaRSSItem(
        title="Second item with media element",
        description="A video with multiple resolutions",
        media_content=[
            PyMediaRSS2Gen.MediaContent(
                url="http://example.com/assets/foo_HD.mp4",
                fileSize=8765432,
                type="video/mp4",
                width="1920",
                height="1080"
            ),
            PyMediaRSS2Gen.MediaContent(
                url="http://example.com/assets/foo_SD.mp4",
                fileSize=2345678,
                type="video/mp4",
                width="1280",
                height="720"
            ),
        ]
    ),
    PyMediaRSS2Gen.MediaRSSItem(
        title="And an item with no media element at all",
        description="An image of foo attached in an media:content element",
        link="http://example.com/article/important-story.html"
    )
]
mediaFeed.write_xml(open("rss2.xml", "w"))

Installation

  1. Easiest way to install this module is using pip (as soon as it’s uploaded to the PyPI):

    % pip install PyMediaRSS2Gen
    
  2. If you want to install the module manually, download the package, unzip it and run:

    % cd where/you/put/PyMediaRSS2Gen/
    % python setup.py install
    

    which uses the standard Python installer. Read the documentation for more details about installing Python modules.

How To Contribute

Every open source project lives from the generous help by contributors that sacrifice their time and PyMediaRSS2Gen is no different.

This project lives on GitHub. You are very welcome to fork this project and submit a pull requests! If you don’t know how to do this you can still report errors by opening an issue.

Look here for more details about contributing to PyMediaRSS2Gen.

Status and Todo

Tests are missing completely so automated testing with tox is a todo item! I’m still new to python and haven’t figured out testing yet.

Below you find the implementation status of the Media RSS elements according to the Media Feed specification.

Feature Status Issue on GitHub
media:content Ready  
media:text Ready  
media:title Ready  
media:group Not implemented See issue
Enable elements on channel level Not implemented See issue
media:rating Not implemented See issue
media:description Not implemented See issue
media:keywords Not implemented See issue
media:thumbnail Not implemented See issue
media:category Not implemented See issue
media:hash Not implemented See issue
media:player Not implemented See issue
media:credit Not implemented See issue
media:copyright Not implemented See issue
media:restriction Not implemented See issue
media:community Not implemented See issue
media:comments Not implemented See issue
media:embed Not implemented See issue
media:responses Not implemented See issue
media:backLinks Not implemented See issue
media:status Not implemented See issue
media:price Not implemented See issue
media:license Not implemented See issue
media:subTitle Not implemented See issue
media:peerLink Not implemented See issue
media:location Not implemented See issue
media:rights Not implemented See issue
media:scenes Not implemented See issue
Summary 3 of 28 implemented See all issues

Changelog

Version 0.1.1 (2014-10-08)

  • Fix setup.py to correctly install required modules

Version 0.1.0 (2014-10-06)

  • Initial release
  • Support for media_content, media_title and media_text

Credits

PyMediaRSS2Gen is written and maintained as a hobby project by Dirk Weise.

This project would not be possible without the work of Andrew Dalke who wrote PyRSS2Gen upon which this module is built.

Contributors

The following wonderful people contributed directly or indirectly to this project:

Please add yourself here alphabetically when you submit your first pull request.

Release History

Release History

This version
History Node

0.1.1

History Node

0.1.0

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
PyMediaRSS2Gen-0.1.1-py2.py3-none-any.whl (11.4 kB) Copy SHA256 Checksum SHA256 py2.py3 Wheel Oct 8, 2014
PyMediaRSS2Gen-0.1.1.tar.gz (9.9 kB) Copy SHA256 Checksum SHA256 Source Oct 8, 2014

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting