Giter Site home page Giter Site logo

horrible-downloader's Introduction

Hi there 👋🏻

Welcome to my GitHub Profile!

horrible-downloader's People

Contributors

atosser avatar codacy-badger avatar gbd199 avatar maxbachmann avatar mtshrmn avatar tiagocv64 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

horrible-downloader's Issues

Handle resolution per show

Apparently, new shows don't always have 1080p resolution. A neat feature is to allow each show to overwrite the specified resolution.

Suggestion:

[settings]
resolution = 1080
download_dir = ~/Videos

[subscriptions]
show1 = 19
show2 = 04
show3 = 07

[resolutions]
show2 = 720 ; overwrites the resolution specified in the settings section

and when subscribing to a show: $ horrible-downloader --subscribe "show2" -r 720

Error parsing non-float episodes

FETCHING: Re Zero kara Hajimeru Isekai Seikatsu - Director's Cut
Process Process-2:
Traceback (most recent call last):
File "/usr/lib/python3.6/multiprocessing/process.py", line 258, in _bootstrap
self.run()
File "/usr/lib/python3.6/multiprocessing/process.py", line 93, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python3.6/dist-packages/HorribleDownloader/cmd.py", line 121, in fetch_episodes
new = list(filter(lambda s: ep_filter(s["episode"]), episodes))
File "/usr/local/lib/python3.6/dist-packages/HorribleDownloader/cmd.py", line 121, in
new = list(filter(lambda s: ep_filter(s["episode"]), episodes))
File "/usr/local/lib/python3.6/dist-packages/HorribleDownloader/cmd.py", line 86, in generated_filter
return any([test(float(ep)) for test in tests])
File "/usr/local/lib/python3.6/dist-packages/HorribleDownloader/cmd.py", line 86, in
return any([test(float(ep)) for test in tests])
ValueError: could not convert string to float: '01B'
Couldn't find specified anime. Exiting

NoneType' object is not subscriptable

Command I Ran:
horrible-downloader -d "Kateikyoushi Hitman Reborn!" -e 8 -o ~/mnt/s/HorribleDownloader

Error I Received
Traceback (most recent call last):
File "/home/steve/.local/bin/horrible-downloader", line 11, in
sys.exit(cli())
File "/home/steve/.local/lib/python3.6/site-packages/HorribleDownloader/cmd.py", line 369, in cli
main(args)
File "/home/steve/.local/lib/python3.6/site-packages/HorribleDownloader/cmd.py", line 225, in main
title = Parser().get_episodes(args.download)[0]["title"]
File "/home/steve/.local/lib/python3.6/site-packages/HorribleDownloader/parser.py", line 88, in get_episodes
showid = self._get_show_id(show)
File "/home/steve/.local/lib/python3.6/site-packages/HorribleDownloader/parser.py", line 19, in _get_show_id
key = fuzzy_match.extractOne(show, self.shows.keys())[0]
TypeError: 'NoneType' object is not subscriptable

Add path to config flag

Not everyone wants to have their config file in ~/.config/horrible-downloader/conf.ini
Also, this will enable having multiple "sessions" - different configs for different purposes.

Proposal: Add a flag (maybe --config) that will point at a different config file.

UnicodeDecodeError: 'charmap'

C:\Users\Calvi>pip install horrible-downloader
Collecting horrible-downloader
Using cached horrible-downloader-1.0.4.tar.gz (11 kB)
ERROR: Command errored out with exit status 1:
command: 'c:\users\calvi\appdata\local\programs\python\python38-32\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Calvi\AppData\Local\Temp\pip-install-3348u_dx\horrible-downloader\setup.py'"'"'; file='"'"'C:\Users\Calvi\AppData\Local\Temp\pip-install-3348u_dx\horrible-downloader\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\Calvi\AppData\Local\Temp\pip-install-3348u_dx\horrible-downloader\pip-egg-info'
cwd: C:\Users\Calvi\AppData\Local\Temp\pip-install-3348u_dx\horrible-downloader
Complete output (7 lines):
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\Calvi\AppData\Local\Temp\pip-install-3348u_dx\horrible-downloader\setup.py", line 7, in
long_description = f.read()
File "c:\users\calvi\appdata\local\programs\python\python38-32\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 5415: character maps to
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Can't download new episode by using CLI. (TypeError)

