Using Nautilus Scripting Abilities to Integrate Right Click File Enqueues with mocp

Using moc player can prove to be both beneficial and challenging. I’ve found myself going back to exaile for a few hours on random days for the simplicity in file management via a GUI. Since I prefer to use a single media player and mocp is light weight and helpful in so many other ways to me… I knew I needed a solution. It dawned on me just today how simple that solution could be with nautilus scripts.

#!/bin/bash
# Enqueue with mocp
# by Tyler "-z-" Mulligan
#
# This is a nautilus script.  When placed in ~/.gnome2/nautilus-scripts
# and chmod +x you will have the ability to right click >> enqueue files
# or directories in mocp.
#
 
mocp -a "$@"

Some other tips… [ and ] silently skip back and forward respectively at a rate of 5sec per second held… this beats the left and arrows which work interactively at 1sec per sec.

? and h bring up the help, don’t forget this. Use this, learn the commands that work for you and happy listening.

Thanks to MrBougo again for helping me simplify the script further… I was originally using a for loop which is unnecessary as the quotes will help the variable expansion and mocp -a can accept multiple files/folders.

feh – lightweight command line image viewer and data tool

While I was looking for a better image viewer than the default ‘eye of gnome’ (eog from the command line), that’s able to play animated gifs, I came across a command line tool called feh

sudo apt-get install feh

feh is is lightweight image viewer that you can call from the command line. It can recursively view files with the following command for example:

feh -r *.jpg

You can navigate through the images with your arrow keys or space bar and backspace. Use the window close button or press esc to quit.

That’s all good and fun and I’ll probably use it from time to time but it’s not what really got me excited about this tool. It has an option for a “list” of image attributes as the screenshot below shows.

screenshot3

By typing for example

feh -l *.jpg

I would list all attributes for jpgs within a specified directory. In my screenshot, I had a text file multiple image extensions, so I did a subshell with an ‘ls’ command piped to ‘grep -v’ which negates whatever pattern that follows it. To rephrase, the command inside $() is run first and that list which has all files minus those ending in ‘.txt’ is called by the ‘feh -l’ command.

I find this very helpful for when I’m slicing images for web pages. When I’m typing out css for example:

#my_image {
  display:block;
  height:25px;
  width:120px;
  background:transparent url('img/my_image.png') 0 0 no-repeat;
}

it’s very handy to have the image dimensions. The nice thing about this raw dimension output is that I can script it further to generate CSS like above.

There are many other tricks this command can do, just type ‘man feh’ to learn more.

By the way, I’ve started using gThumb as my default image viewer, it’s still lightweight and quite powerful. It’s essentially the same as eog with some minor differences and a few major enhancements

sudo apt-get install gthumb

The “easy” way to listen to internet radio in Ubuntu

I started with rhythmbox like most new Ubuntu users. It seemed nice enough but not in the area I was concerned with, internet radio. I tried out many players but was disappointed with different areas of different players. From Ubuntu 8.04 to 8.10 I was using the “good” Amarok (for KDE 3.5). Disappointed by the exclusion of that version in Ubuntu Jaunty 9.04 and unimpressed with workarounds like the PPA’s, I decided to play the field. I came across Exaile, which I’ve blogged about in the past. It’s a good enough player… most of the time. It crashed too often for my likings and I’m getting sick of pkilling it.

It struck me today that I needed a simplier more streamlined solution for my simple needs. I needed a console application. Through a little research, I found moc, which happens to play shoutcast streams as I’ve become accustom to.

I then proceeded to set myself the following way:

sudo apt-get install moc
mkdir -p ~/Music/internet_radio && cd ~/Music/internet_radio
wget -r -l2 -nd -Nc -A.pls http://www.di.fm/index.php
for file in *.pls; do mocp -a $file; done
mocp

1) Installed moc
2) created a directory to download all the playlists from di.fm (since this is the station I listen to most often)
3) wget all the playlists
4) add them all to moc
5) start moc and [tab] to the play list side, enter to play

screenshot-detrateshobo-music-internet_radio

  enter  -- starts playing
  s      -- stops playing
  n      -- plays next item from the playlist
  b      -- plays previous item from the playlist
  space  -- pause
  p      -- pause

  S      -- plays at random
  R      -- repeats the same song in a loop,
	    Next (X button below) must be OFF
  X      -- switches to play sequentially
  o      -- plays a file from the Internet
  u      -- moves playlist item up
  j      -- moves playlist item down
  Ctrl+u -- adds the URL to the playlist
  g      -- searches marked string in file names
  /      -- searches marked string in file names

  r      -- rereads the directory
  T      -- switches to the theme selection menu
  f      -- toggles display mode of song titles
  TAB    -- switches marker bar between the playlist
	    and the file manager panels
  l      -- switches between displaying the playlist
            or the file manager panel
  P      -- switches full path in the playlist
  H      -- toggles hidden files view
  Ctrl-t -- toggles song duration time
  Ctrl-f -- toggles format file view
  m      -- moves to directory entered in config file
  G      -- moves to directory with currently played file
  i      -- moves to marked directory
  U      -- moves to upper directory
  a      -- adds a file to the playlist
  A      -- adds a directory recursively to the playlist
  C      -- clears the playlist
  V      -- saves the playlist
  d      -- removes marked item from the playlist
  Y      -- removes all empty items from the playlist

  < -- decreases volume by 1%
  ,      -- decreases volume by 5%
  >      -- increases volume by 1%
  .      -- increases volume by 5%

  x      -- toggles the mixer channel
  ?      -- shows help

  !      -- goes to a fast dir 1 (set in config file)
  @      -- goes to a fast dir 2
  #      -- goes to a fast dir 3
  $      -- goes to a fast dir 4
  %      -- goes to a fast dir 5
  ^      -- goes to a fast dir 6
  &      -- goes to a fast dir 7
  *      -- goes to a fast dir 8
  (      -- goes to a fast dir 9
  )      -- goes to a fast dir 10

  F1     -- executes ExecCommand1 (set in config file)
  F2     -- executes ExecCommand2
  F3     -- executes ExecCommand3
  F4     -- executes ExecCommand4
  F5     -- executes ExecCommand5
  F6     -- executes ExecCommand6
  F7     -- executes ExecCommand7
  F8     -- executes ExecCommand8
  F9     -- executes ExecCommand9
  F10    -- executes ExecCommand10

Above commands from polish linux’s article on moc audo player, great resource.

My Second Article Published on Ubuntu Magazine

My latest article on Accessing your favorite media via the terminal has been published.

codepad.org – an online compiler/interpreter, and a simple collaboration tool.

codepad.org is an online compiler/interpreter, and a simple collaboration tool.

A (darker) brown theme for ubuntuforums.org

Because I use a dark theme for GTK, I’ve been working on a darker theme for the ubuntu forums using Stylish. It’s not complete but certainly usable. If you’d like to try it out, you can install the theme (after you install stylish) by going to the userstyle page.

g0esklea7oxc2vvin563

8hp9pibmfh3adx4pfo3a

Inspecting GTK dialogs with Parasite

Parasite is a program much like Firebug, except this is for GTK based applications.

By opening a program with parasite enabled, you can literally click elements of the GUI to reveal their properties.

parasite

The installation is pretty simple, open a terminal, clone the git repo, compile install and run. I like to make a folder for software I checkout from SVN or Git in my home dir so I don’t get things all messy. You need git to clone, so if you don’t have it installed already:

$ sudo apt-get install git-core

Clone it:

$ mkdir ~/git_software && cd ~/git_software && git clone git://github.com/chipx86/gtkparasite

Compile and install it:

$ ./autogen.sh && make && sudo make install

I run 64bit, so I had to do the following command to get things working:

$ sudo cp /usr/local/lib/gtk-2.0 /usr/lib64/ -r

Try it out (prefix an application name with GTK_MODULES=gtkparasite):

$ GTK_MODULES=gtkparasite gedit

Reverting two Ubuntu features ‘removed’ in 9.04

Ubuntu Jaunty 9.04 has many improvements on the prior release of Intrepid 8.10, however 2 things were removed that I didn’t agree with. They are pretty easy to change back so I wanted to share them with you all.

Update Notifier in system tray

I guess the idea behind this change was intended to make updates more obvious… but to power-users like myself, I consider it an annoyance. Every time I’d run apt-get, a “update yo shiz” window would pop up above my terminal and anger me. I’m not the stupid windows user Ubuntu’s starting to treat me like. I just don’t have time for updates that require a restart in the middle of the day when I’m trying to get some work done.

gconftool -s --type bool /apps/update-notifier/auto_launch false

tip from launchpad

Ctrl+Alt+Backspace

This would classically restart X… but for some reason they removed this as well?!?! Whatever, here’s how to fix it.

sudo aptitude install dontzap && sudo dontzap –d

tip from Chris Johnston

deluge torrent – sort of like uTorrent for Linux

When I first switched to Linux, I was running a lot of things in WINE because I was having trouble finding good linux alternatives for a few programs I use every day. Many programs weren’t a problem because they were designed (or redesigned) to be open-source and cross-platform. Those of you who have been following along have seen me recommend some applications as I made the switch but for the record, here’s a quick breakdown.

Cross platform applications that didn’t effect my switch to linux:
Web browsing: Firefox
Email: Thunderbird
(S)FTP: Filezilla
Web browsing: Opera (used for testing)

Applications I used on Windows and their alternatives I’ve found for Linux:
Text Editing: – Notepad++ | Geany
IRC: mIRC | Konversation (tried kvirc for a while but it’s too buggy)
Music: MusikCube | Amarok 1.4 / Exaile

The other programs I use are either minuscule or obvious (e.g. AIM to pidgin).

Today I’d like to share with you another great application that has replaced uTorrent (which I ran in WINE for a while and disliked), Deluge. What I love about deluge is that it is a native application with an interface that looks and behaves much like uTorrent does. Right click open folder in uTorrent in WINE is very face palm because it would try to open it in the stripped down windows explorer type thing :shudder:.

Anyway… I started using deluge at version 0.5 or so and since then it’s had a major code rewrite and feels more solid and (appears it) is now more extendible. Below is a screenshot of how nice it looks.

deluge

It even has a web-ui (if you install the package). You need to run this manually with the following command:

deluge -u web

deluge-webui

The only thing it’s missing (that it had in earlier versions) is a good RSS plugin. There are some “solutions” like the FlexRSS plugin or Feeder (web ui only; good luck, have fun with installing that) but they are inferior to uTorrent. However, that is not enough to send me away and I highly recommend this as a Linux torrent client.

To install the latest version in Ubuntu 9.04 Jaunty Jackalope, I added the following PPA to my software sources >> https://launchpad.net/~deluge-team/+archive/ppa

Liquid Rescaling images – A truly mind-blowing plugin for GIMP

I’ve been using a lot of GIMP since switching to Linux because while Photoshop inside WINE is fast, it’s buggy and opening up a virtual machine just isn’t worth the time for a small edit. I’ve been getting used to the differences and with the latest release of 2.6.6 (packaged with Ubuntu 9.04, Jaunty Jackalope) it’s really starting to come together.

Looking to get the most power out of this application, I headed over to this messy repository that is the official plugin registry. Doing a quick breeze through to see if anything caught my eye, it quickly did with this page about Liquid Rescaling. The picture was enough to catch my attention but the video below dropped my jaw.

Looking to learn more, I went to the official page to learn more. On the download page, I found out that it’s included in the Ubuntu repsitories:

sudo apt-get install gimp-plugin-registry

After installing, I went to the help >> plugin browser in gimp and found that it was under the ‘layer’ file menu. I gave it a shot and It really is magic!

Panoramic Sunsets are so much nicer, aren’t they? :-P

Step one, original picture:
sunset

Step two, mark the area I’d like preserved:
sunset-edit

Step three, magic:
sunset-panoramic