Package: timeshift
timeshiftis a python program for recording Internet radio streams and saving
them for later listening (https://en.wikipedia.org/wiki/Timeshifting).
This is “fair use” of the copyrighted material that is being broadcast and is
perfectly legal as long as the files are not made publicly available.Quick Start$ easy_install timeshift
$ cat << EOF > timeshift.conf
[DEFAULT]
basedir = /tmp
baseurl = http://localhost/tmp

[NPR]
title = "National Public Radio"
url = http://npr.ic.llnwd.net/stream/npr_live24
duration = 60
feedfile = npr.atom
EOF
$ python timeshift.py NPRInstallationThe simplest installation method is to use Python’seasy_installorpipto install the package fromPyPI:pip install timeshiftTo install from source, you can clone the project fromBitBucket:hg clone https://bitbucket.org/nmb/timeshiftConfigurationtimeshiftuses a configuration file by default namedtimeshift.confin
the current directory.  To specify a different file use the--config=FILEoption.  The configuration file specifies a global location and URL:[DEFAULT]
basedir = /tmp
baseurl = http://localhost/tmpwherebasediris the local directory where files will be saved andbaseurlis the URL where those files can be accessed.Each source is specified by a separate stanza in the configuration file:[NPR]
title = "National Public Radio"
url = http://npr.ic.llnwd.net/stream/npr_live24
duration = 60
feedfile = npr.atomwheretitleis a long name for source,urlis the location to record
from,durationis the time insecondsto record, andfeedfileis the
name of the file inbasedirto write anAtomfeed to (for use with podcasting
software).Theurlfor the source is the location from which to download the stream.
This can often be found bydownloadingthe MP3 playlist of the stream and
looking for theFile1value inside.UsageSimply run thetimeshift.pyscript with the name of the section that you
wish to record:python timeshift.py NPR.  That will record for the
specified number of seconds to a suitably named file inbasedirand will
add that file to the specified Atom feed in the same directory.To record at regular intervals, use thecronfacility under Unix.  For
example, to record at 17:00 every saturday you could use the crontab line:# m h  dom mon dow   command
0 17 * * SAT python /path/to/timeshift.py --config=/path/to/timeshift.conf NPRAcknowledgmentsTimeshift incorporates the Pythonfeedparser libraryand therfc3339 module.  Thanks to the authors of
those projects.LicenseCopyright 2013 Neil Martinsen-Burrell <neilmartinsenburrell@gmail.com>Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the “Software”), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.