mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-30 07:42:23 +02:00
YT: store adaptive option value in itag opts
So its easier to access and obtained only once
This commit is contained in:
@@ -318,6 +318,7 @@ var YouTubeClient = GObject.registerClass({
|
|||||||
height: monitor.geometry.height * monitor.scale_factor,
|
height: monitor.geometry.height * monitor.scale_factor,
|
||||||
codec: 'h264',
|
codec: 'h264',
|
||||||
type: settings.get_string('yt-quality-type'),
|
type: settings.get_string('yt-quality-type'),
|
||||||
|
adaptive: settings.get_boolean('yt-adaptive-enabled'),
|
||||||
};
|
};
|
||||||
|
|
||||||
uri = await this.getHLSUriAsync(info, itagOpts);
|
uri = await this.getHLSUriAsync(info, itagOpts);
|
||||||
@@ -376,7 +377,7 @@ var YouTubeClient = GObject.registerClass({
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!settings.get_boolean('yt-adaptive-enabled')) {
|
if(!itagOpts.adaptive) {
|
||||||
const result = await this._downloadDataPromise(hlsUri).catch(debug);
|
const result = await this._downloadDataPromise(hlsUri).catch(debug);
|
||||||
if(!result || !result.data) {
|
if(!result || !result.data) {
|
||||||
debug(new Error('HLS manifest download failed'));
|
debug(new Error('HLS manifest download failed'));
|
||||||
@@ -419,9 +420,6 @@ var YouTubeClient = GObject.registerClass({
|
|||||||
)
|
)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
/* TODO: Options in prefs to set preferred video formats and adaptive streaming */
|
|
||||||
const isAdaptiveEnabled = settings.get_boolean('yt-adaptive-enabled');
|
|
||||||
|
|
||||||
debug(`obtaining DASH itags for resolution: ${itagOpts.width}x${itagOpts.height}`);
|
debug(`obtaining DASH itags for resolution: ${itagOpts.width}x${itagOpts.height}`);
|
||||||
const dashItags = YTItags.getDashItags(itagOpts);
|
const dashItags = YTItags.getDashItags(itagOpts);
|
||||||
debug(`DASH itags: ${JSON.stringify(dashItags)}`);
|
debug(`DASH itags: ${JSON.stringify(dashItags)}`);
|
||||||
@@ -452,7 +450,7 @@ var YouTubeClient = GObject.registerClass({
|
|||||||
filteredStreams[fmt].unshift(foundStream);
|
filteredStreams[fmt].unshift(foundStream);
|
||||||
debug(`added ${fmt} itag: ${foundStream.itag}`);
|
debug(`added ${fmt} itag: ${foundStream.itag}`);
|
||||||
|
|
||||||
if(!isAdaptiveEnabled)
|
if(!itagOpts.adaptive)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user