-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTMDBMainHandler.java
More file actions
138 lines (80 loc) · 2.68 KB
/
Copy pathTMDBMainHandler.java
File metadata and controls
138 lines (80 loc) · 2.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
package cs249.finalProject;
import java.io.IOException;
import java.net.URLEncoder;
public class TMDBMainHandler {
TMDBConfiguration tmdb;
HttpConnectionHandler handler;
public TMDBMainHandler() {
tmdb = new TMDBConfiguration();
System.out.println(tmdb.getBase_URL());
handler = new HttpConnectionHandler();
// TODO Auto-generated constructor stub
}
public String returnBackDropImageUrl(String image) {
return tmdb.getImage_Base_URL()+tmdb.getBackdrop()+image;
}
public String returnLogoImageUrl(String image) {
return tmdb.getImage_Base_URL()+tmdb.getLogo()+image;
}
public String returnPosterImageUrl(String image) {
return tmdb.getImage_Base_URL()+tmdb.getPoster()+image;
}
public String returnProfileImageUrl(String image) {
return tmdb.getImage_Base_URL()+tmdb.getProfile()+image;
}public String returnStillImageUrl(String image) {
return tmdb.getImage_Base_URL()+tmdb.getStill()+image;
}
//Movie methods
public String searchMovies(String title, int year,String page) {
String Result = "null";
return Result;
}
public String searchMovies(String title, String page) {
String Result = "null";
return Result;
}
public String searchMovies(String title, int year) {
String Result = "null";
return Result;
}
public String searchMovies(String title ) throws IOException
{
String strResponse = handler.getInformation("https://api.themoviedb.org/3/search/movie?api_key=2960a8435920b05de4baa37a54f3b79d&language=en-US&query=" + URLEncoder.encode(title) + "&page=1&include_adult=false");
//System.out.println(strResponse);
return strResponse;
}
public String getMovie(int id)
{
String searchURL = tmdb.getBase_URL() + "movie/" + id + "?api_key=" + tmdb.getApiKey() + "&language=" + tmdb.getLanguage();
String strResponse = null;
try
{
strResponse = handler.getInformation(searchURL);
}catch (IOException ex)
{
ex.printStackTrace();
}
return strResponse;
}
//TVMethods
public String searchTVShows(String title, int year,String page) {
String Result = "null";
return Result;
}
public String searchTVShows(String title, String page) {
String Result = "null";
return Result;
}
public String searchTVShows(String title, int year) {
String Result = "null";
return Result;
}
public String searchTVShows(String title ) {
StringBuilder Result = new StringBuilder();
return Result.toString();
}
public String getTV(int id) {
String Result = "null";
return Result;
}
}