RSS Subscription

If you would like to be notified automatically of any updates to this page then enter the following URL in your RSS Reader:

http://genietvanhetleven.blogspot.com/atom.xml

Saturday, February 18, 2012

KDE 4.7 Window Rules are ignored: Gotcha!

The following applies under KDE 4.7.2, possibly other versions:

KStart > Favorites > Configure Desktop > Window Behavior >
renders a number of options for
    Task Switcher
    Windows Behavior
    Window Rules
If you right click the title bar of a KDE window, e.g., Konsole then select
    Advanced > Special Window Settings
you end up at the same place.

If from the latter you then change something this automatically creates a Window Rule with which you can set all manner of things.

Similarly, from the former, choosing Window Rules gives you a screen where you see a list of your existing Window rules and options
    New …
    Import
    Modify …
    Export
    Delete …

Unfortunately, you can configure away happily and KDE will just as happily ignore your settings until you middle click the maximize button!!!

Now... that is intuitive... NOT.

Saturday, February 11, 2012

How to save YouTube video and audio under Linux - BASH script

As promised:

A script to save video and audio from a YouTube URL:
===============================================
#! /bin/bash
#
#    License: LGPL v3+ (see the file LICENSE)
#    (c)2001-2012 C. Andrews Lavarre
#    email : alavarre@gmail.com
#
########################################################################
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 3 of the License, or    #
# (at your option) any later version.                                  #
#                                                                      #
# This program is distributed in the hope that it will be useful,      #
# but WITHOUT ANY WARRANTY; without even the implied warranty of       #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        #
# GNU General Public License for more details.                         #
#                                                                      #
# The GNU General Public License is posted at                          #
#    http://www.gnu.org/licenses/gpl.txt                               #
# You may also write to the Free Software Foundation, Inc.,            #
# 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA             #
########################################################################

# This routine was modified 120211 by C. A. Lavarre (Andy).
# It captures a YouTube stream, saves the clip, and then rips the audio
#    to an MP3 file
# Arguments:
#    $1 The YouTube URL
#    $2 The basename
#    $3 [Optional] The destination path
# Usage
#    getUT http://www.youtube.com/watch?v=abcdefg myyoutubefile
# Trap errors
  if [ "$1" == "" ]; then
    # Give instructions
      echo "Usage: getUT http://www.youtube.com/watch?v=abcdefg myyoutubefile"
    # Quit
      exit 0
    # Finish
  fi
# Set the variables
  sourceurl=$1
  base_name=$2
  destdir=$3
  destfile=$3/$2
  if [ "$3" == "" ]; then
    # Change the destination
      destfile=$2
    # Finish
  fi

  destflv=$destfile.flv
  destmp3=$destfile.mp3
# Declare intentions
  echo "Copying "$sourceurl" to "$destflv
# Get the full video
  youtube-dl -o $destflv $sourceurl
# Declare intentions
  echo "Copying audio from "$sourceurl" to "$destmp3
# Rip the audio
ffmpeg -i $destflv -vn -acodec libmp3lame -ac 2 -ab 128k $destmp3


===============================================
I get a weird "unsupported sampling rate" warning, but the output sound ($destmp3) is beautiful nevertheless.


If you have comments or tips please submit. We all win or we all lose. It is not a contest.

Easy when you know how: Saving YouTube Video and Audio

So as usual, the answer isn't simple, but easy when you know how.

    http://linux.seindal.dk/2005/09/12/converting-aac-audio-files-to-mp3/
gives the basics:
    youtube-dl    lets you capture the entire video
    ffprobe          examines the contents of the video

    ffmpeg          strips out the audio and also converts it to a 
                           more favorable format
 

But as always there are gotchas: under linux the mp3 codec doesn't exist, rather there is a libmp3lame library.

So, step by step:


1. Install youtube-dl, ffprobe, ffmeg, and libmp3lame using your usual process, repositories, whatever.
 

