added nix shell + moved creds to separate file

This commit is contained in:
eyjhb 2025-02-08 21:42:34 +01:00
parent c9e937fe10
commit 5b88c53165
Signed by: eyjhb
GPG key ID: 609F508E3239F920
3 changed files with 15 additions and 48 deletions

1
.envrc Normal file
View file

@ -0,0 +1 @@
use nix

50
main.go
View file

@ -2,7 +2,7 @@ package main
import (
"fmt"
"time"
"os"
"git.fricloud.dk/eyjhb/minifluxmpv/cmd"
tea "github.com/charmbracelet/bubbletea"
@ -10,11 +10,8 @@ import (
)
func main() {
// fmt.Println(test())
// return
// 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
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
View 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
'';
}