made all arrays into lists
This commit is contained in:
parent
61471fdd3c
commit
1bf046a8ba
7 changed files with 40 additions and 31 deletions
|
|
@ -6,6 +6,7 @@ import org.xmlpull.v1.XmlPullParser;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
/**
|
||||
|
|
@ -36,7 +37,7 @@ public class DashMpdParser {
|
|||
}
|
||||
}
|
||||
|
||||
public static VideoInfo.AudioStream[] getAudioStreams(String dashManifestUrl,
|
||||
public static List<VideoInfo.AudioStream> getAudioStreams(String dashManifestUrl,
|
||||
Downloader downloader)
|
||||
throws DashMpdParsingException {
|
||||
String dashDoc;
|
||||
|
|
@ -96,6 +97,6 @@ public class DashMpdParser {
|
|||
} catch(Exception e) {
|
||||
throw new DashMpdParsingException("Could not parse Dash mpd", e);
|
||||
}
|
||||
return audioStreams.toArray(new VideoInfo.AudioStream[audioStreams.size()]);
|
||||
return audioStreams;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package org.schabi.newpipe.crawler;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
/**
|
||||
|
|
@ -29,7 +30,7 @@ public interface SearchEngine {
|
|||
class Result {
|
||||
public String errorMessage = "";
|
||||
public String suggestion = "";
|
||||
public final Vector<VideoPreviewInfo> resultList = new Vector<>();
|
||||
public final List<VideoPreviewInfo> resultList = new Vector<>();
|
||||
}
|
||||
|
||||
ArrayList<String> suggestionList(String query, Downloader dl)
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ package org.schabi.newpipe.crawler;
|
|||
* along with NewPipe. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import java.util.Vector;
|
||||
import java.util.List;
|
||||
|
||||
/**Scrapes information from a video streaming service (eg, YouTube).*/
|
||||
|
||||
|
|
@ -63,15 +63,15 @@ public interface VideoExtractor {
|
|||
public abstract String getUploadDate() throws ParsingException;
|
||||
public abstract String getThumbnailUrl() throws ParsingException;
|
||||
public abstract String getUploaderThumbnailUrl() throws ParsingException;
|
||||
public abstract VideoInfo.AudioStream[] getAudioStreams() throws ParsingException;
|
||||
public abstract VideoInfo.VideoStream[] getVideoStreams() throws ParsingException;
|
||||
public abstract List<VideoInfo.AudioStream> getAudioStreams() throws ParsingException;
|
||||
public abstract List<VideoInfo.VideoStream> getVideoStreams() throws ParsingException;
|
||||
public abstract String getDashMpdUrl() throws ParsingException;
|
||||
public abstract int getAgeLimit() throws ParsingException;
|
||||
public abstract String getAverageRating() throws ParsingException;
|
||||
public abstract int getLikeCount() throws ParsingException;
|
||||
public abstract int getDislikeCount() throws ParsingException;
|
||||
public abstract VideoPreviewInfo getNextVideo() throws ParsingException;
|
||||
public abstract Vector<VideoPreviewInfo> getRelatedVideos() throws ParsingException;
|
||||
public abstract List<VideoPreviewInfo> getRelatedVideos() throws ParsingException;
|
||||
public abstract VideoUrlIdHandler getUrlIdConverter();
|
||||
public abstract String getPageUrl();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package org.schabi.newpipe.crawler;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
/**
|
||||
* Created by Christian Schabesberger on 26.08.15.
|
||||
|
|
@ -48,10 +49,11 @@ public class VideoInfo extends AbstractVideoInfo {
|
|||
/** Load and extract audio*/
|
||||
videoInfo.audioStreams = extractor.getAudioStreams();
|
||||
if(videoInfo.dashMpdUrl != null && !videoInfo.dashMpdUrl.isEmpty()) {
|
||||
if(videoInfo.audioStreams == null || videoInfo.audioStreams.length == 0) {
|
||||
videoInfo.audioStreams =
|
||||
DashMpdParser.getAudioStreams(videoInfo.dashMpdUrl, downloader);
|
||||
if(videoInfo.audioStreams == null) {
|
||||
videoInfo.audioStreams = new Vector<AudioStream>();
|
||||
}
|
||||
videoInfo.audioStreams.addAll(
|
||||
DashMpdParser.getAudioStreams(videoInfo.dashMpdUrl, downloader));
|
||||
}
|
||||
/** Extract video stream url*/
|
||||
videoInfo.videoStreams = extractor.getVideoStreams();
|
||||
|
|
@ -73,8 +75,8 @@ public class VideoInfo extends AbstractVideoInfo {
|
|||
public String uploader_thumbnail_url = "";
|
||||
public String description = "";
|
||||
/*todo: make this lists over vectors*/
|
||||
public VideoStream[] videoStreams = null;
|
||||
public AudioStream[] audioStreams = null;
|
||||
public List<VideoStream> videoStreams = null;
|
||||
public List<AudioStream> audioStreams = null;
|
||||
// video streams provided by the dash mpd do not need to be provided as VideoStream.
|
||||
// Later on this will also aplly to audio streams. Since dash mpd is standarized,
|
||||
// crawling such a file is not service dependent. Therefore getting audio only streams by yust
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import org.schabi.newpipe.crawler.VideoPreviewInfo;
|
|||
import java.io.IOException;
|
||||
import java.net.URLDecoder;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Vector;
|
||||
|
||||
|
|
@ -251,13 +252,13 @@ public class YoutubeVideoExtractor implements VideoExtractor {
|
|||
}
|
||||
|
||||
@Override
|
||||
public VideoInfo.AudioStream[] getAudioStreams() throws ParsingException {
|
||||
public List<VideoInfo.AudioStream> getAudioStreams() throws ParsingException {
|
||||
/* If we provide a valid dash manifest, we don't need to provide audio streams extra */
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VideoInfo.VideoStream[] getVideoStreams() throws ParsingException {
|
||||
public List<VideoInfo.VideoStream> getVideoStreams() throws ParsingException {
|
||||
Vector<VideoInfo.VideoStream> videoStreams = new Vector<>();
|
||||
try{
|
||||
String encoded_url_map = playerArgs.getString("url_encoded_fmt_stream_map");
|
||||
|
|
@ -298,7 +299,7 @@ public class YoutubeVideoExtractor implements VideoExtractor {
|
|||
throw new ParsingException("Failed to get any video stream");
|
||||
}
|
||||
|
||||
return videoStreams.toArray(new VideoInfo.VideoStream[videoStreams.size()]);
|
||||
return videoStreams;
|
||||
}
|
||||
|
||||
/**Attempts to parse (and return) the offset to start playing the video from.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue