Closed aditya12398 closed 4 years ago
Are you able to reach the internet from the command line on the machine you're trying this on? Do you need a proxy server to connect to the internet (e.g. in a corporate environment)?
What's the output from this command?
curl -v -o /dev/null https://ia803109.us.archive.org/33/items/mbid-f3c7e885-e459-43e5-865c-95c62a9781b9/mbid-f3c7e885-e459-43e5-865c-95c62a9781b9-19835076126.jpg
Yes, I am able to reach the internet from the command line. Yes, I do need proxy to connect to the internet, it is my university's proxy server. My proxy environment variables are set too.
The output for the above mentioned command is:
slimshady@Slim-Shady:~/Downloads$ curl -v -o /dev/null https://ia803109.us.archive.org/33/items/mbid-f3c7e885-e459-43e5-865c-95c62a9781b9/mbid-f3c7e885-e459-43e5-865c-95c62a9781b9-19835076126.jpg
* Trying 172.16.2.30...
* TCP_NODELAY set
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Connected to 172.16.2.30 (172.16.2.30) port 8080 (#0)
* allocate connect buffer!
* Establish HTTP proxy tunnel to ia803109.us.archive.org:443
> CONNECT ia803109.us.archive.org:443 HTTP/1.1
> Host: ia803109.us.archive.org:443
> User-Agent: curl/7.58.0
> Proxy-Connection: Keep-Alive
>
< HTTP/1.1 200 Connection Established
< Proxy-Agent: IWSS
< Date: Sun, 08 Dec 2019 14:31:02 GMT
<
* Proxy replied 200 to CONNECT request
* CONNECT phase completed!
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /etc/ssl/certs/ca-certificates.crt
CApath: /etc/ssl/certs
} [5 bytes data]
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
} [512 bytes data]
* CONNECT phase completed!
* CONNECT phase completed!
{ [5 bytes data]
* TLSv1.3 (IN), TLS handshake, Server hello (2):
{ [80 bytes data]
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* TLSv1.2 (IN), TLS handshake, Certificate (11):
{ [4773 bytes data]
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
{ [300 bytes data]
* TLSv1.2 (IN), TLS handshake, Server finished (14):
{ [4 bytes data]
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
} [37 bytes data]
* TLSv1.2 (OUT), TLS change cipher, Client hello (1):
} [1 bytes data]
* TLSv1.2 (OUT), TLS handshake, Finished (20):
} [16 bytes data]
* TLSv1.2 (IN), TLS handshake, Finished (20):
{ [16 bytes data]
* SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
* ALPN, server accepted to use http/1.1
* Server certificate:
* subject: OU=Domain Control Validated; CN=*.us.archive.org
* start date: Dec 19 20:41:01 2016 GMT
* expire date: Feb 21 22:56:17 2020 GMT
* subjectAltName: host "ia803109.us.archive.org" matched cert's "*.us.archive.org"
* issuer: C=US; ST=Arizona; L=Scottsdale; O=GoDaddy.com, Inc.; OU=http://certs.godaddy.com/repository/; CN=Go Daddy Secure Certificate Authority - G2
* SSL certificate verify ok.
} [5 bytes data]
> GET /33/items/mbid-f3c7e885-e459-43e5-865c-95c62a9781b9/mbid-f3c7e885-e459-43e5-865c-95c62a9781b9-19835076126.jpg HTTP/1.1
> Host: ia803109.us.archive.org
> User-Agent: curl/7.58.0
> Accept: */*
>
{ [5 bytes data]
< HTTP/1.1 200 OK
< Server: nginx/1.14.0 (Ubuntu)
< Date: Sun, 08 Dec 2019 14:30:51 GMT
< Content-Type: image/jpeg
< Content-Length: 2126299
< Last-Modified: Wed, 09 May 2018 15:27:53 GMT
< Connection: keep-alive
< ETag: "5af31379-2071db"
< Expires: Sun, 08 Dec 2019 20:30:51 GMT
< Cache-Control: max-age=21600
< Access-Control-Allow-Origin: *
< Accept-Ranges: bytes
<
{ [16027 bytes data]
100 2076k 100 2076k 0 0 375k 0 0:00:05 0:00:05 --:--:-- 457k
* Connection #0 to host 172.16.2.30 left intact
slimshady@Slim-Shady:~/Downloads$
Hmm; intriguing! It really does seem like this must have to do with the proxies. A few things come to mind:
self.merge_environment_settings
to ensure that the proxy stuff gets set up from the environment. Maybe we need to be doing that too, or find some way to avoid the manual steps we use.Yes I did try with an internet source without proxy, it worked. Here is what I have. I also thought it might be some specific setting of my own laptop so I tried to run it on my other pc too. It is the same error so I am thinking it has nothing to do with a specific system.
slimshady@Slim-Shady:~$ beet -vv fetchart Deadpool\ 2
user configuration: /home/slimshady/.config/beets/config.yaml
data directory: /home/slimshady/.config/beets
plugin paths: /home/slimshady/Apps/beets/plugins
Sending event: pluginload
library database: /home/slimshady/Apps/beets/musiclibrary.db
library directory: /home/slimshady/Music
Sending event: library_opened
fetchart: trying source filesystem for album Various Artists - Deadpool 2: Original Motion Picture Soundtrack
fetchart: trying source itunes for album Various Artists - Deadpool 2: Original Motion Picture Soundtrack
fetchart: getting URL: https://itunes.apple.com/search?term=Various+Artists+Deadpool+2%3A+Original+Motion+Picture+Soundtrack&entity=album&media=music&limit=200
fetchart: downloading image: https://is4-ssl.mzstatic.com/image/thumb/Music118/v4/1f/92/3c/1f923c51-9785-39dd-42ac-d8e92e37fe7c/source/1200x1200bb.jpg
fetchart: downloaded art to: /tmp/tmpoz64bk2_.jpg
fetchart: using remote image /tmp/tmpoz64bk2_.jpg
Sending event: art_set
embedart: Embedding album art into Various Artists - Deadpool 2: Original Motion Picture Soundtrack
embedart: embedding /home/slimshady/Music/Compilations/Deadpool 2_ Original Motion Picture Soundtrack/cover.jpg
Sending event: write
Sending event: after_write
Sending event: database_change
fetchart: Various Artists - Deadpool 2: Original Motion Picture Soundtrack: found album art
Sending event: cli_exit
What is the benefit of doing what you do over what has been done in their own version? Sorry I am unaware and am not good at python. I only use this package.
Shockingly, the whole reason for doing things in this non-standard way is so that we can easily log the requested URL before actually connecting to the server: https://github.com/beetbox/beets/blob/2e24887f539302f44e37dcf0119a8cb1f26a3150/beetsplug/fetchart.py#L170
This is really nice for transparency, but it requires this weird hack to get the fully-formed URL given the request parameters.
Anyway, it really seems like this is the culprit that's ignoring proxies! Seems like we need to do one of two things:
merge_environment_settings
call I mentioned above.Actually, the latter thing might be easy: I think we can do req.prepare()
even without creating an explicit Session
. Now accepting PRs! :smiley:
Hey, I don't want to be a nudge, but, is this issue resolved?
Implementation was started in https://github.com/beetbox/beets/pull/3453 but we need confirmation that it actually worked. :smiley:
Confirmation that it works on proxy? I can do that. Do I just have to update beets or have to build from source to check? Sorry for asking to be spoon-fed, I am new to this
Awesome!!
You'd need to install from source. There are instructions in an FAQ: https://beets.readthedocs.io/en/stable/faq.html#run-the-latest-source-version-of-beets
…and you'd need to clone the branch where the fix has been applied.
Hey! The fix seems to work. I am having similar problem with lastgenre though. Fetchart works fine with the fix. Can you merge it to the master branch?
@aditya12398 could you open a separate issue about the lastgenre problem, ideally with a log that shows the issue? This plugin does not use the requests
package (directly), so either this is an upstream issue with pylast
or our usage of it. In any case, someone more familiar with lastgenre will hopefully spot the new issue :)
Problem
I recently noticed that beet is not embedding album art in my music files as I import them if they are not available locally. So I ran
beet fetchart
command and tried running it in verbose mode for one of the failed albums.I think I should mention that I am using internet behind a proxy server, not sure if this has anything to do with the error but I am suspicious that its the proxy.
I first ran the import command in verbose mode which gave the following output:
Them running fetchart command in verbose (
-v
) mode:Gave the output as follows:
Setup
My configuration (output of
beet config
) is: