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
VideoLAN
VLC-iOS
Commits
5788eb66
Commit
5788eb66
authored
Nov 13, 2015
by
Felix Paul Kühne
Browse files
media discoverer: add support for custom monitoring locations
parent
b7eab733
Changes
4
Hide whitespace changes
Inline
Side-by-side
Sources/VLCAppDelegate.m
View file @
5788eb66
...
@@ -143,6 +143,8 @@ NSString *const VLCDropboxSessionWasAuthorized = @"VLCDropboxSessionWasAuthorize
...
@@ -143,6 +143,8 @@ NSString *const VLCDropboxSessionWasAuthorized = @"VLCDropboxSessionWasAuthorize
[[
MLMediaLibrary
sharedMediaLibrary
]
applicationWillStart
];
[[
MLMediaLibrary
sharedMediaLibrary
]
applicationWillStart
];
VLCMediaFileDiscoverer
*
discoverer
=
[
VLCMediaFileDiscoverer
sharedInstance
];
VLCMediaFileDiscoverer
*
discoverer
=
[
VLCMediaFileDiscoverer
sharedInstance
];
NSArray
*
searchPaths
=
NSSearchPathForDirectoriesInDomains
(
NSDocumentDirectory
,
NSUserDomainMask
,
YES
);
discoverer
.
directoryPath
=
[
searchPaths
firstObject
];
[
discoverer
addObserver
:
self
];
[
discoverer
addObserver
:
self
];
[
discoverer
startDiscovering
];
[
discoverer
startDiscovering
];
};
};
...
...
Sources/VLCHTTPUploaderController.m
View file @
5788eb66
...
@@ -140,8 +140,10 @@
...
@@ -140,8 +140,10 @@
[
_httpServer
stop
];
[
_httpServer
stop
];
return
true
;
return
true
;
}
}
#if TARGET_OS_IOS
// clean cache before accepting new stuff
// clean cache before accepting new stuff
[
self
cleanCache
];
[
self
cleanCache
];
#endif
// Initialize our http server
// Initialize our http server
_httpServer
=
[[
HTTPServer
alloc
]
init
];
_httpServer
=
[[
HTTPServer
alloc
]
init
];
...
...
Sources/VLCMediaFileDiscoverer.h
View file @
5788eb66
...
@@ -28,6 +28,12 @@
...
@@ -28,6 +28,12 @@
@interface
VLCMediaFileDiscoverer
:
NSObject
@interface
VLCMediaFileDiscoverer
:
NSObject
/**
* the path the discoverer will monitor
* \note _MUST_ be set before starting the discovery
*/
@property
(
readwrite
,
retain
,
nonatomic
)
NSString
*
directoryPath
;
-
(
void
)
addObserver
:(
id
<
VLCMediaFileDiscovererDelegate
>
)
delegate
;
-
(
void
)
addObserver
:(
id
<
VLCMediaFileDiscovererDelegate
>
)
delegate
;
-
(
void
)
removeObserver
:(
id
<
VLCMediaFileDiscovererDelegate
>
)
delegate
;
-
(
void
)
removeObserver
:(
id
<
VLCMediaFileDiscovererDelegate
>
)
delegate
;
...
...
Sources/VLCMediaFileDiscoverer.m
View file @
5788eb66
...
@@ -20,7 +20,6 @@ const float MediaTimerInterval = 2.f;
...
@@ -20,7 +20,6 @@ const float MediaTimerInterval = 2.f;
NSMutableArray
*
_observers
;
NSMutableArray
*
_observers
;
dispatch_source_t
_directorySource
;
dispatch_source_t
_directorySource
;
NSString
*
_directoryPath
;
NSArray
*
_directoryFiles
;
NSArray
*
_directoryFiles
;
NSMutableDictionary
*
_addedFilesMapping
;
NSMutableDictionary
*
_addedFilesMapping
;
NSTimer
*
_addMediaTimer
;
NSTimer
*
_addMediaTimer
;
...
@@ -95,7 +94,12 @@ const float MediaTimerInterval = 2.f;
...
@@ -95,7 +94,12 @@ const float MediaTimerInterval = 2.f;
-
(
void
)
startDiscovering
-
(
void
)
startDiscovering
{
{
_directoryPath
=
[
self
directoryPath
];
if
(
!
_directoryPath
)
{
APLog
(
@"file discovery failed, no path was set"
);
return
;
}
else
APLog
(
@"will discover files in path: '%@'"
,
_directoryPath
);
_directoryFiles
=
[
self
directoryFiles
];
_directoryFiles
=
[
self
directoryFiles
];
int
const
folderDescriptor
=
open
([
_directoryPath
fileSystemRepresentation
],
O_EVTONLY
);
int
const
folderDescriptor
=
open
([
_directoryPath
fileSystemRepresentation
],
O_EVTONLY
);
...
@@ -143,13 +147,6 @@ const float MediaTimerInterval = 2.f;
...
@@ -143,13 +147,6 @@ const float MediaTimerInterval = 2.f;
#pragma mark - directory watcher delegate
#pragma mark - directory watcher delegate
-
(
NSString
*
)
directoryPath
{
NSArray
*
searchPaths
=
NSSearchPathForDirectoriesInDomains
(
NSDocumentDirectory
,
NSUserDomainMask
,
YES
);
NSString
*
directoryPath
=
searchPaths
[
0
];
return
directoryPath
;
}
-
(
void
)
directoryDidChange
-
(
void
)
directoryDidChange
{
{
NSArray
*
foundFiles
=
[
self
directoryFiles
];
NSArray
*
foundFiles
=
[
self
directoryFiles
];
...
...
Write
Preview
Supports
Markdown
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