From: marcelveldt Date: Thu, 16 May 2019 12:35:10 +0000 (+0200) Subject: bugfixes X-Git-Url: https://git.kitaultman.com/?a=commitdiff_plain;h=6c661d321e27a9aad2ac97c2f6f55fdb7f17fd46;p=music-assistant-server.git bugfixes --- diff --git a/music_assistant/modules/homeassistant.py b/music_assistant/modules/homeassistant.py index 7cb9dc97..16de0cb5 100644 --- a/music_assistant/modules/homeassistant.py +++ b/music_assistant/modules/homeassistant.py @@ -41,10 +41,10 @@ def setup(mass): def create_config_entries(config): ''' get the config entries for this module (list with key/value pairs)''' config_entries = [ - (CONF_ENABLED, False, CONF_ENABLED), - ('url', 'localhost', 'URL to homeassistant (e.g. https://homeassistant:8123)'), - ('token', '', 'Long Lived Access Token'), - ('publish_players', True, 'Publish players to Home Assistant') + (CONF_ENABLED, False, 'enabled'), + ('url', 'localhost', 'hass_url'), + ('token', '', 'hass_token'), + ('publish_players', True, 'hass_publish') ] if not config['base'].get('homeassistant'): config['base']['homeassistant'] = {} @@ -54,9 +54,9 @@ def create_config_entries(config): config['base']['homeassistant'][key] = def_value # append hass player config settings if config['base']['homeassistant'][CONF_ENABLED]: - hass_player_conf = [("hass_power_entity", "", "Attach player power to homeassistant entity"), - ("hass_power_entity_source", "", "Source on the homeassistant entity (optional)"), - ("hass_volume_entity", "", "Attach player volume to homeassistant entity")] + hass_player_conf = [("hass_power_entity", "", "hass_player_power"), + ("hass_power_entity_source", "", "hass_player_source"), + ("hass_volume_entity", "", "hass_player_volume")] for key, default, desc in hass_player_conf: entry_found = False for value in config['player_settings']['__desc__']: diff --git a/music_assistant/modules/musicproviders/file.py b/music_assistant/modules/musicproviders/file.py index 5342ee60..902151c3 100644 --- a/music_assistant/modules/musicproviders/file.py +++ b/music_assistant/modules/musicproviders/file.py @@ -28,8 +28,8 @@ def config_entries(): ''' get the config entries for this provider (list with key/value pairs)''' return [ (CONF_ENABLED, False, CONF_ENABLED), - ("music_dir", "", "Path to music files"), - ("playlists_dir", "", "Path to playlists") + ("music_dir", "", "file_prov_music_path"), + ("playlists_dir", "", "file_prov_playlists_path") ] class FileProvider(MusicProvider): diff --git a/music_assistant/modules/web.py b/music_assistant/modules/web.py index fbb9520e..295139b1 100755 --- a/music_assistant/modules/web.py +++ b/music_assistant/modules/web.py @@ -30,9 +30,9 @@ def setup(mass): def create_config_entries(config): ''' get the config entries for this module (list with key/value pairs)''' config_entries = [ - ('ssl_certificate', '', 'Path to ssl certificate file'), - ('ssl_key', '', 'Path to ssl keyfile'), - ('hostname', '', 'Hostname (FQDN used in the certificate)') + ('ssl_certificate', '', 'web_ssl_cert'), + ('ssl_key', '', 'web_ssl_key'), + ('hostname', '', 'web_ssl_host') ] if not config['base'].get('web'): config['base']['web'] = {} diff --git a/music_assistant/player.py b/music_assistant/player.py index a3d341bc..54d3959d 100755 --- a/music_assistant/player.py +++ b/music_assistant/player.py @@ -32,14 +32,14 @@ class Player(): def create_config_entries(self): ''' sets the config entries for this module (list with key/value pairs)''' self.mass.config['player_settings']['__desc__'] = [ - ("enabled", False, "Enable player"), - ("name", "", "Custom name for this player"), - ("group_parent", "", "Group this player to another player"), - ("mute_as_power", False, "Use muting as power control"), - ("disable_volume", False, "Disable volume controls"), - ("apply_group_volume", False, "Apply group volume to childs (for group players only)"), - ("apply_group_power", False, "Apply group power based on childs (for group players only)"), - ("play_power_on", False, "Issue play command on power on") + ("enabled", False, "player_enabled"), + ("name", "", "player_name"), + ("group_parent", "", "player_group_with"), + ("mute_as_power", False, "player_mute_power"), + ("disable_volume", False, "player_disable_vol"), + ("apply_group_volume", False, "player_group_vol"), + ("apply_group_power", False, "player_group_pow"), + ("play_power_on", False, "player_power_play") ] async def players(self): @@ -95,9 +95,16 @@ class Player(): ''' handle hass integration in player command ''' if not self.mass.hass: return - if cmd == 'power' and cmd_args == 'on' and player.settings.get('hass_power_entity') and player.settings.get('hass_power_entity_source'): - service_data = { 'entity_id': player.settings['hass_power_entity'], 'source':player.settings['hass_power_entity_source'] } - await self.mass.hass.call_service('media_player', 'select_source', service_data) + if cmd == 'power' and player.settings.get('hass_power_entity') and player.settings.get('hass_power_entity_source'): + cur_source = await self.mass.hass.get_state(player.settings['hass_power_entity'], attribute='source') + if cmd_args == 'on' and not cur_source: + service_data = { 'entity_id': player.settings['hass_power_entity'], 'source':player.settings['hass_power_entity_source'] } + await self.mass.hass.call_service('media_player', 'select_source', service_data) + elif cmd_args == 'off' and cur_source == player.settings['hass_power_entity_source']: + service_data = { 'entity_id': player.settings['hass_power_entity'] } + await self.mass.hass.call_service('media_player', 'turn_off', service_data) + else: + LOGGER.warning('Ignoring power command as required source is not active') elif cmd == 'power' and player.settings.get('hass_power_entity'): domain = player.settings['hass_power_entity'].split('.')[0] service_data = { 'entity_id': player.settings['hass_power_entity']} diff --git a/music_assistant/web/components/headermenu.vue.js b/music_assistant/web/components/headermenu.vue.js index 1fe2815b..5740e333 100755 --- a/music_assistant/web/components/headermenu.vue.js +++ b/music_assistant/web/components/headermenu.vue.js @@ -14,7 +14,8 @@ Vue.component("headermenu", { - + + menu @@ -23,8 +24,26 @@ Vue.component("headermenu", { arrow_back + + {{ $globals.windowtitle }} + - + + search + + + + + + + menu + + + arrow_back + + + + search @@ -38,13 +57,13 @@ Vue.component("headermenu", { return { menu: false, items: [ - { title: "Home", icon: "home", path: "/" }, - { title: "Artists", icon: "person", path: "/artists" }, - { title: "Albums", icon: "album", path: "/albums" }, - { title: "Tracks", icon: "audiotrack", path: "/tracks" }, - { title: "Playlists", icon: "playlist_play", path: "/playlists" }, - { title: "Search", icon: "search", path: "/search" }, - { title: "Config", icon: "settings", path: "/config" } + { title: this.$t('home'), icon: "home", path: "/" }, + { title: this.$t('artists'), icon: "person", path: "/artists" }, + { title: this.$t('albums'), icon: "album", path: "/albums" }, + { title: this.$t('tracks'), icon: "audiotrack", path: "/tracks" }, + { title: this.$t('playlists'), icon: "playlist_play", path: "/playlists" }, + { title: this.$t('search'), icon: "search", path: "/search" }, + { title: this.$t('settings'), icon: "settings", path: "/config" } ] } }, diff --git a/music_assistant/web/components/player.vue.js b/music_assistant/web/components/player.vue.js index 9bbfc1d7..f0a545ff 100755 --- a/music_assistant/web/components/player.vue.js +++ b/music_assistant/web/components/player.vue.js @@ -39,7 +39,7 @@ Vue.component("player", { queue_music - Queue + {{ $t('queue') }} @@ -116,9 +116,6 @@ Vue.component("player", { - - - diff --git a/music_assistant/web/components/searchbar.vue.js b/music_assistant/web/components/searchbar.vue.js deleted file mode 100644 index 5efcf043..00000000 --- a/music_assistant/web/components/searchbar.vue.js +++ /dev/null @@ -1,92 +0,0 @@ -Vue.component("searchbar", { - template: ` - - `, - data () { - return { - data: [], - searchQuery: '', - selected: null - } - }, - props: { - recentSearch: { - type: Array, - required: true - }, - newSearchQuery: { - type: String, - required: true - }, - settings: { - type: Object, - required: true - } - }, - mounted () { - this.searchQuery = this.settings.initialSearchQuery - this.onClickSearch() - }, - watch: { - searchQuery: { - handler: _.debounce(function (val) { - if (val === '') { - this.$store.commit('CLEAR_SEARCH') - } else { - if (val !== this.newSearchQuery) { - this.onClickSearch() - } - } - }, 1000) - }, - newSearchQuery (val) { - this.searchQuery = val - } - }, - computed: { - filteredDataArray () { - return this.recentSearch.filter(option => { - return ( - option - .toString() - .toLowerCase() - .indexOf(this.searchQuery.toLowerCase()) >= 0 - ) - }) - } - }, - methods: { - onClickSearch () { - this.$emit('clickSearch', this.searchQuery) - }, - onClickClearSearch () { - this.searchQuery = '' - this.$emit('clickClearSearch') - } - } -}) -/* */ \ No newline at end of file diff --git a/music_assistant/web/components/searchbox.vue.js b/music_assistant/web/components/searchbox.vue.js new file mode 100644 index 00000000..1570ab6c --- /dev/null +++ b/music_assistant/web/components/searchbox.vue.js @@ -0,0 +1,50 @@ +Vue.component("searchbox", { + template: ` + + + + + `, + data () { + return { + searchQuery: "", + } + }, + props: ['value'], + mounted () { + this.searchQuery = "" // TODO: set to last searchquery ? + }, + watch: { + searchQuery: { + handler: _.debounce(function (val) { + this.onSearch(); + // if (this.searchQuery) + // this.$globals.showsearchbox = false; + }, 1000) + }, + newSearchQuery (val) { + this.searchQuery = val + } + }, + computed: {}, + methods: { + onSearch () { + //this.$emit('clickSearch', this.searchQuery) + console.log(this.searchQuery); + router.push({ path: '/search', query: {searchQuery: this.searchQuery}}); + }, + } +}) +/* */ \ No newline at end of file diff --git a/music_assistant/web/index.html b/music_assistant/web/index.html index 3157ab83..33402515 100755 --- a/music_assistant/web/index.html +++ b/music_assistant/web/index.html @@ -20,7 +20,8 @@ - + + - - + + + @@ -131,6 +133,7 @@ + @@ -141,12 +144,15 @@ - + + +