• 1
  • 144
  • 145
  • 146(current)
  • 147
  • 148
  • 197
[RELEASE] Texture Cache Maintenance utility
Hi @marcelveldt - I don't think so, as that's another dependency I'd rather not have, to be honest (plus your add-on would need to provide some sort of JSON interface - the texturecache.py script is not an add-on). The current omdbapi implementation is working fine (so long as OMDB is available) and with it I can probably access the omdb data much faster (using multiple threads, up to 20 is allowed/supported by omdbapi.com) than I could via Kodi which is running another script (and may be running on a low-end device, so much more work for the same end result).

Caching is a valid concern, and I hope people don't hammer omdbapi.com by using the imdb option on a too regular basis - I think running the imdb option once a week should be enough. I myself have it scheduled to run imdb on a Sunday, once for movies and then again for tvshows.
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
Hi @Milhouse,

I'm going to schedule weekly imdb fields update (votes, rating and top250) for movies and tvshows.

Can I use it like this:
Code:
pythonw texturecache.py imdb movies | python texturecache.py set

Code:
pythonw texturecache.py imdb tvshows | python texturecache.py set

As the output is piped to texturecache.py set I suppose i won't have problem with stout or sterr right?

Thanks
Image Image
Reply
@redglory should work yes.
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
(2017-02-22, 02:50)Milhouse Wrote: @redglory should work yes.

Milhouse, do you use Task Scheduler?

Can you share your command line parameters? I don't think texturecache.py set is working correctly.

I'm using:
Code:
cmd /C C:\Python27\python.exe texturecache.py imdb tvshows @logfile=logs/imdb_tvshows.log | c:\Python27\python.exe texturecache.py set @logfile=logs/imdb_tvshows_set.log

But the pipe ("|") isn't capturing anything from stdin (which supposely would be stout output from first command)

Thanks

EDIT: running the first command isn't returning anything? Maybe I got blocked from omdb.com? too much requests?
Image Image
Reply
No I use cron (I run texturecache.py on a Raspbian based Raspberry Pi).

Your command would work on Linux for sure, and I'd expect it to work on Windows too though I'm not sure about the various cmd switches - I'd probably put the commands into an imdb.cmd file and then schedule imdb.cmd.

Your log file should tell you what is happening, and if omdbapi.com is responding or not.

I just ran "texturecache.py imdb tvshows" here (UK) and it's currently working although I did see a number of "timeout" failures in the log which suggests the omdbapi.com service may not be back to normal just yet (perhaps the new server can't cope with the load).
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
I'm executing this on cmd:
Code:
python texturecache.py imdb tvshows

and always outputs []
Image Image
Reply
(2017-02-24, 00:42)redglory Wrote: I'm executing this on cmd:
Code:
python texturecache.py imdb tvshows

and always outputs []

That means one of 3 things: 1) you have no TV shows, 2) all your tv show/episodes are failing when querying omdbapi.com or 3) you have no episodes that need updating

