XXX yurij: duplicate from videojs5-hlsjs to avoid deps
556227
function level_label(level){
        if (level.height)
            return level.height+'p';
        if (level.width)
            return Math.round(level.width*9/16)+'p';
        if (level.bitrate)
            return scaled_number(level.bitrate)+'bps';
        return 0;
    }
1240687
function copyAssetsLess() {
  return gulp.src(['./src/assets/stylesheets/*.less'])
    .pipe(replace(/\.\.\/.\.\/.\.\//g, function () {
      return '../../../../';
    }))
    .pipe(replace(/@import '\.\.\/\.\.\/.*\//g, function () {
      return '@import \'';
    }))
    .pipe(rename({dirname: ''}))
    .pipe(gulp.dest(libraryDist + '/dist/less'));
}
957693
function(ql) {
				var preview = ql.preview,
			mimes   = [],
			node,
			win  = ql.window,
			navi = ql.navbar;
			
		$.each(navigator.plugins, function(i, plugins) {
			$.each(plugins, function(i, plugin) {
				(plugin.type.indexOf('audio/') === 0 || plugin.type.indexOf('video/') === 0) && mimes.push(plugin.type);
			});
		});
		mimes = ql.fm.arrayFlip(mimes);
		
		preview.on(ql.evUpdate, function(e) {
			var file  = e.file,
				mime  = file.mime,
				video,
				setNavi = function() {
					navi.css('bottom', win.hasClass('elfinder-quicklook-fullscreen')? '50px' : '');
				};
			
			if (mimes[file.mime] && ql.dispInlineRegex.test(file.mime)) {
				e.stopImmediatePropagation();
				(video = mime.indexOf('video/') === 0) && ql.hideinfo();
				node = $('<embed src="'+ql.fm.openUrl(file.hash)+'" type="'+mime+'" class="elfinder-quicklook-preview-'+(video ? 'video' : 'audio')+'"/>')
					.appendTo(preview);
				
				win.on('viewchange.embed', setNavi);
				setNavi();
			}
		}).on('change', function() {
			if (node && node.parent().length) {
				win.off('viewchange.embed');
				node.remove();
				node= null;
			}
		});
		
	}
278206
function clVideoTransformation() {
        return {
            restrict: 'E',
            transclude: false,
            require: '^clVideo',
            link: function (scope, element, attrs, clVideoCtrl) {
                var attributes = getAttributes(attrs);
                clVideoCtrl.addTransformation(attributes);
            }
        };
    }
