Restrucuture
This commit is contained in:
parent
2142461d36
commit
e3a64aab16
@ -11,7 +11,7 @@ services:
|
|||||||
MARIADB_PASSWORD: password
|
MARIADB_PASSWORD: password
|
||||||
MARIADB_DATABASE: testdb
|
MARIADB_DATABASE: testdb
|
||||||
volumes:
|
volumes:
|
||||||
#- ./mariadb/mysql:/var/lib/mysql
|
- ./mariadb/mysql:/var/lib/mysql
|
||||||
- ./mariadb/backup:/backup
|
- ./mariadb/backup:/backup
|
||||||
ports:
|
ports:
|
||||||
- 3306:3306
|
- 3306:3306
|
@ -5,15 +5,21 @@ go 1.18
|
|||||||
require (
|
require (
|
||||||
github.com/gin-gonic/gin v1.7.7
|
github.com/gin-gonic/gin v1.7.7
|
||||||
github.com/go-sql-driver/mysql v1.6.0
|
github.com/go-sql-driver/mysql v1.6.0
|
||||||
|
github.com/kkdai/youtube/v2 v2.7.11
|
||||||
github.com/spf13/viper v1.11.0
|
github.com/spf13/viper v1.11.0
|
||||||
|
gopkg.in/vansante/go-ffprobe.v2 v2.0.3
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
github.com/bitly/go-simplejson v0.5.0 // indirect
|
||||||
|
github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91 // indirect
|
||||||
|
github.com/dop251/goja v0.0.0-20220214123719-b09a6bfa842f // indirect
|
||||||
github.com/fsnotify/fsnotify v1.5.1 // indirect
|
github.com/fsnotify/fsnotify v1.5.1 // indirect
|
||||||
github.com/gin-contrib/sse v0.1.0 // indirect
|
github.com/gin-contrib/sse v0.1.0 // indirect
|
||||||
github.com/go-playground/locales v0.13.0 // indirect
|
github.com/go-playground/locales v0.13.0 // indirect
|
||||||
github.com/go-playground/universal-translator v0.17.0 // indirect
|
github.com/go-playground/universal-translator v0.17.0 // indirect
|
||||||
github.com/go-playground/validator/v10 v10.4.1 // indirect
|
github.com/go-playground/validator/v10 v10.4.1 // indirect
|
||||||
|
github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect
|
||||||
github.com/golang/protobuf v1.5.2 // indirect
|
github.com/golang/protobuf v1.5.2 // indirect
|
||||||
github.com/hashicorp/hcl v1.0.0 // indirect
|
github.com/hashicorp/hcl v1.0.0 // indirect
|
||||||
github.com/json-iterator/go v1.1.12 // indirect
|
github.com/json-iterator/go v1.1.12 // indirect
|
||||||
|
26
app/go.sum
26
app/go.sum
@ -38,6 +38,9 @@ cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3f
|
|||||||
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
||||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||||
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
||||||
|
github.com/bitly/go-simplejson v0.5.0 h1:6IH+V8/tVMab511d5bn4M7EwGXZf9Hj6i2xSwkNEM+Y=
|
||||||
|
github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngEKAMDJEczWVA=
|
||||||
|
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 h1:DDGfHa7BWjL4YnC6+E63dPcxHo2sUxDIu8g3QgEJdRY=
|
||||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||||
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
|
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
|
||||||
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
|
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
|
||||||
@ -46,9 +49,15 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk
|
|||||||
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
|
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
|
||||||
github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
|
github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
|
||||||
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
|
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
|
||||||
|
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91 h1:Izz0+t1Z5nI16/II7vuEo/nHjodOg0p7+OiDpjX5t1E=
|
||||||
|
github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
|
||||||
|
github.com/dop251/goja v0.0.0-20220214123719-b09a6bfa842f h1:ztRywKO1rqqS8li0TDcnwi9AGsqAH0ky9NaND69/Ccc=
|
||||||
|
github.com/dop251/goja v0.0.0-20220214123719-b09a6bfa842f/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk=
|
||||||
|
github.com/dop251/goja_nodejs v0.0.0-20210225215109-d91c329300e7/go.mod h1:hn7BA7c8pLvoGndExHudxTDKZ84Pyvv+90pbBjbTz0Y=
|
||||||
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||||
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||||
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
|
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
|
||||||
@ -72,6 +81,8 @@ github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD87
|
|||||||
github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
|
github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
|
||||||
github.com/go-playground/validator/v10 v10.4.1 h1:pH2c5ADXtd66mxoE0Zm9SUhxE20r7aM3F26W0hOn+GE=
|
github.com/go-playground/validator/v10 v10.4.1 h1:pH2c5ADXtd66mxoE0Zm9SUhxE20r7aM3F26W0hOn+GE=
|
||||||
github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4=
|
github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4=
|
||||||
|
github.com/go-sourcemap/sourcemap v2.1.3+incompatible h1:W1iEw64niKVGogNgBN3ePyLFfuisuzeidWPMPWmECqU=
|
||||||
|
github.com/go-sourcemap/sourcemap v2.1.3+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg=
|
||||||
github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE=
|
github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE=
|
||||||
github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
|
github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
|
||||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||||
@ -146,12 +157,16 @@ github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHm
|
|||||||
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
|
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
|
||||||
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
|
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
|
||||||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||||
|
github.com/kkdai/youtube/v2 v2.7.11 h1:r7rqDNebb3oNAuu2A7VyLB7AD8+7oYpcdv6HwMNpkPs=
|
||||||
|
github.com/kkdai/youtube/v2 v2.7.11/go.mod h1:Lj0+AMQtlcxTwrcf+Ja6OeGzGGf214j9kEQNDDwlSHc=
|
||||||
github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
|
github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
|
||||||
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
|
|
||||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||||
|
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
|
||||||
|
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
||||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||||
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
|
||||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||||
|
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||||
|
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||||
github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y=
|
github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y=
|
||||||
github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
|
github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
|
||||||
github.com/magiconair/properties v1.8.6 h1:5ibWZ6iY0NctNGWo87LalDlEZ6R41TqbbDamhfG/Qzo=
|
github.com/magiconair/properties v1.8.6 h1:5ibWZ6iY0NctNGWo87LalDlEZ6R41TqbbDamhfG/Qzo=
|
||||||
@ -283,6 +298,7 @@ golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwY
|
|||||||
golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||||
golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||||
|
golang.org/x/net v0.0.0-20220412020605-290c469a71a5 h1:bRb386wvrE+oBNdF1d/Xh9mQrfQ4ecYhW5qJ5GvTGT4=
|
||||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||||
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||||
@ -347,6 +363,7 @@ golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3
|
|||||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
|
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
|
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
|
||||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||||
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||||
@ -497,11 +514,14 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ
|
|||||||
google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw=
|
google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw=
|
||||||
google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
|
|
||||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/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=
|
||||||
|
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||||
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
|
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
|
||||||
gopkg.in/ini.v1 v1.66.4 h1:SsAcf+mM7mRZo2nJNGt8mZCjG8ZRaNGMURJw7BsIST4=
|
gopkg.in/ini.v1 v1.66.4 h1:SsAcf+mM7mRZo2nJNGt8mZCjG8ZRaNGMURJw7BsIST4=
|
||||||
gopkg.in/ini.v1 v1.66.4/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
gopkg.in/ini.v1 v1.66.4/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||||
|
gopkg.in/vansante/go-ffprobe.v2 v2.0.3 h1:nmR7yLalb5p5UmXhXUYnrsIkbb8j7h2OYMDoLETCQ5U=
|
||||||
|
gopkg.in/vansante/go-ffprobe.v2 v2.0.3/go.mod h1:qF0AlAjk7Nqzqf3y333Ly+KxN3cKF2JqA3JT5ZheUGE=
|
||||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||||
|
15
app/handlers/api/00_api.go
Normal file
15
app/handlers/api/00_api.go
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
package api
|
||||||
|
|
||||||
|
import (
|
||||||
|
"database/sql"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Global Variables
|
||||||
|
var DB *sql.DB
|
||||||
|
|
||||||
|
// check error
|
||||||
|
func check(err error) {
|
||||||
|
if err != nil {
|
||||||
|
panic(err.Error())
|
||||||
|
}
|
||||||
|
}
|
47
app/handlers/api/10_getJSON.go
Normal file
47
app/handlers/api/10_getJSON.go
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
package api
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
|
||||||
|
"gitea.voser.cloud/Golang/GoDown/handlers/sqldb"
|
||||||
|
)
|
||||||
|
|
||||||
|
func getJSON(sqlString string) ([]byte, error) {
|
||||||
|
DB = sqldb.Opendb()
|
||||||
|
defer DB.Close()
|
||||||
|
rows, err := DB.Query(sqlString)
|
||||||
|
check(err)
|
||||||
|
defer rows.Close()
|
||||||
|
columns, err := rows.Columns()
|
||||||
|
if err != nil {
|
||||||
|
return []byte("Error while generating json"), err
|
||||||
|
}
|
||||||
|
count := len(columns)
|
||||||
|
tableData := make([]map[string]interface{}, 0)
|
||||||
|
values := make([]interface{}, count)
|
||||||
|
valuePtrs := make([]interface{}, count)
|
||||||
|
for rows.Next() {
|
||||||
|
for i := 0; i < count; i++ {
|
||||||
|
valuePtrs[i] = &values[i]
|
||||||
|
}
|
||||||
|
rows.Scan(valuePtrs...)
|
||||||
|
entry := make(map[string]interface{})
|
||||||
|
for i, col := range columns {
|
||||||
|
var v interface{}
|
||||||
|
val := values[i]
|
||||||
|
b, ok := val.([]byte)
|
||||||
|
if ok {
|
||||||
|
v = string(b)
|
||||||
|
} else {
|
||||||
|
v = val
|
||||||
|
}
|
||||||
|
entry[col] = v
|
||||||
|
}
|
||||||
|
tableData = append(tableData, entry)
|
||||||
|
}
|
||||||
|
jsonData, err := json.Marshal(tableData)
|
||||||
|
if err != nil {
|
||||||
|
return []byte("Error while generating json"), err
|
||||||
|
}
|
||||||
|
return jsonData, nil
|
||||||
|
}
|
30
app/handlers/api/10_ytid_in_db.go
Normal file
30
app/handlers/api/10_ytid_in_db.go
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
package api
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"gitea.voser.cloud/Golang/GoDown/handlers/sqldb"
|
||||||
|
"gitea.voser.cloud/Golang/GoDown/handlers/ytdl"
|
||||||
|
)
|
||||||
|
|
||||||
|
func ytid_in_db(ytid string) string {
|
||||||
|
DB = sqldb.Opendb()
|
||||||
|
defer DB.Close()
|
||||||
|
sqlString := fmt.Sprintf("SELECT COUNT(ytid) FROM testdb.media WHERE ytid LIKE \"%v\";", ytid)
|
||||||
|
var count int
|
||||||
|
err := DB.QueryRow(sqlString).Scan(&count)
|
||||||
|
check(err)
|
||||||
|
if count == 0 {
|
||||||
|
fmt.Printf("Start download of: %s \n", ytid)
|
||||||
|
ytdl.DlAudio(ytid)
|
||||||
|
fmt.Printf("Adding to database: %s \n", ytid)
|
||||||
|
ytdl.AddMedia(ytid)
|
||||||
|
fmt.Printf("Finished download of: %s \n", ytid)
|
||||||
|
return "Song is now available"
|
||||||
|
}
|
||||||
|
if count == 1 {
|
||||||
|
return "Song was already available"
|
||||||
|
}
|
||||||
|
error_return := fmt.Sprintf("Rows returned: %d --> there is an Issue within the database", count)
|
||||||
|
return error_return
|
||||||
|
}
|
17
app/handlers/api/20_GET_api_add_ytid.go
Normal file
17
app/handlers/api/20_GET_api_add_ytid.go
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
package api
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
)
|
||||||
|
|
||||||
|
func GET_api_add_ytid(c *gin.Context) {
|
||||||
|
newSong_ytid := c.Param("ytid")
|
||||||
|
newSong_url := "https://www.youtube.com/watch?v=" + newSong_ytid
|
||||||
|
_, err := url.ParseRequestURI(newSong_url)
|
||||||
|
check(err)
|
||||||
|
is_available := ytid_in_db(newSong_ytid)
|
||||||
|
c.String(http.StatusOK, is_available)
|
||||||
|
}
|
14
app/handlers/api/20_GET_api_db.go
Normal file
14
app/handlers/api/20_GET_api_db.go
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
package api
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
)
|
||||||
|
|
||||||
|
func GET_api_db(c *gin.Context) {
|
||||||
|
dbquery := "SELECT * FROM testdb.media"
|
||||||
|
media, err := getJSON(dbquery)
|
||||||
|
check(err)
|
||||||
|
c.Data(http.StatusOK, "application/json", media)
|
||||||
|
}
|
16
app/handlers/api/20_GET_api_get_ytid.go
Normal file
16
app/handlers/api/20_GET_api_get_ytid.go
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
package api
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
)
|
||||||
|
|
||||||
|
func GET_api_get_ytid(c *gin.Context) {
|
||||||
|
ytid := c.Param("ytid")
|
||||||
|
sqlString := fmt.Sprintf("SELECT * FROM testdb.media WHERE ytid LIKE \"%v\";", ytid)
|
||||||
|
json, err := getJSON(sqlString)
|
||||||
|
check(err)
|
||||||
|
c.Data(http.StatusOK, "application/json", json)
|
||||||
|
}
|
@ -1,101 +0,0 @@
|
|||||||
package api
|
|
||||||
|
|
||||||
import (
|
|
||||||
"database/sql"
|
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
|
||||||
"net/http"
|
|
||||||
"net/url"
|
|
||||||
|
|
||||||
"gitea.voser.cloud/Golang/GoDown/handlers/sqldb"
|
|
||||||
"github.com/gin-gonic/gin"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Global Variables
|
|
||||||
var DB *sql.DB
|
|
||||||
|
|
||||||
// check error
|
|
||||||
func check(err error) {
|
|
||||||
if err != nil {
|
|
||||||
panic(err.Error())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func GET_api_db(c *gin.Context) {
|
|
||||||
dbquery := fmt.Sprintf("SELECT * FROM testdb.media")
|
|
||||||
media, err := getJSON(dbquery)
|
|
||||||
check(err)
|
|
||||||
c.Data(http.StatusOK, "application/json", media)
|
|
||||||
}
|
|
||||||
|
|
||||||
func GET_api_add_ytid(c *gin.Context) {
|
|
||||||
newSong_ytid := c.Param("ytid")
|
|
||||||
newSong_url := "https://www.youtube.com/watch?v=" + newSong_ytid
|
|
||||||
_, err := url.ParseRequestURI(newSong_url)
|
|
||||||
check(err)
|
|
||||||
is_available := ytid_in_db(newSong_ytid)
|
|
||||||
c.String(http.StatusOK, is_available)
|
|
||||||
}
|
|
||||||
|
|
||||||
func ytid_in_db(ytid string) string {
|
|
||||||
sqlString := fmt.Sprintf("SELECT COUNT(ytid) FROM testdb.media WHERE ytid LIKE \"%v\";", ytid)
|
|
||||||
var count int
|
|
||||||
err := DB.QueryRow(sqlString).Scan(&count)
|
|
||||||
check(err)
|
|
||||||
if count == 0 {
|
|
||||||
return "Song is not available"
|
|
||||||
}
|
|
||||||
if count == 1 {
|
|
||||||
return "Song is available"
|
|
||||||
}
|
|
||||||
error_return := fmt.Sprintf("Rows returned: %s --> there is an Issue within the database", string(count))
|
|
||||||
return error_return
|
|
||||||
}
|
|
||||||
|
|
||||||
func GET_api_get_ytid(c *gin.Context) {
|
|
||||||
ytid := c.Param("ytid")
|
|
||||||
sqlString := fmt.Sprintf("SELECT * FROM testdb.media WHERE ytid LIKE \"%v\";", ytid)
|
|
||||||
json, err := getJSON(sqlString)
|
|
||||||
check(err)
|
|
||||||
c.Data(http.StatusOK, "application/json", json)
|
|
||||||
}
|
|
||||||
|
|
||||||
func getJSON(sqlString string) ([]byte, error) {
|
|
||||||
DB = sqldb.Opendb()
|
|
||||||
defer DB.Close()
|
|
||||||
rows, err := DB.Query(sqlString)
|
|
||||||
check(err)
|
|
||||||
defer rows.Close()
|
|
||||||
columns, err := rows.Columns()
|
|
||||||
if err != nil {
|
|
||||||
return []byte("Error while generating json"), err
|
|
||||||
}
|
|
||||||
count := len(columns)
|
|
||||||
tableData := make([]map[string]interface{}, 0)
|
|
||||||
values := make([]interface{}, count)
|
|
||||||
valuePtrs := make([]interface{}, count)
|
|
||||||
for rows.Next() {
|
|
||||||
for i := 0; i < count; i++ {
|
|
||||||
valuePtrs[i] = &values[i]
|
|
||||||
}
|
|
||||||
rows.Scan(valuePtrs...)
|
|
||||||
entry := make(map[string]interface{})
|
|
||||||
for i, col := range columns {
|
|
||||||
var v interface{}
|
|
||||||
val := values[i]
|
|
||||||
b, ok := val.([]byte)
|
|
||||||
if ok {
|
|
||||||
v = string(b)
|
|
||||||
} else {
|
|
||||||
v = val
|
|
||||||
}
|
|
||||||
entry[col] = v
|
|
||||||
}
|
|
||||||
tableData = append(tableData, entry)
|
|
||||||
}
|
|
||||||
jsonData, err := json.Marshal(tableData)
|
|
||||||
if err != nil {
|
|
||||||
return []byte("Error while generating json"), err
|
|
||||||
}
|
|
||||||
return jsonData, nil
|
|
||||||
}
|
|
@ -43,7 +43,9 @@ func Opendb() (db *sql.DB) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func Dbinit() {
|
func Dbinit() {
|
||||||
dbinit, err := DB.Query("CREATE TABLE IF NOT EXISTS `media` (`id` INT NOT NULL AUTO_INCREMENT, `ytid` VARCHAR(100), `url` VARCHAR(255), `localpath` TEXT(65535), `size` INT, `sha256sum` VARCHAR(255), `length` INT, `title` VARCHAR(255), `author` VARCHAR(255), PRIMARY KEY (`id`));")
|
DB = Opendb()
|
||||||
|
defer DB.Close()
|
||||||
|
dbinit, err := DB.Query("CREATE TABLE IF NOT EXISTS testdb.media (`id` INT NOT NULL AUTO_INCREMENT, `ytid` VARCHAR(100), `size` INT, `sha256sum` VARCHAR(255), `duration` INT, `title` VARCHAR(255), `author` VARCHAR(255), PRIMARY KEY (`id`));")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("Error while creating table")
|
fmt.Println("Error while creating table")
|
||||||
panic(err.Error())
|
panic(err.Error())
|
||||||
@ -53,6 +55,8 @@ func Dbinit() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func Dbentrycount() {
|
func Dbentrycount() {
|
||||||
|
DB = Opendb()
|
||||||
|
defer DB.Close()
|
||||||
var count int
|
var count int
|
||||||
dbcount, err := DB.Query("SELECT COUNT(*) FROM testdb.media;")
|
dbcount, err := DB.Query("SELECT COUNT(*) FROM testdb.media;")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
24
app/handlers/ytdl/00_ytdl.go
Normal file
24
app/handlers/ytdl/00_ytdl.go
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
package ytdl
|
||||||
|
|
||||||
|
import "database/sql"
|
||||||
|
|
||||||
|
var DB *sql.DB
|
||||||
|
var Cache_Path string = "./cache/"
|
||||||
|
var Filepath string
|
||||||
|
|
||||||
|
type Media struct {
|
||||||
|
ID string `json: "id"`
|
||||||
|
YTID string `json: "yt-id"`
|
||||||
|
Size int `json: "size"`
|
||||||
|
Sha256sum string `json: "sha256sum"`
|
||||||
|
Duration int `json: "duration"`
|
||||||
|
Title string `json: "title"`
|
||||||
|
Author string `json: "author"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// check error
|
||||||
|
func check(err error) {
|
||||||
|
if err != nil {
|
||||||
|
panic(err.Error())
|
||||||
|
}
|
||||||
|
}
|
40
app/handlers/ytdl/20_AddMedia.go
Normal file
40
app/handlers/ytdl/20_AddMedia.go
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package ytdl
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"crypto/sha256"
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"gitea.voser.cloud/Golang/GoDown/handlers/sqldb"
|
||||||
|
"gopkg.in/vansante/go-ffprobe.v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
func AddMedia(ytid string) {
|
||||||
|
DB = sqldb.Opendb()
|
||||||
|
defer DB.Close()
|
||||||
|
fileinfo, err := os.Stat(Filepath)
|
||||||
|
check(err)
|
||||||
|
file, err := os.Open(Filepath)
|
||||||
|
check(err)
|
||||||
|
defer file.Close()
|
||||||
|
hash := sha256.New()
|
||||||
|
if _, err := io.Copy(hash, file); err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
ctx, cancelFn := context.WithTimeout(context.Background(), 5*time.Second)
|
||||||
|
defer cancelFn()
|
||||||
|
|
||||||
|
ffprobe, err := ffprobe.ProbeURL(ctx, Filepath)
|
||||||
|
if err != nil {
|
||||||
|
log.Panicf("Error getting data: %v", err)
|
||||||
|
}
|
||||||
|
sqlinsert := fmt.Sprintf("INSERT INTO testdb.media (ytid,size,sha256sum,duration) VALUES ('%s','%d','%x','%f')", ytid, fileinfo.Size(), hash.Sum(nil), ffprobe.Format.DurationSeconds)
|
||||||
|
fmt.Println(sqlinsert)
|
||||||
|
dbinsert, err := DB.Query(sqlinsert)
|
||||||
|
check(err)
|
||||||
|
defer dbinsert.Close()
|
||||||
|
}
|
27
app/handlers/ytdl/20_DlAudio.go
Normal file
27
app/handlers/ytdl/20_DlAudio.go
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
package ytdl
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"github.com/kkdai/youtube/v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
func DlAudio(ytid string) {
|
||||||
|
Filepath = fmt.Sprintf(Cache_Path + ytid + ".mp4")
|
||||||
|
ytdl := youtube.Client{}
|
||||||
|
video, err := ytdl.GetVideo(ytid)
|
||||||
|
check(err)
|
||||||
|
formats := video.Formats.WithAudioChannels()
|
||||||
|
stream, _, err := ytdl.GetStream(video, &formats[0])
|
||||||
|
check(err)
|
||||||
|
_ = os.Mkdir(Cache_Path, 0755)
|
||||||
|
file, err := os.Create(Filepath)
|
||||||
|
check(err)
|
||||||
|
fmt.Println(Filepath)
|
||||||
|
defer file.Close()
|
||||||
|
|
||||||
|
_, err = io.Copy(file, stream)
|
||||||
|
check(err)
|
||||||
|
}
|
@ -13,14 +13,12 @@ import (
|
|||||||
// Global Variables
|
// Global Variables
|
||||||
var DB *sql.DB
|
var DB *sql.DB
|
||||||
|
|
||||||
type media struct {
|
type Media struct {
|
||||||
ID string `json: "id"`
|
ID string `json: "id"`
|
||||||
YTID string `json: "yt-id"`
|
YTID string `json: "yt-id"`
|
||||||
Url string `json: "url"`
|
|
||||||
Localpath string `json: "localpath"`
|
|
||||||
Size int `json: "size"`
|
Size int `json: "size"`
|
||||||
Sha256sum string `json: "sha256sum"`
|
Sha256sum string `json: "sha256sum"`
|
||||||
Length int `json: "length"`
|
Duration int `json: "duration"`
|
||||||
Title string `json: "title"`
|
Title string `json: "title"`
|
||||||
Author string `json: "author"`
|
Author string `json: "author"`
|
||||||
}
|
}
|
||||||
|
16
makefile
16
makefile
@ -1,3 +1,15 @@
|
|||||||
dev:
|
all: docker prerequesits gorunapp
|
||||||
|
|
||||||
|
docker:
|
||||||
docker-compose -f Docker/compose.yml up -d
|
docker-compose -f Docker/compose.yml up -d
|
||||||
go run app/main/main.go
|
sleep 5
|
||||||
|
prerequesits:
|
||||||
|
mkdir -p ./app/cache
|
||||||
|
gorunapp:
|
||||||
|
cd app; \
|
||||||
|
go mod tidy; \
|
||||||
|
go run main.go
|
||||||
|
clean:
|
||||||
|
docker-compose -f Docker/compose.yml down
|
||||||
|
sudo rm ./app/cache -rf
|
||||||
|
sudo rm ./Docker/mariadb/mysql/* -rf
|
1
webui
Submodule
1
webui
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 2142461d368561fd14dd0875baf6062df72ce6e7
|
Loading…
Reference in New Issue
Block a user