added nix shell + moved creds to separate file
This commit is contained in:
parent
c9e937fe10
commit
5b88c53165
3 changed files with 15 additions and 48 deletions
1
.envrc
Normal file
1
.envrc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
use nix
|
50
main.go
50
main.go
|
@ -2,7 +2,7 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"os"
|
||||||
|
|
||||||
"git.fricloud.dk/eyjhb/minifluxmpv/cmd"
|
"git.fricloud.dk/eyjhb/minifluxmpv/cmd"
|
||||||
tea "github.com/charmbracelet/bubbletea"
|
tea "github.com/charmbracelet/bubbletea"
|
||||||
|
@ -10,11 +10,8 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
// fmt.Println(test())
|
|
||||||
// return
|
|
||||||
|
|
||||||
// init miniflux
|
// init miniflux
|
||||||
client := miniflux.New("https://miniflux.fricloud.dk/v1/", "F_61V4HkhhJjCF_hI12oDAYhgMY2769KAvOkqPsubqc=")
|
client := miniflux.New(os.Getenv("MINIFLUXMPV_API_URL"), os.Getenv("MINIFLUXMPV_TOKEN"))
|
||||||
|
|
||||||
// init miniflux player
|
// init miniflux player
|
||||||
m := cmd.MinifluxPlayer{
|
m := cmd.MinifluxPlayer{
|
||||||
|
@ -31,46 +28,3 @@ func main() {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func test() error {
|
|
||||||
p := cmd.NewMPVPlayer()
|
|
||||||
fmt.Println(p.IsPlaying())
|
|
||||||
|
|
||||||
// err := p.Play("https://www.youtube.com/watch?v=gCYcHz2k5x0")
|
|
||||||
var err error
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
time.Sleep(10 * time.Second)
|
|
||||||
fmt.Println("First is playing")
|
|
||||||
fmt.Println(p.IsPlaying())
|
|
||||||
|
|
||||||
for {
|
|
||||||
fmt.Println("2nd is playing")
|
|
||||||
fmt.Println(p.IsPlaying())
|
|
||||||
}
|
|
||||||
|
|
||||||
// err = p.Play("https://www.youtube.com/watch?v=3d3ceC_EuC0")
|
|
||||||
// if err != nil {
|
|
||||||
// return err
|
|
||||||
// }
|
|
||||||
|
|
||||||
// time.Sleep(10 * time.Second)
|
|
||||||
|
|
||||||
// fmt.Println(p.VideoDuration)
|
|
||||||
// fmt.Println(p.VideoPosition)
|
|
||||||
|
|
||||||
// time.Sleep(1 * time.Second)
|
|
||||||
|
|
||||||
err = p.Stop()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
fmt.Println("Started playing")
|
|
||||||
time.Sleep(100 * time.Second)
|
|
||||||
|
|
||||||
return nil
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
12
shell.nix
Normal file
12
shell.nix
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
{ pkgs ? import <nixpkgs> {}, ... }:
|
||||||
|
|
||||||
|
pkgs.mkShell {
|
||||||
|
shellHook = ''
|
||||||
|
if [[ -f ".env" ]]; then
|
||||||
|
echo "Found .env file, sourcing it"
|
||||||
|
source .env
|
||||||
|
else
|
||||||
|
echo "No .env file found"
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue