diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..2c53832 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,60 @@ +name: ci + +on: + schedule: + - cron: '0 10 * * *' # everyday at 10am + push: + branches: + - '**' + tags: + - 'v*.*.*' + pull_request: + branches: + - 'main' + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v2 + - + name: Docker meta + id: meta + uses: docker/metadata-action@v3 + with: + # list of Docker images to use as base name for tags + images: | + ghcr.io/urn/hstp + # generate Docker tags based on the following events/attributes + tags: | + type=schedule + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + type=sha + - + name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - + name: Login to GHCR + if: github.event_name != 'pull_request' + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ secrets.GH_USERNAME }} + password: ${{ secrets.GH_TOKEN }} + - + name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 98b2768..ef18cfd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,3 +1,4 @@ + name: Test on: [push] jobs: @@ -7,6 +8,8 @@ jobs: - uses: actions/checkout@master - uses: actions/setup-python@v2 with: - python-version: '3.9' - - name: Test - uses: onichandame/python-test-action@master \ No newline at end of file + python-version: '3.8' + - name: install hstp + run: pip install . + - name: test + run: python -m unittest \ No newline at end of file diff --git a/.gitignore b/.gitignore index e7f66a9..08688a8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ venv __pycache__ -__ignore__ \ No newline at end of file +__ignore__ +build +dist +*.egg-info \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b58157b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM python:3.8-alpine + +RUN apk add inotify-tools bash + +COPY /docker/cron_script.sh /docker/inotify_script.sh /bin/ +COPY /docker/build.crontab /etc/crontabs/root + +COPY . /build + +RUN pip install /build + +CMD ["/bin/inotify_script.sh"] \ No newline at end of file diff --git a/Readme.md b/Readme.md index 1c62efb..d5ac723 100644 --- a/Readme.md +++ b/Readme.md @@ -10,4 +10,7 @@ This repository contains both the specification for the HSTP format and a refere + **Any** Changes to the specification file (excluding spelling or wording), should require an increase in the version number + Releases of the reference implementation, these should be tagged in the github + The Major release should correspond with the standard - + The Minor release should be the patch number \ No newline at end of file + + The Minor release should be the patch number + +## 3rd party content ++ `tests/data/audio.mp3` is "Danse Macabre" by Kevin MacLeod (incompetech.com). Licensed under Creative Commons: Attribution 4.0 License http://creativecommons.org/licenses/by/4.0/ \ No newline at end of file diff --git a/audioboom/downloader/__main__.py b/audioboom/downloader/__main__.py deleted file mode 100644 index fd07bc6..0000000 --- a/audioboom/downloader/__main__.py +++ /dev/null @@ -1,22 +0,0 @@ -import argparse - -import audioboom - -parser = argparse.ArgumentParser( - prog='python -m audioboom-downloader', - description='Download Audioboom podcasts' -) - -parser.add_argument("id", help="The ID of the audioboom channel") -parser.add_argument("-v", "--verbose", help="increase output verbosity", - action="store_true") -parser.add_argument("-o", "--output", help="output directory", default=".") - -args = parser.parse_args() - -c = audioboom.Channel(args.id) - -c.get_episodes() -c.get_playlists() - -c.save(args.output) diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..8d613f7 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,8 @@ +version: '3.0' +services: + build-files: + build: . + volumes: + - ./input:/input + - ./out:/output + - ./log:/log \ No newline at end of file diff --git a/docker/build.crontab b/docker/build.crontab new file mode 100644 index 0000000..34cdc22 --- /dev/null +++ b/docker/build.crontab @@ -0,0 +1 @@ +*/10 * * * * /bin/cron_script.sh diff --git a/docker/cron_script.sh b/docker/cron_script.sh new file mode 100755 index 0000000..4b7e945 --- /dev/null +++ b/docker/cron_script.sh @@ -0,0 +1,13 @@ +#! /bin/bash + +if [ -e /changed ]; then + timeSinceMod=$(($(date +%s) - $(date +%s -r /changed))) + if [ $timeSinceMod -gt 600 ]; then + if [ ! -e /active ]; then + touch /active + date >> /log + python -m hstp -i /input -o /output &>> /log + rm /changed /active + fi + fi +fi diff --git a/docker/inotify_script.sh b/docker/inotify_script.sh new file mode 100755 index 0000000..90c3215 --- /dev/null +++ b/docker/inotify_script.sh @@ -0,0 +1,8 @@ +#! /bin/sh + +crond + +inotifywait -m /input -r | + while read directory action file; do + touch /changed + done diff --git a/hstp/__main__.py b/hstp/__main__.py deleted file mode 100644 index 82130b2..0000000 --- a/hstp/__main__.py +++ /dev/null @@ -1,35 +0,0 @@ -import argparse -import os - -import hstp - - -parser = argparse.ArgumentParser( - prog='python -m hstp', - description='Build an ' -) - -parser.add_argument("-v", "--verbose", help="increase output verbosity", - action="store_true") -parser.add_argument("-i", "--input", help="input directory") -parser.add_argument( - "-o", - "--output", - help="output directory", - default="../out") - -args = parser.parse_args() - -i = hstp.Info() - -if not args.input or (not os.path.isdir(args.input)): - i.error("Input directory does not exist") - exit(1) - -if not args.output or (not os.path.isdir(args.input)): - i.error("Input directory does not exist") - exit(1) - -r = hstp.Reader(i, args.input) -r.load_podcasts() -r.save(args.output) diff --git a/poetry.lock b/poetry.lock new file mode 100644 index 0000000..e5d591b --- /dev/null +++ b/poetry.lock @@ -0,0 +1,156 @@ +[[package]] +name = "lxml" +version = "4.6.4" +description = "Powerful and Pythonic XML processing library combining libxml2/libxslt with the ElementTree API." +category = "main" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, != 3.4.*" + +[package.extras] +cssselect = ["cssselect (>=0.7)"] +html5 = ["html5lib"] +htmlsoup = ["beautifulsoup4"] +source = ["Cython (>=0.29.7)"] + +[[package]] +name = "mutagen" +version = "1.45.1" +description = "read and write audio tags for many formats" +category = "main" +optional = false +python-versions = ">=3.5, <4" + +[[package]] +name = "pep8" +version = "1.7.1" +description = "Python style guide checker" +category = "main" +optional = false +python-versions = "*" + +[[package]] +name = "pycodestyle" +version = "2.7.0" +description = "Python style guide checker" +category = "main" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" + +[[package]] +name = "python-dateutil" +version = "2.8.2" +description = "Extensions to the standard Python datetime module" +category = "main" +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7" + +[package.dependencies] +six = ">=1.5" + +[[package]] +name = "simple-colors" +version = "0.1.5" +description = "Colorful output in terminal" +category = "main" +optional = false +python-versions = "*" + +[[package]] +name = "six" +version = "1.16.0" +description = "Python 2 and 3 compatibility utilities" +category = "main" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" + +[metadata] +lock-version = "1.1" +python-versions = "^3.8" +content-hash = "e3f661738805d0a008afbfa8dc3b7b497e2a725e6a0d16080d6356f9cc9a3c81" + +[metadata.files] +lxml = [ + {file = "lxml-4.6.4-cp27-cp27m-macosx_10_14_x86_64.whl", hash = "sha256:bbf2dc330bd44bfc0254ab37677ec60f7c7ecea55ad8ba1b8b2ea7bf20c265f5"}, + {file = "lxml-4.6.4-cp27-cp27m-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:b667c51682fe9b9788c69465956baa8b6999531876ccedcafc895c74ad716cd8"}, + {file = "lxml-4.6.4-cp27-cp27m-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:72e730d33fe2e302fd07285f14624fca5e5e2fb2bb4fb2c3941e318c41c443d1"}, + {file = "lxml-4.6.4-cp27-cp27m-win32.whl", hash = "sha256:433df8c7dde0f9e41cbf4f36b0829d50a378116ef5e962ba3881f2f5f025c7be"}, + {file = "lxml-4.6.4-cp27-cp27m-win_amd64.whl", hash = "sha256:35752ee40f7bbf6adc9ff4e1f4b84794a3593736dcce80db32e3c2aa85e294ac"}, + {file = "lxml-4.6.4-cp27-cp27mu-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:5ff5bb2a198ea67403bb6818705e9a4f90e0313f2215428ec51001ce56d939fb"}, + {file = "lxml-4.6.4-cp27-cp27mu-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:9b87727561c1150c0cc91c5d9d389448b37a7d15f0ba939ed3d1acb2f11bf6c5"}, + {file = "lxml-4.6.4-cp310-cp310-macosx_10_14_x86_64.whl", hash = "sha256:45fdb2899c755138722797161547a40b3e2a06feda620cc41195ee7e97806d81"}, + {file = "lxml-4.6.4-cp310-cp310-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_24_i686.whl", hash = "sha256:38b9de0de3aa689fe9fb9877ae1be1e83b8cf9621f7e62049d0436b9ecf4ad64"}, + {file = "lxml-4.6.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl", hash = "sha256:662523cd2a0246740225c7e32531f2e766544122e58bee70e700a024cfc0cf81"}, + {file = "lxml-4.6.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl", hash = "sha256:4aa349c5567651f34d4eaae7de6ed5b523f6d70a288f9c6fbac22d13a0784e04"}, + {file = "lxml-4.6.4-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:08eb9200d88b376a8ed5e50f1dc1d1a45b49305169674002a3b5929943390591"}, + {file = "lxml-4.6.4-cp310-cp310-win32.whl", hash = "sha256:bdc224f216ead849e902151112efef6e96c41ee1322e15d4e5f7c8a826929aee"}, + {file = "lxml-4.6.4-cp310-cp310-win_amd64.whl", hash = "sha256:ab6db93a2b6b66cbf62b4e4a7135f476e708e8c5c990d186584142c77d7f975a"}, + {file = "lxml-4.6.4-cp35-cp35m-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:50790313df028aa05cf22be9a8da033b86c42fa32523e4fd944827b482b17bf0"}, + {file = "lxml-4.6.4-cp35-cp35m-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:6764998345552b1dfc9326a932d2bad6367c6b37a176bb73ada6b9486bf602f7"}, + {file = "lxml-4.6.4-cp35-cp35m-win32.whl", hash = "sha256:543b239b191bb3b6d9bef5f09f1fb2be5b7eb09ab4d386aa655e4d53fbe9ff47"}, + {file = "lxml-4.6.4-cp35-cp35m-win_amd64.whl", hash = "sha256:a75c1ad05eedb1a3ff2a34a52a4f0836cfaa892e12796ba39a7732c82701eff4"}, + {file = "lxml-4.6.4-cp36-cp36m-macosx_10_14_x86_64.whl", hash = "sha256:47e955112ce64241fdb357acf0216081f9f3255b3ac9c502ca4b3323ec1ca558"}, + {file = "lxml-4.6.4-cp36-cp36m-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_24_i686.whl", hash = "sha256:20d7c8d90d449c6a353b15ee0459abae8395dbe59ad01e406ccbf30cd81c6f98"}, + {file = "lxml-4.6.4-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl", hash = "sha256:240db6f3228d26e3c6f4fad914b9ddaaf8707254e8b3efd564dc680c8ec3c264"}, + {file = "lxml-4.6.4-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:351482da8dd028834028537f08724b1de22d40dcf3bb723b469446564f409074"}, + {file = "lxml-4.6.4-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:e678a643177c0e5ec947b645fa7bc84260dfb9b6bf8fb1fdd83008dfc2ca5928"}, + {file = "lxml-4.6.4-cp36-cp36m-musllinux_1_1_x86_64.whl", hash = "sha256:15d0381feb56f08f78c5cc4fc385ddfe0bde1456e37f54a9322833371aec4060"}, + {file = "lxml-4.6.4-cp36-cp36m-win32.whl", hash = "sha256:4ba74afe5ee5cb5e28d83b513a6e8f0875fda1dc1a9aea42cc0065f029160d2a"}, + {file = "lxml-4.6.4-cp36-cp36m-win_amd64.whl", hash = "sha256:9c91a73971a922c13070fd8fa5a114c858251791ba2122a941e6aa781c713e44"}, + {file = "lxml-4.6.4-cp37-cp37m-macosx_10_14_x86_64.whl", hash = "sha256:6020c70ff695106bf80651953a23e37718ef1fee9abd060dcad8e32ab2dc13f3"}, + {file = "lxml-4.6.4-cp37-cp37m-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_24_i686.whl", hash = "sha256:f5dd358536b8a964bf6bd48de038754c1609e72e5f17f5d21efe2dda17594dbf"}, + {file = "lxml-4.6.4-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl", hash = "sha256:7ae7089d81fc502df4b217ad77f03c54039fe90dac0acbe70448d7e53bfbc57e"}, + {file = "lxml-4.6.4-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl", hash = "sha256:80d10d53d3184837445ff8562021bdd37f57c4cadacbf9d8726cc16220a00d54"}, + {file = "lxml-4.6.4-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:e95da348d57eb448d226a44b868ff2ca5786fbcbe417ac99ff62d0a7d724b9c7"}, + {file = "lxml-4.6.4-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:ffd65cfa33fed01735c82aca640fde4cc63f0414775cba11e06f84fae2085a6e"}, + {file = "lxml-4.6.4-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:877666418598f6cb289546c77ff87590cfd212f903b522b0afa0b9fb73b3ccfb"}, + {file = "lxml-4.6.4-cp37-cp37m-win32.whl", hash = "sha256:e91d24623e747eeb2d8121f4a94c6a7ad27dc48e747e2dc95bfe88632bd028a2"}, + {file = "lxml-4.6.4-cp37-cp37m-win_amd64.whl", hash = "sha256:4ec9a80dd5704ecfde54319b6964368daf02848c8954d3bacb9b64d1c7659159"}, + {file = "lxml-4.6.4-cp38-cp38-macosx_10_14_x86_64.whl", hash = "sha256:2901625f4a878a055d275beedc20ba9cb359cefc4386a967222fee29eb236038"}, + {file = "lxml-4.6.4-cp38-cp38-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_24_i686.whl", hash = "sha256:b567178a74a2261345890eac66fbf394692a6e002709d329f28a673ca6042473"}, + {file = "lxml-4.6.4-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl", hash = "sha256:4717123f7c11c81e0da69989e5a64079c3f402b0efeb4c6241db6c369d657bd8"}, + {file = "lxml-4.6.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl", hash = "sha256:cf201bf5594d1aab139fe53e3fca457e4f8204a5bbd65d48ab3b82a16f517868"}, + {file = "lxml-4.6.4-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:a77a3470ba37e11872c75ca95baf9b3312133a3d5a5dc720803b23098c653976"}, + {file = "lxml-4.6.4-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:619c6d2b552bba00491e96c0518aad94002651c108a0f7364ff2d7798812c00e"}, + {file = "lxml-4.6.4-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:601f0ab75538b280aaf1e720eb9d68d4fa104ac274e1e9e6971df488f4dcdb0f"}, + {file = "lxml-4.6.4-cp38-cp38-win32.whl", hash = "sha256:75d3c5bbc0ddbad03bb68b9be638599f67e4b98ed3dcd0fec9f6f39e41ee96cb"}, + {file = "lxml-4.6.4-cp38-cp38-win_amd64.whl", hash = "sha256:4341d135f5660db10184963d9c3418c3e28d7f868aaf8b11a323ebf85813f7f4"}, + {file = "lxml-4.6.4-cp39-cp39-macosx_10_14_x86_64.whl", hash = "sha256:9db24803fa71e3305fe4a7812782b708da21a0b774b130dd1860cf40a6d7a3ee"}, + {file = "lxml-4.6.4-cp39-cp39-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_24_i686.whl", hash = "sha256:afd60230ad9d8bcba005945ec3a343722f09e0b7f8ae804246e5d2cfc6bd71a6"}, + {file = "lxml-4.6.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl", hash = "sha256:0c15e1cd55055956e77b0732270f1c6005850696bc3ef3e03d01e78af84eaa42"}, + {file = "lxml-4.6.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl", hash = "sha256:6d422b3c729737d8a39279a25fa156c983a56458f8b2f97661ee6fb22b80b1d6"}, + {file = "lxml-4.6.4-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:2eb90f6ec3c236ef2f1bb38aee7c0d23e77d423d395af6326e7cca637519a4cb"}, + {file = "lxml-4.6.4-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:51a0e5d243687596f46e24e464121d4b232ad772e2d1785b2a2c0eb413c285d4"}, + {file = "lxml-4.6.4-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:d43bd68714049c84e297c005456a15ecdec818f7b5aa5868c8b0a865cfb78a44"}, + {file = "lxml-4.6.4-cp39-cp39-win32.whl", hash = "sha256:ee9e4b07b0eba4b6a521509e9e1877476729c1243246b6959de697ebea739643"}, + {file = "lxml-4.6.4-cp39-cp39-win_amd64.whl", hash = "sha256:48eaac2991b3036175b42ee8d3c23f4cca13f2be8426bf29401a690ab58c88f4"}, + {file = "lxml-4.6.4-pp37-pypy37_pp73-macosx_10_14_x86_64.whl", hash = "sha256:2b06a91cf7b8acea7793006e4ae50646cef0fe35ce5acd4f5cb1c77eb228e4a1"}, + {file = "lxml-4.6.4-pp37-pypy37_pp73-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_24_i686.whl", hash = "sha256:523f195948a1ba4f9f5b7294d83c6cd876547dc741820750a7e5e893a24bbe38"}, + {file = "lxml-4.6.4-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl", hash = "sha256:b0ca0ada9d3bc18bd6f611bd001a28abdd49ab9698bd6d717f7f5394c8e94628"}, + {file = "lxml-4.6.4-pp38-pypy38_pp73-macosx_10_14_x86_64.whl", hash = "sha256:197b7cb7a753cf553a45115739afd8458464a28913da00f5c525063f94cd3f48"}, + {file = "lxml-4.6.4-pp38-pypy38_pp73-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_24_i686.whl", hash = "sha256:6298f5b42a26581206ef63fffa97c754245d329414108707c525512a5197f2ba"}, + {file = "lxml-4.6.4-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl", hash = "sha256:0b12c95542f04d10cba46b3ff28ea52ea56995b78cf918f0b11b05e75812bb79"}, + {file = "lxml-4.6.4.tar.gz", hash = "sha256:daf9bd1fee31f1c7a5928b3e1059e09a8d683ea58fb3ffc773b6c88cb8d1399c"}, +] +mutagen = [ + {file = "mutagen-1.45.1-py3-none-any.whl", hash = "sha256:9c9f243fcec7f410f138cb12c21c84c64fde4195481a30c9bfb05b5f003adfed"}, + {file = "mutagen-1.45.1.tar.gz", hash = "sha256:6397602efb3c2d7baebd2166ed85731ae1c1d475abca22090b7141ff5034b3e1"}, +] +pep8 = [ + {file = "pep8-1.7.1-py2.py3-none-any.whl", hash = "sha256:b22cfae5db09833bb9bd7c8463b53e1a9c9b39f12e304a8d0bba729c501827ee"}, + {file = "pep8-1.7.1.tar.gz", hash = "sha256:fe249b52e20498e59e0b5c5256aa52ee99fc295b26ec9eaa85776ffdb9fe6374"}, +] +pycodestyle = [ + {file = "pycodestyle-2.7.0-py2.py3-none-any.whl", hash = "sha256:514f76d918fcc0b55c6680472f0a37970994e07bbb80725808c17089be302068"}, + {file = "pycodestyle-2.7.0.tar.gz", hash = "sha256:c389c1d06bf7904078ca03399a4816f974a1d590090fecea0c63ec26ebaf1cef"}, +] +python-dateutil = [ + {file = "python-dateutil-2.8.2.tar.gz", hash = "sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86"}, + {file = "python_dateutil-2.8.2-py2.py3-none-any.whl", hash = "sha256:961d03dc3453ebbc59dbdea9e4e11c5651520a876d0f4db161e8674aae935da9"}, +] +simple-colors = [ + {file = "simple_colors-0.1.5-py3-none-any.whl", hash = "sha256:e4ce007a2b9f10141282fa0af21b61e071a1b0794f52367a1fe9b31338e65a35"}, +] +six = [ + {file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"}, + {file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"}, +] diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..ac2e2e1 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,25 @@ +[tool.poetry] +name = "hstp" +version = "2.0.0" +description = "hstp build" +authors = ["University Radio Nottingham "] +license = "MIT" + +[tool.poetry.dependencies] +python = "^3.8" +lxml = "4.6.4" +mutagen = "1.45.1" +pep8 = "1.7.1" +pycodestyle = "2.7.0" +python-dateutil = "2.8.2" +simple-colors = "0.1.5" + +[tool.poetry.dev-dependencies] + +[build-system] +requires = ["poetry-core>=1.0.0"] +build-backend = "poetry.core.masonry.api" + +[tool.poetry.plugins."console_scripts"] +"hstp" = "hstp.__main__:main" +"audioboom-download" = "audioboom.downloader.__main__:main" \ No newline at end of file diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index aceb28f..0000000 --- a/requirements.txt +++ /dev/null @@ -1,6 +0,0 @@ -lxml==4.6.4 -mutagen==1.45.1 -pep8==1.7.1 -pycodestyle==2.7.0 -python-dateutil==2.8.2 -simple-colors==0.1.5 diff --git a/audioboom/__init__.py b/src/audioboom/__init__.py similarity index 100% rename from audioboom/__init__.py rename to src/audioboom/__init__.py diff --git a/audioboom/channel.py b/src/audioboom/channel.py similarity index 100% rename from audioboom/channel.py rename to src/audioboom/channel.py diff --git a/src/audioboom/downloader/__main__.py b/src/audioboom/downloader/__main__.py new file mode 100644 index 0000000..29d6c4a --- /dev/null +++ b/src/audioboom/downloader/__main__.py @@ -0,0 +1,28 @@ +import argparse + +import audioboom + + +def main(): + parser = argparse.ArgumentParser( + prog='python -m audioboom-downloader', + description='Download Audioboom podcasts' + ) + + parser.add_argument("id", help="The ID of the audioboom channel") + parser.add_argument("-v", "--verbose", help="increase output verbosity", + action="store_true") + parser.add_argument("-o", "--output", help="output directory", default=".") + + args = parser.parse_args() + + c = audioboom.Channel(args.id) + + c.get_episodes() + c.get_playlists() + + c.save(args.output) + + +if __name__ == "__main__": + main() diff --git a/audioboom/structures.py b/src/audioboom/structures.py similarity index 100% rename from audioboom/structures.py rename to src/audioboom/structures.py diff --git a/audioboom/utils.py b/src/audioboom/utils.py similarity index 100% rename from audioboom/utils.py rename to src/audioboom/utils.py diff --git a/hstp/__init__.py b/src/hstp/__init__.py similarity index 100% rename from hstp/__init__.py rename to src/hstp/__init__.py diff --git a/src/hstp/__main__.py b/src/hstp/__main__.py new file mode 100644 index 0000000..993f69f --- /dev/null +++ b/src/hstp/__main__.py @@ -0,0 +1,41 @@ +import argparse +import os + +import hstp + + +def main(): + + parser = argparse.ArgumentParser( + prog='python -m hstp', + description='Build an ' + ) + + parser.add_argument("-v", "--verbose", help="increase output verbosity", + action="store_true") + parser.add_argument("-i", "--input", help="input directory") + parser.add_argument( + "-o", + "--output", + help="output directory", + default="../out") + + args = parser.parse_args() + + i = hstp.Info() + + if not args.input or (not os.path.isdir(args.input)): + i.error("Input directory does not exist") + exit(1) + + if not args.output or (not os.path.isdir(args.input)): + i.error("Input directory does not exist") + exit(1) + + r = hstp.Reader(i, args.input) + r.load_podcasts() + r.save(args.output) + + +if __name__ == "__main__": + main() diff --git a/hstp/episode.py b/src/hstp/episode.py similarity index 100% rename from hstp/episode.py rename to src/hstp/episode.py diff --git a/hstp/info.py b/src/hstp/info.py similarity index 100% rename from hstp/info.py rename to src/hstp/info.py diff --git a/hstp/podcast.py b/src/hstp/podcast.py similarity index 100% rename from hstp/podcast.py rename to src/hstp/podcast.py diff --git a/hstp/reader.py b/src/hstp/reader.py similarity index 100% rename from hstp/reader.py rename to src/hstp/reader.py diff --git a/hstp/utils.py b/src/hstp/utils.py similarity index 84% rename from hstp/utils.py rename to src/hstp/utils.py index 00d361f..e12f432 100644 --- a/hstp/utils.py +++ b/src/hstp/utils.py @@ -22,7 +22,8 @@ def path_or_none(file): def copyfile(src, dst): if os.path.isfile(dst): + return # Add more conditions here - if os.path.getsize(src) == os.path.getsize(dst): - return + # if os.path.getsize(src) == os.path.getsize(dst): + # return shutil.copyfile(src, dst) diff --git a/tests/data/audio.mp3 b/tests/data/audio.mp3 index e69de29..4b414a9 100644 Binary files a/tests/data/audio.mp3 and b/tests/data/audio.mp3 differ