[HowTo] Luna - yet another moonlight configurator/launcher add-on

Hey there,

after having some trouble with @Toast’s old HowTo concerning moonlight on OSMC (which completely messed with my OSMC installation; seems to be updated now to work more reliably - nevertheless thanks for all the work and support you put in there, mate!) and ending up starting moonlight-embedded from command line once again, I’ve decided to dig a bit into Kodi addon development and build my own launcher/configurator for moonlight.

The result is named Luna (yeah, I know … not the most creative name ever) and aims to take a more general approach than e.g. @dodslaser’s moonlight-osmc script, which seems to rely on some OSMC specific stuff. Going down that road it will (theoretically) be possible to use Luna to launch moonlight on other platforms as well (which don’t run OSMC, but a standard Kodi installation and/or moonlight-pc) by just adding new launch scripts and trying to detect the environment on first start. To give credit where credit is due, the current OSMC launch script is based on dodslaser’s work (killing Kodi on OSMC can really be a pain in the a** :wink: ), though I’m still looking for a way to use a somewhat more integrated approach to have only one script per platform.

Enough of the preface though, let’s get to the actual point …


Luna’s current features:

  • Host Pairing from inside the Addon
  • Controller Mapping (again from inside the Addon)
  • Dynamic Game Library (uses moonlight’s list command to get games available on the host)
  • Launching of specific titles
  • Support for nearly all of moonlight-embedded’s options

Nearly all of the above could use some more testing - as of now, I’m the only one who ever used it and I solely fixed stuff which I’ve found while configuring or launching game(s)

Issues:

Of course, there are some, including but not limited to:

  • Games containing spaces have not been tested at all, this might not even work right now
  • Controller mapping sometimes doesn’t register controller inputs. I’m currently not sure if this is related to Luna, moonlight or my configuration, since it doesn’t work using moonlight’s CLI either. After restarting xboxdrv manually mapping works as expected again. Haven’t experienced this issue when just launching Steam
  • Immediate installation after uninstalling fails for some reason; restarting Kodi resolves this
  • Luna currently has no own icon, no fanart, no icons for menus / games, …
  • license.txt is missing from repo (will be GPL)
  • Some texts are missing in the currently released version (already fixed in master)

Requirements & Installation:

  • moonlight-embedded needs to be properly installed and configured (either follow moonlight-embedded’s instructions or Toast’s tutorial linked above)
  • Install this addon from zip

Upcoming:

  • Add a configuration wizard for the first start
  • Some more translations

TL;DR:

Luna can be found HERE.


Hope I’ve picked to right forum category to introduce this addon and let me know what you guys think!
If you should have any issues and/or feature requests feel free to post them here or on the issue tracker. When using Luna please keep in mind that it is currently veeeery alpha, so expect some quirks here and there (even though I did my best to iron out the worst).

Happy Gaming!

1 Like

Here is a good idea helpout with me and dodslaser there is always strenght in numbers instead of forking and going alone :smile:

we got most of those things covered its just that between me and dodslaser there is little time to make good progress with him studying and me working so another person might just bring some balance

that way i can continue working on getting more controllers working for the fork while you and dodslaser get cracking on the addon :smile:

p.s i included your addon in the howto.

To be honest, I half expected the first comment to be along the lines of ‘Why didn’t you put all the effort into an already existing addon?’ - and I expected to get a lot more heat for this :wink:

And actually, there is a (I believe very solid) reasoning behind my decision to publish this as something new.
When I started working on this (about a week and half back or so) I was thinking about just forking dodslaser’s repo and doing a PR once I’m done(-ish). Yet it became apparent pretty quickly that what was done already (at the very least what is publicly visible; and that’s the only thing I could leverage as help to make a decision) was way to different from what I had in mind and what I was creating, so I’d have ended up replacing at least his main addon file - which is not only not a solid basis for a PR to a repo which doesn’t contain and rely on that many files but also essentially something entirely new. The latter is true especially for me adding new features and trying to target other Kodi installations as well down the road. In short, I would’ve felt like I would be undoing someone’s work as the basis (and maybe even the vision of how this addon should work and which users it should target) was too different.

