Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
VideoLAN
VLC-iOS
Commits
4247bc24
Commit
4247bc24
authored
Feb 17, 2015
by
Felix Paul Kühne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix last playback position lookup when media is stored in a logical folder
parent
2cdb6ea2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
4 deletions
+29
-4
Sources/VLCMovieViewController.m
Sources/VLCMovieViewController.m
+29
-4
No files found.
Sources/VLCMovieViewController.m
View file @
4247bc24
...
...
@@ -639,11 +639,36 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
if
(
self
.
fileFromMediaLibrary
)
matchedFile
=
self
.
fileFromMediaLibrary
;
else
if
(
self
.
mediaList
)
{
NSArray
*
matches
=
[
MLFile
fileForURL
:[[[
self
.
mediaList
mediaAtIndex
:
self
.
itemInMediaListToBePlayedFirst
]
url
]
absoluteString
]];
if
(
matches
.
count
>
0
)
{
matchedFile
=
matches
[
0
];
lastPosition
=
matchedFile
.
lastPosition
.
floatValue
;
/* TODO: move this code to MLKit */
NSString
*
path
=
[[[
self
.
mediaList
mediaAtIndex
:
self
.
itemInMediaListToBePlayedFirst
]
url
]
absoluteString
];
NSString
*
componentString
=
@""
;
NSArray
*
pathComponents
=
[
path
componentsSeparatedByString
:
@"/"
];
NSUInteger
componentCount
=
pathComponents
.
count
;
if
([
pathComponents
[
componentCount
-
2
]
isEqualToString
:
@"Documents"
])
componentString
=
[
path
lastPathComponent
];
else
{
NSUInteger
firstElement
=
[
pathComponents
indexOfObject
:
@"Documents"
]
+
1
;
for
(
NSUInteger
x
=
0
;
x
<
componentCount
-
firstElement
;
x
++
)
{
if
(
x
==
0
)
componentString
=
[
componentString
stringByAppendingFormat
:
@"%@"
,
pathComponents
[
firstElement
+
x
]];
else
componentString
=
[
componentString
stringByAppendingFormat
:
@"/%@"
,
pathComponents
[
firstElement
+
x
]];
}
}
NSFetchRequest
*
request
=
[[
NSFetchRequest
alloc
]
init
];
NSManagedObjectContext
*
moc
=
[[
MLMediaLibrary
sharedMediaLibrary
]
managedObjectContext
];
NSEntityDescription
*
entity
=
[
NSEntityDescription
entityForName
:
@"File"
inManagedObjectContext
:
moc
];
[
request
setEntity
:
entity
];
[
request
setPredicate
:[
NSPredicate
predicateWithFormat
:
@"url CONTAINS %@"
,
componentString
]];
NSSortDescriptor
*
descriptor
=
[[
NSSortDescriptor
alloc
]
initWithKey
:
@"title"
ascending
:
YES
selector
:
@selector
(
localizedCaseInsensitiveCompare
:
)];
[
request
setSortDescriptors
:@[
descriptor
]];
NSArray
*
matches
=
[
moc
executeFetchRequest
:
request
error
:
nil
];
if
(
matches
.
count
>
0
)
matchedFile
=
matches
[
0
];
}
if
(
matchedFile
.
lastPosition
)
lastPosition
=
matchedFile
.
lastPosition
.
floatValue
;
...
...
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