all repos — tmdb-desktop-client @ b820fcafd3dc14e660da50e6017c651dab89e38c

A simple tmdb desktop client written in Java

Works
Prashant Jha prashant.kumarjha63@gmail.com
Wed, 01 May 2019 18:18:26 +0530
commit

b820fcafd3dc14e660da50e6017c651dab89e38c

parent

dbb011e0d83f3ec60650896845fae941b0885d48

M src/com/oocpro/tmdbdesktop/Main.javasrc/com/oocpro/tmdbdesktop/Main.java

@@ -1,15 +1,23 @@

package com.oocpro.tmdbdesktop; import com.oocpro.tmdbdesktop.tmdb.Movie; +import com.oocpro.tmdbdesktop.tmdb.Search; import java.io.IOException; +import java.io.InputStreamReader; +import java.io.BufferedReader; + public class Main{ public static void main (String [] args)throws IOException{ - Movie ring = new Movie(565); - System.out.println(ring.title + " ("+ring.year+")"); - System.out.println("Plotline: " + ring.plotline); - System.out.println("Genres: " + ring.genres); - System.out.println("Rating: " + ring.rating); + System.out.println("Enter a movie name to search "); + BufferedReader mname = new BufferedReader(new InputStreamReader(System.in)); + String Mov_name = mname.readLine(); + Search mv = new Search(Mov_name); + Movie det = new Movie(Search.IDs.get(1)); + System.out.println(det.title + " ("+det.year+")"); + System.out.println("Plotline: " + det.plotline); + System.out.println("Genres: " + det.genres); + System.out.println("Rating: " + det.rating); } }
M src/com/oocpro/tmdbdesktop/tmdb/Movie.javasrc/com/oocpro/tmdbdesktop/tmdb/Movie.java

@@ -23,7 +23,7 @@ public Movie(int id)throws IOException, MalformedURLException{

String geturl = MOVIEBASEURL+id+"?api_key="+Constants.API_KEY; InputStream res = (InputStream)new URL(geturl).getContent(); JSONObject movie = new JSONObject(new JSONTokener(res)); - System.out.println(movie.toString(1)); + //System.out.println(movie.toString(1)); genres = new ArrayList<String>(); Iterator genres_itr = movie.getJSONArray("genres").iterator();
M src/com/oocpro/tmdbdesktop/tmdb/Search.javasrc/com/oocpro/tmdbdesktop/tmdb/Search.java

@@ -11,12 +11,8 @@ import java.util.Iterator;

import java.util.List; public class Search{ - static String MOVIE_NAME; - public List<Integer> IDs; - public Search()throws IOException,MalformedURLException{ //CONSTRUCTOR TO INITIALISE MOVIE ID - System.out.println("ENTER MOVIE NAME TO SEARCH "); - BufferedReader mnm = new BufferedReader(new InputStreamReader(System.in)); - MOVIE_NAME = mnm.readLine(); + public static List<Integer> IDs; + public Search(String MOVIE_NAME)throws IOException,MalformedURLException{ //CONSTRUCTOR TO INITIALISE MOVIE ID String s_url=Constants.BASEURL+"/search/movie?api_key="+Constants.API_KEY+"&language=en-US&query=%s"; //General URL format for finding a movie String url=String.format(s_url,MOVIE_NAME); //Adding the query System.out.println("URL = "+url);

@@ -32,7 +28,7 @@ JSONObject id = (JSONObject)IDS_itr.next();

IDs.add(id.getInt("id")); } - System.out.println(IDs + " "); + //System.out.println(IDs.get(1) + " "); //System.out.println(ja.toString(1));

@@ -41,9 +37,9 @@ //System.out.println(" "+ja.getInt("total_pages"));

} - public static void main(String args[])throws IOException{ - Search sc = new Search(); - } + //public static void main(String args[])throws IOException{ + // Search sc = new Search(); + //} }