Ticket #256 (new defect)

Opened 1 year ago

Last modified 11 months ago

Exception initializing MediaStore

Reported by: unkn0wn Assigned to: dev
Priority: major Milestone:
Component: MediaServer Backend MediaDB Version:
Keywords: Cc:

Description

Coherence segfaults initially creating database. It performs a partial import, successfully adds artists A through H, then bails.

Unhandled error in Deferred:
Traceback (most recent call last):
  File "/usr/lib64/python2.6/site-packages/coherence/backends/mediadb_storage.py", line 668, in upnp_init
    self.get_music_files(self.medialocation)
  File "/usr/lib64/python2.6/site-packages/coherence/backends/mediadb_storage.py", line 548, in get_music_files
    d.addBoth(got_tags, file)
  File "/usr/lib64/python2.6/site-packages/twisted/internet/defer.py", line 214, in addBoth
    callbackKeywords=kw, errbackKeywords=kw)
  File "/usr/lib64/python2.6/site-packages/twisted/internet/defer.py", line 186, in addCallbacks
    self._runCallbacks()
--- <exception caught here> ---
  File "/usr/lib64/python2.6/site-packages/twisted/internet/defer.py", line 328, in _runCallbacks
    self.result = callback(self.result, *args, **kw)
  File "/usr/lib64/python2.6/site-packages/coherence/backends/mediadb_storage.py", line 509, in got_tags
    album=tags.get('album', '')
exceptions.AttributeError: Failure instance has no attribute 'get'

MediaStore? configuration

[[MediaStore]]
	medialocation = /media/music
	mediadb = /var/db/media.db
	name = Music

Some info on my system:

Linux tulkas 2.6.30-gentoo-r5 #4 SMP Fri Oct 9 19:25:43 EDT 2009 x86_64 AMD Athlon(tm) Dual Core Processor 5050e AuthenticAMD GNU/Linux
dev-python/twisted-8.1.0
dev-python/epsilon-0.5.12
dev-python/axiom-0.5.31
dev-db/sqlite-3.6.17

I'd be happy to provide any additional information to help diagnose/resolve the issue.

Change History

(in reply to: ↑ description ) 15.10.2009 21:33:52 changed by dev

Replying to unkn0wn:

the MediaDB store is very picky when it comes to the metadata. Probably one of your files has an incomplete set and the tag-extractor fails on it.

But we shouldn't break there, instead write a warning and continue with the next file.

Time for http://coherence-project.org/wiki/MediaDB-ng

(follow-up: ↓ 3 ) 15.10.2009 22:48:16 changed by unkn0wn

Update:

I removed pyid3lib in favor of tagpy and that seemed to work. I still get exceptions in the log, but they seem to be handled and the database is initialized successfully. I undoubtably have bad data somewhere, but I'd expect it to be ignored with a warning rather than crash.

Traceback (most recent call last):
  File "/usr/lib64/python2.6/site-packages/coherence/backends/mediadb_storage.py", line 668, in upnp_init
    self.get_music_files(self.medialocation)
  File "/usr/lib64/python2.6/site-packages/coherence/backends/mediadb_storage.py", line 548, in get_music_files
    d.addBoth(got_tags, file)
  File "/usr/lib64/python2.6/site-packages/twisted/internet/defer.py", line 214, in addBoth
    callbackKeywords=kw, errbackKeywords=kw)
  File "/usr/lib64/python2.6/site-packages/twisted/internet/defer.py", line 186, in addCallbacks
    self._runCallbacks()
--- <exception caught here> ---
  File "/usr/lib64/python2.6/site-packages/twisted/internet/defer.py", line 328, in _runCallbacks
    self.result = callback(self.result, *args, **kw)
  File "/usr/lib64/python2.6/site-packages/coherence/backends/mediadb_storage.py", line 532, in got_tags
    album_ds.cover = check_for_cover_art(dirname)
  File "/usr/lib64/python2.6/site-packages/coherence/backends/mediadb_storage.py", line 496, in check_for_cover_art
    jpgs = [i for i in os.listdir(path) if os.path.splitext(i)[1] in ('.jpg', '.JPG')]
exceptions.UnicodeEncodeError: 'ascii' codec can't encode character u'\xf6' in position 14: ordinal not in range(128)

I'm not sure if this is an issue with Coherence or if there is a bug upstream. Does pyid3lib throw exceptions that the mediadb backend should be catching?

I switched from dev-python/pyid3lib-0.5.1-r1 to dev-python/tagpy-0.94.5 with great success

(in reply to: ↑ 2 ) 19.10.2009 12:02:23 changed by lightyear

Replying to unkn0wn:

Update: I removed pyid3lib in favor of tagpy and that seemed to work. I still get exceptions in the log, but they seem to be handled and the database is initialized successfully. I undoubtably have bad data somewhere, but I'd expect it to be ignored with a warning rather than crash. {{{ Traceback (most recent call last): File "/usr/lib64/python2.6/site-packages/coherence/backends/mediadb_storage.py", line 668, in upnp_init self.get_music_files(self.medialocation) File "/usr/lib64/python2.6/site-packages/coherence/backends/mediadb_storage.py", line 548, in get_music_files d.addBoth(got_tags, file) File "/usr/lib64/python2.6/site-packages/twisted/internet/defer.py", line 214, in addBoth callbackKeywords=kw, errbackKeywords=kw) File "/usr/lib64/python2.6/site-packages/twisted/internet/defer.py", line 186, in addCallbacks self._runCallbacks() --- <exception caught here> --- File "/usr/lib64/python2.6/site-packages/twisted/internet/defer.py", line 328, in _runCallbacks self.result = callback(self.result, *args, **kw) File "/usr/lib64/python2.6/site-packages/coherence/backends/mediadb_storage.py", line 532, in got_tags album_ds.cover = check_for_cover_art(dirname) File "/usr/lib64/python2.6/site-packages/coherence/backends/mediadb_storage.py", line 496, in check_for_cover_art jpgs = [i for i in os.listdir(path) if os.path.splitext(i)[1] in ('.jpg', '.JPG')] exceptions.UnicodeEncodeError?: 'ascii' codec can't encode character u'\xf6' in position 14: ordinal not in range(128) }}}

This is a known problem with os on posix system in python 2.5/2.6: it returns bytestrings for filenames which it can't encode with the systems default encoding - which is totally legit on most filesystems (like ext3) on linux systems. So a really quick work-a-round is to just rename the files (using a id3-tagging tool mostly the best solution).

I'm not sure if this is an issue with Coherence or if there is a bug upstream. Does pyid3lib throw exceptions that the mediadb backend should be catching?

This is not a bug in pyid3lib.

But you are right it, should be more defensive; warn don't crash. I am not sure if we are going to do much work on this in the near future though because we are planning to replace the media db with a gst-tagbin based approach with more features soon.