jellyfin / jellyfin-roku

The Official Roku Client for Jellyfin
https://jellyfin.org
GNU General Public License v2.0
449 stars 137 forks source link

Can't connect to media libraries with new version 1.6.4 #1177

Closed holdswoa closed 1 year ago

holdswoa commented 1 year ago

Software Versions

Describe the bug

Jellyfin client has upgraded to 1.6.4. Since then, it will not connect to Jellyfin server. Reinstalling doesn't help. Incorrect user credentials cause an error, the correct credentials the client connects, but immediately returns to the Roku home screen. Server activity shows a connection, but the client just crashes. Sideloading previous version 1.6.2 and everything works correctly

How To Reproduce

  1. Upgrade (automatically) to client version 1.6.4
  2. Connect to Jellyfin server
  3. Bug occurs

Expected behavior

Expect to see Jellyfin media libraries

Logs

Screenshots

Connection Information

Additional context

cewert commented 1 year ago

👋 Hello and thank you for the bug report! I have a couple questions for you:

holdswoa commented 1 year ago

Hi @cewert

I couldn't find the binary for 1.6.3 originally, so this is why I reverted to 1.6.2. I have no cloned the repo, and when I sideload the 1.6.3 tag, it works fine. The 1.6.4 tag is broken when I sideload it. Here is the stack trace I get.

BRIGHTSCRIPT: ERROR: ParseJSON: Invalid number: pkg:/source/Main.brs(63)
BrightScript Micro Debugger.
Enter any BrightScript statement, debug commands, or HELP.
Suspending threads...
BRIGHTSCRIPT: ERROR: roUrlTransfer.GetToString: Sync-wait interrupted: pkg:/source/api/baserequest.brs(71)
Thread selected:  0*   pkg:/source/Main.brs(63)                if parseJSON(APIRequest("/System/Configuration/encoding").Ge
Current Function:
055:      sceneManager.currentUser = m.user.Name
056:      group = CreateHomeGroup()
057:      group.callFunc("loadLibraries")
058:      sceneManager.callFunc("pushScene", group)
059:  
060:      m.scene.observeField("exit", m.port)
061:  
062:      ' Downloads and stores a fallback font to tmp:/
063:*     if parseJSON(APIRequest("/System/Configuration/encoding").GetToString())["EnableFallbackFont"] = true
064:          re = CreateObject("roRegex", "Name.:.(.*?).,.Size", "s")
065:          filename = APIRequest("FallbackFont/Fonts").GetToString()
066:          filename = re.match(filename)
067:          if filename.count() > 0
Source Digest(s): 
pkg: dev 1.6.4 7dd35461 Jellyfin
Array operation attempted on variable not DIM'd. (runtime error &he7) in pkg:/source/Main.brs(63)
Backtrace:
#0  Function main(args As Dynamic) As Void
   file/line: pkg:/source/Main.brs(63)
Local Variables:
args             roAssociativeArray refcnt=2 count:4
global           Interface:ifGlobal
m                roAssociativeArray refcnt=2 count:6
appinfo          roAppInfo refcnt=1
runner           <uninitialized>
playstatetask    roSGNode:PlaystateTask refcnt=1
scenemanager     roSGNode:SceneManager refcnt=1
group            roSGNode:Home refcnt=1
re               <uninitialized>
filename         <uninitialized>
dialog           <uninitialized>
input            <uninitialized>
video            <uninitialized>
msg              <uninitialized>
reportingnode    <uninitialized>
itemnode         <uninitialized>
selecteditem     <uninitialized>
video_id         <uninitialized>
node             <uninitialized>
ptr              <uninitialized>
series           <uninitialized>
albums           <uninitialized>
selectedindex    <uninitialized>
screencontent    <uninitialized>
viewhandled      <uninitialized>
query            <uninitialized>
options          <uninitialized>
results          <uninitialized>
btn              <uninitialized>
audio_stream_idx <uninitialized>
mediasourceid    <uninitialized>
buttons          <uninitialized>
trailerdata      <uninitialized>
movie            <uninitialized>
button           <uninitialized>
panel            <uninitialized>
trackselected    <uninitialized>
info             <uninitialized>
retryvideo       <uninitialized>
event            <uninitialized>
currenttime      <uninitialized>
Threads:
ID    Location                                Source Code
 0*   pkg:/source/Main.brs(63)                if parseJSON(APIRequest("/System/Configuration/encoding").Ge
 1    pkg:/source/api/baserequest.brs(71)     data = req.GetToString()
  *selected
Brightscript Debugger> 
Can't continue
cewert commented 1 year ago

Perfect, thank you!

That line of code is trying to retrieve the Jellyfin server setting regarding Fallback Fonts. Do you have Fallback fonts enabled on your Jellyfin server (under Playback in the server settings)? and if so can you give more details about what font you are using?

If you don't use fallback fonts, you can safely delete that whole if statement as a workaround until we get this fixed.

1hitsong commented 1 year ago

if so can you give more details about what font you are using?

Especially the font's file size.

cewert commented 1 year ago

Well it's not just you having problems with that line of code. That line caused a total of 70 app crashes just on April 8th

fallbackfonts-error

holdswoa commented 1 year ago

@cewert / @1hitsong I didn't have fallback fonts enabled. I commented that block out and it works fine, so I guess the fix would be simple enough.

1hitsong commented 1 year ago

@cewert I think we can break that line apart and confirm isValid() in a few spots. We may want to start discussing a quick 1.6.5 to push some of these bug fixes live quickly.

cewert commented 1 year ago

@1hitsong I agree we're going to need a hotfix - this one is pretty bad and it should be easy to fix by using isValid() like you said.

1hitsong commented 1 year ago

@holdswoa The fallback font code block in main.brs the you commented out, can you try replacing it with the following code block and see if the client still works for you?


    configEncoding = api_API().system.getconfigurationbyname("encoding")
    if isValid(configEncoding) and isValid(configEncoding.EnableFallbackFont)
        if configEncoding.EnableFallbackFont
            re = CreateObject("roRegex", "Name.:.(.*?).,.Size", "s")
            filename = APIRequest("FallbackFont/Fonts").GetToString()
            if isValid(filename)
                filename = re.match(filename)
                if filename.count() > 0
                    filename = filename[1]
                    APIRequest("FallbackFont/Fonts/" + filename).gettofile("tmp:/font")
                end if
            end if
        end if
    end if
holdswoa commented 1 year ago

@1hitsong it works fine with your change. Cheers