You should see in the logfile when omdbapi.com queries fail to obtain a result. Assuming some omdbapi.com queries are succeeding (sorry, this isn't shown clearly in the log - you can only tell by the absence of a failure message) and you're not getting any "changes" (ie. "[]" is being output) then this would confirm that your current media library matches perfectly with omdbapi.com and nothing needs to be updated. I'm not sure how often omdbapi.com will update it's own database, it might only be once a day so running this script repeatedly is unlikely to be beneficial.

If you just want to test your code, you can manually change the votes for an episode so that re-runnig "imdb tvshows" should correct the change (assuming the episode is being found on omdbapi.com, of course):

Here's an example, using the show "Lucifer":
Code:
texturecache.py/texturecache.py imdb tvshows lucifer
[]

So no errors/failures - all episodes are being found on omdbapi.com - and nothing that needs updating.

View the votes for the tvshow:
Code:
texturecache.py Jd tvshows lucifer @extrajson.tvshows.episode=votes

This is my result: http://sprunge.us/UbhJ

Now pick an episode and make a note of the episodeid - in my case, the latest episode 2x13 has episodeid 20387 (with votes 412)

Change the number of votes to something other than its current value, for example 1:
Code:
texturecache.py set episode 20387 votes 1

And now re-run the imdb update:
Code:
texturecache.py/texturecache.py imdb tvshows lucifer
[
  {
    "episodetitle": "2x13. A Good Day to Die",
    "imdbnumber": "tt5668586",
    "items": {
      "votes": "412"
    },
    "libraryid": 20387,
    "title": "Lucifer",
    "type": "episode"
  }
]

You can do this repeatedly until you are happy with your code. If you still get no changes after changing the votes then please upload your logfile somewhere when running "imdb tvshows <tvshowname>"
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
(2017-02-20, 21:20)Milhouse Wrote: Hi @marcelveldt - I don't think so, as that's another dependency I'd rather not have, to be honest (plus your add-on would need to provide some sort of JSON interface - the texturecache.py script is not an add-on). The current omdbapi implementation is working fine (so long as OMDB is available) and with it I can probably access the omdb data much faster (using multiple threads, up to 20 is allowed/supported by omdbapi.com) than I could via Kodi which is running another script (and may be running on a low-end device, so much more work for the same end result).

Caching is a valid concern, and I hope people don't hammer omdbapi.com by using the imdb option on a too regular basis - I think running the imdb option once a week should be enough. I myself have it scheduled to run imdb on a Sunday, once for movies and then again for tvshows.

Ah, I see. Makes sense. I can provide you that json interface but like you said, a python service within Kodi will probably be much too slow for the purpose. Maybe indeed just inform users to not abuse the service for the sake of server capacity. OMDB info is refreshed no more than 14 days anyways.
Reply
@Milhouse,

I'll try with a single show/episode and report back Smile

Thanks

EDIT: Tested with Avatar and my Kodi library's votes are equal to OMDB but not the same as IMDB ?!

It seems OMDB isn't synced with IMDB.
Image Image
Reply
I'm having a weird problem.

I first tried to pipe imdb json results to texturecache.py set and I get:
Code:
λ python texturecache.py imdb movies | python texturecache.py set
Traceback (most recent call last):.
  File "texturecache.py", line 8585, in <module>
    main(sys.argv[1:])
  File "texturecache.py", line 8393, in main
    extraFields=_extraFields, query=_query, drop_items=_drop_items)
  File "texturecache.py", line 4645, in jsonQuery
    updateIMDb(mediatype, jcomms, data)
  File "texturecache.py", line 5894, in updateIMDb
    movies250 = MyUtility.Top250MovieList()
  File "texturecache.py", line 4060, in Top250MovieList
    html = urllib2.urlopen(URL)
  File "C:\Python27\lib\urllib2.py", line 154, in urlopen
    return opener.open(url, data, timeout)
  File "C:\Python27\lib\urllib2.py", line 435, in open
    response = meth(req, response)
  File "C:\Python27\lib\urllib2.py", line 548, in http_response
    'http', request, response, code, msg, hdrs)
  File "C:\Python27\lib\urllib2.py", line 467, in error
    result = self._call_chain(*args)
  File "C:\Python27\lib\urllib2.py", line 407, in _call_chain
    result = func(*args)
  File "C:\Python27\lib\urllib2.py", line 654, in http_error_302
    return self.parent.open(new, timeout=req.timeout)
  File "C:\Python27\lib\urllib2.py", line 429, in open
    response = self._open(req, data)
  File "C:\Python27\lib\urllib2.py", line 447, in _open
    '_open', req)
  File "C:\Python27\lib\urllib2.py", line 407, in _call_chain
    result = func(*args)
  File "C:\Python27\lib\urllib2.py", line 1241, in https_open
    context=self._context)
  File "C:\Python27\lib\urllib2.py", line 1198, in do_open
    raise URLError(err)
