Skip to content

Commit 6066502

Browse files
committed
Initial commit. No code yet.
0 parents  commit 6066502

File tree

7 files changed

+218
-0
lines changed

7 files changed

+218
-0
lines changed

COPYING

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
2+
Version 2, December 2004
3+
4+
Copyright (C) 2004 Sam Hocevar <[email protected]>
5+
6+
Everyone is permitted to copy and distribute verbatim or modified
7+
copies of this license document, and changing it is allowed as long
8+
as the name is changed.
9+
10+
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
11+
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
12+
13+
0. You just DO WHAT THE FUCK YOU WANT TO.
14+
15+
This program is free software. It comes without any warranty, to
16+
the extent permitted by applicable law. You can redistribute it
17+
and/or modify it under the terms of the Do What The Fuck You Want
18+
To Public License, Version 2, as published by Sam Hocevar. See
19+
http://sam.zoy.org/wtfpl/COPYING for more details.

INSTALL

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
It should be as straight-forward as
2+
3+
sudo python2 setup.py install
4+
5+
You should now be able to view API documentation on the fly:
6+
7+
pdoc csv
8+
9+
Or generate HTML for API documentation:
10+
11+
pdoc --html csv
12+

README.md

+129
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
`nflvid` is a Python package that facilates the processing of NFL game footage.
2+
In particular, this library provides routines to do the following:
3+
4+
- Download game footage from NFL's content provider (Neulion).
5+
6+
- Download play meta data associated with game footage that, among other
7+
things, describes the start time of every play in the game.
8+
9+
- Cut the game footage into pieces where each piece corresponds to a single
10+
play.
11+
12+
- Provide a few API functions for accessing the file path of a particular
13+
play by integration with [nflgame](https://github.com/BurntSushi/nflgame).
14+
15+
The methods used in this library rely heavily on the open availability of data
16+
that could be shut off at any time. More to the point, the content that this
17+
library requires is large and cannot be distributed easily. Therefore, this
18+
package's future remains uncertain.
19+
20+
Slicing game footage into play-by-play pieces is done using meta data, which
21+
can sometimes contain errors. Not all of them are detectable, but when they
22+
are, `nflvid` can create a ten-second "stand in" video clip with a textual
23+
description of the play.
24+
25+
The meta data for when each play starts in the footage is included in this
26+
repository and is installed automatically.
27+
28+
The actual game footage can either be broadcast footage (with commercials
29+
removed), or it can be "all-22" (coach) footage. Broadcast footage comes in
30+
varying qualities (up to 720p HD) while "all-22" footage is limited to only
31+
standard definition (480p) quality. `nflvid` faciliates acquiring either, but
32+
getting coach footage is much more reliable and is therefore the default
33+
operation. Gathering broadcast footage is possible, but it is buggy.
34+
35+
36+
## Documentation
37+
38+
The API documentation is generated from the code using `epydoc`. A copy of
39+
it can be found here: http://burntsushi.net/doc/nflvid
40+
41+
42+
## Installation
43+
44+
[nflvid is on PyPI](https://pypi.python.org/pypi/nflvid), so it can be
45+
installed with `pip`:
46+
47+
pip2 install nflvid
48+
49+
50+
## Dependencies
51+
52+
`nflvid` depends on the following third-party Python packages, which are all
53+
available in `PyPI` and are installed automatically by `pip` if it's used to
54+
install `nflvid`.
55+
56+
* [nflgame](https://pypi.python.org/pypi/nflgame)
57+
* [httplib2](https://pypi.python.org/pypi/httplib2)
58+
* [eventlet](https://pypi.python.org/pypi/eventlet)
59+
* [beautifulsoup4](https://pypi.python.org/pypi/beautifulsoup4)
60+
61+
Additionally, the following programs are used to facilitate the downloading and
62+
slicing of video. They should be available in the standard repositories of any
63+
Linux distribution. They are not required if you already have the sliced
64+
play-by-play footage and only want to access video of a particular play given a
65+
play identifier from `nflgame`.
66+
67+
* [ffmpeg](http://www.ffmpeg.org)
68+
* [imagemagick](http://www.imagemagick.org/) (specifically, the `convert`
69+
program)
70+
* [rtmpdump](http://www.imagemagick.org/) (to download rtmp streams)
71+
72+
73+
## Basic usage
74+
75+
`nflvid` operates by understanding two different directory hierarchies. One is
76+
a directory containing one file for each game. The other is a directory with a
77+
sub-directory for each game, where each sub-directory contains a single file
78+
for each play in that game. The former is known as the `footage_dir` while the
79+
latter is known as `footage_play_dir`.
80+
81+
To start downloading the "all-22" footage to `/home/you/pats/full` for
82+
every New England game in 2012, you could use the following command to start
83+
with: (The lone `--` before the directory is necessary since more than one team
84+
can be specified with the `--teams` option.)
85+
86+
nflvid-footage --dry-run --season 2012 --teams NE -- /home/you/pats/full
87+
88+
Note the use of the `--dry-run` flag. When set, this only downloads the first
89+
30 seconds of each game. The point is to test that your environment is
90+
configured correctly before starting a long-running job. If the dry run
91+
completes OK, then try playing the files it downloaded in
92+
`/home/you/pats/full`. If all is well, proceed with downloading the full
93+
video:
94+
95+
nflvid-footage --season 2012 --teams NE -- /home/you/pats/full
96+
97+
Sometimes video downloads can fail (although it is rare), so make sure to watch
98+
the output of `nflvid-footage`. It will tell you if a download is incomplete.
99+
If so, delete the video and re-run the command. **The program will not
100+
re-download footage that is already on disk!**
101+
102+
Once you've downloaded some games, you can now try slicing the footage into
103+
plays. The following command will put the sliced plays into
104+
`/home/you/pats/pbp`:
105+
106+
nflvid-slice --dry-run /home/you/pats/pbp /home/you/pats/full/*.mp4
107+
108+
Note once again the `--dry-run` flag. When slicing, this flag will only slice
109+
the first ten plays in a game. Although slicing doesn't take as long as
110+
downloading (since there is no transcoding), it's still worth it to try
111+
something quick to make sure things are working. After that's done, check the
112+
contents of `/home/you/pats/pbp`. You should see a directory for each game
113+
video in `/home/you/pats/full`. If the video of the plays is OK, then
114+
remove the `--dry-run` flag:
115+
116+
nflvid-slice /home/you/pats/pbp /home/you/pats/full/*.mp4
117+
118+
Note that you can keep running this same command over and over again. **Plays
119+
will not be resliced if they are already on disk**.
120+
121+
Finally, since the meta data describing the start time of each play is
122+
sometimes incomplete, you can add place-holder videos for each missing play
123+
that contain a static 10-second-long textual description of the play:
124+
125+
nflvid-slice --add-missing-plays /home/you/pats/pbp /home/you/pats/full/*.mp4
126+
127+
Please check out `nflvid-footage --help` and `nflvid-slice --help` for more
128+
options.
129+

pdoc/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
hello = 'Sweet'

scripts/generate-docs

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh
2+
3+
rm -rf docs/*
4+
# epydoc --docformat restructuredtext -v --html --name nflgame \
5+
epydoc -v --html --name nflvid \
6+
--no-private \
7+
-o ./doc/ nflvid
8+

session.vim

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
au BufWritePost *.py silent !ctags -R

setup.py

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
from distutils.core import setup
2+
import os
3+
4+
longdesc = \
5+
'''A simple program (and library) to auto generate API documentation for Python
6+
libraries. All documentation text is parsed as Markdown and can be outputted as
7+
HTML or as plain text for console use. There are no special syntax rules, just
8+
pure Markdown.
9+
10+
While pdoc tries to stay consistent with documentation practices recommend by
11+
PEP 8 and PEP 257, pdoc also looks for documentation of representation in some
12+
places just as epydoc does. Namely, docstrings proceeding module level
13+
variables, class variables and instance variables in __init__ methods. This is
14+
done by traversing the ast of the source text.'''
15+
16+
try:
17+
docfiles = map(lambda s: 'doc/%s' % s, list(os.walk('doc'))[0][2])
18+
except IndexError:
19+
docfiles = []
20+
21+
setup(
22+
name='pdoc',
23+
author='Andrew Gallant',
24+
author_email='[email protected]',
25+
version='0.0.1',
26+
license='WTFPL',
27+
description='A simple program to auto generate API documentation for '
28+
'Python libraries.',
29+
long_description=longdesc,
30+
url='https://github.com/BurntSushi/pdoc',
31+
classifiers=[
32+
'License :: Public Domain',
33+
'Development Status :: 3 - Alpha',
34+
'Environment :: Console',
35+
'Intended Audience :: Developers',
36+
'Intended Audience :: End Users/Desktop',
37+
'Intended Audience :: Other Audience',
38+
'Operating System :: OS Independent',
39+
'Programming Language :: Python :: 2.6',
40+
'Programming Language :: Python :: 2.7',
41+
],
42+
platforms='ANY',
43+
packages=['pdoc'],
44+
package_dir={'pdoc': 'pdoc'},
45+
data_files=[('share/doc/pdoc', ['README.md', 'COPYING', 'INSTALL']),
46+
('share/doc/pdoc/doc', docfiles)],
47+
scripts=['scripts/pdoc']
48+
)

0 commit comments

Comments
 (0)