opacam / cohen3 Goto Github PK
View Code? Open in Web Editor NEWSimple DLNA/UPnP Media Client/Server for Python 3
License: MIT License
Simple DLNA/UPnP Media Client/Server for Python 3
License: MIT License
Python 3.8.2
root@aspen:/opt/docker/services/cohen3# docker-compose up
Starting cohen3_cohen3_1 ... done
Attaching to cohen3_cohen3_1
cohen3_1 | [WARNING][coherence ] Coherence UPnP framework version 0.9.3 starting [log level: warning]... (base.py:522)
cohen3_1 | [WARNING][webserver ] WebServer on ip http://10.40.16.5:8080 ready (base.py:197)
cohen3_1 | [WARNING][fs_item ] Traceback (most recent call last):
cohen3_1 | File "/usr/local/lib/python3.8/site-packages/coherence/backends/fs_storage.py", line 292, in __init__
cohen3_1 | filename, mimetype, dlna_pn = _find_thumbnail(
cohen3_1 | File "/usr/local/lib/python3.8/site-packages/coherence/backends/fs_storage.py", line 107, in _find_thumbnail
cohen3_1 | for f in glob.glob(pattern):
cohen3_1 | File "/usr/local/lib/python3.8/glob.py", line 21, in glob
cohen3_1 | return list(iglob(pathname, recursive=recursive))
cohen3_1 | File "/usr/local/lib/python3.8/glob.py", line 74, in _iglob
cohen3_1 | for name in glob_in_dir(dirname, basename, dironly):
cohen3_1 | File "/usr/local/lib/python3.8/glob.py", line 85, in _glob1
cohen3_1 | return fnmatch.filter(names, pattern)
cohen3_1 | File "/usr/local/lib/python3.8/fnmatch.py", line 52, in filter
cohen3_1 | match = _compile_pattern(pat)
cohen3_1 | File "/usr/local/lib/python3.8/fnmatch.py", line 46, in _compile_pattern
cohen3_1 | return re.compile(res).match
cohen3_1 | File "/usr/local/lib/python3.8/re.py", line 250, in compile
cohen3_1 | return _compile(pattern, flags)
cohen3_1 | File "/usr/local/lib/python3.8/re.py", line 302, in _compile
cohen3_1 | p = sre_compile.compile(pattern, flags)
cohen3_1 | File "/usr/local/lib/python3.8/sre_compile.py", line 764, in compile
cohen3_1 | p = sre_parse.parse(p, flags)
cohen3_1 | File "/usr/local/lib/python3.8/sre_parse.py", line 948, in parse
cohen3_1 | p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
cohen3_1 | File "/usr/local/lib/python3.8/sre_parse.py", line 443, in _parse_sub
cohen3_1 | itemsappend(_parse(source, state, verbose, nested + 1,
cohen3_1 | File "/usr/local/lib/python3.8/sre_parse.py", line 834, in _parse
cohen3_1 | p = _parse_sub(source, state, sub_verbose, nested + 1)
cohen3_1 | File "/usr/local/lib/python3.8/sre_parse.py", line 443, in _parse_sub
cohen3_1 | itemsappend(_parse(source, state, verbose, nested + 1,
cohen3_1 | File "/usr/local/lib/python3.8/sre_parse.py", line 598, in _parse
cohen3_1 | raise source.error(msg, len(this) + 1 + len(that))
cohen3_1 | re.error: bad character range u-S at position 36
cohen3_1 | (fs_storage.py:297)
I'll gladly support the docker implementation as well. ;)
Looking at the code, it uses Twisted, which does not follow redirects by default:
https://twistedmatrix.com/documents/current/web/howto/client.html#following-redirects
2.in def list_content(self, name, item, request): add
after these, can support Chinese file name or directory name, it is good
E501: line too long (max should be 79)
Using:
cohen3 --plugin=backend:FSStore,content:/media/RouxpiTech
And streaming some content will fail with:
File "/home/RouxpiTech/.local/lib/python3.6/site-packages/coherence/upnp/devices/media_server.py", line 388, in process_child del request.received_headers[b'content-length'] builtins.AttributeError: 'Request' object has no attribute 'received_headers'
I have tested with other devices, and this error only happens on some devices.
It fails with Samsung TVs
And it was succesfull in iOS.
Travis build fails complaining about pep8 error: W504 (line break after binary operator) and it shouldn't because this conflicts with W503 which enforces the opposite.
/Users/rich/Library/Python/3.11/bin/cohen3
Traceback (most recent call last):
File "/Users/rich/Library/Python/3.11/bin/cohen3", line 5, in <module>
from coherence.cli import main
File "/Users/rich/Library/Python/3.11/lib/python/site-packages/coherence/cli.py", line 27, in <module>
from coherence.base import Coherence, Plugins
File "/Users/rich/Library/Python/3.11/lib/python/site-packages/coherence/base.py", line 62, in <module>
from eventdispatcher import (
File "/Users/rich/Library/Python/3.11/lib/python/site-packages/eventdispatcher/__init__.py", line 5, in <module>
from .dictproperty import DictProperty, ObservableDict
File "/Users/rich/Library/Python/3.11/lib/python/site-packages/eventdispatcher/dictproperty.py", line 13, in <module>
class ObservableDict(collections.MutableMapping):
^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'collections' has no attribute 'MutableMapping'
As now there is a Dockerfile, it feels natural to have one.
Using Github Actions it is possible easily. Commits to master can build automatically the image and push it to Docker Hub. I can help, if needed.
Prerequisite: a Docker Hub free account and an existing empty image/repo there.
The google's api used for the original project is not working anymore with youtube, google shutdown the old api and has released a new api with oauth authorization, new urls...
I installed via pip / user install per the README, but get:
cohen3
zsh: command not found: cohen3
pip3 list -v | grep coh
cohen3 0.9.3 /Users/rich/Library/Python/3.10/lib/python/site-packages pip
But I don't see an actual binary or anything named cohen3
in that dir.
Not sure what I'm missing.
[rich:~/Dropbox/cohen-dnla]$ pip3 -V
pip 22.2.2 from /opt/homebrew/lib/python3.10/site-packages/pip (python 3.10)
[rich:~/Dropbox/cohen-dnla]$ echo $PATH
/opt/homebrew/lib/python3.10/site-packages/pip:/Users/rich/Library/Python/3.10/lib/python/site-packages:/opt/homebrew/opt/node@16/bin:/usr/local/bin:/usr/local/sbin:/Users/rich/bin:/Users/rich/.poetry/bin:/usr/local/opt/libpq/bin:/usr/local/Cellar/ruby/2.7.1_2/bin/gem:/usr/local/opt/ruby/bin:/Users/rich/.krew/bin:/Users/rich/Library/Python/3.7/bin/:/usr/local/opt/mysql-client/bin:/usr/local/sbin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Users/rich/.pub-cache/bin
E122: continuation line missing indentation or outdented
https://pypi.org/project/Cohen3/ has 0.8.3 but the repo has 0.9.1
E402: module level import not at top of file
E303: too many blank lines
Cohen3.base.log_level
breaks here if you use the CLI interface in non daemon mode and without a configuration file (or without a proper logging section). You will get an builtins.AttributeError: 'Section' object has no attribute 'upper'
exception.
The reason for this behavior is, that you unconditionally add a loggging
section in cli.py but only in daemon mode do you add a level
attribute a few lines later.
Cohen3 won't start with a recent version of Twisted because it uses the Twisted HTTPPageGetter API which has been removed for security reasons.
$ cohen3 -h
Traceback (most recent call last):
File "/usr/local/bin/cohen3", line 5, in <module>
from coherence.cli import main
File "/usr/local/lib/python3.9/site-packages/coherence/cli.py", line 27, in <module>
from coherence.base import Coherence, Plugins
File "/usr/local/lib/python3.9/site-packages/coherence/base.py", line 71, in <module>
from coherence.upnp.core.device import Device, RootDevice
File "/usr/local/lib/python3.9/site-packages/coherence/upnp/core/device.py", line 32, in <module>
from coherence.upnp.core import utils
File "/usr/local/lib/python3.9/site-packages/coherence/upnp/core/utils.py", line 611, in <module>
class myHTTPPageGetter(client.HTTPPageGetter):
File "/usr/local/lib/python3.9/site-packages/twisted/python/deprecate.py", line 475, in __getattribute__
value = getattr(state._module, name)
AttributeError: module 'twisted.web.client' has no attribute 'HTTPPageGetter'
There are only documentation for some parts of the project (backends) and some of the current documentation is outdated.
The recently added external dependencies (axiom and epsilon) does not have format accordingly the pep8 code style
Installing the latest version using:
pip install https://github.com/opacam/Cohen3/archive/master.zip
will fail with:
Downloading https://files.pythonhosted.org/packages/a2/37/f46636488468b8c30d7a59be471fdd9fb84b82ca3d770fe819e815bec65d/eventdispatcher-1.81.tar.gz
ERROR: Complete output from command python setup.py egg_info:
ERROR: Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-dvxm4cem/eventdispatcher/setup.py", line 4, in <module>
from eventdispatcher import __version__
File "/tmp/pip-install-dvxm4cem/eventdispatcher/eventdispatcher/__init__.py", line 12, in <module>
from .scheduledevent import ScheduledEvent
File "/tmp/pip-install-dvxm4cem/eventdispatcher/eventdispatcher/scheduledevent.py", line 8, in <module>
from clock import Clock
ModuleNotFoundError: No module named 'clock'
----------------------------------------
ERROR: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-dvxm4cem/eventdispatcher/
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.