Skip to content
This repository has been archived by the owner on Sep 8, 2024. It is now read-only.

Fix Mimic 2 cache directory error #2800

Merged
merged 3 commits into from
Jan 15, 2021
Merged

Fix Mimic 2 cache directory error #2800

merged 3 commits into from
Jan 15, 2021

Conversation

chrisveilleux
Copy link
Member

Description

Fixed an error that occurs when the pre-loaded cache directory already exists but the cache_text.txt file does not.

How to test

Remove the cache_text.txt file from the pre-loaded cache directory and reboot the device. There should be no errors regarding creating the file.

Contributor license agreement signed?

CLA [Y]

…y exists but the cache_text.txt file does not.
@devops-mycroft devops-mycroft added the CLA: Yes Contributor License Agreement exists (see https://github.com/MycroftAI/contributors) label Jan 14, 2021
@devops-mycroft
Copy link

Voight Kampff Integration Test Failed (Results).
Mycroft logs are also available: skills.log, audio.log, voice.log, bus.log, enclosure.log

krisgesling
krisgesling previously approved these changes Jan 14, 2021
Copy link
Contributor

@krisgesling krisgesling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great.

I also like the shift so that generate_cache_text only does what the method name suggests.

@krisgesling krisgesling added Status: Accepted PR has been reviewed and accepted. There must be some reason why it isn't being merged. Type: Bug - quick Bug fixes that are quick to review and the implications of the change are clear and contained. labels Jan 14, 2021
@@ -45,28 +45,26 @@
cache_dialog_path = [res_path, wifi_setup_path]


def generate_cache_text(cache_audio_dir, cache_text_file):
def generate_cache_text(cache_text_file):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is deprecating the old API, maybe throw a deprecation warning and support the argument for a while

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yeah good point.

Should we also make them private methods and only expose a single cache_handler? Or are there uses for these independently?

Actually it would definitely need a little more refactoring to be properly generic.

Copy link
Contributor

@JarbasAl JarbasAl Jan 14, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm not sure this even fits in mycroft-core tbh, feels like an helper script that should not be there in the first place.

but now that its there, there might be users in the wild depending on it, eg, OVOS could be using that to generate its own cache (it isn't afaik)

making them private would also break the api compatibility, so still needs a deprecation warning, that way next major version tells everyone to stop depending on it, and the one after can make them private/remove them

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, agree we shouldn't break the API.

Given it's currently hardcoded to Mimic2, we could extract it to that plugin. At the moment this seems like the most likely course of action to me.

Alternatively, if there is interest and someone willing to do it, they could refactor it for use in any TTS in which case we could leave it in core as a common method.

@krisgesling krisgesling dismissed their stale review January 14, 2021 07:06

Breaking API as Jarbas pointed out.

@krisgesling krisgesling added Status: Change requested and removed Status: Accepted PR has been reviewed and accepted. There must be some reason why it isn't being merged. labels Jan 14, 2021
@chrisveilleux
Copy link
Member Author

Fixed backwards compatibility issue.

@chrisveilleux chrisveilleux force-pushed the bugfix/mimic2-cache-dir branch from 51d2a26 to a52d45f Compare January 14, 2021 20:30
@devops-mycroft
Copy link

Voight Kampff Integration Test Succeeded (Results)

@devops-mycroft
Copy link

Voight Kampff Integration Test Failed (Results).
Mycroft logs are also available: skills.log, audio.log, voice.log, bus.log, enclosure.log

@devops-mycroft
Copy link

Voight Kampff Integration Test Succeeded (Results)

"exists before executing this function. support for this argument "
"will be removed in version 21.08"
)
os.makedirs(cache_audio_dir)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to check if this directory exists before making it?

@krisgesling krisgesling merged commit e69f351 into dev Jan 15, 2021
@krisgesling krisgesling deleted the bugfix/mimic2-cache-dir branch January 15, 2021 05:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CLA: Yes Contributor License Agreement exists (see https://github.com/MycroftAI/contributors) Status: Change requested Type: Bug - quick Bug fixes that are quick to review and the implications of the change are clear and contained.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants