Don't use git-tracked files as config files directly, and add the generated m3u to the gitignore properly

This commit is contained in:
Kevin MacMartin 2023-03-11 00:39:16 -05:00
parent 0c9cc7f5fc
commit 0eac61ebf6
6 changed files with 20 additions and 5 deletions

5
.gitignore vendored
View file

@ -1,2 +1,5 @@
.m3u *.m3u
node_modules node_modules
config/categories.json
config/countries.json
config/languages.json

View file

@ -3,6 +3,9 @@
# Dependencies # Dependencies
deps=('curl' 'dos2unix' 'grep' 'node' 'rows' 'sqlite3') deps=('curl' 'dos2unix' 'grep' 'node' 'rows' 'sqlite3')
# Config files
config_files=('categories.json' 'countries.json' 'languages.json')
# URLs # URLs
tmp_m3u_url='https://iptv-org.github.io/iptv/index.m3u' tmp_m3u_url='https://iptv-org.github.io/iptv/index.m3u'
tmp_csv_url='https://raw.githubusercontent.com/iptv-org/database/master/data/channels.csv' tmp_csv_url='https://raw.githubusercontent.com/iptv-org/database/master/data/channels.csv'
@ -92,5 +95,13 @@ done
exit 1 exit 1
} }
# Ensure the required config files exist
for config in "${config_files[@]}"; do
if [[ ! -f "config/$config" ]]; then
printf '%s\n' "The file config/$config is missing"
exit 1
fi
done
# Update M3U # Update M3U
update update

View file

@ -13,7 +13,8 @@ Takes [iptv-org](https://github.com/iptv-org) data and creates a custom m3u
## Usage ## Usage
1. Customize the languages, countries and categories in the respective json files in the `config` folder using the ids from the respective csv here: https://github.com/iptv-org/database/blob/master/data 1. Copy the example config files in the `config` folder to the equivalent file names without the `.example` (ie: copy `config/$x.example.json` to `config/$x.json`)
2. Run `npm install` 2. Edit the newly created non-example files in the `config` folder to customize the set of languages, countries and categories using the `id` attributes of the respective csv files here: https://github.com/iptv-org/database/blob/master/data
3. Run `./iptv-m3u-update` 3. Run `npm install`
4. Load your freshly generated `channels.m3u` 4. Run `./iptv-m3u-update`
5. Load your freshly generated `channels.m3u`