database

package
v0.0.0-...-a6843ac Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 13, 2023 License: GPL-3.0 Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChannelSearch

func ChannelSearch(dbname, GlobalStatus, str, searchType string) *sql.Rows

search channels by some string (tags, notes, channel name, channel directory, channel with a video by title)

func CheckCount

func CheckCount(dbname, cat string) (count int)

channel related queries get a count of channels by category

func CheckErr

func CheckErr(err error, msg string)

generic error notification instead of writing it 10000000 times

func DBCheck

func DBCheck(dbname string) bool

check if there is a sqlite database and if not create it

func DateConvert

func DateConvert(unixtime int) string

convert a unix date to a human readable date

func DateConvertToUnix

func DateConvertToUnix(d string) string

convert standard date to unix for database

func DateConvertTrim

func DateConvertTrim(unixtime int, limit int) string

convert a date and trim stuff we don't want to see

func DbConnect

func DbConnect(dbname string) *sql.DB

generic database connect setting cach size journal mode and foreign key constraints

func DeleteChannel

func DeleteChannel(dbname, chanid string)

delete a channel (with FK constraints all associated videos will be deleted)

func Exists

func Exists(name string) bool

check if a file exists used for startup

func GetAllSearches

func GetAllSearches(dbname string) *sql.Rows

search related queries get all custom search URLS

func GetAllStatus

func GetAllStatus(dbname string) *sql.Rows

status related queries get all status needs to be renamed to get all category but I'm being lazy today

func GetAllTags

func GetAllTags(dbname, ob string) *sql.Rows

tag related queries get all tags from the table

func GetChanExist

func GetChanExist(dbname, chanid string) (count int)

check if the channel exists

func GetChannelVids

func GetChannelVids(dbname, publisher string) *sql.Rows

get all videos for a particular channel

func GetChannels

func GetChannels(dbname, cat, ob string) *sql.Rows

get all channels by category

func GetLastCheck

func GetLastCheck(dbname string) int

get the last time a channel was checked

func GetLastDownload

func GetLastDownload(dbname, chanid string) int

get the last download date for a particular channel

func GetLatestVideos

func GetLatestVideos(dbname string) *sql.Rows

video related queries this is for the main display to show the latest downloded videos

func GetStatus

func GetStatus(dbname, status string) string

get a category name by id

func GetStatusIDI

func GetStatusIDI(dbname, status string) int

return the integer value of the status id from name

func GetStatusName

func GetStatusName(dbname, status string) string

get category id from name

func GetVideoExist

func GetVideoExist(dbname, videoid string) (count int)

check if a video exists

func InsertChannel

func InsertChannel(dbname string, channel Channel) bool

insert a new channel

func InsertVideo

func InsertVideo(dbname, videoid, title, description, publisher, publish_date, downloaded string)

insert a new video to the table

func ModChanSettings

func ModChanSettings(dbname, channelURL, newChanURL, displayname, channelDirectory, textArea string, statusSelector int) bool

modify channel settings it will even update the channel id key and cascade to the video table

func MoveTo

func MoveTo(dbname, chanid, cat string)

change the category of a channel

func Openbrowser

func Openbrowser(url, defbrowser string)

open your favorite web browser

func SearchCount

func SearchCount(dbname string) (count int)

get a count of custom searches

func SearchDelete

func SearchDelete(dbname, id string) bool

delete a search

func SearchInsert

func SearchInsert(dbname, name, link string) bool

add a new search

func SearchUpdate

func SearchUpdate(dbname, id, name, link string) bool

update a search

func StatusCount

func StatusCount(dbname string) (count int)

get a count of the number of categories

func StatusInsert

func StatusInsert(dbname, status string)

insert a new category

func StatusUpdate

func StatusUpdate(dbname, id, status string)

update a category name

func TagCount

func TagCount(dbname string) (count int)

get a count of tags in the table

func TagInsert

func TagInsert(dbname, tag string)

insert a new tag name

func TagUpdate

func TagUpdate(dbname, id, tag string)

update a tag name

func UpdateChanLastPub

func UpdateChanLastPub(dbname, chanid, unix string)

update the last published date for a channel

func UpdateChecked

func UpdateChecked(dbname, chanid string)

update the last time a channel was checked for new content

func UpdateFeedCT

func UpdateFeedCT(dbname, chanid string, feedCount int)

update the number of videos showing in the feed

Types

type Category

type Category struct {
	ID   int
	Name string
}

for the category table

type Channel

type Channel struct {
	ID              int
	Displayname     string
	Dldir           string
	Yt_channelid    string
	Lastpub         int
	Lastcheck       int
	Archive         int
	Notes           string
	Date_added      int
	Last_feed_count int
}

for the channel table

func GetChanInfo

func GetChanInfo(dbname, ytid string) Channel

get channel details

type Search struct {
	ID   int
	Name string
	Link string
}

for the search table

type Tags

type Tags struct {
	ID   int
	Name string
}

for the tags table

type Video

type Video struct {
	ID           int
	YT_videoid   string
	Title        string
	Description  string
	Publisher    string
	Publish_date int
	Downloaded   int
}

for the video table

func GetVideoInfo

func GetVideoInfo(dbname, videoid string) Video

get info for a particular video

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL