mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-30 07:42:23 +02:00
Do not keep invalid YT video info
This commit is contained in:
@@ -56,23 +56,21 @@ var YouTubeClient = GObject.registerClass({
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if video is playable */
|
const invalidInfoMsg = (
|
||||||
if(
|
|
||||||
!info.playabilityStatus
|
!info.playabilityStatus
|
||||||
|| !info.playabilityStatus.status === 'OK'
|
|| !info.playabilityStatus.status === 'OK'
|
||||||
) {
|
)
|
||||||
|
? 'video is not playable'
|
||||||
|
: (!info.streamingData)
|
||||||
|
? 'video response data is missing URIs'
|
||||||
|
: null;
|
||||||
|
|
||||||
|
if(invalidInfoMsg) {
|
||||||
|
this.lastInfo = null;
|
||||||
this.emit('info-resolved', false);
|
this.emit('info-resolved', false);
|
||||||
this.downloadingVideoId = null;
|
this.downloadingVideoId = null;
|
||||||
|
|
||||||
return reject(new Error('video is not playable'));
|
return reject(new Error(invalidInfoMsg));
|
||||||
}
|
|
||||||
|
|
||||||
/* Check if data contains streaming URIs */
|
|
||||||
if(!info.streamingData) {
|
|
||||||
this.emit('info-resolved', false);
|
|
||||||
this.downloadingVideoId = null;
|
|
||||||
|
|
||||||
return reject(new Error('video response data is missing URIs'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.lastInfo = info;
|
this.lastInfo = info;
|
||||||
@@ -82,6 +80,8 @@ var YouTubeClient = GObject.registerClass({
|
|||||||
return resolve(info);
|
return resolve(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Do not clear video info here, as we still have
|
||||||
|
* valid info from last video that can be reused */
|
||||||
this.emit('info-resolved', false);
|
this.emit('info-resolved', false);
|
||||||
this.downloadingVideoId = null;
|
this.downloadingVideoId = null;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user