-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from martynvdijke/develop
Release v/0.4.0
- Loading branch information
Showing
20 changed files
with
2,321 additions
and
432 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,4 +17,4 @@ lib | |
lib64 | ||
*.pyc | ||
*.pyo | ||
youtube_playlist_randomizer/__pycache_/* | ||
youtube_playlist_randomizer/__pycache_/* |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,33 @@ | ||
[build-system] | ||
requires = ["flit_core >=2,<4"] | ||
build-backend = "flit_core.buildapi" | ||
[tool.poetry] | ||
name = "youtube-playlist-randomizer" | ||
version = "0.4.0" | ||
description = "A tool to randomize youtube playlists" | ||
authors = ["Martyn van Dijke <[email protected]>"] | ||
license = "MIT" | ||
readme = "README.md" | ||
packages = [{include = "youtube_playlist_randomizer"}] | ||
|
||
[tool.poetry.dependencies] | ||
python = "^3.11" | ||
google-api-python-client = "^2.134.0" | ||
prompt-toolkit2 = "^2.0.11" | ||
google-auth-oauthlib = "^1.2.0" | ||
prompt-toolkit = "^3.0.47" | ||
|
||
|
||
[tool.flit.metadata] | ||
module = "youtube_playlist_randomizer" | ||
author = "Martyn van Dijke" | ||
author-email = "[email protected]" | ||
home-page = "https://github.com/martynvdijke/youtube-playlist-randomizer" | ||
requires=[ | ||
"flit_core>=2.2.0", | ||
"coloredlogs", | ||
"google_auth_oauthlib", | ||
"google-api-python-client", | ||
"prompt_toolkit" | ||
] | ||
requires-python=">=3.5" | ||
classifiers = [ "License :: OSI Approved :: MIT License",] | ||
description-file = "README.md" | ||
[tool.poetry.group.dev.dependencies] | ||
pylint = "^2.17.7" | ||
black = "^23.12.1" | ||
mypy = "^1.10.1" | ||
pytest = "^7.4.4" | ||
flake8 = "^6.1.0" | ||
ruff = "^0.4.10" | ||
poetry = "^1.8.3" | ||
|
||
[build-system] | ||
requires = ["poetry-core"] | ||
build-backend = "poetry.core.masonry.api" | ||
|
||
[tool.flit.scripts] | ||
youtube_playlist_randomizer = "youtube_playlist_randomizer:main" | ||
[tool.poetry.scripts] | ||
youtube-playlist-randomizer = 'youtube_playlist_randomizer.main:main' | ||
ypr = 'youtube_playlist_randomizer.main:main' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,103 +1,6 @@ | ||
""" | ||
Simple python cli script to shuffle an input list and save the playlist | ||
""" | ||
|
||
__version__ = "0.2.0" | ||
|
||
""" | ||
Main module for | ||
""" | ||
import argparse | ||
import logging | ||
import sys | ||
import pathlib | ||
import coloredlogs | ||
from . import __version__ | ||
from . import auth | ||
from . import playlist | ||
|
||
__author__ = "Martyn van Dijke" | ||
__copyright__ = "Martyn van Dijke" | ||
__license__ = "MIT" | ||
_logger = logging.getLogger(__name__) | ||
|
||
|
||
def parse_args(args): | ||
""" | ||
Args: | ||
args: cli arguments given to script | ||
Returns: | ||
list of supported arguments | ||
""" | ||
parser = argparse.ArgumentParser(description="Playlist randomizer") | ||
parser.add_argument( | ||
"--version", | ||
action="version", | ||
version=f"randomizer version: {__version__}", | ||
) | ||
|
||
# set logging level | ||
parser.add_argument( | ||
"-v", | ||
"--verbose", | ||
dest="loglevel", | ||
help="set loglevel to INFO", | ||
action="store_const", | ||
const=logging.INFO, | ||
) | ||
parser.add_argument( | ||
"-vv", | ||
"--very-verbose", | ||
dest="loglevel", | ||
help="set loglevel to DEBUG", | ||
action="store_const", | ||
const=logging.DEBUG, | ||
) | ||
|
||
parser.add_argument( | ||
"-n", | ||
"--update_request", | ||
default=190, | ||
help="Specify the number of update request to do per 24 hours [default=%(default)r]", | ||
) | ||
|
||
parser.add_argument( | ||
"-i", | ||
"--input", | ||
default="client_secret.json", | ||
type=pathlib.Path, | ||
help="Specify the secret client json file [default=%(default)r]", | ||
required=True, | ||
) | ||
return parser.parse_args(args) | ||
|
||
|
||
def setup_logging(loglevel): | ||
"""Setup basic logging | ||
Args: | ||
loglevel (int): minimum loglevel for emitting messages | ||
""" | ||
logformat = "[%(asctime)s] %(levelname)s:%(name)s:%(message)s" | ||
logging.basicConfig( | ||
level=loglevel, | ||
stream=sys.stdout, | ||
format=logformat, | ||
datefmt="%Y-%m-%d %H:%M:%S", | ||
) | ||
# setup colred logs | ||
coloredlogs.install(level=loglevel, logger=_logger) | ||
|
||
|
||
def main(argv=None): | ||
""" | ||
Main function that does all the dispatching of the subfunctions | ||
Args: | ||
args: sys arguments | ||
Returns: | ||
none | ||
""" | ||
args = parse_args(argv) | ||
setup_logging(args.loglevel) | ||
youtube = auth.auth(args) | ||
playlist.PlayListRandomizer(youtube, args) | ||
sys.exit("Done shuffling playlist, thank for using") | ||
__version__ = "0.3.0" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
|
||
|
||
from youtube_playlist_randomizer import __version__ | ||
import argparse | ||
import logging | ||
import pathlib | ||
import sys | ||
|
||
|
||
def parse_args(): | ||
""" | ||
Returns: | ||
list of supported arguments | ||
""" | ||
parser = argparse.ArgumentParser(description="Playlist randomizer") | ||
parser.add_argument( | ||
"--version", | ||
action="version", | ||
version=f"randomizer version: {__version__}", | ||
) | ||
|
||
# set logging level | ||
parser.add_argument( | ||
"-v", | ||
"--verbose", | ||
dest="loglevel", | ||
help="set loglevel to INFO", | ||
action="store_const", | ||
const=logging.INFO, | ||
) | ||
parser.add_argument( | ||
"-vv", | ||
"--very-verbose", | ||
dest="loglevel", | ||
help="set loglevel to DEBUG", | ||
action="store_const", | ||
const=logging.DEBUG, | ||
) | ||
|
||
parser.add_argument( | ||
"-n", | ||
"--number_of", | ||
dest="chunks", | ||
default=190, | ||
help="Specify the number of update request to do per 24 hours [default=%(default)r]", | ||
) | ||
|
||
parser.add_argument( | ||
"-i", | ||
"--input", | ||
default="client_secret.json", | ||
dest="input", | ||
type=pathlib.Path, | ||
help="Specify the secret client json file [default=%(default)r]", | ||
required=False, | ||
) | ||
return parser.parse_args() | ||
|
||
|
||
def setup_logging(loglevel): | ||
"""Setup basic logging | ||
Args: | ||
loglevel (int): minimum loglevel for emitting messages | ||
""" | ||
logformat = "[%(asctime)s] %(levelname)s:%(name)s:%(message)s" | ||
logging.basicConfig( | ||
level=loglevel, | ||
stream=sys.stdout, | ||
format=logformat, | ||
datefmt="%Y-%m-%d %H:%M:%S", | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.