MilhouseVH / texturecache.py

Utility script to manage the XBMC texture cache
http://forum.xbmc.org/showthread.php?tid=158373
GNU General Public License v2.0
179 stars 32 forks source link

python3.12 update needed #75

Open graysky2 opened 1 month ago

graysky2 commented 1 month ago

It seems that python3.12 breaks this script. Any change to update it?


% texturecache vclean
/usr/bin/texturecache:108: SyntaxWarning: invalid escape sequence '\.'
  serial_urls = "assets\.fanart\.tv"
/usr/bin/texturecache:359: SyntaxWarning: invalid escape sequence '\^'
  self.CACHE_IGNORE_TYPES[index] = re.compile(re.sub("^\^image://", "^", r.pattern))
/usr/bin/texturecache:361: SyntaxWarning: invalid escape sequence '\^'
  self.PRUNE_RETAIN_TYPES[index] = re.compile(re.sub("^\^image://", "^", r.pattern))
/usr/bin/texturecache:1286: SyntaxWarning: invalid escape sequence '\('
  title = re.sub("\(%d\)$" % year, "", title).strip()
/usr/bin/texturecache:2095: SyntaxWarning: invalid escape sequence '\.'
  self.web_re_result = re.compile("^.*:(%s)[ ]*: .*\.RECEIVED WEB DATA: ([0-9]*), (.*), (.*)$" % tpattern)
/usr/bin/texturecache:2096: SyntaxWarning: invalid escape sequence '\.'
  self.json_re_result = re.compile("^.*:(%s)[ ]*: .*\.PARSING JSON DATA: (.*)$" % tpattern)
/usr/bin/texturecache:3953: SyntaxWarning: invalid escape sequence '\.'
  RE_STACKING_1_9 = re.compile("(.*?)([ _.-]*(?:cd|dvd|p(?:ar)?t|dis[ck])[ _.-]*[0-9]+)(.*?)(\.[^.]+)$", flags=re.IGNORECASE)
/usr/bin/texturecache:3954: SyntaxWarning: invalid escape sequence '\.'
  RE_STACKING_A_D = re.compile("(.*?)([ _.-]*(?:cd|dvd|p(?:ar)?t|dis[ck])[ _.-]*[a-d])(.*?)(\.[^.]+)$", flags=re.IGNORECASE)
/usr/bin/texturecache:4136: SyntaxWarning: invalid escape sequence '\?'
  RE_IMDB = re.compile("/movie/\?([0-9]*)")
/usr/bin/texturecache:5111: SyntaxWarning: invalid escape sequence '\.'
  episode = re.sub("([0-9]*x[0-9]*)\..*", "\\1", title)
/usr/bin/texturecache:5246: SyntaxWarning: invalid escape sequence '\.'
  episode = re.sub("([0-9]*x[0-9]*)\..*", "\\1", title)
/usr/bin/texturecache:5477: SyntaxWarning: invalid escape sequence '\.'
  episode = re.sub("([0-9]*x[0-9]*)\..*", "\\1", title)
/usr/bin/texturecache:5536: SyntaxWarning: invalid escape sequence '\.'
  episode = re.sub("([0-9]*x[0-9]*)\..*", "\\1", title)
/usr/bin/texturecache:5762: SyntaxWarning: invalid escape sequence '\.'
  episode_year = re.sub("([0-9]*x[0-9]*)\..*", "\\1", title)
/usr/bin/texturecache:5813: SyntaxWarning: invalid escape sequence '\.'
  episode_year = re.sub("([0-9]*x[0-9]*)\..*", "\\1", title)
/usr/bin/texturecache:5984: SyntaxWarning: invalid escape sequence '\.'
  SxE = re.sub("[0-9]*x([0-9]*)\..*", "\\1", episode["label"])
/usr/bin/texturecache:6038: SyntaxWarning: invalid escape sequence '\('
  re_parenthesis = re.compile("\([a-zA-Z]*\)$")
/usr/bin/texturecache:6098: SyntaxWarning: invalid escape sequence '\('
  tvshow["title"] = re.sub("\(%d\)$" % tvshow["tc.year"], "", tvshow["title"]).strip()
/usr/bin/texturecache:6793: SyntaxWarning: invalid escape sequence '\.'
  mediatype = re.sub(".*\.Get(.*)","\\1",r["method"])
/usr/bin/texturecache:7066: SyntaxWarning: invalid escape sequence '\.'
  mediatype = re.sub(".*\.Get(.*)","\\1",r["method"])
/usr/bin/texturecache:3942: DeprecationWarning: datetime.datetime.utcfromtimestamp() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.fromtimestamp(timestamp, datetime.UTC).
  EPOCH = datetime.datetime.utcfromtimestamp(0)
Rescanning library...
rainman74 commented 1 month ago

It seems that python3.12 breaks this script. Any change to update it?

No!

Just use this: https://forum.kodi.tv/showthread.php?tid=158373&pid=3184117#pid3184117

graysky2 commented 1 month ago

@rainman74 - I am on linux

graysky2 commented 1 month ago

I do not code in python but I can use chatgpt. This modification seems to fix the vclean and vscan functions but it breaks the P function with seems to go on forever. Someone with more knowledge needs to help...

https://github.com/graysky2/texturecache.py/commit/4a206765af7939600473b8af3ac0787261922df9

rainman74 commented 1 month ago

@rainman74 - I am on linux

There are also Python wrappers for linux ;-)

Or you can use both versions at the same time, which is no problem at all with Linux. https://askubuntu.com/questions/350751/install-and-run-python-3-at-the-same-time-than-python-2

graysky2 commented 1 month ago

I'd rather fix the code

rainman74 commented 1 month ago

I'd rather fix the code

Good luck with your project then.

Langelus commented 4 weeks ago

Faced the same problem and while it would be lovely if the script got updated you could still possibly install Python 3.11 alongside the newer versions. I ran the script successfully on Ubuntu 24.04 with Deadsnakes build of Python 3.11

sudo add-apt-repository ppa:deadsnakes/ppa sudo apt update sudo apt install python3.11