beetbox / beets

music library manager and MusicBrainz tagger
http://beets.io/
MIT License
12.6k stars 1.8k forks source link

BPD still errors out after pull of issue #2062 #2071

Closed bearcatsandor closed 7 years ago

bearcatsandor commented 8 years ago

Problem

Regarding https://github.com/beetbox/beets/pull/2062 bpd still doesn't operate properly. It starts to build the directory tree and then gives me an error about bluelet

Running this command in verbose (-vv) mode:

$ beet -vv bpd start 

Led to this problem:
user configuration: /home/bearcat/.config/beets/config.yaml
data directory: /home/bearcat/.config/beets
plugin paths:
Sending event: pluginload
inline: adding album field album_length
artresizer: method is (2, (6, 9, 4))
thumbnails: using IM to write metadata
thumbnails: using GIO to compute URIs
lyrics: Disabling google source: no API key configured.
library database: /home/bearcat/.config/beets/musiclibrary.blb
library directory: /home/hometheater/audio
Sending event: library_opened
the: "REO Speedwagon" -> "REO Speedwagon"
the: "REO Speedwagon" -> "REO Speedwagon"
the: "REO Speedwagon" -> "REO Speedwagon"
the: "Mourning Ritual" -> "Mourning Ritual"
the: "David Bowie" -> "David Bowie"
the: "菅野よう子" -> "菅野よう子"
the: "菅野よう子" -> "菅野よう子"
the: "菅野よう子" -> "菅野よう子"
the: "菅野よう子" -> "菅野よう子"
the: "菅野よう子" -> "菅野よう子"
the: "菅野よう子" -> "菅野よう子"
Building directory tree...
... done.
Traceback (most recent call last):
  File "/usr/lib/python-exec/python2.7/beet", line 9, in <module>
    load_entry_point('beets==1.3.19', 'console_scripts', 'beet')()
  File "/usr/lib64/python2.7/site-packages/beets/ui/__init__.py", line 1259, in main
    _raw_main(args)
  File "/usr/lib64/python2.7/site-packages/beets/ui/__init__.py", line 1246, in _raw_main
    subcommand.func(lib, suboptions, subargs)
  File "/usr/lib64/python2.7/site-packages/beetsplug/bpd/__init__.py", line 1190, in func
    self.start_bpd(lib, host, int(port), password, volume, debug)
  File "/usr/lib64/python2.7/site-packages/beetsplug/bpd/__init__.py", line 1167, in start_bpd
    server.run()
  File "/usr/lib64/python2.7/site-packages/beetsplug/bpd/__init__.py", line 761, in run
    super(Server, self).run()
  File "/usr/lib64/python2.7/site-packages/beetsplug/bpd/__init__.py", line 195, in run
    Connection.handler(self)))
  File "/usr/lib64/python2.7/site-packages/beets/util/bluelet.py", line 393, in run
    exit_te.reraise()
  File "/usr/lib64/python2.7/site-packages/beets/util/bluelet.py", line 217, in reraise
    _reraise(self.exc_info[0], self.exc_info[1], self.exc_info[2])
  File "/usr/lib64/python2.7/site-packages/beets/util/bluelet.py", line 281, in advance_thread
    next_event = coro.send(value)
  File "/usr/lib64/python2.7/site-packages/beets/util/bluelet.py", line 643, in server
    listener = Listener(host, port)
  File "/usr/lib64/python2.7/site-packages/beets/util/bluelet.py", line 413, in __init__
    self.sock.bind((host, port))
  File "/usr/lib64/python2.7/socket.py", line 228, in meth
    return getattr(self._sock,name)(*args)
socket.gaierror: [Errno -2] Name or service not known

Here's a link to the music files that trigger the bug (if relevant):

Setup

My configuration (output of beet config) is:

lyrics:
    bing_lang_from: []
    fallback: No lyrics found
    bing_client_secret: REDACTED
    google_API_key: REDACTED
    force: no
    google_engine_ID: REDACTED
    sources:
    - google
    - lyricwiki
    - lyrics.com
    - musixmatch
    auto: yes
    genius_api_key: REDACTED
    bing_lang_to:
