|
26 | 26 | import ai.olami.ids.IDSResult; |
27 | 27 | import ai.olami.ids.JokeData; |
28 | 28 | import ai.olami.ids.MathData; |
| 29 | +import ai.olami.ids.MusicControlData; |
29 | 30 | import ai.olami.ids.NewsData; |
| 31 | +import ai.olami.ids.KKBOXData; |
| 32 | +import ai.olami.ids.KKBOXDataPhoto; |
30 | 33 | import ai.olami.ids.OpenWebData; |
31 | 34 | import ai.olami.ids.PoemData; |
32 | 35 | import ai.olami.ids.StockMarketData; |
@@ -144,6 +147,93 @@ public static void dumpIDSData(NLIResult nliResult) { |
144 | 147 | } |
145 | 148 | } |
146 | 149 |
|
| 150 | + // ******************************************************************** |
| 151 | + // * KKBOX EXAMPLE |
| 152 | + // *------------------------------------------------------------------- |
| 153 | + // * Simplified Chinese (China): ** 简体中文服务地区尚不支持此模块 ** |
| 154 | + // * Traditional Chinese (Taiwan): 我要聽音樂 |
| 155 | + // ******************************************************************** |
| 156 | + // * Check to see if contains IDS KKBOX data |
| 157 | + if (nliResult.getType().equals(IDSResult.Types.KKBOX.getName())) { |
| 158 | + // Get all of KKBOXData into ArrayList. |
| 159 | + ArrayList<KKBOXData> dataArray = nliResult.getDataObjects(); |
| 160 | + for (int x = 0; x < dataArray.size(); x++) { |
| 161 | + System.out.format("|\t- IDS KKBOX Data[%s] :\n", x); |
| 162 | + System.out.format("|\t\t- ID: %s\n", |
| 163 | + dataArray.get(x).getID()); |
| 164 | + System.out.format("|\t\t- Duration: %s\n", |
| 165 | + dataArray.get(x).getDuration()); |
| 166 | + System.out.format("|\t\t- Title: %s\n", |
| 167 | + dataArray.get(x).getTitle()); |
| 168 | + System.out.format("|\t\t- Artist: [ID=%s], %s\n", |
| 169 | + dataArray.get(x).getArtistID(), dataArray.get(x).getArtist()); |
| 170 | + System.out.format("|\t\t- Album: [ID=%s], %s\n", |
| 171 | + dataArray.get(x).getAlbumID(), dataArray.get(x).getAlbum()); |
| 172 | + System.out.format("|\t\t- URL: %s\n", |
| 173 | + dataArray.get(x).getURL()); |
| 174 | + // List photos |
| 175 | + if (dataArray.get(x).hasPhotos()) { |
| 176 | + KKBOXDataPhoto[] photoArray = dataArray.get(x).getPhotos(); |
| 177 | + for (int i = 0; i < photoArray.length; i++) { |
| 178 | + System.out.format("|\t\t- Photo[%s]:\n", i); |
| 179 | + System.out.format("|\t\t\t- Width:%s , Hight:%s\n", |
| 180 | + photoArray[i].getWidth(), photoArray[i].getHeight()); |
| 181 | + System.out.format("|\t\t\t- URL:%s\n", |
| 182 | + photoArray[i].getURL()); |
| 183 | + } |
| 184 | + } |
| 185 | + } |
| 186 | + } |
| 187 | + |
| 188 | + // ******************************************************************** |
| 189 | + // * MUSIC CONTROL EXAMPLE |
| 190 | + // *------------------------------------------------------------------- |
| 191 | + // * Simplified Chinese (China): 下一首 |
| 192 | + // * Traditional Chinese (Taiwan): 下一首 |
| 193 | + // ******************************************************************** |
| 194 | + // * Check to see if contains IDS MusicControl data |
| 195 | + if (nliResult.getType().equals(IDSResult.Types.MUSIC_CONTROL.getName())) { |
| 196 | + // Get all of MusicControlData into ArrayList. |
| 197 | + ArrayList<MusicControlData> dataArray = nliResult.getDataObjects(); |
| 198 | + for (int x = 0; x < dataArray.size(); x++) { |
| 199 | + System.out.format("|\t- IDS MusicControl Data[%s] :\n", x); |
| 200 | + System.out.format("|\t\t- Index: %s\n", |
| 201 | + (dataArray.get(x).hasIndex() ? dataArray.get(x).getIndex() : "NO INDEX, [It means based on current/previous index] ")); |
| 202 | + System.out.format("|\t\t- Command: %s \n", |
| 203 | + dataArray.get(x).getCommand()); |
| 204 | + if (dataArray.get(x).getCommand().equals(MusicControlData.NEXT)) { |
| 205 | + System.out.println("|\t\t <播放下一首 / 播放下一首>"); |
| 206 | + } |
| 207 | + if (dataArray.get(x).getCommand().equals(MusicControlData.PREVIOUS)) { |
| 208 | + System.out.println("|\t\t <播放上一首 / 播放上一首>"); |
| 209 | + } |
| 210 | + if (dataArray.get(x).getCommand().equals(MusicControlData.PAUSE)) { |
| 211 | + System.out.println("|\t\t <暂停播放 / 暫停播放>"); |
| 212 | + } |
| 213 | + if (dataArray.get(x).getCommand().equals(MusicControlData.PLAY)) { |
| 214 | + System.out.println("|\t\t <开始播放 / 開始播放>"); |
| 215 | + } |
| 216 | + if (dataArray.get(x).getCommand().equals(MusicControlData.RANDOM)) { |
| 217 | + System.out.println("|\t\t <随机播放模式 / 隨機播放模式>"); |
| 218 | + } |
| 219 | + if (dataArray.get(x).getCommand().equals(MusicControlData.LOOP)) { |
| 220 | + System.out.println("|\t\t <循环播放模式 / 循環播放模式>"); |
| 221 | + } |
| 222 | + if (dataArray.get(x).getCommand().equals(MusicControlData.ORDER)) { |
| 223 | + System.out.println("|\t\t <顺序播放模式 / 順序播放模式>"); |
| 224 | + } |
| 225 | + if (dataArray.get(x).getCommand().equals(MusicControlData.MUTE)) { |
| 226 | + System.out.println("|\t\t <设置为静音 / 設置為靜音>"); |
| 227 | + } |
| 228 | + if (dataArray.get(x).getCommand().equals(MusicControlData.VOLUME_UP)) { |
| 229 | + System.out.println("|\t\t <音量增大 / 音量增大>"); |
| 230 | + } |
| 231 | + if (dataArray.get(x).getCommand().equals(MusicControlData.VOLUME_DOWN)) { |
| 232 | + System.out.println("|\t\t <音量减小 / 音量減小>"); |
| 233 | + } |
| 234 | + } |
| 235 | + } |
| 236 | + |
147 | 237 | // ******************************************************************** |
148 | 238 | // * TV PROGRAM EXAMPLE |
149 | 239 | // *------------------------------------------------------------------- |
|
0 commit comments