Skip to content

Commit 241e88e

Browse files
committedMar 21, 2017
- added pip installer, fixed which, prompting for credentials
1 parent 353ce1f commit 241e88e

File tree

6 files changed

+86
-57
lines changed

6 files changed

+86
-57
lines changed
 

‎README.md

+54-42
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ Download NHL.tv Streams with up to 720p60 and remove the commercial breaks
99

1010
## Usage:
1111
```
12-
usage: nhltv.py [-h] -t TEAMID [-u USERNAME] [-p PASSWORD] [-q QUALITY]
12+
usage: nhltv [-h] -t TEAMID [-u USERNAME] [-p PASSWORD] [-q QUALITY]
1313
[-d DOWNLOAD_FOLDER] [-r] [-m]
1414
15-
nhltv.py: Download NHL TV
15+
nhltv: Download NHL TV
1616
1717
optional arguments:
1818
-h, --help show this help message and exit
@@ -34,11 +34,31 @@ optional arguments:
3434
```
3535

3636

37-
# How to install
38-
nhltv is a python2.7 script that needs ffmpeg and aria2.
37+
# How to install nhltv
38+
39+
Info: TO open a Terminal window:
40+
* Press Command+Space and type Terminal and press enter/return key.
41+
* Run in Terminal app:
42+
43+
## Ensure to have pip installed
44+
Open a Terminal window and run:
45+
```
46+
sudo easy_install pip
47+
```
48+
## Install nhltv script
49+
50+
In a Terminal window go to a folder of choice for the git clone and run:
51+
```
52+
git clone git@github.com:cmaxwe/dl-nhltv.git
53+
pip install .
54+
```
55+
56+
# How to install nhltv dependencies
57+
You won't be able to use it without having aria2 and ffmpeg installed
58+
Below are instructions on how to do install aria2c and ffmpeg.
3959

4060
## OS X > 10.9
41-
You can install from precompiled binaries for from source
61+
You can install aria2c and ffmpeg from pre-compiled binaries for from source
4262

4363
### From source
4464
You probably want to be a developer for this.
@@ -47,7 +67,8 @@ You probably want to be a developer for this.
4767
* Run in Terminal app:
4868

4969
#### Install apples OS X command line development tools:
50-
* Run command below in Terminal window:
70+
71+
* Run command below in Terminal window:
5172
```
5273
sudo xcode-select --install
5374
```
@@ -56,7 +77,7 @@ sudo xcode-select --install
5677
* Wait for the command to finish.
5778

5879
#### Install homebrew:
59-
* Run command below in Terminal window:
80+
* Run command below in Terminal window:
6081
```
6182
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
6283
```
@@ -69,17 +90,19 @@ Note: Installation of ffmpeg will take some time as its compiled from scratch.
6990
Once done you should be able to run aria2 or ffmpeg in the Terminal window but you probably need to start a new Terminal.
7091

7192
### Install from binary:
72-
We are going to download dl-nhltv
73-
We are going to download ffmpeg pre-build binary and put it into /usr/local/bin as root user
74-
We are going to install aria2c and start a new Terminal window.
93+
We are going to download dl-nhltv
94+
95+
We are going to download ffmpeg pre-build binary and put it into /usr/local/bin as root user
96+
97+
We are going to install aria2c and start a new Terminal window.
7598

7699
#### Get dl-nhltv source from github:
77100
* Open page https://github.com/cmaxwe/dl-nhltv
78101
* Click “Code” tab
79-
* Click “Clone or Download”
102+
* Click “Clone or Download”
80103
* Click “Download ZIP” Open with “Archive Utility”
81104
* Once downloaded extract dl-nhltv-master.zip
82-
* Move extracted folder to a location where you want to run dl-nhltv from
105+
* Move extracted folder to a location where you want to run dl-nhltv from
83106

84107
#### Get ffmpeg binary
85108
* Go to http://evermeet.cx/pub/ffmpeg/
@@ -91,21 +114,21 @@ We are going to install aria2c and start a new Terminal window.
91114
* change into folder bin
92115
* drag and grop ffmpeg binary to the /usr/local/bin folder
93116

