• 1
  • 131
  • 132
  • 133(current)
  • 134
  • 135
  • 197
[RELEASE] Texture Cache Maintenance utility
Hi Guys

When I am trying to run this getting below error and appreciate some help....

Code:
osmc@GUESTpi:~$ ./texturecache.py c all
Traceback (most recent call last):
  File "./texturecache.py", line 8572, in <module>
    main(sys.argv[1:])
  File "./texturecache.py", line 8272, in main
    if not checkConfig(argv[0]): sys.exit(2)
  File "./texturecache.py", line 7812, in checkConfig
    data = wcomms.sendJSON(REQUEST, "libPing", checkResult=False, useWebServer=True)
  File "./texturecache.py", line 2203, in sendJSON
    return self.sendWeb("POST", "/jsonrpc", id, request, {"Content-Type": "application/json"}, timeout=timeout)
  File "./texturecache.py", line 2190, in sendWeb
    return json.loads(data) if data != "" else ""
  File "/usr/lib/python2.7/json/__init__.py", line 338, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python2.7/json/decoder.py", line 366, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python2.7/json/decoder.py", line 384, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
Reply
@sniferx1: texturecache.py is connecting to something that's not the Kodi webserver - add "webserver.port=xxxx" to texturecache.cfg (where xxxx is your Kodi webserver port). The default port that texturecache.py will use is 8080, so presumably your Kodi webserver is not using port 8080 (but something else is).
Texture Cache Maintenance Utility: Preload your texture cache for optimal UI performance. Remotely manage media libraries. Purge unused artwork to free up space. Find missing media. Configurable QA check to highlight metadata issues. Aid in diagnosis of library and cache related problems.
Reply
Many thanks Milhouse. That's explain why my other 2x RPI's working. I will do this for sure. I think the port on it is 80 and I will change it to 8080 or use the config. Thanks million for super quick reply.....
Reply
Thank you for your script and the help you provide.

Hopefully, you can help me out. While toying with artwork downloader, it downloaded logo.png, poster.jpg, banner.jpg and landscape.jpg into my movie folder. Problem is my movie folder has some folders with movies, but the rest are all in this single folder with exported artwork named like this: movie name-poster. The newer movies have no artwork in this folder and while browsing, kodi replaced the cached artwork like posters with the poster.jpg file, thus all movies with only cached posters had the one poster file.

I deleted the files, cleaned library, used your script to prune and to purge the files also. Now the movies have a blank poster as current art and I have no idea how to refresh only those movies to get the correct posters and logos, and doing so without writing poster.jpg etc. in the folder, but to let kodi export and name it through the interface.

Querying the MySQL db shows that the db still has the paths set to the now missing poster, banner.jpg etc. Even the older movies have the unused artwork like banners set to Movies/banner.jpg. Do I have to delete alle the entries in art with these exact paths?
Reply
@Risgah: You've discovered the hard way that Artwork Downloader doesn't support artwork with the movie-name prefix which is why it's recommended not to enable the "Use local artwork" setting (this is mentioned throughout the AD thread) if you have multiple movies per folder. Unfortunately using AD in this way has hosed your library by associating multiple movies with useless artwork of the same name. Now that you've deleted this artwork you're left with multiple movies associated with non-existing local artwork.

To fix this you can use mklocal.py to remove the artwork associations from your MyVideos library that no longer exist in your local filesystem by using the "--readonly --nokeep" options.

Once you've removed the non-existent artwork associations you should use Artwork Download again, but this time with "Use local artwork" DISABLED. Now any missing artwork for movies will be associated with links to remote artwork. You can leave you library like that, using remote artwork (which may disappear at some point), but instead I would recommend you use mklocal.py again (this time without --readonly) to download the new remote artwork and create new image files using movie-name prefix filenames alongside your movies, then associate your movies with these new local artwork files (which you can then cache etc.).

Using mklocal.py to download remote artwork alongside your movies is superior to exporting artwork from your library, as the library export will export only the cached (and thus lower quality) artwork and not the original high-quality artwork which is what mklocal.py will download.
Texture Cache Maintenance Utility: Preload your texture cache for optimal UI performance. Remotely manage media libraries. Purge unused artwork to free up space. Find missing media. Configurable QA check to highlight metadata issues. Aid in diagnosis of library and cache related problems.
Reply
Yeah, I used AD for years without any problems until now Smile.

