Skip to content

Commit

Permalink
Merge pull request #3 from rmusser01/main
Browse files Browse the repository at this point in the history
Merging pull request as I have landed rolling summarization support and confirmed it working. Only supports OpenAI currently. Next up: Tests.
  • Loading branch information
rmusser01 committed May 16, 2024
2 parents 764e03b + c82fac1 commit 9251dea
Show file tree
Hide file tree
Showing 65 changed files with 4,784 additions and 13 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/pylint.yml
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')
Binary file added .gitignore
Binary file not shown.
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions .idea/tldw.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added Bin/ffmpeg.exe
Binary file not shown.
58 changes: 58 additions & 0 deletions Get_Playlist_URLs.py
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)
42 changes: 42 additions & 0 deletions HF/Dockerfile
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"]
Loading

0 comments on commit 9251dea

Please sign in to comment.