mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-29 23:32:04 +02:00
Add some YouTube related preferences
This commit is contained in:
@@ -102,7 +102,11 @@
|
||||
<!-- YouTube -->
|
||||
<key name="yt-adaptive-enabled" type="b">
|
||||
<default>false</default>
|
||||
<summary>Enable to use adaptive streaming</summary>
|
||||
<summary>Enable to use adaptive streaming for YouTube</summary>
|
||||
</key>
|
||||
<key name="yt-quality-type" type="s">
|
||||
<default>"hfr"</default>
|
||||
<summary>Max YouTube video quality type</summary>
|
||||
</key>
|
||||
|
||||
<!-- Other -->
|
||||
|
@@ -228,6 +228,10 @@ class ClapperPrefsDialog extends Gtk.Dialog
|
||||
{
|
||||
title: 'Network',
|
||||
widget: Prefs.NetworkPage,
|
||||
},
|
||||
{
|
||||
title: 'YouTube',
|
||||
widget: Prefs.YouTubePage,
|
||||
}
|
||||
]
|
||||
},
|
||||
|
16
src/prefs.js
16
src/prefs.js
@@ -132,6 +132,22 @@ class ClapperNetworkPage extends PrefsBase.Grid
|
||||
}
|
||||
});
|
||||
|
||||
var YouTubePage = GObject.registerClass(
|
||||
class ClapperYouTubePage extends PrefsBase.Grid
|
||||
{
|
||||
_init()
|
||||
{
|
||||
super._init();
|
||||
|
||||
this.addTitle('YouTube');
|
||||
this.addCheckButton('Adaptive streaming', 'yt-adaptive-enabled');
|
||||
this.addComboBoxText('Max quality', [
|
||||
['normal', "Normal"],
|
||||
['hfr', "HFR"],
|
||||
], 'yt-quality-type');
|
||||
}
|
||||
});
|
||||
|
||||
var GStreamerPage = GObject.registerClass(
|
||||
class ClapperGStreamerPage extends PrefsBase.Grid
|
||||
{
|
||||
|
@@ -317,7 +317,7 @@ var YouTubeClient = GObject.registerClass({
|
||||
width: monitor.geometry.width * monitor.scale_factor,
|
||||
height: monitor.geometry.height * monitor.scale_factor,
|
||||
codec: 'h264',
|
||||
types: ['standard', 'hfr'],
|
||||
type: settings.get_string('yt-quality-type'),
|
||||
};
|
||||
const dashInfo = await this.getDashInfoAsync(info, itagOpts).catch(debug);
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
const Itags = {
|
||||
video: {
|
||||
h264: {
|
||||
standard: {
|
||||
normal: {
|
||||
240: 133,
|
||||
360: 134,
|
||||
480: 135,
|
||||
@@ -49,10 +49,14 @@ function getDashItags(opts)
|
||||
? Itags.audio.aac
|
||||
: Itags.audio.opus
|
||||
};
|
||||
const types = Object.keys(Itags.video[opts.codec]);
|
||||
|
||||
for(let type of opts.types) {
|
||||
for(let type of types) {
|
||||
const formats = Itags.video[opts.codec][type];
|
||||
_appendItagArray(allowed.video, opts, formats);
|
||||
|
||||
if(type === opts.type)
|
||||
break;
|
||||
}
|
||||
|
||||
return allowed;
|
||||
|
Reference in New Issue
Block a user