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

feat/ovos_plugin_manager #1

Merged
merged 1 commit into from
Nov 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/build_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,15 @@ jobs:
python -m pip install build wheel
- name: Install System Dependencies
run: |
sudo apt install python3-dev swig libssl-dev libfann-dev portaudio19-dev
sudo apt-get update
sudo apt install python3-dev swig libssl-dev libfann-dev portaudio19-dev libpulse-dev
- name: Build Distribution Packages
run: |
python setup.py bdist_wheel
- name: Install tflite_runtime workaround tflit bug
Copy link
Member

Choose a reason for hiding this comment

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

Does this deserve an issue?

Copy link
Member Author

Choose a reason for hiding this comment

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

maybe, there is one in the upstream tflit repo already, happens in some platforms due to some mismatch with post release version of the wheel it tries to download or something during setup.py

Copy link
Member

Choose a reason for hiding this comment

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

Just want to make sure we remember to remove this when upstream gets fixed, though it's not a big deal just for automation

run: |
pip3 install numpy
pip3 install --extra-index-url https://google-coral.github.io/py-repo/ tflite_runtime
- name: Install core repo
run: |
pip install .[audio-backend,mark1,stt,tts,skills_minimal,skills,default_skills,enclosure,bus,all]
182 changes: 1 addition & 181 deletions mycroft/audio/services/__init__.py
Original file line number Diff line number Diff line change
@@ -1,182 +1,2 @@
# Copyright 2017 Mycroft AI Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
"""Definition of the audio service backends base classes.
from ovos_plugin_manager.templates.audio import AudioBackend, RemoteAudioBackend

These classes can be used to create an Audioservice plugin extending
Mycroft's media playback options.
"""
from abc import ABCMeta, abstractmethod


class AudioBackend(metaclass=ABCMeta):
"""Base class for all audio backend implementations.

Args:
config (dict): configuration dict for the instance
bus (MessageBusClient): Mycroft messagebus emitter
"""

def __init__(self, config, bus):
self._track_start_callback = None
self.supports_mime_hints = False
self.config = config
self.bus = bus

@property
def playback_time(self):
return 0

@abstractmethod
def supported_uris(self):
"""List of supported uri types.

Returns:
list: Supported uri's
"""

@abstractmethod
def clear_list(self):
"""Clear playlist."""

@abstractmethod
def add_list(self, tracks):
"""Add tracks to backend's playlist.

Args:
tracks (list): list of tracks.
"""

@abstractmethod
def play(self, repeat=False):
"""Start playback.

Starts playing the first track in the playlist and will contiune
until all tracks have been played.

Args:
repeat (bool): Repeat playlist, defaults to False
"""

@abstractmethod
def stop(self):
"""Stop playback.

Stops the current playback.

Returns:
bool: True if playback was stopped, otherwise False
"""

def set_track_start_callback(self, callback_func):
"""Register callback on track start.

This method should be called as each track in a playlist is started.
"""
self._track_start_callback = callback_func

def pause(self):
"""Pause playback.

Stops playback but may be resumed at the exact position the pause
occured.
"""

def resume(self):
"""Resume paused playback.

Resumes playback after being paused.
"""

def next(self):
"""Skip to next track in playlist."""

def previous(self):
"""Skip to previous track in playlist."""

def lower_volume(self):
"""Lower volume.

This method is used to implement audio ducking. It will be called when
Mycroft is listening or speaking to make sure the media playing isn't
interfering.
"""

def restore_volume(self):
"""Restore normal volume.

Called when to restore the playback volume to previous level after
Mycroft has lowered it using lower_volume().
"""

def get_track_length(self):
"""
getting the duration of the audio in milliseconds
"""

def get_track_position(self):
"""
get current position in milliseconds
"""

def set_track_position(self, milliseconds):
"""
go to position in milliseconds

Args:
milliseconds (int): number of milliseconds of final position
"""

def seek_forward(self, seconds=1):
"""Skip X seconds.

Args:
seconds (int): number of seconds to seek, if negative rewind
"""

def seek_backward(self, seconds=1):
"""Rewind X seconds.

Args:
seconds (int): number of seconds to seek, if negative jump forward.
"""

def track_info(self):
"""Get info about current playing track.

Returns:
dict: Track info containing atleast the keys artist and album.
"""
ret = {}
ret['artist'] = ''
ret['album'] = ''
return ret

def shutdown(self):
"""Perform clean shutdown.

Implements any audio backend specific shutdown procedures.
"""
self.stop()


class RemoteAudioBackend(AudioBackend):
"""Base class for remote audio backends.

RemoteAudioBackends will always be checked after the normal
AudioBackends to make playback start locally by default.

An example of a RemoteAudioBackend would be things like Chromecasts,
mopidy servers, etc.
"""
177 changes: 0 additions & 177 deletions mycroft/audio/services/chromecast/__init__.py

This file was deleted.

Loading