Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor Bug Fix #1

Closed
JedidiahStolzfus opened this issue Dec 9, 2020 · 13 comments
Closed

Minor Bug Fix #1

JedidiahStolzfus opened this issue Dec 9, 2020 · 13 comments

Comments

@JedidiahStolzfus
Copy link

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.

@pcwii
Copy link
Owner

pcwii commented Dec 10, 2020

@JedidiahStolzfus
I will look into this. I did not even know anyone was actually using this skill. I have not officially released it to the community yet.
How long have you been using it? What version of Kodi? Anything else you would like to see? I have had very limited development time recently so it has been idle for a while. Maybe this is the motivation I need to pick it back up. Thanks for the feedback!

@JedidiahStolzfus
Copy link
Author

I've only started working with it a couple of days ago. I was trying out the other Kodi skill you made, but it had a problem too, then I found this one and figured it might work better since it was using the common play skill.

It's currently running on a Raspberry Pi4 4G version, Kodi 18.7 is running on the same device as Mycroft, which was a small feat in itself to get running. So far, the only thing that doesn't seem to work is I can't tell it to play any stored TV shows. It'll play movies and music, but I can't tell it "play the tv show burn notice". That would be a nice feature to have.

I think the skill is worth getting running though, and I think the bug I found was just overlooked. I'm not a python programmer, but with my knowledge of other languages I was able to figure it out with some googling.

I don't mind testing things out in an actual working environment. Here's what I have working so far:

https://youtu.be/qQTQNhVIqs0

I'm also using your Mesh skill for communicating with my home made IOT stuff via MQTT and Node-Red.

@pcwii
Copy link
Owner

pcwii commented Dec 10, 2020

You definitely don't want to use the old Kodi skill as it was developed before the "common play" was added to mycroft. The cpKodi skill was my attempt to get it to play nice with common play. As far as TV shows go, it is something I was in the middle of working on when I paused development. I will try to pick it back up and get this working. Watched your video and the kodi music request is a bit slow in responding. During my testing I found parsing the kodi response data is pretty slow when there are large collections, I will try to clean that up a bit as well.
What audio card / microphone are you using for Mycroft? I noticed it responds well even when music is playing which can be a problem with mycroft.
Glad you like the Mesh skill, it is definitely handy for some IOT stuff. I use it to send audible notifications from HomeAssistant.

@JedidiahStolzfus
Copy link
Author

I posted a question on the old Kodi still, I'll go over and close it then. My music collection is about 20,000 files, so it can take some time to find things, plus I think when I shot that video the system was busy doing something else, it seems to be more responsive now.

This is the microfphone I"m using: https://www.amazon.com/gp/product/B07G1VPH51/ref=ppx_yo_dt_b_asin_title_o08_s01?ie=UTF8&psc=1

It works well, is detected properly, the only real issue I've found is if you use the button on it, which kills the power to the mike, and then turn it back on, it isn't detected. A reboot is needed to detect the mike again. I was testing a couple hours ago with it playing music from my stereo rather loudly and I could still yell over the music and have it hear and respond to commands.

In the video you saw the enclosure that I've made. There's going to be a pair of 40mm speakers in those grills hooked up to a small amplifier which will be connected to the volume control on the front and the headphone jack. That way I can have Mycroft audio go out through those speakers and kodi audio go out through HDMI. I'm hoping that will eliminate any chance of feedback when music or movies are playing. I'm just waiting for my amplifier boards to show up from China.

There's the RGB LED on the front, blue indicates it's listening, red is HDD activity and green is network activity.

@JedidiahStolzfus
Copy link
Author

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.

@pcwii
Copy link
Owner

pcwii commented Dec 11, 2020

The roman numeral item is interesting. Currently I am creating a filter with the request to the kodi api. This filter contains all the words in the utterance. I may need to re-think this as mycroft will return "Alien 3" for the utterance. If I apply this to the filter it will fail to return Alien III. This is a part of the kodi api. The option I have is to return all movies in the library and parse them myself but this would take much more processing time for large libraries. Let me think about this a bit more.

@pcwii
Copy link
Owner

pcwii commented Dec 15, 2020

@JedidiahStolzfus, I made a change to permit a search for the Alien III, still looking at the punctuation issue and other items.
Currently if you request Alien 3, I have made it pull anything with Alien, Then check the returned list for any matches with 3, if that fails then check for III, If that fails it will return all Alien movies, otherwise it should return Alien III. I have lots of code clean up to do so there may be a few updates over the coming days.

@JedidiahStolzfus
Copy link
Author

Cool, I'll check out the new version when I get my devices plugged back in. They're currently sitting in pieces while I finish building them.

@JedidiahStolzfus
Copy link
Author

Installed it earlier today, I think there's something wrong.

` 01:21:08.393 | INFO | 802 | Playback Control Skill | Resolving Player for: the movie clue
Removing event mycroft-playback-control.mycroftai:PlayQueryTimeout

Removing event mycroft-playback-control.mycroftai:PlayQueryTimeout
~~~~kills.mycroft_skill.mycroft_skill:on_error:835 | An error occurred while processing a request in CP Kodi Skill
Traceback (most recent call last):
  File "/home/pi/mycroft-core/mycroft/skills/mycroft_skill/event_container.py", line 66, in wrapper
    handler(message)
  File "/home/pi/mycroft-core/mycroft/skills/common_play_skill.py", line 96, in __handle_play_query
    result = self.CPS_match_query_phrase(search_phrase)
  File "/opt/mycroft/skills/cpkodi-skill.pcwii/__init__.py", line 304, in CPS_match_query_phrase
    request_data = self.get_request_info(phrase)  # Parse the utterance (phrase)
  File "/opt/mycroft/skills/cpkodi-skill.pcwii/__init__.py", line 179, in get_request_info
    with open(resource_path) as resource_file:
TypeError: expected str, bytes or os.PathLike object, not NoneType
Removing event mycroft-playback-control.mycroftai:PlayQueryTimeout
 01:21:16.508 | INFO     |   802 | Playback Control Skill |    No matches
  ^--- NEWEST ---^
`

@pcwii
Copy link
Owner

pcwii commented Dec 19, 2020

yep, doing some active debugging, and testing. Likely broke a few things in the process.

@JedidiahStolzfus
Copy link
Author

I see you updated it. Now it's working like it was. It does seem to be returning hits faster than it was. Don't know if you did anything to fix that.

I'm trying to find things that will break it and I think I found a couple of minor issues.
"play the movie alien covenant"
returns no results.
"play the movie alien: covenant"
plays the movie. The colon in the title is throwing it off.
"play the movie alien"
returns all movies with "alien" in the title, including alien: covenant. It properly runs through the entire list until the last one, if you skip it, it gives an error: "list index out of range" in line 678

doing this:
"play the album division bell"
returns nothing.
"play the album the division bell"
returns the correct album.

I saw in another skill (don't recall which one) that it was ignoring articles like 'the', might be something to consider doing here too.

Hope I'm not inundating you with issues, I just really like this skill, and would love to see it work.

@pcwii
Copy link
Owner

pcwii commented Dec 19, 2020

No problem at all, I appreciate the assistance debugging, it can be difficult to test all the options. I will continue to plug away over the coming days as I have time.

@JedidiahStolzfus
Copy link
Author

No rush, at this point, I don't know when my Mycroft boxes will be done since the amplifier boards I ordered are apparently stuck in customs for over a month now. I ordered a second set, I bet they show up before the first set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants