Jellyfin Forum
SOLVED: Clearing desktop client cache? - Printable Version

+- Jellyfin Forum (https://forum.jellyfin.org)
+-- Forum: Support (https://forum.jellyfin.org/f-support)
+--- Forum: Troubleshooting (https://forum.jellyfin.org/f-troubleshooting)
+--- Thread: SOLVED: Clearing desktop client cache? (/t-solved-clearing-desktop-client-cache)



Clearing desktop client cache? - Manly Manlison - 2023-10-21

As stated above, I'd love to know if there is an easy way to have the cache be cleared on desktop clients.

I edit quite a few things on my JF server (design and different buttons, other logo and favicon etc) but it sometimes seems to make the window go blank when desktop clients are loaded into my JF server. I fixed it on my own PC by clearing the cache in "C:\Users\MyUsername\AppData\Local\Jellyfin Media Player\cache\QtWebEngine\Default\Cache" on windows. But then my friend started experiencing the same, and I had to remotely fix it for him the same way I did it since nobody is that tech savvy in my area. 

Now I'm a bit f-ed, because another friend on a Macbook now gets a grey screen, forcing her to use the browser to watch my content, which in turn makes the server transcode Slightly-frowning-face And I have no clue where the cache is on macOS or how to even access it. It would be nice if I could introduce some kind of auto cache clearing task, or even better, figure out why they get a blank screen when accessing my server after I edit the web contents.

Any tips/ideas how to resolve this? And does anyone know where the cache is located on macOS?


RE: Clearing desktop client cache? - Manly Manlison - 2023-10-21

For now I have just created a PowerShell script and converted it into an .exe and added a button in the jellyfin menu to download it. The script is just as simple as:
Code:
Set-Location "$($env:UserProfile)\AppData\Local\"
Remove-Item 'Jellyfin Media Player' -Recurse

This little script is actually so great for me because when I edit small stuff in the index.html file I normally can't see the changes on the desktop clients, and on chrome you usually have to ctrl+F5 to see the changes, but the script makes me able to see them!

I'm still trying to figure out how to do that on macOS and where the cache folder is located tho XD


RE: Clearing desktop client cache? - Manly Manlison - 2023-10-22

As for MacOS, I only had an early 2011 macbook pro lying around, which runs an OS version that jellyfin isn't supported on (needs MacOS 11.7 as a minimum), but with opencore legacy patcher to the rescue I got the newest OS installed and installed the client to continue my search for the cache folder.
With some luck I managed to find a folder similar to the Windows one - at ~/Libraries/Caches/'Jellyfin Media Player'

Running unsigned scripts and exe files on other computers is a new headache I've learned about these past days Grinning-face 
But on macOS I found the easiest way to do it was to make a file through AppleScript Editor and make my mac users press the play button to run the commands I needed to run.

Again, super simple code:
Code:
tell application "Terminal"
  do script "rm -rf ~/Library/Caches/'Jellyfin Media Player'"
  activate
end tell

.. but for some reason it didn't change anything for her after deleting the cache folder..  still a blank screen when she loads up Jellyfin Media Player..
Then I got reminded of this other thread where someone suggested putting the client in full screen - and lo and behold, such a fucking simple fix actually worked for her..! I guess the 6 hours it took wasn't wasted though, I'm a bit better on MacOS now Grinning-face

But the only problem now was that she was still running the old web version and not my newly edited one, so it seems I still have some digging to do to find the actual cache folder, since deleting the other one apparently didn't do the trick Confused-face


RE: Clearing desktop client cache? - Manly Manlison - 2023-10-23

I found the last piece of the puzzle and thought I'd share this to anyone else running into the same use case. I don't know if there will be an official feature of this in the future, so just in case I've made a redneck solution that my users can do to fix the weird cache issues they've sometimes had due to me changing up stuff in the web folder frequently - and hopefully their issues can be fixed with as little guidance as needed.

The approach I took to clear cache was:

Windows:
I made a powershell script that only removes the Jellyfin Media Player folder, by creating a new text file and then changing the extension from .txt to .ps1
Code:
Set-Location "$($env:UserProfile)\AppData\Local\"
Remove-Item 'Jellyfin Media Player' -Recurse

If you then run the below code in elevated PowerShell, you can turn your script into an .exe file
Code:
Install-Module ps2exe
Invoke-PS2EXE C:\location\of\script.ps1 C:\clearcache.exe

The .exe is going to be unsigned and from what I could understand, signing an app is locked behind a paywall which I didn't care much for Grinning-face  so you will be met with a warning when running the unsigned .exe
   
which kinda sucks but meh you press more info and run anyway and you're gucci Grinning-face

Mac:
Creating a script in Mac and moving it to another Mac quickly seemed impossibly hard to do, since the OS just blocks the file and forces the user to jump through a couple of hoops just to open the damn file. Too much of a hassle.. So I found out that you can pass the script through Applescript Editor which is built into the OS.

So we save the script as an unsigned script, which as default opens in the editor, making it more like a project file with the code already pasted in. 

Doing it this way, we basically have their computer think that their own user is the mastermind behind this script and runs the script with no security block/message.
They just have to press the play button:
   
and it passes the script on to Terminal

The code:
Code:
tell application "Terminal"
   do script "rm -rf ~/Library/Caches/'Jellyfin Media Player' ~/Library/'Application Support'/'Jellyfin Media Player'/QtWebEngine"
   activate
end tell

Initially I only thought I needed to delete the folder in  ~/Library/Caches/'Jellyfin Media Player'  but it didn't do the same thing as it did in Windows, as there's another web cache folder in  ~/Library/'Application Support'/'Jellyfin Media Player'/QtWebEngine" that I missed in my first try.
I don't know the difference between those two folders, but deleting them just makes Jellyfin Media Player recreate the folders and the items inside, so it shouldn't break anything if I just delete both Grinning-face


Now for it to be as user friendly as possible, I've done this:
I added a menu button for support:
   

And pressing it links into a basic html page where my users can easily download the proper clients as well as find the scripts I've made:
   

I'm not sure if I'm allowed to upload the finished .exe file and the .scpt file so just PM me if you want the files Smiling-face