Skip to content

Commit 09db50d

Browse files
meoyawnHaarigerHarald
authored andcommitted
Use proper beans (HaarigerHarald#39)
1 parent 4f51c90 commit 09db50d

File tree

6 files changed

+119
-4
lines changed

6 files changed

+119
-4
lines changed

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ buildscript {
55
jcenter()
66
}
77
dependencies {
8-
classpath 'com.android.tools.build:gradle:2.3.0'
8+
classpath 'com.android.tools.build:gradle:2.3.3'
99

1010
// NOTE: Do not place your application dependencies here; they belong
1111
// in the individual module build.gradle files

gradle/wrapper/gradle-wrapper.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0.1-all.zip

gradlew

100644100755
File mode changed.

youtubeExtractor/src/main/java/at/huber/youtubeExtractor/Format.java

+47
Original file line numberDiff line numberDiff line change
@@ -123,4 +123,51 @@ public int getHeight() {
123123
return height;
124124
}
125125

126+
@Override
127+
public boolean equals(Object o) {
128+
if (this == o) return true;
129+
if (o == null || getClass() != o.getClass()) return false;
130+
131+
Format format = (Format) o;
132+
133+
if (itag != format.itag) return false;
134+
if (height != format.height) return false;
135+
if (fps != format.fps) return false;
136+
if (audioBitrate != format.audioBitrate) return false;
137+
if (isDashContainer != format.isDashContainer) return false;
138+
if (isHlsContent != format.isHlsContent) return false;
139+
if (ext != null ? !ext.equals(format.ext) : format.ext != null) return false;
140+
if (vCodec != format.vCodec) return false;
141+
return aCodec == format.aCodec;
142+
143+
}
144+
145+
@Override
146+
public int hashCode() {
147+
int result = itag;
148+
result = 31 * result + (ext != null ? ext.hashCode() : 0);
149+
result = 31 * result + height;
150+
result = 31 * result + fps;
151+
result = 31 * result + (vCodec != null ? vCodec.hashCode() : 0);
152+
result = 31 * result + (aCodec != null ? aCodec.hashCode() : 0);
153+
result = 31 * result + audioBitrate;
154+
result = 31 * result + (isDashContainer ? 1 : 0);
155+
result = 31 * result + (isHlsContent ? 1 : 0);
156+
return result;
157+
}
158+
159+
@Override
160+
public String toString() {
161+
return "Format{" +
162+
"itag=" + itag +
163+
", ext='" + ext + '\'' +
164+
", height=" + height +
165+
", fps=" + fps +
166+
", vCodec=" + vCodec +
167+
", aCodec=" + aCodec +
168+
", audioBitrate=" + audioBitrate +
169+
", isDashContainer=" + isDashContainer +
170+
", isHlsContent=" + isHlsContent +
171+
'}';
172+
}
126173
}

youtubeExtractor/src/main/java/at/huber/youtubeExtractor/VideoMeta.java

+43-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ protected VideoMeta(String videoId, String title, String author, String channelI
2626
}
2727

2828

29-
3029
// 120 x 90
3130
public String getThumbUrl() {
3231
return IMAGE_BASE_URL + videoId + "/default.jpg";
@@ -83,4 +82,47 @@ public long getViewCount() {
8382
return viewCount;
8483
}
8584

85+
@Override
86+
public boolean equals(Object o) {
87+
if (this == o) return true;
88+
if (o == null || getClass() != o.getClass()) return false;
89+
90+
VideoMeta videoMeta = (VideoMeta) o;
91+
92+
if (videoLength != videoMeta.videoLength) return false;
93+
if (viewCount != videoMeta.viewCount) return false;
94+
if (isLiveStream != videoMeta.isLiveStream) return false;
95+
if (videoId != null ? !videoId.equals(videoMeta.videoId) : videoMeta.videoId != null)
96+
return false;
97+
if (title != null ? !title.equals(videoMeta.title) : videoMeta.title != null) return false;
98+
if (author != null ? !author.equals(videoMeta.author) : videoMeta.author != null)
99+
return false;
100+
return channelId != null ? channelId.equals(videoMeta.channelId) : videoMeta.channelId == null;
101+
102+
}
103+
104+
@Override
105+
public int hashCode() {
106+
int result = videoId != null ? videoId.hashCode() : 0;
107+
result = 31 * result + (title != null ? title.hashCode() : 0);
108+
result = 31 * result + (author != null ? author.hashCode() : 0);
109+
result = 31 * result + (channelId != null ? channelId.hashCode() : 0);
110+
result = 31 * result + (int) (videoLength ^ (videoLength >>> 32));
111+
result = 31 * result + (int) (viewCount ^ (viewCount >>> 32));
112+
result = 31 * result + (isLiveStream ? 1 : 0);
113+
return result;
114+
}
115+
116+
@Override
117+
public String toString() {
118+
return "VideoMeta{" +
119+
"videoId='" + videoId + '\'' +
120+
", title='" + title + '\'' +
121+
", author='" + author + '\'' +
122+
", channelId='" + channelId + '\'' +
123+
", videoLength=" + videoLength +
124+
", viewCount=" + viewCount +
125+
", isLiveStream=" + isLiveStream +
126+
'}';
127+
}
86128
}

youtubeExtractor/src/main/java/at/huber/youtubeExtractor/YtFile.java

+27-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,33 @@ public Format getFormat() {
2828
* Format data for the specific file.
2929
*/
3030
@Deprecated
31-
public Format getMeta(){
31+
public Format getMeta() {
3232
return format;
3333
}
34+
35+
@Override
36+
public boolean equals(Object o) {
37+
if (this == o) return true;
38+
if (o == null || getClass() != o.getClass()) return false;
39+
40+
YtFile ytFile = (YtFile) o;
41+
42+
if (format != null ? !format.equals(ytFile.format) : ytFile.format != null) return false;
43+
return url != null ? url.equals(ytFile.url) : ytFile.url == null;
44+
}
45+
46+
@Override
47+
public int hashCode() {
48+
int result = format != null ? format.hashCode() : 0;
49+
result = 31 * result + (url != null ? url.hashCode() : 0);
50+
return result;
51+
}
52+
53+
@Override
54+
public String toString() {
55+
return "YtFile{" +
56+
"format=" + format +
57+
", url='" + url + '\'' +
58+
'}';
59+
}
3460
}

0 commit comments

Comments
 (0)