/**
   * 解析歌词通过数据流
   *
   * @param kscInputStream
   * @throws IOException
   * @throws NumberFormatException
   */
  public static void parserKscLyricsByKscInputStream(
      String sid, InputStream kscInputStream, int type) throws NumberFormatException, IOException {
    mSid = sid;
    if (mKscLyricsParser == null) {
      mKscLyricsParser = new KscLyricsParserUtil();
    }
    BufferedReader br = new BufferedReader(new InputStreamReader(kscInputStream, "GB2312"));
    mKscLyricsParser.parserksc(br);

    SongMessage songMessage = new SongMessage();

    if (type == SongMessage.KSCTYPELRC) {

      songMessage.setType(SongMessage.LRCKSCDOWNLOADED);
    } else if (type == SongMessage.KSCTYPEDES) {

      songMessage.setType(SongMessage.DESKSCDOWNLOADED);
    } else if (type == SongMessage.KSCTYPELOCK) {

      songMessage.setType(SongMessage.LOCKKSCDOWNLOADED);
    }
    // songMessage.setKscFilePath(kscFilePath);
    songMessage.setSid(sid);
    // 通知
    ObserverManage.getObserver().setMessage(songMessage);
  }
Пример #2
0
  /**
   * 加载ksc歌词文件
   *
   * @param context
   * @param sid
   * @param title
   * @param singer
   * @param kscUrl
   */
  public static void loadKsc(
      String sid, String title, String singer, String displayName, String kscUrl, int type) {
    // 先判断本地有没有歌词文件
    // 如果有,则加载歌词文件
    // 如果没有,则判断kscUrl是否为空
    // 如果kscUrl为空,则从服务器获取kscUrl的路径,然后下载ksc歌词文件
    // 如果kscUrl不为空,则直接下载ksc歌词文件

    String kscFilePath = Constants.PATH_KSC + File.separator + displayName + ".ksc";

    File kscFile = new File(kscFilePath);
    if (!kscFile.exists()) {
      return;
    } else {

      SongMessage songMessage = new SongMessage();

      if (type == SongMessage.KSCTYPELRC) {

        songMessage.setType(SongMessage.LRCKSCLOADED);
      } else if (type == SongMessage.KSCTYPEDES) {

        songMessage.setType(SongMessage.DESKSCLOADED);
      } else if (type == SongMessage.KSCTYPELOCK) {

        songMessage.setType(SongMessage.LOCKKSCLOADED);
      }

      songMessage.setKscFilePath(kscFilePath);
      songMessage.setSid(sid);
      // 通知
      ObserverManage.getObserver().setMessage(songMessage);
    }
  }