2. Given a YouTube URL of
    http://www.youtube.com/watch?v=abcdefg
    at a terminal issue the command (under Linux, do whatever equivalent elsewhere):
    cd "directory I want it to be in"
    The quote marks protect the path from embedded spaces... Then issue
    youtube-dl -o "myyoutubefile.flv" http://www.youtube.com/watch?v=abcdefg
    This will save (output: -o) the YouTube video clip as a Flash video (.flv) file containing both the video and the audio.  Kaffeine will quite happily play both.
 

3. Check the audio and video channel formats with
    ffprobe "myyoutubefile.flv"
    The output of this will contain a string
        Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, s16, 147 kb/s
    or something similar, indicating that the audio format is aac.
 

4. Strip out the audio to another format  (e.g., here we go to mp3) with
    ffmpeg -i myyoutubefile.flv -vn -acodec libmp3lame -ac 2 -ab 128k myyoutubeaudio.mp3

 
You can do this all in one step with a handy script. Watch this space.

Easy when you know how...

Saturday, February 4, 2012

GnuCash 2.4.9 Workaround

The upgrade of openSUSE to version 12.1 results in an upgrade of the guile library from version 1.8 to version 2.0.
Unfortunately GnuCash (versions 2.4.7 and 2.4.9)  still depend on guile 1.8. As a result GnuCash crashes on start with 
     ERROR: In procedure debug-options-interface: Unknown option name: maxdepth
See
for the gory details.
Fortunately, there is a workaround until the openSUSE folks sort this out.
The workaround is to use YaST (yast2 sw_single) to DELETE guile 2.0. This will result in an offer to roll back gnucash to version 2.4.7 and to roll back guile to version 1.8.
Which is fine by me.

Saturday, January 28, 2012

Solution: Displaying KTimeTracker results chronologically

KTimeTracker is very cool. It automatically adds events to an .ics file for events on the computer.

But it has no way to display the record in a chronological fashion.

The solution is a bit of a hack, but after several hours of googling about it seems to be the only way:

1. Load the .ics file as a new calendar in Thunderbird's Lightning calendar application (Sunbird is defunct, Evolution does not offer the conversion).
   File > Open > Calendar File > (Navigate to the .ics file)
  
   This will display most of the events as "Tasks" but not to worry, we are just using the file conversion feature of Lightning.
  
2. Export it as a .csv file:
       Right click on the calendar file in the left panel (e.g. chronology), select Export Calendar,
       select Outlook Comma Separated Values (.csv) as the output file format,
       and choose the filename (which in this case defaults to chronology)
       (Delete the calendar in Lightning: right click and choose Delete...)
   
4. Open the exportedfilename.csv in Excel or OpenOffice Calc. This will trigger the text-to-columns editor. Ensure you select Separated by: Commas and especially, Detect special numbers or else the times will be imported as text fields with a text delimiter I cannot figure out how to delete.
  
5.  Format the date and time columns as desired. I prefer 24 hour formats, which at a touch confirms that the times have been properly imported.
  
6. Sort the result as you wish.

Easy when you know how...
As I said, this is a hack. It only gives the result at a snapshot of time. I wish KTimeTracker would just offer a chronological sort presentation, which would show ongoing results. But it doesn't.

Wednesday, January 18, 2012

NDAA, SOPA, PIPA, MPAA, RIAA, and Life, Liberty, and the Pursuit of Happiness

18 January 2012 was an historic day, mark my words:
WE THE PEOPLE spoke with unequivocal clarity: 
     Yoh! Government! Butt Out!
There is a clear, dangerous, and hideous trend here:
  • NDAA: Elimination of habeas corpus protection, after 900 years
  • SOPA/PIPA: 
    • Elimination of due process: arbitrary website shutdowns on suspicion of malfeasance broadly defined
    • Redirection of web access ("DNS" filtering): effectively reporting you to authorities for even trying to access certain websites