duplicates:
    format: $albumartist - $album - $title
    count: yes
    album: no
    full: no
    keys: []
    move: ''
    tag: ''
    path: no
    copy: ''
    tiebreak: {}
    strict: no
    checksum: ''
    merge: no
    delete: no
play:
    command: gst-play-1.0 --gapless --volume=1.0
    use_folders: no
    raw: yes
    warning_threshold: -2
    warning_treshold: 100
    relative_to:
library: ~/.config/beets/musiclibrary.blb

replace:
    '[\\/]': _
    ^\.: _
    '[\x00-\x1f]': _
    '[<>:"\?\*\|]': _
    \s+$: ''
    ' ': _
    \!: ''
original_date: yes
ftintitle:
    format: (feat. {0})
    auto: yes
    drop: no

plugins: acousticbrainz badfiles bpd chroma convert copyartifacts duplicates edit embedart fetchart follow fromfilename ftintitle fuzzy importadded info inline lastgenre lyrics mbcollection mbsync mpdstats missing play random replaygain rewrite the thumbnails types web
follow:
    auto: yes
    email: bearcatsandor@gmail.com
    password: j@gu@rund1
    userid: 7frytxfvwbjh8llhbif9lkd0zavps9
acousticbrainz:
    auto: yes

paths:
    default: '%lower{%the{$albumartist}/$original_year-$album%if{$albumdisambig,_[$albumdisambig]}/$disc-$track-$title}'
    singleton: '%lower{singletons/%the{$artist}-$title}'
    comp: '%lower{various_artists/%if{$original_year,$original_year,$year}-$album%if{$albumdisambig,_[$albumdisambig]}/$disc-$track-%the{$artist}-$title}'

format_item: $albumartist - $original_year - $album - $title - $length
art_filename: cover
missing:
    format: $albumartist - $album - $title
    count: yes
    total: yes
format_album: $albumartist - $original_year - $album
lastgenre:
    fallback: ''
    canonical: ''
    source: track
    count: 4
    force: yes
    min_weight: 10
    auto: yes
    whitelist: yes
    separator: ', '

import:
    move: yes
    incremental: yes
    detail: yes
    timid: yes
    resume: ask
    log: /tmp/beets_import.log
    write: yes

sort_album: albumartist+ original_year+ album+

match:
    preferred:
        media:
        - Hybrid SACD
        - SACD
        - CD
        - Digital Media|File
mbcollection:
    auto: no
mpd:
    rating: no
    rating_mix: 0.75
    host: localhost
    music_directory: /home/hometheater/audio
    password: REDACTED
    port: 6600
fetchart:
    auto: yes
    google_search: no
    cautious: no
    minwidth: 1500
    sources: coverart albumart fanarttv itunes amazon
    fanarttv_key: REDACTED
    google_engine: 001442825323518660753:hrh5ch1gjzm
    enforce_ratio: no
    maxwidth: 0
    store_source: no
    google_key: REDACTED
    cover_names:
    - cover
    - front
    - art
    - album
    - folder
embedart:
    maxwidth: 1000
    compare_threshold: 0
    auto: yes
    ifempty: no
    remove_art_file: no

musicbrainz:
    user: bearcatsandor
    pass: REDACTED
fuzzy:
    threshold: 0.7
    prefix: '~'
sort_item: albumartist+ original_year+ album+ disc+ track+
convert:
    format: flac
    pretend: no
    quiet: no
    formats:
        extension: flac
        flac: gst-launch-1.0 filesrc location="$source" ! decodebin ! audioconvert ! flacenc quality=8 ! flactag ! filesink location="$dest"
        embed: yes
        copy_album_art: yes
        dest: ~/tmp
        alac:
            command: ffmpeg -i $source -y -vn -acodec alac $dest
            extension: m4a
        aac:
            command: ffmpeg -i $source -y -vn -acodec libfaac -aq 100 $dest
            extension: m4a
        opus: ffmpeg -i $source -y -vn -acodec libopus -ab 96k $dest
        mp3: ffmpeg -i $source -y -vn -aq 2 $dest
        ogg: ffmpeg -i $source -y -vn -acodec libvorbis -aq 3 $dest
        wma: ffmpeg -i $source -y -vn -acodec wmav2 -vn $dest
    never_convert_lossy_files: no
    album_art_maxwidth: 0
    dest:
    auto: no
    threads: 6
    copy_album_art: no
    tmpdir:
    max_bitrate: 500

    paths: {}
    embed: yes
