diff --git a/go.mod b/go.mod index 7114e84..432185f 100644 --- a/go.mod +++ b/go.mod @@ -6,22 +6,25 @@ require ( github.com/bwmarrin/discordgo v0.27.1 github.com/gorilla/handlers v1.5.2 github.com/gorilla/sessions v1.2.2 - github.com/kkdai/youtube/v2 v2.9.0 + github.com/kkdai/youtube/v2 v2.10.0 github.com/robrotheram/dca v0.0.0-20240103231016-764e174aecab github.com/segmentio/ksuid v1.0.4 github.com/sirupsen/logrus v1.9.3 - golang.org/x/net v0.19.0 - golang.org/x/oauth2 v0.15.0 + golang.org/x/net v0.21.0 + golang.org/x/oauth2 v0.17.0 + gopkg.in/vansante/go-ffprobe.v2 v2.1.1 ) require ( - github.com/felixge/httpsnoop v1.0.3 // indirect + github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect + github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/gorilla/securecookie v1.1.2 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect - github.com/pelletier/go-toml/v2 v2.1.0 // indirect + github.com/pelletier/go-toml/v2 v2.1.1 // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/sagikazarmark/locafero v0.4.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect github.com/sourcegraph/conc v0.3.0 // indirect @@ -29,9 +32,8 @@ require ( github.com/spf13/cast v1.6.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/subosito/gotenv v1.6.0 // indirect - go.uber.org/atomic v1.9.0 // indirect - go.uber.org/multierr v1.9.0 // indirect - golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect + go.uber.org/multierr v1.11.0 // indirect + golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect google.golang.org/appengine v1.6.8 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect @@ -39,19 +41,20 @@ require ( require ( github.com/bitly/go-simplejson v0.5.1 // indirect - github.com/dlclark/regexp2 v1.10.0 // indirect - github.com/dop251/goja v0.0.0-20230828202809-3dbe69dd2b8e // indirect + github.com/dlclark/regexp2 v1.11.0 // indirect + github.com/dop251/goja v0.0.0-20240220182346-e401ed450204 // indirect github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect github.com/golang/protobuf v1.5.3 // indirect - github.com/google/pprof v0.0.0-20230907193218-d3ddc7976beb // indirect - github.com/google/uuid v1.5.0 + github.com/google/pprof v0.0.0-20240227163752-401108e1b7e7 // indirect + github.com/google/uuid v1.6.0 github.com/gorilla/mux v1.8.1 - github.com/gorilla/websocket v1.5.0 + github.com/gorilla/websocket v1.5.1 github.com/jonas747/ogg v0.0.0-20161220051205-b4f6f4cf3757 // indirect - github.com/spf13/viper v1.18.1 - go.etcd.io/bbolt v1.3.8 - golang.org/x/crypto v0.16.0 // indirect - golang.org/x/sys v0.15.0 // indirect + github.com/spf13/viper v1.18.2 + github.com/stretchr/testify v1.8.4 + go.etcd.io/bbolt v1.3.9 + golang.org/x/crypto v0.20.0 // indirect + golang.org/x/sys v0.17.0 // indirect golang.org/x/text v0.14.0 // indirect - google.golang.org/protobuf v1.31.0 // indirect + google.golang.org/protobuf v1.32.0 // indirect ) diff --git a/go.sum b/go.sum index 96db373..eae8c39 100644 --- a/go.sum +++ b/go.sum @@ -13,15 +13,15 @@ github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1 github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= github.com/dlclark/regexp2 v1.7.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= -github.com/dlclark/regexp2 v1.10.0 h1:+/GIL799phkJqYW+3YbOd8LCcbHzT0Pbo8zl70MHsq0= -github.com/dlclark/regexp2 v1.10.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= +github.com/dlclark/regexp2 v1.11.0 h1:G/nrcoOa7ZXlpoa/91N3X7mM3r8eIlMBBJZvsz/mxKI= +github.com/dlclark/regexp2 v1.11.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= github.com/dop251/goja v0.0.0-20211022113120-dc8c55024d06/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk= -github.com/dop251/goja v0.0.0-20230828202809-3dbe69dd2b8e h1:UvQD6hTSfeM6hhTQ24Dlw2RppP05W7SWbWb6kubJAog= -github.com/dop251/goja v0.0.0-20230828202809-3dbe69dd2b8e/go.mod h1:QMWlm50DNe14hD7t24KEqZuUdC9sOTy8W6XbCU1mlw4= +github.com/dop251/goja v0.0.0-20240220182346-e401ed450204 h1:O7I1iuzEA7SG+dK8ocOBSlYAA9jBUmCYl/Qa7ey7JAM= +github.com/dop251/goja v0.0.0-20240220182346-e401ed450204/go.mod h1:QMWlm50DNe14hD7t24KEqZuUdC9sOTy8W6XbCU1mlw4= github.com/dop251/goja_nodejs v0.0.0-20210225215109-d91c329300e7/go.mod h1:hn7BA7c8pLvoGndExHudxTDKZ84Pyvv+90pbBjbTz0Y= github.com/dop251/goja_nodejs v0.0.0-20211022123610-8dd9abb0616d/go.mod h1:DngW8aVqWbuLRMHItjPUyqdj+HWPvnQe8V8y1nDpIbM= -github.com/felixge/httpsnoop v1.0.3 h1:s/nj+GCswXYzN5v2DpNMuMQYe+0DDwt5WVCU6CWBdXk= -github.com/felixge/httpsnoop v1.0.3/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= +github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= @@ -38,10 +38,10 @@ github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/pprof v0.0.0-20230207041349-798e818bf904/go.mod h1:uglQLonpP8qtYCYyzA+8c/9qtqgA3qsXGYqCPKARAFg= -github.com/google/pprof v0.0.0-20230907193218-d3ddc7976beb h1:LCMfzVg3sflxTs4UvuP4D8CkoZnfHLe2qzqgDn/4OHs= -github.com/google/pprof v0.0.0-20230907193218-d3ddc7976beb/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik= -github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU= -github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/pprof v0.0.0-20240227163752-401108e1b7e7 h1:y3N7Bm7Y9/CtpiVkw/ZWj6lSlDF3F74SfKwfTCer72Q= +github.com/google/pprof v0.0.0-20240227163752-401108e1b7e7/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gorilla/handlers v1.5.2 h1:cLTUSsNkgcwhgRqvCNmdbRWG0A3N4F+M2nWKdScwyEE= github.com/gorilla/handlers v1.5.2/go.mod h1:dX+xVpaxdSw+q0Qek8SSsl3dfMk3jNddUkMzo0GtH0w= github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= @@ -51,16 +51,17 @@ github.com/gorilla/securecookie v1.1.2/go.mod h1:NfCASbcHqRSY+3a8tlWJwsQap2VX5pw github.com/gorilla/sessions v1.2.2 h1:lqzMYz6bOfvn2WriPUjNByzeXIlVzURcPmgMczkmTjY= github.com/gorilla/sessions v1.2.2/go.mod h1:ePLdVu+jbEgHH+KWw8I1z2wqd0BAdAQh/8LRvBeoNcQ= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= +github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/ianlancetaylor/demangle v0.0.0-20220319035150-800ac71e25c2/go.mod h1:aYm2/VgdVmcIU8iMfdMvDMsRAQjcfZSKFby6HOFvi/w= github.com/jonas747/dca v0.0.0-20210930103944-155f5e5f0cc7/go.mod h1:rxjYX9OJU81unMxQDHChU/lAiOhlY9MV+faPX/NmwLk= github.com/jonas747/ogg v0.0.0-20161220051205-b4f6f4cf3757 h1:Kyv+zTfWIGRNaz/4+lS+CxvuKVZSKFz/6G8E3BKKBRs= github.com/jonas747/ogg v0.0.0-20161220051205-b4f6f4cf3757/go.mod h1:cZnNmdLiLpihzgIVqiaQppi9Ts3D4qF/M45//yW35nI= -github.com/kkdai/youtube/v2 v2.9.0 h1:J7BvfIsxEyyd1MmB/75LgDvG8BGGsG9bSHpbo/qIb+8= -github.com/kkdai/youtube/v2 v2.9.0/go.mod h1:H0ntZBgaah4F0wxnEUkLa6yUeyTDDg06xFJ3tvA6gOw= +github.com/kkdai/youtube/v2 v2.10.0 h1:s8gSWo3AxIafK560XwDVnha9aPXp3N2HQAh1x81R5Og= +github.com/kkdai/youtube/v2 v2.10.0/go.mod h1:H5MLUXiXYuovcEhQT/uZf7BC/syIbAJlDKCDsG+WDsU= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= @@ -74,8 +75,8 @@ github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0V github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= -github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= +github.com/pelletier/go-toml/v2 v2.1.1 h1:LWAJwfNvjQZCFIDKWYQaM62NcYeYViCmWIwmOStowAI= +github.com/pelletier/go-toml/v2 v2.1.1/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= @@ -100,12 +101,11 @@ github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.18.1 h1:rmuU42rScKWlhhJDyXZRKJQHXFX02chSVW1IvkPGiVM= -github.com/spf13/viper v1.18.1/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk= +github.com/spf13/viper v1.18.2 h1:LUXCnvUvSM6FXAsj6nnfc8Q2tp1dIgUfY9Kc8GsSOiQ= +github.com/spf13/viper v1.18.2/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= @@ -114,31 +114,31 @@ github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXl github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -go.etcd.io/bbolt v1.3.8 h1:xs88BrvEv273UsB79e0hcVrlUWmS0a8upikMFhSyAtA= -go.etcd.io/bbolt v1.3.8/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= -go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= -go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI= -go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ= +go.etcd.io/bbolt v1.3.9 h1:8x7aARPEXiXbHmtUwAIv7eV2fQFHrLLavdiJ3uzJXoI= +go.etcd.io/bbolt v1.3.9/go.mod h1:zaO32+Ti0PK1ivdPtgMESzuzL2VPoIG1PCQNvOdo/dE= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.16.0 h1:mMMrFzRSCF0GvB7Ne27XVtVAaXLrPmgPC7/v0tkwHaY= -golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= -golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g= -golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k= +golang.org/x/crypto v0.20.0 h1:jmAMJJZXr5KiCw05dfYK9QnqaqKLYXijU23lsEdcQqg= +golang.org/x/crypto v0.20.0/go.mod h1:Xwo95rrVNIoSMx9wa1JroENMToLWn3RNVrTBpLHgZPQ= +golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 h1:LfspQV/FYTatPTr/3HzIcmiUFH7PGP+OQ6mgDYo3yuQ= +golang.org/x/exp v0.0.0-20240222234643-814bf88cf225/go.mod h1:CxmFvTBINI24O/j8iY7H1xHzx2i4OsyguNBmN/uPtqc= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= -golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= -golang.org/x/oauth2 v0.15.0 h1:s8pnnxNVzjWyrvYdFUQq5llS1PX2zhPXmccZv99h7uQ= -golang.org/x/oauth2 v0.15.0/go.mod h1:q48ptWNTY5XWf+JNten23lcvHpLJ0ZSxF5ttTHKVCAM= +golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= +golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/oauth2 v0.17.0 h1:6m3ZPmLEFdVxKKWnKq4VqZ60gutO35zm+zrAHVmHyDQ= +golang.org/x/oauth2 v0.17.0/go.mod h1:OzPDGQiuQMguemayvdylqddI7qcD9lnSDb+1FiwQ5HA= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= +golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -148,8 +148,8 @@ golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= -golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -168,8 +168,8 @@ google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAs google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= -google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= +google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= @@ -177,6 +177,8 @@ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EV gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/vansante/go-ffprobe.v2 v2.1.1 h1:DIh5fMn+tlBvG7pXyUZdemVmLdERnf2xX6XOFF+0BBU= +gopkg.in/vansante/go-ffprobe.v2 v2.1.1/go.mod h1:qF0AlAjk7Nqzqf3y333Ly+KxN3cKF2JqA3JT5ZheUGE= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/main.go b/main.go index d5c5b76..36017a7 100644 --- a/main.go +++ b/main.go @@ -1,7 +1,6 @@ package main import ( - "fmt" "os" "path/filepath" "w2g/pkg/api" @@ -42,5 +41,5 @@ func main() { defer bot.Close() app := api.NewApp(utils.Configuration, hub) - fmt.Println(app.Start()) + app.Start() } diff --git a/pkg/api/authentication.go b/pkg/api/authentication.go index 8ed1b68..78baae0 100644 --- a/pkg/api/authentication.go +++ b/pkg/api/authentication.go @@ -159,14 +159,14 @@ func (da *DiscordAuth) HandleLogin(w http.ResponseWriter, r *http.Request) { func (da *DiscordAuth) ClearSession(w http.ResponseWriter, r *http.Request) { session, err := da.store.Get(r, sessionName) if err != nil { - fmt.Printf("failed to get session: %v", err) + log.Debugf("failed to get session: %v", err) return } session.Values["token"] = "" session.Options.MaxAge = -1 err = session.Save(r, w) if err != nil { - fmt.Printf("failed to delete session: %v", err) + log.Debugf("failed to delete session: %v", err) return } } diff --git a/pkg/api/handlers.go b/pkg/api/handlers.go index 7fe7c5e..786f92c 100644 --- a/pkg/api/handlers.go +++ b/pkg/api/handlers.go @@ -13,6 +13,7 @@ import ( "w2g/pkg/utils" "github.com/gorilla/mux" + log "github.com/sirupsen/logrus" ) type handler struct { @@ -439,7 +440,7 @@ func (h *handler) handleMediaProxy(w http.ResponseWriter, r *http.Request) { // Stream the response body to the client _, err = io.Copy(w, resp.Body) if err != nil { - fmt.Printf("Failed to stream response body: %s\n", err) + log.Debugf("Failed to stream response body: %s\n", err) return } } diff --git a/pkg/api/websocket.go b/pkg/api/websocket.go index 4bafddb..79f65e8 100644 --- a/pkg/api/websocket.go +++ b/pkg/api/websocket.go @@ -2,7 +2,6 @@ package api import ( "encoding/json" - "fmt" "net/http" "time" "w2g/pkg/controllers" @@ -10,6 +9,7 @@ import ( "github.com/google/uuid" "github.com/gorilla/websocket" + log "github.com/sirupsen/logrus" ) const WEBPLAYER = controllers.PlayerType("WEB_PLAYER") @@ -46,7 +46,7 @@ func (c *Client) Read() { for { _, msg, err := c.socket.ReadMessage() if err != nil { - fmt.Printf("ERROR decoding %v", err) + log.Debugf("ERROR decoding %v", err) c.contoller.RemoveListner(c.id) c.contoller.Leave(c.id, c.user.Username) return @@ -86,13 +86,11 @@ func (wb *Client) Id() string { } func (wb *Client) Play(url string, start int) (controllers.PlayerExitCode, error) { - fmt.Println(WEBPLAYER + "_PLAY") wb.progress = media.MediaDuration{ Progress: 0, } wb.running = true <-wb.done - fmt.Println(WEBPLAYER + "_DONE") return wb.exitCode, nil } @@ -100,24 +98,19 @@ func (wb *Client) Progress() media.MediaDuration { return wb.progress } -func (wb *Client) Pause() { - fmt.Println(WEBPLAYER + "_PAUSE") -} +func (wb *Client) Pause() {} func (wb *Client) Unpause() { - fmt.Println(WEBPLAYER + "_UNPAUSE") wb.running = true } func (wb *Client) Stop() { wb.exitCode = controllers.STOP_EXITCODE - fmt.Println(WEBPLAYER + "_STOP") if wb.running { wb.running = false wb.done <- "STOP" } } func (wb *Client) Close() { - fmt.Println(WEBPLAYER + "_CLOSE") wb.exitCode = controllers.EXIT_EXITCODE } diff --git a/pkg/controllers/auditing.go b/pkg/controllers/auditing.go index 9c01f69..6f494c7 100644 --- a/pkg/controllers/auditing.go +++ b/pkg/controllers/auditing.go @@ -1,6 +1,8 @@ package controllers -import log "github.com/sirupsen/logrus" +import ( + log "github.com/sirupsen/logrus" +) type Auditing struct { } diff --git a/pkg/controllers/betterStackAuditing.go b/pkg/controllers/betterStackAuditing.go new file mode 100644 index 0000000..0f54d9c --- /dev/null +++ b/pkg/controllers/betterStackAuditing.go @@ -0,0 +1,48 @@ +package controllers + +import ( + "bytes" + "encoding/json" + "fmt" + "net/http" +) + +type BetterStack struct { + Token string +} + +type BetterStackMessage struct { + Level string `json:"level"` + Severity string `json:"severity"` + Status Action `json:"status"` + Message string `json:"message"` + State PlayerState `json:"state"` +} + +func (a *BetterStack) Send(event Event) { + jsonData, err := json.Marshal(BetterStackMessage{ + Level: "info", + Severity: "low", + Status: event.Action, + State: event.State, + }) + if err != nil { + fmt.Println("Error marshaling JSON:", err) + return + } + req, err := http.NewRequest("POST", "https://in.logs.betterstack.com", bytes.NewBuffer(jsonData)) + if err != nil { + fmt.Println("Error creating request:", err) + return + } + req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", a.Token)) + req.Header.Set("Content-Type", "application/json") + + client := &http.Client{} + resp, err := client.Do(req) + if err != nil { + fmt.Println("Error sending request:", err) + return + } + defer resp.Body.Close() +} diff --git a/pkg/controllers/controller.go b/pkg/controllers/controller.go index 57e5929..02846f4 100644 --- a/pkg/controllers/controller.go +++ b/pkg/controllers/controller.go @@ -1,13 +1,13 @@ package controllers import ( - "fmt" "sync" "time" "w2g/pkg/media" "w2g/pkg/utils" "github.com/google/uuid" + log "github.com/sirupsen/logrus" bolt "go.etcd.io/bbolt" ) @@ -36,6 +36,10 @@ func NewController(id string, db *bolt.DB) *Controller { } contoller.load(id) contoller.AddListner(uuid.NewString(), &Auditing{}) + if utils.Configuration.BetterStackToken != "" { + contoller.AddListner(uuid.NewString(), &BetterStack{Token: utils.Configuration.BetterStackToken}) + } + return &contoller } @@ -164,6 +168,9 @@ func (c *Controller) Join(player Player, user string) { func (c *Controller) Leave(id string, user string) { c.players.Remvoe(id) c.Notify(LEAVE_ACTION, user) + if len(c.players.players) == 0 { + c.Stop(SYSTEM) + } } func (c *Controller) ContainsPlayer(id string) bool { @@ -174,22 +181,21 @@ func (c *Controller) ContainsPlayer(id string) bool { } func (c *Controller) progress() { - fmt.Println("START") for { audio := c.state.Current.GetAudioUrl() - fmt.Println("START_PLAYING") + log.Debug("START_PLAYING") c.players.Play(audio, 0) - fmt.Println("STOP_PLAYING") - if len(c.state.Current.Url) == 0 || c.players.Empty() || c.state.State == STOP { - c.Stop(SYSTEM) - fmt.Println("DONE") - return - } + log.Debug("STOP_PLAYING") if !c.state.Loop { c.state.Next() c.Notify(UPDATE_QUEUE, SYSTEM) } - fmt.Println("NEXT") + if len(c.state.Current.Url) == 0 || c.players.Empty() || c.state.State == STOP { + c.Stop(SYSTEM) + log.Debug("DONE") + return + } + log.Debug("NEXT") } } diff --git a/pkg/controllers/player.go b/pkg/controllers/player.go index f36e5fa..e804c65 100644 --- a/pkg/controllers/player.go +++ b/pkg/controllers/player.go @@ -1,10 +1,11 @@ package controllers import ( - "fmt" "sync" "time" "w2g/pkg/media" + + log "github.com/sirupsen/logrus" ) type PlayerType string @@ -97,7 +98,7 @@ func (p *Players) Play(url string, start int) { go func(player Player) { exit, err := player.Play(url, start) if err != nil { - fmt.Printf("%s player error: %v", player.Type(), err) + log.Warnf("%s player error: %v", player.Type(), err) } wg.Done() if exit == STOP_EXITCODE { diff --git a/pkg/discord/players/discord.go b/pkg/discord/players/discord.go index 72faa2d..08205d1 100644 --- a/pkg/discord/players/discord.go +++ b/pkg/discord/players/discord.go @@ -76,9 +76,7 @@ func (player *DiscordPlayer) playStream() { ticker := time.NewTicker(time.Second) for { select { - case msg := <-player.done: - // Clean up incase something happened and ffmpeg is still running - fmt.Printf("player msg: %v\n", msg) + case <-player.done: player.Finish() return case <-ticker.C: @@ -170,7 +168,6 @@ func (player *DiscordPlayer) Play(url string, startTime int) (controllers.Player player.playStream() if player.seekTo > -1 { - fmt.Println("SEEKING") player.Finish() return player.Play(url, int(player.seekTo.Seconds())) } diff --git a/pkg/media/MP3Audio.go b/pkg/media/MP3Audio.go index f87dc93..51efd2c 100644 --- a/pkg/media/MP3Audio.go +++ b/pkg/media/MP3Audio.go @@ -1,6 +1,10 @@ package media -import "github.com/segmentio/ksuid" +import ( + "time" + + "github.com/segmentio/ksuid" +) type MP3Video struct{} @@ -10,16 +14,21 @@ func init() { } func (client *MP3Video) GetMedia(url string, username string) ([]Media, error) { - return []Media{ - { - ID: ksuid.New().String(), - Url: url, - User: username, - Type: MediaType(client.GetType()), - Title: url, - AudioUrl: url, - }, - }, nil + track := Media{ + ID: ksuid.New().String(), + Url: url, + User: username, + Type: MediaType(client.GetType()), + Title: url, + AudioUrl: url, + } + if data, err := getMediaInfo(url); err == nil { + track.Title = data.Format.Filename + track.Progress = MediaDuration{ + Duration: time.Duration(data.Format.DurationSeconds * float64(time.Second)), + } + } + return []Media{track}, nil } func (client *MP3Video) Refresh(media *Media) error { diff --git a/pkg/media/MP4Vidoe.go b/pkg/media/MP4Vidoe.go index 446f25b..81b82b8 100644 --- a/pkg/media/MP4Vidoe.go +++ b/pkg/media/MP4Vidoe.go @@ -1,6 +1,12 @@ package media -import "github.com/segmentio/ksuid" +import ( + "context" + "time" + + "github.com/segmentio/ksuid" + "gopkg.in/vansante/go-ffprobe.v2" +) type MP4Video struct{} @@ -9,17 +15,28 @@ func init() { MediaFactory.Register(mp4Client) } +func getMediaInfo(url string) (*ffprobe.ProbeData, error) { + ctx, cancelFn := context.WithTimeout(context.Background(), 2*time.Second) + defer cancelFn() + return ffprobe.ProbeURL(ctx, url) +} + func (client *MP4Video) GetMedia(url string, username string) ([]Media, error) { - return []Media{ - { - ID: ksuid.New().String(), - Url: url, - User: username, - Type: MediaType(client.GetType()), - Title: url, - AudioUrl: url, - }, - }, nil + track := Media{ + ID: ksuid.New().String(), + Url: url, + User: username, + Type: MediaType(client.GetType()), + Title: url, + AudioUrl: url, + } + if data, err := getMediaInfo(url); err == nil { + track.Title = data.Format.Filename + track.Progress = MediaDuration{ + Duration: time.Duration(data.Format.DurationSeconds * float64(time.Second)), + } + } + return []Media{track}, nil } func (client *MP4Video) Refresh(media *Media) error { diff --git a/pkg/media/Odysee.go b/pkg/media/Odysee.go index c849bfc..f63ae3f 100644 --- a/pkg/media/Odysee.go +++ b/pkg/media/Odysee.go @@ -2,9 +2,11 @@ package media import ( "encoding/json" - "io/ioutil" + "fmt" + "io" "net/http" "regexp" + "strconv" "strings" "time" @@ -55,9 +57,28 @@ func (sc *OdyseeAPI) getOdyseePage(url string) ([]byte, error) { return []byte{}, err } defer resp.Body.Close() - return ioutil.ReadAll(resp.Body) + return io.ReadAll(resp.Body) } +func parseDuration(durationStr string) (time.Duration, error) { + re := regexp.MustCompile(`PT(\d+)M(\d+)S`) + matches := re.FindStringSubmatch(durationStr) + if len(matches) != 3 { + return 0, fmt.Errorf("invalid duration format: %s", durationStr) + } + + minutes, err := strconv.Atoi(matches[1]) + if err != nil { + return 0, err + } + + seconds, err := strconv.Atoi(matches[2]) + if err != nil { + return 0, err + } + + return time.Duration(minutes)*time.Minute + time.Duration(seconds)*time.Second, nil +} func parse(text string) (data []string) { tkn := html.NewTokenizer(strings.NewReader(text)) @@ -95,30 +116,37 @@ func parse(text string) (data []string) { func (sc *OdyseeAPI) GetMedia(url string, username string) ([]Media, error) { data, _ := sc.getOdyseePage(url) - parsedData := parse(string(data))[0] - parsedData = strings.ReplaceAll(parsedData, "\n", "") - parsedData = strings.ReplaceAll(parsedData, "\\", "") - dataInBytes := []byte(parsedData) + scripts := parse(string(data)) + var tackData odyseeStruct + for _, script := range scripts { + script = strings.ReplaceAll(script, "\n", "") + script = strings.ReplaceAll(script, "\\", "") + dataInBytes := []byte(script) + if json.Unmarshal(dataInBytes, &tackData) == nil { + break + } + } media := []Media{} - - err := json.Unmarshal(dataInBytes, &tackData) - if err != nil { - return media, err + if tackData.ContentURL == "" { + return media, fmt.Errorf("unable to parse site") } m := Media{ - ID: ksuid.New().String(), - Url: url, - User: username, - Type: VIDEO_TYPE_ODYSEE, - Title: tackData.Name, - //Duration: time.Duration(tackData.Duration / 1000), + ID: ksuid.New().String(), + Url: url, + User: username, + Type: VIDEO_TYPE_ODYSEE, + Title: tackData.Name, Thumbnail: tackData.ThumbnailURL, ChannelName: tackData.Author.Name, AudioUrl: tackData.ContentURL, } - + if duration, err := parseDuration(tackData.Duration); err == nil { + m.Progress = MediaDuration{ + Duration: duration, + } + } return append(media, m), nil } diff --git a/pkg/media/Peertube.go b/pkg/media/Peertube.go index 7bb8d65..6fee32c 100644 --- a/pkg/media/Peertube.go +++ b/pkg/media/Peertube.go @@ -213,17 +213,9 @@ func (pt *Peertube) GetMedia(url string, username string) ([]Media, error) { audioUrl = file.FileURL } } - } else if len(info.StreamingPlaylists) > 0 { - //audioUrl = info.StreamingPlaylists[0].PlaylistURL - playlist := info.StreamingPlaylists[0].Files[0] - for _, play := range info.StreamingPlaylists { - for _, file := range play.Files { - if file.Size < playlist.Size { - playlist = file - } - } - } - audioUrl = playlist.FileDownloadURL + } else if info.IsLive { + playlist := info.StreamingPlaylists[0] + audioUrl = playlist.PlaylistURL } m := Media{ diff --git a/pkg/media/Podcast.go b/pkg/media/Podcast.go index 5a8de68..9cb9691 100644 --- a/pkg/media/Podcast.go +++ b/pkg/media/Podcast.go @@ -4,9 +4,12 @@ package media import ( "encoding/xml" - "io/ioutil" + "io" "net/http" "time" + "w2g/pkg/utils" + + "github.com/segmentio/ksuid" ) type Time struct { @@ -109,7 +112,7 @@ func (pod *PodcastRSS) fetch(url string) (pd Podcast, err error) { defer res.Body.Close() - buff, err := ioutil.ReadAll(res.Body) + buff, err := io.ReadAll(res.Body) if err != nil { return } @@ -122,19 +125,26 @@ func (pod *PodcastRSS) GetMedia(url string, username string) ([]Media, error) { if err != nil { return []Media{}, err } - item := podcasts.Items[0] - - return []Media{ - { - Url: item.Enclosure.Url, - Type: VIDEO_TYPE_PODCAST, - Thumbnail: item.Image.Url, - Title: item.Title, - User: username, - AudioUrl: item.Enclosure.Url, - }, - }, nil + track := Media{ + ID: ksuid.New().String(), + Url: item.Link, + Thumbnail: item.Image.Url, + User: username, + Type: VIDEO_TYPE_PODCAST, + Title: item.Title, + AudioUrl: item.Enclosure.Url, + ChannelName: podcasts.Title, + } + if track.Thumbnail == "" { + track.Thumbnail = podcasts.Image.Href + } + if duration, err := utils.ParseTime(item.Duration); err == nil { + track.Progress = MediaDuration{ + Duration: duration, + } + } + return []Media{track}, nil } func (pod *PodcastRSS) GetType() MediaType { @@ -146,7 +156,7 @@ func (pod *PodcastRSS) IsValidUrl(url string, ct *ContentType) bool { if err != nil { return false } - return contentetType == "application/rss+xml; charset=UTF-8" || contentetType == "application/xml; charset=utf-8" + return contentetType == "application/rss+xml; charset=UTF-8" || contentetType == "application/xml; charset=utf-8" || contentetType == "text/xml" } func (client *PodcastRSS) Refresh(media *Media) error { diff --git a/pkg/media/RadioGarden.go b/pkg/media/RadioGarden.go index 47396f8..451b506 100644 --- a/pkg/media/RadioGarden.go +++ b/pkg/media/RadioGarden.go @@ -4,13 +4,14 @@ import ( "crypto/tls" "encoding/json" "fmt" - "log" "net/http" "net/url" "path" "regexp" "time" + log "github.com/sirupsen/logrus" + "github.com/segmentio/ksuid" ) diff --git a/pkg/media/media_test.go b/pkg/media/media_test.go index 9192d30..ec280d0 100644 --- a/pkg/media/media_test.go +++ b/pkg/media/media_test.go @@ -1,9 +1,38 @@ package media -import "testing" +import ( + "testing" -func TestMeida(t *testing.T) { + "github.com/stretchr/testify/assert" +) +func TestMP4Meida(t *testing.T) { client := MediaFactory.GetFactory("https://f000.backblazeb2.com/file/exceptionerror-io-public/movies/Bicentennial.Man.1999.mkv") - client.GetMedia("https://f000.backblazeb2.com/file/exceptionerror-io-public/movies/Bicentennial.Man.1999.mkv", "") + tracks, err := client.GetMedia("https://f000.backblazeb2.com/file/exceptionerror-io-public/movies/Bicentennial.Man.1999.mkv", "") + assert.Nil(t, err) + assert.Equal(t, len(tracks), 1) +} + +func TestPodcastMeida(t *testing.T) { + url := "https://feeds.fireside.fm/selfhosted/rss" + client := MediaFactory.GetFactory(url) + tracks, err := client.GetMedia(url, "") + assert.Nil(t, err) + assert.Equal(t, len(tracks), 1) +} + +func TestPeerTubeLive(t *testing.T) { + url := "https://jupiter.tube/w/gYdezxbqGJMA3cfTTiK1cz" + client := MediaFactory.GetFactory(url) + tracks, err := client.GetMedia(url, "") + assert.Nil(t, err) + assert.Equal(t, len(tracks), 1) +} + +func TestOdesey(t *testing.T) { + url := "https://odysee.com/@veritasium:f/the-trillion-dollar-equation:3" + client := MediaFactory.GetFactory(url) + tracks, err := client.GetMedia(url, "") + assert.Nil(t, err) + assert.Equal(t, len(tracks), 1) } diff --git a/pkg/playlists/playlists.go b/pkg/playlists/playlists.go index 0e191a7..9230fe7 100644 --- a/pkg/playlists/playlists.go +++ b/pkg/playlists/playlists.go @@ -1,10 +1,11 @@ package playlists import ( - "log" "w2g/pkg/media" "w2g/pkg/utils" + log "github.com/sirupsen/logrus" + "github.com/google/uuid" bolt "go.etcd.io/bbolt" ) diff --git a/pkg/utils/config.go b/pkg/utils/config.go index dc9e740..de9b4d8 100644 --- a/pkg/utils/config.go +++ b/pkg/utils/config.go @@ -20,6 +20,7 @@ type Config struct { Reset bool `mapstructure:"RESET"` Loglevel string `mapstructure:"LOG_LEVEL"` ListenPort string `mapstructure:"LISTEN_PORT"` + BetterStackToken string `mapstructure:"BETTER_STACK_TOKEN"` } // LoadConfig reads configuration from file or environment variables. diff --git a/ui/src/assets/media.svg b/ui/src/assets/media.svg new file mode 100644 index 0000000..6b5ff8b --- /dev/null +++ b/ui/src/assets/media.svg @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/ui/src/pages/app/components/card.jsx b/ui/src/pages/app/components/card.jsx index 475cccd..8f8f4bb 100644 --- a/ui/src/pages/app/components/card.jsx +++ b/ui/src/pages/app/components/card.jsx @@ -1,5 +1,6 @@ import { useState } from "react" import { useSwipeable } from "react-swipeable"; +import media_svg from "../../../assets/media.svg" const QueueItem = ({ key, pos, video, children }) => { const [showMenu, setShowMenu] = useState(false) @@ -24,7 +25,11 @@ const QueueItem = ({ key, pos, video, children }) => { {pos}
- {video.title} + { + video.thumbnail ? {video.title} + : + {video.title} + }

@@ -119,8 +124,8 @@ const Card = ({ queue, updateQueue }) => {

-
- +
+

Queue Empty

diff --git a/ui/src/pages/app/components/header.jsx b/ui/src/pages/app/components/header.jsx index 0a0dac2..53da38a 100644 --- a/ui/src/pages/app/components/header.jsx +++ b/ui/src/pages/app/components/header.jsx @@ -1,7 +1,14 @@ +import media_svg from "../../../assets/media.svg" + export const Header = ({ state }) => { return (
- + { + state.current.thumbnail ? + : + + } +

Now Playing

{state.current.title}

diff --git a/ui/src/pages/app/components/player/AudioPlayer.jsx b/ui/src/pages/app/components/player/AudioPlayer.jsx index 1847c8a..7c73d75 100644 --- a/ui/src/pages/app/components/player/AudioPlayer.jsx +++ b/ui/src/pages/app/components/player/AudioPlayer.jsx @@ -37,14 +37,16 @@ export const AudioPlayer = ({ state }) => { return (
-
-
+
+ +
+
-
+
-
+
-
-
+
+
-
+
-
+
-
+
{volume === 0 ? setVolume(100)} /> : setVolume(0)} />}
diff --git a/ui/src/pages/app/controller.jsx b/ui/src/pages/app/controller.jsx index e0c778f..5c95db5 100644 --- a/ui/src/pages/app/controller.jsx +++ b/ui/src/pages/app/controller.jsx @@ -110,7 +110,7 @@ export const AppController = () => { :
-
+
{state.current.id &&
}