Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Casanowow Life for love
VLC-Android
Commits
73f1bdfb
Commit
73f1bdfb
authored
Apr 04, 2012
by
Sébastien Toque
Browse files
remove URL usage & duplicated code
(java.net.URL doesn't even recognize rtsp for instance)
parent
2b74b9f5
Changes
2
Hide whitespace changes
Inline
Side-by-side
vlc-android/src/org/videolan/vlc/Media.java
View file @
73f1bdfb
...
...
@@ -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
;
...
...
vlc-android/src/org/videolan/vlc/MediaLibrary.java
View file @
73f1bdfb
...
...
@@ -234,7 +234,7 @@ public class MediaLibrary {
}
}
else
{
// create new media item
mItemList
.
add
(
new
Media
(
mContext
,
file
));
mItemList
.
add
(
new
Media
(
mContext
,
file
URI
,
true
));
}
}
else
if
(
file
.
isDirectory
())
{
directorys
.
push
(
file
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment