@@ -6,7 +6,6 @@ use crate::{
66 } ,
77 } ,
88 opt:: { Cdn , FeedType , Opt , Quality , Sport } ,
9- HOST ,
109} ;
1110use chrono:: { DateTime , NaiveDate , Utc } ;
1211use failure:: { bail, format_err, Error , ResultExt } ;
@@ -58,6 +57,7 @@ impl LazyStream {
5857
5958 let game = Game :: new (
6059 opts. sport ,
60+ opts. host . clone ( ) ,
6161 game_pk,
6262 game_date,
6363 date,
@@ -137,6 +137,7 @@ impl LazyStream {
137137#[ derive( Clone ) ]
138138pub struct Game {
139139 sport : Sport ,
140+ host : String ,
140141 pub game_pk : u64 ,
141142 pub game_date : DateTime < Utc > ,
142143 pub selected_date : NaiveDate ,
@@ -149,6 +150,7 @@ pub struct Game {
149150impl Game {
150151 fn new (
151152 sport : Sport ,
153+ host : String ,
152154 game_pk : u64 ,
153155 game_date : DateTime < Utc > ,
154156 selected_date : NaiveDate ,
@@ -157,6 +159,7 @@ impl Game {
157159 ) -> Self {
158160 Game {
159161 sport,
162+ host,
160163 game_pk,
161164 game_date,
162165 selected_date,
@@ -190,6 +193,7 @@ impl Game {
190193
191194 let stream = Stream :: new (
192195 id,
196+ self . host . clone ( ) ,
193197 self . sport ,
194198 feed_type,
195199 self . game_date ,
@@ -348,6 +352,7 @@ impl Game {
348352#[ allow( clippy:: option_option) ]
349353pub struct Stream {
350354 id : String ,
355+ host : String ,
351356 sport : Sport ,
352357 pub feed_type : FeedType ,
353358 game_date : DateTime < Utc > ,
@@ -360,13 +365,15 @@ pub struct Stream {
360365impl Stream {
361366 fn new (
362367 id : String ,
368+ host : String ,
363369 sport : Sport ,
364370 feed_type : FeedType ,
365371 game_date : DateTime < Utc > ,
366372 selected_date : NaiveDate ,
367373 ) -> Self {
368374 Stream {
369375 id,
376+ host,
370377 sport,
371378 feed_type,
372379 game_date,
@@ -380,7 +387,7 @@ impl Stream {
380387 pub fn host_link ( & self , cdn : Cdn ) -> String {
381388 format ! (
382389 "{}/getM3U8.php?league={}&date={}&id={}&cdn={}" ,
383- HOST ,
390+ self . host ,
384391 self . sport,
385392 self . selected_date. format( "%Y-%m-%d" ) ,
386393 self . id,
0 commit comments