Added functionality to download comics from KAT. Will research a way to preview the comics, because currently it's impossible to 'stream' comics.

This commit is contained in:
Kepoor Hampond 2016-07-15 09:54:28 -07:00
parent 5cb3c3b201
commit 721da835aa
2 changed files with 50 additions and 26 deletions

View file

@ -48,6 +48,10 @@ Currently the system can stream or download the following:
- Complete albums. - Complete albums.
- Movies. - Movies.
- TV shows. - TV shows.
- Playlists.
- Comics.*
<sup>\* Limited only to downloading.<sup>
When downloading music, the system will fill out the specific meta-data so that it will appear organized in your player of choice. It parses the following pieces of meta-data: When downloading music, the system will fill out the specific meta-data so that it will appear organized in your player of choice. It parses the following pieces of meta-data:
- Title. - Title.
@ -59,7 +63,7 @@ When downloading music, the system will fill out the specific meta-data so that
<sup>\* Album art is slightly buggy, and tracknumber only works when downloading complete album.<sup> <sup>\* Album art is slightly buggy, and tracknumber only works when downloading complete album.<sup>
On a personal judgement, we would judge that the complete meta-data parsing works ~90% of the time. On a personal judgement, we would say that the complete meta-data parsing works ~80% of the time.
### Usage ### Usage
```bash ```bash
@ -68,21 +72,7 @@ $ irs (stream | download) tv <tv-show> <episode>
$ irs (stream | download) song <song-name> by <artist> $ irs (stream | download) song <song-name> by <artist>
$ irs (stream | download) album <album-name> by <artist> $ irs (stream | download) album <album-name> by <artist>
$ irs (stream | download) playlist <txt-file-name> $ irs (stream | download) playlist <txt-file-name>
``` $ irs download comic <comic-name> <run>
The text file should be formatted like so: `<song>: <artist>`
```
Unforgettable: Nat King Cole
99 Luftballons: Nena
Ride Of The Valkyries: Budapest Symphony Orchestra
MTV Theme "Man On The Moon": Jonathan Elias & John Peterson
The Times They Are A-Changin': Bob Dylan
Everybody Wants To Rule The World: Studio Group
Protest: Philip Glass
The Sound Of Silence: Simon & Garfunkel
All Along The Watchtower: Jimi Hendrix
Desolation Row: My Chemical Romance
First We Take Manhattan: Dominic Frontiere
``` ```
#### Examples #### Examples
@ -91,8 +81,16 @@ $ irs stream movie Fight Club
$ irs download album A Night At The Opera by Queen $ irs download album A Night At The Opera by Queen
$ irs stream song Where Is My Mind by The Pixies $ irs stream song Where Is My Mind by The Pixies
$ irs download tv mr.robot s01e01 $ irs download tv mr.robot s01e01
$ irs stream album A Day At The Races by Queen $ irs stream playlist "Raid The Arcade.txt"
$ irs download playlist "Raid The Arcade.txt" $ irs download comic Paper Girls 001
``` ```
The text file should be formatted like so: `<song>: <artist>`
```
Good Times Bad Times: Led Zeppelin
I Want To Break Free: Queen
The Man Who Sold The World: David Bowie
```
### Disclaimer ### Disclaimer
Copyrighted content may be illegal to stream and/or download in your country. Copyrighted content may be illegal to stream and/or download in your country.

42
irs.py
View file

@ -1,4 +1,21 @@
#!/usr/bin/python3 #!/usr/bin/python3
# Ingenious Redistribution System, A system built to redistribute media to the consumer.
# Copyright (C) 2016 Cooper Hammond
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os, sys, time, re, select, requests, subprocess import os, sys, time, re, select, requests, subprocess
import urllib.request, urllib.parse import urllib.request, urllib.parse
from termcolor import colored from termcolor import colored
@ -186,8 +203,7 @@ def get_torrent_url(args, category):
search_url = 'https://kat.cr/usearch/' + urllib.parse.quote_plus((" ".join(args) + " category:" + category)) search_url = 'https://kat.cr/usearch/' + urllib.parse.quote_plus((" ".join(args) + " category:" + category))
search_request_response = requests.get(search_url, verify=True) search_request_response = requests.get(search_url, verify=True)
soup = BeautifulSoup(search_request_response.text, 'html.parser') soup = BeautifulSoup(search_request_response.text, 'html.parser')
choice = False choice, results, ran_out = False, True, False
results = True
i = 0 i = 0
print ("") print ("")
while choice == False: while choice == False:
@ -196,9 +212,10 @@ def get_torrent_url(args, category):
try: try:
print ("%s. " % (number + 1) + movie_page[number].string) print ("%s. " % (number + 1) + movie_page[number].string)
except Exception: except Exception:
print (output('e') + " End of results.") if ran_out == False:
# Errors should never pass silently. print (output('e') + " End of results.")
pass # - Zen of Python ran_out = True
pass
a = int(str(input("\n%s What torrent would you like? " % output("q")))) - 1 a = int(str(input("\n%s What torrent would you like? " % output("q")))) - 1
if a in tuple(range(0, 10)): if a in tuple(range(0, 10)):
search_url = requests.get('https://kat.cr' + movie_page[a].get('href'), verify=True) search_url = requests.get('https://kat.cr' + movie_page[a].get('href'), verify=True)
@ -256,6 +273,14 @@ def main():
elif media == "playlist": elif media == "playlist":
rip_playlist(args[-1], what_to_do) rip_playlist(args[-1], what_to_do)
elif media == "comic":
if what_to_do == "download":
os.system("rtorrent '%s'" % get_torrent_url(args, 'comics'))
exit(0)
elif what_to_do == "stream":
print ("%s Streaming is unavailable for comics." % output("e"))
exit(0)
elif media == "movie": elif media == "movie":
if what_to_do == "stream": if what_to_do == "stream":
os.system('peerflix "%s" -a -d --vlc' % get_torrent_url(args, 'movie')) os.system('peerflix "%s" -a -d --vlc' % get_torrent_url(args, 'movie'))
@ -287,14 +312,15 @@ def invalid_format():
irs (stream | download) tv <tv-show> <episode> irs (stream | download) tv <tv-show> <episode>
irs (stream | download) song <song-name> by <artist> irs (stream | download) song <song-name> by <artist>
irs (stream | download) album <album-name> by <artist> irs (stream | download) album <album-name> by <artist>
irs (stream | download) playlist <txt-file-name>""") irs (stream | download) playlist <txt-file-name>
irs download comic <comic-name> <run>""")
print ("Examples:") print ("Examples:")
print (""" irs stream movie Fight Club print (""" irs stream movie Fight Club
irs download album A Night At The Opera by Queen irs download album A Night At The Opera by Queen
irs stream song Where Is My Mind by The Pixies irs stream song Where Is My Mind by The Pixies
irs download tv mr.robot s01e01 irs download tv mr.robot s01e01
irs stream album A Day At The Races by Queen irs stream playlist "Rock Save The Queen.txt"
irs download playlist "Rock Save The Queen.txt" """) irs download comic Paper Girls 001""")
print ("\nFor more info see: https://github.com/kepoorhampond/IngeniousRedistributionSystem") print ("\nFor more info see: https://github.com/kepoorhampond/IngeniousRedistributionSystem")
if __name__ == '__main__': if __name__ == '__main__':