Commit 73f1bdfb authored by Sébastien Toque's avatar Sébastien Toque

remove URL usage & duplicated code

(java.net.URL doesn't even recognize rtsp for instance)
parent 2b74b9f5
......@@ -20,9 +20,6 @@
package org.videolan.vlc;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashSet;
import android.content.Context;
......@@ -99,21 +96,11 @@ public class Media implements Comparable<Media> {
/**
* Create a new Media
* @param context Application context of the caller
* @param MRL the file's MRL (media resource locator)
* @param media URI
* @param addToDb Should it be added to the file database?
*/
public Media(Context context, String MRL, Boolean addToDb) {
mLocation = MRL;
try {
URL urlobj = new URL(MRL);
mFilename = urlobj.getFile().substring(urlobj.getFile().lastIndexOf('/') + 1);
/* empty filenames are awkward */
if (mFilename.equals("")) {
mFilename = urlobj.getHost();
}
} catch (MalformedURLException e1) {
mFilename = "";
}
public Media(Context context, String URI, Boolean addToDb) {
mLocation = URI;
LibVLC mLibVlc = null;
try {
......@@ -153,17 +140,6 @@ public class Media implements Comparable<Media> {
}
}
/**
* Create from file
*
* @param context Context of the caller
* @param file File object of the file to be added
*/
public Media(Context context, File file) {
this(context, Util.PathToURI(file.getPath()), true);
mFilename = file.getName().substring(0, file.getName().lastIndexOf('.'));
}
public Media(Context context, String location, long time, long length, int type,
Bitmap picture, String title, String artist, String genre, String album) {
mLocation = location;
......
......@@ -234,7 +234,7 @@ public class MediaLibrary {
}
} else {
// create new media item
mItemList.add(new Media(mContext, file));
mItemList.add(new Media(mContext, fileURI, true));
}
} else if (file.isDirectory()) {
directorys.push(file);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment