Showing posts with label cli. Show all posts
Showing posts with label cli. Show all posts

Tuesday, October 27, 2015

Easily Manage / Connect To SSH Hosts With Guake Indicator

Guake Indicator is an Ubuntu AppIndicator for Guake terminal users, useful for those who need to connect to multiple SSH hosts frequently: the indicator lets you easily manage your favorite SSH hosts and establish new SSH connections via Guake.

Guake is a Quake-style drop-down terminal which can be invoked with a single keystroke and hidden by pressing the same key again.

Guake Indicator

Guake Indicator features:
  • easily connect to your SSH hosts and MySQL servers;
  • run various commands / tasks (e.g. navigate to a folder, ping google.com and so on);
  • GUI to add new SSH hosts or localhost tasks.

The SSH hosts / commands can be added by using the Guake Indicator GUI or by editing the ~/.guake-indicator/guake-indicator.json configuration file.

Guake Indicator add entry


Install Guake Indicator in Ubuntu


Guake Indicator can be installed in Ubuntu Utopic, Trusty or Saucy by using a PPA. To add the PPA and install Guake Indicator, use the following commands:
sudo add-apt-repository ppa:gun101/ppa
sudo apt-get update
sudo apt-get install guake-indicator

Once installed, launch Guake Indicator from the menu / Dash.

Guake Indicator doesn't start automatically on login. To add it to startup, open Startup Applications, click "Add" and enter "guake-indicator" under "Name:" and "Command:", then click Add and you're done - Guake Indicator should now start automatically when you log in.

Guake Indicator should be available in the Debian repositories soon. Until then, you can try to use the Ubuntu packages in Debian (not tested).

Other Linux distributions: grab the source from HERE.
Read more »

Sunday, October 25, 2015

gdrive: A Simple Google Drive CLI Client (Cross-Platform)

gdrive (not to be confused with Grive!) is a simple command line Google Drive client written in Go, available for Linux, Windows, FreeBSD and Mac OS X.

gdrive

The tool was created for uploading and downloading files from/to Google Drive and it doesn't support any kind of synchronization. In fact, gdrive can't even download multiple files at once.

However, gdrive is still useful for one-off uploads / downloads (for automated uploads of a backup archive for example), especially since Grive, another command line Google Drive client (which does support sync) that's quite popular among Linux users, wasn't updated since May, 2013 and looks pretty much dead.

gdrive features:
  • upload/download single files (and optionally, it can convert uploaded files to Google Docs format);
  • upload folders;
  • create folder;
  • share file or folder from your Google Drive;
  • generate preview and download url;
  • show shared status;
  • search your Google Drive;
  • cross-platform.

Update: the latest gdrive now supports recursive directory uploads and resumable uploads.


Using gdrive


To use gdrive, you must firstly authenticate it with Google. Do this, simply run "drive" in a terminal (this assumes that you've installed the gdrive binary as "drive", by following our installation instructions - see below):
drive
A link should be displayed in the terminal, which you need to copy and paste in your web browser. In your web browser, click "Accept" and copy the resulting code and paste it in the terminal where you ran "drive".

To be able to download files from Google Drive to your computer, you must use the file id. To find out this id, run the following command to get a list of recent files (and their ids) available in your Google Drive:
gdrive list
Example:
$ drive list
Id Title Size Created
0B0tRrdcY7CwJZHh5ZmVpZHRMYW8 drive-linux-amd64 10 MB 2014-09-25 17:47:08
0B0tRrdcY7CwJY2lNS2x3NC1lQUU drive-linux-386 8 MB 2014-09-25 17:47:01
0B0tRrdcY7CwJR3lmZnlRaFZwOHc drive-linux-arm 9 MB 2014-09-25 17:46:57
0B0tRrdcY7CwJQlRfQUVxY2hkWUE drive-linux-rpi 9 MB 2014-09-25 17:46:52
Note that "drive list" lists all your recent Google Drive files, even those shared with you, etc.

Now you can download a file from Google Drive, by using the following command:
drive download --id FILE_ID
where "FILE_ID" is the file id which you can see when using the "drive list" command.
File download example:
$ drive download --id 0B0tRrdcY7CwJZHh5ZmVpZHRMYW8
Downloaded 'drive-linux-amd64' at 10 MB/s, total 10 MB

To upload a single file or a folder to Google Drive, use the following command:
drive upload --file /PATH/TO/FILE_OR_FOLDER_NAME
File/folder upload example:
$ drive upload --file drive-linux-amd64
Id: 0B0tRrdcY7CwJZHh5ZmVpZHRMYW8
Title: drive-linux-amd64
Size: 10 MB
Created: 2014-09-25 17:47:08
Modified: 2014-09-25 17:47:06
Owner: Alin Andrei
Md5sum: 82333d9c678af60a727779349a310a4e
Shared: False
Parents: 0B0tRrdcY7CwJWjFOTzd0YkpOTms
MIME Type:
Uploaded 'drive-linux-amd64' at 1 MB/s, total 10 MB
Important: gdrive can't upload multiple files unless you place them in a folder and pass the folder path to gdrive - for instance, you can use wildcards to upload multiple files in the current directory at once (so for example, "drive upload --file *.txt" won't work).

To see all the supported commands, use the following command:
drive --help

For more information and examples, see the gdrive GitHub page.


Download gdrive


Download gdrive (binaries available for Linux - 32bit, 64bit, Arm and Raspberry Pi -, Windows, Mac and FreeBSD as well as the source code)

To report bugs, help with its development, etc. see the gdrive GitHub page.


Install gdrive in Linux


The gdrive GitHub page offers binaries for Linux (well as Windows, etc.) for 32bit, 64bit, Arm and a binary especially for Raspberry Pi. To install it, download the binary, place it in your home folder and run the following command to install it to /usr/local/bin/ as "drive":

cd && sudo install drive-linux* /usr/local/bin/drive

That's it.

Also see:
Read more »

Grive2: Grive Fork With Google Drive REST API And Partial Sync Support [PPA]

Grive was an unofficial, open source command line Linux client for Google Drive. I say "was" because the tool no longer works due to Google changing it's API recently and Grive not being maintained any more (there are no commits on its GitHub page since May, 2013).

Grive2

To get Grive up and running again, Vitaliy Filippov forked it and named his fork "Grive2". The fork supports the new Google Drive REST API and it also includes a new feature: partial (directory) sync, along with bug fixes.

Compared to the original "Grive", Grive2 comes with the following changes:
  • supports the new Drive REST API
  • added partial sync
  • major code refractoring: a lot of dead code removed, JSON-C is not used any more, API-specific code is split from non-API-specific
  • some stability fixes
  • slightly reduce number of syscalls when reading local files
  • bug fixes

Also, just like the old app, Grive2 does NOT support:
  • continuously waiting for changes in file system or in Google Drive to occur and upload. A sync is only performed when you run Grive, and it calculates checksums for all files every time;
  • symbolic links;
  • Google documents.


Install Grive2 in Ubuntu or Linux Mint via PPA


Since there are quite a tools that rely on Grive, the Grive2 binary and package continue to be called "grive", so installing Grive2 from the main failsdownloads PPA will overwrite any old Grive versions it may find on the system (just as if it was a newer Grive1 version).

To install Grive2 in Ubuntu, Linux Mint and derivatives by using the main failsdownloads PPA, use the following commands:
sudo add-apt-repository ppa:nilarimogard/failsdownloads
sudo apt-get update
sudo apt-get install grive
If you don't want to add the PPA, you can download the deb from HERE (for Ubuntu 12.04, you'll also need yajl2 - get it from HERE) but installing the debs manually means you won't receive automatic updates.

Arch Linux users can install Grive2 via AUR (it's actually the old "grive" package, updated with the new Grive2 fork).

For other Linux distributions, see the Grive2 GitHub page.


Using Grive2


Grive2

1. Grive2 will download / upload new or changed files from the directory you run it. So firstly, let's create a new folder - we'll call it "grive" -, in your home directory:
mkdir -p ~/grive

2. Next, navigate using the terminal into the newly created "grive" folder:
cd ~/grive

3. The first time you run Grive2, you must use the "-a" argument to grant it permission to access your Google Drive:
grive -a
After running the command above, an URL should be displayed in the terminal - copy this URL and paste it in a web browser. In the newly loaded page, you'll be asked to give Grive permission to access your Google Drive and after clicking "Allow access", an authentication code will be displayed - copy this code and paste it in the terminal where you ran Grive2.

That's it. Now each time you want to sync Google Drive with your local "grive" folder, navigate to the "grive" folder (step 2) and run "grive" (this time without "-a" since you've already authenticated Grive with Google Drive).

Grive2 comes with some advanced features as well. For instance, compared to the original Grive, the new Grive2 fork supports partial sync. To only synchronize one subfolder (a folder from your ~/grive directory) with Google Drive, use:
grive -s SUBFOLDER
(replacing "SUBFOLDER" with the name of the subfolder you want to sync)

To see all the available options, type:
grive --help
Read more »

YouTube Command Line Player And Downloader `mps-youtube` 0.2.0 Released With Support For Downloading YouTube Playlists, More

mps-youtube is a command line tool that can be used to search, play and download YouTube videos, which supports both local and YouTube playlists.

By default, mps-youtube is basically a YouTube audio player (and downloader), but you can enable external video playback (via mpv or MPlayer) from its options:


Features:
  • search and play audio / video from YouTube;
  • search tracks of albums by album title;
  • search and import YouTube playlists;
  • create and save local playlists;
  • download audio / video from YouTube, with support for DASH (so it can mux separate audio and video streams - that means it can download 1080p YouTube videos since all 1080p YouTube videos use DASH);
  • view video comments;
  • works under Linux, Windows and Mac OSX;
  • many other small but useful features.

The latest mps-youtube 0.2.0, released today, adds quite a few new features and improvements, such as:
  • auto detect terminal size;
  • transcode audio to mp3 and other formats (requires ffmpeg or avconv);
  • added "da" (download best available audio file) and "dv" (download best available video file) commands to playlist search results;
  • added options to download YouTube playlists (use "dapl" for audio and "dvpl" for video) by url or id;
  • the progress indicator now works with mpv;
  • added option to show system notifications (on Ubuntu, install "libnotify-bin" and enable notifications using "set notifier notify-send");
  • Added overwrite true/false option for downloads (skips download if downloaded file already exists);
  • added copy to clipboard feature (requires "xclip" from the repositories and "xerox" which you can install via python-pip);
  • remux audio downloads for better file compatibility.


Getting started with mps-youtube


To start mps-youtube, use the following command:
mpsyt

Before using mps-youtube, let's configure it.

mps-youtube uses mplayer as the default media player but you can change this to mpv by using the following command:
set player mpv

By default, mps-youtube searches for music only. If you want to disable this, use the following command:
set search_music false

Also, mps-youtube plays just the audio by default so if you wish to enable playing videos (using the player set above), run the command below (once again, after running "mpsyt"):
set show_video true

You can view all the available configuration options by using the command below:
set


Searching for music / videos using mps-youtube is as easy as adding "." or "/" in front of the search terms (without the quotes). For instance, to search for Led Zeppelin, you can use:
.led zeppelin
or:
/led zeppelin
You can navigate to the next / previous page of results by using "n" (next) and "p" (previous).

To play an item, enter its number. You can also play multiple items, for instance, use "1-5" to play items 1 to 5 or "1, 2, 6" to play the first, second and sixth item and so on.



To download an item, use:
d ITEM-NUMBER
For example, to download the 3rd search result, use "d 3" - this displays all the available audio and video formats and lets you choose which to download. You can also download the best audio (use "da ITEM-NUMBER") or best video (use "dv ITEM-NUMBER"). This works for both searches and playlists.

This is just to get you started so for more information on using mps-youtube, type "h" and then "help TOPIC" (where topic is "basic", "search" and so on) as explained in mps-youtube:



Install mps-youtube


Arch Linux users can install the latest mps-youtube via AUR

mps-youtube is available in Ubuntu 14.10 and 15.04 repositories as well as Debian Sid and Jessie however, that's an older version so if you want to install the latest version in Ubuntu, Debian, Linux Mint and so on, you can use PIP:

1. Install Python PIP:
sudo apt-get install python3-pip

2. Install mps-youtube using Python PIP:
sudo pip3 install mps-youtube

3. You'll also need either mpv or mplayer if you want to play audio or video via mps-youtube.

mpv is available in the official Ubuntu 14.04, 14.10 and 15.04 repositories as well as in Debian Jessie and Sid so to install it, use the following command:
sudo apt-get install mpv