Error:

FETCHING: Kanojo, Okarishimasu.............................. NONE
FETCHING: Shokugeki no Soma S5.............................. NONE
FETCHING: Dokyuu Hentai HxEros.............................. NONE
FETCHING: Re Zero kara Hajimeru Isekai Seikatsu
FETCHING: Boruto - Naruto Next Generations.................. NONE
FETCHING: Sword Art Online - Alicization - War of Underworld NONE
FETCHING: Lapis ReLiGHTs.................................... FOUND (1)
Traceback (most recent call last):
  File "c:\users\drake\appdata\local\programs\python\python38-32\lib\runpy.py", line 193, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\users\drake\appdata\local\programs\python\python38-32\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\Drake\AppData\Local\Programs\Python\Python38-32\Scripts\horrible-downloader.exe\__main__.py", line 7, in <module>
  File "c:\users\drake\appdata\local\programs\python\python38-32\lib\site-packages\HorribleDownloader\cmd.py", line 257, in main
    downloads_list.extend(reversed(episodes))
TypeError: 'NoneType' object is not reversible

support search method

Support the search method in the parser.
GET: https://horriblesubs.info/api.php?method=search&value=VALUE

subscribing to downloaded shows

When using the --download flag, the entry is being automatically subscribed.
This is a side effect that isn't always welcome.

Double fetching of show indication

When I check for new episodes for my subscribed shows by typing

> horrible-downloader

I get some of the shows to display twice. Here is an example for that:

Clearly this is a bug, and there should be only 3 lines.

NOTE: this is only a visual bug, which means the files themselves are not affected (they're downloaded only once).

Search confusion with shows containing another show name.

When searching boku no hero academia - ikinokore! kesshi no survival kunren

The results returned are for "boku no hero academia"

Also affects subscription.
If you subscribe using a shorter term ex. "ikinokore" the config gets updated correctly but on execution results for the main show are returned.

I'll try to beat you to a fix, but I may not have time in the next couple of days.

Error webtorrent not found

FETCHING: One-Punch Man.....................................FOUND (3)

Found 3 files to download:

One-Punch Man - 03 [1080p].mkv
One-Punch Man - 02 [1080p].mkv
One-Punch Man - 01 [1080p].mkv

would you like to proceed? [Y/n] y
/bin/sh: 1: webtorrent: not found
/bin/sh: 1: webtorrent: not found
/bin/sh: 1: webtorrent: not found
shalmon@shalmon-MS-7B38:~$ horrible-downloader -d "one punch man" -e 1,2,3, -o ~/media/shalmon/Shalmon/

Order download priority of new episodes

When running the CLI, it prompts the user to reorder the downloads. It then proceeds to display all of the subscriptions. This is overwhelming and it should display only the shows which will be downloaded.

On another note, when downloading a specific show (with the --download flag), it shouldn't ask for reordering, because there's non.

IndexError when downloading batch only shows

When trying to download a series which has no regular episodes but only batches, the IndexError is being raised.

Example, quoted from #29 (comment):

$ horrible-downloader -d "Kateikyoushi Hitman Reborn!" -e 8 -o ~/mnt/s/HorribleDownloader
Traceback (most recent call last):
  File "/usr/bin/horrible-downloader", line 8, in <module>
    sys.exit(cli())
  File "/home/suerflowz/.local/lib/python3.8/site-packages/HorribleDownloader/cmd.py", line 369, in cli
    main(args)
  File "/home/suerflowz/.local/lib/python3.8/site-packages/HorribleDownloader/cmd.py", line 225, in main
    title = Parser().get_episodes(args.download)[0]["title"]
IndexError: list index out of range

Handle KeyboardInterrupt Exception gracefully

After latest commit, the KeyboardInterrupt exception is being thrown and not handled.

Here's an example for such exception:

FETCHING: jojo's bizarre adventure - golden wind^CTraceback (most recent call last):
  File "/usr/bin/horrible-downloader", line 188, in <module>
    main(args)
  File "/usr/bin/horrible-downloader", line 107, in main
    episodes = PARSER.get_episodes(show)
  File "/home/suerflowz/.local/lib/python3.7/site-packages/HorribleDownloader/parser.py", line 88, in get_episodes
    showid = self._get_show_id(show)
  File "/home/suerflowz/.local/lib/python3.7/site-packages/HorribleDownloader/parser.py", line 19, in _get_show_id
    key = fuzzy_match.extractOne(show, self.shows.keys())[0]
  File "/home/suerflowz/.local/lib/python3.7/site-packages/HorribleDownloader/parser.py", line 74, in shows
    html = requests.get(url).text
  File "/usr/lib/python3.7/site-packages/requests/api.py", line 75, in get
    return request('get', url, params=params, **kwargs)
  File "/usr/lib/python3.7/site-packages/requests/api.py", line 60, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/lib/python3.7/site-packages/requests/sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib/python3.7/site-packages/requests/sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/usr/lib/python3.7/site-packages/urllib3/connectionpool.py", line 603, in urlopen
    chunked=chunked)
  File "/usr/lib/python3.7/site-packages/urllib3/connectionpool.py", line 344, in _make_request
    self._validate_conn(conn)
  File "/usr/lib/python3.7/site-packages/urllib3/connectionpool.py", line 843, in _validate_conn
    conn.connect()
  File "/usr/lib/python3.7/site-packages/urllib3/connection.py", line 316, in connect
    conn = self._new_conn()
  File "/usr/lib/python3.7/site-packages/urllib3/connection.py", line 160, in _new_conn
    (self._dns_host, self.port), self.timeout, **extra_kw)
  File "/usr/lib/python3.7/site-packages/urllib3/util/connection.py", line 57, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
  File "/usr/lib/python3.7/socket.py", line 748, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
