How to Stream Music from Linux PC to iPhone over Wifi

posted in: Linux Archives | 1

There are endless possiblities to stream music from your computer to your phone over wifi, but few dedicated howtos that walk you through the process step by step.

Option 1: UPnP

Universal Plug and Play (UpnP) is developed by the Digital Living Network Alliance (DLNA) and has interoperateability in mind. See Make Use Of for a list of possibilities.

  • Server: Subsonic

    Client: pick one from http://www.subsonic.org/pages/apps.jsp. VLC also works as a client, see https://askubuntu.com/a/109083/80611
    I use play:Sub, another $5
    I also tried Gerbera

    • Add Gerbera-ppa. If you ar not using ubuntu (but, say, Debian or Bunsenlabs) see astarix for help.
    • Install Gerbera. apt-get said “Unable to correct problems, you have held broken packages. Used aptitude instead (see here)
    • Failed.

    Option 2: DAAP

    Easy, cheap, but flawed.

    • Server: Install Rhythmbox → open plugins → enable “DAAP Music Sharing” (obviously install if it is not there) → right click → properties → enter name and tick “Share my music”. Done.
    • Client: Install “Simple DAAP” from app store. Open, find your server, done. I keep getting error -1004 and even though the phone can see the server it does not connect. Since DAAP is a proprietary protocol invented by…Apple, you would expect that there are options. But as there’s no native app that can do it and Simple DAAP is the only lonely player in the field, there aren’t. Except of course you find a broken android phone, install Music Pump (costs) or DAAP media player (free) and in under the minute you’re dancing around the house streaming.

    Hat tip: Lifewire

    Video

    Interestingly it was easier to setup video streaming than audio (use vlcstreamer, see upubuntu).

Mendeley Migration

posted in: Linux Archives | 0

Alreet.Sometimes Mendeley content has to move. There’s no easy way to tell Mendeley that. So.

  1. sudo apt-get install sqlitebrowser
  2. cd ~/.local/share/data/Mendeley\ Ltd./Mendeley\ Desktop/
  3. sqlitebrowser <you@whatever>@www.mendeley.com.sqlite
  4. Go to »Execute sql«-tab
  5. update Files set
    localUrl = replace(localUrl, 'file:///old/path/‘, 'file:///media/new/path/‘);
  6. click »Execute« (or F5 or ctrl+return)
  7. click »Write changes«
  8. Done. Easy, right?

Thanks to 3.14a and jordi’s comment there. For related Mendeley grievances see khufkens, who can tell you how to sync Mendeley to your own server (instead of feeding Elsevier’s questionable pricing model).

Connect Crunchbang Linux to Bluetooth Speaker

posted in: Linux Archives | 0


I got myself one of these and after setting it up properly I must say that while I am a bit disappointed by the reach, I am very impressed with the sound quality for this kind of money (a white label apparently as »C26« sells under various brands and for different prices).

Anyway, the whole setup was a true Linux afternoon, reminding me of my NDISwrapper-days, just like it was 2006 again.

First, It took me a while to get crunchbang to discover the device and connect [1] (Blueman works much better as a bluetooth manager). Then apparently I manually needed to let pulseaudio know where to send the audio [2]. Atfer fiddling with some files, pulseaudio was broken, so I needed to reinstall [3]. Finally, the sound was much poorer than via my phone. I don’t know if I overlooked it or if loading rtirq changed something [4], but in the volume control center of pulseaudio there is a tab called »configuration« where I had to choose »High Fidelity Playback (A2DP)« to get decent sound (instead of »Telephony Duplex (HSP/HFP)« or »off«). Now most of the times it changes to the Bluetooth-device automatically once I switch it on and back when I switch it off. Sometimes not. But hey.

The sources I used were these:

  1. How to make pulseaudio bluetooth-ready: http://askubuntu.com/a/223203/80611
  2. How to switch the sink in pulse audio: http://askubuntu.com/a/108882/80611
  3. How to clean up after you screw up (which I did), i.e. reinstall pulseaudio: http://askubuntu.com/a/435221/80611
  4. How to improve the sound once it works but reminds you of a telephone: http://askubuntu.com/a/520384/80611 and https://wiki.ubuntu.com/UbuntuStudio/rtirq

 

Automatically batch rename photo files

posted in: Linux Archives, Photography | 0

Following Robert Seale’s advice, I was looking for a solution to batch rename photo files. After my last shoot I used digikam and while the results were as desired, it took a second or more per image, which I thought a bit long. After not finding a different suitable solution I asked the question on unix.stackexchange and was overwhelmed by two people’s in-depth answers. I learned a lot from both mikserv and Gilles and in the end settled with Gilles’ suggestion. I take zero credit for the solution, I don’t even understand parts of what is going on, but I amended it a little bit nonetheless and thought the extended version might help someone.*

Preliminaries

What I get when I come home is file names looking like this: _DSC1234.NEF. What I wanted instead was

  1. date-shot in YYYYMMDD-format plus
  2. a descriptive shoot-name plus
  3. image-number

looking like this: 20140708_WeddingAdamAndEve_0001.NEF

There are a few issues with this:

ad 1. Date Shot: sometimes I can only copy and rename the files a few days after shooting, so the date should reflect the date the picture was taken, not the date it was copied. Getting date-shot from the file itself is difficult as there is no birth time recorded. The closest is mtime which is the time the file’s content has last been modified. However, creation date is stored in image file’s EXIF data.

ad 2: Name of Shoot: Ideally I wanted this to be a variable I could set as a parameter when calling the script.

ad 3. Number of Image: This should reflect the age of the image with the oldest one having the lowest number. The problem is that cameras usually restart numbering at  0000 once they hit  9999. So images n-9999 can potentially be older than 0000-n. I needed a solution that would cater for this special case.

 

The code

# original solution by @Gilles (http://unix.stackexchange.com/questions/141138/)

# set base path and navigate to &quot;basepath + parameter 1&quot;
BASEPATH='/media/data/photo/';
cd $BASEPATH$1

# add &quot;EXIF creation time&quot; as prefix to original file names
exiv2 mv -r %Y%m%d-%H%M%S:basename: *.NEF
# Now we have files with names like 20140630-235958_DSC1234.NEF.

# final rename
i=10000
for x in *.NEF; do
   i=$((i+1))
   mv &quot;$x&quot; &quot;${x%-*}_$2-${i#1}_Copyright-Jan-Soehlke.NEF&quot;
done

 

Walkthrough

Line 4: Here we set our base path. We choose the highest directory ever useed to store pictures.

Line 5: Navigate to base path + parameter 1. If our script is called rename and the pictures are in /media/data/photo/weddings/adam+eve, then we call the script through

./rename weddings/adam+eve

Line 8: In a first iteration we add EXIF-creation time as a prefix to the original file names. We use exiv2 for this operation. -r is for rename and we use YYYYMMDD-hhmmss, which is %Y%m%d-%H%M%S in strftime(3), plus :basename: to keep the original filename after the time stamp.

Through creation time as a prefix we now sort files by age, even if the files would sort differently by name. This could happen if during a shoot we reach 9999 and the camera’s counter continues at 0000 or if we shot with two different cameras.

By also retaining the original file name for now, we make sure that in case there are multiple files with the same time stamp, they still have individual names. EXIF time’s finest unit is a second, so if we fire bursts of images (Nikon’s D4s for example shoots at 11 frames/second), we have multiple files with the same creation date and thus potentially 11 files with the same name.

Line 12: The counter variable i counts from 10000 and is used with the leading 1 digit stripped; this is a trick to get the leading zeros so that all counter values have the same number. If you want more (or less) than four digits, set i accordingly.

Line 15: ${x%-*} removes everything that follows the - character, in our case it is hours, minutes and seconds as well as the original filename. ${i#1} writes the new four digit file number.

$2 provides a second variable, which we use for the shoot name. In this case we want it to be WeddingAdamAndEve, so we call the script through

./rename weddings/adam+eve WeddingAdamAndEve

Finally, I added _Copyright-Jan-Soehlke. It not only reminds someone who downloads the file that it is indeed copyrighted, it also helps with SEO as my name is automatically associated with each image I upload.

 

Possible Problems

a) The original file names already have a - in place. In this case change the  - in line 8 to something different (like _) and use the same character in the ${x%-*}-part in line 15 (in this case ${x%_*}, otherwise the script will not work as intended.

b) A burst of images reaches across the 9999/0000-mark. These specific files will not be in order after renaming – but they weren’t in order in the first place, so I have no idea how to tackle this rare scenario other than by setting your camera’s counter to reset to 0000 after each formatting.

c) Your files do not contain EXIF data. In this case see mikeserv’s solution which uses a different angle of attack and is thoroughly and well explained.

 

___________________________

* Stackexchange uses the CC-BY-SA license, so all the code in this example is naturally also CC-BY-SA.

Crunchbang on x200s

posted in: Linux Archives | 0

Through a few very lucky coincidences I received a Thinkpad x200s a few days ago and set it up with Crunchbang which must have been the most straightforward os-installation ever. Two Three Four things though:

Rawtherapee

A slightly outdated version is in debian’s repositories, but if you want a newer one, go to »Kbyte’s Hideout«. Download .deb package and dpkg -i rawtherapee_<xxx>.deb

If there are unsolved dependencies: apt-get install -f and then  dpkg -i rawtherapee_<xxx>.deb

Picasa

Well.

It still is the most straightforward programme I know for editing, simple retouches and exporting smaller sizes. I’m not happy with wine, I’m not happy with a google tool, but I cannot and cannot find an alternative (see here). Hence:

before following the webupd8 tutorial I needed
apt-get install libwine-cms:i386
After installation, use
cd ~/.wine/drive_c/Program\ Files/Google/Picasa3 && wine Picasa3.exe
to launch it.

If you would then create a script called »picasa« somewhere, say in ~/scripts containing the following:

#!/bin/bash

cd ~/.wine/drive_c/Program\ Files/Google/Picasa3 &amp;amp;amp;&amp;amp;amp; wine Picasa3.exe

exit 0

Picasa can then be launched from command-line with a simple »picasa« after a final
sudo ln -s ~/scripts/picasa /usr/bin/picasa

Clock

To change the format from Hour:Minute open ~/.config/tint2/tint2rc and consult strftime-man to change to your liking.

Change Key Bindings

Keyboard shortcuts can be changed in ~/.config/openbox/rc.xml

After saving, go to Openbox menu > Preferences > Openbox Config > Reconfigure. (Thanks, MysteryMember)

MTPFS FAIL

posted in: Linux Archives | 2

My ubuntu 12.04 computer cannot see my Android 4.1.2 phone, instead I must install go-mtpfs and control it via command line. Thankfully, Andrew over at webupd8 provides all the necessary tools (all credit goes to him, for long version see there):

sudo add-apt-repository ppa:webupd8team/unstable
sudo apt-get update
sudo apt-get install go-mtpfs

Optional:

sudo apt-get install go-mtpfs-unity

Mount:

go-mtpfs /media/MyAndroid

Unmount:

fusermount -u /media/MyAndroid

Ironic that I should now need a special programme to mount my one Linux device on my other Linux device while windows works out of the box…

Network Sync

posted in: Linux Archives | 0

I recently got my hands on a shiny eee-PC for surprisingly little money. As I am travelling a fair bit at the moment, the opportunity was more than welcome. Now, mobility comes at a price and the price is called »multiple instances of files«. When the files in question are your PhD, it has the potential for a fantastic nightmare. Most people use dropbox to tackle this, but for one reason and another, I neither want to use that, nor ubuntu one. I have owncloud [see here], and after resolving some issues, the sync client works, but I still would like to keep more data in tune then I could possibly channel through my shared hosting plan. Unison (via ssh) seems the way to go.

Setting it up was a lot easier then I though. All it took was rbgeek’s exccellent article »File Synchronization Between Two Ubuntu Servers using Unison«.

Falko Timme’s article »Setting Up Unison File Synchronization Between Two Servers On Debian Squeeze« at howtoforge was also helpful. Another insightful article is Chris Lale’s »Synchronising laptop and desktop files using Unison« at Sourceforge.

One issue: normally your device gets an IP address automatically from your router. Unison settings depend on the IP address (for ssh connection), so if the IP address changes, Unison gets confused. Thus, we want a static IP address on the remote machine. Johnathan Hobson’s »Networking Tips and Tricks« are a good start. The settings that finally worked for me I got via chili555’s post on ubuntuforums. Using Netman’s GUI, I set:

Method: Manual

Address: 192.168.0.9

Netmask: 255.255.255.0

Gateway: 192.168.0.1

DNS Servers: 8.8.8.8, 192.168.0.1

Search domains:

I understand little, but what I do understand is this:

  • »address« needs to be outside the router’s scope. Mine is configured to start at 10, so I picked 9.
  • »gateway« simply seems to be the router’s ip-address
  • »DNS-Servers«: no clue why 8.8.8.8, the other again seems to be router’s ip address

You can easily determine the router’s ip-address and the scope for auto DHCP from the router’s admin interface.

Other useful information and resources

SSH

Unison

Alternatives

 

[article started in January 2013; final, rewritten version from January 2014]

Overheating Thinkpad T60

posted in: Linux Archives | 2

Since 12.04 my thinkpad (T60) regularly shuts down due to heat. I don’t like it and I am afraid of damage – to hard drives or to the system.

The problem is described in many places and many different fixes, remedies and work arounds exist. Most of them lack proper documentation, so I am reluctant to try them. Even thinkfan, which is quite popular, scares me more than it helps.

Here is a collection of relevant information I found:

  1. Bug report at launchpad
    https://bugs.launchpad.net/ubuntu/+source/linux/+bug/751689
  2. Show temperatures of all sensors
    cat /proc/acpi/ibm/thermal
  3. Show Speed of fan
    cat /proc/acpi/ibm/fan
  4. Thermal Sensors
    http://www.thinkwiki.org/wiki/Thermal_sensors
  5. List of ways to control fan speeds at Thinkwiki.org
    http://www.thinkwiki.org/wiki/How_to_control_fan_speed
  6. Thread at askubuntu
    http://askubuntu.com/questions/178467/thinkpad-fan-control-error
  7. Howto at NeoLocus
    http://blog.neolocus.com/2012/07/lenovo-thinkpad-x61-temperature-and-fan.html
  8. Howto at thinkwiki.de [in German]:
    http://thinkwiki.de/Thinkfan

For now I went with #7 (thinkfan howto by Neolocus), and I do hear a substantial difference in fan activity – but I am still scared.

xubuntu 12.04

posted in: Linux Archives | 0

Way too many issues with a first attempt drove me to the decission to reinstall. I had a look around and made eye contact with fedora, arch and debian but in the end thought I’d give a clean xubuntu installation a second chance – and I did not regret it. Here goes:

1. Installation from LiveUSB

First surprise:No issues. Only: apparently all of a sudden my computer needs a /boot partition, so my partition map looks like this:

1. primary   ext2    254MB   /boot
2. logical   swap   4000MB
3. logical   ext4   <rest>   /

2. Dual Screen under xubuntu

sudo apt-get install arandr...   READ MORE

Deny Internet in Ubuntu

posted in: Linux Archives | 0

I have phases in my work cycle, where I want to limit internet access to myself. Thus, I created a »work-user« and in the user’s properties I unticked the boxes 

  • Connect to internet using a modem
  • Connect to wireless and ethernet networks
  • Use modems

I thought that should do the trick, yet it didn’t restrict internet access to this user. I tried various other things to deny access to network and web and finally found something useful at ubuntuusers.org (German):

create a file in /etc/init.d (filename doesn’t matter)

sudo touch /etc/init.d/iptab-filter.sh

Open the file you created:

sudo gedit /etc/init.d/iptab-filter.sh...   READ MORE

ffmpeg-GUI

posted in: Linux Archives | 0

I was somewhat flabberghasted when I found out my mobile phone (Sony Ericsson Cyber-shot) was unable to play .mp4, .flv, .avi and what else I tried. It refuses to play all video formats save .3gp.

I was unable to convert to this with avidemux. Google quickly told me that ffmpeg could do the trick. But being unfamiliar with bitrates and stuff I was happy indeed when I found Mobile Media Converter, which is a neat and lean GUI for ffmpeg (Mac, Linux and Win). It even sports convenient batch process via drag & drop. Have fun.

WordPress Cookie Plugin by Real Cookie Banner