Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python method xbmc.getCacheThumbName deprecated/broken #22288

Open
1 of 7 tasks
scott967 opened this issue Dec 19, 2022 · 2 comments
Open
1 of 7 tasks

Python method xbmc.getCacheThumbName deprecated/broken #22288

scott967 opened this issue Dec 19, 2022 · 2 comments

Comments

@scott967
Copy link
Contributor

Bug report

Describe the bug

Here is a clear and concise description of what the problem is:

A call to xbmc.getCacheThumbName returns unusable result. An inspection of code shows:

String getCacheThumbName(const String& path)
{
XBMC_TRACE;
auto crc = Crc32::ComputeFromLowerCase(path);
return StringUtils::Format("{:08x}.tbn", crc);
}

which seems to be old code. Seems to have last been touched in 2016 #10107

In doing some searches, have seen various dev/support threads on this; don't think it works and the most useful solution is work around of using JSON-RPC instead.

Expected Behavior

Here is a clear and concise description of what was expected to happen:

When calling xbmc.getCacheThumbName with a video or audio thumb -- image://video@path/filename/ as obtained from the videodb should get a valid subfolder/filename from the Thumbnails folder.

Example: library has movie C:\Test movie\Easter Parade\Easter Parade (1948).mkv
Kodi generates thumbnail and videodb and updates art table image://video@C%3a%5cTest%20movie%5cEaster%20Parade%5cEaster%20Parade%20(1948).mkv/

texturesdb texture table for that url has cachedurl of 6/6c841ad1.jpg and that cached image does exist.

xbmc.getCacheThumbName returns 27ef574a.tbn which is consistent with the code.

Actual Behavior

An invalid image path/filename is returned 27ef574a.tbn It appears the intent of the method is just to compute a hash; not get the actual cached filename from Thumbnails. I tried various permutations on the url (deleting "image://" , trailing "/", etc but couldn't get the right cache filename (disregarding the old .tbn extension)
Reviewing TextureCache.cpp, I wasn't able to figure out the correct way to compute the cache filename.

Possible Fix

To Reproduce

Steps to reproduce the behavior:

  1. get a video thumb from the videodb
  2. in python, pass the result as arg to xbmc.getCacheThumbName
  3. log the return from function

Debuglog

The debuglog can be found here:
https://paste.kodi.tv/dukazavasi.kodi

Screenshots

Here are some links or screenshots to help explain the problem:

Additional context or screenshots (if appropriate)

Here is some additional context or explanation that might help:

Your Environment

Used Operating system:

  • Android

  • iOS

  • tvOS

  • Linux

  • macOS

  • Windows

  • Windows UWP

  • Operating system version/name: Win 10 x64

  • Kodi version: 20 RC1 win x64

note: Once the issue is made we require you to update it with new information or Kodi versions should that be required.
Team Kodi will consider your problem report however, we will not make any promises the problem will be solved.

@scott967
Copy link
Contributor Author

scott967 commented Dec 19, 2022

After additional testing it appears that the right way to call xbmc.getCacheThumbName is to use the raw uri and not decode or otherwise clean it up, so format like:
image://video@C%3a%5cTest%20movie%5cThe%20Admiral%20Roaring%20Currents%20(2004)%5cThe%20Admiral%20Roaring%20Currents%20(2004).mkv/

will generate a good filename, but the .tbn extension should be changed to .jpg I think. Suggest also the doxygen documentation provide some more clarity as to the argument format.

@sarbes
Copy link
Member

sarbes commented Dec 19, 2022

I would like to reserve the right to have other (GPU specific) formats in the future.

If someone would change this, please consider not hard coding the file extension.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants