Closed Pawe98 closed 5 years ago
@wackerl91
I would like to add a button to luna to close a session. Can you give me little guidance on how I could do this? Which are the files I need to edit? I would just run a script from there terminating the session. The script doesn't need parameters, I just don't know wich files and generally how kodi adons work to do this. Your help is very appreciated :)
Grüße aus Stuttgart
@Pawe98 What's your goal here? Closing a hanging session? I'm honestly kind of confused, because you won't be able to close a running session (as Luna isn't running at that time) and most failed sessions should get closed automatically.
Either way, there are multiple files involved when adding new functionality:
/resources/skins/Default/720p/
, essentially defining the layoutresources/lib/controller/
resources/lib/config/routing.yml
) when routing to another controller and / or adding a new oneresources/lib/views/
Have a look at e.g. how the "Add Host" button is added to the view and when it's selected calls the main_add_host
action, where this string is essentially the prefix for the main controller defined in routing.yaml
plus the action to call (add_host
, which exists as a function in maincontroller.py
which again is decorated with @route(name='add_host')
).
An example of how you can run scripts instead of a displaying a view can be found in gamelistcontroller.py
(which essentially just calls the moonlight launch helper and tells it to launch a game. If you want to go back to the previous view, you will need to run your script -if possible, display a confirmation to the user e.g. using a banner like it's done for errors etc. - and render the previous view again, e.g. the main menu or the game list). One thing to note here is that cancelling a session is a host-based action, so it should probably be part of the host context menu (as it makes sense there) and you need to pass the paths to the key files / dirs.
Last thing I want to mention is that Luna isn't exactly your standard Kodi addon - there's a lot of magic involved in lots of different places which make the architecture pretty tidy, but can also be intimidating when diving in. Just try to figure out how specific functionalities have been added in the past and you'll be fine :) It's just that Kodi addon tutorials won't help you much (if at all).
If you need any more detailed guidance (or you'd rather discuss this in german) feel free to send me an email (address is on my github profile).
Cheers!
Ok ill give it a try I haven't used python before. Thanks for the detailed advice : )
Am Mo., 18. Feb. 2019, 19:06 hat Ludwig Wacker notifications@github.com geschrieben:
@Pawe98 https://github.com/Pawe98 What's your goal here? Closing a hanging session? I'm honestly kind of confused, because you won't be able to close a running session (as Luna isn't running at that time) and most failed sessions should get closed automatically.
Either way, there are multiple files involved when adding new functionality:
- the XML files in /resources/skins/Default/720p/, essentially defining the layout
- controllers for each view, which can be found in resources/lib/controller/
- potentially the routing information (resources/lib/config/routing.yml) when routing to another controller and / or adding a new one
- the view definitions in resources/lib/views/
Have a look at e.g. how the "Add Host" button is added to the view and when it's selected calls the main_add_host action, where this string is essentially the prefix for the main controller defined in routing.yaml plus the action to call (add_host, which exists as a function in maincontroller.py which again is decorated with @route(name='add_host')).
An example of how you can run scripts instead of a displaying a view can be found in gamelistcontroller.py (which essentially just calls the moonlight launch helper and tells it to launch a game. If you want to go back to the previous view, you will need to run your script -if possible, display a confirmation to the user e.g. using a banner like it's done for errors etc. - and render the previous view again, e.g. the main menu or the game list). One thing to note here is that cancelling a session is a host-based action, so it should probably be part of the host context menu (as it makes sense there) and you need to pass the paths to the key files / dirs.
Last thing I want to mention is that Luna isn't exactly your standard Kodi addon - there's a lot of magic involved in lots of different places which make the architecture pretty tidy, but can also be intimidating when diving in. Just try to figure out how specific functionalities have been added in the past and you'll figure it out :) It's just that Kodi addon tutorials won't help you much (if at all).
If you need any more detailed guidance (or you'd rather discuss this in german) feel free to send me an email (address is on my github profile).
Cheers!
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/wackerl91/luna/issues/171#issuecomment-464830910, or mute the thread https://github.com/notifications/unsubscribe-auth/As9LP-WGy8NcGbBMxwE3KcafwufRVCGhks5vOuuYgaJpZM4aZkB8 .
Have a good day: https://github.com/Pawe98/luna/releases/tag/v0.7.0-rc7-fixed
I take no credit (literally only typos fixed)
Don't want to trust my zip? : look at /resources/lib/launch scripts/ and compare the files