urllib2.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)>
Traceback (most recent call last):
  File "texturecache.py", line 8585, in <module>
    main(sys.argv[1:])
  File "texturecache.py", line 8494, in main
    setDetails_batch(dryRun=dryRun)
  File "texturecache.py", line 6201, in setDetails_batch
    jdata = json.loads("".join(data))
  File "C:\Python27\lib\json\__init__.py", line 339, in loads
    return _default_decoder.decode(s)
  File "C:\Python27\lib\json\decoder.py", line 364, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Python27\lib\json\decoder.py", line 382, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

But then tried to write to file and then read from it:
Code:
λ python texturecache.py imdb movies > imdb.dat
Code:
λ type imdb.dat | python texturecache.py set

And set worked as expected. Something wrong with pipe | ?!
Image Image
Reply
The error/failure is in the first call to "texturecache.py imdb movies".

In order to identify top 250 movies it retrieves top 250 results from http://top250.info/charts which redirects to https://top250.info/charts - not sure if it's always performed this http-to-https redirect, but it's doing now. Which isn't really a problem, except when the host fails to verify the certificate as happened in your case.

Seems like it might be an intermittent problem (no issues for me), possibly resulting from some sort of load balancing where one server could be misconfigured.

Keep trying and if it continues to be a problem we may need to disable certificate verification.
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
My script ran on sunday without any issue.

Maybe it was a temporary problem
Image Image
Reply
I'm trying to run texturecache remotely from ubuntu to an android tv box and can not get it to connect. And for the life of me, I can't figure out what I am doing wrong.

I've installed texturecache per the instructions. I've set the config file to the IP address of the box I have (and removed the # at the front of the line). Here is the output when I run it:

Code:
FATAL: The task you wish to perform requires read/write file
       access to the Kodi SQLite3 Texture Cache database.

       The following SQLite3 database could not be opened:
       /home/xubuntu/userdata/Database/Textures13.db

       Check settings in properties file texturecache.cfg,
       or upgrade your Kodi client to use a more recent
       version that supports Textures JSON API.

I turned on the log file too, and here is the output from it:

Code:
2017-03-04 14:15:25.251679:MainThread: Command line args: ['./texturecache.py', 'x']
2017-03-04 14:15:25.253254:MainThread: Current version #: v2.3.5
2017-03-04 14:15:25.253377:MainThread: Current platform : linux2
2017-03-04 14:15:25.253504:MainThread: Python  version #: v2.7.12.0 (final)
2017-03-04 14:15:25.255123:MainThread: libVersion.JSON SOCKET REQUEST: [{"jsonrpc": "2.0", "method": "JSONRPC.Version", "id": "libVersion"}]
2017-03-04 14:15:25.758214:MainThread: JSON Textures DB API not supported - will use SQLite to access the Textures DB


It's like texturecache isn't recognizing I told it to connect to a remote IP. But the cfg file is definitely set. I started thinking maybe there is a communication error between this ubuntu box and the android box. So via a webbrowser, I tested via a simple json web address message test:
Code:
http://ipofandroidtvbox:8080/jsonrpc?request={"jsonrpc":"2.0","method":"GUI.ShowNotification","params":{"title":"ATTENTION","message":"MESSAGEHERE"},"id":1}
I get back in the browser: {"id":1,"jsonrpc":"2.0","result":"OK"}
And ofcourse I get the message on tv. So I know communication is working.

I'm guessing this is something obvious I've done wrong, but I sure can't find it. Can someone point me in the right direction? Thanks!
Reply
Unfortunately you cut off your log just before it got interesting, when it would have shown the version of JSON API installed in your Android Kodi client - presumably it's not recent as it doesn't support the JSON TexturesDB API introduced with JSON 6.9.0 (added in Kodi 13 on 26 Oct 2013).

Without TexturesDB API support the script has to access your SQLite database directly, and in order to do that it needs access to the filesystem ether via a mount point, or running the script locally on the client (both of which will likely be problematic for Android, in which case upgrading the version of Kodi would be best).
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
That was all the log file had. I'm also running Kodi 16.1

Does this clarify?
Reply
  • 1
  • 144
  • 145
  • 146(current)
  • 147
  • 148
  • 197

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