Booplicate / MAS-Submods-YouTubeMusic

A submod for MAS which allows you to listen to music from youtube
9 stars 9 forks source link

Testing on Linux #3

Closed ghost closed 4 years ago

ghost commented 4 years ago

Hey there, I typically run linux and I would be willing and able to help with any testing and feedback. Thank you!

Booplicate commented 4 years ago

💹 I'll make a new branch for a Linux version. I'll let you know when it's up (might take a couple of days).

ghost commented 4 years ago

Awesome, thank you!

Booplicate commented 4 years ago

Okay, that's not good. Show the content of /Doki Doki Literature Club/lib/linux-x86_64/lib/python2.7 and /Doki Doki Literature Club/game/Submods

ghost commented 4 years ago

Ok, here is what is in each folder.

/game/Submods: Screenshot at 2020-05-17 10-17-26

/lib/linux-x86_64/lib/python2.7: Screenshot at 2020-05-17 10-21-11

Booplicate commented 4 years ago

Please, try again with this build. Like before, ask her to find music on YouTube (or give a direct link), short and long songs. YouTube.Music.SSL.TEST.2.zip If doesn't work, send mas_log.txt/traceback.txt again.

ghost commented 4 years ago

I think it gave me the same error as before, I tried a few different times. I've asked for artist name, name of song, and direct url:

Sun May 17 10:51:30 2020 Linux-5.4.0-29-generic-x86_64-with-debian-bullseye-sid Ren'Py 6.99.12.4.2187

VERSION: 0.11.2 [exp] OSError(2, 'No such file or directory') [exp] OSError(2, 'No such file or directory') [YTM ERROR]: Failed to request HTML data. Exception: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)> [YTM ERROR]: Failed to request HTML data. Exception: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)> [YTM ERROR]: Failed to request audio stream. Exception: ERROR: Unable to download webpage: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)> (caused by URLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)'),)) [YTM ERROR]: Failed to request HTML data. Exception: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)> [YTM ERROR]: Failed to request HTML data. Exception: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)>

Booplicate commented 4 years ago

Weird, it seems like the lib is working, but it can't find the certificates on your PC. Can you put this in your game directory and run the game once. That file should delete itself, but if it doesn't, you'll need do it manually. After that find the file called ssl_debug.txt in the game directory and send it here. This way we can be sure you have installed certfs. get_def_paths.zip

ghost commented 4 years ago

I put the get_def_paths file into /game and ran it once, it didn't seem to have generated a ssl_debug.txt file. I looked at the mas_log.txt to see what it said and it gave me this:

Sun May 17 13:13:15 2020 Linux-5.4.0-29-generic-x86_64-with-debian-bullseye-sid Ren'Py 6.99.12.4.2187

VERSION: 0.11.2 [exp] OSError(2, 'No such file or directory') [exp] OSError(2, 'No such file or directory') [exp] OSError(2, 'No such file or directory') [exp] OSError(2, 'No such file or directory')

Booplicate commented 4 years ago

It should be in the folder where you have DDLC.exe. Looks like the file can't delete itself, so you'll need to do it yourself after you're done.

ghost commented 4 years ago

Ah, found it! It was in my /home directory, I have enclosed it here. Thank you!

ssl_debug.txt

Booplicate commented 4 years ago

No idea why it put it there. When I run it, I see the file it the game dir.

Anyway, both cafile and capath are None. Which means it'll try to take it from the default paths. And I think it cannot find it there. Maybe I could distribute my cacert.pem, and use it in urlopen by passing in the context argument. But I'm not sure how to make some of the libs (e.g. Pafy) use it. Maybe with os.environ["SSL_CERT_FILE"]. I also did think about removing the dependency and making my own lightweight methods to fetch yt info. But it would take a lot of time compared to the current situation where I just import some libs and write 2 lines of code.

And can I be sure it'd be safe to do so anyway?

The ssl module does work, otherwise you'd get a traceback upon launching the game. The same module but for Windows works on my end. I was able to intentionally get the same error as you did (CERTIFICATE_VERIFY_FAILED) by passing in a modified context. That makes me think it has something to do with your system and certificates, rather than with the module. I'm not completely sure tho.

I can suggest to give this a try. It should give an idea to your system what to use.

ghost commented 4 years ago

I'm not sure why either, I was surprised to see it outside the game directory! I'm glad it gave you some info though - because you totally fixed it, and fast too! Search by song title & artist name work as expected, as well as entering the url directly. Songs play and repeats as expected. Play/pause button present and working in the music selection menu. I think it's good to go. Sweet!

Booplicate commented 4 years ago

That makes me even more concerned that it's your OS. Do you have another system where you could test?

