Sha256: 313aa60075549faebdb44f935e6fec5cf8a00fa4ed237c0617f20639a455fb30
Contents?: true
Size: 1.97 KB
Versions: 1
Compression:
Stored size: 1.97 KB
Contents
# # # = Video actions for Jeeves # # == SubTitle # # Author:: Robert Sharp # Copyright:: Copyright (c) 2013 Robert Sharp # License:: Open Software Licence v3.0 # # This software is licensed for use under the Open Software Licence v. 3.0 # The terms of this licence can be found at http://www.opensource.org/licenses/osl-3.0.php # and in the file copyright.txt. Under the terms of this licence, all derivative works # must themselves be licensed under the Open Software Licence v. 3.0 # # # require 'jeeves/tags' module Jeeves class Video def initialize(path, logger, options={}) @path = path @logger = logger @jeeves_url = options[:jeeves_url] @jeeves_tv_url = options[:jeeves_tv_url] @logger.verbose "Created a video for #{@path}" @logger.debug "Jeeves URL set to: #{@jeeves_url}" @logger.debug "Jeeves TV URL set to: #{@jeeves_tv_url}" end def tag_from_prog_id(prog_id) @logger.verbose "About to tag video using prod id: #{prog_id}" tags = Jeeves::Tagger.new_from_remote_id(prog_id, 'pid', @jeeves_tv_url) if tags then @logger.verbose "Tagger successful" @logger.debug "Tags are: #{tags}" target = tags.apply_to_proxy(@path) @original = @path @path = target else # no tags so raise raise Jeeves::VideoError, "Failed to tag file" end end def upload_to_jeeves url = "#{@jeeves_url}/videos/new_from_file.txt?path=#{@path}" @logger.verbose "About to upload to Jeeves for #{@path}" @logger.debug "Using #{url}" data = '' open(url) do |resp| resp.each_line do |line| data << line end end @logger.verbose "Response: #{data}" return data end def get_tags Jeeves::Tagger.new_from_file(@path) end def clean_up if @original then FileUtils.rm_f(@path) @path = @original end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
jeeves-pvr-0.2.0 | lib/jeeves/video.rb |