Being on Win7 with a smb share I tried the following:

Code:
C:\path\to\python\python.exe C:\path\to\texturecache\texturecache.py jd movies | C:\path\to\tools\mklocal.py --local /Nas/Disk1/Movies --prefix smb://192.168.1.10/Disk1/Movies --readonly --nokeep --output changes.dat

But I always get:

Traceback (most recent call last):
File "C:\...\texturecache\texturecache.py", line 8572, in <module>
main(sys.argv[1:])
File "C:\...\texturecache\texturecache.py", line 8380, in main
extraFields=_extraFields, query=_query, drop_items=_drop_items)
File "C:\...\texturecache\texturecache.py", line 4627, in jsonQuery
jcomms.dumpJSON(data, decode, ensure_ascii)
File "C:\...\texturecache\texturecache.py", line 2853, in dumpJSON
self.logger.out(json.dumps(data, indent=2, ensure_ascii=ensure_ascii, sort_keys=True), newLine=True)
File "C:\...\texturecache\texturecache.py", line 977, in out
sys.stdout.write("%-s%s" % (udata, NL))
File "codecs.py", line 377, in write
OSError: [Errno 22] Invalid argument

Also happens with most other variations of --local I tried, like mapped to drive Z.

Also, is there a dry run command for this?
Reply
(2016-08-03, 22:53)Risgah Wrote: But I always get:

You may need "C:\path\to\python\python.exe" on the right hand side of the pipe too. I'd suggest configuring your Windows system so it has python.exe on the PATH then you can probably drop "C:\path\to\python\python.exe" when running a python script.

(2016-08-03, 22:53)Risgah Wrote: Also, is there a dry run command for this?

That would be the "--dryrun" option.
Texture Cache Maintenance Utility: Preload your texture cache for optimal UI performance. Remotely manage media libraries. Purge unused artwork to free up space. Find missing media. Configurable QA check to highlight metadata issues. Aid in diagnosis of library and cache related problems.
Reply
Still not working. There isn't even an error message in the debug log or any mention of . The command:

Code:
python texturecache.py jd movies | python tools\mklocal.py --local Nas/Disk1/Movies --prefix smb://192.168.1.10/Disk1/Movies --readonly --nokeep --dryrun --output changes.dat

just parses the library and outputs all the "skipping bad prefix" messages about the movie files (but not the artwork files) on another disk (Disk2/Movies2) - the movies in Disk1/movies are not in there, so the prefix matches their path, correct? But nothing else happens, no output in the changes.dat file.
Reply
(2016-08-04, 13:31)Risgah Wrote: just parses the library and outputs all the "skipping bad prefix" messages about the movie files (but not the artwork files) on another disk (Disk2/Movies2) - the movies in Disk1/movies are not in there, so the prefix matches their path, correct? But nothing else happens, no output in the changes.dat file.

The mklocal.py script really only expects one root (prefix) that matches your entire library, but you've used a prefix which is specific to a subset of your movies, so the non-matching movies are ignored with "bad prefix" messages.

Try using "--local Nas/ --prefix smb://192.168.1.10:/" instead of "--local Nas/Disk1/Movies --prefix smb://192.168.1.10:/Disk1/Movies".

If you want to see what the script is doing, enable the debug option "--verbose".

Once the script has finished running, check what is in the changes.dat file - it should be a list of changes that will set artwork for various movies to a blank value, ie. nothing, which will remove the artwork from the media library. If you're happy with the changes, apply it to your media library with "type changes.dat | python texturecache.py set"
Texture Cache Maintenance Utility: Preload your texture cache for optimal UI performance. Remotely manage media libraries. Purge unused artwork to free up space. Find missing media. Configurable QA check to highlight metadata issues. Aid in diagnosis of library and cache related problems.
Reply
Not one command I ever tried wrote anything into the changes.dat file.

(2016-08-04, 16:03)Milhouse Wrote: Try using "--local Nas/ --prefix smb://192.168.1.10:/" instead of "--local Nas/Disk1/Movies --prefix smb://192.168.1.10:/Disk1/Movies".

If you want to see what the script is doing, enable the debug option "--verbose".

Once the script has finished running, check what is in the changes.dat file - it should be a list of changes that will set artwork for various movies to a blank value, ie. nothing, which will remove the artwork from the media library. If you're happy with the changes, apply it to your media library with "type changes.dat | python texturecache.py set"

