mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-06-23 15:30:34 -04:00
Add custom schema handling for gocoder (#601)
This commit is contained in:
commit
63e7aac754
@ -61,7 +61,8 @@ export const SnackbarProvider = ({ children }: { children: ReactElement | ReactE
|
||||
return;
|
||||
}
|
||||
|
||||
addPortal("snackbar", <Snackbar {...top} />);
|
||||
const { key, ...props } = top;
|
||||
addPortal("snackbar", <Snackbar key={key} {...props} />);
|
||||
timeout.current = setTimeout(() => {
|
||||
removePortal("snackbar");
|
||||
updatePortal();
|
||||
|
@ -19,7 +19,7 @@
|
||||
*/
|
||||
|
||||
import Svg, { type SvgProps, Path } from "react-native-svg";
|
||||
import { useYoshiki } from "yoshiki";
|
||||
import { useYoshiki } from "yoshiki/native";
|
||||
|
||||
/* export const KyooLogo = (props: SvgProps) => ( */
|
||||
/* <Svg viewBox="0 0 128 128" {...props}> */
|
||||
|
@ -26,4 +26,7 @@ POSTGRES_PASSWORD=
|
||||
POSTGRES_DB=
|
||||
POSTGRES_SERVER=
|
||||
POSTGRES_PORT=5432
|
||||
# (the schema "gocoder" will be used)
|
||||
# Default is gocoder, you can specify "disabled" to use the default search_path of the user.
|
||||
# If this is not "disabled", the schema will be created (if it does not exists) and
|
||||
# the search_path of the user will be ignored (only the schema specified will be used).
|
||||
POSTGRES_SCHEMA=gocoder
|
||||
|
@ -191,6 +191,8 @@ func getVideoKeyframes(path string, video_idx uint32, kf *Keyframe) error {
|
||||
pts, flags := x[0], x[1]
|
||||
|
||||
// true if there is no keyframes (e.g. in a file w/o video track)
|
||||
// can also happen if a video has more packets than frames (so the last packet
|
||||
// is emtpy and has a N/A pts)
|
||||
if pts == "N/A" {
|
||||
break
|
||||
}
|
||||
|
@ -24,22 +24,29 @@ type MetadataService struct {
|
||||
|
||||
func NewMetadataService() (*MetadataService, error) {
|
||||
con := fmt.Sprintf(
|
||||
"postgresql://%v:%v@%v:%v/%v?application_name=gocoder&search_path=gocoder&sslmode=disable",
|
||||
"postgresql://%v:%v@%v:%v/%v?application_name=gocoder&sslmode=disable",
|
||||
url.QueryEscape(os.Getenv("POSTGRES_USER")),
|
||||
url.QueryEscape(os.Getenv("POSTGRES_PASSWORD")),
|
||||
url.QueryEscape(os.Getenv("POSTGRES_SERVER")),
|
||||
url.QueryEscape(os.Getenv("POSTGRES_PORT")),
|
||||
url.QueryEscape(os.Getenv("POSTGRES_DB")),
|
||||
)
|
||||
schema := GetEnvOr("POSTGRES_SCHEMA", "gocoder")
|
||||
if schema != "disabled" {
|
||||
con = fmt.Sprintf("%s&search_path=%s", con, url.QueryEscape(schema))
|
||||
}
|
||||
db, err := sql.Open("postgres", con)
|
||||
if err != nil {
|
||||
fmt.Printf("Could not connect to database, check your env variables!")
|
||||
return nil, err
|
||||
}
|
||||
|
||||
_, err = db.Exec("create schema if not exists gocoder")
|
||||
if schema != "disabled" {
|
||||
_, err = db.Exec(fmt.Sprintf("create schema if not exists %s", schema))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
driver, err := postgres.WithInstance(db, &postgres.Config{})
|
||||
if err != nil {
|
||||
|
Loading…
x
Reference in New Issue
Block a user