mirror of
https://github.com/iptv-org/database.git
synced 2024-11-22 10:54:11 -05:00
Merge branch 'master' into pr/3732
This commit is contained in:
commit
2507cba956
8 changed files with 201 additions and 54 deletions
4
.github/ISSUE_TEMPLATE/channels_add.yml
vendored
4
.github/ISSUE_TEMPLATE/channels_add.yml
vendored
|
@ -66,7 +66,7 @@ body:
|
||||||
id: broadcast_area
|
id: broadcast_area
|
||||||
attributes:
|
attributes:
|
||||||
label: Broadcast Area
|
label: Broadcast Area
|
||||||
description: List of codes describing the broadcasting area of the channel. Any combination of `r/<region_code>`, `c/<country_code>`, `s/<subdivision_code>`
|
description: List of codes describing the broadcasting area of the channel separated by `;`. Any combination of `r/<region_code>`, `c/<country_code>`, `s/<subdivision_code>`
|
||||||
placeholder: 's/CN-AH'
|
placeholder: 's/CN-AH'
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
|
@ -130,7 +130,7 @@ body:
|
||||||
id: logo
|
id: logo
|
||||||
attributes:
|
attributes:
|
||||||
label: Logo
|
label: Logo
|
||||||
description: "Logo URL. Only URL with HTTPS protocol are allowed. Supported image types: `PNG`, `JPEG`. Max size: 512x512 pixels"
|
description: "Logo URL. Only URL with HTTPS protocol are allowed. Supported image types: `PNG`, `JPEG`. Max size: 512x512 pixels. The link should not be [geo-blocked](https://en.wikipedia.org/wiki/Geo-blocking)"
|
||||||
placeholder: 'https://example.com/logo.png'
|
placeholder: 'https://example.com/logo.png'
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
|
|
4
.github/ISSUE_TEMPLATE/channels_edit.yml
vendored
4
.github/ISSUE_TEMPLATE/channels_edit.yml
vendored
|
@ -62,7 +62,7 @@ body:
|
||||||
- type: input
|
- type: input
|
||||||
attributes:
|
attributes:
|
||||||
label: Broadcast Area
|
label: Broadcast Area
|
||||||
description: List of codes describing the broadcasting area of the channel. Any combination of `r/<region_code>`, `c/<country_code>`, `s/<subdivision_code>`
|
description: List of codes describing the broadcasting area of the channel separated by `;`. Any combination of `r/<region_code>`, `c/<country_code>`, `s/<subdivision_code>`
|
||||||
placeholder: 's/CN-AH'
|
placeholder: 's/CN-AH'
|
||||||
|
|
||||||
- type: input
|
- type: input
|
||||||
|
@ -114,7 +114,7 @@ body:
|
||||||
- type: input
|
- type: input
|
||||||
attributes:
|
attributes:
|
||||||
label: Logo
|
label: Logo
|
||||||
description: "Logo URL. Only URL with HTTPS protocol are allowed. Supported image types: `PNG`, `JPEG`. Max size: 512x512 pixels"
|
description: "Logo URL. Only URL with HTTPS protocol are allowed. Supported image types: `PNG`, `JPEG`. Max size: 512x512 pixels. The link should not be [geo-blocked](https://en.wikipedia.org/wiki/Geo-blocking)"
|
||||||
placeholder: 'https://example.com/logo.png'
|
placeholder: 'https://example.com/logo.png'
|
||||||
|
|
||||||
- type: textarea
|
- type: textarea
|
||||||
|
|
30
.github/workflows/update.yml
vendored
30
.github/workflows/update.yml
vendored
|
@ -7,35 +7,25 @@ jobs:
|
||||||
main:
|
main:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- uses: tibdex/github-app-token@v1
|
- uses: tibdex/github-app-token@v1
|
||||||
id: create-app-token
|
id: create-app-token
|
||||||
with:
|
with:
|
||||||
app_id: ${{ secrets.APP_ID }}
|
app_id: ${{ secrets.APP_ID }}
|
||||||
private_key: ${{ secrets.APP_PRIVATE_KEY }}
|
private_key: ${{ secrets.APP_PRIVATE_KEY }}
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
token: ${{ steps.create-app-token.outputs.token }}
|
||||||
- run: npm install
|
- run: npm install
|
||||||
- run: GITHUB_TOKEN=${{ steps.create-app-token.outputs.token }} npm run db:update --silent >> $GITHUB_OUTPUT
|
- run: GITHUB_TOKEN=${{ steps.create-app-token.outputs.token }} npm run db:update --silent >> $GITHUB_OUTPUT
|
||||||
id: issue-process
|
id: issue-process
|
||||||
|
- name: Validate Changes
|
||||||
|
run: npm run db:validate
|
||||||
- name: Commit Changes
|
- name: Commit Changes
|
||||||
|
if: steps.issue-process.outputs.OUTPUT != 0
|
||||||
run: |
|
run: |
|
||||||
git config user.name ${{ github.actor }}
|
git config user.name "iptv-bot[bot]"
|
||||||
git config user.email '${{ github.actor }}@users.noreply.github.com'
|
git config user.email "84861620+iptv-bot[bot]@users.noreply.github.com"
|
||||||
git add data/channels.csv
|
git add data/channels.csv
|
||||||
git commit -m "[Bot] Update channels.csv" --no-verify
|
git commit -m "[Bot] Update channels.csv" -m "Committed by [iptv-bot](https://github.com/apps/iptv-bot) via [update](https://github.com/iptv-org/database/actions/runs/${{ github.run_id }}) workflow." -m "${{ steps.issue-process.outputs.OUTPUT }}" --no-verify
|
||||||
git status
|
git status
|
||||||
- name: Create Pull Request
|
git push
|
||||||
uses: peter-evans/create-pull-request@v5
|
|
||||||
with:
|
|
||||||
token: ${{ steps.create-app-token.outputs.token }}
|
|
||||||
branch: bot/patch
|
|
||||||
branch-suffix: timestamp
|
|
||||||
delete-branch: true
|
|
||||||
add-paths: |
|
|
||||||
data/*.csv
|
|
||||||
title: '[Bot] Update database'
|
|
||||||
body: |
|
|
||||||
This pull request is created by [update][1] workflow.
|
|
||||||
|
|
||||||
${{ steps.issue-process.outputs.OUTPUT }}
|
|
||||||
|
|
||||||
[1]: https://github.com/iptv-org/database/actions/runs/${{ github.run_id }}
|
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
| country | Country code from which the channel is transmitted. A list of all supported countries and their codes can be found in [data/countries.csv](data/countries.csv) | Required | `CN` |
|
| country | Country code from which the channel is transmitted. A list of all supported countries and their codes can be found in [data/countries.csv](data/countries.csv) | Required | `CN` |
|
||||||
| subdivision | Code of the subdivision (e.g., provinces or states) from which the broadcast is transmitted. A list of all supported subdivisions and their codes can be found in [data/subdivisions.csv](data/subdivisions.csv). | Optional | `CN-AH` |
|
| subdivision | Code of the subdivision (e.g., provinces or states) from which the broadcast is transmitted. A list of all supported subdivisions and their codes can be found in [data/subdivisions.csv](data/subdivisions.csv). | Optional | `CN-AH` |
|
||||||
| city | The name of the city in English from which the channel is broadcast. May contain any characters except `,` and `"`. | Optional | `Hefei` |
|
| city | The name of the city in English from which the channel is broadcast. May contain any characters except `,` and `"`. | Optional | `Hefei` |
|
||||||
| broadcast_area | List of codes describing the broadcasting area of the channel. Any combination of `r/<region_code>`, `c/<country_code>`, `s/<subdivision_code>`. | Required | `s/CN-AH` |
|
| broadcast_area | List of codes describing the broadcasting area of the channel separated by `;`. Any combination of `r/<region_code>`, `c/<country_code>`, `s/<subdivision_code>`. | Required | `s/CN-AH` |
|
||||||
| languages | List of languages in which the channel is broadcast separated by `;`. A list of all supported languages and their codes can be found in [data/languages.csv](data/languages.csv). | Required | `zho` |
|
| languages | List of languages in which the channel is broadcast separated by `;`. A list of all supported languages and their codes can be found in [data/languages.csv](data/languages.csv). | Required | `zho` |
|
||||||
| categories | List of categories to which this channel belongs separated by `;`. A list of all supported categories can be found in [data/categories.csv](data/categories.csv). | Optional | `general` |
|
| categories | List of categories to which this channel belongs separated by `;`. A list of all supported categories can be found in [data/categories.csv](data/categories.csv). | Optional | `general` |
|
||||||
| is_nsfw | Indicates whether the channel broadcasts adult content (`TRUE` or `FALSE`). | Required | `FALSE` |
|
| is_nsfw | Indicates whether the channel broadcasts adult content (`TRUE` or `FALSE`). | Required | `FALSE` |
|
||||||
|
@ -43,7 +43,7 @@
|
||||||
| closed | Date on which the channel closed (`YYYY-MM-DD`). | Optional | `2020-05-31` |
|
| closed | Date on which the channel closed (`YYYY-MM-DD`). | Optional | `2020-05-31` |
|
||||||
| replaced_by | The ID of the channel that this channel was replaced by. | Optional | `CCTV1.cn` |
|
| replaced_by | The ID of the channel that this channel was replaced by. | Optional | `CCTV1.cn` |
|
||||||
| website | Official website URL. | Optional | `http://www.ahtv.cn/` |
|
| website | Official website URL. | Optional | `http://www.ahtv.cn/` |
|
||||||
| logo | Logo URL. Only URL with HTTPS protocol are allowed. Supported image types: `PNG`, `JPEG`. Max size: 512x512 pixels. | Required | `https://example.com/logo.png` |
|
| logo | Logo URL. Only URL with [HTTPS](https://ru.wikipedia.org/wiki/HTTPS) protocol are allowed. Supported image types: `PNG`, `JPEG`. Max size: 512x512 pixels. The link should not be [geo-blocked](https://en.wikipedia.org/wiki/Geo-blocking). | Required | `https://example.com/logo.png` |
|
||||||
|
|
||||||
### categories
|
### categories
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Database [![check](https://github.com/iptv-org/database/actions/workflows/check.yml/badge.svg)](https://github.com/iptv-org/database/actions/workflows/check.yml)
|
# Database [![update](https://github.com/iptv-org/database/actions/workflows/update.yml/badge.svg)](https://github.com/iptv-org/database/actions/workflows/update.yml)
|
||||||
|
|
||||||
User editable database for TV channels.
|
User editable database for TV channels.
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,5 +1,6 @@
|
||||||
const Joi = require('joi').extend(require('@joi/date'))
|
const Joi = require('joi').extend(require('@joi/date'))
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
const url = require('url')
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
id: Joi.string()
|
id: Joi.string()
|
||||||
|
@ -53,7 +54,7 @@ module.exports = {
|
||||||
scheme: ['https']
|
scheme: ['https']
|
||||||
})
|
})
|
||||||
.custom((value, helper) => {
|
.custom((value, helper) => {
|
||||||
const ext = path.extname(value)
|
const ext = path.extname(url.parse(value).pathname)
|
||||||
if (!ext || /(\.png|\.jpeg|\.jpg)/i.test(ext)) {
|
if (!ext || /(\.png|\.jpeg|\.jpg)/i.test(ext)) {
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -66,7 +66,7 @@ async function editChannels() {
|
||||||
}
|
}
|
||||||
|
|
||||||
const index = _.findIndex(channels, { id: channel.id })
|
const index = _.findIndex(channels, { id: channel.id })
|
||||||
if (!index) {
|
if (index < 0) {
|
||||||
updateIssue(issue, { labels: ['channels:edit', 'rejected:wrong_id'] })
|
updateIssue(issue, { labels: ['channels:edit', 'rejected:wrong_id'] })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -165,12 +165,12 @@ function parseIssue(issue) {
|
||||||
Logo: 'logo'
|
Logo: 'logo'
|
||||||
}
|
}
|
||||||
|
|
||||||
const matches = issue.body.match(/### ([^\r\n]+)[^\w\d]+([^\r\n]+)/g)
|
const matches = issue.body.match(/### ([^\r\n]+)\s+([^\r\n]+)/g)
|
||||||
|
|
||||||
if (!matches) return { issue, channel: null }
|
if (!matches) return { issue, channel: null }
|
||||||
|
|
||||||
matches.forEach(item => {
|
matches.forEach(item => {
|
||||||
const [, fieldLabel, value] = item.match(/### ([^\r\n]+)[^\w\d]+([^\r\n]+)/)
|
const [, fieldLabel, value] = item.match(/### ([^\r\n]+)\s+([^\r\n]+)/)
|
||||||
const field = fields[fieldLabel]
|
const field = fields[fieldLabel]
|
||||||
|
|
||||||
if (!field) return
|
if (!field) return
|
||||||
|
|
Loading…
Reference in a new issue