Thing is I've never got a report from a Windows user about this error. If that's just your system, then it should be fixed outside of my submod. If that's a common thing for Linux not to include the certs in its distributions, then I could override it for all Linux users. But what about MacOS? Who knows lol.

Thanks for your time and efforts, though! Now I just need to think out that all.

ghost commented 4 years ago

Sure, I could test it on a Windows installation, if that might help? I'll use the most recent test file.

Booplicate commented 4 years ago

Oh no. I tested in on Windows myself. I mean maybe another version/distribution of Linux?

ghost commented 4 years ago

Ah ok no unfortunately I don't have a working spare right now, I just replaced my old drive actually. I can do more testing when I get a spare drive? Thank you for all the work you did to get this working, I really appreciate it. I'm not sure if the certs aren't included in the system in general, or if it is specific to mine, or if whatever is in the game file overrides/defines everything else?

Booplicate commented 4 years ago

It would be wonderful If you could make more test on another unix system. There's no rush, so when you're ready, just let me know. I'd do it myself, but I don't have space for it. And I don't know much about unix systems. So for now I'm putting it on hold until we get more info.

ghost commented 4 years ago

You got it, I'll let you know when I have a drive to play with.
Thank you!

multimokia commented 4 years ago

So what's interesting is. I ran this on my Ubuntu install and had a completely different thing happen.

While the submod itself still doesn't work. Not only is that def paths in the DDLC/ folder for me, but it actually HAS a path.

...But it's not on this computer.

Results of my ssl_debug.txt are:

Default paths:
DefaultVerifyPaths(cafile=None, capath=None, openssl_cafile_env='SSL_CERT_FILE', openssl_cafile='/home/tom/ab/x64lucid-deps/install/ssl/cert.pem', openssl_capath_env='SSL_CERT_DIR', openssl_capath='/home/tom/ab/x64lucid-deps/install/ssl/certs')

Do note, this is running right off the branch. So not using the second test zip. I will attempt that now. (Same result)

ghost commented 4 years ago

Oh wow you're right, I took a look at the ssl_debug.txt file and I believe it's the same - definitely not a location on this box. Older ssl test version of 2.2 is still working fine but new version 2.3 doesn't work.

Booplicate commented 4 years ago

We'll add the needed packages with the next release.

Older ssl test version of 2.2 is still working fine but new version 2.3 doesn't work.

This's funny because there's no way 2.2 works as for now - youtube killed it. You'll get the "couldn't find anything" kind of response from Monika. Hence 2.3 exists.

ghost commented 4 years ago

Huh you're right! I figured 2.2 was still working normally since it was working ok last time I asked her to play something for us and I haven't gotten any errors upon opening the game. No errors when it runs either, but now Monika can't find any music.

Thank you!

Booplicate commented 4 years ago

@d3adpan I have the build for the next release ready, I'd like you to run some test on Linux if you have time. ytm_test.zip

ghost commented 4 years ago

Hey there, sorry for the delay to get back to you. She gives me the normal dialogue right up until I select the song from the list - then after a brief pause, she tells me she's sorry and maybe she did something wrong, she can't play the song right now.

Booplicate commented 4 years ago

Thank you! Yeah, that happens to everyone now since YouTube made some more changes like yesterday or so. But it's the API problem. Sadly that means I still can't be sure that my code works on any platform.

ghost commented 4 years ago

Oh man YouTube has been a right pain. OK no worries, keep me posted, and thanks for the hard work!

ghost commented 4 years ago

Sweet thanks! Version 2.4 confirmed working on linux!
Ubuntu Release: 20.04.1 LTS (Focal Fossa) 64-bit Kernel: Linux 5.7.10-050710-generic x86_64

I tried playing a playlist but it just repeats the first song in the list - am I running into a limitation of linux?

Out of curiosity, is there a way to add the youtube music option to the music menu?

Sweet work man. Looking forward to using the update feature you've made available! Thanks again!

ghost commented 4 years ago

Sorry, wrong button

Booplicate commented 4 years ago

First at all, I'm happy that this submod is cross-platform now! Thanks to you and @multimokia!

I tried playing a playlist but it just repeats the first song in the list - am I running into a limitation of linux?

Playlists are not supported at all, it's surprising that you were able to play a song from a playlist. Handling playlists is a tricky task, I had some ideas before, but wasn't able to get it to work. Probably will work on it later.

Out of curiosity, is there a way to add the youtube music option to the music menu?

I'm not sure what you mean. But this issue is getting out of its scope. Can you open a new issue for it and explain that request in details, please?

ghost commented 4 years ago

Thanks for letting me know about the playlists, looking forward to seeing what comes next!