Skip to content

Commit

Permalink
feat/automations
Browse files Browse the repository at this point in the history
  • Loading branch information
JarbasAl committed Sep 6, 2024
1 parent 9db9d3e commit eb3d0ec
Show file tree
Hide file tree
Showing 12 changed files with 495 additions and 5 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/conventional-label.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# auto add labels to PRs
on:
pull_request_target:
types: [ opened, edited ]
name: conventional-release-labels
jobs:
label:
runs-on: ubuntu-latest
steps:
- uses: bcoe/conventional-release-labels@v1
74 changes: 74 additions & 0 deletions .github/workflows/publish_alpha.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# This workflow will generate a distribution and upload it to PyPI

name: Publish Alpha Build
on:
push:
branches:
- dev
paths-ignore:
- 'version.py'
- 'test/**'
- 'examples/**'
- '.github/**'
- '.gitignore'
- 'LICENSE'
- 'CHANGELOG.md'
- 'MANIFEST.in'
- 'README.md'
- 'scripts/**'
workflow_dispatch:

jobs:
build_and_publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: dev
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.
- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Install Build Tools
run: |
python -m pip install build wheel
- name: Increment Version
run: |
VER=$(python setup.py --version)
python scripts/update_version.py
- name: "Generate release changelog"
uses: heinrichreimer/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
maxIssues: 50
id: changelog
- name: Commit to dev
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Increment Version
branch: dev
- name: version
run: echo "::set-output name=version::$(python setup.py --version)"
id: version
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: V${{ steps.version.outputs.version }}
release_name: Release ${{ steps.version.outputs.version }}
body: |
Changes in this Release
${{ steps.changelog.outputs.changelog }}
draft: false
prerelease: true
commitish: dev
- name: Build Distribution Packages
run: |
python setup.py sdist bdist_wheel
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{secrets.PYPI_TOKEN}}
73 changes: 73 additions & 0 deletions .github/workflows/publish_stable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# This workflow will generate a distribution and upload it to PyPI

name: Publish Stable Release
on:
push:
branches:
- master
paths-ignore:
- 'version.py'
- 'test/**'
- 'examples/**'
- '.github/**'
- '.gitignore'
- 'LICENSE'
- 'CHANGELOG.md'
- 'MANIFEST.in'
- 'README.md'
- 'scripts/**'
workflow_dispatch:

jobs:
build_and_publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: dev
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.
- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Install Build Tools
run: |
python -m pip install build wheel
- name: Remove Alpha tag
run: |
python scripts/remove_alpha.py
- name: "Generate release changelog"
uses: heinrichreimer/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
maxIssues: 50
id: changelog
- name: Commit to dev
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Increment Version
branch: dev
- name: version
run: echo "::set-output name=version::$(python setup.py --version)"
id: version
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: V${{ steps.version.outputs.version }}
release_name: Release ${{ steps.version.outputs.version }}
body: |
Changes in this Release
${{ steps.changelog.outputs.changelog }}
draft: false
prerelease: true
commitish: dev
- name: Build Distribution Packages
run: |
python setup.py sdist bdist_wheel
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{secrets.PYPI_TOKEN}}
2 changes: 1 addition & 1 deletion .github/workflows/pypi_upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
commitish: dev
- name: Build Distribution Packages
run: |
python setup.py bdist_wheel
python setup.py sdist bdist_wheel
- name: Publish to Test PyPI
uses: pypa/gh-action-pypi-publish@master
with:
Expand Down
File renamed without changes.
210 changes: 210 additions & 0 deletions examples/iptv.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
from tutubo.models import Channel

kids = [
"https://www.youtube.com/@hasbroOfficial",
"https://www.youtube.com/@BoomerangUK",
"https://www.youtube.com/@MarvelHQ",
"https://www.youtube.com/@DinoKids",
"https://www.youtube.com/@TheSmurfsEnglish",
"https://www.youtube.com/@ZipZipOfficial",
"https://www.youtube.com/@cartoonito",
"https://www.youtube.com/@HorridHenry",
"https://www.youtube.com/@teletubbies",
"https://www.youtube.com/@PowerRangersOfficial",
]

movies = [
"https://www.youtube.com/@ClassicMrBean",
"https://www.youtube.com/@ShoutStudios",
"https://www.youtube.com/@MST3K",
"https://www.youtube.com/@adultswim",
]
news = [
"https://www.youtube.com/@tpaonline3152", # Angola
"https://www.youtube.com/@euronewspt",
"https://www.youtube.com/@airevolutionx"
]
misc = [
"https://www.youtube.com/@SpacedustDOC",
"https://www.youtube.com/@DryBarComedy",
"https://www.youtube.com/@EnglishClass101",
# "https://www.youtube.com/@pixeldry",
"https://www.youtube.com/@BitcoinLIVEyt"
]
space = [
"https://www.youtube.com/@Whataboutit",
"https://www.youtube.com/@WorldCamLIVE",
"https://www.youtube.com/@WNSPACELIVE",
]

reading = [
"https://www.youtube.com/@AgroSquerril",
"https://www.youtube.com/@Frequency2156",
"https://www.youtube.com/@CreepsMcPasta"
]