In general, I do get your point about rather working together than always creating something new and I strongly believe in the strength in numbers concept of OSS. Yet I also believe this is only true to a certain extent, since there is also a point where you have to ask yourself if what you’re doing is still part of an existing project. Otherwise you could also question the existence of multiple Media Center distributions (given that for example OSMC and OpenELEC provide a similar feature set, with OSMC being the one that’s more open) or the need for multiple CMSs / CMFs (again, providing similar feature sets). After all, choice isn’t always a bad thing, right?

Bottom line is: I guess the decision between contribution and building a new project is always hard to get right but easy to get wrong and I can assure you and dodslaser that I did not take this decision light-minded.

I sincerely hope that you get my reasons (and that they didn’t make me sound like a dick :smile: ) and you’re not mad at me for this. If you should feel unsatisfied by this answer please tell me and I’ll try my best to clarify :smiley:

Nevertheless thanks for your support by linking Luna in your howto, really appreciate that!

P.S.: I’m working and studying as well, so my time is as limited as anyone’s ^.^

Have no problems at all with your arguments :slight_smile: if you wish to join in at a later date just yell and ill set it up

currently working on my common controller pack for moonlight

https://gitlab.com/swe_toast/common_controller_pack

simple stuff

Honestly, I’m with @Toast on this one. Sure, if you want to create something of your own to do the same things we are already working on that’s up to you, but I feel it would be way more productive to work on this together. I’ll finish polishing my new release probably before Christmas. That version adds many of the things you mention (still not multi-platform obviously, if that’s your main thing.)

Work together is always the best for long way and for better results, maybe you can do it.

thanks for your effort.

Again, I totally agree with working together towards a common goal is definitely a huge plus. Yet - as said before - this is only really true to a certain extent. There was almost no code base which I could have used to provide the features I did with Luna, so - again - I’d have ended up replacing nearly all of it, which I deemed kind of unfair, considering someone put work into it. Reading between the lines this also sounds so much like a ‘first to the market gotta be the one and only’ situation and this just doesn’t hold true.

To be really honest (and I’m going to explicitly exclude Toast from this, as his common controller pack is a totally different issue): When I started coding Luna, I did not know when or even if the features mentioned on Git were going to be implemented, as there wasn’t a lot going on in that repo. There has been zero indication of when one could expect those features. Somewhat turning the tables now: Luna has those features publicly available today - they may not be tested 100%, but neither will any other implementation be when it’s available for the first time. Yet I wanted to have those features as they make my life using moonlight so much easier, so I went ahead and ‘did my own thing’. It’s not like I built the exact(!) same thing from scratch but rather building something with a way enhanced feature set - which (imho, as was explained above) deserves to be something new. Concerning the mentioned productivity of working together: as of right now (and I can only judge by what’s publicly available), it might even proof to be more productive to make Luna’s features better than re-creating them (which - objectively and looking at the current facts - would be even worse than what you’re ‘blaming’ me for). If you’re willing to do so, I’ll appreciate any help. If not … well, by all means go ahead.

First and foremost I built Luna for myself - when I was done I thought ‘Why not share it for everyone to use and make it better, as this should be a solid base.’. The ability to plug in different launch scripts (multi-platform) is merely on of them, which I’d love to have to game on my Notebook (or possibly tablet).

Frankly … I don’t even really care if anyone uses Luna or not. As I’ve said, I’ve built this for myself. Anyone who is willing to make it better (and if it’s just by feature requests or bug reports) is welcome. If everyone goes with giving me heat for publicly providing something I’ve spent lots of time on … well, that’s fine for me as well.
However I will NOT publicly comment on anything regarding my decision anymore since I’ve said everything I got to say as of right now and this topic is bound to start a fight sooner or later. Additionally, this thread should be about an addon some people might like and others might not. If anyone wishes to discuss this any further (and / or a possible cooperation) please send me a PN. This really shouldn’t be the place to do so.