94-
Verify by opening a new Terminal window and type in
117+
Verify by opening a new Terminal window and type in
95118
```
96119
ffmpeg -h
97120
```
98-
You shoudl see ffmpeg short help printed
121+
You should see ffmpeg short help printed
99122

100-
#### Get aria2 binary package and install it
123+
#### Get aria2 binary package and install it
101124
* Go to http://mac.softpedia.com/get/Internet-Utilities/aria2.shtml
102125
* Click “DOWNLOAD” top left corner
103126
* Click either “External Mirror” or “Softpedia Secure Download (US)”
104127
* DONT CLICK ANYTHING! wait for the download !
105-
* In Downloads right click on the aria2.pkg file and select “open”
106-
* Click install and authenticate.
128+
* In Downloads right click on the aria2.pkg file and select “open”
129+
* Click install and authenticate.
107130

108-
Verify by starting a new Terminal window and type in
131+
Verify by starting a new Terminal window and type in
109132
```
110133
aria2c -h
111134
```
@@ -114,11 +137,11 @@ You should get aria2c's help printed
114137

115138
## On Linux
116139
On Linux this should be rather easy. Havent tried. Only painfull thing could be the python version.
117-
You need python 2.7 or higher. Might want to try 3 as some distries have 2.6 its apparently easier with python3
140+
You need python 2.7 or higher. Might want to try 3 as some distries have 2.6 its apparently easier with python3
118141

119142
### Debian based
120-
121-
#### Install aria2
143+
144+
#### Install aria2c and ffmpeg
122145
```
123146
sudo apt-get install aria2 ffmpeg
124147
```
@@ -128,7 +151,7 @@ https://www.assetbank.co.uk/support/documentation/install/ffmpeg-debian-squeeze/
128151

129152

130153
### Red Hat based
131-
note: havent tried this pure guesswork RHEL likes its python2.6 as its system version so you need to keep that.
154+
note: havent tried this pure guesswork RHEL likes its python2.6 as its system version so you need to keep that.
132155

133156
1) install aria2
134157
```
@@ -138,34 +161,23 @@ For some distributions install ffmpeg follow howto of your choice like
138161

139162
https://www.assetbank.co.uk/support/documentation/install/ffmpeg-debian-squeeze/ffmpeg-debian-jessie/
140163

141-
## Configure dl-nhltv
142-
* In Finder go to your dl-nhltv-master folder
143-
* Edit “globals.py”
144-
* Configure username and password of your NHLTV account
145-
USERNAME = ""
146-
PASSWORD = ""
147-
* Configure your team, see full list below TEAMID entry
148-
TEAMID = "17"
149-
* save changes and close globals.py
150-
151-
Note: Make sure to keep the formatting and all settings surrounded by quotes.
152-
OS X TextEdit is messing up the quotes by turning normal up quotes into some special up-quotes that python does not understand. On OSX You might want to use the sublime text editor instead see https://www.sublimetext.com/
164+
```
153165
154166
## Run dl-nhltv
167+
BEWARE ! This early version stores settings.json and temporary files in the folder you run it from!
168+
Temporary files can exceed 5GB on your drive you want at least 10GB free space!
169+
Best is to have a folder per team line to run the command in like $HOME/NHL/Detroit /$HOME/NHL/Capitals etc..
170+
155171
* Press Command+Space and type Terminal and press enter/return key.
156172
* Run in Terminal app
157-
* type “cd” and hit space then drag and drop your dl-nhltv-master folder into the Terminal window
158-
* Hit enter
159-
* Run
160173
```
161-
python2.7 nhltv.py -t Detroit -u yourNhlUserName -p yourNhlPassword
174+
nhltv -t Detroit
162175
```
163-
Note: your username and password gets stored in settings.json folder so you don't need to flash it on the comamnd line everyt time.
164176
165177
# How dl-nhltv works
166-
When it runs it will check the nhl.tv servers for a new game for your team and if it finds it then it will download it. Then after it downloads it will do a loop and start looking for the next game. It saves the id of the last game so if you aren't getting the results you expect then take a look at the settings.json file and set the game id manually to be lower than the gameid you want to download. It also saves the username and password in the settings.json file
178+
When it runs it will check the nhl.tv servers for a new game for your team and if it finds it then it will download it. Then after it downloads it will do a loop and start looking for the next game. It saves the id of the last game in settings.json in the folder you ran it from so if you aren't getting the results you expect then take a look at the settings.json file and set the game id manually to be lower than the gameid you want to download. It also saves the username and password in the settings.json file when you pass it in via -u -p. Otherwise it will ask when the cookies run old.
167179
168-
## Files and folders
169-
dl-nhltv downloads the parts of a stream into a temp/ subfolder below its source code.
180+
# Files and folders
181+
dl-nhltv downloads the parts of a stream into a temp/ subfolder below the folder you started from.
170182
Per game you have a different log file for the download.
171183
You can watch the progress of the download by looking into the temp folder.

