beetbox / beets

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

Support HTTP proxies #2184

Open tm-nihonsuki opened 8 years ago

tm-nihonsuki commented 8 years ago

Problem

Not connecting reliably through a proxy server to various services. Example below shows result of fingerprint request.

Running this command in verbose (-vv) mode:

beet -vv import ./
data directory: /home/tony/.config/beets
library database: /home/tony/Music/musiclibrary.blb
library directory: /home/tony/Music
Sending event: import_task_start
fingerprint matching '/mnt/bulk/Music/00 -  We Will Rock You (Fatboy Slim Remix) - 0000.mp3' failed: HTTP request failed: Proxy URLs must have explicit schemes.
fingerprint matching '/mnt/bulk/Music/00 - 10 10 - 0000.mp3' failed: HTTP request failed: Proxy URLs must have explicit schemes.
fingerprint matching '/mnt/bulk/Music/00 - 19 ( US Extended Mix ) - 1985.mp3' failed: HTTP request failed: Proxy URLs must have explicit schemes.
fingerprint matching '/mnt/bulk/Music/00 - 19 (Vietnam Destruction Mix) - 0000.mp3' failed: HTTP request failed: Proxy URLs must have explicit schemes.
fingerprint matching '/mnt/bulk/Music/00 - 1995 Penny - 0000.mp3' failed: HTTP request failed: Proxy URLs must have explicit schemes.

Led to this problem:

Means that the program doesn't reach beyond the proxy

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

Setup

My configuration (output of beet config) is:

# Automatically migrated from legacy .beetsconfig.

directory: ~/Music
library: ~/Music/musiclibrary.blb

import:
    copy: true
    delete: true
    resume: false
    log: ~/Music/musicimport.log
    threaded: true

paths:
    default: $genre/$albumartist/$album/$track $title
    albumtype:soundtrack: Soundtracks/$album/$track $title
    singleton: Non-Album/$artist/$title
    comp: Compilations/$genre/$album/$track title

plugins: chroma fromfilename web

chroma:
    auto: yes

fromfilename:
   auto: no

web:
    host: 127.0.0.1
    port: 8337
sampsyo commented 8 years ago

Yes, AFAIK nothing in beets explicitly supports HTTP CONNECT proxies. If you can give us some background on exactly what we would need to do to support this, we could consider this a feature request.

tm-nihonsuki commented 8 years ago

Hi Adrian.

Thanks for the prompt reply. The only relevant information I could find via google was this question on stackoverflow.

http://stackoverflow.com/questions/35824689/proxy-urls-must-have-explicit-schemes

I guess if the proxy details could be put in the config file, something like:

proxy: enabled: [true/false] http: myproxy:80 protocol: host:port

pull that into the appropriate module for accessing the internet and then call resources with

http://myproxy:80/www.interestingsite.com/resource.html?etc

From what I can gather at a glance, it is the inclusion of the local proxy's details at the head that is lacking. Not sure if or why this is necessary. Which module would I need to play with to check this, do you think?

Thanks again.

Tony

edit ============================================

Found the musicbrainz: section of the config and tried playing with that. I've tried...

musicbrainz:
    host: host:port/musicbrainz.org
    ratelimit: 1
    ratelimit_interval: 1.0

musicbrainz:
    host: http[s]://[user:passwd@]host:port/musicbrainz.org
    ratelimit: 1
    ratelimit_interval: 1.0

but to no avail. A simplistic approach, I know.

sampsyo commented 8 years ago

OK, let's make this a feature request. Unfortunately, doing this will require pervasive changes to every place where beets accesses URLs---there are many such places if you include the plugins. In beets core, the main requests go through the https://github.com/alastair/python-musicbrainzngs library.

maxjoehnk commented 7 years ago

Have you tried setting the http_proxy (or https_proxy) environment variable? For me, beets is working fine with the proxy set in http_proxy.