mirror of
https://github.com/iptv-org/database.git
synced 2024-11-26 20:41:27 -05:00
Merge branch 'iptv-org:master' into master
This commit is contained in:
commit
373767d00b
8 changed files with 1053 additions and 86 deletions
16
.github/ISSUE_TEMPLATE/channels_add.yml
vendored
16
.github/ISSUE_TEMPLATE/channels_add.yml
vendored
|
@ -10,6 +10,7 @@ body:
|
|||
Please fill out the issue form as much as you can so we could efficiently process your request
|
||||
|
||||
- type: input
|
||||
id: name
|
||||
attributes:
|
||||
label: Channel Name
|
||||
description: "Official channel name in English or call sign. May include: `a-z`, `0-9`, `space`, `-`, `!`, `:`, `&`, `.`, `+`, `'`, `/`, `»`, `#`, `%`, `°`, `$`, `@`, `?`"
|
||||
|
@ -18,24 +19,28 @@ body:
|
|||
required: true
|
||||
|
||||
- type: input
|
||||
id: alt_name
|
||||
attributes:
|
||||
label: Alternative Names (optional)
|
||||
description: List of alternative channel names separated by `;`. May contain any characters except `,` and `"`
|
||||
placeholder: '安徽卫视'
|
||||
|
||||
- type: input
|
||||
id: network
|
||||
attributes:
|
||||
label: Network (optional)
|
||||
description: Network of which this channel is a part. May contain any characters except `,` and `"`
|
||||
placeholder: 'Anhui'
|
||||
|
||||
- type: input
|
||||
id: owners
|
||||
attributes:
|
||||
label: Owners (optional)
|
||||
description: List of channel owners separated by `;`. May contain any characters except `,` and `"`
|
||||
placeholder: 'China Central Television'
|
||||
|
||||
- type: input
|
||||
id: country
|
||||
attributes:
|
||||
label: Country
|
||||
description: Country code from which the channel is transmitted. A list of all supported countries and their codes can be found in [data/countries.csv](https://github.com/iptv-org/database/blob/master/data/countries.csv)
|
||||
|
@ -44,18 +49,21 @@ body:
|
|||
required: true
|
||||
|
||||
- type: input
|
||||
id: subdivision
|
||||
attributes:
|
||||
label: Subdivision (optional)
|
||||
description: 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](https://github.com/iptv-org/database/blob/master/data/subdivisions.csv)
|
||||
placeholder: 'CN-AH'
|
||||
|
||||
- type: input
|
||||
id: city
|
||||
attributes:
|
||||
label: City (optional)
|
||||
description: Name of the city from which the channel is transmitted
|
||||
placeholder: 'Hefei'
|
||||
|
||||
- type: input
|
||||
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>`
|
||||
|
@ -64,6 +72,7 @@ body:
|
|||
required: true
|
||||
|
||||
- type: input
|
||||
id: languages
|
||||
attributes:
|
||||
label: Languages
|
||||
description: 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](https://github.com/iptv-org/database/blob/master/data/languages.csv)
|
||||
|
@ -72,12 +81,14 @@ body:
|
|||
required: true
|
||||
|
||||
- type: input
|
||||
id: categories
|
||||
attributes:
|
||||
label: Categories (optional)
|
||||
description: List of categories to which this channel belongs separated by `;`. A list of all supported categories can be found in [data/categories.csv](https://github.com/iptv-org/database/blob/master/data/categories.csv)
|
||||
placeholder: 'animation;kids'
|
||||
|
||||
- type: dropdown
|
||||
id: is_nsfw
|
||||
attributes:
|
||||
label: NSFW
|
||||
description: Indicates whether the channel broadcasts adult content
|
||||
|
@ -88,30 +99,35 @@ body:
|
|||
required: true
|
||||
|
||||
- type: input
|
||||
id: launched
|
||||
attributes:
|
||||
label: Launched (optional)
|
||||
description: Launch date of the channel (`YYYY-MM-DD`)
|
||||
placeholder: '2016-07-28'
|
||||
|
||||
- type: input
|
||||
id: closed
|
||||
attributes:
|
||||
label: Closed (optional)
|
||||
description: Date on which the channel closed (`YYYY-MM-DD`)
|
||||
placeholder: '2020-05-31'
|
||||
|
||||
- type: input
|
||||
id: replaced_by
|
||||
attributes:
|
||||
label: Replaced By (optional)
|
||||
description: The ID of the channel that this channel was replaced by
|
||||
placeholder: 'CCTV1.cn'
|
||||
|
||||
- type: input
|
||||
id: website
|
||||
attributes:
|
||||
label: Website (optional)
|
||||
description: Official website URL
|
||||
placeholder: 'http://www.ahtv.cn/'
|
||||
|
||||
- type: input
|
||||
id: logo
|
||||
attributes:
|
||||
label: Logo
|
||||
description: "Logo URL. Only URL with HTTPS protocol are allowed. Supported image types: `PNG`, `JPEG`. Max size: 512x512 pixels"
|
||||
|
|
2
.github/ISSUE_TEMPLATE/channels_edit.yml
vendored
2
.github/ISSUE_TEMPLATE/channels_edit.yml
vendored
|
@ -25,7 +25,7 @@ body:
|
|||
|
||||
- type: input
|
||||
attributes:
|
||||
label: Alternative Names (optional)
|
||||
label: Alternative Names
|
||||
description: List of alternative channel names separated by `;`. May contain any characters except `,` and `"`
|
||||
placeholder: '安徽卫视'
|
||||
|
||||
|
|
41
.github/workflows/update.yml
vendored
Normal file
41
.github/workflows/update.yml
vendored
Normal file
|
@ -0,0 +1,41 @@
|
|||
name: update
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '0 0 * * *'
|
||||
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 }}
|
||||
- run: npm install
|
||||
- run: GITHUB_TOKEN=${{ steps.create-app-token.outputs.token }} npm run db:update --silent >> $GITHUB_OUTPUT
|
||||
id: issue-process
|
||||
- name: Commit Changes
|
||||
run: |
|
||||
git config user.name ${{ github.actor }}
|
||||
git config user.email '${{ github.actor }}@users.noreply.github.com'
|
||||
git add data/channels.csv
|
||||
git commit -m "[Bot] Update channels.csv" --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 }}
|
File diff suppressed because it is too large
Load diff
241
package-lock.json
generated
241
package-lock.json
generated
|
@ -7,6 +7,8 @@
|
|||
"name": "@iptv-org/database",
|
||||
"dependencies": {
|
||||
"@joi/date": "^2.1.0",
|
||||
"@octokit/core": "^4.2.0",
|
||||
"@octokit/plugin-paginate-rest": "^6.0.0",
|
||||
"autocrop-js": "^0.2.0",
|
||||
"axios": "^0.25.0",
|
||||
"chalk": "^4.1.2",
|
||||
|
@ -156,6 +158,116 @@
|
|||
"moment": "2.x.x"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/auth-token": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-3.0.3.tgz",
|
||||
"integrity": "sha512-/aFM2M4HVDBT/jjDBa84sJniv1t9Gm/rLkalaz9htOm+L+8JMj1k9w0CkUdcxNyNxZPlTxKPVko+m1VlM58ZVA==",
|
||||
"dependencies": {
|
||||
"@octokit/types": "^9.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 14"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/core": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/core/-/core-4.2.0.tgz",
|
||||
"integrity": "sha512-AgvDRUg3COpR82P7PBdGZF/NNqGmtMq2NiPqeSsDIeCfYFOZ9gddqWNQHnFdEUf+YwOj4aZYmJnlPp7OXmDIDg==",
|
||||
"dependencies": {
|
||||
"@octokit/auth-token": "^3.0.0",
|
||||
"@octokit/graphql": "^5.0.0",
|
||||
"@octokit/request": "^6.0.0",
|
||||
"@octokit/request-error": "^3.0.0",
|
||||
"@octokit/types": "^9.0.0",
|
||||
"before-after-hook": "^2.2.0",
|
||||
"universal-user-agent": "^6.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 14"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/endpoint": {
|
||||
"version": "7.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-7.0.5.tgz",
|
||||
"integrity": "sha512-LG4o4HMY1Xoaec87IqQ41TQ+glvIeTKqfjkCEmt5AIwDZJwQeVZFIEYXrYY6yLwK+pAScb9Gj4q+Nz2qSw1roA==",
|
||||
"dependencies": {
|
||||
"@octokit/types": "^9.0.0",
|
||||
"is-plain-object": "^5.0.0",
|
||||
"universal-user-agent": "^6.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 14"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/graphql": {
|
||||
"version": "5.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-5.0.5.tgz",
|
||||
"integrity": "sha512-Qwfvh3xdqKtIznjX9lz2D458r7dJPP8l6r4GQkIdWQouZwHQK0mVT88uwiU2bdTU2OtT1uOlKpRciUWldpG0yQ==",
|
||||
"dependencies": {
|
||||
"@octokit/request": "^6.0.0",
|
||||
"@octokit/types": "^9.0.0",
|
||||
"universal-user-agent": "^6.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 14"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/openapi-types": {
|
||||
"version": "16.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-16.0.0.tgz",
|
||||
"integrity": "sha512-JbFWOqTJVLHZSUUoF4FzAZKYtqdxWu9Z5m2QQnOyEa04fOFljvyh7D3GYKbfuaSWisqehImiVIMG4eyJeP5VEA=="
|
||||
},
|
||||
"node_modules/@octokit/plugin-paginate-rest": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-6.0.0.tgz",
|
||||
"integrity": "sha512-Sq5VU1PfT6/JyuXPyt04KZNVsFOSBaYOAq2QRZUwzVlI10KFvcbUo8lR258AAQL1Et60b0WuVik+zOWKLuDZxw==",
|
||||
"dependencies": {
|
||||
"@octokit/types": "^9.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 14"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@octokit/core": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/request": {
|
||||
"version": "6.2.3",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-6.2.3.tgz",
|
||||
"integrity": "sha512-TNAodj5yNzrrZ/VxP+H5HiYaZep0H3GU0O7PaF+fhDrt8FPrnkei9Aal/txsN/1P7V3CPiThG0tIvpPDYUsyAA==",
|
||||
"dependencies": {
|
||||
"@octokit/endpoint": "^7.0.0",
|
||||
"@octokit/request-error": "^3.0.0",
|
||||
"@octokit/types": "^9.0.0",
|
||||
"is-plain-object": "^5.0.0",
|
||||
"node-fetch": "^2.6.7",
|
||||
"universal-user-agent": "^6.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 14"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/request-error": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-3.0.3.tgz",
|
||||
"integrity": "sha512-crqw3V5Iy2uOU5Np+8M/YexTlT8zxCfI+qu+LxUB7SZpje4Qmx3mub5DfEKSO8Ylyk0aogi6TYdf6kxzh2BguQ==",
|
||||
"dependencies": {
|
||||
"@octokit/types": "^9.0.0",
|
||||
"deprecation": "^2.0.0",
|
||||
"once": "^1.4.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 14"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/types": {
|
||||
"version": "9.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-9.0.0.tgz",
|
||||
"integrity": "sha512-LUewfj94xCMH2rbD5YJ+6AQ4AVjFYTgpp6rboWM5T7N3IsIF65SBEOVcYMGAEzO/kKNiNaW4LoWtoThOhH06gw==",
|
||||
"dependencies": {
|
||||
"@octokit/openapi-types": "^16.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@sideway/address": {
|
||||
"version": "4.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.3.tgz",
|
||||
|
@ -281,6 +393,11 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"node_modules/before-after-hook": {
|
||||
"version": "2.2.3",
|
||||
"resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.3.tgz",
|
||||
"integrity": "sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ=="
|
||||
},
|
||||
"node_modules/bl": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz",
|
||||
|
@ -713,6 +830,11 @@
|
|||
"node": ">=0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/deprecation": {
|
||||
"version": "2.3.1",
|
||||
"resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz",
|
||||
"integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ=="
|
||||
},
|
||||
"node_modules/detect-libc": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.1.tgz",
|
||||
|
@ -1286,6 +1408,14 @@
|
|||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/is-plain-object": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz",
|
||||
"integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/is-utf8": {
|
||||
"version": "0.2.1",
|
||||
"resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz",
|
||||
|
@ -2857,6 +2987,11 @@
|
|||
"resolved": "https://registry.npmjs.org/unfetch/-/unfetch-4.2.0.tgz",
|
||||
"integrity": "sha512-F9p7yYCn6cIW9El1zi0HI6vqpeIvBsr3dSuRO6Xuppb1u5rXpCPmMvLSyECLhybr9isec8Ohl0hPekMVrEinDA=="
|
||||
},
|
||||
"node_modules/universal-user-agent": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.0.tgz",
|
||||
"integrity": "sha512-isyNax3wXoKaulPDZWHQqbmIx1k2tb9fb3GGDBRxCscfYV2Ch7WxPArBsFEG8s/safwXTT7H4QGhaIkTp9447w=="
|
||||
},
|
||||
"node_modules/util-deprecate": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
||||
|
@ -3115,6 +3250,92 @@
|
|||
"moment": "2.x.x"
|
||||
}
|
||||
},
|
||||
"@octokit/auth-token": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-3.0.3.tgz",
|
||||
"integrity": "sha512-/aFM2M4HVDBT/jjDBa84sJniv1t9Gm/rLkalaz9htOm+L+8JMj1k9w0CkUdcxNyNxZPlTxKPVko+m1VlM58ZVA==",
|
||||
"requires": {
|
||||
"@octokit/types": "^9.0.0"
|
||||
}
|
||||
},
|
||||
"@octokit/core": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/core/-/core-4.2.0.tgz",
|
||||
"integrity": "sha512-AgvDRUg3COpR82P7PBdGZF/NNqGmtMq2NiPqeSsDIeCfYFOZ9gddqWNQHnFdEUf+YwOj4aZYmJnlPp7OXmDIDg==",
|
||||
"requires": {
|
||||
"@octokit/auth-token": "^3.0.0",
|
||||
"@octokit/graphql": "^5.0.0",
|
||||
"@octokit/request": "^6.0.0",
|
||||
"@octokit/request-error": "^3.0.0",
|
||||
"@octokit/types": "^9.0.0",
|
||||
"before-after-hook": "^2.2.0",
|
||||
"universal-user-agent": "^6.0.0"
|
||||
}
|
||||
},
|
||||
"@octokit/endpoint": {
|
||||
"version": "7.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-7.0.5.tgz",
|
||||
"integrity": "sha512-LG4o4HMY1Xoaec87IqQ41TQ+glvIeTKqfjkCEmt5AIwDZJwQeVZFIEYXrYY6yLwK+pAScb9Gj4q+Nz2qSw1roA==",
|
||||
"requires": {
|
||||
"@octokit/types": "^9.0.0",
|
||||
"is-plain-object": "^5.0.0",
|
||||
"universal-user-agent": "^6.0.0"
|
||||
}
|
||||
},
|
||||
"@octokit/graphql": {
|
||||
"version": "5.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-5.0.5.tgz",
|
||||
"integrity": "sha512-Qwfvh3xdqKtIznjX9lz2D458r7dJPP8l6r4GQkIdWQouZwHQK0mVT88uwiU2bdTU2OtT1uOlKpRciUWldpG0yQ==",
|
||||
"requires": {
|
||||
"@octokit/request": "^6.0.0",
|
||||
"@octokit/types": "^9.0.0",
|
||||
"universal-user-agent": "^6.0.0"
|
||||
}
|
||||
},
|
||||
"@octokit/openapi-types": {
|
||||
"version": "16.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-16.0.0.tgz",
|
||||
"integrity": "sha512-JbFWOqTJVLHZSUUoF4FzAZKYtqdxWu9Z5m2QQnOyEa04fOFljvyh7D3GYKbfuaSWisqehImiVIMG4eyJeP5VEA=="
|
||||
},
|
||||
"@octokit/plugin-paginate-rest": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-6.0.0.tgz",
|
||||
"integrity": "sha512-Sq5VU1PfT6/JyuXPyt04KZNVsFOSBaYOAq2QRZUwzVlI10KFvcbUo8lR258AAQL1Et60b0WuVik+zOWKLuDZxw==",
|
||||
"requires": {
|
||||
"@octokit/types": "^9.0.0"
|
||||
}
|
||||
},
|
||||
"@octokit/request": {
|
||||
"version": "6.2.3",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-6.2.3.tgz",
|
||||
"integrity": "sha512-TNAodj5yNzrrZ/VxP+H5HiYaZep0H3GU0O7PaF+fhDrt8FPrnkei9Aal/txsN/1P7V3CPiThG0tIvpPDYUsyAA==",
|
||||
"requires": {
|
||||
"@octokit/endpoint": "^7.0.0",
|
||||
"@octokit/request-error": "^3.0.0",
|
||||
"@octokit/types": "^9.0.0",
|
||||
"is-plain-object": "^5.0.0",
|
||||
"node-fetch": "^2.6.7",
|
||||
"universal-user-agent": "^6.0.0"
|
||||
}
|
||||
},
|
||||
"@octokit/request-error": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-3.0.3.tgz",
|
||||
"integrity": "sha512-crqw3V5Iy2uOU5Np+8M/YexTlT8zxCfI+qu+LxUB7SZpje4Qmx3mub5DfEKSO8Ylyk0aogi6TYdf6kxzh2BguQ==",
|
||||
"requires": {
|
||||
"@octokit/types": "^9.0.0",
|
||||
"deprecation": "^2.0.0",
|
||||
"once": "^1.4.0"
|
||||
}
|
||||
},
|
||||
"@octokit/types": {
|
||||
"version": "9.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-9.0.0.tgz",
|
||||
"integrity": "sha512-LUewfj94xCMH2rbD5YJ+6AQ4AVjFYTgpp6rboWM5T7N3IsIF65SBEOVcYMGAEzO/kKNiNaW4LoWtoThOhH06gw==",
|
||||
"requires": {
|
||||
"@octokit/openapi-types": "^16.0.0"
|
||||
}
|
||||
},
|
||||
"@sideway/address": {
|
||||
"version": "4.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.3.tgz",
|
||||
|
@ -3211,6 +3432,11 @@
|
|||
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
|
||||
"integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA=="
|
||||
},
|
||||
"before-after-hook": {
|
||||
"version": "2.2.3",
|
||||
"resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.3.tgz",
|
||||
"integrity": "sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ=="
|
||||
},
|
||||
"bl": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz",
|
||||
|
@ -3538,6 +3764,11 @@
|
|||
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
|
||||
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ=="
|
||||
},
|
||||
"deprecation": {
|
||||
"version": "2.3.1",
|
||||
"resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz",
|
||||
"integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ=="
|
||||
},
|
||||
"detect-libc": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.1.tgz",
|
||||
|
@ -3969,6 +4200,11 @@
|
|||
"resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz",
|
||||
"integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4="
|
||||
},
|
||||
"is-plain-object": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz",
|
||||
"integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q=="
|
||||
},
|
||||
"is-utf8": {
|
||||
"version": "0.2.1",
|
||||
"resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz",
|
||||
|
@ -5227,6 +5463,11 @@
|
|||
"resolved": "https://registry.npmjs.org/unfetch/-/unfetch-4.2.0.tgz",
|
||||
"integrity": "sha512-F9p7yYCn6cIW9El1zi0HI6vqpeIvBsr3dSuRO6Xuppb1u5rXpCPmMvLSyECLhybr9isec8Ohl0hPekMVrEinDA=="
|
||||
},
|
||||
"universal-user-agent": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.0.tgz",
|
||||
"integrity": "sha512-isyNax3wXoKaulPDZWHQqbmIx1k2tb9fb3GGDBRxCscfYV2Ch7WxPArBsFEG8s/safwXTT7H4QGhaIkTp9447w=="
|
||||
},
|
||||
"util-deprecate": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
"act:check": "act pull_request -W .github/workflows/check.yml",
|
||||
"act:deploy": "act push -W .github/workflows/deploy.yml",
|
||||
"db:validate": "node scripts/db/validate.js",
|
||||
"db:export": "node scripts/db/export.js"
|
||||
"db:export": "node scripts/db/export.js",
|
||||
"db:update": "node scripts/db/update.js"
|
||||
},
|
||||
"pre-commit": [
|
||||
"db:validate"
|
||||
|
@ -13,6 +14,8 @@
|
|||
"author": "Arhey",
|
||||
"dependencies": {
|
||||
"@joi/date": "^2.1.0",
|
||||
"@octokit/core": "^4.2.0",
|
||||
"@octokit/plugin-paginate-rest": "^6.0.0",
|
||||
"autocrop-js": "^0.2.0",
|
||||
"axios": "^0.25.0",
|
||||
"chalk": "^4.1.2",
|
||||
|
|
181
scripts/db/update.js
Normal file
181
scripts/db/update.js
Normal file
|
@ -0,0 +1,181 @@
|
|||
const { csv, file } = require('../core')
|
||||
const channelScheme = require('../db/schemes/channels')
|
||||
const { Octokit } = require('@octokit/core')
|
||||
const { paginateRest } = require('@octokit/plugin-paginate-rest')
|
||||
const CustomOctokit = Octokit.plugin(paginateRest)
|
||||
const _ = require('lodash')
|
||||
|
||||
const octokit = new CustomOctokit({
|
||||
auth: process.env.GITHUB_TOKEN
|
||||
})
|
||||
|
||||
const DATA_DIR = process.env.DATA_DIR || './data'
|
||||
const OWNER = 'iptv-org'
|
||||
const REPO = 'database'
|
||||
|
||||
let channels = []
|
||||
let processedIssues = []
|
||||
|
||||
async function main() {
|
||||
try {
|
||||
const filepath = `${DATA_DIR}/channels.csv`
|
||||
channels = await csv.fromFile(filepath)
|
||||
|
||||
await editChannels()
|
||||
await addChannels()
|
||||
|
||||
channels = _.orderBy(channels, [channels => channels.id.toLowerCase()], ['asc'])
|
||||
await csv.save(filepath, channels)
|
||||
|
||||
const output = processedIssues.map(issue => `closes #${issue.number}`).join(', ')
|
||||
console.log(`OUTPUT=${output}`)
|
||||
} catch (err) {
|
||||
console.log(err.message)
|
||||
}
|
||||
}
|
||||
|
||||
main()
|
||||
|
||||
async function editChannels() {
|
||||
const issues = await fetchIssues('channels:edit,approved')
|
||||
issues.map(parseIssue).forEach(({ issue, channel }) => {
|
||||
if (!channel) {
|
||||
updateIssue(issue, { labels: ['channels:edit', 'rejected:invalid'] })
|
||||
return
|
||||
}
|
||||
|
||||
const index = _.findIndex(channels, { id: channel.id })
|
||||
if (!index) {
|
||||
updateIssue(issue, { labels: ['channels:edit', 'rejected:invalid'] })
|
||||
return
|
||||
}
|
||||
|
||||
const found = channels[index]
|
||||
|
||||
for (let prop in channel) {
|
||||
if (channel[prop] !== undefined) {
|
||||
found[prop] = channel[prop]
|
||||
}
|
||||
}
|
||||
|
||||
channels.splice(index, 1, found)
|
||||
|
||||
processedIssues.push(issue)
|
||||
})
|
||||
}
|
||||
|
||||
async function addChannels() {
|
||||
const issues = await fetchIssues('channels:add,approved')
|
||||
issues.map(parseIssue).forEach(({ issue, channel }) => {
|
||||
if (!channel) {
|
||||
updateIssue(issue, { labels: ['channels:add', 'rejected:invalid'] })
|
||||
return
|
||||
}
|
||||
|
||||
const found = channels.find(c => c.id === channel.id)
|
||||
if (found) {
|
||||
updateIssue(issue, { labels: ['channels:add', 'rejected:duplicate'] })
|
||||
return
|
||||
}
|
||||
|
||||
channels.push(channel)
|
||||
processedIssues.push(issue)
|
||||
})
|
||||
}
|
||||
|
||||
async function fetchIssues(labels) {
|
||||
const issues = await octokit.paginate('GET /repos/{owner}/{repo}/issues', {
|
||||
owner: OWNER,
|
||||
repo: REPO,
|
||||
per_page: 100,
|
||||
labels,
|
||||
headers: {
|
||||
'X-GitHub-Api-Version': '2022-11-28'
|
||||
}
|
||||
})
|
||||
|
||||
return issues
|
||||
}
|
||||
|
||||
async function updateIssue(issue, { labels }) {
|
||||
await octokit.request('PATCH /repos/{owner}/{repo}/issues/{issue_number}', {
|
||||
owner: OWNER,
|
||||
repo: REPO,
|
||||
issue_number: issue.number,
|
||||
labels,
|
||||
headers: {
|
||||
'X-GitHub-Api-Version': '2022-11-28'
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function parseIssue(issue) {
|
||||
const buffer = {}
|
||||
const channel = {}
|
||||
const fields = {
|
||||
'Channel ID (required)': 'id',
|
||||
'Channel Name': 'name',
|
||||
'Alternative Names': 'alt_names',
|
||||
'Alternative Names (optional)': 'alt_names',
|
||||
Network: 'network',
|
||||
'Network (optional)': 'network',
|
||||
Owners: 'owners',
|
||||
'Owners (optional)': 'owners',
|
||||
Country: 'country',
|
||||
Subdivision: 'subdivision',
|
||||
'Subdivision (optional)': 'subdivision',
|
||||
City: 'city',
|
||||
'City (optional)': 'city',
|
||||
'Broadcast Area': 'broadcast_area',
|
||||
Languages: 'languages',
|
||||
Categories: 'categories',
|
||||
'Categories (optional)': 'categories',
|
||||
NSFW: 'is_nsfw',
|
||||
Launched: 'launched',
|
||||
'Launched (optional)': 'launched',
|
||||
Closed: 'closed',
|
||||
'Closed (optional)': 'closed',
|
||||
'Replaced By': 'replaced_by',
|
||||
'Replaced By (optional)': 'replaced_by',
|
||||
Website: 'website',
|
||||
'Website (optional)': 'website',
|
||||
Logo: 'logo'
|
||||
}
|
||||
|
||||
const matches = issue.body.match(/### ([^\r\n]+)[^\w\d]+([^\r\n]+)/g)
|
||||
|
||||
if (!matches) return { issue, channel: null }
|
||||
|
||||
matches.forEach(item => {
|
||||
const [, fieldLabel, value] = item.match(/### ([^\r\n]+)[^\w\d]+([^\r\n]+)/)
|
||||
const field = fields[fieldLabel]
|
||||
|
||||
if (!field) return
|
||||
|
||||
buffer[field] = value === '_No response_' ? undefined : value.trim()
|
||||
})
|
||||
|
||||
for (let field of Object.keys(channelScheme)) {
|
||||
channel[field] = buffer[field]
|
||||
}
|
||||
|
||||
if (!channel.id) {
|
||||
channel.id = generateChannelId(channel.name, channel.country)
|
||||
}
|
||||
|
||||
return { issue, channel }
|
||||
}
|
||||
|
||||
function generateChannelId(name, country) {
|
||||
if (name && country) {
|
||||
const slug = name
|
||||
.replace(/\+/gi, 'Plus')
|
||||
.replace(/^@/gi, 'At')
|
||||
.replace(/[^a-z\d]+/gi, '')
|
||||
country = country.toLowerCase()
|
||||
|
||||
return `${slug}.${country}`
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
100
yarn.lock
100
yarn.lock
|
@ -49,6 +49,84 @@
|
|||
dependencies:
|
||||
"moment" "2.x.x"
|
||||
|
||||
"@octokit/auth-token@^3.0.0":
|
||||
"integrity" "sha512-/aFM2M4HVDBT/jjDBa84sJniv1t9Gm/rLkalaz9htOm+L+8JMj1k9w0CkUdcxNyNxZPlTxKPVko+m1VlM58ZVA=="
|
||||
"resolved" "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-3.0.3.tgz"
|
||||
"version" "3.0.3"
|
||||
dependencies:
|
||||
"@octokit/types" "^9.0.0"
|
||||
|
||||
"@octokit/core@^4.2.0", "@octokit/core@>=4":
|
||||
"integrity" "sha512-AgvDRUg3COpR82P7PBdGZF/NNqGmtMq2NiPqeSsDIeCfYFOZ9gddqWNQHnFdEUf+YwOj4aZYmJnlPp7OXmDIDg=="
|
||||
"resolved" "https://registry.npmjs.org/@octokit/core/-/core-4.2.0.tgz"
|
||||
"version" "4.2.0"
|
||||
dependencies:
|
||||
"@octokit/auth-token" "^3.0.0"
|
||||
"@octokit/graphql" "^5.0.0"
|
||||
"@octokit/request" "^6.0.0"
|
||||
"@octokit/request-error" "^3.0.0"
|
||||
"@octokit/types" "^9.0.0"
|
||||
"before-after-hook" "^2.2.0"
|
||||
"universal-user-agent" "^6.0.0"
|
||||
|
||||
"@octokit/endpoint@^7.0.0":
|
||||
"integrity" "sha512-LG4o4HMY1Xoaec87IqQ41TQ+glvIeTKqfjkCEmt5AIwDZJwQeVZFIEYXrYY6yLwK+pAScb9Gj4q+Nz2qSw1roA=="
|
||||
"resolved" "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-7.0.5.tgz"
|
||||
"version" "7.0.5"
|
||||
dependencies:
|
||||
"@octokit/types" "^9.0.0"
|
||||
"is-plain-object" "^5.0.0"
|
||||
"universal-user-agent" "^6.0.0"
|
||||
|
||||
"@octokit/graphql@^5.0.0":
|
||||
"integrity" "sha512-Qwfvh3xdqKtIznjX9lz2D458r7dJPP8l6r4GQkIdWQouZwHQK0mVT88uwiU2bdTU2OtT1uOlKpRciUWldpG0yQ=="
|
||||
"resolved" "https://registry.npmjs.org/@octokit/graphql/-/graphql-5.0.5.tgz"
|
||||
"version" "5.0.5"
|
||||
dependencies:
|
||||
"@octokit/request" "^6.0.0"
|
||||
"@octokit/types" "^9.0.0"
|
||||
"universal-user-agent" "^6.0.0"
|
||||
|
||||
"@octokit/openapi-types@^16.0.0":
|
||||
"integrity" "sha512-JbFWOqTJVLHZSUUoF4FzAZKYtqdxWu9Z5m2QQnOyEa04fOFljvyh7D3GYKbfuaSWisqehImiVIMG4eyJeP5VEA=="
|
||||
"resolved" "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-16.0.0.tgz"
|
||||
"version" "16.0.0"
|
||||
|
||||
"@octokit/plugin-paginate-rest@^6.0.0":
|
||||
"integrity" "sha512-Sq5VU1PfT6/JyuXPyt04KZNVsFOSBaYOAq2QRZUwzVlI10KFvcbUo8lR258AAQL1Et60b0WuVik+zOWKLuDZxw=="
|
||||
"resolved" "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-6.0.0.tgz"
|
||||
"version" "6.0.0"
|
||||
dependencies:
|
||||
"@octokit/types" "^9.0.0"
|
||||
|
||||
"@octokit/request-error@^3.0.0":
|
||||
"integrity" "sha512-crqw3V5Iy2uOU5Np+8M/YexTlT8zxCfI+qu+LxUB7SZpje4Qmx3mub5DfEKSO8Ylyk0aogi6TYdf6kxzh2BguQ=="
|
||||
"resolved" "https://registry.npmjs.org/@octokit/request-error/-/request-error-3.0.3.tgz"
|
||||
"version" "3.0.3"
|
||||
dependencies:
|
||||
"@octokit/types" "^9.0.0"
|
||||
"deprecation" "^2.0.0"
|
||||
"once" "^1.4.0"
|
||||
|
||||
"@octokit/request@^6.0.0":
|
||||
"integrity" "sha512-TNAodj5yNzrrZ/VxP+H5HiYaZep0H3GU0O7PaF+fhDrt8FPrnkei9Aal/txsN/1P7V3CPiThG0tIvpPDYUsyAA=="
|
||||
"resolved" "https://registry.npmjs.org/@octokit/request/-/request-6.2.3.tgz"
|
||||
"version" "6.2.3"
|
||||
dependencies:
|
||||
"@octokit/endpoint" "^7.0.0"
|
||||
"@octokit/request-error" "^3.0.0"
|
||||
"@octokit/types" "^9.0.0"
|
||||
"is-plain-object" "^5.0.0"
|
||||
"node-fetch" "^2.6.7"
|
||||
"universal-user-agent" "^6.0.0"
|
||||
|
||||
"@octokit/types@^9.0.0":
|
||||
"integrity" "sha512-LUewfj94xCMH2rbD5YJ+6AQ4AVjFYTgpp6rboWM5T7N3IsIF65SBEOVcYMGAEzO/kKNiNaW4LoWtoThOhH06gw=="
|
||||
"resolved" "https://registry.npmjs.org/@octokit/types/-/types-9.0.0.tgz"
|
||||
"version" "9.0.0"
|
||||
dependencies:
|
||||
"@octokit/openapi-types" "^16.0.0"
|
||||
|
||||
"@sideway/address@^4.1.3":
|
||||
"integrity" "sha512-8ncEUtmnTsMmL7z1YPB47kPUq7LpKWJNFPsRzHiIajGC5uXlWGn+AmkYPcHNl8S4tcEGx+cnORnNYaw2wvL+LQ=="
|
||||
"resolved" "https://registry.npmjs.org/@sideway/address/-/address-4.1.3.tgz"
|
||||
|
@ -147,6 +225,11 @@
|
|||
"resolved" "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz"
|
||||
"version" "1.5.1"
|
||||
|
||||
"before-after-hook@^2.2.0":
|
||||
"integrity" "sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ=="
|
||||
"resolved" "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.3.tgz"
|
||||
"version" "2.2.3"
|
||||
|
||||
"bl@^4.0.3":
|
||||
"integrity" "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w=="
|
||||
"resolved" "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz"
|
||||
|
@ -473,6 +556,11 @@
|
|||
"resolved" "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz"
|
||||
"version" "1.0.0"
|
||||
|
||||
"deprecation@^2.0.0":
|
||||
"integrity" "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ=="
|
||||
"resolved" "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz"
|
||||
"version" "2.3.1"
|
||||
|
||||
"detect-libc@^2.0.0", "detect-libc@^2.0.1":
|
||||
"integrity" "sha512-463v3ZeIrcWtdgIg6vI6XUncguvr2TnGl4SzDXinkt9mSLpBJKXT3mW6xT3VQdDN11+WVs29pgvivTc4Lp8v+w=="
|
||||
"resolved" "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.1.tgz"
|
||||
|
@ -871,6 +959,11 @@
|
|||
"resolved" "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz"
|
||||
"version" "1.1.0"
|
||||
|
||||
"is-plain-object@^5.0.0":
|
||||
"integrity" "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q=="
|
||||
"resolved" "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz"
|
||||
"version" "5.0.0"
|
||||
|
||||
"is-utf8@^0.2.0":
|
||||
"integrity" "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI="
|
||||
"resolved" "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz"
|
||||
|
@ -1355,7 +1448,7 @@
|
|||
"resolved" "https://registry.npmjs.org/node-cleanup/-/node-cleanup-2.1.2.tgz"
|
||||
"version" "2.1.2"
|
||||
|
||||
"node-fetch@^2.6.1", "node-fetch@2.6.7":
|
||||
"node-fetch@^2.6.1", "node-fetch@^2.6.7", "node-fetch@2.6.7":
|
||||
"integrity" "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ=="
|
||||
"resolved" "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz"
|
||||
"version" "2.6.7"
|
||||
|
@ -1978,6 +2071,11 @@
|
|||
"resolved" "https://registry.npmjs.org/unfetch/-/unfetch-4.2.0.tgz"
|
||||
"version" "4.2.0"
|
||||
|
||||
"universal-user-agent@^6.0.0":
|
||||
"integrity" "sha512-isyNax3wXoKaulPDZWHQqbmIx1k2tb9fb3GGDBRxCscfYV2Ch7WxPArBsFEG8s/safwXTT7H4QGhaIkTp9447w=="
|
||||
"resolved" "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.0.tgz"
|
||||
"version" "6.0.0"
|
||||
|
||||
"util-deprecate@^1.0.1", "util-deprecate@~1.0.1":
|
||||
"integrity" "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
|
||||
"resolved" "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz"
|
||||
|
|
Loading…
Reference in a new issue