wxllow / applemusicrp

Discord Rich Presence for Apple Music w/ Album Artwork!
MIT License
67 stars 5 forks source link

Crashes on song title >128 characters #33

Open JadenAnjara opened 1 year ago

JadenAnjara commented 1 year ago

Hello, I've noticed the app sometimes crashing on certain musics. It has happened on some of the Apple Music Music Mix lists so I don't know if it's related to the musics not being in my library (but it doesn't seem to be the case as I'm listening to non library music without the app crashing) but that brings me to the second type of crash: titles. I don't know if it's the special character of the title ( called "¿") or the length of the album title Music to listen to~dance to~blaze to~pray to~feed to~sleep to~talk to~grind to~trip to~breathe to~help to~hurt to~scroll to~roll to~love to~hate to~learn Too~plot to~play to~be to~feel to~breed to~sweat to~dream to~hide to~live to~die to~GO TO but something in this music is definitely breaking the app (or Discord limitations maybe). I don't think it's the author as all the other Bring Me The Horizon songs seem to work fine

wxllow commented 1 year ago

Are you using Windows or macOS?

JadenAnjara commented 1 year ago

Using Windows 10, Build 19044

wxllow commented 1 year ago

I figured out the issue, the state has to be <128 characters. I will fix this as soon as I can :)

pypresence.exceptions.ServerError: Child "activity" fails because child "state" fails because "state" length must be less than or equal to 128 characters long
JadenAnjara commented 1 year ago

To be honest that's an edge case XD Nice figuring it out tho !

Ammar360 commented 1 year ago

Hi, absolutely love the work! Any updates on this bug?

Ammar360 commented 1 year ago
@@ -67,10 +67,10 @@ def get_rp(info, statuses):

    formatting_args = {
        "status": "Playing" if info[0] == "PLAYING" else "Paused",
        "state": info[0][:125] + "..." if len(info[0]) > 128 else info[0],
        "song": info[1][:125] + "..." if len(info[1]) > 128 else info[1],
        "artist": info[2][:125] + "..." if len(info[2]) > 128 else info[2],
        "album": info[3][:125] + "..." if len(info[3]) > 128 else info[3],
    }

    # Format arguments

I wonder if this code would help solve your code, and you could push out a new release? I tried to make my own pull and compile it but it was missing a lot of the necessary libraries

wxllow commented 1 year ago
@@ -67,10 +67,10 @@ def get_rp(info, statuses):

    formatting_args = {
        "status": "Playing" if info[0] == "PLAYING" else "Paused",
        "state": info[0][:125] + "..." if len(info[0]) > 128 else info[0],
        "song": info[1][:125] + "..." if len(info[1]) > 128 else info[1],
        "artist": info[2][:125] + "..." if len(info[2]) > 128 else info[2],
        "album": info[3][:125] + "..." if len(info[3]) > 128 else info[3],
    }

    # Format arguments

I wonder if this code would help solve your code, and you could push out a new release? I tried to make my own pull and compile it but it was missing a lot of the necessary libraries

hmm that probably would fix it!

Ammar360 commented 1 year ago

Awesome, let me know if that works! Looking forward to the next release because this bug is single-handedly driving me the most crazy lol.