-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
Merging pull request as I have landed rolling summarization support and confirmed it working. Only supports OpenAI currently. Next up: Tests.
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Pylint | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.8", "3.9", "3.10"] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install pylint | ||
- name: Analysing the code with pylint | ||
run: | | ||
pylint $(git ls-files '*.py') |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import sys | ||
import yt_dlp | ||
from urllib.parse import urlparse, parse_qs | ||
|
||
def get_playlist_videos(playlist_url): | ||
ydl_opts = { | ||
'extract_flat': True, 'skip_download': True, | ||
'quiet': False | ||
} | ||
|
||
try: | ||
with yt_dlp.YoutubeDL(ydl_opts) as ydl: | ||
info = ydl.extract_info(playlist_url, download=False) | ||
|
||
if 'entries' in info: | ||
video_urls = [entry['url'] for entry in info['entries']] | ||
playlist_title = info['title'] | ||
return video_urls, playlist_title | ||
else: | ||
print("No videos found in the playlist.") | ||
return [], None | ||
except Exception as e: | ||
print(f"An error occurred: {e}") | ||
return [], None | ||
|
||
|
||
def save_to_file(video_urls, filename): | ||
with open(filename, 'w') as file: | ||
file.write('\n'.join(video_urls)) | ||
print(f"Video URLs saved to {filename}") | ||
|
||
|
||
def parse_playlist_url(url): | ||
parsed_url = urlparse(url) | ||
query_params = parse_qs(parsed_url.query) | ||
|
||
if 'list' in query_params: | ||
playlist_id = query_params['list'][0] | ||
base_url = f"{parsed_url.scheme}://{parsed_url.netloc}{parsed_url.path}" | ||
playlist_url = f"{base_url}?list={playlist_id}" | ||
return playlist_url | ||
else: | ||
return url | ||
|
||
|
||
if __name__ == '__main__': | ||
if len(sys.argv) < 2: | ||
print("Please provide the playlist URL as a command-line argument.") | ||
print("""Example:\n\t python Get_Playlist_URLs.py "https://www.youtube.com/playlist?list=PLH15HpR5qRsWalnnt-9eYELxbEcYBPB6I" """) | ||
sys.exit(1) | ||
|
||
playlist_url = sys.argv[1] | ||
parsed_playlist_url = parse_playlist_url(playlist_url) | ||
video_urls, playlist_title = get_playlist_videos(parsed_playlist_url) | ||
|
||
if video_urls: | ||
filename = f"{playlist_title}.txt" | ||
save_to_file(video_urls, filename) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
FROM nvidia/cuda:12.1.1-cudnn8-devel-ubuntu22.04 | ||
|
||
ARG DEBIAN_FRONTEND=noninteractive | ||
|
||
ENV PYTHONUNBUFFERED=1 | ||
|
||
RUN apt-get update && apt-get install --no-install-recommends -y \ | ||
build-essential \ | ||
python3.9 \ | ||
python3-pip \ | ||
git \ | ||
ffmpeg \ | ||
&& apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|
||
WORKDIR /code | ||
|
||
COPY ./requirements.txt /code/requirements.txt | ||
|
||
# Set up a new user named "user" with user ID 1000 | ||
RUN useradd -m -u 1000 user | ||
# Switch to the "user" user | ||
USER user | ||
# Set home to the user's home directory | ||
ENV HOME=/home/user \ | ||
PATH=/home/user/.local/bin:$PATH \ | ||
PYTHONPATH=$HOME/app \ | ||
PYTHONUNBUFFERED=1 \ | ||
GRADIO_ALLOW_FLAGGING=never \ | ||
GRADIO_NUM_PORTS=1 \ | ||
GRADIO_SERVER_NAME=0.0.0.0 \ | ||
GRADIO_THEME=huggingface \ | ||
SYSTEM=spaces | ||
|
||
RUN pip3 install --no-cache-dir --upgrade -r /code/requirements.txt | ||
|
||
# Set the working directory to the user's home directory | ||
WORKDIR $HOME/app | ||
|
||
# Copy the current directory contents into the container at $HOME/app setting the owner to the user | ||
COPY --chown=user . $HOME/app | ||
|
||
CMD ["python3", "app.py"] |