Of course, you can also use mplayer, which is available in the official repositories for any Ubuntu / Debian version - install it using the following command:
sudo apt-get install mplayer

If you had mps-youtube installed and you want to upgrade it (or you want to upgrade it later on, when a new version is released), use the following command:
sudo pip3 install mps-youtube --upgrade

For Windows and Mac OS X installation instructions, bug reports and so on, see the mps-youtube GitHub page.
Read more »

LGOGDownloader: Command Line GOG.com Game Downloader For Linux [Ubuntu PPA]

LGOGDownloader is an open source command line GOG.com game downloader for Linux, which uses the same API as the official GOGDownloader (which unfortunately is not available for Linux). 

The tool can download GOG.com games (including language-specific installers if available), list / download updated files, resume unfinished downloads, repair downloaded installers, download extras such as artwork or manuals and more.

lgogdownloader

GOG.com is a computer game sale and distribution service which delivers DRM-free video games. Linux support was added on July 25th, 2014.

LGOGDownloader features:
  • List available games (simple and detailed list);
  • Batch downloading;
  • Repair downloaded installers/extras;
  • Resume unfinished downloads;
  • Cover downloading;
  • Perl regular expressions for filtering games;
  • Download speed limiting;
  • Checking for update notifications;
  • List/download updated files;
  • Check for orphaned files;
  • Check file status;
  • Blacklist files.


Install LGOGDownloader