music = [
"https://www.youtube.com/@NuclearBlastRecords",
"https://www.youtube.com/@centurymedia",
"https://www.youtube.com/@Herknungr",
"https://www.youtube.com/@solitudeprod",
"https://www.youtube.com/@dadabots_",
"https://www.youtube.com/@LofiGirl",
]
pets = [
"https://www.youtube.com/@TVfordogs-2106",
"https://www.youtube.com/@sweetpetmusic",
"https://www.youtube.com/@BirderKing"
]
wildlife_cams = [
"https://www.youtube.com/@nature-live",
"https://www.youtube.com/@NamibiaCam",
"https://www.youtube.com/c/Africamvideos",
"https://www.youtube.com/c/ExploreAfrica"
# @ExploreAfrica ?? goes to wrong channel, https://www.youtube.com/@exploreafrica6302
]
beach_cams = [
"https://www.youtube.com/@PlayoceanLive",
"https://www.youtube.com/@MadeiraWebLive"
]

def get_readings():
m3u_content = '#EXTM3U\n'

for url in reading:
print(666, url)
try:
c = Channel(url)
for v in c.live:
if not v.is_live:
break # always come after current lives
print(v.title, v.keywords)
m3u_content += f'\n#EXTINF:-1 group-title="TV" tvg-logo="{v.thumbnail_url}",{v.title}\n{v.watch_url}\n'
except Exception as e:
print("error - rate limited?", e)

with open("youtubeTV_Readings.m3u8", "w") as f:
f.write(m3u_content)


def get_channels():
m3u_content = '#EXTM3U\n'

for url in news + movies + misc + space:
print(666, url)
try:
c = Channel(url)
for v in c.live:
if not v.is_live:
break # always come after current lives
print(v.title, v.keywords)
m3u_content += f'\n#EXTINF:-1 group-title="TV" tvg-logo="{v.thumbnail_url}",{v.title}\n{v.watch_url}\n'
except Exception as e:
print("error - rate limited?", e)

with open("youtubeTV.m3u8", "w") as f:
f.write(m3u_content)


def get_kids():
m3u_content = '#EXTM3U\n'

for url in kids:
print(666, url)
try:
c = Channel(url)
for v in c.live:
if not v.is_live:
break # always come after current lives
print(v.title, v.keywords)
m3u_content += f'\n#EXTINF:-1 group-title="TV" tvg-logo="{v.thumbnail_url}",{v.title}\n{v.watch_url}\n'
except Exception as e:
print("error - rate limited?", e)

with open("youtubeTV_Kids.m3u8", "w") as f:
f.write(m3u_content)


def get_music():
m3u_content = '#EXTM3U\n'

for url in music:
print(666, url)
try:
c = Channel(url)
for v in c.live:
if not v.is_live:
break # always come after current lives
print(v.title, v.keywords)
m3u_content += f'\n#EXTINF:-1 group-title="TV" tvg-logo="{v.thumbnail_url}",{v.title}\n{v.watch_url}\n'
except Exception as e:
print("error - rate limited?", e)

with open("youtubeTV_Music.m3u8", "w") as f:
f.write(m3u_content)


def get_pets():
m3u_content = '#EXTM3U\n'

for url in pets:
print(666, url)
try:
c = Channel(url)
for v in c.live:
if not v.is_live:
break # always come after current lives
print(v.title, v.keywords)
m3u_content += f'\n#EXTINF:-1 group-title="TV" tvg-logo="{v.thumbnail_url}",{v.title}\n{v.watch_url}\n'
except Exception as e:
print("error - rate limited?", e)

with open("youtubeTV_Pets.m3u8", "w") as f:
f.write(m3u_content)


def get_wildlife_cams():
m3u_content = '#EXTM3U\n'

for url in wildlife_cams:
print(666, url)
try:
c = Channel(url)
for v in c.live:
if not v.is_live:
break # always come after current lives
print(v.title, v.keywords)
m3u_content += f'\n#EXTINF:-1 group-title="TV" tvg-logo="{v.thumbnail_url}",{v.title}\n{v.watch_url}\n'
except Exception as e:
print("error - rate limited?", e)

with open("youtubeTV_wildLife.m3u8", "w") as f:
f.write(m3u_content)


def get_beachcams():
m3u_content = '#EXTM3U\n'

for url in beach_cams:
print(666, url)
try:
c = Channel(url)
for v in c.live:
if not v.is_live:
break # always come after current lives
print(v.title, v.keywords)
m3u_content += f'\n#EXTINF:-1 group-title="TV" tvg-logo="{v.thumbnail_url}",{v.title}\n{v.watch_url}\n'
except Exception as e:
print("error - rate limited?", e)

with open("youtubeTV_beachCams.m3u8", "w") as f:
f.write(m3u_content)


get_readings()
get_channels()
get_kids()
get_music()
get_wildlife_cams()
get_pets()
get_beachcams()
9 changes: 9 additions & 0 deletions examples/livestreams.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from tutubo.models import Channel

url = "https://www.youtube.com/@ShoutStudios"
c = Channel(url)
for v in c.live:
if not v.is_live:
continue
print(v.title, v.watch_url, v.keywords)

Loading

0 comments on commit eb3d0ec

Please sign in to comment.