Noodlecode parody of spaghetti code

Month: December 2012

Record from tv card using mencoder

* Assuming tv card audio in cannot be detected & need to use line-in

rekodtv.sh

#!/bin/bash

CHANNEL=29 # R6-TV1,E11-TV2,29-TV3,37-NTV7,44-8TV,48-TV9
DURATION="60:00" # 60 minutes

amixer -c 0 sset 'Line',0 80% mute cap
mencoder tv://
  -tv channel=$CHANNEL:chanlist=europe-east:forceaudio:alsa:amode=1:adevice=hw.0,0:mjpeg
  -vf pp=md
  -of mpeg
  -oac lavc
  -ovc xvid
  -xvidencopts bitrate=800:vhq=2
  -endpos $DURATION
  -o tv.mpg&& sleep 20 && mplayer tv.mpg

Note: I set the Line-in as the capture channel for audio and mute it, so that no real-time audio coming out of the speaker. After 20 secs sleep, the recording playback started, settings to 5 secs is too low & the playback may stop itself.

To determine alsa hardware ID (hw.0,0) – assuming audio card 0 is the one
that connected the tv card audio out through line-in

$ amixer -c 0

Check

Simple mixer control 'Input Source',0
  ...
  Item0: 'Line'

Therefore, device ID is 0 (see ‘Input Source’)

ALSA hardware ID : hw.<cardID>,<deviceID>

To record:

$ chmod +x rekodtv.sh
$ ./rekodtv.sh

To force stop the recording (above script will auto stop record after 60 minutes)

stoprekod.sh

#!/bin/bash

kill -9 `ps ax|grep mencoder|grep -v grep|awk '{print $1}'`

Recorded videos must be reindexed before storing

idx.sh

#!/bin/bash

mencoder -idx tv.mpg -ovc copy -oac copy -o tv_idx.mpg

To play:

$ mplayer tv.mpg

Setup Trac on Windows

Using Bitnami Trac Stack + Subversion (SVN).

    1. Setup environment
      • Download Bitnami Track Stack (Windows installer) & install it
      • Add to PATH
        C:\Program Files\BitNami Trac Stack\python\Scripts
        C:\Program Files\BitNami Trac Stack\apache2\bin
    2. Create new project
      • Cmd
        $ trac-admin <trac env path> initenv
      • path: C:\Users\Username\Projects\Trac\newproject
    3. Configure SVN repo
      • Edit C:\Users\Username\Projects\Trac\newproject\conf\trac.ini
        repository_dir = <svn repo path>
      • path: C:\Users\Username\Projects\Repos\newproject (create using TortoiseSVN)
    4. Enable SVN module in Trac
        • Edit trac.ini

          [components]
          tracopt.versioncontrol.svn.svn_fs.subversionconnector=enabled
          acct_mgr.*=enabled
  • Edit logo image
    • Edit trac.ini
      [header_logo]
      src = site/logo.png
    • Place image in <trac env path>\htdocslogo.png
  • Enable syntax highlighting
    • Install pygments
      # easy_install pygments
    • Edit trac.ini
      [mimeviewer]
      pygments_default_style = default
  • Add admin permission
    • Cmd
      $ trac-admin /path/to/projenv permission add admin TRAC_ADMIN
    • /path/to/projectenv = c:\Users\Username\Projects\Trac\newproject
  • Add user
    • Cmd
      # htdigest -c htpasswd "Trac" username
    • -c = Create auth file (exclude when adding user)
      htpasswd = C:\Users\Username\BitNami Trac Stack\apps\trac\users\htpasswd
      “trac” = realm in http-dav-svn.conf below
  • Enable SVN repo hosting on Apache
    • Add in httpd.conf
      # svn repository
      Include conf/extra/http-dav-svn.conf
    • Create http-dav-svn.conf (copied from subversion.conf at http://noodlecode.net/2010/11/06/apache-svn-on-fedora/)
    • Edit:
      SVNParentPath C:\Users\Username\Projects\Repos
      AuthType Basic
    • AuthName & AuthUserFile follow values in c:\Program Files\BitNami Trac Stack\apps\trac\conf\trac.conf
      * bitnami trac by default is using basic auth

Trac can be accessed at http://localhost/trac. Checkout & commit to SVN repo at http://localhost/svn

Setup Titanium Studio environment for developing Titanium module (Android) on Windows

Using Titanium Studio 2.1.2.201208301612 and Titanium Mobile 2.1.4.GA

  1. Install Android SDK on path without space (C:\Android\android-sdk)
  2. Install SDK platform AND Google API – 2.2 to latest (4.2)
  3. Install Android NDK (C:\Android\android-ndk-r8b)
  4. Add titanium.py to PATH
    C:\Users\Username\AppData\Roaming\Titanium\mobilesdk\win32\2.1.4.GA
  5. Add python to PATH (if you don’t have python installed):
    C:\Users\Username\AppData\Local\Titanium Studio\plugins\com.appcelerator.titanium.python.win32_1.0.0.1338515509\python

    (Browse into the folder if want to know exact foldername)

  6. Install Gperf and add to PATH
    C:\Program Files\Gnu\Win32\bin

Create new module

  1. Open Titanium Studio
  2. Right click Project Explorer > New > Titanium Mobile Module Project
  3. You should be able to select Android as platform
  4. Continue until finish creating
  5. Edit build.properties, add
    android.ndk=C:\Android\android-ndk-r8b

Build & package module

  1. Right click build.xml > Run As > Ant Build
  2. Packaged module zip file is in dist folder

Copyright © 2017 Noodlecode