The above does by no ways mean that those two launchers will be split for all times - as far as I’m concerned at least. There might come a time where they’re similar enough (both regarding vision and code base) to provide a single solution, but as of right now, they’re just way too different.

Cheers!

(And yes, I’ve spent 1 hour on that answer to be as objective on the matter at hand as possible. If someone feels the need to hate me for what I’ve said here … go ahead and send me a PN, I’ll gladly answer.)

1 Like

Luna 0.2.2 Alpha is out!

This release contains the following new features / improvements:

LUNA-1: Main Menu Icons and Game Information scraper
LUNA-2: Cache Control action in settings to clear cached game data
LUNA-3: Resolution selection is now optional (adding this information to the config led to bug in some cases. moonlight is now selecting its default resolution instead. Note that if Luna worked fine before this change you might need to reconfigure the add-on and enable ‘Override Default Resolution’) - thanks to @karl1 for figuring this out!

Additionally, this also fixes some pairing and launching related issues which where reported and diagnosed by @nlooije - thanks!

Luna is still alpha, so please provide feedback regarding bugs and/or feature requests on the issue tracker!

Should consider to setup a repository on github so that the addon can be updated via kodi

http://kodi.wiki/view/HOW-TO:Create_a_repository_for_add-ons

1 Like

@Toast: Thank you so much for the suggestion! Will definitely look into this soon (updating / auto-updating similar to OSMC itself was already on my list, but didn’t do any research up until now).

1 Like

@exxe So I’ve mentioned this on Github and I do think this is maybe a side issue and really depends on if it’s possible or even useful to others but I was wondering if you could add a link to Steam (big picture) itself under Luna alongside the list of games (preferably pinned to the top, as an option). This way, games that currently won’t launch directly (for me so far Far Cry 4) which do launch ok under Steam big picture mode could be launched and played using Luna. I could use the direct link in Luna for some and otherwise fire up Steam big picture mode. You did mention that this is probably handled by GFE itself in which case it might not be doable but hopefully it’s both possible and not too difficult to implement if you’re willing. If not, I’d just use Luna to launch Steam big picture mode so it’s all good. Apart from my unscientific testing which makes me think that Steam is possibly causing performance issues with Streaming on at least some games. Having the option would be fantastic. Either way, thanks for the plugin and looking forward to any updates. :slightly_smiling:

@diagonali:
Thanks for the suggestion (and sorry for my reply being delayed even further than I initially anticipated - but then again I warned you that I don’t have much time on my hands right now ;P).
I had a look at this today and while doing so I realised that the most recent GFE version now properly merges the games it could find on its own (the ones in the ‘Games’ tab) with the manually added ones (those under ‘Preferences’ > ‘SHIELD’) which results in Steam being automatically included in my list. Which is actually very funny on its own as Steam isn’t part of either list in GFE but it’s reported when calling moonlight list.
This might already be enough for your use case (having Steam listed when you added games manually).
If this is not a case (or if GFE is set up differently on your end and it doesn’t work the way I described above) I’d need to find a way to make GFE list only my manually added games once again and try if it can find and launch Steam even if it’s not listed (which is a huge gamble anyway and I actually don’t expect GFE to work that way, but you never know …).

Either way I might add an option to exclude Steam from sorting and thus pinning it to the top (if it’s listed by GFE that is).

Cheers!

1 Like

This project is so lovely, thank you exxe a million times! I’m new to Raspberry Pi + Kodi, and unknowingly took the more difficult approach of trying to get Kodi and moonlight to work well within the “RetroPie” OS and their EmulationStation. Getting the base OSMC operating system with your plugin was such a breath of fresh air compared to the pain I was previously going through. Super easy & straightforward, it’s just beautiful! (no disrespect to RetroPie, I just realized I didn’t really need any of those emulators so it was pointless)

You realize you’re changing history by being part of this butterfly effect which will eventually wipeout consoles, right? :smiley:

Small feature request: Wake-on-Lan functionality would be awesomesauce