1223114
function injectVideoApi(url, callback) {
    if (utils.isNil(url)) {
        console.error('Inject videos api error');
        return;
    }
    let found = document.querySelectorAll('script[src="' + url + '"]')
    if (utils.isNil(found) || found.length == 0) {
        let script = document.createElement('script');
        script.type = 'text/javascript';
        script.src = url;
        script.onload = () => {
            if (utils.isFunction(callback)) callback();
        };
        document.body.appendChild(script);
        return false;
    }
    if (utils.isFunction(callback)) callback();
}
1082299
function HlsProv(id){
    var jwplayer = E.jwplayer||window.jwplayer, Hls = E.Hls||window.Hls;
    var jw = id && jwplayer(id);
    console.log('init hola/hls provider v'+E.VERSION+' hls v'+Hls.version+
        (E.version ? ' hap v'+E.version : ''));
    jw.provider = this;
    function empty_fn(name){ return function(){}; }
    var _this = this;
    this.hls_restore_pos = function(){
        var new_pos = this.hls_queued.seek;
        var old_pos = video.currentTime;
        if (hls.streamController.state == 'STOPPED')
        {
            // XXX pavelki: hack to use our start position
            hls.streamController.startPosition = 0;
            hls.startLoad(new_pos||0);
        }
        if (!new_pos)
            return;
        this._in_seek = true;
        video.currentTime = new_pos;
        this.trigger(jwe.JWPLAYER_MEDIA_SEEK, {position: old_pos,
            offset: new_pos});
        // XXX pavelki: hack to override W3 algorithm of media
        // seeking: when video element has HAVE_NOTHING state,
        // seeking event doesn't fire and loading doesn't start
        if (!video.readyState)
            video.dispatchEvent(new Event('seeking'));
        this.hls_queued.seek = 0;
    };
    function check_playback_started(video){
        if (video.paused)
            return void hls_log('video play refused');
        function rm_listeners(){
            video.removeEventListener('playing', listener);
            video.removeEventListener('pause', listener);
            video.removeEventListener('abort', listener);
            video.removeEventListener('error', listener);
        }
        function listener(e){
            rm_listeners();
            if (e.type!='playing')
                hls_log('play() was interrupted by a "'+e.type+'" event');
        }
        video.addEventListener('playing', listener);
        video.addEventListener('abort', listener);
        video.addEventListener('error', listener);
        video.addEventListener('pause', listener);
    }
    function video_play(){
        var promise = video.play()||check_playback_started(video);
        if (promise && promise.catch)
        {
            promise.catch(function(err){
                hls_log('video_play failed with '+err);
                console.warn(err);
                // user gesture required to start playback
                if (err.name=='NotAllowedError' &&
                    video.hasAttribute('jw-gesture-required'))
                {
                    _this.trigger('autoplayFailed');
                    video.setAttribute('autoplay-failed', 'failed');
                }
            });
        }
        else if (video.hasAttribute('jw-gesture-required'))
        {
            // autoplay isn't supported in older versions of Safari (<10)
            // and Chrome (<53)
            _this.trigger('autoplayFailed');
            video.setAttribute('autoplay-failed', 'failed');
        }
    }
    function hls_log(msg){
        var dbg;
        if (dbg = hls_params.debug)
            dbg.log(msg);
    }
    function hls_play(){
        hls_log('hls_play state: '+_this.hls_state+' att:'+_this.attached);
        if (!(_this.hls_queued.play = _this.hls_state!='ready') &&
            _this.attached)
        {
            _this.hls_restore_pos();
            video_play();
        }
    }
    function hls_load(src){
        if (!src)
            return;
        if (_this.hls_state=='ready')
            _this.hls_state = 'idle';
        if (_this.level_cb)
            hls.off(Hls.Events.LEVEL_LOADED, _this.level_cb);
        _this.level_cb = function(){
            hls_log('hls play queued on level_cb:'+_this.hls_queued.play);
            hls.off(Hls.Events.LEVEL_LOADED, _this.level_cb);
            _this.level_cb = undefined;
            _this.hls_state = 'ready';
            if (_this.hls_queued.play)
                hls_play();
            _this.trigger(jwe.JWPLAYER_MEDIA_BUFFER_FULL);
        };
        hls.on(Hls.Events.LEVEL_LOADED, _this.level_cb);
        hls.loadSource(src);
        if (!hls.media)
            _this.attachMedia();
    }
    function on_video_src_change(video, allow_cb){
        var o = video;
        for (; o && !o.hasOwnProperty('src'); o = Object.getPrototypeOf(o));
        if (!o)
            return;
        var prop = Object.getOwnPropertyDescriptor(o, 'src');
        // XXX volodymyr: some browsers (e.g. safari9) may lock access to src,
        // solution copied from polyfill.video_source_access in html5.js
        if (!prop.get && !prop.set)
        {
            prop.get = function(){
                var src = video.getAttribute('src');
                return src!=null ? src : '';
            };
            prop.set = function(s){
                var el = document.createElement('source');
                el.src = s||''; // will convert relative path into absolute uri
                video.setAttribute('src', el.src);
            };
        }
        Object.defineProperty(video, 'src', {
            configurable: true,
            enumerable: false,
            set: function(src){
                if (allow_cb(prop.get.call(video), src))
                    prop.set.call(video, src);
            },
            get: prop.get,
        });
    }
    function get_default_src(sources){
        return sources &&
            sources.find(function(s){ return s.default; }) || sources[0];
    }
    function _log(method, message){
        if (_this.hls.holaLog && _this.hls.holaLog[method])
            _this.hls.holaLog[method].call(_this.hls.holaLog, message);
    }
    // XXX marka: jwplayer inherits provider from DefaultProvider, so it will
    // override our inheritance from EventEmitter, do it manually
    this.events = new EventEmitter();
    this.addEventListener = this.on = this.events.on.bind(this.events);
    this.once = this.events.once.bind(this.events);
    this.removeEventListener = this.off = this.events.off.bind(this.events);
    this.trigger = this.emit = function(e){
        if (!_this.attached && !_this.before_complete)
            return;
        var args = [].slice.call(arguments);
        _this.events.emit.apply(this.events, args);
        if (e!='all')
        {
            args.unshift('all');
            _this.events.emit.apply(this.events, args);
        }
    };
    this.removeAllListeners = function(e){
        this.events.removeAllListeners(e); };
    this.hls_queued = {play: false, seek: 0};
    this.attached = true;
    this.hls_state = 'idle';
    this.is_mobile = function(){
        var ios, and, ua = navigator.userAgent;
        if ((ios = /iP(hone|ad|od)/i.test(ua)) || (and = /Android/i.test(ua)))
            return {is_ios: ios, is_android: and};
    };
    this.supports_captions = function(){
        var ua = navigator.userAgent;
        return /(iPhone|iPad|iPod|iPod touch);.*?OS/.test(ua)
            || / (Chrome|Version)\/\d+(\.\d+)+.* Safari\/\d+(\.\d+)+/.test(ua)
            || /Firefox\/(\d+(?:\.\d+)+)/.test(ua);
    };
    var element = document.getElementById(id), container;
    var video = element ? element.querySelector('video') : undefined, hls;
    var try_play, can_play, _is_mobile = this.is_mobile();
    var visual_quality = {reason: 'initial choice', mode: 'auto'};
    if (!video)
    {
        video = document.createElement('video');
        if (_is_mobile)
            video.setAttribute('jw-gesture-required', '');
    }
    video.className = 'jw-video jw-reset';
    // XXX marka: mark html5 element to skip autodetection of dm/hls
    video.hola_dm_hls_attached = true;
    // XXX pavelki: hack to override ozee's wrong src set
    on_video_src_change(video, function(from, to){ return to!=from+'?'; });
    var hls_params = E.hls_params||{}, hola_log;
    this.ad_count = 0;
    if (jw)
    {
        jw.on('captionsList', caption_track);
        jw.on('captionsChanged', caption_track);
        // XXX pavelki: counters for ad, need to make loading deferred
        jw.on('adImpression', function(){
            _this.ad_count++;
        });
        jw.on('adComplete', function(){ _this.ad_count--; });
        jw.on('adSkipped', function(){ _this.ad_count--; });
        Object.assign(hls_params, jw.hola_config);
        if (hls_params.debug!='undefined')
        {
            hola_log = hls_params.debug;
            delete hls_params.debug;
        }
    }
    hls_params.debug = {};
    ['debug', 'info', 'log', 'warn','error'].forEach(function(method){
        hls_params.debug[method] = _log.bind(null, method); });
    this.hls = hls = new Hls(hls_params);
    hls.holaLog = hola_log;
    if (jw)
        jw.hls = hls;
    var _buffered, _duration, _position;
    function caption_track(cc){
        if (!_this.renderNatively)
            return;
        var tracks = video.textTracks, new_id = cc.tracks[cc.track].id;
        for (var i=0; i<tracks.length; i++)
            tracks[i].mode = tracks[i]._id==new_id ? 'showing' : 'hidden';
    }
    function get_seekable_end(){
        var i, end, len = video.seekable ? video.seekable.length : 0;
        for (end = 0, i = 0; i<len; i++)
            end = Math.max(end, video.seekable.end(i));
        return end;
    }
    function get_duration(){
        var duration = video.duration, end = get_seekable_end();
        if (duration==Infinity && end)
        {
            var seekable_dur = end-video.seekable.start(0);
            if (seekable_dur!=Infinity && seekable_dur>120)
                duration = -seekable_dur;
        }
        return duration;
    }
    function get_duration_inf(){
        return is_live() ? 1/0 : get_duration();
    }
    function is_live(){
        var live, levels;
        try {
            if (!(levels = hls.streamController.levels))
                return;
            var loaded_lvl = levels.find(function(lvl){ return lvl.details; });
            live = loaded_lvl && !!loaded_lvl.details.live;
        } catch(e){ hls_log('is_live failed with '+e); }
        return live;
    }
    function get_buffered(){
        var buf = video.buffered, dur = video.duration;
        if (!buf || !buf.length || dur<=0 || dur==Infinity)
            return 0;
        return Math.min(buf.end(buf.length-1)/dur, 1.0);
    }
    function set_buffered(buffered, pos, duration){
        if (buffered==_buffered && duration==_duration)
            return;
        _buffered = buffered;
        _this.trigger(jwe.JWPLAYER_MEDIA_BUFFER, {bufferPercent: buffered*100,
            position: pos, duration: get_duration_inf()});
    }
    function playback_complete(){
        _this.setState('complete');
        _this.trigger(jwe.JWPLAYER_MEDIA_COMPLETE);
        _this.before_complete = false;
    }
    var video_listeners = {
        durationchange: function(){
            _duration = get_duration();
            set_buffered(get_buffered(), _position, _duration);
        },
        ended: function(){
            if (_this.state=='idle' || _this.state=='complete')
                return;
            _this.before_complete = true;
            _this.trigger(jwe.JWPLAYER_MEDIA_BEFORECOMPLETE);
            if (_this.attached)
                playback_complete();
        },
        error: function(){
            _this.trigger(jwe.JWPLAYER_MEDIA_ERROR, {
                message: 'Error loading media: File could not be played'});
        },
        loadstart: function(){ video.setAttribute('jw-loaded', 'started'); },
        loadeddata: function(){
            video.setAttribute('jw-loaded', 'data');
            if (!_this.supports_captions())
                return;
            video.textTracks.onaddtrack = function(){
                _this.renderNatively = true;
                _this.trigger('subtitlesTracks', {tracks: video.textTracks});
            };
            // XXX pavelki: add checking of playlist
            if (video.textTracks.length)
                video.textTracks.onaddtrack();
        },
        loadedmetadata: function(){
            if (video.muted)
            {
                video.muted = false;
                video.muted = true;
            }
            video.setAttribute('jw-loaded', 'meta');
            _duration = get_duration();
            _this.trigger(jwe.JWPLAYER_MEDIA_META, {duration:
                get_duration_inf(), height: video.videoHeight,
                width: video.videoWidth});
        },
        canplay: function(){
            can_play = true;
            _this.trigger(jwe.JWPLAYER_MEDIA_BUFFER_FULL);
        },
        playing: function(){
            _this.setState('playing');
            if (!video.hasAttribute('jw-played'))
                video.setAttribute('jw-played', '');
            if (video.hasAttribute('jw-gesture-required'))
            {
                video.removeAttribute('jw-gesture-required');
                video.removeAttribute('autoplay-failed');
            }
            _this.trigger(jwe.JWPLAYER_PROVIDER_FIRST_FRAME, {});
        },
        pause: function(){
            if (_this.state=='complete' || video.currentTime==video.duration)
                return;
            _this.setState('paused');
        },
        seeking: function(){
            if (!_this._in_seek)
            {
                _this._in_seek = true;
                _this.trigger(jwe.JWPLAYER_MEDIA_SEEK, {position: _position,
                    offset: video.currentTime});
            }
        },
        seeked: function(){
            _this._in_seek = false;
            _this.trigger(jwe.JWPLAYER_MEDIA_SEEKED);
        },
        progress: function(){
            set_buffered(get_buffered(), _position, _duration); },
        timeupdate: function(){
            _duration = get_duration();
            _position = _duration<0 ? -(get_seekable_end()-video.currentTime) :
                video.currentTime;
            set_buffered(get_buffered(), _position, _duration);
            if (_this.state=='playing')
            {
                _this.trigger(jwe.JWPLAYER_MEDIA_TIME, {position: _position,
                    duration: get_duration_inf()});
            }
        },
    };
    function wrap_gen(e){
        return function(){
            if (!_this.attached)
                return;
            video_listeners[e]();
        };
    }
    for (var e in video_listeners)
        video.addEventListener(e, wrap_gen(e), false);
    function scaled_number(num){
        if (num===undefined)
            return '';
        if (!num)
            return '0';
        var k = 1024;
        var sizes = ['', 'K', 'M', 'G', 'T', 'P'];
        var i = Math.floor(Math.log(num)/Math.log(k));
        num /= Math.pow(k, i);
        if (num<0.001)
            return '0';
        if (num>=k-1)
            num = Math.trunc(num);
        var str = num.toFixed(num<1 ? 3 : num<10 ? 2 : num<100 ? 1 : 0);
        return str.replace(/\.0*$/, '')+sizes[i];
    }
    // XXX yurij: duplicate from videojs5-hlsjs to avoid deps
    function level_label(level){
        if (level.height)
            return level.height+'p';
        if (level.width)
            return Math.round(level.width*9/16)+'p';
        if (level.bitrate)
            return scaled_number(level.bitrate)+'bps';
        return 0;
    }
    function get_levels(){
        var levels = hls.levels||[], res = [];
        // level 0 mimics native jw's hls provider behavior
        if (levels.length>1)
            res.push({label: 'Auto'});
        levels.forEach(function(level){
            res.push({bitrate: level.bitrate, height: level.height,
                label: level_label(level), width: level.width});
        });
        return res;
    }
    function get_level(level){
        var levels = hls.levels||[];
        level = level||hls.currentLevel;
        return {
            // level 0 is dummy for 'Auto' option in jwplayer's UI
            jw: hls.manual_level==-1 || levels.length<2 ? 0 : level+1,
            real: levels.length<2 ? 0 : level+1,
        };
    }
    hls.on(Hls.Events.ERROR, function(event, data){
        if (!data.fatal)
            return;
        var msg;
        switch (data.details)
        {
        case Hls.ErrorDetails.MANIFEST_LOAD_ERROR:
        case Hls.ErrorDetails.MANIFEST_LOAD_TIMEOUT:
            msg = 'Cannot load M3U8: '+data.response.statusText;
            break;
        default:
            msg = 'Error loading media: '+data.details;
            break;
        }
        _this.trigger(jwe.JWPLAYER_MEDIA_ERROR, {message: msg});
    });
    hls.on(Hls.Events.MANIFEST_LOADED, function(){
        _this.trigger(jwe.JWPLAYER_MEDIA_LEVELS, {
            currentQuality: get_level().jw,
            levels: get_levels()
        });
        var levels, is_video = 0;
        if (!(levels = hls.levels))
            return;
        levels.forEach(function(level){
            is_video += +!!(level.videoCodec || !level.audioCodec &&
                (level.bitrate>64000 || level.width || level.height));
        });
        _this.trigger(jwe.JWPLAYER_MEDIA_TYPE, {mediaType: is_video ?
            'video' : 'audio'});
    });
    hls.on(Hls.Events.LEVEL_SWITCH, function(e, data){
        var levels = get_levels(), level_id = get_level(data.level);
        _this.trigger(jwe.JWPLAYER_MEDIA_LEVEL_CHANGED, {
            currentQuality: level_id.jw,
            levels: levels,
        });
        var level = levels[level_id.real];
        visual_quality.level = level;
        visual_quality.level.index = level_id.real;
        visual_quality.level.label = hls.manual_level==-1 && levels.length>1 ?
            'auto' : level.label;
        visual_quality.reason = visual_quality.reason||'auto';
        _this.trigger('visualQuality', visual_quality);
        visual_quality.reason = '';
    });
    this.init = function(item){
        try_play = false;
        video.setAttribute('jw-loaded', 'init');
    };
    this.load = function(item){
        if (!this.attached)
            return;
        var newsource = get_default_src(item.sources).file;
        var video_state = video.getAttribute('jw-loaded');
        var hq = this.hls_queued, played = video.hasAttribute('jw-played');
        if (!_is_mobile || played)
        {
            // don't change state on mobile before user initiates playback
            this.setState('loading');
        }
        hq.seek = Math.max(item.starttime-(hq.rw_sec||0), 0);
        if (this.hls_state!='ready' || (this.source||'') != newsource ||
            ['init', 'started'].includes(video_state))
        {
            var sc;
            try_play = false;
            video.load();
            hls.stopLoad(hls.media && this.hls_state=='ready' &&
                video_state=='init');
            hls_load(this.source = newsource);
            video.setAttribute('jw-loaded', 'init');
        }
        else
            hls_play();
        if (_is_mobile && !played)
        {
            if (!try_play && (!_is_mobile.is_ios || can_play))
            {
                try_play = true;
                can_play = false;
                video_play();
            }
            if (!video.paused && this.state!='playing')
                this.setState('loading');
        }
    };
    this.play = function(){ hls_play(); };
    this.pause = function(){
        video.pause();
        _this.setState('paused');
    };
    this.stop = function(){
        hls.stopLoad();
        _this.setState('idle');
    };
    this.volume = function(vol){ video.volume = Math.min(vol/100, 1.0); };
    this.mute = function(state){ video.muted = !!state; };
    this.seek = function(pos){
        this._in_seek = true;
        if (this.hls_state=='ready')
        {
            var sv = video.currentTime;
            video.currentTime = pos;
            this.trigger(jwe.JWPLAYER_MEDIA_SEEK, {position: sv, offset: pos});
        }
        else
            this.hls_queued.seek = pos;
    };
    // XXX arik: todo, without it video resize will be wrong.
    // eg. http://www.ozee.com/shows/muddha-mandaram#hola_mode=cdn&hola_zone=ozee_hap
    this.resize = function(width, height, stretching){};
    this.remove = function(){
        this.in_container = false;
        hls.stopLoad();
        this.source = undefined;
        if (container === video.parentNode)
            container.removeChild(video);
    };
    this.destroy = function(){
        for (var e in video_listeners)
            video.removeEventListener(e, video_listeners[e], false);
        this.removeAllListeners();
    };
    this.setVisibility = function(state){
        container.style.visibility = state ? 'visible' : '';
        container.style.opacity = state ? 1 : 0;
    };
    this.setFullscreen = function(){ return false; };
    this.getFullscreen = empty_fn('getFullscreen');
    this.getContainer = function(){ return container; };
    this.setContainer = function(element){
        container = element;
        container.appendChild(video);
        this.in_container = true;
    };
    hls.manual_level = -1;
    this.setCurrentQuality = function(level){
        if (level == hls.manual_level+1)
            return;
        hls.manual_level = level-1;
        if (!hls.hola_adaptive)
            hls.loadLevel = hls.manual_level;
        _this.trigger(jwe.JWPLAYER_MEDIA_LEVEL_CHANGED,
            {currentQuality: level, levels: get_levels()});
        visual_quality.reason = 'api';
    };
    this.getName = function(){ return {name: 'hola/hls'}; };
    this.get_position = function(){ return video.currentTime; };
    this.getQualityLevels = function(){ return get_levels(); };
    this.getCurrentQuality = function(){ return get_level(hls.loadLevel).jw; };
    this.getAudioTracks = empty_fn('getAudioTracks');
    this.getCurrentAudioTrack = empty_fn('getCurrentAudioTrack');
    this.setCurrentAudioTrack = empty_fn('setCurrentAudioTrack');
    this.checkComplete = function(){ return !!this.before_complete; };
    this.setControls = empty_fn('setControls');
    this.attachMedia = function(){
        if (this.before_complete)
            return playback_complete();
        if (this.ad_count)
            hls_log('jwprovider attach inside ad '+this.ad_count);
        this.attached = true;
        hls.attachMedia(video);
    };
    this.detachMedia = function(){
        hls.trigger(Hls.Events.BUFFER_RESET);
        hls.detachMedia();
        if (this.level_cb)
        {
            hls.off(Hls.Events.LEVEL_LOADED, this.level_cb);
            this.level_cb = undefined;
        }
        // XXX pavelki: hack to remove pending segments
        delete hls.bufferController.segments;
        this.attached = false;
        return video;
    };
    this.setState = function(state){
        var oldState = this.state||'idle';
        this.state = state;
        if (state==oldState)
            return;
        this.trigger(jwe.JWPLAYER_PLAYER_STATE, {newstate: state});
    };
    this.sendMediaType = function(levels){
        var is_audio = ['oga', 'aac', 'mp3', 'mpeg', 'vorbis']
            .includes(levels[0].type);
        this.trigger(jwe.JWPLAYER_MEDIA_TYPE, {mediaType: is_audio ?
            'audio' : 'video'});
    };
}
1045549
def main(args=None):
    """"""

    dlx = Downloader()
    epilog = dlx.epilog()

    options, arguments = parse(args, epilog)

    # create list of video files that don't have accompanying 'srt' subtitles
    targets = [p for p in arguments if os.path.isfile(p) and not
               os.path.exists(os.path.splitext(p)[0] + '.srt')]

    if not targets:
        fatal('No valid targets were specified')

    if options.rename:
        videos = [rename(p) for p in targets]
    else:
        videos = targets

    dlx.download(videos, options.downloader, options.language)

    subtitles = []

    for video_path in videos:
        srt_path = os.path.splitext(video_path)[0] + '.srt'
        if os.path.isfile(srt_path):
            subtitles.append(srt_path)
        elif not options.quiet:
            failure(video_path, options.downloader)

    if options.scan and subtitles:
        scan(subtitles)
