aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--README.rst1
-rw-r--r--docs/index.rst27
-rw-r--r--setup.cfg50
-rw-r--r--youtube-podcaster.json.example21
-rw-r--r--youtube_podcaster/__init__.py44
-rw-r--r--youtube_podcaster/__main__.py8
-rw-r--r--youtube_podcaster/config.py64
-rw-r--r--youtube_podcaster/podcastfeeder.py4
-rw-r--r--youtube_podcaster/podcastupdater.py34
-rw-r--r--youtube_podcaster/youtube-podcaster.json.sample10
-rw-r--r--youtube_podcaster/youtube/downloader.py23
12 files changed, 171 insertions, 116 deletions
diff --git a/.gitignore b/.gitignore
index 55cf740..6296ae8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -44,4 +44,3 @@ MANIFEST
44*.xml 44*.xml
45*.save 45*.save
46downloads/ 46downloads/
47youtube-podcaster.json
diff --git a/README.rst b/README.rst
index b485fbb..9b66292 100644
--- a/README.rst
+++ b/README.rst
@@ -1,3 +1,4 @@
1=================
1YouTube Podcaster 2YouTube Podcaster
2================= 3=================
3 4
diff --git a/docs/index.rst b/docs/index.rst
index 62a305d..73e63f8 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -1,29 +1,4 @@
1================= 1.. include:: ../README.rst
2youtube-podcaster
3=================
4
5This is the documentation of **youtube-podcaster**.
6
7.. note::
8
9 This is the main page of your project's `Sphinx <http://sphinx-doc.org/>`_
10 documentation. It is formatted in `reStructuredText
11 <http://sphinx-doc.org/rest.html>`__. Add additional pages by creating
12 rst-files in ``docs`` and adding them to the `toctree
13 <http://sphinx-doc.org/markup/toctree.html>`_ below. Use then
14 `references <http://sphinx-doc.org/markup/inline.html>`__ in order to link
15 them from this page, e.g. :ref:`authors <authors>` and :ref:`changes`.
16 It is also possible to refer to the documentation of other Python packages
17 with the `Python domain syntax
18 <http://sphinx-doc.org/domains.html#the-python-domain>`__. By default you
19 can reference the documentation of `Sphinx <http://sphinx.pocoo.org>`__,
20 `Python <http://docs.python.org/>`__, `matplotlib
21 <http://matplotlib.sourceforge.net>`__, `NumPy
22 <http://docs.scipy.org/doc/numpy>`__, `Scikit-Learn
23 <http://scikit-learn.org/stable>`__, `Pandas
24 <http://pandas.pydata.org/pandas-docs/stable>`__, `SciPy
25 <http://docs.scipy.org/doc/scipy/reference/>`__. You can add more by
26 extending the ``intersphinx_mapping`` in your Sphinx's ``conf.py``.
27 2
28Contents 3Contents
29======== 4========
diff --git a/setup.cfg b/setup.cfg
index f1b8f8c..e559f20 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -6,53 +6,35 @@ author-email = t0m.vd.l33@gmail.com
6license = MIT License 6license = MIT License
7home-page = http://github.com/tomvanderlee/youtube-podcaster 7home-page = http://github.com/tomvanderlee/youtube-podcaster
8description-file = README.rst 8description-file = README.rst
9# Add here all kinds of additional classifiers as defined under
10# https://pypi.python.org/pypi?%3Aaction=list_classifiers
11classifiers = Development Status :: 3 - Alpha, 9classifiers = Development Status :: 3 - Alpha,
12 License :: OSI Approved :: MIT License 10 License :: OSI Approved :: MIT License
13 Programming Language :: Python :: 3 :: Only 11 Programming Language :: Python :: 3 :: Only
14 12
15[entry_points] 13[entry_points]
16console_scripts = 14console_scripts =
17 youtube-podcaster = youtube_podcaster:main 15 youtube-podcaster = youtube_podcaster:main
18# Add here console scripts like:
19# console_scripts =
20# hello_world = youtube_podcaster.module:function
21# as well as other entry_points.
22
23 16
24[files] 17[files]
25# Add here 'data_files', 'packages' or 'namespace_packages'. 18packages =
26# Additional data files are defined as key value pairs of source and target: 19 youtube_podcaster
27packages = 20data_files =
28 youtube_podcaster 21 share/man/man1/ = docs/_build/man/*
29# data_files = 22 share/youtube-podcaster/ = youtube-podcaster.json.example
30# share/youtube_podcaster_docs = docs/*
31 23
32[extras] 24[extras]
33# Add here additional requirements for extra features, like:
34# PDF =
35# ReportLab>=1.2
36# RXP
37 25
38[test] 26[test]
39# py.test options when running `python setup.py test`
40addopts = tests 27addopts = tests
41 28
42[pytest] 29[pytest]
43# Options for py.test: 30addopts =
44# Specify command line options as you would do when invoking py.test directly. 31 --cov youtube_podcaster --cov-report term-missing
45# e.g. --cov-report html (or xml) for html/xml output or --junitxml junit.xml 32 --verbose
46# in order to write a coverage file that can be read by Jenkins.
47addopts =
48 --cov youtube_podcaster --cov-report term-missing
49 --verbose
50 33
51[aliases] 34[aliases]
52docs = build_sphinx 35docs = build_sphinx
53 36
54[bdist_wheel] 37[bdist_wheel]
55# Use this option if your package is pure-python
56universal = 1 38universal = 1
57 39
58[build_sphinx] 40[build_sphinx]
@@ -60,17 +42,11 @@ source_dir = docs
60build_dir = docs/_build 42build_dir = docs/_build
61 43
62[pbr] 44[pbr]
63# Let pbr run sphinx-apidoc
64autodoc_tree_index_modules = True 45autodoc_tree_index_modules = True
65# autodoc_tree_excludes = ...
66# Let pbr itself generate the apidoc
67# autodoc_index_modules = True
68# autodoc_exclude_modules = ...
69# Convert warnings to errors
70# warnerrors = True
71 46
72[devpi:upload] 47[devpi:upload]
73# Options for the devpi: PyPI serer and packaging tool
74# VCS export must be deactivated since we are using setuptools-scm
75no-vcs = 1 48no-vcs = 1
76format = bdist_wheel 49format = bdist_wheel
50
51[easy_install]
52
diff --git a/youtube-podcaster.json.example b/youtube-podcaster.json.example
new file mode 100644
index 0000000..d9b48af
--- /dev/null
+++ b/youtube-podcaster.json.example
@@ -0,0 +1,21 @@
1{
2 "server" : {
3 "interface": "0.0.0.0",
4 "port": 8888
5 },
6
7 "youtube": {
8 "api-key": ""
9 },
10
11 "podcasts": [{
12 "username": "",
13 "playlists": [""]
14 }],
15
16 "downloads": {
17 "format": "vorbis",
18 "path": "/tmp/downloads/",
19 "url": "localhost"
20 }
21}
diff --git a/youtube_podcaster/__init__.py b/youtube_podcaster/__init__.py
index 32aee7c..77ab9cc 100644
--- a/youtube_podcaster/__init__.py
+++ b/youtube_podcaster/__init__.py
@@ -1,27 +1,47 @@
1#!/usr/bin/env python3 1#!/usr/bin/env python3
2 2
3import json 3import argparse
4 4
5from http.server import ( 5from http.server import HTTPServer
6 HTTPServer,
7)
8 6
9from . import ( 7from .podcastfeeder import create_feeder
10 youtube, 8from .config import (
9 Config,
10 ConfigException
11) 11)
12 12
13from .podcastfeeder import ( 13"""
14 create_feeder 14Start the program
15) 15"""
16 16
17 17
18def main(): 18def main():
19 config = json.load(open("youtube-podcaster.json")) 19 arg_parser = argparse.ArgumentParser(prog="youtube-podcaster",
20 description="Converts youtube \
21 playlists to RSS-feeds")
22 arg_parser.add_argument("-c", "--config",
23 dest="config",
24 help="Use CONFIG as the config file")
25 arg_parser.add_argument("-i", "--interface",
26 dest="interface",
27 help="The interface the http server will listen on")
28 arg_parser.add_argument("-p", "--port",
29 dest="port",
30 help="The port the http server will listen on")
31 arg_parser.add_argument("--api-key",
32 dest="apikey",
33 help="The YouTube API v3 key")
34 args = arg_parser.parse_args()
20 35
21 try: 36 try:
22 PodcastFeeder = create_feeder(config["youtube"], config["podcasts"]) 37 config = Config.parse_config(args)
23 server = HTTPServer(("", 8888), PodcastFeeder) 38
39 PodcastFeeder = create_feeder(config)
40
41 server = HTTPServer(config.get_server_address(), PodcastFeeder)
24 server.serve_forever() 42 server.serve_forever()
43 except ConfigException as e: