Provider Streaming-URL zu Threadfin Streaming-URL konvertieren
(streamingType, playlistID, channelNumber, channelName, url string, backup_channel_1 *BackupStream, backup_channel_2 *BackupStream, backup_channel_3 *BackupStream)
| 313 | |
| 314 | // Provider Streaming-URL zu Threadfin Streaming-URL konvertieren |
| 315 | func createStreamingURL(streamingType, playlistID, channelNumber, channelName, url string, backup_channel_1 *BackupStream, backup_channel_2 *BackupStream, backup_channel_3 *BackupStream) (streamingURL string, err error) { |
| 316 | |
| 317 | var streamInfo StreamInfo |
| 318 | var serverProtocol string |
| 319 | |
| 320 | if len(Data.Cache.StreamingURLS) == 0 { |
| 321 | Data.Cache.StreamingURLS = make(map[string]StreamInfo) |
| 322 | } |
| 323 | |
| 324 | var urlID = getMD5(fmt.Sprintf("%s-%s", playlistID, url)) |
| 325 | |
| 326 | if s, ok := Data.Cache.StreamingURLS[urlID]; ok { |
| 327 | streamInfo = s |
| 328 | |
| 329 | } else { |
| 330 | streamInfo.URL = url |
| 331 | streamInfo.BackupChannel1 = backup_channel_1 |
| 332 | streamInfo.BackupChannel2 = backup_channel_2 |
| 333 | streamInfo.BackupChannel3 = backup_channel_3 |
| 334 | streamInfo.Name = channelName |
| 335 | streamInfo.PlaylistID = playlistID |
| 336 | streamInfo.ChannelNumber = channelNumber |
| 337 | streamInfo.URLid = urlID |
| 338 | |
| 339 | Data.Cache.StreamingURLS[urlID] = streamInfo |
| 340 | |
| 341 | } |
| 342 | |
| 343 | switch streamingType { |
| 344 | |
| 345 | case "DVR": |
| 346 | serverProtocol = System.ServerProtocol.DVR |
| 347 | |
| 348 | case "M3U": |
| 349 | serverProtocol = System.ServerProtocol.M3U |
| 350 | |
| 351 | } |
| 352 | |
| 353 | if Settings.ForceHttps { |
| 354 | if Settings.HttpsThreadfinDomain != "" { |
| 355 | serverProtocol = "https" |
| 356 | System.Domain = Settings.HttpsThreadfinDomain |
| 357 | } |
| 358 | } |
| 359 | |
| 360 | streamingURL = fmt.Sprintf("%s://%s/stream/%s", serverProtocol, System.Domain, streamInfo.URLid) |
| 361 | return |
| 362 | } |
| 363 | |
| 364 | func getStreamInfo(urlID string) (streamInfo StreamInfo, err error) { |
| 365 |