Last active
August 29, 2015 14:28
-
-
Save bokmann/bc90676dfced1f8bb3d0 to your computer and use it in GitHub Desktop.
Created as a snipper to share with Avdi.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# once upon a time these rake tasks were in use in my house. I had a program that would scrape my kids | |
# TV shows off of my tivo as they were recorded and dump them in a directory. Of course, they had tivo's | |
# encryption on them. the 'decode' task transcoded them to mp4 and moved them to a different directory, | |
# and the 'publish' task would copy them to a generation one Apple TV (the one with the 40 gig hard drive). | |
# My kids then had a never-ending source of Dora and Dinosaur Train, and I had vital space on my Tivo for | |
# things like "The Walking Dead". With a parental code in my Tivo, my kids' shows were sandboxed in a | |
# safe place. | |
# | |
# I presented this code as an example of automation in a conference talk done several times, and this code | |
# was actually taken off of a slide used for that talk. As such, the original code was a little longer | |
# (variable names for directories, etc), and contained a password for the scp command. | |
# | |
# These were scheduled to run in the early morning via cron. | |
namespace :tivo do | |
task :decode do | |
Dir.foreach('~/video/tivoshows/') do |file| | |
outname = file.gsub("mpeg", "mp4") | |
`tivodecode -n -o #{FIle.join("~/videos/tvshows", outname)}, file` | |
end | |
end | |
task :publish_to_appletv do | |
Net::SSH.start('myappletv.local', 'dbock', 'yeahright') do |ssh| | |
ssh.sftp.connect do |sftp| | |
Dir.foreach('~/videos/tvshows/') { |file| sftp.put_file(File.join("~/videos/tvshows",file), file) } | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment