Release plugin.video.themoviedb.helper - Access to TheMovieDb API for Skinners
#83
(2019-08-10, 06:20)jurialmunkey Wrote: @bsoriano
I've just added a few script functions that assist managing windows and plugin paths when overriding <onclick> actions.

Adding a Path to the History
Code:
<onclick>RunScript(plugin.video.themoviedb.helper,add_path=$INFO[ListItem.FolderPath],call_id=1134)</onclick>

This command will add the path to a window property:
Code:
$INFO[Window(Home).Property(TMDbHelper.Path.Current)]

Then it will open the call_id window:
Code:
ActivateWindow(1134)

This will allow you to create a custom window with ID=1140 to act as a custom info dialog.
In the window, add a hidden list to be the detailed item:
Code:
<content>$INFO[Window(Home).Property(TMDbHelper.Path.Current)]</content>

The important part is that the add_path command stores each path in a breadcrumb history which can then be walked back through.

Returning to a previous path
To return to a previous path, you use the "del_path" command to delete the current path and replace it with the previously added path
Code:
RunScript(plugin.video.themoviedb.helper,del_path)

Now TMDbHelper.Path.Current will be the path added before the last one.
Each del_path command will step one back into the path history.

You can use this in the <onunload> of your custom window so that hitting back will set the path back to the previous one.
Code:
<onunload>RunScript(plugin.video.themoviedb.helper,del_path)</onunload>


Preventing the path from being deleted
However, there is a problem: if you just added a path, then a new window will activate and the current window unloading will delete the path you just added. To prevent this from happening, you can add "prevent_del" to the "add_path" command:
Code:
<onclick>RunScript(plugin.video.themoviedb.helper,prevent_del,add_path=$INFO[ListItem.FolderPath],call_id=1140)</onclick>

This command will add a "lock" to the added path.
If the lock is on, then the next del_path command will delete the lock rather than the path.

This means that when you add the path, the onunload command is effectively prevented from deleting the path (it only deletes the lock).
However, if you press "Back" then the onunload command will instead delete the path allowing you to go back to the previous one.


Resetting the paths
Code:
RunScript(plugin.video.themoviedb.helper,reset_path)
This command will delete all the history.

@jurialmunkey, this is great, thank you! I will try these new functions! Now I can do everything within your plugin. Thanks again.

Regards,

Bart
Reply


Messages In This Thread
RE: TheMovieDB Helper - by jurialmunkey - 2019-07-31, 11:47
RE: plugin.video.themoviedb.helper - Access to TheMovieDb API for Skinners - by bsoriano - 2019-08-10, 14:38
Logout Mark Read Team Forum Stats Members Help
plugin.video.themoviedb.helper - Access to TheMovieDb API for Skinners2