‎nhltv_lib/__init__.py

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from common import *
2+
from download_nhl import DownloadNHL
3+
from silenceskip import silenceSkip
4+
from teams import Team, Teams
5+
from video import reEncode

‎nhltv_lib/common.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from datetime import datetime
44
import os
55
import subprocess
6-
from Carbon.Aliases import false
76

87
MASTER_FILE_TYPE = 'master_tablet60.m3u8'
98
SETTINGS_FILE = 'settings.json'
@@ -102,7 +101,7 @@ def createMandatoryFiles():
102101

103102
def which(program):
104103
command = 'which ' + program
105-
returnCode = subprocess.Popen(command, shell=True).wait()
104+
returnCode = subprocess.Popen(command, stdout=subprocess.PIPE, shell=True).wait()
106105
if returnCode == 0:
107106
return True
108107
return False

‎nhltv_lib/download_nhl.py

+5-7
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from datetime import timedelta
1414
from datetime import datetime
1515
import time
16+
import getpass
1617

1718

1819
class DownloadNHL(object):
@@ -400,13 +401,10 @@ def getSessionKey(self, game_id, event_id, content_id, authorization):
400401

401402
def login(self):
402403
# Check if username and password are provided
403-
404-
if self.userName == "":
405-
tprint("Error: Missing username")
406-
exit(1)
407-
if self.passWord == "":
408-
tprint("Error: Missing password")
409-
exit(1)
404+
print("Need to login to NHL Gamecenter")
405+
if (self.userName == "") or (self.passWord == ""):
406+
self.userName = raw_input("Username: ")
407+
self.passWord = getpass.getpass()
410408

411409
cj = cookielib.LWPCookieJar(COOKIES_LWP_FILE)
412410
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))

‎nhltv.py ‎nhltv_lib/main.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
TEAMID = 0
1313
dl = DownloadNHL()
1414

15+
__author__ = "Clayton Maxwell && Helge Wehder"
16+
1517

1618
def main():
1719
"""
@@ -123,18 +125,12 @@ def parse_args():
123125
setSetting("USERNAME", args.USERNAME)
124126
else:
125127
dl.userName = getSetting("USERNAME")
126-
if dl.userName == "":
127-
print("Missing username, please provide username with -u")
128-
exit(1)
129128

130129
if args.PASSWORD:
131130
dl.passWord = args.PASSWORD
132131
setSetting("PASSWORD", args.PASSWORD)
133132
else:
134133
dl.passWord = getSetting("PASSWORD")
135-
if dl.passWord == "":
136-
print("Missing password, please provide password with -p")
137-
exit(1)
138134

139135
if args.QUALITY:
140136
dl.quality = str(args.QUALITY)

‎setup.py

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import subprocess
2+
from setuptools import setup
3+
4+
# Lets get the version from git tag last one wins
5+
VERSION = subprocess.check_output(["git", "tag"]).rstrip().strip("v").split()[-1]
6+
7+
setup(
8+
name='nhltv',
9+
version=VERSION,
10+
description='Download NHL games from game center',
11+
url='https://github.com/cmaxwe/dl-nhltv',
12+
license='None',
13+
keywords='NHL GAMECENTER',
14+
packages=['nhltv_lib'],
15+
include_package_data=True,
16+
entry_points={
17+
'console_scripts': [
18+
'nhltv=nhltv_lib.main:parse_args'],
19+
})

0 commit comments

Comments
 (0)
Please sign in to comment.