X-Git-Url: http://p2p-next.cs.pub.ro/gitweb/?a=blobdiff_plain;f=cis%2Fcisd.py;h=3f0dc25afcb5277a1ff3bbfdbea35b2716c6fb63;hb=aa1e24b4e3a9d99a72c8e440b0dafe2118a72816;hp=cb22887eb8d8d815dbfa27dcdfdc23677e2f7db8;hpb=a95dd065bbaaf656f69903e9a3eed83c326c1437;p=living-lab-site.git diff --git a/cis/cisd.py b/cis/cisd.py index cb22887..3f0dc25 100755 --- a/cis/cisd.py +++ b/cis/cisd.py @@ -2,14 +2,45 @@ import sys import config -import cis_exceptions +import os + +from BaseLib.Core.API import * + +def create_torrent(source): + """ Creates a torrent file for the video source file. """ + + if isinstance(source, unicode): + usource = source + else: + usource = source.decode(sys.getfilesystemencoding()) + + duration = config.AVINFO_CLASS.get_video_duration(source, True) + + print config.BT_TRACKER, duration, source + + tdef = TorrentDef() + tdef.add_content(usource, playtime=duration) + tdef.set_tracker(config.BT_TRACKER) + + tdef.set_piece_length(32768) + + tdef.finalize() + tdef.save(source + '.tstream') if __name__ == '__main__': + pass # transcoder = config.TRANSCODER_CLASS(sys.argv[1]) # transcoder.transcode('webm', "vorbis", "vp8", a_bitrate="128k", a_samplingrate=22050, a_channels=2, v_bitrate="256k", v_framerate=15, v_resolution="320x240", v_dar="4:3") - thumb_extractor = config.THUMB_EXTRACTOR_CLASS(sys.argv[1]) - #print thumb_extractor.get_video_duration() - #thumb_extractor.extract_random_thumb() - print thumb_extractor.extract_summary_thumbs(5) +# thumb_extractor = config.THUMB_EXTRACTOR_CLASS(sys.argv[1]) +# #print thumb_extractor.get_video_duration() +# #thumb_extractor.extract_random_thumb() +# print thumb_extractor.extract_summary_thumbs(5) + +# file_transfer = config.FILE_TRANSFERER_CLASS() +# file_transfer.get(['vim_config.tar.gz']) +# #file_transfer.put(['cisd.py']) +# file_transfer.close() + + create_torrent(sys.argv[1])