@@ -40,14 +40,17 @@ using pman.bg.MediaTools;
40
40
@:expose (' MediaTools' )
41
41
class MediaTools {
42
42
/**
43
- * probe the given Directory for all openable files
44
- */
43
+ probe the given Directory for all openable files
44
+ * */
45
45
public static function getAllOpenableFiles (dir : Directory , done : Array <File >-> Void ): Void {
46
46
var probe = new OpenableFileProbe ();
47
47
probe .setSources ([dir ]);
48
48
probe .run ( done );
49
49
}
50
50
51
+ /**
52
+ probe many directories for all contained files that PMan can open
53
+ **/
51
54
public static function igetAllOpenableFiles (idir : Iterable <Directory >, done : Array <File >-> Void ): Void {
52
55
var coll = new Array ();
53
56
function collect (d : Directory , next : Void -> Void ) {
@@ -66,34 +69,33 @@ class MediaTools {
66
69
}
67
70
68
71
/**
69
- * convert the given file list into a track list
70
- */
72
+ convert the given list of File instances into a list of Track instances
73
+ * */
71
74
public static inline function convertToTracks (files : Array <File >): Array <Track > {
72
75
return (new FileListConverter ().convert ( files ).toArray ());
73
76
}
74
77
75
78
/**
76
- * initialize a list of Tracks all at once
77
- */
79
+ initialize a list of Track instances all at once
80
+ * */
78
81
public static function initAll (tracks : Array <Track >, done : Void -> Void ): Void {
79
82
var initter = new TrackListInitializer ();
80
83
initter .initAll (tracks , function (count : Int ) {
81
84
done ();
82
85
});
83
86
}
84
87
85
- /**
86
- * load data for a list of Tracks
87
- */
88
+ /*
88
89
@:deprecated
89
90
public static function loadDataForAll(tracks:Array<Track>, ?done:Cb<TLDLResult>):Void {
90
91
var loader = new TrackListDataLoader();
91
92
loader.load(tracks, done);
92
93
}
94
+ */
93
95
94
- /**
95
- * get underlying media object from the given MediaObject
96
- */
96
+ /**
97
+ get underlying media object from the given MediaObject
98
+ * */
97
99
@:access ( gryffin.display. Video )
98
100
@:access ( gryffin.audio. Audio )
99
101
public static function getUnderlyingMediaObject (mo : MediaObject ): NativeMediaObject {
@@ -108,14 +110,14 @@ class MediaTools {
108
110
}
109
111
}
110
112
111
- /**
112
- * load the MediaMetadata attached to the given MediaSource
113
- */
113
+ /**
114
+ load the MediaMetadata attached to the given MediaSource
115
+ * */
114
116
public static function getMediaMetadata (src : MediaSource ): Promise <Null <MediaMetadata >> {
115
- return Promise . create ( {
117
+ return new Promise ( function ( yes , no ) {
116
118
switch ( src ) {
117
119
case MSLocalPath ( path ):
118
- @ forward new LoadMediaMetadata ( path ).getMetadata ();
120
+ yes ( cast new LoadMediaMetadata ( path ).getMetadata () );
119
121
120
122
default :
121
123
throw ' Error: Media metadata can only be loaded for media items located on the local filesystem' ;
@@ -129,6 +131,9 @@ class MediaTools {
129
131
public static inline function stripSlashSlash (s : String ): String return s .withoutLeadingSlashes ();
130
132
}
131
133
134
+ /**
135
+ mixins for Uri strings
136
+ **/
132
137
class UriTools {
133
138
//
134
139
public static function toMediaProvider (uri : String ): MediaProvider {
0 commit comments