The only output in the cmd window after your command is:
Progress: 'number of movies' of 'number of movies'

With --verbose there are these lines for every movie
##DEBUG## mediatype [movie]; mediatitle [movie name]
##DEBUG## mediafile is [smb://192.168.1.10/Disk1/Movies/filename.avi]
##DEBUG## local root name would be [Nas\Disk1\Movies\filename.avi]

Edit:

Ah, I did not add or specify any --artwork. Now it did populate the dat.file. I always thought without --artwork mklocal.py would do it all.
Reply
I can't help you if that's all you give me. Paste more of the console text (without you mangling it) to pastebin.com and provide a link, or you'll have to find another solution.

I will just say that "Nas" (your --local parameter) doesn't look like a particularly usable Windows path - on a Windows machine I'd expect it to be something you've mapped such as "X:\" (which maps to \\NAS\) or a UNC such as "\\NAS\".
Texture Cache Maintenance Utility: Preload your texture cache for optimal UI performance. Remotely manage media libraries. Purge unused artwork to free up space. Find missing media. Configurable QA check to highlight metadata issues. Aid in diagnosis of library and cache related problems.
Reply
Did now use --artwork, see edit above Smile.

And now getting this for --artwork poster, is this correct?
##DEBUG## [poster ] Assigning null value to library item

In changes.dat these:
{
"items": {
"art.poster": null
},
"libraryid": 3623,
"title": "'71",
"type": "movie"
},

Is this how it should be?

Quote:I will just say that "Nas" (your --local parameter) doesn't look like a particularly usable Windows path - on a Windows machine I'd expect it to be something you've mapped such as "X:\" (which maps to \\NAS\) or a UNC such as "\\NAS\".

The path is C:\Nas now with the results above, but I have not mapped anything. Does it have to map back to the share on the Nas or can it be just a local folder on the Windows machine?
Reply
(2016-08-04, 17:47)Risgah Wrote: And now getting this for --artwork poster, is this correct?

It looks OK, is that one of the movies that needed fixing? The extract you posted will set the poster for that movie to null, ie. remove the artwork association.

Nothing will actually happen until you run that file through "texturecache.py set".

(2016-08-04, 17:47)Risgah Wrote: The path is C:\Nas now with the results above, but I have not mapped anything.

If "C:\Nas" is where you movies are located, then that's what "--local" needs to be.

(2016-08-04, 17:47)Risgah Wrote: Does it have to map back to the share on the Nas or can it be just a local folder on the Windows machine?

It has to be wherever you movies and artwork are located, it can't just be any directory. If you can't access your movies through "C:\Nas" then it's not the path you should be using.
Texture Cache Maintenance Utility: Preload your texture cache for optimal UI performance. Remotely manage media libraries. Purge unused artwork to free up space. Find missing media. Configurable QA check to highlight metadata issues. Aid in diagnosis of library and cache related problems.
Reply
It worked! Thank you for your help.

As I said above, not using --artwork to specify was the culprit along with the unmapped local path. After I posted the command and you didn't say anything about the --artwork missing, I figured it was not necessary Smile.

It did delete all the old associations and Artwork Downloader did refresh the missing ones. Your script is really awesome, and I hope someday Kodi can handle the caching a bit better. Seems a lot of people have trouble with the whole caching of thumbnails, albeit some through false use Wink.
Reply
(2016-08-04, 19:19)Risgah Wrote: As I said above, not using --artwork to specify was the culprit along with the unmapped local path. After I posted the command and you didn't say anything about the --artwork missing, I figured it was not necessary Smile.

Yes, it needs the "--artwork" parameter, and it's in the original post I linked. The script will only "process" the artwork you tell it to process, regardless of what artwork mklocal.py is "fed" from texturecache.py, so if you only want your posters processed then specify "--artwork poster" and only your posters will be removed/downloaded/whatever, even if your media library includes fanart, banners etc. (these artwork items will just be ignored).
Texture Cache Maintenance Utility: Preload your texture cache for optimal UI performance. Remotely manage media libraries. Purge unused artwork to free up space. Find missing media. Configurable QA check to highlight metadata issues. Aid in diagnosis of library and cache related problems.
Reply
  • 1
  • 131
  • 132
  • 133(current)
  • 134
  • 135
  • 197

Logout Mark Read Team Forum Stats Members Help
[RELEASE] Texture Cache Maintenance utility17