The LGOGDownloader Ubuntu PPA is outdated, so I uploaded LGOGDownloader in the main failsdownloads PPA for Ubuntu 14.10 and 14.04 (it can't be built on older Ubuntu versions).

Ubuntu 14.04 or 14.10 (and Linux Mint 17, etc.) users can install LGOGDownloader by using the main failsdownloads PPA. To add the PPA and install the tool, use the following commands:
sudo add-apt-repository ppa:nilarimogard/failsdownloads
sudo apt-get update
sudo apt-get install lgogdownloader

If you don't want to add the PPA, you can grab the deb from HERE.

LGOGDownloader for other Linux distributions:


Using LGOGDownloader


The first thing you need to do after installing LGOGDownloader is to login. To do this, run the command below:
lgogdownloader --login
Then enter your GOG.com email and password.

After logging in successfully, a configuration file called "config.cfg" is created under ~/.config/lgogdownloader/ You may want to change a few things from this configuration file, so open it with a text editor - using the command below, the config.cfg file will be loaded in Gedit:
gedit ~/.config/lgogdownloader/config.cfg

In this file, you can change the platform, language, choose if you want to download tar.gz files ("no-targz") and/or deb files ("no-deb"), limit the download speed and so on, so change any options you want, then save the file. For instance, to only download the Linux binaries, change "platform" from "5" to 4".

Then, list your GOG.com games by using the following command:
lgogdownloader --list

To download a game (in the current directory), use the command below:
lgogdownloader --download --game GAMENAME
(where GAMENAME is the game name as displayed by the "lgogdownloader --list" command).

Some more LGOGDownloader usage examples can be found HERE.

To view all the available LGOGDownloader options, run:
lgogdownloader --help

Report any LGOGDownloader issues you may find @ GitHub.
Read more »

Saturday, October 24, 2015

YouTube Viewer: A Complete YouTube Client For Linux [Ubuntu PPA]

YouTube Viewer is an application written in Perl that can be used to search, play and download YouTube videos.

The app ships with two interfaces: GTK2 and comamnd line and it offers a wide range of features, like an advanced search, browsing YouTube categories, view your subscriptions, favorites or recommended videos, view complete video information (including comments, upvotes/downvotes, video category and so on and allows posting comments from the app) and more.

YouTube Viewer

YouTube Viewer features:
  • GTK2 and command line interfaces;
  • search, play and download YouTube videos;
  • supported external players: mplayer (and mplayer2), mpv, vlc and SMPlayer (for a complete GUI for mpv/mplayer) and you can add more in the configuration file;
  • displays complete video information: video length, number of views, upvotes/downvotes, uploader, video category and upload date;
  • you can see video comments, add a comment, rate a video, add it to favorites and so on, directly from YouTube Viewer;
  • log in to your YouTube account and see your subscriptions, favorites, recommended videos and watch history;
  • advanced YouTube search: you can choose to search for videos, channels or playlists, sort search results by relevance, rating, view count or date published as well as upload date (all time, this month, this week or today), search by video duration and so on, with configurable results per page;
  • list the latest videos uploaded or favorited by a user, list playlists created by a user or subscription videos for a username;
  • browse YouTube videos by categories or tops (top rated, top favorites, most shared, most popular, etc.);
  • supports entering a YouTube video URL in the search field to play that video;
  • more.

YouTube Viewer is a great application that supports pretty much everything you can do directly on the YouTube website (well, without uploading or editing videos), but it lacks a pretty important feature: it can't play 1080p videos. That's because YouTube now uses DASH for 1080p videos, with separate audio and video streams, which is not supported by YouTube Viewer for now. Update: the application can now play 1080p videos but for some reason it can't download them so the best downloaded video quality continues to be 720p.

Also, the UI could use some improvements, especially the Preferences dialog, which currently displays the options available in the configuration file as plain text:

YouTube Viewer

Here are a few more YouTube Viewer screenshots:

YouTube Viewer

YouTube Viewer

YouTube Viewer


The command line interface comes with pretty much the same features as the GUI and is very easy to use - type "youtube-viewer" in a terminal, then type ":h" to see all the available options (you can also use "youtube-viewer --help" to achieve the same thing):

YouTube Viewer

YouTube Viewer

Note that the command line and GTK interfaces don't use the same settings. To configure the command line YouTube Viewer interface, edit the "youtube-viewer.conf" file located under ~/.config/youtube-viewer (run "youtube-viewer" once so the file is created).

Important: in my test, YouTube Viewer didn't work properly with VLC and using it with mplayer may result in some videos not working (due to the videos using an encrypted signature), so for best results, use this application with mpv. To set YouTube Viewer to use mpv as the video player, from its menu select Preferences and change the "video_player_selected" value to "mpv".


Install YouTube Viewer in Ubuntu 15.04, 14.10 and 14.04 Or Linux Mint 17.1 and 17


1. Install mpv

Like I said above, even though YouTube Viewer supports multiple video players, right now it only works properly with mpv or at least that was the case in my test. To install mpv in Ubuntu 15.04, 14.10 or 14.04 / Linux Mint 17.1 or 17, simply use the following command:
sudo apt-get install mpv
Ubuntu 14.04 and 14.10 have a pretty old mpv version so if you want to install a newer version, I recommend using Doug McMahon's mpv PPA.

2. Install YouTube Viewer

To make it easier to install, I've uploaded the latest YouTube Viewer from GIT to the main failsdownloads PPA, for  Ubuntu 15.04, 14.10 and 14.04 / Linux Mint 17.1 and 17. Add the PPA and install YouTube Viewer using the following commands:
sudo add-apt-repository ppa:nilarimogard/failsdownloads
sudo apt-get update
sudo apt-get install youtube-viewer

Arch Linux users can install YouTube Viewer (GIT) via AUR: cli | gtk

For other Linux distributions, see the YouTube Viewer Google Code and GitHub pages.

Report any issues you may find @ GitHub.

Thanks to Hund for the tip!
Read more »

Thursday, October 22, 2015

Geeknote: Command-Line Evernote Client

Geeknote is a command-line client for Evernote, useful to add notes to Evernote via Bash scripts, cron, applications that can't directly use the Evernote SDK or to simply manage your Evernote notes from the command-line.

The tool supports all basic Evernote functions: it can create or delete notes, create notepads and tags, search notes (with filters) and of course, edit existing notes, but that's about it. The application doesn't support advanced features like adding attachments to your notes or downloading/opening existing attachments.

The default editor used by Geeknote is Nano, but you can change it to other console editors such as Vim, Emacs and so on and you can even use GUI text editors, like Gedit for instance.

Furthermore, Geeknote comes with a tool called gnsync, which allows synchronizing a folder containing text notes (it only works with text data!) with Evernote. This can be used to sync various logs or reports with Evernote under certain notebooks and add various tags automatically, but of course, there are many use cases for this.

Here are a few simple Geeknote examples (to simplify it, I didn't add tags or notebooks):
$ geeknote create --title "Testing geeknote"
Note has been successfully created.

$ geeknote edit "Testing geeknote"
Note has been successfully saved.
$geeknote create --title "Testing geeknote 2"
Note has been successfully created.

$ geeknote find geeknote
Search request: intitle:geeknote
Total found: 2
1 : 22/09/2014 15:23 Testing geeknote
2 : 22/09/2014 15:24 Testing geeknote 2

$ geeknote show geeknote
Total found: 2
1 : 22/09/2014 15:23 Testing geeknote
2 : 22/09/2014 15:24 Testing geeknote 2
0 : -Cancel-
: 1
################## TITLE ##################
Testing geeknote
=================== META ==================
Created: 22/09/2014 15:23
Updated: 22/09/2014 15:24
----------------- CONTENT -----------------
A simple test note created using Geeknote.

And a screenshot:


For how to use Geeknote, see its documentation.


Install Geeknote


Before proceeding, please note that Geeknote doesn't work with Ubuntu 12.04 / Linux Mint 13 because of an issue with the Evernote SDK for Python.

Debian / Ubuntu / Linux Mint (and derivatives) users can install Geeknote by using the commands below:
sudo apt-get install git python-thrift python-bs4 python-oauth2 python-html2text python-sqlalchemy python-setuptools
cd && git clone https://github.com/VitaliyRodnenko/geeknote.git
cd geeknote
sudo python setup.py install --record installed_files.txt
(the first command installs the required dependencies - there are 2 dependencies which aren't available in the Ubuntu repositories, but Geeknote automatically downloads and installs them)

To be able to remove Geeknote later on, make sure you don't delete the installed_files.txt file.

Arch Linux users can install Geeknote via AUR.

For other Linux distributions or Mac OS X, see the Geeknote GitHub page.

Once installed, authenticate Geeknote with Evernote by using the following command:
geeknote login
Note: Geeknote asks for a two-factor authentication code but if you didn't set this up with Evernote, simply press Enter.

Then, check out its documentation to see how to create/edit notes, change the default editor, etc.


How to remove Geeknote in Debian / Ubuntu / Linux Mint


To remove Geeknote (assuming you installed the app using our instructions and you didn't delete the "installed_files.txt" file), simply use the following command:
sudo xargs rm -v < ~/geeknote/installed_files.txt
(if you moved the installed_files.txt file, make sure you edit its path in the command above)
Read more »

Monday, October 19, 2015

Video Downloader `youtube-dl` Gets Support For Separate Audio And Video YouTube DASH Streams

YouTube uses Dynamic Adaptive Streaming over HTTP (DASH) for delivering videos and along with that, it serves the audio and video in two separate streams for some resolutions/formats. For instance, resolutions like 1080p and 480p are available only with separate audio and video streams.

youtube-dl, a popular command line tool for downloading videos from YouTube and other similar websites, was updated recently with proper support for DASH and separate audio and video streams: the tool can now automatically combine / merge / multiplex the audio and video formats offered by YouTube.

Here's an example via cynic.cc for downloading separate audio and video streams from YouTube and combining them automatically using youtube-dl (which uses ffmpeg or avconv under the hood):

"Now, if you want a 480p video in H.264 format, High profile, with 128kbps AAC audio (this used to be Youtube's format 35), you can specify format -f 135+140 on the command-line and it will download both the audio, the video and multiplex it with ffmpeg (or avconv, depending on what you have installed)."

And that's not all, a lot of other improvements and fixes are added daily to this command line download tool.

For instance, since our previous article about youtube-dl, the downloader received support for many websites, including: Vevo, 9gag, discovery.com, vk.com, southpark.de, myspace.com, vube.com, vesti.ru, stream.cz, ndr.de, onf.ca, Dropbox and so on, along with many fixes and improvements.

For those not familiar with youtube-dl, this command line video downloader not only supports hundreds of websites, but it can also extract the audio automatically, download playlists, download and embed subtitles into videos and more.


Install youtube-dl in Ubuntu


The latest youtube-dl 2014.02.17 is available in the Ubuntu 14.04 Trusty Tahr repository but it wasn't backported for older Ubuntu versions. Install it via Ubuntu Software Center or by using the following command:
sudo apt-get install youtube-dl

For older Ubuntu versions (though I also recommend it for Ubuntu 14.04), you can install youtube-dl by using the main failsdownloads PPA.

As a reminder, I update youtube-dl from the failsdownloads PPA a few times a week, so if YouTube or another website make changes that break it, run an update and it's very likely that a new youtube-dl version will be available, which fixes the issues.

To add the main failsdownloads PPA and install youtube-dl in Ubuntu and derivatives (Linux Mint, elementary OS and so on), use the following commands:
sudo add-apt-repository ppa:nilarimogard/failsdownloads
sudo apt-get update
sudo apt-get install youtube-dl

If you don't want to add our PPA, you can manually download the deb from the PPA by visiting THIS link.

For other Linux distributions, you'll find installation instructions HERE.


Using youtube-dl to download videos


To download a video, simply use the following command:
youtube-dl http://VIDEO_URL
where "VIDEO_URL" is the url of the video you want to download.

If you don't use any parameters, youtube-dl tries to download the best format. For YouTube, by default it downloads the best non-DASH format, which usually is 720p mp4 for YouTube.

So here's how to download 1080p YouTube videos using youtube-dl:


How to download 1080p YouTube videos using youtube-dl


1. Firstly, get a list of formats. I'll use a random video link as an example below:
youtube-dl -F http://www.youtube.com/watch?v=3JZ_D3ELwOQ

This will list all the available formats:
youtube-dl -F http://www.youtube.com/watch?v=3JZ_D3ELwOQ
[youtube] Setting language
[youtube] 3JZ_D3ELwOQ: Downloading webpage
[youtube] 3JZ_D3ELwOQ: Downloading video info webpage
[youtube] 3JZ_D3ELwOQ: Extracting video information
[info] Available formats for 3JZ_D3ELwOQ:
format code extension resolution note
171 webm audio only DASH webm audio , audio@ 48k (worst)
140 m4a audio only DASH audio , audio@128k
160 mp4 192p DASH video
133 mp4 240p DASH video
134 mp4 360p DASH video
135 mp4 480p DASH video
136 mp4 720p DASH video
137 mp4 1080p DASH video
17 3gp 176x144
36 3gp 320x240
5 flv 400x240
43 webm 640x360
18 mp4 640x360
22 mp4 1280x720 (best)
As you can see, for 1080p there's only a DASH video available (format 137) and two separate DASH audio files (formats 140 and 171).

2. To get the best video quality (1080p DASH - format "137") and best audio quality (DASH audio - format "140"), you must use the following command:
youtube-dl -f 137+140 http://www.youtube.com/watch?v=3JZ_D3ELwOQ
"-f 137+140" specifies the format: 137 (which means mp4 1080p as you can see above) for video and 140 (which means m4a audio@128k) for audio, as displayed by the command under step 1.

youtube-dl

To see all the available options (extract audio, choose a different video quality, download a video playlist and many many other options), type the following commands in a terminal: "man youtube-dl" or "youtube-dl -h".
Read more »

Sunday, October 18, 2015

Peerflix: Stream Torrents With VLC Or MPlayer Via Command Line

Peerflix is an experimental video streaming BitTorrent client for Node.js. The tool can be used to stream video torrents via command line and play the stream with your favorite video player, such as VLC or MPlayer.

Peerflix Ubuntu VLC

Peerflix supports supports setting the maximum number of connections, changing the port, loading subtitles and more.

The application even supports streaming torrents with multiple video files, although I'm not sure if the video files are played in order (if you try it, let us know in the comments).

Peerflix is actually what Popcorn Time uses under the hood, but you can use it separately so you can stream any video torrent and use any video player you want.


Install Peerflix in Ubuntu


Peerflix should work with most Linux distributions, but the instructions below are for Ubuntu only. For other Linux distributions, install Node.js, then install Peerflix using "npm install -g peerflix".

1. To install Peerflix in Ubuntu, firstly you'll have to add the Node.js PPA and install nodejs:
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs

2. Next, install Peerflix using the following command:
sudo npm install -g peerflix

Update -> Arch Linux users can install Peerflix via AUR: stable | git.


Optional: Firefox integration (via Pinguy)


Pinguy shared some tweaks for integrating Firefox with Peerflix for both regular torrents and magnet links. Using these tweaks, you'll be able to open torrent files and magnet links from Firefox with Peerflix and directly play them with VLC.

Below you can watch a quick video I recorded a few minutes ago, demoing Peerflix (with VLC) streaming torrents directly from Firefox:


(direct video link)


To set up these tweaks, use the instructions below (requires VLC).

Setting this in Chrome is more complicated, here's an example.

1. Firstly, install vlc, xterm, python-libtorrent and wget:
sudo apt-get install vlc xterm python-libtorrent wget

2. To be able to open torrent files from Firefox and play them with VLC via Peerflix, use the commands below:
wget https://raw.github.com/hotice/failsdownloads/master/Torrent-Video-Player -O /tmp/Torrent-Video-Player
sudo install /tmp/Torrent-Video-Player /usr/local/bin/
Then, open your web browser and click a video torrent. When it asks what app to use, select Other and browse for /usr/local/bin/Torrent-Video-Player

3. For Magnet Links support, use the commands below:
wget https://raw.github.com/danfolkes/Magnet2Torrent/master/Magnet_To_Torrent2.py -O /tmp/Magnet_To_Torrent2.py
sudo install /tmp/Magnet_To_Torrent2.py /usr/local/bin/
wget https://raw.github.com/hotice/failsdownloads/master/Magnet-Video-Player -O /tmp/Magnet-Video-Player
sudo install /tmp/Magnet-Video-Player /usr/local/bin/
And just like above, open Firefox, click a magnet link, select Other and browser for /usr/local/bin/Magnet-Video-Player


Using Peerflix


Using the extra tweaks above, you basically don't have to do anything else. But if you want to use Peerflix manually (for instance, to use your favourite video player), here's a quick guide.

To stream a torrent with Peerflix and play it with VLC, use the following command:
peerflix http://some-torrent/movie.torrent --vlc
(replacing "some-torrent/movie.torrent with the link to a video torrent file)

Example:
peerflix http://download.stefan.ubbink.org/ToS/tears_of_steel_1080p.webm.torrent --vlc

To automatically play the video in MPlayer instead of VLC, use the following command:
peerflix http://some-torrent/movie.torrent --mplayer

If you don't want to use VLC or MPlayer, simply don't append "--vlc" or "--mplayer" to the Peerflix command. Example:
peerflix http://download.stefan.ubbink.org/ToS/tears_of_steel_1080p.webm.torrent

Peerflix

Then open some video player like Totem for instance, select to open location and enter the location displayed by Peerflix ("http://192.168.1.6:8888/" in my case - see screenshot above).

It's also worth mentioning that you don't have to use a torrent link - you can use Peerflix with a locally saved torrent file too:
peerflix somevideo.torrent

Peerflix also supports setting the maximum number of connections, changing the port, loading subtitles and more. Here's the complete list of options:
$ peerflix --help
Usage: peerflix torrent_file_or_url [options]

Options:
-c, --connections max connected peers [default: 100]
-p, --port change the http port [default: 8888]
-i, --index changed streamed file (index)
-t, --subtitles load subtitles file
-q, --quiet be quiet
-v, --vlc autoplay in vlc*
-m, --mplayer autoplay in mplayer**
-o, --omx autoplay in omx**
-j, --jack autoplay in omx** using the audio jack
--clean remove the tmp buffer file after peerflix closes
--path change buffer file path

*Autoplay can take several seconds to start since it needs to wait
for the first piece
*OMX player is the default Raspbian video player
Read more »

Saturday, October 17, 2015

Command Line YouTube Player `mps-youtube` Sees New Release(s)

mps-youtube was updated to version 0.2.2 (and shortly after to 0.2.3) recently, bringing some interesting new features, like an option to use an external application for downloading YouTube videos, metadata tagging of downloaded audio files and more.

mps-youtube

mps-youtube is a a command line tool to search, play and download YouTube videos, which supports both local and YouTube playlists.

By default, mps-youtube is basically a YouTube audio player, but it can also serve as a YouTube video player (and downloader), by enabling external video playback (officially, it supports mpv and mplayer for video playback) from its options.

What makes mps-youtube special is the easy to use command line interface, the integrated YouTube search and the ability to download and play only the audio stream, great for those with limited data plans. Here's a list of the most important mps-youtube features:
  • search and play audio / video from YouTube;
  • search tracks of albums by album title;
  • search and import YouTube playlists;
  • create and save local playlists;
  • download audio / video from YouTube, including option to download full YouTube playlists, with support for DASH (so it can mux separate audio and video streams - that means it can download 1080p YouTube videos since all 1080p YouTube videos use DASH) - requires avconv or ffmpeg;
  • transcode audio to mp3 and other formats (requires ffmpeg or avconv);
  • system notifications;
  • view video comments;
  • works under Linux, Windows and Mac OSX;
  • many other small but useful features.

Now back to mps-youtube 0.2.2 (and 0.2.3, which was released shortly after 0.2.2). Probably the most important new feature is the addition of an option which allows setting an external application for downloading YouTube audio/video. This means you can use something like aria2, which supports multiple connections

To set mps-youtube to use aria2, firstly make sure aria2 is installed:
sudo apt-get install aria2
And then use the following command in mps-youtube to set the external download command to aria2:
set download_command aria2c --dir=%d --out=%f %u
For instance, to set the download_command to aria2 and use 4 connections, use:
set download_command aria2c -s4 -x4 --dir=%d --out=%f %u
For more info about this, type "help dl-command" in mps-youtube.

It's important to mention that using an external download command does not support (at least for now) transcoding the downloaded file to another format directly from mps-youtube.

Other changes in mps-youtube 0.2.2 and 0.2.3:
  • implemented skip to previous track. Use > and < keys for next and previous track, q for quit (was ctrl-c). mpv / mplayer input.conf can be imported to use custom keymappings;
  • implemented metadata tagging of downloaded audio files (requires ffmpeg or avconv). This feature is not complete and currently, it uses the YouTube video title as metadata;
  • the stream quality is now displayed in the status line;
  • fixed progress bar for mpv 0.7;
  • fixed YouTube comments overshoot window size;
  • fixed issue with audio remux when using d download command;
  • fixed issue with "set" command.



Install mps-youtube


Arch Linux users can install the latest mps-youtube via AUR.

mps-youtube is available in Ubuntu 14.10 and 15.04 repositories as well as Debian Sid and Jessie however, that's an older version so if you want to install the latest version in Ubuntu, Debian, Linux Mint and so on, you can use PIP:

1. Install Python PIP (requires Python 3):
sudo apt-get install python3-pip

2. Install mps-youtube using Python PIP:
sudo pip3 install mps-youtube

3. You'll also need either mpv or mplayer(2) if you want to play audio or video via mps-youtube.

mpv is available in the official Ubuntu 14.04, 14.10 and 15.04 repositories as well as in Debian Jessie and Sid so to install it, use the following command:
sudo apt-get install mpv

The mpv version in Ubuntu is pretty old so if you want to install a newer version, you can use Doug McMahon's mpv PPA.

Of course, you can also use mplayer2, which is available in the official repositories for any Ubuntu / Debian version - install it using the following command:
sudo apt-get install mplayer2

If you had mps-youtube installed and you want to upgrade it (or you want to upgrade it later on, when a new version is released), use the following command:
sudo pip3 install mps-youtube --upgrade


For Windows and Mac OS X installation instructions, bug reports and so on, see the mps-youtube GitHub page.


Configuring and using mps-youtube


To start mps-youtube, use the following command:
mpsyt

Before using mps-youtube, you'll need to configure it, in case you won't like the defaults.

mps-youtube 0.2.3 uses mpv as the default media player but you can change this to mplayer2 by using the following command:
set player mplayer
(that's not a typo, the mplayer 2 executable is "mplayer").

By default, mps-youtube searches for music only. If you want to disable this, use the following command:
set search_music false

Also, mps-youtube plays only the audio by default so if you wish to enable playing videos (using the player set above), run the command below (once again, after running "mpsyt"):
set show_video true

You can view all the available configuration options by using the command below:
set

mps-youtube

Searching for music / videos using mps-youtube is as easy as adding "." or "/" in front of the search terms (without the quotes). For instance, to search for Volbeat, you can use:
.volbeat
or:
/volbeat
You can navigate to the next / previous page of results by using "n" (next) and "p" (previous).

To play an item, enter its number. You can also play multiple items, for instance, use "1-5" to play items 1 to 5 or "1, 2, 6" to play the first, second and sixth item and so on.

mps-youtube

To download an item, use:
d ITEM-NUMBER
For example, to download the 3rd search result, use "d 3" - this displays all the available audio and video formats and lets you choose which to download (see screenshot above). You can also download the best audio (use "da ITEM-NUMBER") or best video (use "dv ITEM-NUMBER"). This works for both searches and playlists.

This is just to get you started so for more information on using mps-youtube, type "h" and then "help TOPIC" (where topic is "basic", "search" and so on) as explained in mps-youtube:

mps-youtube
Read more »

Thursday, October 15, 2015

Betty Is Like Siri Or Google Now For The Command Line (Translates Plain English Into Commands)

Betty is like Siri or Google Now for the command line. Well, sort of. The tool translates plain English into commands: it displays the command it runs and obviously, the command output, in the terminal.

Betty isn't voice controlled so you still have to type your (plain English) commands but if you want, it can speak the command output.

Betty command line

Betty's mission is, according to its GitHub page, to "provide a way to use computers through natural language input":

"Specifically, the benefit is being able to do things on your computer without leaving the command line or screwing around on the internet trying to find the right command. Betty just works".

For example, if you can't remember the exact compress and uncompress commands (and avoid sittuations like THIS), you can simply ask Betty to do it:
betty uncompress archive.tar.gz
Of course, the commands supported by Betty at this time is pretty limited since the tool is under two weeks old, but it should improve quite fast since it's not that hard to add new commands (and there are 17 contributors already).

Betty 0.1.5 supports a wide variety of commands, such as:
  • count (number of characters in a file, number of words in a directory, etc.);
  • config (change your name);
  • datetime (current time, date, etc.);
  • Find (find in files);
  • Internet / web queries (download some file, find out what's the weather like, etc.);
  • file / directory operations (compress/uncompress files, show file size, change permissions, etc.);
  • processes;
  • user commands (what's my username, real name, ip address, who else is logged in, etc.);
  • control iTunes and Spotify;
  • more.

Here are a few Betty examples:

$ betty whats my username
Betty: Running whoami
andrei

$ betty how many words are in gnome3 
Betty: Running find gnome3 -type f -exec wc -w {} \; | awk '{total += $1} END {print total}'
214

$ betty download http://cdimage.ubuntu.com/daily-live/current/utopic-desktop-amd64.iso to ubuntu-14.10-daily.iso
Betty: Running curl -o ubuntu-14.10-daily.iso http://cdimage.ubuntu.com/daily-live/current/utopic-desktop-amd64.iso

$ betty give me permission to this directory
Betty: Running sudo chown -R `whoami` .

$ betty turn web mode on
Betty: Web queries ON
$ betty whats the weather like in Bucharest
Asking the internet...
Betty: Bucarest, Bucuresti: It is currently patchy light rain in area with thunder, 63 Fahrenheit

$ betty turn web mode on
Betty: Web queries ON
$ betty translate "command line" to Spanish
Asking the internet...
Betty: Línea de comandos

And of course:
$ betty whats the meaning of life
Betty: 42.

A complete list of supported commands is available @ GitHub (under Documentation).


Install Betty in Linux


1. Install Ruby (required to use Betty) and curl (required by some Betty commands). In Ubuntu, install them using the following command:
sudo apt-get install ruby curl

2. Install git and download the latest Betty using the following commands:
sudo apt-get install git
cd && git clone https://github.com/pickhardt/betty

Or, to download Betty without using Git, grab THIS archive, extract it in your home folder and rename the extracted folder to "betty".

3. And finally, you'll have to add the path to the "betty/main.rb" file as an alias for "betty" in your ~/.bashrc file. Do this automatically (assuming you've downloaded Betty in your home folder!) by using the following commands:
echo "alias betty=\"~/betty/main.rb\"" >> ~/.bashrc
source ~/.bashrc

To contribute, submit bug reports, check out the latest code and the official installation instructions, see the Betty GitHub page.

Read more »

Wednesday, October 14, 2015

mps-youtube Migrates To YouTube API v3, Gets Ubuntu Sound Menu Support

mps-youtube 0.2.4 was released today and with this version, the app was migrated to YouTube API v3. This is an important change because the old v2 API was shut down recently so previous mps-youtube versions no longer work.

Another important change in this release is the addition of MPRIS v2 support, which means that mps-youtube can now make use of Ubuntu's Sound Menu, GNOME Shell Media Player Indicator extension and so on.


mps-youtube is a command line YouTube audio player which supports both local and YouTube playlists (with built-in YouTube search).

By default, the app plays only the audio (it only downloads the audio stream, great for those with limited data plans) however, you can enable video playback from its options and in this case, mpv or mplayer is used to play the videos (other players might work, but only mpv and mplayer are officially supported).

Other mps-youtube features include downloading YouTube audio/video (including 1080p videos) - either single videos or complete YouTube playlists, transcode audio to mp3 and other formats (requires ffmpeg or avconv), optional system notifications as well as many other small but useful features.


mps-youtube 0.2.4


The latest mps-youtube 0.2.4 brings support for Data API v3, an important change because the old v2 API was shut down recently so previous mps-youtube versions no longer work.

Another important change in mps-youtube 0.2.4 is the addition of MPRIS v2 support. This allows integrating mps-youtube with the Ubuntu Sound Menu, GNOME Shell Mediaplayer Indicator extension and others.

To get this to work with the Ubuntu Sound Menu (used by default in Ubuntu w/ Unity and Xubuntu), you need to install a desktop file for mps-youtube. To speed things up, I created a desktop file for you and to install it, along with an YouTube icon, simply use the following commands (or download it from HERE and install it manually):
sudo apt-get install wget
cd /tmp
wget https://github.com/hotice/failsdownloads/raw/master/mps-youtube.tar.gz
tar -xvf mps-youtube.tar.gz
sudo cp /tmp/mps-youtube/youtube.png /usr/share/pixmaps/
sudo desktop-file-install /tmp/mps-youtube/mps-youtube.desktop
Then, start playing a song/video in mps-youtube and it should show up in the Ubuntu Sound Menu:


For GNOME Shell Mediaplayer Indicator extension, mps-youtube doesn't need a desktop file and it should work without any tweaks:


Besides these changes, mps-youtube 0.2.4 includes bug fixes:
  • Fix issue with rate-limiting in "album" command
  • Fix display issue with small terminal width

For how to install and configure mps-youtube, see THIS article.
Read more »

Tuesday, October 6, 2015

PeerTV: Command-Line Tool To Manager And Play TV Series From EZTV Via Peerflix

PeerTV is a command line tool for manage and play TV series from EZTV.it. It uses Peerflix to stream the torrents and by default, the videos are played with mpv, but that can be changed from the PeerTV configuration file.

Peertv

For those not familiar with Peerflix, this is a an experimental video streaming BitTorrent client for Node.js which can be used to stream video torrents via command line and play the stream with your favorite video player, such as VLC or MPlayer.

PeerTV allows you to easily keep track of your watched / unwatched episodes: each viewed episode is automatically marked as seen and you can manually mark/unmark episodes as viewed - and of course, you play them with the help of Peerflix, with subtitles support.

For downloading subtitles, PeerTV uses subliminal, a Python library and command line tool which supports subtitle websites such as Addic7ed, OpenSubtitles, Podnapisi, TheSubDB and TvSubtitles.

Important note: PeerTV uses Peerflix to stream TV shows from torrents and that may be illegal in your country. Use at your own risk!


Install PeerTV


1. PeerTV depends on bash, sed, wget, rt, sqlite3, peerflix, mpv (or some other video player), and optionally: subliminal and notify-send.

In Ubuntu / Linux Mint, most of these should be installed by default and for the rest, use the following commands to install them along with python-pip, which we'll use to install subliminal (and "git", to get the latest PeerTV under step 3):
sudo apt-get install wget git sqlite3 python-pip mpv libnotify-bin
sudo pip install subliminal

2. You'll also need Peerflix - for how to install Peerflix, see THIS article.

3. And finally, download and install PeerTV using the following commands:
cd && git clone https://gitorious.org/peertv/peertv-bash.git
cd peertv-bash
sudo PREFIX="/usr/local" make install

You can also download PeerTV manually from HERE.

Later on if you want to update PeerTV, navigate to its directory (assuming you've used the commands above, it should be in your home folder):
cd ~/peertv-bash

And update it using the following commands:
git pull
sudo PREFIX="/usr/local" make install

Arch Linux users can install PeerTV via AUR.


Configure PeerTV


The first time you run peertv (so run "peertv" in a terminal), it creates a configuration file under: ~/.config/peertv.conf

To see all the available configuration options, run the following command:
peertv config

To change some configuration options, use:
peertv set <configuration> <value>

For instance, to set the default subtitle language to English, use:
peertv set subtitle en
Modify these configuration options to suit your needs - as you can see, here you can set the video player to use for playing TV episodes (but, depending on the video player you set, you'll also need to change the other "MPLAYER_" options!), port (for instance, I already had something running on port 8888 so I had to change it to 8887 to get PeerTV to work), and so on.


How to use PeerTV


For the commands below, I'll use "Game of Thrones" with the "thrones" shortname as an example - replace these with the TV shows you want to add.

To use it, firstly visit the EZTV show list at https://eztv.it/showlist/, copy the show link (Game of Thrones in our example) and add it to PeerTV, like this:
peertv add thrones https://eztv.it/shows/481/game-of-thrones/
("thrones" can be anything and it will be used as the shortname for the TV series - Game of Thrones in this case)

Next, update the series with magnet links from EZTV using the command below:
peertv update thrones
(or, use "all" instead of "thrones" to update all the TV series you've added)

You can list all the episodes of a series by using the command below:
peertv list thrones

You can mark episodes as viewed using the following command (the command below marks Game of Thrones episode 1 from season 1, as seen):
peertv mark thrones 1x1

You can also mark multiple episodes - here's an example in which you'll mark all episodes up to season 3 episode 6 as viewed (from Game of Thrones):
peertv mark thrones "<3x6"

To view all the PeerTV available options, run:
peertv help

More examples, etc. available at PeerTV's Gitorious page.
Read more »

Command Line YouTube Player `mps-youtube` Gets YouTube Playlists Support, More

mps-youtube, a command line tool to search, play and download YouTube videos with local playlists support, has received quite a few changes since our previous article about it. The most important new feature is YouTube playlist support: you can now search and play YouTube playlists.

mps-youtube
Searching YouTube playlists in the latest mps-youtube

Unfortunately, mps-youtube doesn't yet support downloading complete YouTube playlists, but hopefully this will be added in a future release.


Here are the most important changes in mps-youtube since our previous article (current version: 0.1.38)
  • added prompt to mux audio on m4v download;
  • faster opening of audio streams;
  • added "pls <query>" command to search for YouTube playlists;
  • added "pl <playlist url>" command to open YouTube playlist url;
  • added "dlurl <YouTube url>" command for directly downloading a YouTube video;
  • added "playurl <YouTube url>" command for directly playing a YouTube video;
  • added "url <YouTube url>" command for retrieving a specific YouTube video;
  • added "i<number>" for YouTube playlist information display;
  • added stream url preloading for first item of opened YouTube playlists
  • same playlist file is now shared between Python2.7+ and Python3+ (was separate);
  • list user uploads using "user <username>";
  • other changes and many bug fixes.

mps-youtube
YouTube playlist loaded in mps-youtube


Install mps-youtube


Debian update: mps-youtube is now available in Debian unstable thanks to Zlatan Todoric: mps-youtube so install it using:
sudo apt-get install mps-youtube

For Ubuntu, see below.

1. mps-youtube can be installed using pip. To Install pip in Ubuntu, use the following command:
sudo apt-get install python3-pip

2. Then install mps-youtube using pip:

sudo pip3 install mps-youtube

3. You'll also need mplayer, which you can install using the following command:
sudo apt-get install mplayer

To upgrade mps-youtube, use this command:
sudo pip3 install mps-youtube --upgrade

Arch Linux users can install mps-youtube via AUR.

If you want to use this with MPV, you can install it in Ubuntu (Saucy and Trusty) by using THIS PPA.

mpsyt is also available for Windows and Mac OS X. See its GitHub page for installation instructions.


Usage


Start mps-youtube by typing the following command in a terminal:
mpsyt

To search for a video on YouTube, prefix your search with either "." or "/". Or, search for an YouTube playlist by using the command below:
pls <query>

You can see all the available commands by typing "h" in the mpsyt shell.

More on using pms-youtube in our previous article

For bug reports, feature requests, etc., see the mps-youtube GitHub page.
Read more »