KeyboardInterrupt

It should print a non-spamming message based on the state and quit gracefully.

Limit not working properly

image

If the limit is below 12, the function returns an empty list, for anything between 12-24 it returns 12 and so on.

The solution is simply changing the '>=' to '>' in:

if response.text == stop_text or query["nextid"] >= limit // 12:

I will submit a pull request but wanted to get feedback first in case I'm missing something.

Python 3.8.2, latest version of the package

change title fuzzing scorer for better results

The scorer currently used is the default WRation one, it returns dissatisfying results.
f.e for "enen s2" it returned "Ace Attorney S2" instead of the expected "Enen no Shouboutai S2".

I did some reading on https://medium.com/analytics-vidhya/matching-messy-pandas-columns-with-fuzzywuzzy-4adda6c7994f and experimented a bit, and found that the best resulting fuzzing scorer is 'token_set_ratio', which returns way better results and even works faster.

The change is simply adding scorer=fuzz.token_set_ratio(after importing fuzz from rapidfuzz of course) to:

proper_title, ratio = process.extractOne(title, self.shows.keys())

Next week's episodes are downloading

i ran horrible downloader and it downloaded episode 10 of fire force and 11 of dr.stone(which air next week
of course they didn't download in my torrent client but i'm not sure if it's going to work next week

Allow downloads queue re-arrangement

When using the horrible-downloader CLI, the user has no control over the order of the downloads. I suggest using a prompt which allows the user to change that (will default to current behavior).

Encoding error while installing on Windows

I tried installing the newest version (1.0.4) and this error came up:

C:\Users\moshe>pip install horrible-downloader==1.0.4 -v -v
Created temporary directory: C:\Users\moshe\AppData\Local\Temp\pip-ephem-wheel-cache-n4q7xfgs
Created temporary directory: C:\Users\moshe\AppData\Local\Temp\pip-req-tracker-dxyrardf
Created requirements tracker 'C:\\Users\\moshe\\AppData\\Local\\Temp\\pip-req-tracker-dxyrardf'
Created temporary directory: C:\Users\moshe\AppData\Local\Temp\pip-install-0o49y0z8
Collecting horrible-downloader==1.0.4
  1 location(s) to search for versions of horrible-downloader:
  * https://pypi.org/simple/horrible-downloader/
  Getting page https://pypi.org/simple/horrible-downloader/
  Found index url https://pypi.org/simple
  Looking up "https://pypi.org/simple/horrible-downloader/" in the cache
  Request header has "max_age" as 0, cache bypassed
  Starting new HTTPS connection (1): pypi.org:443
  https://pypi.org:443 "GET /simple/horrible-downloader/ HTTP/1.1" 304 0
  Analyzing links from page https://pypi.org/simple/horrible-downloader/
    Found link https://files.pythonhosted.org/packages/ae/e3/e4c6f0834540f41d9e88bd6d9dbf126fea537521fd39da17b98bfb47c41f/horrible-downloader-1.0.1.tar.gz#sha256=1694563c0948b3202680f8e3305d34684be26e33dd26f6aa6990fe2111271dee (from https://pypi.org/simple/horrible-downloader/), version: 1.0.1
    Found link https://files.pythonhosted.org/packages/0e/ef/01f79367779e354848ca5ee5ba2724dc90461114f4475b1f126ae990f20a/horrible-downloader-1.0.2.tar.gz#sha256=f1267ced7623ad6908d8735370f44d47bb4303a07c3dc984d6ebb715c149e6cd (from https://pypi.org/simple/horrible-downloader/), version: 1.0.2
    Found link https://files.pythonhosted.org/packages/45/73/4c9ce98190625dae67bcb5d53592bc27a8049bbbaee1c7bd1cf8d9760f92/horrible-downloader-1.0.3.tar.gz#sha256=e2128b712e83590e4fac456a534d1c1e2794aed6eb8e2417f82009bab088ab6a (from https://pypi.org/simple/horrible-downloader/), version: 1.0.3
    Found link https://files.pythonhosted.org/packages/39/f7/9eb464840d8813d8ef4cd1a0d039f7b883878937d50ab3b0cda72fcf2450/horrible-downloader-1.0.4.tar.gz#sha256=36f4589155fdb0d0cf61deef98e47138cb6fe8a7618670fdb1b7adb441b3ae21 (from https://pypi.org/simple/horrible-downloader/), version: 1.0.4
  Config variable 'Py_DEBUG' is unset, Python ABI tag may be incorrect
  Config variable 'WITH_PYMALLOC' is unset, Python ABI tag may be incorrect
  Given no hashes to check 1 links for project 'horrible-downloader': discarding no candidates
  Using version 1.0.4 (newest of versions: 1.0.4)
  Created temporary directory: C:\Users\moshe\AppData\Local\Temp\pip-unpack-s_eafx9y
  Looking up "https://files.pythonhosted.org/packages/39/f7/9eb464840d8813d8ef4cd1a0d039f7b883878937d50ab3b0cda72fcf2450/horrible-downloader-1.0.4.tar.gz" in the cache
  Current age based on date: 269
  Ignoring unknown cache-control directive: immutable
  Freshness lifetime from max-age: 365000000
  The response is "fresh", returning cached response
  365000000 > 269
  Using cached https://files.pythonhosted.org/packages/39/f7/9eb464840d8813d8ef4cd1a0d039f7b883878937d50ab3b0cda72fcf2450/horrible-downloader-1.0.4.tar.gz
  Downloading from URL https://files.pythonhosted.org/packages/39/f7/9eb464840d8813d8ef4cd1a0d039f7b883878937d50ab3b0cda72fcf2450/horrible-downloader-1.0.4.tar.gz#sha256=36f4589155fdb0d0cf61deef98e47138cb6fe8a7618670fdb1b7adb441b3ae21 (from https://pypi.org/simple/horrible-downloader/)
  Added horrible-downloader==1.0.4 from https://files.pythonhosted.org/packages/39/f7/9eb464840d8813d8ef4cd1a0d039f7b883878937d50ab3b0cda72fcf2450/horrible-downloader-1.0.4.tar.gz#sha256=36f4589155fdb0d0cf61deef98e47138cb6fe8a7618670fdb1b7adb441b3ae21 to build tracker 'C:\\Users\\moshe\\AppData\\Local\\Temp\\pip-req-tracker-dxyrardf'
    Running setup.py (path:C:\Users\moshe\AppData\Local\Temp\pip-install-0o49y0z8\horrible-downloader\setup.py) egg_info for package horrible-downloader
    Running command python setup.py egg_info
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\moshe\AppData\Local\Temp\pip-install-0o49y0z8\horrible-downloader\setup.py", line 7, in <module>
        long_description = f.read()
      File "c:\users\moshe\appdata\local\programs\python\python37-32\lib\encodings\cp1252.py", line 23, in decode
        return codecs.charmap_decode(input,self.errors,decoding_table)[0]
    UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 5415: character maps to <undefined>
Cleaning up...
  Removing source in C:\Users\moshe\AppData\Local\Temp\pip-install-0o49y0z8\horrible-downloader
Removed horrible-downloader==1.0.4 from https://files.pythonhosted.org/packages/39/f7/9eb464840d8813d8ef4cd1a0d039f7b883878937d50ab3b0cda72fcf2450/horrible-downloader-1.0.4.tar.gz#sha256=36f4589155fdb0d0cf61deef98e47138cb6fe8a7618670fdb1b7adb441b3ae21 from build tracker 'C:\\Users\\moshe\\AppData\\Local\\Temp\\pip-req-tracker-dxyrardf'
Removed build tracker 'C:\\Users\\moshe\\AppData\\Local\\Temp\\pip-req-tracker-dxyrardf'
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Exception information:
Traceback (most recent call last):
  File "c:\users\moshe\appdata\local\programs\python\python37-32\lib\site-packages\pip\_internal\cli\base_command.py", line 188, in main
    status = self.run(options, args)
  File "c:\users\moshe\appdata\local\programs\python\python37-32\lib\site-packages\pip\_internal\commands\install.py", line 345, in run
    resolver.resolve(requirement_set)
  File "c:\users\moshe\appdata\local\programs\python\python37-32\lib\site-packages\pip\_internal\legacy_resolve.py", line 196, in resolve
    self._resolve_one(requirement_set, req)
  File "c:\users\moshe\appdata\local\programs\python\python37-32\lib\site-packages\pip\_internal\legacy_resolve.py", line 359, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "c:\users\moshe\appdata\local\programs\python\python37-32\lib\site-packages\pip\_internal\legacy_resolve.py", line 307, in _get_abstract_dist_for
    self.require_hashes
  File "c:\users\moshe\appdata\local\programs\python\python37-32\lib\site-packages\pip\_internal\operations\prepare.py", line 215, in prepare_linked_requirement
    finder, self.build_isolation,
  File "c:\users\moshe\appdata\local\programs\python\python37-32\lib\site-packages\pip\_internal\distributions\source.py", line 79, in prepare_distribution_metadata
    self.req.prepare_metadata()
  File "c:\users\moshe\appdata\local\programs\python\python37-32\lib\site-packages\pip\_internal\req\req_install.py", line 551, in prepare_metadata
    self.run_egg_info()
  File "c:\users\moshe\appdata\local\programs\python\python37-32\lib\site-packages\pip\_internal\req\req_install.py", line 628, in run_egg_info
    command_desc='python setup.py egg_info')
  File "c:\users\moshe\appdata\local\programs\python\python37-32\lib\site-packages\pip\_internal\utils\misc.py", line 931, in call_subprocess
    raise InstallationError(exc_msg)
pip._internal.exceptions.InstallationError: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
WARNING: You are using pip version 19.2.2, however version 19.3.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

Everything works just fine on linux. Don't know about mac.
The solution is quite simple, but I wont have time fixing it for the following week so I'm creating this issue instead.

Choose between different download methods

Hey :)

It would be useful to add an option to choose download methods other than webtorrent.

I think this could be implemented pretty generically by replacing download() in cmd.py with a Downloader object, and then creating another class for each download method you want to implement, which the Downloader would then wrap.

I attached an example for the basic idea I have. If it's alright, I could implement it further :D

downloader.py.txt
example.py.txt

Failed building wheel

Sorry I cannot provide much more feedback - I have no idea what is happening here. I saw you were using Linux's command line, so I don't know if it doesn't work because I'm on Win10.

Processing c:\users\mario\program_files\horrible-downloader
Requirement already satisfied: beautifulsoup4>=4 in c:\users\mario\program_files\python3\lib\site-packages (from Horrible-Downloader==0.1.6) (4.7.1)
Requirement already satisfied: requests>=2 in c:\users\mario\program_files\python3\lib\site-packages (from Horrible-Downloader==0.1.6) (2.20.1)
Requirement already satisfied: lxml>=4 in c:\users\mario\program_files\python3\lib\site-packages (from Horrible-Downloader==0.1.6) (4.3.4)
Requirement already satisfied: sty>=1.0.0b9 in c:\users\mario\program_files\python3\lib\site-packages (from Horrible-Downloader==0.1.6) (1.0.0b11)
Requirement already satisfied: fuzzywuzzy>=0.16 in c:\users\mario\program_files\python3\lib\site-packages (from Horrible-Downloader==0.1.6) (0.17.0)
Requirement already satisfied: python-levenshtein>=0.12 in c:\users\mario\program_files\python3\lib\site-packages (from Horrible-Downloader==0.1.6) (0.12.0)
Requirement already satisfied: soupsieve>=1.2 in c:\users\mario\program_files\python3\lib\site-packages (from beautifulsoup4>=4->Horrible-Downloader==0.1.6) (1.9.2)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\mario\program_files\python3\lib\site-packages (from requests>=2->Horrible-Downloader==0.1.6) (2018.10.15)
Requirement already satisfied: urllib3<1.25,>=1.21.1 in c:\users\mario\program_files\python3\lib\site-packages (from requests>=2->Horrible-Downloader==0.1.6) (1.24.1)
Requirement already satisfied: idna<2.8,>=2.5 in c:\users\mario\program_files\python3\lib\site-packages (from requests>=2->Horrible-Downloader==0.1.6) (2.7)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\users\mario\program_files\python3\lib\site-packages (from requests>=2->Horrible-Downloader==0.1.6) (3.0.4)
Requirement already satisfied: setuptools in c:\users\mario\program_files\python3\lib\site-packages (from python-levenshtein>=0.12->Horrible-Downloader==0.1.6) (40.6.3)
Building wheels for collected packages: Horrible-Downloader
  Building wheel for Horrible-Downloader (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: 'c:\users\mario\program_files\python3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Mario\\AppData\\Local\\Temp\\pip-req-build-fclkerys\\setup.py'"'"'; __file__='"'"'C:\\Users\\Mario\\AppData\\Local\\Temp\\pip-req-build-fclkerys\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\Mario\AppData\Local\Temp\pip-wheel-ovkkdlbg' --python-tag cp37
       cwd: C:\Users\Mario\AppData\Local\Temp\pip-req-build-fclkerys\
  Complete output (41 lines):
  Warning: 'classifiers' should be a list, got type 'tuple'
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib
  creating build\lib\HorribleDownloader
  copying HorribleDownloader\config_manager.py -> build\lib\HorribleDownloader
  copying HorribleDownloader\parser.py -> build\lib\HorribleDownloader
  copying HorribleDownloader\__init__.py -> build\lib\HorribleDownloader
  running egg_info
  creating Horrible_Downloader.egg-info
  writing Horrible_Downloader.egg-info\PKG-INFO
  writing dependency_links to Horrible_Downloader.egg-info\dependency_links.txt
  writing requirements to Horrible_Downloader.egg-info\requires.txt
  writing top-level names to Horrible_Downloader.egg-info\top_level.txt
  writing manifest file 'Horrible_Downloader.egg-info\SOURCES.txt'
  reading manifest file 'Horrible_Downloader.egg-info\SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  writing manifest file 'Horrible_Downloader.egg-info\SOURCES.txt'
  copying HorribleDownloader\default_conf.ini -> build\lib\HorribleDownloader
  running build_scripts
  creating build\scripts-3.7
  copying bin\horrible-downloader -> build\scripts-3.7
  installing to build\bdist.win-amd64\wheel
  running install
  running install_lib
  creating build\bdist.win-amd64
  creating build\bdist.win-amd64\wheel
  creating build\bdist.win-amd64\wheel\HorribleDownloader
  copying build\lib\HorribleDownloader\config_manager.py -> build\bdist.win-amd64\wheel\.\HorribleDownloader
  copying build\lib\HorribleDownloader\default_conf.ini -> build\bdist.win-amd64\wheel\.\HorribleDownloader
  copying build\lib\HorribleDownloader\parser.py -> build\bdist.win-amd64\wheel\.\HorribleDownloader
  copying build\lib\HorribleDownloader\__init__.py -> build\bdist.win-amd64\wheel\.\HorribleDownloader
  running install_egg_info
  Copying Horrible_Downloader.egg-info to build\bdist.win-amd64\wheel\.\Horrible_Downloader-0.1.6-py3.7.egg-info
  running install_scripts
  creating build\bdist.win-amd64\wheel\Horrible_Downloader-0.1.6.data
  creating build\bdist.win-amd64\wheel\Horrible_Downloader-0.1.6.data\scripts
  copying build\scripts-3.7\horrible-downloader -> build\bdist.win-amd64\wheel\Horrible_Downloader-0.1.6.data\scripts
  error: [WinError 193] %1 is not a valid Win32 application
  ----------------------------------------
  ERROR: Failed building wheel for Horrible-Downloader
  Running setup.py clean for Horrible-Downloader
Failed to build Horrible-Downloader
Installing collected packages: Horrible-Downloader
  Found existing installation: horrible-downloader 0.1.6
    Uninstalling horrible-downloader-0.1.6:
      Successfully uninstalled horrible-downloader-0.1.6
  Running setup.py install for Horrible-Downloader ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\mario\program_files\python3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Mario\\AppData\\Local\\Temp\\pip-req-build-fclkerys\\setup.py'"'"'; __file__='"'"'C:\\Users\\Mario\\AppData\\Local\\Temp\\pip-req-build-fclkerys\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Mario\AppData\Local\Temp\pip-record-_yyxtqzv\install-record.txt' --single-version-externally-managed --compile
         cwd: C:\Users\Mario\AppData\Local\Temp\pip-req-build-fclkerys\
    Complete output (36 lines):
    Warning: 'classifiers' should be a list, got type 'tuple'
    running install
    running build
    running build_py
    creating build
    creating build\lib
    creating build\lib\HorribleDownloader
    copying HorribleDownloader\config_manager.py -> build\lib\HorribleDownloader
    copying HorribleDownloader\parser.py -> build\lib\HorribleDownloader
    copying HorribleDownloader\__init__.py -> build\lib\HorribleDownloader
    running egg_info
    writing Horrible_Downloader.egg-info\PKG-INFO
    writing dependency_links to Horrible_Downloader.egg-info\dependency_links.txt
    writing requirements to Horrible_Downloader.egg-info\requires.txt
    writing top-level names to Horrible_Downloader.egg-info\top_level.txt
    reading manifest file 'Horrible_Downloader.egg-info\SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    writing manifest file 'Horrible_Downloader.egg-info\SOURCES.txt'
    copying HorribleDownloader\default_conf.ini -> build\lib\HorribleDownloader
    running build_scripts
    creating build\scripts-3.7
    copying bin\horrible-downloader -> build\scripts-3.7
    running install_lib
    creating c:\users\mario\program_files\python3\Lib\site-packages\HorribleDownloader
    copying build\lib\HorribleDownloader\config_manager.py -> c:\users\mario\program_files\python3\Lib\site-packages\HorribleDownloader
    copying build\lib\HorribleDownloader\default_conf.ini -> c:\users\mario\program_files\python3\Lib\site-packages\HorribleDownloader
    copying build\lib\HorribleDownloader\parser.py -> c:\users\mario\program_files\python3\Lib\site-packages\HorribleDownloader
    copying build\lib\HorribleDownloader\__init__.py -> c:\users\mario\program_files\python3\Lib\site-packages\HorribleDownloader
    byte-compiling c:\users\mario\program_files\python3\Lib\site-packages\HorribleDownloader\config_manager.py to config_manager.cpython-37.pyc
    byte-compiling c:\users\mario\program_files\python3\Lib\site-packages\HorribleDownloader\parser.py to parser.cpython-37.pyc
    byte-compiling c:\users\mario\program_files\python3\Lib\site-packages\HorribleDownloader\__init__.py to __init__.cpython-37.pyc
    running install_egg_info
    Copying Horrible_Downloader.egg-info to c:\users\mario\program_files\python3\Lib\site-packages\Horrible_Downloader-0.1.6-py3.7.egg-info
    running install_scripts
    writing list of installed files to 'C:\Users\Mario\AppData\Local\Temp\pip-record-_yyxtqzv\install-record.txt'
    error: [WinError 193] %1 is not a valid Win32 application
    ----------------------------------------
  Rolling back uninstall of horrible-downloader
  Moving to c:\users\mario\program_files\python3\lib\site-packages\horrible_downloader-0.1.6-py3.7.egg-info
   from c:\users\mario\program_files\python3\lib\site-packages\~orrible_downloader-0.1.6-py3.7.egg-info
  Moving to c:\users\mario\program_files\python3\lib\site-packages\horribledownloader
   from c:\users\mario\program_files\python3\lib\site-packages\~orribledownloader
ERROR: Command errored out with exit status 1: 'c:\users\mario\program_files\python3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Mario\\AppData\\Local\\Temp\\pip-req-build-fclkerys\\setup.py'"'"'; __file__='"'"'C:\\Users\\Mario\\AppData\\Local\\Temp\\pip-req-build-fclkerys\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Mario\AppData\Local\Temp\pip-record-_yyxtqzv\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.

not work to python 3.5 syntax error

Traceback (most recent call last):
File "/usr/local/bin/horrible-downloader", line 7, in
from HorribleDownloader.cmd import cli
File "/usr/local/lib/python3.5/dist-packages/HorribleDownloader/cmd.py", line 99
subprocess.call(f"webtorrent "{episode[quality]['Magnet']}" -o "{subdir}"", shell=True)
^
as soon as I haven’t tried, it doesn’t work( python 3.5

About the planned formatting implementations

I tried to make a little something to maybe help you implement those things, although I don't really know how the script works, so I don't know if you can make any use (and I can't make a PR) out of this. Hopefully it'll be enough to at least give you an idea or a clue on how to do it yourself.

# Cases:
# 1: Commas and dashes: 1, 2, 3, 4 - 6
# 2: Greater/lower than: 7> (or) <10
# 3: 2, plus equal sign: 7>=
# 4?: Adding commas inbetween: <=10, 14>=

# Let `ep_str` be the string containing the episode numbers information
# each case variable below would correspond to the abovementioned `ep_str`

import re

case_1 = "1, 2, 3, 4 - 6, 7, 8"
case_21 = "7>"
case_22 = "<10"
case_3 = "7>="
case_4 = "<=10, 14>="

cases = [case_1, case_21, case_22, case_3, case_4]

groups_re = r"([\d\-\<\>\=\s]+)(?:\s*\,?\s*)"
# (I suggest to) remove \s in the first group if you do not want to accept "4 - 6" or "< 7" as valid syntax
# groups_re = r"([\d\-\<\>\=]+)(?:\s*\,?\s*)" # It would be like this

for case in cases:

    exp_groups = re.findall(groups_re, case)

    ep_nums = []

    for group in exp_groups:

        if group.isdigit():
            ep_num = int(group)
            ep_nums += [ep_num]

        else:

            if '-' in group:
                ep_num_1 = int(re.search(r"(\d+)", group).group(1))
                ep_num_2 = int(re.search(r"(?:\-\s*)(\d+)", group).group(1))
                ep_nums += list(range(ep_num_1, ep_num_2 +1))

            elif '<' in group:
                ep_num = int(re.search(r"(\d+)", group).group(1))
                ep_nums += list(range(1, ep_num))
                if '=' in group:
                    ep_nums += [ep_num]
                
            elif '>' in group:
                ep_num = int(re.search(r"(\d+)", group).group(1))
                if '=' in group:
                    ep_nums += [ep_num]
                # find max episode number for that show
                max_episode_num = 25 # just for the example
                ep_nums += list(range(ep_num +1, max_episode_num +1))

    print(ep_nums)

# check if episode numbers appear more than once in the list
# or make a way to automatically remove the duplicates

# for episode in ep_nums:
#     download(episode) # or whatever

# Possible issues (depending on the site you're downloading from, I don't know):
# there may be an episode 0 (or that appears as 0 in the search).
# there may be episodes with non integer numbers (e.g. 13.5)
# there may be episodes with word titles

This is not very strict with the syntax in really any way but if you need it to be in fact strict, it's not hard to figure out either. I could do it in a couple minutes, so just say it if you need it like that.

Adding log output

It would be neat to have a file which will log all the operations the CLI is doing.
This is useful when running it in the background and you want to retroactively see what it has done and when.

Of course, the path to the log file will be customizable in the config file.

Fetch episodes to download asynchronously

In the CLI, when beginning to download the episodes, it iterates over the subscriptions in a linear fashion:

for show, last_watched in [(title, 0)] if args.download else CONFIG.subscriptions:

(line 95 in bin/horrible-downloader)

This can get very slow, that's because each iteration it does one or more web request.
I suggest to switch over for a queue and a worker based iteration. So that all of the requests could happen simultaneously and asynchronously.

RIP HS

Well, I was going to continue looking into the API but I suppose that is a moot point now. RIP HS.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.