Merge branch 'master' into pr/3732

This commit is contained in:
Aleksandr Statciuk 2023-05-27 21:14:20 +03:00
commit 2507cba956
8 changed files with 201 additions and 54 deletions

View file

@ -66,7 +66,7 @@ body:
id: broadcast_area
attributes:
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'
validations:
required: true
@ -130,7 +130,7 @@ body:
id: logo
attributes:
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'
validations:
required: true

View file

@ -62,7 +62,7 @@ body:
- type: input
attributes:
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'
- type: input
@ -114,7 +114,7 @@ body:
- type: input
attributes:
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'
- type: textarea

View file

@ -7,35 +7,25 @@ jobs:
main:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: tibdex/github-app-token@v1
id: create-app-token
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- uses: actions/checkout@v3
with:
token: ${{ steps.create-app-token.outputs.token }}
- run: npm install
- run: GITHUB_TOKEN=${{ steps.create-app-token.outputs.token }} npm run db:update --silent >> $GITHUB_OUTPUT
id: issue-process
- name: Validate Changes
run: npm run db:validate
- name: Commit Changes
if: steps.issue-process.outputs.OUTPUT != 0
run: |
git config user.name ${{ github.actor }}
git config user.email '${{ github.actor }}@users.noreply.github.com'
git config user.name "iptv-bot[bot]"
git config user.email "84861620+iptv-bot[bot]@users.noreply.github.com"
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
- name: Create Pull Request
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 }}
git push

View file

@ -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` |
| 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` |
| 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` |
| 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` |
@ -43,7 +43,7 @@
| 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` |
| 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

View file

@ -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.

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,6 @@
const Joi = require('joi').extend(require('@joi/date'))
const path = require('path')
const url = require('url')
module.exports = {
id: Joi.string()
@ -53,7 +54,7 @@ module.exports = {
scheme: ['https']
})
.custom((value, helper) => {
const ext = path.extname(value)
const ext = path.extname(url.parse(value).pathname)
if (!ext || /(\.png|\.jpeg|\.jpg)/i.test(ext)) {
return true
} else {

View file

@ -66,7 +66,7 @@ async function editChannels() {
}
const index = _.findIndex(channels, { id: channel.id })
if (!index) {
if (index < 0) {
updateIssue(issue, { labels: ['channels:edit', 'rejected:wrong_id'] })
return
}
@ -165,12 +165,12 @@ function parseIssue(issue) {
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 }
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]
if (!field) return