366868
function VideoLoader(loadItem, preferXHR) {
		this.AbstractMediaLoader_constructor(loadItem, preferXHR, createjs.AbstractLoader.VIDEO);

		if (createjs.RequestUtils.isVideoTag(loadItem) || createjs.RequestUtils.isVideoTag(loadItem.src)) {
			this.setTag(createjs.RequestUtils.isVideoTag(loadItem)?loadItem:loadItem.src);

			// We can't use XHR for a tag that's passed in.
			this._preferXHR = false;
		} else {
			this.setTag(this._createTag());
		}
	}
484129
function(hljs) {
  return {
    aliases: ['rs'],
    keywords:
      'alignof as be box break const continue crate do else enum extern ' +
      'false fn for if impl in let loop match mod mut offsetof once priv ' +
      'proc pub pure ref return self sizeof static struct super trait true ' +
      'type typeof unsafe unsized use virtual while yield ' +
      'int i8 i16 i32 i64 ' +
      'uint u8 u32 u64 ' +
      'float f32 f64 ' +
      'str char bool',
    illegal: '</',
    contains: [
      hljs.C_LINE_COMMENT_MODE,
      hljs.C_BLOCK_COMMENT_MODE,
      hljs.inherit(hljs.QUOTE_STRING_MODE, {illegal: null}),
      {
        className: 'string',
        begin: /r(#*)".*?"\1(?!#)/
      },
      {
        className: 'string',
        begin: /'\\?(x\w{2}|u\w{4}|U\w{8}|.)'/
      },
      {
        begin: /'[a-zA-Z_][a-zA-Z0-9_]*/
      },
      {
        className: 'number',
        begin: '\\b(0[xb][A-Za-z0-9_]+|[0-9_]+(\\.[0-9_]+)?([uif](8|16|32|64)?)?)',
        relevance: 0
      },
      {
        className: 'function',
        beginKeywords: 'fn', end: '(\\(|<)', excludeEnd: true,
        contains: [hljs.UNDERSCORE_TITLE_MODE]
      },
      {
        className: 'preprocessor',
        begin: '#\\[', end: '\\]'
      },
      {
        beginKeywords: 'type', end: '(=|<)',
        contains: [hljs.UNDERSCORE_TITLE_MODE],
        illegal: '\\S'
      },
      {
        beginKeywords: 'trait enum', end: '({|<)',
        contains: [hljs.UNDERSCORE_TITLE_MODE],
        illegal: '\\S'
      },
      {
        begin: hljs.IDENT_RE + '::'
      },
      {
        begin: '->'
      }
    ]
  };
}
113360
public VideoData duplicate() throws IOException, ClassNotFoundException {
        VideoData result = new VideoData();
        // serialize
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ObjectOutputStream oos = new ObjectOutputStream(baos);
        writeExternal(oos);
        oos.close();
        // convert to byte array
        byte[] buf = baos.toByteArray();
        baos.close();
        // create input streams
        ByteArrayInputStream bais = new ByteArrayInputStream(buf);
        ObjectInputStream ois = new ObjectInputStream(bais);
        // deserialize
        result.readExternal(ois);
        ois.close();
        bais.close();
        // clone the header if there is one
        if (header != null) {
            result.setHeader(header.clone());
        }
        result.setSourceType(sourceType);
        result.setSource(source);
        result.setTimestamp(timestamp);
        return result;
    }
848016
function VideoCaps(videoCapsDict){
  if(!(this instanceof VideoCaps))
    return new VideoCaps(videoCapsDict)

  videoCapsDict = videoCapsDict || {}

  // Check videoCapsDict has the required fields
  // 
  // checkType('VideoCodec', 'videoCapsDict.codec', videoCapsDict.codec, {required: true});
  //  
  // checkType('Fraction', 'videoCapsDict.framerate', videoCapsDict.framerate, {required: true});
  //  

  // Init parent class
  VideoCaps.super_.call(this, videoCapsDict)

  // Set object properties
  Object.defineProperties(this, {
    codec: {
      writable: true,
      enumerable: true,
      value: videoCapsDict.codec
    },
    framerate: {
      writable: true,
      enumerable: true,
      value: videoCapsDict.framerate
    }
  })
}
60959
function (vm, callback) {
    if (this.isReplaying) {
      vm.actionOnCommitForReplay = vm.actionOnCommit;
      // Clone the values to be sure no reference mistakes happen!
      if (vm.attributes) {
        var flatAttr = flatten(vm.attributes);
        var undefines = [];
        _.each(flatAttr, function (v, k) {
          if (v === undefined) {
            undefines.push(k);
          }
        });
        vm.attributes = vm.toJSON();
        _.each(undefines, function (k) {
          vm.set(k, undefined);
        });
      }

      this.replayingVms[vm.id] = vm;
      if (vm.actionOnCommit === 'delete') {
        delete this.replayingVms[vm.id];
        if (!this.replayingVmsToDelete[vm.id]) this.replayingVmsToDelete[vm.id] = vm;
      }
      if (vm.actionOnCommit === 'create') {
        vm.actionOnCommit = 'update';
      }
      return callback(null);
    }
    this.repository.commit(vm, callback);
  }
1313876
function reHashChunk(chunk, assets, hashFn, nameMap) {
    const isMainFile = file => file.endsWith('.js') || file.endsWith('.css');

    // Update the name of the main files
    chunk.files.filter(isMainFile).forEach((oldChunkName, index) => {
        const asset = assets[oldChunkName];
        const { fullHash, shortHash: newHash } = hashFn(asset.source());

        let newChunkName;

        if (oldChunkName.includes(chunk.renderedHash)) {
            // Save the hash map for replacing the secondary files
            nameMap[chunk.renderedHash] = newHash;
            newChunkName = oldChunkName.replace(chunk.renderedHash, newHash);

            // Keep the chunk hashes in sync
            chunk.hash = fullHash;
            chunk.renderedHash = newHash;
        } else {
            // This is a massive hack:
            //
            // The oldHash of the main file is in `chunk.renderedHash`. But some plugins add a
            // second "main" file to the chunk (for example, `mini-css-extract-plugin` adds a
            // css file). That other main file has to be rehashed too, but we don't know the
            // oldHash of the file, so we don't know what string we have to replace by the new
            // hash.
            //
            // However, the hash present in the file name must be one of the hashes of the
            // modules inside the chunk (modules[].renderedHash). So we try to replace each
            // module hash with the new hash.
            const module = Array.from(chunk.modulesIterable).find(m =>
                oldChunkName.includes(m.renderedHash)
            );

            // Can't find a module with this hash... not sure what is going on, just return and
            // hope for the best.
            if (!module) return;

            // Save the hash map for replacing the secondary files
            nameMap[module.renderedHash] = newHash;
            newChunkName = oldChunkName.replace(module.renderedHash, newHash);

            // Keep the module hashes in sync
            module.hash = fullHash;
            module.renderedHash = newHash;
        }

        // Change file name to include the new hash
        chunk.files[index] = newChunkName;
        asset._name = newChunkName;
        delete assets[oldChunkName];
        assets[newChunkName] = asset;
    });

    // Update the content of the rest of the files in the chunk
    chunk.files
        .filter(file => !isMainFile(file))
        .forEach(file => {
            Object.keys(nameMap).forEach(old => {
                const newHash = nameMap[old];
                replaceStringInAsset(assets[file], old, newHash);
            });
        });
}
285952
def validate(self):
        
        from .files import VideoFile, WebVideoFile
        try:
            assert self.kind == content_kinds.VIDEO, "Assumption Failed: Node should be a video"
            assert self.questions == [], "Assumption Failed: Video should not have questions"
            assert len(self.files) > 0, "Assumption Failed: Video must have at least one video file"

            # Check if there are any .mp4 files if there are video files (other video types don't have paths)
            assert any(f for f in self.files if isinstance(f, VideoFile) or isinstance(f, WebVideoFile)), "Assumption Failed: Video should have at least one .mp4 file"

            return super(VideoNode, self).validate()
        except AssertionError as ae:
            raise InvalidNodeException("Invalid node ({}): {} - {}".format(ae.args[0], self.title, self.__dict__))
220523
function(segmentIndex, index, obj) {
      var file = obj;

      if (file.type === 'VIDEO' || file.type === 'AUDIO') {
        file = findSupportedSource(file);
      }

      if (file) {
        _bytesTotal += file.size;
        _files[segmentIndex].push(file);
      }
    }
1228567
function cloneWithRaws(node) {
      if (node.nodes) {
        const oldNodes = node.nodes;
        node.nodes = [];
        const clone = node.clone({ raws: node.raws });
        node.nodes = oldNodes;
        for (const clonedChild of oldNodes.map(cloneWithRaws)) {
          clone.append(clonedChild);
        }
        return clone;
      } else {
        return node.clone({ raws: node.raws });
      }
    }
81903
function () {

			var images = {};
			var blobs = {};

			if ( 'Video' in fbxTree.Objects ) {

				var videoNodes = fbxTree.Objects.Video;

				for ( var nodeID in videoNodes ) {

					var videoNode = videoNodes[ nodeID ];

					var id = parseInt( nodeID );

					images[ id ] = videoNode.RelativeFilename || videoNode.Filename;

					// raw image data is in videoNode.Content
					if ( 'Content' in videoNode ) {

						var arrayBufferContent = ( videoNode.Content instanceof ArrayBuffer ) && ( videoNode.Content.byteLength > 0 );
						var base64Content = ( typeof videoNode.Content === 'string' ) && ( videoNode.Content !== '' );

						if ( arrayBufferContent || base64Content ) {

							var image = this.parseImage( videoNodes[ nodeID ] );

							blobs[ videoNode.RelativeFilename || videoNode.Filename ] = image;

						}

					}

				}

			}

			for ( var id in images ) {

				var filename = images[ id ];

				if ( blobs[ filename ] !== undefined ) images[ id ] = blobs[ filename ];
				else images[ id ] = images[ id ].split( '\\' ).pop();

			}

			return images;

		}