coherence-project / Coherence

DLNA/UPnP Media Server and Framework for the Digital Living
MIT License
171 stars 52 forks source link

Not working in Arch Linux #5

Closed drunk3nm0nk3y closed 10 years ago

drunk3nm0nk3y commented 10 years ago

Distro: Arch Linux - linux 3.14.1-1 - x86_64 Python versions: 2.7.6 (and also v3.4.0, but coherence is executed with v2.7 !) installed Twisted packages: twisted 13.2.0-1 and twisted-web2 8.1.0-4

The installation works , but when running coherence I always get a lot of errors and coherence doesn't work:

$ coherence -c /etc/coherence.conf 

/usr/lib/python2.7/site-packages/Coherence-0.6.7-py2.7.egg/coherence/extern/louie.py:8: UserWarning: extern.louie will soon be deprecated in favor of coherence.dispatcher.
  warnings.warn("extern.louie will soon be deprecated in favor of coherence.dispatcher.")
Traceback (most recent call last):
  File "/usr/lib/python2.7/logging/__init__.py", line 851, in emit
    msg = self.format(record)
  File "/usr/lib/python2.7/logging/__init__.py", line 724, in format
    return fmt.format(record)
  File "/usr/lib/python2.7/logging/__init__.py", line 467, in format
    s = self._fmt % record.__dict__
TypeError: not enough arguments for format string
Logged from file log.py, line 42
Traceback (most recent call last):
  File "/usr/lib/python2.7/logging/__init__.py", line 851, in emit
    msg = self.format(record)
  File "/usr/lib/python2.7/logging/__init__.py", line 724, in format
    return fmt.format(record)
  File "/usr/lib/python2.7/logging/__init__.py", line 467, in format
    s = self._fmt % record.__dict__
TypeError: not enough arguments for format string
Logged from file log.py, line 42
/usr/lib/python2.7/site-packages/Coherence-0.6.7-py2.7.egg/coherence/extern/inotify.py:40: UserWarning: coherence.extern.inotify is deprecated.
  warnings.warn("coherence.extern.inotify is deprecated.")
Traceback (most recent call last):
  File "/usr/lib/python2.7/logging/__init__.py", line 851, in emit
    msg = self.format(record)
  File "/usr/lib/python2.7/logging/__init__.py", line 724, in format
    return fmt.format(record)
  File "/usr/lib/python2.7/logging/__init__.py", line 467, in format
    s = self._fmt % record.__dict__
TypeError: not enough arguments for format string
Logged from file log.py, line 42
Traceback (most recent call last):
  File "/usr/lib/python2.7/logging/__init__.py", line 851, in emit
    msg = self.format(record)
  File "/usr/lib/python2.7/logging/__init__.py", line 724, in format
    return fmt.format(record)
  File "/usr/lib/python2.7/logging/__init__.py", line 467, in format
    s = self._fmt % record.__dict__
TypeError: not enough arguments for format string
Logged from file log.py, line 42

I have only activated the "FSStore" Backend in the config file, I also set the right network device name and even added a multicast route, pointing to the proper network interface. All dependencies are installed.

It would be great if you could fix this, or tell me how to fix this problem on my side. I thinks that coherence is a really promising software and I was planning extend it by writing a backend for streaming live content.

drunk3nm0nk3y commented 10 years ago

seems like there are some errors in log.py?! By commentig out the various log functions in log.py I could also trigger this warning:

/usr/lib/python2.7/site-packages/Coherence-0.6.7-py2.7.egg/coherence/extern/inotify.py:40: UserWarning: coherence.extern.inotify is deprecated.
  warnings.warn("coherence.extern.inotify is deprecated.")

which seems to be ok. I edited "log.py" again and let it print the log-messages in to the terminal. Finally some usefull information about what is going on! Coherence is running, but it can't start the backends mediaserver and fsstore. Here is the output:

$ coherence -c /etc/coherence.conf
/usr/lib/python2.7/site-packages/Coherence-0.6.7-py2.7.egg/coherence/extern/louie.py:8: UserWarning: extern.louie will soon be deprecated in favor of coherence.dispatcher.
  warnings.warn("extern.louie will soon be deprecated in favor of coherence.dispatcher.")
Coherence UPnP framework version 0.6.7 starting...
running on host: 192.168.2.50
send out discovery for ssdp:all
WebServer on port 41932 ready
adding plugin %r
/usr/lib/python2.7/site-packages/Coherence-0.6.7-py2.7.egg/coherence/extern/inotify.py:40: UserWarning: coherence.extern.inotify is deprecated.
  warnings.warn("coherence.extern.inotify is deprecated.")
Activating FSStore plugin as MediaServer...
Can't enable FSStore plugin for sub-system MediaServer, __init__() got an unexpected keyword argument 'active'!
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/Coherence-0.6.7-py2.7.egg/coherence/base.py", line 445, in add_plugin
    new_backend = device_class(self, plugin_class, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'active'

Can't enable plugin, : 'NoneType' object has no attribute 'uuid'!
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/Coherence-0.6.7-py2.7.egg/coherence/base.py", line 385, in setup_part2
    plugin['uuid'] = str(backend.uuid)[5:]
AttributeError: 'NoneType' object has no attribute 'uuid'

Coherence UPnP ControlPoint starting...
EventServer ready...
D-Bus pontoon <coherence.dbus_service.DBusPontoon at /org/Coherence at 0x3f92c50> <dbus._dbus.SessionBus (session) at 0x3f37170> <dbus.service.BusName org.Coherence on <dbus._dbus.SessionBus (session) at 0x3f37170> at 0x3f92c90>
D-Bus pontoon started
SSDP command M-SEARCH * - from 192.168.2.50:60584
with headers:
Discovery request from (192.168.2.50,60584) for ssdp:all
Discovery request for ssdp:all

The contents of **kwargs in the function "add_plugin" of "base.py" (line 445) are:

active yes
content /home/myUsername/Videos/
name Videos

and this are basically just the parsed entrys from the FSStore plugin section in the config file. Please notice that I didn't change anything in the config (except the path to my video folder), so the syntax in that file should be ok. Anyway it seems like "active=yes" is causing the problem, because it is unexpected. Or is it maybe a general problem by how the **kwargs are handled?

drunk3nm0nk3y commented 10 years ago

It works now, but I had to downgrade coherence and some python packages. I installed these versions:

I hope this helps other people out there

htgoebel commented 10 years ago

I just merged pull request #6 which should solve this problem. Would you please be so kind testing this?

drunk3nm0nk3y commented 10 years ago

Ok, I will try it out and report back. Thanks for the support!

drunk3nm0nk3y commented 10 years ago

I tried the new/patched version on two differn Arch Linux Systems with twisted 13.2.0-1 installed. On both of them it did not work.

Here is the output from the first System (the same system as I used in my privious comments):

$ coherence -c coherence.config 
/usr/lib/python2.7/site-packages/Coherence-0.6.7-py2.7.egg/coherence/extern/louie.py:8: UserWarning: extern.louie will soon be deprecated in favor of coherence.dispatcher.
  warnings.warn("extern.louie will soon be deprecated in favor of coherence.dispatcher.")
Traceback (most recent call last):
  File "/usr/lib/python2.7/logging/__init__.py", line 851, in emit
    msg = self.format(record)
  File "/usr/lib/python2.7/logging/__init__.py", line 724, in format
    return fmt.format(record)
  File "/usr/lib/python2.7/logging/__init__.py", line 467, in format
    s = self._fmt % record.__dict__
TypeError: not enough arguments for format string
Logged from file log.py, line 42
Traceback (most recent call last):
  File "/usr/lib/python2.7/logging/__init__.py", line 851, in emit
    msg = self.format(record)
  File "/usr/lib/python2.7/logging/__init__.py", line 724, in format
    return fmt.format(record)
  File "/usr/lib/python2.7/logging/__init__.py", line 467, in format
    s = self._fmt % record.__dict__
TypeError: not enough arguments for format string
Logged from file log.py, line 42
/usr/lib/python2.7/site-packages/Coherence-0.6.7-py2.7.egg/coherence/extern/inotify.py:40: UserWarning: coherence.extern.inotify is deprecated.
  warnings.warn("coherence.extern.inotify is deprecated.")
Traceback (most recent call last):
  File "/usr/lib/python2.7/logging/__init__.py", line 851, in emit
    msg = self.format(record)
  File "/usr/lib/python2.7/logging/__init__.py", line 724, in format
    return fmt.format(record)
  File "/usr/lib/python2.7/logging/__init__.py", line 467, in format
    s = self._fmt % record.__dict__
TypeError: not enough arguments for format string
Logged from file log.py, line 42
Traceback (most recent call last):
  File "/usr/lib/python2.7/logging/__init__.py", line 851, in emit
    msg = self.format(record)
  File "/usr/lib/python2.7/logging/__init__.py", line 724, in format
    return fmt.format(record)
  File "/usr/lib/python2.7/logging/__init__.py", line 467, in format
    s = self._fmt % record.__dict__
TypeError: not enough arguments for format string
Logged from file log.py, line 42
^CTraceback (most recent call last):
  File "/usr/lib/python2.7/logging/__init__.py", line 851, in emit
    msg = self.format(record)
  File "/usr/lib/python2.7/logging/__init__.py", line 724, in format
    return fmt.format(record)
  File "/usr/lib/python2.7/logging/__init__.py", line 467, in format
    s = self._fmt % record.__dict__
TypeError: not enough arguments for format string
Logged from file log.py, line 42

The log-file is beeing created, but nothing is written into it!

The second testsystem was a Arch Linux ARM System. The output looks a bit different on this system:

/usr/lib/python2.7/site-packages/coherence/extern/louie.py:8: UserWarning: extern.louie will soon be deprecated in favor of coherence.dispatcher.
  warnings.warn("extern.louie will soon be deprecated in favor of coherence.dispatcher.")
Traceback (most recent call last):
  File "/usr/lib/python2.7/logging/__init__.py", line 851, in emit
    msg = self.format(record)
  File "/usr/lib/python2.7/logging/__init__.py", line 724, in format
    return fmt.format(record)
  File "/usr/lib/python2.7/logging/__init__.py", line 467, in format
    s = self._fmt % record.__dict__
TypeError: not enough arguments for format string
Logged from file log.py, line 42
Traceback (most recent call last):
  File "/usr/lib/python2.7/logging/__init__.py", line 851, in emit
    msg = self.format(record)
  File "/usr/lib/python2.7/logging/__init__.py", line 724, in format
    return fmt.format(record)
  File "/usr/lib/python2.7/logging/__init__.py", line 467, in format
    s = self._fmt % record.__dict__
TypeError: not enough arguments for format string
Logged from file log.py, line 42
Traceback (most recent call last):
  File "/usr/lib/python2.7/logging/__init__.py", line 851, in emit
    msg = self.format(record)
  File "/usr/lib/python2.7/logging/__init__.py", line 724, in format
    return fmt.format(record)
  File "/usr/lib/python2.7/logging/__init__.py", line 467, in format
    s = self._fmt % record.__dict__
TypeError: not enough arguments for format string
Logged from file log.py, line 42
^CUnhandled error in Deferred:
Unhandled Error
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/coherence/base.py", line 582, in shutdown
    return _shutdown()
  File "/usr/lib/python2.7/site-packages/coherence/base.py", line 574, in _shutdown
    dl.addCallback(homecleanup)
  File "/usr/lib/python2.7/site-packages/twisted/internet/defer.py", line 306, in addCallback
    callbackKeywords=kw)
  File "/usr/lib/python2.7/site-packages/twisted/internet/defer.py", line 295, in addCallbacks
    self._runCallbacks()