I won't sea-lawyer the details here, there are plenty of other sites that explore all the niceties. If you don't know the acronyms then Google and Wiki-dive when you can. 
The point is that there is a collusion afoot between our elected representatives and big business "content vendors" (MPAA, RIAA) to restrict our historically defended (um, with blood, need I remind you) rights to freedom of body, speech, privacy, and spirit.
So what can you do?
MAKE A NOISE. Complain. Write. Join. Post. 
If you just let it happen, if you insist on being politically correct, you have no one to blame but yourself. That is what happened in Germany in the 1930s.
Anyone who is purposely trying to hurt you is NOT your friend. Not family, not associates, especially not politicians.
So, MAKE A NOISE.
As for the MPAA, RIAA, News of the World, all the "Times", and the newspaper industry in general, consider the following:
  • Studies have shown that if someone likes a product they'll usually end up paying for it. That certainly goes for me.
  • On the other hand, I don't pay for trash.
  • Most of the movies out there are trash. Violence, foul language, stress... who needs it? 
  • Packaging a ton of trash with the one good song is common recording industry practice. If you want the one good song you have to pay for all the trash you don't want.
London Times does the equivalent. You have to buy an entire week of papers to get Internet access to their site. I don't have time to read all that trash!! So I canceled my subscription, and haven't missed it a day.
I can go on and on. But the bottom line is that most people are decent. The people they are trying to get with these measures will find another way and most are just doing for fun or bragging rights anyhow. So they are cutting off their noses to spite their faces.
And when you do that at the expense of my freedom, liberty, and privacy, then I get mad.
Fighting mad.
And not just I.
LISTEN UP!! WE THE PEOPLE!!
As for actual measures to fix the problem:
Term Limits
We need to change the kind of people that are drawn to elected Government positions.  That means changing the system fundamentally from risk-averse to risk-prone people. People willing to stand up and strike out.
Like me.
But people like that will burn out. So they won't stand for the twenty or so years it takes to get into a position in which you can actually accomplish something.
So the system needs to change to let people like me get in, fix things, and get out.
And that means TERM LIMITS. Three strikes and you're out:
  • First term to figure out what's happening
  • Second term to actually try to do something
  • Third term to start to become cynical and conniving.
And that's it, bubba, home for you.
It's no coincidence that that is why the military typically limits tours to three years. It works for action- and results-oriented people.
So:
Make a noise: write your representatives, post to your friends and the web. Do Something!
If not, you have only yourself to blame.

Thursday, September 29, 2011

Linux Anti-Virus: Klamav

For a number of reasons, I reinstalled Linux openSUSE 11.4, which then meant reinstalling all the apps, including clamav, the popular anti-virus app for Linux.

This time I discovered klamav, a KDE GUI for the underlying command line interface (CLI) clamav. (There is also a Gnome GUI, but I haven't used it yet.)

klamav is a true pleasure. Very well thought out and complete, as far as it goes.

And it goes quite a way.

Use it to:
  • Schedule virus scans on any number of directories, either recursively or not: it has a very easy functional decomposition tree of the directories. If you want to go recursively there is a simple click box: click it and any particular directory in the tree and all the children are automatically checked.
  • Conduct a scan immediately. Simply click scan.
And much more.

Of course, it has a few problems:
  • It offers only two email programs to be scanned dynamically as the messages arrive: kmail and Evolution. I searched, there was a Thunderbird ("T-bird") addon that supposedly solved this, but it has disappeared for version 7.0. But that doesn't really matter, as you can manually and on schedule do the scan, as noted above. And frankly, dynamic scanning is an exercise in paranoia for most Linux users...
  • It tags and (with your permission) quarantines the entire subdirectory containing a suspect file. And it does this by default if it finds stuff it doesn't understand, like any binaries or encrypted files. But this is not a problem unless you are doing a lot of encrypted PDF and binary transfers by email, which you shouldn't be doing anyhow. Use http, ftp, BitTorrent, or whatever else, not email... And even then, it has a 'way cool "check it out" feature: once the files/messages are quarantined you can right click to have their "problem" checked out online, (I found the google link the most helpful), and then with one click, restore them.

    Most of the problems were of the "not understood" variety. I did find one file that possibly had a real virus, and deleted it.
    But it would be nice if the author were to enable quarantining just the single offending file (rather than the entire subdirectory) and include Thunderbird in his list of supported email clients, or else offer a website posting on what it would take to create a filter to do so...

    So very well done, and well recommended. Infinitely better and easier than struggling at the CLI.