Kodi Community Forum
Release OzWeather - Australian Weather Addon using BOM data inc. animated radar support - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: Add-on Support (https://forum.kodi.tv/forumdisplay.php?fid=27)
+---- Forum: Weather Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=155)
+---- Thread: Release OzWeather - Australian Weather Addon using BOM data inc. animated radar support (/showthread.php?tid=116905)



RE: OzWeather - Australian Weather Addon using BOM data inc. animated radar support - bossanova808 - 2021-07-14

Kodi dev has confirmed that when an addon updates it removes the entire folder, clearing out excess files (see https://forum.kodi.tv/showthread.php?tid=363562&pid=3049377#pid3049377) - so my best guess is something about the OSMC updates means the files are read only when you go to do the patch (probably because OSMC has done something to the skin files and not released them/changed the file perms/perhaps changed the mount paramaters?)

Definitely need a debug log or you could ask them what might be going on.


RE: OzWeather - Australian Weather Addon using BOM data inc. animated radar support - DavidFW1960 - 2021-07-14

Thanks for chasing that up. Ill ask them about it


RE: OzWeather - Australian Weather Addon using BOM data inc. animated radar support - DavidFW1960 - 2021-07-15

They say the skin file is being regularly updated but Kodi only clears that folder when Kodi itself is updated like 19.0 to 19.1. OSMC won't touch any file it didn't create itself. So when a skin file is updated, it leave the .original files there but overwrites the xml file and the patcher sees the .original files so it doesn't copy over the patched files.
I would think the patcher should be able to check the xml file for a keyword like ozweather in the xml file and if it is not found create a fresh .original file and copy over the patched xml files.


RE: OzWeather - Australian Weather Addon using BOM data inc. animated radar support - bossanova808 - 2021-07-15

They're wrong, in a sense, but you haven't actually asked them the right question. 

What we've confirmed it that Kodi clears the folder for the add-on on every add-on update.  Easy to test for yourself, as Ronie explicitly did...we're not talking about Kodi or OSMC updates here.  Add-on updates (skin updates) specifically.

I see in your OSMC thread:
What it does is it copies the relevant files and adds .original to the end of the file name and it uses that to determine if it needs to update the skin files again

You're not hearing me it seems.  If the .original files are already there, it just skips the backup bit (because it already has backups), and tries to do the patch anyway.  It does NOT use their presense to determine whether to run the patch again.  Only uses it to determine whether to back up again.  If you run the patcher and choose patch - it WILL try and patch.  Simple as that - the ball is entirely in your court.

Also:
updating Kodi should wipe out all files in the skin folder, (Estuary in this case)

No, what we are saying is that Skin updates will (and should) clear the folder, specifically. Later you say:

Ok so it’s problematic if the skin is updated but OSMC is leaving old files in the skin folder when it updates

No, it's not.  It's actually desirable behaviour, and sensible on their part, that they don't nuke other files.  Indeed it would be really bad if they did.

Again, all this is actually irrelevant.  You can completely ignore the issue of the .original files, unless and specifically only if the notification you are getting specifically starts with 'Exiting - as error when backing up....'.   Which you have not said.   It's all a furphy, based on your incorrect assumption that those .original files block the patch process - they do not, and it is not your issue.  See these two lines specifically - they prevent the backup process (and only the backup process) from being attempted, if the .original files are already there.  So those files being there is definitely NOT your issue...
https://github.com/bossanova808/repository.bossanova808/blob/c3aae7ae5749f8c308e34a6cd9195f2dcca366ea/staging/script.ozweather-skinpatcher/resources/lib/ozweather_skinpatcher.py#L107
https://github.com/bossanova808/repository.bossanova808/blob/c3aae7ae5749f8c308e34a6cd9195f2dcca366ea/staging/script.ozweather-skinpatcher/resources/lib/ozweather_skinpatcher.py#L117

The very simple patch process is just a series of file copies (with a bit of search and replace in those files before the copying)...and that is the bit that is apparently failing - so, ok - but there's simply no way for me to work out why it is failing without that debug log.  As they say, their update process does update skin files as part of it (and not using the Kodi mechanism for this clearly, or the .originals WOULD be cleared). Thus the most likely explanation at this stage is something about their update process make those skin files untouchable (probably until the next reboot) - by the patcher. 

It's all a complete guess though...all I know for sure is that the .original files remaining present is NOT the issue.  And the easy way to solve the issue is (well, should be) - grab the debug log when it fails.


RE: OzWeather - Australian Weather Addon using BOM data inc. animated radar support - DavidFW1960 - 2021-07-15

OK but the patched files are not being written to the xml folder and I can see that if I open the xml files in an editor. Let me check the logs and see if there are any clues otherwise I'll just have to wait till next time to see what happens.


RE: OzWeather - Australian Weather Addon using BOM data inc. animated radar support - bossanova808 - 2021-07-15

Yep I am quite willing to believe there is an issue with the patch itself failing, I am just trying to make clear what it not the cause....and it all comes down to catching it in the act at the time of the attempted copy.


RE: OzWeather - Australian Weather Addon using BOM data inc. animated radar support - DavidFW1960 - 2021-07-17

(2021-07-15, 03:17)bossanova808 Wrote: Yep I am quite willing to believe there is an issue with the patch itself failing, I am just trying to make clear what it not the cause....and it all comes down to catching it in the act at the time of the attempted copy.

Log here
https://paste.osmc.tv/uzomadaxik
Failed again


RE: OzWeather - Australian Weather Addon using BOM data inc. animated radar support - bossanova808 - 2021-07-17

Ok  so this the the relevant stuff from all that mess - https://pastebin.com/raw/uTGFdTEX   - From that, the patcher ran, and no errors were raised (you didn't see any errors, right?  By 'failed' you mean it just didn't result in changes...if you DID see an error...what was it?  Because it did not get raised by OzWeather, according to this log...).  i.e. Kodi and Python believe the copies were succesfully made (new backups were not as .original files present, but that did indeed not stop the patching as mentioned).  So (assuming you're 100% sure this is the 'failed' run) - I don't think it has failed at all, I think it did precisely what it should do.

e.g.
Code:

2021-07-17 09:38:53.396 T:3130 DEBUG <general>: ### OzWeather Skin Patcher 0.2.7 - Patching & copying /home/osmc/.kodi/addons/script.ozweather-skinpatcher/resources/skin-files/estuary/VideoFullScreen.xml to /usr/share/kodi/addons/skin.estuary/xml

Kodi is told to reload the skin:

Code:

2021-07-17 09:38:53.405 T:3130 DEBUG <general>: ### OzWeather Skin Patcher 0.2.7 - Reloading skin to pick up changes

So, that's exactly what happens on every other platform I have run it on (CoreElec many times, Windows (two separate machines) - many times, etc) - so, in fact, I think the issue might be this:

Code:

2021-07-17 09:38:53.411 T:2841 INFO <general>: Suppressing skin reload as the walkthrough is running

...no idea what that is (some sort of OSMC new version notification thing??) = but it's blocking the skin reload that would show the changes.  Without that, you'd have to reboot to see them.

So from that, the conclusion would have to be the patcher is running just fine, & succeeding, but OSMC is blocking the skin changes from becoming visible by blocking that reload.

If the skin changes are not present on the next reboot, then it's probably queuing up some changes for that reboot that over-write the patched skin (this is a wild guess).  But there is not reason to think the patcher is not working 100% really.  I can't really see a scenario where Kodi/Python think a file has copied when it hasn't done so successfully.  In 15 years of Python, that results in an exception 100% of times I've seen that...

Perhaps OSMC could be convinced to do a skin reload after the walkthrough (...perhaps only if it knows one was requested - it does know this, so should not be hard for them to store a flag then trigger a reload if the flag is set - and appropriate given Kodi has requested one...). 
Or you could e.g. bind a remote key to reload skin and manually do it after that walkthrough thing is finished.  It's actually a very handy remote button to have...well, for dev stuff anyway.


RE: OzWeather - Australian Weather Addon using BOM data inc. animated radar support - DavidFW1960 - 2021-07-17

Yeah the log shows everything is happy. The only problem is the xml files are still the skin unpatched ones. After an update, doesn't matter how many Tim's I patch the skin, the files in the xml directory are still the original unpatched files which I can confirm by opening them in a text editor that there is no OzWeather section.
The only way I can get the files to patch is by restoring from the patcher and then patching the skin again. Then it works perfectly.

So 'technically' it might be working from the log but it isn't doing anything.

I also restarted twice after enabling debug logging and before I ran the patcher and I do see the skin reloaded message... but the xml files are the untouched original ones not the ones the patcher should be copying over.

I have no idea what the walkthrough is. I ran the patcher immediately after enabling debug logging and restarting twice and then I used the OSMC app to upload the log files. So it was definitely the failed patching in the logs. Immediately after I disabled debug I then restored from the patcher and then patched again with the right result.


RE: OzWeather - Australian Weather Addon using BOM data inc. animated radar support - bossanova808 - 2021-07-17

You'll see the skin reloaded messages because I send the command...but I can't do anything about OSMC stopping it, and Kodi doesn't give a confirmation or anything.  But it works on all the other platforms, so...

In the end, you might just have to live with that workaround as your approach...not really a big deal to do it what way really, is it?   But it's some sort of OSMC weirdness for sure.  I could add a note to the wiki for the tiny few folks who still bother with OSMC.

The patcher _is_ working as far as Kodi/Python is concerned - there's no error on the write....so really, what could I possibly do to help here?? 

The only difference is that one operation (restore) is using a basic xbmcvfs.copy and the other (patching) is using xbmcvfs.write.  You could try changing around line 155 to:

Code:

file_to_write = config.xml_destination_folder + "/" + ntpath.basename(file)
log(f"Writing patched file to: {file_to_write}")
with xbmcvfs.File(file_to_write, 'w') as destination_file:
    result = destination_file.write(new_data)
    log(f"...done...result: {result}")

I guess that would log the result, at least, which might confirm the write is false, but it wouldn't tell us _why_ still.  Again, Python really always throws an exception on failed writes, so it's pretty reasonable to assume the write has succeeded at this point.

The other thing to do might be to manually check the file permissions...or do a search of the entire file system to see if the files are actually being written, but for some reason in the wrong spot....but honestly I just can't see why restoring them first works, that just makes no sense...and I can only care so much about an obscure bug on one particular offshoot platform when it works everywhere else just fine.

(....or just do yourself a favour and get an Odroid N2 with CoreElec - way faster than the Vero, and no weirdo bugs...)


RE: OzWeather - Australian Weather Addon using BOM data inc. animated radar support - Cinephile - 2021-07-17

Is the new version v19 only? As on my 18.7 install there is no update available and I'm stuck on 1.0.2

Cheers


RE: OzWeather - Australian Weather Addon using BOM data inc. animated radar support - bossanova808 - 2021-07-17

Yep, jsut for 19 - pretty much 100% re-write (to Python3) - even before the re-write to use the BOM API directly and skin patcher came along etc.

19 is great...time to make the jump....


RE: OzWeather - Australian Weather Addon using BOM data inc. animated radar support - Cinephile - 2021-07-17

(2021-07-17, 08:53)bossanova808 Wrote: 19 is great...time to make the jump....

But my add-ons! Wink

I will consider, many thanks.


RE: OzWeather - Australian Weather Addon using BOM data inc. animated radar support - bossanova808 - 2021-07-17

Well I'd say at this point anything that is likely to keep working in to the future is likely to be on 19 already...and many of those things probably work better as folks like me will have taken the chance to re-write and improve.


RE: OzWeather - Australian Weather Addon using BOM data inc. animated radar support - Cinephile - 2021-07-17

Fair enough, I only use a handful of add-ons anyway. Will do an audit and go from there.