Showing posts with label scripting. Show all posts
Showing posts with label scripting. Show all posts

Wednesday, October 16, 2013

Download Adobe Connect Presentations

Download your own copy of an Adobe Connect 8 Presentation




The following are some methods I used to download offline copies of presentations given at a class I took at the University of Washington.  Adobe Connect 8 was the web meeting software used, and it should be noted that Adobe provides documentation on how to provide offline copies, but for various reasons our instructors weren't able to figure it out.

If you search the Adobe Connect user forums, you’ll notice it’s filled with people posting questions on how to export their presentation. I found some good information in the forums and other places, and this post simply lists the methods I used to achieve the goal.


The Easy Way Out: Throw money at the problem
Without a doubt, the easiest solution is to use a screen recording utility.  You may already have a favorite tool, but I payed for one called Screencast-O-Matic.  For what it’s worth, it did a great job for the price.  In hindsight, I would have just recorded the presentations as they became available.
http://www.screencast-o-matic.com



The Do It Yourself Method
Disclaimers:
  • You must be comfortable with the basics of editing and and video (I do you no favors)
  • Fail Early! If it’s not working out, don’t blame yourself and go the easy route

Software: FLV Editor Lite

I found a good free Flash editor called FLV Editor.  It’s free lite version will work fine if you stay under 4 input files, and honestly if you need more you shouldn’t use this method.  If you find the software useful, I’d encourage you to support the developer and buy the software.

The publisher also has a player called FLV Player, which is a pretty robust player despite its ugly interface.  It plays FLV files better than the VLC Player.

Download the presentation

You will have to download the presentation directly from the web software using these steps:  
1. View the Adobe Connect video on your browser like you normally would
2. Remove the extra parameters from the URL, and add this on the end: /output/filename.zip?download=zip
3. Reload page, wait for a download dialog to display and save the file


What is in that Zip file anyway?

The zip file you receive consists of several Flash (FLV) files that make up different parts of the presentation (audio/video/chat/etc); together they form the entire presentation.  The way I understand it, there is one file that controls all the others, called mainstream.

In the best case scenario, the presenter gives the presentation without stopping the recording. However, if they paused any part of the presentation at any time, a new file is created.  This is where the mainstream file steps in, it keeps track of which files should be “played” when, like a music conductor in an orchestra.  This file will not help us, but it’s important to understand how it works.

Extract Audio/Video

I only wanted the audio and the screen share.  Unfortunately the audio and screen shares are stored in separate files.  In the best case scenario:
  • The audio is stored in a file similar to: cameraVoip_****.flv
  • The screen share video is stored in a file similar to: screenshare_****.flv


Video can also be stored on the voip file (usually a web cam of the instructor), so we will need to separate the audio from the video in that file.  Then we will merge the audio to the video from the screenshare file.


Here are the steps to follow this best-case scenario:
  1. Open the FLV Editor
  2. Add the cameraVoip file  
    1. Drag the file into the editor section
    2. Choose the option to un-link the audio & video
    3. Delete just the video part, leaving the audio behind (this can be tricky)
  3. Add the screenshare file
    1. Drag the file into the editor section
    2. It should only have a video part, no sound
  4. Make sure the audio and video line up,and export to Flash
    1. There is an option to export to other formats with the pay version


If you have more than one of either the audio or video

The instructions are similar to the best-case scenario, except you have to get a little creative.  If you can watch the original presentation on the website, you may be able to figure out where the presenter paused.  You can then try to match up all the files in the editor appropriately.



Are there other options?
I originally tried an awesome command-line utility called ffmpeg:  
  • It can work with flv files, but isn’t so good with converting them, so stick to flv
  • If you have more than one of either the audio or video files, prepare for a difficult time
  • Sometimes the audio/video would be out of sync, usually because one of the files was ~5 seconds longer than the other.  
  • There are plenty of examples on the web on how to use this tool.
  • http://www.ffmpeg.org

My method was to extract the audio, then combine it with the video using a script.
Here are the 2 commands that were the heart of my script:

ffmpeg -i cameraVoip*.flv -vn -acodec mp3 output_audio.mp3
ffmpeg -i output_audio.mp3 -i screenshare*.flv -acodec copy -vcodec copy output_video.flv


If you can follow what’s going on in those 2 commands, you can try ffmpeg.  I found it a fun exercise to remind myself that I still have some command-line skills, and that was good enough to move on to something else that would get the task finished faster.


