Documentation
¶
Overview ¶
Copyright © 2025 NAME HERE <EMAIL ADDRESS>
Copyright © 2025 NAME HERE <EMAIL ADDRESS>
Copyright © 2025 NAME HERE <EMAIL ADDRESS>
Copyright © 2025 NAME HERE <EMAIL ADDRESS>
Copyright © 2025 NAME ExaExamples:
%s install # Install using symlink method %s install --profile # Force install by modifying shell profile", AppName, AppName),es: %s app install # Install using symlink method %s app install --profile # Force install by modifying shell profile", AppName, AppName, AppName),E <EMAIL ADDRESS>
Copyright © 2025 NAME HERE <EMAIL ADDRESS>
Copyright © 2025 NAME HERE <EMAIL ADDRESS>
Copyright © 2025 NAME HERE <EMAIL ADDRESS>
Copyright © 2025 NAME HERE <EMAIL ADDRESS>
Copyright © 2025 NAME HERE <EMAIL ADDRESS>
Index ¶
- Constants
- Variables
- func CheckChannelVideoCount(channelID string) (apiCount, dbCount int, needsSync bool, err error)
- func CloseDB() error
- func DownloadVideo(url, filename string) error
- func Execute()
- func GetDB() (*sql.DB, error)
- func GetSetting(key string) (string, error)
- func LogDebug(message string, args ...interface{})
- func NewMenu() menuModel
- func RunChannelBrowserTUI(channels []Channel) error
- func RunTUI() error
- func SetSetting(key, value string) error
- func StoreChannel(channel Channel) error
- func StoreVideos(channelID string, videos []Video) error
- func StoreVideosBatch(channelID string, videos []Video) error
- func UpdateVideoFileSize(videoID string, fileSize int64) error
- type Channel
- type Client
- func (c *Client) FetchAllChannels() error
- func (c *Client) FetchAllVideos(channelID string) ([]Video, error)
- func (c *Client) FetchAllVideosWithLimit(channelID string, maxVideos int) ([]Video, error)
- func (c *Client) FetchChannelData(channelID string) error
- func (c *Client) FetchVideos(channelID string, offset, limit int) ([]Video, error)
- func (c *Client) GetChannelVideoCount(channelID string) (int, error)
- func (c *Client) SyncAllChannelVideos() error
- func (c *Client) SyncAllChannelVideosWithOptions(fetchFileSizes bool) error
- func (c *Client) SyncChannelVideos(channelID string) error
- func (c *Client) SyncChannelVideosWithOptions(channelID string, fetchFileSizes bool) error
- func (c *Client) SyncChannels() error
- type GetAllChannelsResponse
- type GetChannelResponse
- type GetChannelVideosResponse
- type GitHubRelease
- type GraphQLRequest
- type Links
- type ShowInfo
- type TorrentConfig
- type Video
- type VideoInfo
Constants ¶
const ( // DefaultModulePath is the Go module path for updates (when published) DefaultModulePath = "github.com/daniel-le97/banned-cli" APIEndpoint = "https://api.banned.video/graphql" // AppDescription is the short description shown in help AppDescription = "tool for downloading from https://banned.video" // AppLongDescription is the detailed description AppLongDescription = "a tool for downloading from https://banned.video" // Default torrent configuration DefaultTrackerURL = "udp://tracker.openbittorrent.com:80/announce" DefaultPieceLength = 256 // KB )
Application configuration - change these values to customize the application
const ( GitHubOwner = "daniel-le97" GitHubRepo = "banned-cli" )
Variables ¶
var ( // AppName is the application name (binary name) AppName = "banned" // ConfigFileName is the default config file name (without extension) ConfigFileName = "." + AppName )
var ( // Global database instance DB *sql.DB )
var DefaultTrackers = []string{
"udp://tracker.openbittorrent.com:80/announce",
"udp://tracker.publicbt.com:80/announce",
"udp://tracker.ccc.de:80/announce",
"udp://exodus.desync.com:6969/announce",
}
Popular public trackers (can be used as fallbacks)
Functions ¶
func CheckChannelVideoCount ¶
CheckChannelVideoCount compares API video count with local database count
func DownloadVideo ¶
DownloadVideo downloads a video from a URL and saves it to a file
func Execute ¶
func Execute()
Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.
func GetSetting ¶
GetSetting retrieves a setting value by key
func LogDebug ¶
func LogDebug(message string, args ...interface{})
LogDebug logs database operations for debugging
func RunChannelBrowserTUI ¶
RunChannelBrowserTUI creates and runs the channel browser TUI
func StoreChannel ¶
StoreChannel stores or updates channel information in the database
func StoreVideos ¶
StoreVideos stores multiple videos in the database
func StoreVideosBatch ¶
StoreVideosBatch stores videos in a batch with proper error handling
func UpdateVideoFileSize ¶
UpdateVideoFileSize updates the file_size for a video in the database
Types ¶
type Channel ¶
type Channel struct {
ID string `json:"_id"`
Title string `json:"title"`
Summary string `json:"summary,omitempty"`
TextInfo string `json:"textInfo,omitempty"`
Avatar string `json:"avatar,omitempty"`
CoverImage string `json:"coverImage,omitempty"`
IsLive bool `json:"isLive,omitempty"`
TotalVideos float64 `json:"totalVideos,omitempty"`
TotalVideoViews float64 `json:"totalVideoViews,omitempty"`
TotalLikes float64 `json:"totalLikes,omitempty"`
Videos []Video `json:"videos,omitempty"`
ShowInfo *ShowInfo `json:"showInfo,omitempty"`
Links *Links `json:"links,omitempty"`
}
Channel represents a channel structure
func GetAllChannels ¶
GetAllChannels retrieves all channels from the database
func GetAllChannelsFromDB ¶
GetAllChannelsFromDB retrieves all channels from the database
type Client ¶
type Client struct {
APIEndpoint string
}
Client represents the API client
func (*Client) FetchAllChannels ¶
FetchAllChannels fetches all available channels and stores them in database
func (*Client) FetchAllVideos ¶
FetchAllVideos recursively fetches all videos for a channel using pagination
func (*Client) FetchAllVideosWithLimit ¶
FetchAllVideosWithLimit is like FetchAllVideos but stops after maxVideos for testing
func (*Client) FetchChannelData ¶
FetchChannelData fetches detailed channel information
func (*Client) FetchVideos ¶
FetchVideos fetches videos from the API and stores them in the database
func (*Client) GetChannelVideoCount ¶
GetChannelVideoCount fetches the video count for a channel from the API
func (*Client) SyncAllChannelVideos ¶
SyncAllChannelVideos syncs videos for all channels incrementally
func (*Client) SyncAllChannelVideosWithOptions ¶
SyncAllChannelVideosWithOptions syncs videos for all channels incrementally with options
func (*Client) SyncChannelVideos ¶
SyncChannelVideos fetches only new videos for a specific channel
func (*Client) SyncChannelVideosWithOptions ¶
SyncChannelVideosWithOptions fetches only new videos for a specific channel with options
func (*Client) SyncChannels ¶
SyncChannels fetches only new/updated channels
type GetAllChannelsResponse ¶
type GetAllChannelsResponse struct {
Data struct {
GetAllChannels []Channel `json:"getAllChannels"`
} `json:"data"`
}
type GetChannelResponse ¶
type GetChannelResponse struct {
Data struct {
GetChannel Channel `json:"getChannel"`
} `json:"data"`
}
type GitHubRelease ¶
type GitHubRelease struct {
TagName string `json:"tag_name"`
Name string `json:"name"`
Assets []struct {
Name string `json:"name"`
BrowserDownloadURL string `json:"browser_download_url"`
Size int64 `json:"size"`
} `json:"assets"`
Prerelease bool `json:"prerelease"`
Draft bool `json:"draft"`
Body string `json:"body"`
}
GitHub API structs
type GraphQLRequest ¶
type GraphQLRequest struct {
OperationName string `json:"operationName"`
Variables map[string]interface{} `json:"variables"`
Query string `json:"query"`
}
GraphQL request/response structures
type TorrentConfig ¶
type TorrentConfig struct {
Tracker string
OutputDir string
PieceLength int
Comment string
Private bool
}
TorrentConfig holds configuration for torrent creation
type Video ¶
type Video struct {
ID string `json:"_id"`
Title string `json:"title"`
Summary string `json:"summary"`
LargeImage string `json:"largeImage"`
VideoDuration float64 `json:"videoDuration"`
CreatedAt string `json:"createdAt"`
DirectURL string `json:"directUrl"`
PlayCount int `json:"playCount,omitempty"`
LikeCount int `json:"likeCount,omitempty"`
AngerCount int `json:"angerCount,omitempty"`
EmbedURL string `json:"embedUrl,omitempty"`
Published bool `json:"published,omitempty"`
FileSize int64 `json:"fileSize,omitempty"`
}
Video represents a video structure