Skip to content

Commit

Permalink
Fix vodcast detection
Browse files Browse the repository at this point in the history
Twitch has changed the value of the broadcast_platform and stream_type
attributes from "watch_party" to "rerun" in the "stable" kraken/v5 API.
  • Loading branch information
bastimeyer committed Apr 6, 2018
1 parent 6d2542b commit 67d23f8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/app/models/twitch/Stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ const fpsRanges = [
{ target: 144, min: 142, max: 146 }
];

const reRerun = /rerun|watch_party/;


export default Model.extend({
i18n: service(),
Expand Down Expand Up @@ -75,8 +77,8 @@ export default Model.extend({
"channel.status",
function() {
if (
get( this, "broadcast_platform" ) === "watch_party"
|| get( this, "stream_type" ) === "watch_party"
reRerun.test( get( this, "broadcast_platform" ) )
|| reRerun.test( get( this, "stream_type" ) )
) {
return true;
}
Expand Down
12 changes: 12 additions & 0 deletions src/test/tests/models/twitch/Stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,12 +215,24 @@ test( "Computed properties", function( assert ) {
});
assert.ok( get( record, "isVodcast" ), "Is a vodcast now" );

setProperties( record, {
broadcast_platform: "rerun",
stream_type: "live"
});
assert.ok( get( record, "isVodcast" ), "Is still vodcast/rerun" );

setProperties( record, {
broadcast_platform: "live",
stream_type: "watch_party"
});
assert.ok( get( record, "isVodcast" ), "Is still a vodcast" );

setProperties( record, {
broadcast_platform: "live",
stream_type: "rerun"
});
assert.ok( get( record, "isVodcast" ), "Is still a vodcast/rerun" );

setProperties( record, {
broadcast_platform: "live",
stream_type: "live"
Expand Down

0 comments on commit 67d23f8

Please sign in to comment.