예제 #1
0
파일: Media.java 프로젝트: vyloy/lnvc
  public Media(
      Context context,
      String location,
      long time,
      long length,
      int type,
      Bitmap picture,
      String title,
      String artist,
      String genre,
      String album,
      int width,
      int height,
      String artworkURL) {
    mLocation = location;
    mFilename = null;
    mTime = time;
    mLength = length;
    mType = type;
    mPicture = picture;
    mWidth = width;
    mHeight = height;

    mTitle = title;
    mArtist = Util.getValue(artist, R.string.unknown_artist);
    mGenre = Util.getValue(genre, R.string.unknown_genre);
    mAlbum = Util.getValue(album, R.string.unknown_album);
    mArtworkURL = artworkURL;
  }
예제 #2
0
파일: Media.java 프로젝트: vyloy/lnvc
  private void extractTrackInfo(TrackInfo[] tracks) {
    if (tracks == null) return;

    for (TrackInfo track : tracks) {
      if (track.Type == TrackInfo.TYPE_VIDEO) {
        mType = TYPE_VIDEO;
        mWidth = track.Width;
        mHeight = track.Height;
      } else if (mType == TYPE_ALL && track.Type == TrackInfo.TYPE_AUDIO) {
        mType = TYPE_AUDIO;
      } else if (track.Type == TrackInfo.TYPE_META) {
        mLength = track.Length;
        mTitle = track.Title;
        mArtist = Util.getValue(track.Artist, R.string.unknown_artist);
        mAlbum = Util.getValue(track.Album, R.string.unknown_album);
        mGenre = Util.getValue(track.Genre, R.string.unknown_genre);
        mArtworkURL = track.ArtworkURL;
        Log.d(TAG, "Title " + mTitle);
        Log.d(TAG, "Artist " + mArtist);
        Log.d(TAG, "Genre " + mGenre);
        Log.d(TAG, "Album " + mAlbum);
      }
    }

    /* No useful ES found */
    if (mType == TYPE_ALL) {
      int dotIndex = mLocation.lastIndexOf(".");
      if (dotIndex != -1) {
        String fileExt = mLocation.substring(dotIndex);
        if (Media.VIDEO_EXTENSIONS.contains(fileExt)) {
          mType = TYPE_VIDEO;
        } else if (Media.AUDIO_EXTENSIONS.contains(fileExt)) {
          mType = TYPE_AUDIO;
        }
      }
    }
  }