Skip to content

Commit

Permalink
improve logging messages
Browse files Browse the repository at this point in the history
  • Loading branch information
sonroyaalmerol committed Mar 2, 2024
1 parent 3e22d1b commit f2fc16a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ If your IPTV provider issues multiple M3U links for each connection, but you pre
## How It Works

1. **Initialization and M3U Playlist Consolidation:**
- On startup, the service loads M3U playlists from the specified URLs (M3U_URL_1, M3U_URL_2, M3U_URL_3, etc.). This usually takes a while, depending on the size of the original M3U files as it goes through each entry.
- On startup, the service loads M3U playlists from the specified URLs (M3U_URL_1, M3U_URL_2, M3U_URL_3, etc.). This usually takes a while, depending on the size of the original M3U files as it goes through each entry. The parsing process will be done in the background.
- It consolidates the playlists by merging different streams based on their stream name.
- The consolidated data will be saved in a JSON file in the data folder which will serve as its "database."
- For each unique stream name, the service aggregates the corresponding stream URLs into a consolidated M3U playlist.
Expand Down
6 changes: 4 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ func updateSource(ctx context.Context, m3uUrl string, index int) {
case <-ctx.Done():
return
default:
fmt.Printf("Updating M3U #%s from %d\n", m3uUrl, index)
fmt.Printf("Background process: Updating M3U #%s from %d\n", m3uUrl, index)
err := m3u.ParseM3UFromURL(m3uUrl, index)
if err != nil {
fmt.Printf("Error updating M3U: %v\n", err)
}

fmt.Printf("Updated M3U #%s from %d\n", m3uUrl, index)
fmt.Printf("Background process: Updated M3U #%s from %d\n", m3uUrl, index)

updateIntervalInHour, exists := os.LookupEnv("UPDATE_INTERVAL")
if !exists {
Expand Down Expand Up @@ -63,5 +63,7 @@ func main() {

// Start the server
fmt.Println("Server is running on port 8080...")
fmt.Println("Playlist Endpoint is running (`/playlist.m3u`)")
fmt.Println("Stream Endpoint is running (`/stream/{streamID}.mp4`)")
http.ListenAndServe(":8080", nil)
}

0 comments on commit f2fc16a

Please sign in to comment.