Skip to content

Commit

Permalink
season folders + cleanup
Browse files Browse the repository at this point in the history
- Tvshows now get placed into season folders
- Removed unused regex import
- Bump version
- more comments
  • Loading branch information
jenslys committed Sep 2, 2022
1 parent 704a097 commit b8dd449
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions nrkdl/nrkdl.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import yt_dlp
from yt_dlp.postprocessor import MetadataParserPP
import argparse
import re

parser = argparse.ArgumentParser()
parser.add_argument(
Expand Down Expand Up @@ -49,6 +48,7 @@ def progress_hooks(d):
file_tuple = os.path.split(os.path.abspath(d["filename"]))
print("Done downloading {}".format(file_tuple[1]))

# TODO: #1 Replace progress prints with a progress bar. (https://github.com/tqdm/tqdm)
if d["status"] == "downloading":
print("Downloading:", d["filename"])
print("Progress:", d["_percent_str"])
Expand All @@ -61,11 +61,12 @@ def main():
video_title = "%(series)s" # Title of show/movie
movie = "%(title)s.%(ext)s" # Moviename.mp4
tvshow = "%(series)s - %(season_number)sx%(episode_number)s - %(episode)s.%(ext)s" # Exit - 1x2 - Horer og hummer på Hankø
download_path = os.getcwd()
current_season = "Season %(season_number)s"
download_path = os.getcwd() # ? Gets the current working dir
folder_name = download_path + "/" + video_title

if "/serie/" in args.url: # Identify if its a tvshow or movie
filename = tvshow
if "/serie/" in args.url: # ? Identify if its a tvshow or movie
filename = current_season + "/" + tvshow
else:
filename = movie
ydl_opts = {
Expand Down Expand Up @@ -126,3 +127,7 @@ def main():
ydl.download([args.url])
except Exception as e:
raise e


if __name__ == "__main__":
main()
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="nrkdl",
version="1.0.5",
version="1.0.6",
author="jenlys",
description="Download movies/tv-shows from nrk.no",
long_description=long_description,
Expand Down

0 comments on commit b8dd449

Please sign in to comment.