GithubHelp home page GithubHelp logo

cpkodi-skill's People

Contributors

david-morris avatar pcwii avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

cpkodi-skill's Issues

Web Settings not refreshing

Changes to the web settings does not get loaded into the skill.
May need to add ability to refresh via spoken command.

Enchancement: Open Favorites

I'm opening this issue to say that I'm working on an "open favorite" function, and to write down the info I've learned that is needed.

Favorites can be fetched with kodi.Favourites.GetFavourites(properties=['window','windowparameter','path'])['result']['favourites'] (that's a line of kodi-json which I use in the REPL, but I don't intend to pull it as a dependency).

Then you just need to know whether its type is window, media, or script.

If it's a script, it's unsupported. Kore can't run scripts from the favourites menu either. I think the skill should say so?

If it's a window, it can be run with kodi.GUI.ActivateWindow(window=favorite_item['window'],parameters=[favorite_item['windowparameter']]) but we should send a noop input event after it because some windows don't take the screen out of idle when opened.

If it's media, it can be run with kodi.Player.Open(item={"file":favourite_item['path']}), whether it is actually a local file or a stream of some kind.

play command not working anymore

Hello,

first at all, thank you for your amazing work!

for some reason the "play" command won't work (since 2 weak) on my site. If the voice command "watch" is used it is working well.

It seams there is some trouble using the "Playback Control Skill".

Hope you got an idea, how this happen. Have a good week!

image

Load fails on Ubuntu 20.10

I‘ve got Mycroft installed on Ubuntu 20.10 with Python 3.8.6. Mycroft runs without problems, but the installation of cpkodi fails with the following message:

Traceback (most recent call last):                                                                                              
  File "/home/rr/mycroft-core/mycroft/skills/skill_loader.py", line 276, in _load_skill_source                                  
    skill_module = load_skill_module(main_file_path, self.skill_id)                                                            
  File "/home/rr/mycroft-core/mycroft/skills/skill_loader.py", line 72, in load_skill_module                                    
    spec.loader.exec_module(mod)                                                                                               
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module                                                      
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed                                                 
  File "/opt/mycroft/skills/cpkodi-skill.pcwii/__init__.py", line 33, in <module>                                               
    for each_module in sys.modules:                                                                                            
RuntimeError: dictionary keys changed during iteration                                                                         
~~~~.840 | ERROR    | 56085 | mycroft.skills.skill_loader:_communicate_load_status:351 | Skill cpkodi-skill.pcwii failed to load

I have read here that a similar problem can be solved by switching from python3.8 to python3.7. Could I do this using a virtual environment?

[Request] License?

I see that the old version of this project has GPL 3.0, which would be really great for this project since it's sitting on the mycroft-core repo which has a highly invested company involved.

Whatever license you choose, it'd be good to have clarity.

make it so it doesn't just search by title, but also by artist

I had another thought on how to possibly speed up the search on large music collections. Can you make it so it doesn't just search by title, but also by artist?

For example:
play the album Us by Peter Gabriel

As it currently works, if you just say
play the album us

it'll return every instance of 'us' in any album title. Obviously giving it an artist name you could just search the subset of albums by that particular artist instead of searching the entire database.

I'm not completely sure but I think there's a problem with having certain punctuation or characters in the title. If I search for Alien Covenant which has a colon in it, it returns an error. Also, the IMDB title for Alien III is a superscripted 3, and that seems to cause an error.

Just thought I'd let you know in case you do want to get this advanced further. I'll be happy to test things out.

Originally posted by @JedidiahStolzfus in #1 (comment)

mute/reduce kodi volume while "hey mycroft"

Hello,

first of all thanks a lot for your awesome work. I realy love to controll my living room kodi using cpkodi-skill.

Is there possible an easy solution to stop/mute kodi via api, if mycroft receive the wake word (hey mycroft, hey jarvis, ...)

Have a good day!

edit: found an inconsistent in your docu. When i use the pvr feature with eg. "play channel 1" it starts a channel where the channel name is something like "one" in the name. But using "watch channel 1" kodi plays the first channel.

I guess play and watch is mistaken in your docu.

Fails to load freshly installed on x86_64

I'm running Arch on a halftop, and I've been having this issue trying to install:

 14:59:12.773 | INFO     |  5873 | cpkodi-skill_pcwii:<module>:35 | Attempting to reload tools Modules: cpkodi-skill_pcwii.youtube_tools
 14:59:12.774 | ERROR    |  5873 | mycroft.skills.skill_loader:_load_skill_source:278 | Failed to load skill: cpkodi-skill.pcwii (RuntimeError('dictionary keys changed during iteration'))
Traceback (most recent call last):
  File "/home/dmorris/src/mycroft-core/mycroft/skills/skill_loader.py", line 276, in _load_skill_source
    skill_module = load_skill_module(main_file_path, self.skill_id)
  File "/home/dmorris/src/mycroft-core/mycroft/skills/skill_loader.py", line 72, in load_skill_module
    spec.loader.exec_module(mod)
  File "<frozen importlib._bootstrap_external>", line 790, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/opt/mycroft/skills/cpkodi-skill.pcwii/__init__.py", line 33, in <module>
    for each_module in sys.modules:
RuntimeError: dictionary keys changed during iteration
 14:59:12.774 | ERROR    |  5873 | mycroft.skills.skill_loader:_communicate_load_status:351 | Skill cpkodi-skill.pcwii failed to load

I was able to get it to load by changing for each_module in sys.modules: to for each_module in list(sys.modules):, but I don't know whether that solved the problem or disabled your sanity check.

Crash while reading some PVR intent block in __init__.py

bug-cpkodi

I installed cpkodi today on a new device but it crashed.

The command I ran to install it is:
mycroft-msm https://github.com/pcwii/cpkodi-skill.git

Here is the bug log on mycroft debug:

15:06:31.652 | INFO     |  6412 | mycroft.skills.skill_loader:_communicate_load_status:280 | Skill mycroft-configuration.mycroftai loaded successfully
 15:06:31.654 | INFO     |  6412 | mycroft.skills.skill_loader:load:114 | ATTEMPTING TO LOAD SKILL: cpkodi-skill.pcwii
~~~~kill.pcwii (SyntaxError('invalid syntax', ('/opt/mycroft/skills/cpkodi-skill.pcwii/__init__.py', 379, 32, '                if channel_no := self._match_adapt_regex(phrase, "ChannelNumber") is not None:\n')))
Traceback (most recent call last):
  File "/opt/mycroft/mycroft/skills/skill_loader.py", line 208, in _load_skill_source
    ('.py', 'rb', imp.PY_SOURCE)
  File "/usr/lib/python3.7/imp.py", line 234, in load_module
    return load_source(name, filename, file)
  File "/usr/lib/python3.7/imp.py", line 171, in load_source
    module = _load(spec)
  File "<frozen importlib._bootstrap>", line 696, in _load
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 724, in exec_module
  File "<frozen importlib._bootstrap_external>", line 860, in get_code
  File "<frozen importlib._bootstrap_external>", line 791, in source_to_code
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/opt/mycroft/skills/cpkodi-skill.pcwii/__init__.py", line 379
    if channel_no := self._match_adapt_regex(phrase, "ChannelNumber") is not None:
                   ^
SyntaxError: invalid syntax
 15:06:31.670 | ERROR    |  6412 | mycroft.skills.skill_loader:_communicate_load_status:287 | Skill cpkodi-skill.pcwii failed to load 

This bug seem to disappear if I modify 'init.py' and comment/remove the all function:

@intent_handler(IntentBuilder('').require("WatchKeyword").require("PVRKeyword").optionally("ChannelNumber"))                                                                                                   
def handle_channel(self, message):                                                                                                                                                                             
    if 'ChannelNumber' in message.data:                                                                                                                                                                        
        play_channel_number(self.kodi_path, int(message.data['ChannelNumber']))                                                                                                                                
        return
    if channel_no := self._match_adapt_regex(message.data['utterance'], "ChannelNumber") is not None:                                                                                                          
        self.dLOG("Adapt failed to recognize an optional regex.")                                                                                                                                              
        play_channel_number(self.kodi_path, int(channel_no))                                                                                                                                                   
        return                                                                                                                                                                                                 
    self.dLOG("Channel number not matched. Trying to find a channel name.")                                                                                                                                    
    channel_query = message.utterance_remainder()                                                                                                                                                              
    channels = find_channel(self.kodi_path, channel_query)                                                                                                                                                     
    if len(channels) == 0:                                                                                                                                                                                     
        self.speak_dialog('no.channel', data={'title':channel_query},                                                                                                                                          
                          expect_response=False,                                                                                                                                                               
                          wait=False)                                                                                                                                                                          
        return False

... but this is likely going to disable PVR support?

Menu Navigation

Sometimes when I search for a video on Youtube, the video I want is not the first result, so something else plays instead. Using other kodi controllers, that's not an issue because the search window shows you options and if the video you want isn't highly ranked, you can try another search. But a list of videos really isn't appropriate for a voice to bark out and insist we choose immediately.

So ideally there would be a kodi jsonrpc method that showed us the menu items in the current container, and a kodi jsonrpc method that let us select one of those items as focused and/or activate it. Neither of those exist. What we can do is use XBMC.GetInfoLabels to get information on the length of a list (Container().NumItems) and our current position in it (Container().Position, note: 1-indexed), and then query the titles of each item, and then navigate using the Input commands. There are some implementation details I'm sorting out in terms of choosing things from the current screen or not, I'm leaning towards choosing things from the current screen by default since that's a more predictable interface.

Unfortunately, this only works for containers, so it doesn't work inside of the main-menu interfaces (Favourites, Videos, etc.). It also doesn't let us interact with dialogs. However, I'm writing it for Youtube, and I'll make a generic interface with a "choose" keyword for it which can be used in any Container (mostly vertical menus), but I'd like to hear what others would like to use it for.

handle only 1 result

There's a minor error on line 415 that doesn't allow a movie to be played if there's only one result found.

As it stands in the original file:
movie_id = self.active_library['movieid']

Proposed fix:
movie_id = self.active_library[0]['movieid']

Enchancement request on Youtube

The youtube commands didn't work on my system, and I saw that you have been changing that lately.

Why not add a dependency to youtube_dl? Then you could use their API to fetch video entries:

ydl = youtube_dl.YoutubeDL(ydl_opts)
results = ydl.extract_info("ytsearch:<query string>")

and that way, if the Youtube API changes, you won't duplicate the youtube_dl team's work.

Installing on mk1 mycroft

When installing to a mk1 the sudo prompt comes up asking for the mycroft password.
However it doesn't accept the password, as my account is pi not mycroft

pi@mark_1:~ $ sudo msm install https://github.com/pcwii/cpkodi-skill.git
INFO - building SkillEntry objects for all skills
INFO - Downloading skill: https://github.com/pcwii/cpkodi-skill
INFO - Reading from manifest.yml
INFO - Installing system requirements...
Requesting sudo to run command: apt-get install libenchant1c2a...
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libenchant1c2a is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

[sudo] password for mycroft: 
Sorry, try again.
[sudo] password for mycroft: 
Sorry, try again.
[sudo] password for mycroft: 
Sorry, try again.
sudo: 3 incorrect password attempts

Support music play queue skip, previous

I'm loving this skill so thank you so much for putting it together! I'm wondering how hard it would be to support music playl queue commands such as:

  • "play next"/"skip"/"next" --> play next song in play queue. If none, end playback
  • "previous"/"go back" --> play previous song in play queue. If none, restart current song
  • "play again"/"restart" --> restart playback of current song

I'd love to learn more about how to contribute phrases like this and help map them to commands. If there is a doc or example code let me know!

Contribute italian

Thanks for this Skill, it works very well in en-us. How can I help translating in Italian? A simple PR with the it-it translation would be enough?

Enchancement: Put regex in adapt

I figured out reading the decide-skill repo that regexes need to have their matching group match the filename without extension, and the .rx must be required (not optional) in the intent handler.

By using adapt, we'll be able to make the code shorter and clearer, we'll be closer to the programming style of the wider community, and we'll be able to have multiple phrases for the same action without monstrous regexes, e.g. supporting both "play big buck bunny from my favorites" and "play my starred item big buck bunny."

I'll wait until my previous pull request is resolved to make a pull request on this, since I didn't set up a feature branch for that pull request.

More a question than issue :)

Hey thanks for the skill I am just curious if echo cancellation works for kodi. I have kodi connected to the same pi but with hdmi. Mycroft on analog audio. But i can’t tell mycroft commands like pause or noise down most of the time because the tv close to the mic.

Minor Bug Fix

There's a minor error on line 415 that doesn't allow a movie to be played if there's only one result found.

As it stands in the original file:
movie_id = self.active_library['movieid']

Proposed fix:
movie_id = self.active_library[0]['movieid']

I'm not a python programmer, this is all fairly new to me, but looking up the error I found someone suggested putting the [0] to solve the problem and it worked. I tested it by calling up a single word title, a title with multiple words, a title with punctuation and everything worked perfectly after the change.

Thanks for the great skill.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.