Remove all YouTube code

It has been broken for quite some time. From now on this is gonna be left to handle for GStreamer plugins.
This commit is contained in:
Rafał Dzięgiel
2021-12-20 13:35:50 +01:00
parent 7a508fef39
commit f6a1aaf1dc
10 changed files with 13 additions and 1566 deletions

View File

@@ -2,7 +2,6 @@ const { Adw, Gdk, Gio, GObject, Gst, GstClapper, Gtk } = imports.gi;
const ByteArray = imports.byteArray;
const Debug = imports.src.debug;
const Misc = imports.src.misc;
const YouTube = imports.src.youtube;
const { PlaylistWidget } = imports.src.playlist;
const { WebApp } = imports.src.webApp;
@@ -45,12 +44,10 @@ class ClapperPlayer extends GstClapper.Clapper
this.webserver = null;
this.webapp = null;
this.ytClient = null;
this.playlistWidget = new PlaylistWidget();
this.seekDone = true;
this.needsFastSeekRestore = false;
this.customVideoTitle = null;
this.windowMapped = false;
this.quitOnStop = false;
@@ -142,42 +139,19 @@ class ClapperPlayer extends GstClapper.Clapper
set_uri(uri)
{
this.customVideoTitle = null;
if(Misc.getUriProtocol(uri) === 'file') {
const file = Misc.getFileFromLocalUri(uri);
if(!file) {
if(!this.playlistWidget.nextTrack())
debug('set media reached end of playlist');
if(Misc.getUriProtocol(uri) !== 'file') {
const [isYouTubeUri, videoId] = YouTube.checkYouTubeUri(uri);
return;
}
if(uri.endsWith('.claps')) {
this.load_playlist_file(file);
if(!isYouTubeUri)
return super.set_uri(uri);
if(!this.ytClient)
this.ytClient = new YouTube.YouTubeClient();
const { root } = this.widget;
const surface = root.get_surface();
const monitor = root.display.get_monitor_at_surface(surface);
this.ytClient.getPlaybackDataAsync(videoId, monitor)
.then(data => {
this.customVideoTitle = data.title;
super.set_uri(data.uri);
})
.catch(debug);
return;
}
const file = Misc.getFileFromLocalUri(uri);
if(!file) {
if(!this.playlistWidget.nextTrack())
debug('set media reached end of playlist');
return;
}
if(uri.endsWith('.claps')) {
this.load_playlist_file(file);
return;
return;
}
}
super.set_uri(uri);