Conclusion
This are the methods I used to download copies of the presentations: I tried to piece the presentation together by myself, but if I ran into any issues I immedately went to the screen recorder.

Your presentation can vary wildly, so you might have to do some investigation with the various files in the zip archive to determine the best course of action.  Hopefully I have at least given you some inspiration.

Monday, March 25, 2013

Notepad++ Time-Stamp

Kudos

I’ve been keeping some form of a work journal for years; I’d highly recommend it.  I recently got annoyed with creating timestamps in Notepad++, and ran across a helpful post in a forum.  It was so helpful that I thought I’d do my best to try to give it some additional street cred.

Here is the original link:
http://sourceforge.net/p/notepad-plus/discussion/331753/thread/3458d1da#62f2

What day of the week was 4/22/2006 anyway?

Before I start, if you have the TextFX plugin already setup in Notepad++, it provides 2 static methods of inserting a datetime stamp:
Menu: TextFX > TextFX Insert > I:Date & Time: short format: 3:56 PM 3/22/2013
Menu: TextFX > TextFX Insert > I:Date & Time: long format:  3:56 PM Friday, March 22, 2013
If these look good enough to you, you can skip to the section on how to map a keyboard shortcut to these.  However, in addition to the time and date, I also wanted the day of the week, like this:
03:36 PM 03/22/2013 (Friday)


Steps

It turns out this can easily be done with a simple Python script.  I don’t even know Python that well and I was able to do it.

1. Install the python plugin:
  • The plugin’s name is: Python Script
  • It’s recommend you do this via the NP++ Plugin Manger (Menu: Plugins > Plugin Manger)
  • Here’s a link to the project page:  http://npppythonscript.sourceforge.net/
  • The script includes some basic Python libraries, so you shouldn’t need to install Python or other 3rd party libraries

2. Setup script in Notepad++:
  • Menu:  Plugins > Python Script > New Python Script
  • It will ask you for a new file name, I choose: npp_timedate_stamp.py
  • A new tab will appear in NP++ for you to enter the script.
  • This is the script I used:
    
    # Add date/time stamp in Notepad++ 03:28 PM 03-22-2013 (Friday)
    import time
    editor.addText( time.strftime( '%I:%M %p %m/%d/%Y (%A) ' ) )
    
    
  • Here is a link to the Python documentation which shows what all the format string characters: http://docs.python.org/2/library/time.html
  • Save your script

3. Configure Notepad++ to use the script:
  • Menu: Plugins > Python Script > Configuration
  • You should see your script under the User Scripts section
  • Add it to Toolbar and/or Menu
  • I put it in both, but I only managed to find it under menu
  • It shows up as its own entry under Menu: Plugins > Python Script > npp_timedate_stamp

4. Create a keyboard shortcut (my preferred method):
  • Menu: Settings > Shortcut Mapper
  • Switch to Plugin
  • Scroll down until you see your script name (i.e. npp_timedate_stamp)
  • Click on it, choose Modify, and choose a key.  I used: CTRL + ;

Furthermore

This was exciting to me in more ways than one, because in the past I’ve looked for ways of modifying Notepad++, and plugins can be a daunting undertaking.  Apparently the Python plugin is mapped to all the Notepad++ features, so I might utilize it more in the future.

Monday, February 13, 2012

Backup Visual SVN Repositories

(using svnadmin dump)

After migrating from a Linux SVN server to a Windows server with Visual SVN, I needed a new backup script.  Visual SVN doesn't come with a backup solution, but it does have enough SVN admin tools to be able to complete this task without having to install any additional SVN tools. 

The scripts perform an svadmin dump on every repository on the server, then zip those dump files into a one zip file with the current date, using 7-zip.  I used 2 scripts because I wanted to get as much logging as possible into the final zip file. 

You’ll find loads of similar scripts throughout the web, the ones below are just my variant of other methods found; please feel free to cherry pick anything you need out of here.  It goes without saying that you'll have to customize each script to get it work on your system.  This code is free and comes with no guarantees.    Good luck!

Code Highlights:
These are conventions I felt were interesting, I've removed some of the script particulars:

Call svn_dump_repos.cmd > log.txt
  • Calls the dump script and pipes the output to a text file (log_timestamp.txt)
Dir /A:D /B> dirs.txt
  •  (Run in Repository folder) Stores a list of all folders (repositories) into a text file (dirs.txt)
FOR /F %%r IN (dirs.txt) DO ( ... )
  • Runs a loop for each item (%%r) in dirs.txt (i.e. each repository)

I highlighted the same lines that I felt were important in the code below.

Script 1:
svn_backup.cmd
@ECHO OFF
REM svn_backup.cmd
REM 02/10/2012 jmj
REM
REM This script will log the entire script: svn_dump_repos.cmd, and add it to the final zip file.
REM Instead of providing command-line arguments, each variable is set below.
REM

CLS

REM cpuname used for filename, workingdir for holding dumps/logs/etc,
REM and destdir for final destination
set cpuname=svnserver
set workingdir=D:\svn_backup\temp
set destdir=\\backup_server\DEV

REM timestamp = YYYYMMDD
set timestamp=%DATE:~-4%%DATE:~4,2%%DATE:~7,2%

REM Program file locations
set zipexe="C:\Program Files\7-Zip\7z.exe"


echo.
echo ****************************************************
echo Starting svn_dump_repos.cmd, (log as log_timestamp.txt)
echo ****************************************************
if not exist %workingdir% md %workingdir%
call svn_dump_repos.cmd > %workingdir%\log_%timestamp%.txt


REM svn_dump_repos.cmd created the final zip file, add any log files into it (*.txt)
echo.
echo ****************************************************
echo Adding log files to zip file
echo ****************************************************
cd %workingdir%
%zipexe% a %cpuname%_%timestamp%.zip %workingdir%\*.txt

echo.
echo ****************************************************
echo Move archive to final destination
echo ****************************************************
move *.zip %destdir%

echo.
echo ****************************************************
echo Removing the temporary files and exit
echo ****************************************************
del /f /q %workingdir%\*.txt
del /f /q %workingdir%\*.svndump

Script 2:
svn_dump_repos.cmd
@ECHO OFF
REM svn_dump_repos.cmd
REM 02/10/2012 jmj
REM
REM This script will perform a svnadmin dump on each repository in a folder
REM
REM Instead of providing command-line arguments, each variable is set below.
REM

REM cpuname used for filename, workingdir for holding dumps/logs/etc,
REM and destdir for final destination (not used here, but you want to include location in log)
set cpuname=svnserver
set repo=D:\Repositories
set workingdir=D:\svn_backup\temp
set destdir=\\backup_server\DEV

REM timestamp = YYYYMMDD
set timestamp=%DATE:~-4%%DATE:~4,2%%DATE:~7,2%

REM Program file locations
set svnadminexe="C:\Program Files\VisualSVN Server\bin\svnadmin"
set zipexe="C:\Program Files\7-Zip\7z.exe"


echo.
echo ****************************************************
echo Hello! Ready! 
echo.
echo Create svn dump files for each repository on server
echo.
echo Using these Settings:
echo  - Computer Name: %cpuname%
echo  - Repository Folder: %repo%
echo  - Working Directory: %workingdir%
echo  - Destination Directory: %destdir%
echo  - Zip Exe (7-zip) Location: %zipexe%
echo  - svnadmin Location: %svnadminexe%
echo ****************************************************
echo.

echo.
echo ****************************************************
echo Dump Respositories (name_timestamp.svndump)
echo ****************************************************
cd %repo%
dir /A:D /B> %workingdir%\dirs.txt
cd %workingdir%

FOR /F %%r IN (%workingdir%\dirs.txt) DO (
    echo Dumping: %%r
    %svnadminexe% dump %repo%\%%r > %workingdir%\%%r_%timestamp%.svndump
    if errorlevel 1 then Goto Error
)

echo.
echo ****************************************************
echo Compressing Dump files (servername_timestamp.zip)
echo ****************************************************
%zipexe% a -tzip %workingdir%\%cpuname%_%timestamp%.zip %workingdir%\*.svndump

if errorlevel 1 then Goto Error

echo.
echo ****************************************************
echo testing the new archive
echo ****************************************************
%zipexe% t %workingdir%\%cpuname%_%timestamp%.zip

if errorlevel 1 then Goto Error

echo.
echo ****************************************************
echo listing contents of new archive
echo ****************************************************
%zipexe% l %workingdir%\%cpuname%_%timestamp%.zip

if errorlevel 1 then Goto Error

GOTO Finish

:Error
echo.
echo There was an Error in the process
echo Please double-check the results!
echo.
echo GoodBye!
@ECHO ON

:Finish
echo.
echo Finished!

@ECHO ON