Android Open Source - Android-Media-Library movie Details Datasource






From Project

Back to project page Android-Media-Library.

License

The source code is released under:

Apache License

If you think the Android project Android-Media-Library 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 grevian.MediaLibrary;
/*  w ww. j a v  a2 s. co  m*/
import java.util.HashMap;
import org.xmlrpc.android.XMLRPCClient;
import android.util.Log;

public class movieDetailsDatasource {
  @SuppressWarnings("unchecked")
  public static String getDetailsByTitle(String title)
  {
      String text = "";
      try
      {
        XMLRPCClient client = new XMLRPCClient("http://api.opensubtitles.org/xml-rpc");
        
        HashMap<String, String> loginResults = (HashMap<String, String>)client.call("LogIn", "", "", "CA", "GrevianMedia 0.1");
        String sessionToken = loginResults.get("token");
        
        String[][] args = { {"query", title} };
        HashMap<String, String> results = (HashMap<String, String>)client.call("SearchSubtitles", sessionToken, args);
        
          if  ( results.size() > 0 &&
              results.get("message").equalsIgnoreCase("Database entry found"))
          {
            // TODO: Do a query to get imdb details and shuffle them into an appropriate data structure
              text = results.get("description");
          }
          
          client.call("LogOut", sessionToken);
          
      }
      catch (Exception e)
      {
        Log.e("GrevianMedia", e.getMessage());
        return "";
      }
      
      return text;
  }
}




Java Source Code List

grevian.MediaLibrary.ItemFoundActivity.java
grevian.MediaLibrary.LookupException.java
grevian.MediaLibrary.MediaContentProvider.java
grevian.MediaLibrary.MediaFactory.java
grevian.MediaLibrary.MediaLibrary.java
grevian.MediaLibrary.Media.java
grevian.MediaLibrary.TextSearchAdapter.java
grevian.MediaLibrary.UPCDataSource.java
grevian.MediaLibrary.UPCRESTSource.java
grevian.MediaLibrary.movieDetailsDatasource.java
org.xmlrpc.android.Base64Coder.java
org.xmlrpc.android.XMLRPCClient.java
org.xmlrpc.android.XMLRPCException.java
org.xmlrpc.android.XMLRPCFault.java
org.xmlrpc.android.XMLRPCSerializer.java