mirror of
https://github.com/cooperhammond/irs.git
synced 2024-12-22 17:35:28 +00:00
Added functionality to download books, cause it takes literaly 2 more lines. 😏
This commit is contained in:
parent
721da835aa
commit
894e0a4c9e
14
README.md
14
README.md
|
@ -49,7 +49,7 @@ Currently the system can stream or download the following:
|
||||||
- Movies.
|
- Movies.
|
||||||
- TV shows.
|
- TV shows.
|
||||||
- Playlists.
|
- Playlists.
|
||||||
- Comics.*
|
- Comics and books.*
|
||||||
|
|
||||||
<sup>\* Limited only to downloading.<sup>
|
<sup>\* Limited only to downloading.<sup>
|
||||||
|
|
||||||
|
@ -69,19 +69,19 @@ On a personal judgement, we would say that the complete meta-data parsing works
|
||||||
```bash
|
```bash
|
||||||
$ irs (stream | download) movie <movie-name>
|
$ irs (stream | download) movie <movie-name>
|
||||||
$ 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 | album) <title> 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>
|
$ irs download (comic <title> <run> | book <title> by <author>)
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Examples
|
#### Examples
|
||||||
```bash
|
```bash
|
||||||
$ irs stream movie Fight Club
|
$ irs download book I, Robot by Isaac Asimov
|
||||||
$ 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 album A Night At The Opera by Queen
|
||||||
|
$ irs stream movie Fight Club
|
||||||
$ irs download tv mr.robot s01e01
|
$ irs download tv mr.robot s01e01
|
||||||
$ irs stream playlist "Raid The Arcade.txt"
|
$ irs stream playlist "Rock Save The Queen.txt"
|
||||||
$ irs download comic Paper Girls 001
|
$ irs download comic Paper Girls 001
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
24
irs.py
24
irs.py
|
@ -153,13 +153,12 @@ def visible(element):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def search_google(song_name, band):
|
def search_google(song_name, band):
|
||||||
# takes 2 strings, one as the song_name and the other as the band's name, with the keyword as what prefaces the info you want.
|
|
||||||
try:
|
try:
|
||||||
string = "%s %s" % (song_name, band)
|
string = "%s %s" % (song_name, band)
|
||||||
filename = 'http://www.google.com/search?q=' + urllib.parse.quote_plus(string)
|
filename = 'http://www.google.com/search?q=' + urllib.parse.quote_plus(string)
|
||||||
hdr = {
|
hdr = {
|
||||||
'User-Agent':'Mozilla/5.0', # Honestly, this is just so that google doesn't prevent your from looking at them.
|
'User-Agent':'Mozilla/5.0',
|
||||||
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', # creds are here.
|
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
||||||
}
|
}
|
||||||
texts = BeautifulSoup(urlopen(Request(filename, headers=hdr)).read(), 'html.parser').findAll(text=True)
|
texts = BeautifulSoup(urlopen(Request(filename, headers=hdr)).read(), 'html.parser').findAll(text=True)
|
||||||
|
|
||||||
|
@ -201,6 +200,7 @@ def get_album(album_name, artist, what_to_do):
|
||||||
|
|
||||||
def get_torrent_url(args, category):
|
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))
|
||||||
|
print (search_url)
|
||||||
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, results, ran_out = False, True, False
|
choice, results, ran_out = False, True, False
|
||||||
|
@ -273,12 +273,12 @@ 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":
|
elif media in ("comic", "book"):
|
||||||
if what_to_do == "download":
|
if what_to_do == "download":
|
||||||
os.system("rtorrent '%s'" % get_torrent_url(args, 'comics'))
|
os.system("rtorrent '%s'" % get_torrent_url(args, media + "s"))
|
||||||
exit(0)
|
exit(0)
|
||||||
elif what_to_do == "stream":
|
elif what_to_do == "stream":
|
||||||
print ("%s Streaming is unavailable for comics." % output("e"))
|
print ("\n%s Streaming is unavailable for comics and books.\n" % output("e"))
|
||||||
exit(0)
|
exit(0)
|
||||||
|
|
||||||
elif media == "movie":
|
elif media == "movie":
|
||||||
|
@ -310,17 +310,17 @@ def invalid_format():
|
||||||
print ("Usage:")
|
print ("Usage:")
|
||||||
print (""" irs (stream | download) movie <movie-name>
|
print (""" irs (stream | download) movie <movie-name>
|
||||||
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 | album) <title> 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>""")
|
irs download (comic <title> <run> | book <title> by <author>) """)
|
||||||
print ("Examples:")
|
print ("Examples:")
|
||||||
print (""" irs stream movie Fight Club
|
print (""" irs download book I, Robot by Isaac Asimov
|
||||||
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 album A Night At The Opera by Queen
|
||||||
|
irs stream movie Fight Club
|
||||||
irs download tv mr.robot s01e01
|
irs download tv mr.robot s01e01
|
||||||
irs stream playlist "Rock Save The Queen.txt"
|
irs stream playlist "Rock Save The Queen.txt"
|
||||||
irs download comic Paper Girls 001""")
|
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__':
|
||||||
|
|
Loading…
Reference in a new issue