mirror of
https://github.com/nxshock/promodj.git
synced 2024-11-27 03:01:01 +05:00
Compare commits
2 Commits
f7c03b0110
...
87bc382747
Author | SHA1 | Date | |
---|---|---|---|
87bc382747 | |||
fc684125cc |
@ -48,9 +48,7 @@ func handlePlayer(w http.ResponseWriter, r *http.Request) {
|
||||
var data []J
|
||||
|
||||
for _, track := range tracks {
|
||||
host := "music.nxshock.me"
|
||||
|
||||
u, _ := url.Parse(fmt.Sprintf("https://%s/stream", host))
|
||||
u, _ := url.Parse("stream")
|
||||
q := make(url.Values)
|
||||
q.Add("url", track.Url)
|
||||
u.RawQuery = q.Encode()
|
||||
@ -88,7 +86,7 @@ func handleGetM3u(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "audio/x-mpegurl")
|
||||
w.Header().Set("Accept-Ranges", "none")
|
||||
|
||||
w.Write(b)
|
||||
_, _ = w.Write(b)
|
||||
}
|
||||
|
||||
func handleStream(w http.ResponseWriter, r *http.Request) {
|
||||
|
17
parser.go
17
parser.go
@ -3,6 +3,7 @@ package main
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
@ -40,7 +41,13 @@ func UpdateGenres() error {
|
||||
func updateGenreList() ([]Genre, error) {
|
||||
url := "https://promodj.com/music"
|
||||
|
||||
doc, err := goquery.NewDocument(url)
|
||||
resp, err := http.Get(url)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
doc, err := goquery.NewDocumentFromReader(resp.Body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -54,7 +61,13 @@ func updateGenreList() ([]Genre, error) {
|
||||
}
|
||||
|
||||
func parsePage(url string, resultsChan chan TrackInfo) {
|
||||
doc, err := goquery.NewDocument(url)
|
||||
resp, err := http.Get(url)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
doc, err := goquery.NewDocumentFromReader(resp.Body)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ func encode(url string, w io.Writer) error {
|
||||
buf := buffer.New(int64(config.BufferSize) * 1024 * 1024)
|
||||
_, err = nio.Copy(w, out, buf)
|
||||
if err != nil {
|
||||
cmd.Process.Kill()
|
||||
_ = cmd.Process.Kill()
|
||||
}
|
||||
|
||||
return nil
|
||||
|
Loading…
Reference in New Issue
Block a user