Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
VLC-Android
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
315
Issues
315
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
VideoLAN
VLC-Android
Commits
2b74b9f5
Commit
2b74b9f5
authored
Apr 04, 2012
by
Sébastien Toque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only decode filename from uri when it's actually used
parent
0bf07d9a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
7 deletions
+14
-7
vlc-android/src/org/videolan/vlc/DatabaseManager.java
vlc-android/src/org/videolan/vlc/DatabaseManager.java
+2
-4
vlc-android/src/org/videolan/vlc/Media.java
vlc-android/src/org/videolan/vlc/Media.java
+6
-3
vlc-android/src/org/videolan/vlc/Util.java
vlc-android/src/org/videolan/vlc/Util.java
+6
-0
No files found.
vlc-android/src/org/videolan/vlc/DatabaseManager.java
View file @
2b74b9f5
...
@@ -305,8 +305,7 @@ public class DatabaseManager {
...
@@ -305,8 +305,7 @@ public class DatabaseManager {
picture
=
BitmapFactory
.
decodeByteArray
(
blob
,
0
,
blob
.
length
);
picture
=
BitmapFactory
.
decodeByteArray
(
blob
,
0
,
blob
.
length
);
}
}
String
location
=
cursor
.
getString
(
8
);
String
location
=
cursor
.
getString
(
8
);
File
file
=
Util
.
URItoFile
(
location
);
Media
media
=
new
Media
(
context
,
location
,
Media
media
=
new
Media
(
context
,
location
,
file
.
getName
().
substring
(
0
,
file
.
getName
().
lastIndexOf
(
'.'
)),
cursor
.
getLong
(
0
),
cursor
.
getLong
(
1
),
cursor
.
getInt
(
2
),
cursor
.
getLong
(
0
),
cursor
.
getLong
(
1
),
cursor
.
getInt
(
2
),
picture
,
cursor
.
getString
(
4
),
picture
,
cursor
.
getString
(
4
),
cursor
.
getString
(
5
),
cursor
.
getString
(
6
),
cursor
.
getString
(
5
),
cursor
.
getString
(
6
),
...
@@ -353,8 +352,7 @@ public class DatabaseManager {
...
@@ -353,8 +352,7 @@ public class DatabaseManager {
if
(
blob
!=
null
)
{
if
(
blob
!=
null
)
{
picture
=
BitmapFactory
.
decodeByteArray
(
blob
,
0
,
blob
.
length
);
picture
=
BitmapFactory
.
decodeByteArray
(
blob
,
0
,
blob
.
length
);
}
}
File
file
=
Util
.
URItoFile
(
location
);
media
=
new
Media
(
context
,
location
,
media
=
new
Media
(
context
,
location
,
file
.
getName
().
substring
(
0
,
file
.
getName
().
lastIndexOf
(
'.'
)),
cursor
.
getLong
(
0
),
cursor
.
getLong
(
1
),
cursor
.
getInt
(
2
),
cursor
.
getLong
(
0
),
cursor
.
getLong
(
1
),
cursor
.
getInt
(
2
),
picture
,
cursor
.
getString
(
4
),
picture
,
cursor
.
getString
(
4
),
cursor
.
getString
(
5
),
cursor
.
getString
(
6
),
cursor
.
getString
(
5
),
cursor
.
getString
(
6
),
...
...
vlc-android/src/org/videolan/vlc/Media.java
View file @
2b74b9f5
...
@@ -164,10 +164,10 @@ public class Media implements Comparable<Media> {
...
@@ -164,10 +164,10 @@ public class Media implements Comparable<Media> {
mFilename
=
file
.
getName
().
substring
(
0
,
file
.
getName
().
lastIndexOf
(
'.'
));
mFilename
=
file
.
getName
().
substring
(
0
,
file
.
getName
().
lastIndexOf
(
'.'
));
}
}
public
Media
(
Context
context
,
String
location
,
String
filename
,
long
time
,
long
length
,
int
type
,
public
Media
(
Context
context
,
String
location
,
long
time
,
long
length
,
int
type
,
Bitmap
picture
,
String
title
,
String
artist
,
String
genre
,
String
album
)
{
Bitmap
picture
,
String
title
,
String
artist
,
String
genre
,
String
album
)
{
mLocation
=
location
;
mLocation
=
location
;
mFilename
=
filename
;
mFilename
=
null
;
mTime
=
time
;
mTime
=
time
;
mLength
=
length
;
mLength
=
length
;
mType
=
type
;
mType
=
type
;
...
@@ -196,6 +196,9 @@ public class Media implements Comparable<Media> {
...
@@ -196,6 +196,9 @@ public class Media implements Comparable<Media> {
}
}
public
String
getFileName
()
{
public
String
getFileName
()
{
if
(
mFilename
==
null
)
{
mFilename
=
Util
.
URItoFileName
(
mLocation
);
}
return
mFilename
;
return
mFilename
;
}
}
...
@@ -240,7 +243,7 @@ public class Media implements Comparable<Media> {
...
@@ -240,7 +243,7 @@ public class Media implements Comparable<Media> {
if
(
mTitle
!=
null
)
if
(
mTitle
!=
null
)
return
mTitle
;
return
mTitle
;
else
else
return
mFilename
;
return
getFileName
()
;
}
}
public
String
getArtist
()
{
public
String
getArtist
()
{
...
...
vlc-android/src/org/videolan/vlc/Util.java
View file @
2b74b9f5
...
@@ -45,6 +45,12 @@ public class Util {
...
@@ -45,6 +45,12 @@ public class Util {
return
new
File
(
Uri
.
decode
(
URI
).
replace
(
"file://"
,
""
));
return
new
File
(
Uri
.
decode
(
URI
).
replace
(
"file://"
,
""
));
}
}
public
static
String
URItoFileName
(
String
URI
)
{
int
sep
=
URI
.
lastIndexOf
(
'/'
);
int
dot
=
URI
.
lastIndexOf
(
'.'
);
return
Uri
.
decode
(
URI
.
substring
(
sep
+
1
,
dot
));
}
public
static
String
PathToURI
(
String
path
)
{
public
static
String
PathToURI
(
String
path
)
{
String
URI
;
String
URI
;
try
{
try
{
...
...
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