--- <exception caught here> ---
  File "/usr/lib/python2.7/site-packages/twisted/internet/defer.py", line 577, in _runCallbacks
    current.result = callback(current.result, *args, **kw)
  File "/usr/lib/python2.7/site-packages/coherence/base.py", line 567, in homecleanup
    self.ssdp_server.shutdown()
  File "/usr/lib/python2.7/site-packages/coherence/upnp/core/ssdp.py", line 65, in shutdown
    if self.resend_notify_loop.running:
exceptions.AttributeError: 'SSDPServer' object has no attribute 'resend_notify_loop'
Hypfer commented 10 years ago

There is another pull request waiting which fixes this. It works now. I've tested it. :)

Blog entry (german) about that: http://hypfer.de/blog/2014/05/01/upnpdlna-und-das-play-to-kontextmenue-unter-linux/

drunk3nm0nk3y commented 10 years ago

Nice, I will test it as soon as the pull request gets through.

I have also read your Blog Post and I didn't now that there is a Nautilus plugin. Maybe I will try it out later. Right now I'm trying to realize Live Streaming via Coherence. I have a DVB-T Tuner and want to Stream the TV programs with Coherence. Piping the mpegts stream into a FIFO didn't work, because Coherence or Twisted can't handle FIFOs. I intend to write a custom backend, but I'm still not sure about how to "feed" coherence with the AV-Stream from the DVB tuner and I'm still looking for a good documentation about writing backends.

Hypfer commented 10 years ago

OR you just use https://github.com/tvheadend/tvheadend

It's awesome.

drunk3nm0nk3y commented 10 years ago

Looks good, but I want to do this with uPnP/DLNA

htgoebel commented 10 years ago

I'm working on a fix. But since coherence is in a bad shape and the fix has to be made at many places, this will take some hours. Do not expect results prior to Saturday evening (CET).

drunk3nm0nk3y commented 10 years ago

Thanks a lot and don't worry, in the meantime I can still use my downgraded installation! It is really great that you and other people like Hypfer still support this project. But it's sad that the main developers didn't continue to work on Coherence. In fact it's still one of the most referenced Projects when it comes to uPnP/DLNA...

drunk3nm0nk3y commented 10 years ago

Sry for mixing unrelated stuff into this issue. [... moved to issue #8 by moderator...] I thought I did some obvious thing wrong and didn't see it as an issue. That's why i didn't create an new issue for this. But I guess you are right :-)

htgoebel commented 10 years ago

@drunk3nm0nk3y: Please do not put unrelated stuff into other issues. Opening new issues is for free and it make the maintainers life much more easy. Thanks

htgoebel commented 10 years ago

@drunk3nm0nk3y: Can you please report, whether this very problem is now solved on your systems. Thanks.

drunk3nm0nk3y commented 10 years ago

I will test it tomorrow and report back.

drunk3nm0nk3y commented 10 years ago

Coherence starts, but can't start the mediaserver backends, complaining about the numbers of arguments passed to one of the init-functions:

> $ coherence -c coherence.config 
2014-05-12 20:41:10,766 WARNING coherence: Coherence UPnP framework version 0.6.7 starting... (base.py:288)
2014-05-12 20:41:10,772 WARNING webserver: WebServer on port 30020 ready (base.py:129)
2014-05-12 20:41:10,815 WARNING coherence: Can't enable DvbStore plugin for sub-system MediaServer, __init__() takes exactly 1 argument (6 given)! (base.py:448)
2014-05-12 20:41:10,828 WARNING coherence: Can't enable FSStore plugin for sub-system MediaServer, __init__() takes exactly 1 argument (8 given)! (base.py:448)

DvbStore is my custom backend and FSStore is one of the backends coherence comes with.

Update, got some more information by setting log-level to debug:

$ coherence -c coherence.config 
No handlers could be found for logger "coherence"
2014-05-12 20:58:51,600 WARNING coherence: Coherence UPnP framework version 0.6.7 starting... (base.py:288)
2014-05-12 20:58:51,603 INFO coherence: running on host: 192.168.2.23 (base.py:312)
2014-05-12 20:58:51,608 WARNING webserver: WebServer on port 30020 ready (base.py:129)
2014-05-12 20:58:51,609 INFO coherence: adding plugin 'DvbStore' (base.py:428)
2014-05-12 20:58:51,651 INFO coherence: Activating DvbStore plugin as MediaServer... (base.py:441)
2014-05-12 20:58:51,651 WARNING coherence: Can't enable DvbStore plugin for sub-system MediaServer, __init__() takes exactly 1 argument (6 given)! (base.py:448)
2014-05-12 20:58:51,653 DEBUG coherence: Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/Coherence-0.6.7-py2.7.egg/coherence/base.py", line 442, in add_plugin
    new_backend = device_class(self, plugin_class, **kwargs)
TypeError: __init__() takes exactly 1 argument (6 given)
 (base.py:449)
2014-05-12 20:58:51,654 INFO coherence: adding plugin 'FSStore' (base.py:428)
2014-05-12 20:58:51,664 INFO coherence: Activating FSStore plugin as MediaServer... (base.py:441)
2014-05-12 20:58:51,665 WARNING coherence: Can't enable FSStore plugin for sub-system MediaServer, __init__() takes exactly 1 argument (8 given)! (base.py:448)
2014-05-12 20:58:51,666 DEBUG coherence: Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/Coherence-0.6.7-py2.7.egg/coherence/base.py", line 442, in add_plugin
    new_backend = device_class(self, plugin_class, **kwargs)
TypeError: __init__() takes exactly 1 argument (8 given)
 (base.py:449)
htgoebel commented 10 years ago

Okay. Here is another try. Please test branch maintain/0.6.x.

It took some time, since I tried to fix the root of the cause.

drunk3nm0nk3y commented 10 years ago

Just tried it. At first I thought everything is fine, but then I noticed that there are errors in the FSStore backend. Seems like something goes wrong while scanning the Folder where the media files are located. The path is correct, I checked it.

Coherence works, my custom extension works too, but the FSStore backend does not work. Here is the output:

$ coherence -c coherence.config 
2014-05-15 22:27:31,664 WARNING coherence: Coherence UPnP framework version 0.6.7 starting... (base.py:292)
2014-05-15 22:27:31,670 WARNING webserver: WebServer on port 30020 ready (base.py:131)
2014-05-15 22:27:31,967 INFO mediaserver: ScheduledRecordingServer missing callback (media_server.py:659)
2014-05-15 22:27:31,981 INFO mediaserver: MediaServer register (basics.py:240)
2014-05-15 22:27:31,985 WARNING mediaserver: MediaServer DvbStore (<coherence.backends.dvb_storage.DvbStore object at 0x978884c>) activated with id anyUID-will-do (media_server.py:717)
2014-05-15 22:27:31,992 INFO fs_store: cannot import name inotify (fs_storage.py:500)
2014-05-15 22:27:31,994 DEBUG fs_store: walk '/home/username/Videos' (fs_storage.py:635)
2014-05-15 22:27:31,998 DEBUG fs_store: append  /home/username/Videos <type 'str'> None (fs_storage.py:685)
2014-05-15 22:27:32,016 DEBUG fs_store: create  directory /home/username/Videos <type 'str'> None (fs_storage.py:654)
2014-05-15 22:27:32,023 INFO mediaserver: MediaServer getChildWithDefault, GET, description-2.xml, /anyUID-will-do/description-2.xml IPv4Address(TCP, '192.168.2.23', 47959) (media_server.py:69)
2014-05-15 22:27:32,024 WARNING fs_store: on walk of '/home/username/Videos': AttributeError("'NoneType' object has no attribute 'rfind'",) (fs_storage.py:538)
2014-05-15 22:27:32,025 INFO mediaserver: {'host': '192.168.2.23', 'user-agent': 'Coherence PageGetter'} (media_server.py:71)
2014-05-15 22:27:32,046 DEBUG fs_store: Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/Coherence-0.6.7-py2.7.egg/coherence/backends/fs_storage.py", line 536, in __init__
    self.walk(path, parent, self.ignore_file_pattern)
  File "/usr/lib/python2.7/site-packages/Coherence-0.6.7-py2.7.egg/coherence/backends/fs_storage.py", line 637, in walk
    parent = self.append(path, parent)
  File "/usr/lib/python2.7/site-packages/Coherence-0.6.7-py2.7.egg/coherence/backends/fs_storage.py", line 702, in append
    id = self.create(mimetype, path, parent)
  File "/usr/lib/python2.7/site-packages/Coherence-0.6.7-py2.7.egg/coherence/backends/fs_storage.py", line 669, in create
    self.store[id] = FSItem(id, parent, path, mimetype, self.urlbase, UPnPClass, update=True, store=self)
  File "/usr/lib/python2.7/site-packages/Coherence-0.6.7-py2.7.egg/coherence/backends/fs_storage.py", line 139, in __init__
    _, ext = os.path.splitext(self.cover)
  File "/usr/lib/python2.7/posixpath.py", line 105, in splitext
    return genericpath._splitext(p, sep, altsep, extsep)
  File "/usr/lib/python2.7/genericpath.py", line 91, in _splitext
    sepIndex = p.rfind(sep)
AttributeError: 'NoneType' object has no attribute 'rfind'
 (fs_storage.py:540)

again, thanks for your help

htgoebel commented 10 years ago

And another try. Here it crashes with a UnicodeDecodeError when browsing the content. Can't solve this quickly, sorry.

htgoebel commented 10 years ago

This should now be fixed by 41a8481.

drunk3nm0nk3y commented 10 years ago

Just tested it and I can confirm that it's fixed! Thanks a lot :-)

htgoebel commented 10 years ago

You are welcome. Thanks for testing.