Dlna/UPnP framework
For the Digital Living
Cohen3 Framework is a DLNA/UPnP Media Server for Python 3, based on the Python 2 version named Cohen. Provides several UPnP MediaServers and MediaRenderers to make simple publishing and streaming different types of media content to your network.
Cohen3 is the Python 3's version of the Coherence Framework project, originally created by Frank Scholz. If you ever used the original Coherence project you could use Cohen3 like you do in the original Coherence project.
- Documentation: https://opacam.github.io/Cohen3/
- GitHub: https://github.com/opacam/Cohen3
- Issue tracker: https://github.com/opacam/Cohen3/issues
- PyPI: https://pypi.python.org/pypi/cohen3
- Free software: MIT licence
Background: I'm trying to run an IPv6 only network alongside my LAN and transition as many devices as possible. In the IPv4 world I'm using MiniDLNA as media server, but that just won't work for IPv6 (and many other DLNA servers, such as Cohen3, also currently support IPv4 only). But some clients like VLC Player, at least the desktop version, already support IPv6 DLNA. So I searched for a simple DLNA server which could be modified easily and found Cohen3.
This fork now supports IPv6, but with some limitations:
- the interface to listen on needs to be specified in config
- netifaces package is required
- ipv6=1 must be set in config
- an ULA address must be present on the listen interface
- if IPv6 is activated no IPv4 clients will be served, it's either v6 or v4 but not both
As I implemented IPv6 with personal use in mind, I only modified the file storage backend (I do not need the others) and other necessary components to get it working for my needs. That's why the limitations are there and why I won't contribute back to upstream for now.
I don't have time (for now) to modify other backends and properly test everything, but feel to do so if you like IPv6 too.
The original Coherence Framework were know to work with different kind of dlna/UPnP clients and Cohen3 should also work for them:
- Sony Playstation 3/4
- XBox360/One
- Denon AV Receivers
- WD HD Live MediaPlayers
- Samsung TVs
- Sony Bravia TVs
And provides a lot of backends to fulfil your media streaming needs:
- Local file storage
- Apple Trailers
- Lol Cats
- ShoutCast Radio
- and much more...
Right now Cohen is in development mode. All the code has been refactored in order to work for Python 3, moreover, some additions has been made to make easier to create a custom Backend (check the coherence.backends.models package documentation for more information). The original Coherence project was unmaintained for a while and some of the backends has become obsolete. You can see the backends status in the below table.
Backend Name | Description/Notes | |
---|---|---|
❓ | AmpacheStore | |
✔️ | AppleTrailersStore | |
❓ | AudioCDStore | |
❓ | AxisCamStore | |
❓ | BansheeStore | |
❓ | BuzztardStore | |
❓ | DVBDStore | |
❓ | ElisaPlayer | |
❓ | ElisaMediaStore | |
❓ | FeedStore | |
❓ | FlickrStore | |
✔️ | FSStore | |
❓ | Gallery2Store | |
❓ | GStreamerPlayer | |
✔️ | IRadioStore (ShoutCast) | |
❓ | ITVStore | |
✖️ | LastFMStore | service moved to new api...needs update |
✔️ | LolcatsStore | |
❓ | MediaStore | |
🔥 | PicasaStore | Moved to `misc/deprecated/backends` because google stopped to offer this service, but could be rewrite using the api for the new service `Google Photos` |
✔️ | PlayListStore | |
❓ | RadiotimeStore | |
❓ | SWR3Store | |
✔️ | TEDStore | |
❓ | TestStore | |
❓ | TrackerStore | |
❓ | TestStore | |
✖️ | TwitchStore | Partially working, video play is not working |
❓ | YamjStore | |
🔥 | YouTubeStore | Moved to `misc/deprecated/backends` because Google moved to new api... backend should be rewrite with new api in mind |
Notes:
Please note that some of the listed backends may be removed in future releases. This will depend on factors such as the availability of the target service, the dependencies of the backend, and the maintainability of the code. It is important to keep in mind that the main goal of this project is to create a functional media server/client capable of serving local files on a DLNA/UPnP network. All of the backends included are additional features that may be useful for some end-users, and can also serve as a reference for creating your own backend using Cohen3's modules.
If you want to install with pip, first make sure that the pip command triggers the python3 version of python or use pip3 instead. You can install the Cohen3 python package from pypi or github
$ pip3 install --user Cohen3
$ pip3 install --user https://github.com/opacam/Cohen3/archive/master.zip
Note
- An user install is recommended or use an virtualenv
Tip
If you encounter problems while installing, caused by some dependency, you may try to bypass this error by installing the conflicting dependency before Cohen3, so if you face an error like this for Twisted:
ERROR: Could not find a version that satisfies the requirement Twisted>=19.2.1 (from Cohen3) (from versions: none)
You should be able to fix it installing Twisted before the install of Cohen3:
pip3 install --upgrade --user Twisted
After downloading and extracting the archive or having done a git clone, move into the freshly created 'Cohen3' folder and install all dependencies (dev included) with poetry, but first upgrade pip:
$ pip3 install pip --upgrade $ pip3 install poetry==1.1.12 $ poetry install
Also, you can perform a personalized install using pip. This will allow you to install only certain dependencies, if you want the basic dependencies to run the project:
$ pip install .
If you want to install Cohen3 with development dependencies:
$ pip install .[dev]
Note: Here you have all supported install modes:
- dev: all the dependencies will be installed except docs
- test: used by travis builds (omits dbus and docs)
- docs: install build dependencies to generate docs
- dbus: install dependencies needed by tube service or dvbd storage
- gstreamer: needed if you use GStreamerPlayer
- picasa: needed by the picasa storage
- youtube: needed by the youtube backend
To just export some files on your hard-disk fire up Cohen with an UPnP MediaServer with a file-system backend enabled:
$ cohen3 --plugin=backend:FSStore,content:/path/to/your/media/files
You can also configure cohen via a config file. Feel free to check our example
misc/cohen.conf.example
. The config file can be placed anywhere, cohen
looks by default for $HOME/.cohen
, but you can pass the path via the
command line option '-c' to it too:
$ cohen3 -c /path/to/config/file
Starting from version 0.9.0 the event system has changed from louie/dispatcher to EventDispatcher (external dependency). Here are the most important changes:
- The new event system is not a global dispatcher anymore
- All the signal/receivers are connected between them only if it is necessary.
- We don't connect/disconnect anymore, instead we will bind/unbind.
- The events has been renamed (this is necessary because the old event names contains dots in his names, and this could cause troubles with the new event system)
Please, check the documentation for further details at "The events system" section.
Report bugs at https://github.com/opacam/Cohen3/issues
Feel free to fetch the repo and send your pull requests!