2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.vizio.internal.appdb;
15 import static org.openhab.binding.vizio.internal.VizioBindingConstants.*;
17 import java.io.IOException;
18 import java.io.InputStream;
19 import java.nio.charset.StandardCharsets;
21 import org.eclipse.jdt.annotation.NonNullByDefault;
22 import org.osgi.service.component.annotations.Activate;
23 import org.osgi.service.component.annotations.Component;
24 import org.slf4j.Logger;
25 import org.slf4j.LoggerFactory;
28 * The {@link VizioAppDbService} class makes available a JSON list of known apps on Vizio TVs.
30 * @author Michael Lobstein - Initial Contribution
33 @Component(service = VizioAppDbService.class)
35 public class VizioAppDbService {
36 private final Logger logger = LoggerFactory.getLogger(VizioAppDbService.class);
37 private String vizioAppsJson;
40 public VizioAppDbService() {
42 InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("/db/apps.json");
44 vizioAppsJson = new String(is.readAllBytes(), StandardCharsets.UTF_8);
46 vizioAppsJson = EMPTY;
48 } catch (IOException e) {
49 logger.warn("Unable to load Vizio app list : {}", e.getMessage());
50 vizioAppsJson = EMPTY;
54 public String getVizioAppsJson() {