threaded: yes
per_disc_numbering: yes
replaygain:
    backend: gstreamer
    auto: no
    overwrite: yes
    targetlevel: 89
album_fields:
    album_length: "total = 0\nfor item in items:\n    total += item.length\n    return total\n"

ui:
    color: yes
bpd:
    host: localhost
    port: 6600
    volume: 100
    password: REDACTED
directory: /home/hometheater/audio
echonest:
    apikey: 0WIRGAGR6HEDIRCRD
    auto: yes
    upload: yes
    convert: yes
    trunicate: yes
chroma:
    auto: yes
importadded:
    preserve_write_mtimes: no
    preserve_mtimes: no
rewrite: {}
thumbnails:
    auto: yes
    dolphin: no
    force: no
web:
    host: 127.0.0.1
    port: 8337
    cors: ''
pathfields: {}
item_fields: {}
edit:
    itemfields: track title artist album
    albumfields: album albumartist
    ignore_fields: id path
copyartifacts:
    print_ignored: no
    extensions: .*
the:
    a: yes
    patterns: []
    the: yes
    strip: no
    format: '{0}, {1}'
jackwilsdon commented 8 years ago

Hmm, that error almost looks like it's failing to resolve localhost, could you try replacing it with 127.0.0.1 in the bpd configuration section?

sampsyo commented 8 years ago

You could also just consider removing the host setting altogether and using the default.

bearcatsandor commented 8 years ago

I get the same error with '127.0.0.1' and that line removed.

On Wed, Jun 22, 2016 at 11:21 AM, Adrian Sampson notifications@github.com wrote:

You could also just consider removing the host setting altogether and using the default.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/beetbox/beets/issues/2071#issuecomment-227815358, or mute the thread https://github.com/notifications/unsubscribe/AADgP78rlpwBgZuf4WvPIEoMBN4PH_4vks5qOW8ZgaJpZM4I7hAQ .

Bearcat M. Şándor Voice: 872.CAT.SOUL (872.228.7685) Fax: 406.235.7070 My public pgp key is included for verification of my identity

jackwilsdon commented 8 years ago

That's very peculiar indeed, it seems it's failing to look up the address...

sampsyo commented 8 years ago

Yes indeed; that's very mysterious! Can you try running this Python one-liner to see if something socket-related is broken on your system?

python -c 'import socket; socket.socket().bind(("", 8337))'
bearcatsandor commented 8 years ago

That returns null for both root and my beets user.

On Wed, Jun 22, 2016 at 5:09 PM, Adrian Sampson notifications@github.com wrote:

Yes indeed; that's very mysterious! Can you try running this Python one-liner to see if something socket-related is broken on your system?

python -c 'import socket; socket.socket().bind(("", 8337))'

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/beetbox/beets/issues/2071#issuecomment-227904298, or mute the thread https://github.com/notifications/unsubscribe/AADgPzScckKtWKABVDSovSAvv9BB5oYwks5qOcCYgaJpZM4I7hAQ .

Bearcat M. Şándor Voice: 872.CAT.SOUL (872.228.7685) Fax: 406.235.7070 My public pgp key is included for verification of my identity

sampsyo commented 8 years ago

Quite strange. Any success if you leave the port as the default too—or, more drastically, if you remove everything in your config file except the line that enables the bpd plugin?

bearcatsandor commented 8 years ago

My config now contains only:

directory: /home/hometheater/audio library: ~/.config/beets/musiclibrary.blb

plugins: bpd

Note that it complains about gst versions. I have both some 0.10 and 1.0 gst libraries installed. Shall i remove all the 0.10 stuff i can find to see if that might be the issue?

I still get the error:

beet -vv bpd start 18:07:41 user configuration: /home/bearcat/.config/beets/config.yaml data directory: /home/bearcat/.config/beets plugin paths: Sending event: pluginload library database: /home/bearcat/.config/beets/musiclibrary.blb library directory: /home/hometheater/audio Sending event: library_opened /usr/lib64/python2.7/site-packages/beetsplug/bpd/gstplayer.py:31: PyGIWarning: Gst was imported without specifying a version first. Use gi.require_version('Gst', '1.0') before import to ensure that the right version gets loaded. from gi.repository import GLib, Gst Building directory tree... ... done. Traceback (most recent call last): File "/usr/lib/python-exec/python2.7/beet", line 9, in load_entry_point('beets==1.3.19', 'console_scripts', 'beet')() File "/usr/lib64/python2.7/site-packages/beets/ui/init.py", line 1259, in main _raw_main(args) File "/usr/lib64/python2.7/site-packages/beets/ui/init.py", line 1246, in _raw_main subcommand.func(lib, suboptions, subargs) File "/usr/lib64/python2.7/site-packages/beetsplug/bpd/init.py", line 1190, in func self.start_bpd(lib, host, int(port), password, volume, debug) File "/usr/lib64/python2.7/site-packages/beetsplug/bpd/init.py", line 1167, in start_bpd server.run() File "/usr/lib64/python2.7/site-packages/beetsplug/bpd/init.py", line 761, in run super(Server, self).run() File "/usr/lib64/python2.7/site-packages/beetsplug/bpd/init.py", line 195, in run Connection.handler(self))) File "/usr/lib64/python2.7/site-packages/beets/util/bluelet.py", line 393, in run exit_te.reraise() File "/usr/lib64/python2.7/site-packages/beets/util/bluelet.py", line 217, in reraise _reraise(self.exc_info[0], self.exc_info[1], self.exc_info[2]) File "/usr/lib64/python2.7/site-packages/beets/util/bluelet.py", line 281, in advance_thread next_event = coro.send(value) File "/usr/lib64/python2.7/site-packages/beets/util/bluelet.py", line 643, in server listener = Listener(host, port) File "/usr/lib64/python2.7/site-packages/beets/util/bluelet.py", line 413, in init self.sock.bind((host, port)) File "/usr/lib64/python2.7/socket.py", line 228, in meth return getattr(self._sock,name)(*args) socket.gaierror: [Errno -2] Name or service not known

On Wed, Jun 22, 2016 at 5:47 PM, Adrian Sampson notifications@github.com wrote:

Quite strange. Any success if you leave the port as the default too—or, more drastically, if you remove everything in your config file except the line that enables the bpd plugin?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/beetbox/beets/issues/2071#issuecomment-227910492, or mute the thread https://github.com/notifications/unsubscribe/AADgP3vlrKsHL997DsFOK1JtMHbO7G57ks5qOcmbgaJpZM4I7hAQ .

Bearcat M. Şándor Voice: 872.CAT.SOUL (872.228.7685) Fax: 406.235.7070 My public pgp key is included for verification of my identity

sampsyo commented 8 years ago

Very strange indeed -- I don't know what else to try! Everything works fine on my end, and I can't see any reason why socket.bind would ever fail with the default values for the host and port. I also don't see any reason why the test line I gave you would succeed while exactly the same call inside bpd would crash.

Any ideas for other things that might be different about your system? Can you try a different computer?

philippbeckmann commented 8 years ago

PyGIWarning: Gst was imported without specifying a version first. Use gi.require_version('Gst', '1.0') before import to ensure that the right version gets loaded. from gi.repository import GLib, Gst

IIRC this order of instruction was necessary to comply to the flake style checks. Is there a way to let flake ignore this special case?

ghost commented 8 years ago

what was the flake8 error?

philippbeckmann commented 8 years ago

Something like "no imports after function call".

Edit: Found it "E402 module level import not at top of file"

ghost commented 8 years ago

yes, there is a way to make flake8 conditionally ignore stuff by adding # noqa ignore=ERROR_NO at the end of it.

ghost commented 8 years ago

fixed the import warning in https://github.com/beetbox/beets/commit/cb6efc4c225416a9951c09237b1fbb547147bb34

sampsyo commented 8 years ago

Thanks, @jrobeson! Could you please add a quick changelog entry to that effect?

bearcatsandor commented 7 years ago

I'm closing this now, as it seems to be resolved.