manage.go 780 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. package libamuse
  2. import (
  3. "notabug.org/apiote/amuse/accounts"
  4. "notabug.org/apiote/amuse/datastructure"
  5. "notabug.org/apiote/amuse/db"
  6. "strings"
  7. "fmt"
  8. )
  9. func MakeAdmin(username string) error {
  10. return db.MakeAdmin(username)
  11. }
  12. func TouchWantlist() error {
  13. uris, err := db.GetWantlistUris()
  14. if err != nil {
  15. return err
  16. }
  17. auth := accounts.Authentication{Token: ""}
  18. for _, uri := range uris {
  19. fmt.Printf("Touching %s\n", uri)
  20. type_id := strings.Split(uri, "/")
  21. itemType := datastructure.ItemType(type_id[0])
  22. itemId := type_id[1]
  23. switch itemType {
  24. case datastructure.ItemTypeFilm:
  25. _, _ = ShowFilm(itemId, "en-GB", "text/html", auth)
  26. case datastructure.ItemTypeTvserie:
  27. _, _ = ShowTvSerie(itemId, "", "en-GB", "text/html", auth)
  28. }
  29. }
  30. return nil
  31. }