Android Open Source - mha-android Media Descriptor






From Project

Back to project page mha-android.

License

The source code is released under:

Copyright (c) 2011-2012 Cameron Porter, Ryan Brown http://github.com/camporter/mha-android Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated...

If you think the Android project mha-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.teamacra.myhomeaudio.media;
// w  ww.jav  a2s.  co m
import org.json.JSONException;
import org.json.JSONObject;

public class MediaDescriptor {
  private final int id;
  private final String title;
  private final String artist;
  private final String album;
  private final String genre;

  public MediaDescriptor(int id, String title, String artist, String album,
      String genre) {
    this.id = id;
    this.title = title;
    this.artist = artist;
    this.album = album;
    this.genre = genre;
  }

  public MediaDescriptor(int id) {
    this.id = id;
    this.title = null;
    this.artist = null;
    this.album = null;
    this.genre = null;
  }

  public MediaDescriptor(MediaDescriptor descriptor) {
    this.id = descriptor.id();
    this.title = descriptor.title();
    this.artist = descriptor.artist();
    this.album = descriptor.album();
    this.genre = descriptor.genre();
  }

  public int id() {
    return id;
  }

  public String title() {
    return title;
  }

  public String artist() {
    return artist;
  }

  public String album() {
    return album;
  }

  public String genre() {
    return genre;
  }

  /*
   * (non-Javadoc)
   * 
   * @see java.lang.Object#toString()
   */
  @Override
  public String toString() {
    return title;
  }
  
  public JSONObject toJSONObject() {
    JSONObject result = new JSONObject();
    
    try {
      result.put("id", id);
      result.put("title", title);
      result.put("artist", artist);
      result.put("album", album);
      result.put("genre", genre);
    } catch (JSONException e) {
      e.printStackTrace();
    }
    
    return result;
  }
}




Java Source Code List

com.teamacra.myhomeaudio.MHAApplication.java
com.teamacra.myhomeaudio.bluetooth.BluetoothService.java
com.teamacra.myhomeaudio.discovery.DiscoveryConstants.java
com.teamacra.myhomeaudio.discovery.DiscoveryDescription.java
com.teamacra.myhomeaudio.discovery.DiscoverySearchListener.java
com.teamacra.myhomeaudio.discovery.DiscoverySearch.java
com.teamacra.myhomeaudio.discovery.MDNSDiscovery.java
com.teamacra.myhomeaudio.http.HttpBase.java
com.teamacra.myhomeaudio.http.HttpClient.java
com.teamacra.myhomeaudio.http.HttpNode.java
com.teamacra.myhomeaudio.http.HttpSource.java
com.teamacra.myhomeaudio.http.HttpStream.java
com.teamacra.myhomeaudio.http.StatusCode.java
com.teamacra.myhomeaudio.locations.NodeSignalRange.java
com.teamacra.myhomeaudio.locations.NodeSignature.java
com.teamacra.myhomeaudio.manager.ConfigurationManager.java
com.teamacra.myhomeaudio.manager.LocationManager.java
com.teamacra.myhomeaudio.manager.NodeManager.java
com.teamacra.myhomeaudio.manager.StreamManager.java
com.teamacra.myhomeaudio.media.MediaDescriptor.java
com.teamacra.myhomeaudio.node.Node.java
com.teamacra.myhomeaudio.source.Source.java
com.teamacra.myhomeaudio.stream.StreamAction.java
com.teamacra.myhomeaudio.stream.Stream.java
com.teamacra.myhomeaudio.ui.InitialConfigActivity.java
com.teamacra.myhomeaudio.ui.LoginActivity.java
com.teamacra.myhomeaudio.ui.MyHomeAudioActivity.java
com.teamacra.myhomeaudio.ui.RegisterActivity.java
com.teamacra.myhomeaudio.ui.fragment.SongFragment.java
com.teamacra.myhomeaudio.ui.fragment.SourceFragment.java
com.teamacra.myhomeaudio.ui.fragment.TestFragment.java