PS: Even though I download and installed the 0.5.2 zip, the addon thinks it is 0.5.1, asks to update and never stop reporting that it is 0.5.1. Slightly odd but no biggie!

1 Like

I was working on exactly the same project as @Amivit: A RetoPie/ES/Kodi/Moonlight build. OSMC with Moonlight and Luna is 1000x cleaner. I didn’t really need an Amiga emulator that badly that I had to see it on boot daily.

Also, the name of the Luna addon is catchy and the icon is really slick. I’ve seen whole marketing teams come out with names and logos waaay less creative and relevant. Good job.

So far the only thing I’m stuck with is controller mapping. I used a few of the OSMC guides to try to get an Xbox 360 controller going, but I think this is going to be more complex than I expected. The moonlight mappings folder that @dodslaser spoke of was not in the usr/local/share directory; had to create the directory and conf file myself. When in the custom mapping settings, I can’t quite find what input to select. There seems to only be mice, my logitech receiver, and some event#'s. There’s also the possibility that xpad may be causing issues. I’ve been a little hesitant to blacklist it as irtimmer had suggested in the moonlight-embedded how-to until I tried a few things. It took me a while to get the controller to work with Kodi’s interface in the first place so I don’t want to break anything just yet.

I’ve only been working with Linux for about a month so everything still takes me hours to figure out. I want to enjoy what I have for a day or two :smile:

1 Like

When I stopped development of my plugin I had just finished a piece of code that found all available inputs and created a dict of their name mapped to the corresponding /dev/eventX or /dev/jsX, and allowed you to select and map input by device name instead of the less catchy /dev/xX. I’m currently working on a project which I don’t want to talk about too much as of now, but you might see something similar there if I ever release it. If not I’ll probably push it to Luna.

Thread moved to “How to” subforum.

@Amivit / @djrockgt: Thanks for your kind words. But you should probably thank the guys developing moonlight more than me, as all of this wouldn’t be possible without their work. And while you’re at it you should probably thank @dodslaser as well for the general idea. After all, Luna is ‘only’ a GUI addon to make using moonlight somewhat less painful for the average guy.
About WoL: Added to the list. I’ll look into it once I find some more time :slight_smile: No promises though.

@dodslaser: That’s actually a neat idea and something I haven’t even thought about. As a backend developer I usually don’t care too much about usability.
Creating a map of device names and their corresponding paths isn’t that hard (actually using something very similar in the boot script for my homeserver as I need to attach specific drives to one of the VMs and VMWare is just too stupid to remember it properly). The hard part is getting moonlight to always recognise the input used without having to restart the driver.
That being said - and since I suspect that your working with @Toast on his project - I won’t do anything remotely controller related in Luna until you guys finished your work as I think a general solution for controller mappings is way more useful than a Luna / moonlight specific implementation (you probably got more insight on how controller inputs are handled anyway and that’s something I don’t really want to dig into if it’s not absolutely necessary). Still, if you should ever need any help (testing, …) just let me know.

Hi, first post here. I installed moonlight and Luna onto OSMC which I’m running on a RPi2. Streaming seems to be working great but I’m having controller issues with a wireless Xbox controller connected to the RPi2. I followed the guide under the XBox controller section here:
Moonlight install how-to
but both before and after the xboxdrv changes as document the direction pad is messed up.

Down goes right
Right goes down
Left goes up
Up goes left

I know that the left analog stick, top triggers, and at least the A and B buttons work as they should. Unsure about the other controls at this time.

I tried to play with the controller mappings in Luna but not sure what “device” I should be trying to remap. Eventually I’d like to connect a PS4 or PS3 controller through bluetooth but thought it would be easier to set it up with a wireless Xbox (for PC) controller first.

I’m a noobie with linux / OSMC so please be gentle. :wink:

Welcome to the forums then :wink:
Have you tried starting xboxdrv with the additional ‘—dpad-rotation 90’ flag? This usually takes care of wrong dpad rotation.

Meh go ahead on your controller since we spoke ive resigned from the project and my guess is that Sam and the rest of the guys has little to no interest in controller support.