Skip to content

Commit aaf8e09

Browse files
committed
Add config.toml.example (fix #269 #194)
1 parent 3690018 commit aaf8e09

File tree

4 files changed

+119
-59
lines changed

4 files changed

+119
-59
lines changed

README.md

Lines changed: 8 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -50,66 +50,26 @@ In order to query YouTube or Vimeo API you have to obtain an API token first.
5050
- [How to get YouTube API key](https://elfsight.com/blog/2016/12/how-to-get-youtube-api-key-tutorial/)
5151
- [Generate an access token for Vimeo](https://developer.vimeo.com/api/guides/start#generate-access-token)
5252

53-
## Configuration example
53+
## Configuration
5454

5555
You need to create a configuration file (for instance `config.toml`) and specify the list of feeds that you're going to host.
56-
Here is an example how configuration might look like:
56+
See [config.toml.example](./config.toml.example) for all possible configuration keys available in Podsync.
57+
58+
Minimal configuration would look like this:
5759

5860
```toml
5961
[server]
6062
port = 8080
61-
# Bind a specific IP addresses for server ,"*": bind all IP addresses which is default option, localhost or 127.0.0.1 bind a single IPv4 address
62-
bind_address = "172.20.10.2"
63-
# Specify path for reverse proxy and only [A-Za-z0-9]
64-
path = "test"
65-
data_dir = "/app/data" # Don't change if you run podsync via docker
63+
data_dir = "/data/podsync/"
6664

67-
# Tokens from `Access tokens` section
6865
[tokens]
69-
youtube = ["YOUTUBE_API_TOKEN"] # YouTube API Key. See https://developers.google.com/youtube/registering_an_application
70-
vimeo = [ # Multiple keys will be rotated.
71-
"VIMEO_API_KEY_1", # Vimeo developer keys. See https://developer.vimeo.com/api/guides/start#generate-access-token
72-
"VIMEO_API_KEY_2"
73-
]
66+
youtube = "PASTE YOUR API KEY HERE"
7467

7568
[feeds]
76-
[feeds.ID1]
77-
url = "{FEED_URL}" # URL address of a channel, group, user, or playlist.
78-
page_size = 50 # The number of episodes to query each update (keep in mind, that this might drain API token)
79-
update_period = "12h" # How often query for updates, examples: "60m", "4h", "2h45m"
80-
quality = "high" # or "low"
81-
format = "video" # or "audio"
82-
playlist_sort = "asc" # or "desc", which will fetch playlist items from the end
83-
# custom.cover_art_quality use "high" or "low" to special cover image quality from channel cover default is equal with "quality" and disable when custom.cover_art was set.
84-
# custom = { title = "Level1News", description = "News sections of Level1Techs, in a podcast feed!", author = "Level1Tech", cover_art = "{IMAGE_URL}", cover_art_quality = "high", category = "TV", subcategories = ["Documentary", "Tech News"], explicit = true, lang = "en" } # Optional feed customizations
85-
# max_height = 720 # Optional maximal height of video, example: 720, 1080, 1440, 2160, ...
86-
# cron_schedule = "@every 12h" # Optional cron expression format. If set then overwrite 'update_period'. See details below
87-
# filters = { title = "regex for title here", not_title = "regex for negative title match", description = "...", not_description = "..." } # Optional Golang regexp format. If set, then only download matching episodes.
88-
# opml = true|false # Optional inclusion of the feed in the OPML file (default value: false)
89-
# clean = { keep_last = 10 } # Keep last 10 episodes (order desc by PubDate)
90-
# youtube_dl_args = [ "--write-sub", "--embed-subs", "--sub-lang", "en,en-US,en-GB" ] # Optional extra arguments passed to youtube-dl when downloading videos from this feed. This example would embed available English closed captions in the videos. Note that setting '--audio-format' for audio format feeds, or '--format' or '--output' for any format may cause unexpected behaviour. You should only use this if you know what you are doing, and have read up on youtube-dl's options!
91-
92-
[database]
93-
badger = { truncate = true, file_io = true } # See https://github.com/dgraph-io/badger#memory-usage
94-
95-
[downloader]
96-
self_update = true # Optional, auto update youtube-dl every 24 hours
97-
timeout = 15 # Timeout in minutes
98-
99-
# Optional log config. If not specified logs to the stdout
100-
[log]
101-
filename = "podsync.log"
102-
max_size = 50 # MB
103-
max_age = 30 # days
104-
max_backups = 7
105-
compress = true
106-
69+
[feeds.ID1]
70+
url = "https://www.youtube.com/channel/UCxC5Ls6DwqV0e-CYcAKkExQ"
10771
```
10872

109-
Please note: Automatically clean-up will not work without a database configuration.
110-
111-
Episodes files will be kept at: `/path/to/data/directory/ID1`, feed will be accessible from: `http://localhost/ID1.xml`
112-
11373
If you want to hide Podsync behind reverse proxy like nginx, you can use `hostname` field:
11474

11575
```toml

cmd/podsync/config_test.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,16 @@ timeout = 15
4040
filters = { title = "regex for title here" }
4141
playlist_sort = "desc"
4242
clean = { keep_last = 10 }
43-
[feeds.XYZ.custom]
44-
cover_art = "http://img"
45-
cover_art_quality = "high"
46-
category = "TV"
47-
subcategories = ["1", "2"]
48-
explicit = true
49-
lang = "en"
50-
author = "Mrs. Smith ([email protected])"
51-
ownerName = "Mrs. Smith"
52-
ownerEmail = "[email protected]"
43+
[feeds.XYZ.custom]
44+
cover_art = "http://img"
45+
cover_art_quality = "high"
46+
category = "TV"
47+
subcategories = ["1", "2"]
48+
explicit = true
49+
lang = "en"
50+
author = "Mrs. Smith ([email protected])"
51+
ownerName = "Mrs. Smith"
52+
ownerEmail = "[email protected]"
5353
`
5454
path := setup(t, file)
5555
defer os.Remove(path)

config.toml.example

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# This is an example of TOML configuration file for Podsync.
2+
3+
# Web server related configuration.
4+
[server]
5+
# HTTP server port.
6+
port = 8080
7+
# Optional. If you want to hide Podsync behind reverse proxy like nginx, you can use hostname field.
8+
# Server will be accessible from http://localhost:8080, but episode links will point to https://my.test.host:4443/ID1/XYZ
9+
hostname = "https://my.test.host:4443"
10+
# Bind a specific IP addresses for server ,"*": bind all IP addresses which is default option, localhost or 127.0.0.1 bind a single IPv4 address
11+
bind_address = "172.20.10.2"
12+
# Specify path for reverse proxy and only [A-Za-z0-9]
13+
path = "test"
14+
data_dir = "/app/data" # Don't change if you run podsync via docker
15+
16+
# API keys to be used to access Youtube and Vimeo.
17+
# These can be either specified as string parameter or array of string (so those will be rotated).
18+
[tokens]
19+
youtube = "YOUTUBE_API_TOKEN" # YouTube API Key. See https://developers.google.com/youtube/registering_an_application
20+
vimeo = [ # Multiple keys will be rotated.
21+
"VIMEO_API_KEY_1", # Vimeo developer keys. See https://developer.vimeo.com/api/guides/start#generate-access-token
22+
"VIMEO_API_KEY_2"
23+
]
24+
25+
# The list of data sources to be hosted by Podsync.
26+
# These are channels, users, playlists, etc.
27+
[feeds]
28+
# Each channel must have a unique identifier (in this example "ID1").
29+
[feeds.ID1]
30+
# URL address of a channel, group, user, or playlist.
31+
url = "https://www.youtube.com/channel/CHANNEL_NAME_TO_HOST"
32+
33+
# The number of episodes to query each update (keep in mind, that this might drain API token)
34+
page_size = 50
35+
36+
# How often query for updates, examples: "60m", "4h", "2h45m"
37+
update_period = "12h"
38+
39+
quality = "high" # or "low"
40+
format = "video" # or "audio"
41+
playlist_sort = "asc" # or "desc", which will fetch playlist items from the end
42+
43+
# Optional maximal height of video, example: 720, 1080, 1440, 2160, ...
44+
max_height = 720
45+
46+
# Optinally include this feed in OPML file (default value: false)
47+
opml = true
48+
49+
# Optional cron expression format for more precise update schedule.
50+
# If set then overwrite 'update_period'.
51+
cron_schedule = "@every 12h"
52+
53+
# Whether to cleanup old episodes.
54+
# Keep last 10 episodes (order desc by PubDate)
55+
clean = { keep_last = 10 }
56+
57+
# Optional Golang regexp format.
58+
# If set, then only download matching episodes.
59+
filters = { title = "regex for title here", not_title = "regex for negative title match", description = "...", not_description = "..." }
60+
61+
# Optional extra arguments passed to youtube-dl when downloading videos from this feed.
62+
# This example would embed available English closed captions in the videos.
63+
# Note that setting '--audio-format' for audio format feeds, or '--format' or '--output' for any format may cause
64+
# unexpected behaviour. You should only use this if you know what you are doing, and have read up on youtube-dl's options!
65+
youtube_dl_args = ["--write-sub", "--embed-subs", "--sub-lang", "en,en-US,en-GB"]
66+
67+
# Optional feed customizations
68+
[feeds.ID1.custom]
69+
title = "Level1News"
70+
description = "News sections of Level1Techs, in a podcast feed!"
71+
author = "Level1Tech"
72+
cover_art = "{IMAGE_URL}"
73+
cover_art_quality = "high"
74+
category = "TV"
75+
subcategories = ["Documentary", "Tech News"]
76+
explicit = true
77+
lang = "en"
78+
author = "Mrs. Smith ([email protected])"
79+
ownerName = "Mrs. Smith"
80+
ownerEmail = "[email protected]"
81+
82+
# Podsync uses local database to store feeds and episodes metadata.
83+
# This section is optional and usually not needed to configure unless some very specific corner cases.
84+
# Refer to https://dgraph.io/docs/badger/get-started/#memory-usage for documentation.
85+
[database]
86+
badger = { truncate = true, file_io = true }
87+
88+
# Youtube-dl specific configuration.
89+
[downloader]
90+
# Optional, auto update youtube-dl every 24 hours
91+
self_update = true
92+
# Download timeout in minutes.
93+
timeout = 15
94+
95+
# Optional log config. If not specified logs to the stdout
96+
[log]
97+
filename = "podsync.log"
98+
max_size = 50 # MB
99+
max_age = 30 # days
100+
max_backups = 7
101+
compress = true

pkg/db/badger.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ const (
2323
)
2424

2525
// BadgerConfig represents BadgerDB configuration parameters
26-
// See https://github.com/dgraph-io/badger#memory-usage
2726
type BadgerConfig struct {
2827
Truncate bool `toml:"truncate"`
2928
FileIO bool `toml:"file_io"`

0 commit comments

Comments
 (0)