Archiv für mp3

Nützliches aus der Konsole / Useful stuff from the terminal – Part 1 – m3u playlist script (multi-language)

Posted in GNU/Linux/FLOSS, Music, Terminal with tags , , , , , , , , on 10. Januar 2010 by bausparfuchs

Hier stelle ich in unregelmäßigen Abständen nützliche Skripte und kleine Befehlsschnipselchen vor, die mir mal irgendwann zugeflattert sind und die ich nicht mehr missen möchte.

This series is about to introduce some useful scripts or code snippets that I found once and that I never want to miss anymore.

Wer ein großes Musikarchiv sein eigen nennt und viele Unterordner (bspw jeweils ein Album) in dieser Sammlung hat, der hat eventuell irgendwann den Wunsch nach Playlisten im m3u Format, die jeden einzelnen Ordner zusammenfassen.  Dafür habe ich in diesem Beitrag auf Ubuntuusers.de vor langer Zeit eine Lösung gefunden, die ich seitdem benutze. Für jeden Ordner wird eine m3u-Playlist angelegt und im selben Ordner gespeichert. Das ganze wird aus einem Startverzeichnis angeleiert und arbeitet sich rekursiv durch alles durch.

Sicherlich noch anpass- und erweiterbar, aber mir reicht es.

Who owns a big music archive and has many sub-folders (e.g. one album per folder) in this collection, may have the wish to easily create playlists in the m3u format for each folder. Therefore I  found a nice script in this post on Ubuntuusers.de long ago, that I use from time to time. For each folder, a m3u playlist is created and stored in the same folder. The whole thing is started from a directory and recursively works its way through all sub folders.

Certainly still  improvable, but good enough for me.

Achtung: Bitte darauf achten, dass manche Zeilen von der Blogsoftware umgebrochen werden. Die müssen natürlich in einer Zeile stehen, damit das Skript funktioniert.

Attention: Please take care about the lines which are broken by my blog software. In order to get the script working you have to write them in a single line.

#!/bin/bash</span>
<pre>
INPUTDIR="$1"

cd "$INPUTDIR"

INPUTDIR="$PWD"

cd "$OLDPWD"

filedir=""

OLDIFS="$IFS"

IFS=$'\n'

for filepath in $(find $INPUTDIR -type f -name '*.mp3' -print | sort); do

IFS="$OLDIFS"

oldfiledir="$filedir"

filedir="$(dirname "$filepath")"

filename="$(basename "$filepath")"

if [ "$oldfiledir" = "$filedir" ]; then

echo $filename >> "$filedir/$(echo $filedir | awk -F/ '{ print $(NF-1) " - " $NF }').m3u"

else

rm -f "$filedir/$(echo $filedir | awk -F/ '{ print $(NF-1) " - " $NF }').m3u"

echo $filename > "$filedir/$(echo $filedir | awk -F/ '{ print $(NF-1) " - " $NF }').m3u"

fi

done

exit

[Guide] How to get your IPOD (and other media devices) work with Amarok 2 [Update]

Posted in GNU/Linux/FLOSS, Ipod, Music, Technology with tags , , , , , , , , , , , on 4. Januar 2010 by bausparfuchs

First I want to thank all people who helped me (through comments, the ubuntuusers.de Community or hints on IRC or identi.ca/twitter) to improve this article and those who will do that at any later time.

Note: Because the way how Amarok deals with media devices is generally the same for every kind of supported device, you can skip the IPOD-only stuff here and just try the „6-Step“  guide below. The steps are the same for other devices. Please understand that I focus on the IPOD here, and that I can’t write as much about other devices. Maybe I will improve the Guide with these information in the next months. For further questions about other devices and their support state, use the ways, the links at the end of this article will provide.

As some of you may know, I’m a frequent Amarok user and try to contribute as much as I can for that project. Hanging around in the project’s IRC channel #amarok on Freenode brings some problems to my eyes which are asked very often. One of that is a question like  „How can I manage my IPOD in Amarok 2“ and similar questions with the same topic.

Since I am an IPOD user too (lemme say that I would never ever buy an apple device again ;-)) I noticed that most of these questions result from two things:

  1. It’s not well documented how Amarok 2 plays together with IPODs. (Which might become better, when I finish this article)
  2. Most users seem to believe that some extra configuring or clicking is needed to set up the IPOD. As some of you remember, in Amarok 1.4 there was a separate configuration window for media devices, which is not there anymore in Amarok 2. Thus, the existing guides which only discuss the IPOD stuff for Amarok 1.4, are not usable anymore. If one does not see such a Menu/Box/Configuring dialogue, he might  think there was something wrong by default and so he comes to IRC and asks around. They simply don’t believe that the whole thing should work out of the box.

For that reason I decided to write a simple guide to help those people with a single link instead of giving the same explanations all the time.

Starting requirements:

  • Amarok 2 (either an official binary release from your distro, or compiled from sources, but then you have to ensure that libgpod is recognised by cmake. Cmake will tell you that at the end of configuring)
  • latest libgpod (either binary or compiled from source. Sources can be found at the Gtkpod project
  • One of the IPODs that are supported by libgpod. (see next chapter)

There may be Issues which are not Amarok or libgpod related which I can’t discuss here. Though I think it’s recommended to try this guide first to see if it works. If it fails, you could have a look at the end of the article where I put some links.

Supported Devices [2010-01-07]

A lot of various IPOD models are supported by libgpod, and so they are in Amarok. I am not completely sure but As far as I know every IPOD which is using mass storage for its content will work fine, except from the buttonless „Shuffle“ variants in their 3rd and 4th generation. A bit different are the „IPOD touch“- and „iPhone“ devices which are in general (not completely yet) supported by libgpod, though amarok will have problems with them.

The iPhone / IPOD touch issue

Although libgpod (at least from GIT) works with those devices (not perfectly yet, but usable) amarok will have Problems to see them.
To be displayed inside of amarok, every device needs to be recognised by Solid which currently doesn’t see the iPhone or IPOD touch. Unfortunately there is no other way to tell amarok manually that there is a device plugged in. These information I got from „marcan“ on IRC. However, according to Christophe Fergeau („teuf“), that might not be fully correct:

Teuf: there’s an iphone OS collection which seems to detect iphones ok, so it’s misleading to say solid doesn’t detect the iphone imo. Maybe it’s the ifuse mount it can’t detect

As soon as I will get any further information about that issue, I will certainly write it down here.

As a workaround you can use Gtkpod, which is also a great IPOD managing program  to manage your touch device, since these devices should be usable with it.

Here is what you have to do to get your IPOD (or other device) rediscovering your music:

  1. Plug in your IPOD
  2. Mount your IPOD
  3. Have a look at Amarok’s collection Browser. The IPOD should immediately appear in there, like on that Picture:
    Collection View with IPOD

    Collection view with IPOD

    It might be that Amarok doesn’t see a correct DB on the IPOD (dunno why that happens sometimes) and it will create a new one. If that happens it would be good to empty the IPOD using a file browser to avoid messing up the device. As an alternative you can right-click on the IPOD in the collection view and „Search for old and orphaned Tracks“ which will show up in the new DB and you can delete them.

    Orphaned Tracks on IPOD

    Find Orphaned Tracks

  4. Search a Song, an album or a whole artist from your „local collection“ which you want to have on the IPOD and do a right-click on it:

    Copy to collection

    The "copy to collection" dialogue

  5. Select the above-shown option „copy to collection“ –> IPOD from the list and see the Sons being transferred onto the device. Look at the progress bar:

    Progress bar - click to enlarge

  6. Once transferred your songs the only thing you have to do is to unmount your IPOD (may take some time until the syncing wheel on the display disappears) and enjoy  your Music.

To delete songs you just have to right-click them on the IPOD in the collection view and choose „delete“.

That should be enough to get the basic function from your IPOD. There is way of improvement needed but as my own programming skills are very low-level I can hardly do something myself at the moment. Amarok’s IPOD dev Alejandro (XEVIX) is very busy and so we have to wait either for him to get more free time which he wants to spend with Amarok, or for me to get better in programming (what should happen in the next months) or for an other guy who hacks that stuff into Git.

What is not working with the IPOD?

As far as I can say (Amarok 2.2.1 stable) the following is not working yet:

  • Rating Sync from IPOD to Amarok. (The other way round works)
  • Transferring Playlists from Amarok to IPOD and vice versa. (important thing)
  • Last.fm scrobbling of played songs if the IPOD appears on Amarok (my „most wished feature“ ;-))
  • Native podcast transferring (You can copy Podcasts onto the IPOD if you download it with amarok and transfer it from the built-in file browser in Amarok, the same way we did it above. (Downloaded Podcasts are stored in ~/.kde/share/apps/amarok/podcasts)
    Currently there is a patch for that available which was committed to GIT after the 2.2.2 feature freeze. Therefore it will not be in 2.2.2 stable. You can apply the patch manually and compile amarok from sources. There is an other solution on the way, which will fix the issue the right way. Bart Cerneels is working on that. If that solution is ready before 2.2.3 feature freeze, we will most likely get native podcast support with 2.2.3 which should come up around the beginning of march 2010.
  • Picture, Video, Audio Books (don’t miss those features)
  • Compilation support (figuring out how that works, maybe I could fix that soon)
  • Play count syncing with amarok (don’t even know if that is possible)
  • IPOD Touch/iPhone: Support depends on the  development of libgpod, don’t know whats the state and I don’t even care 😉 Support for these device is given by libgpod but there is an issue which makes them not usable in amarok. I described that issue above.

My IPOD still doesn’t work, what to do?

As I wrote above, there may be Issues which are not Amarok or libgpod related which I can’t discuss here. (e.g. might there be problems with a hfs+ formatted IPOD (Apple file system) For such general issues have a look at those links. If anyone has other good related links, please tell me.

  • For the Ubuntu/Debian people a few good articles around basic IPOD Linux setup can be found at the (German) Ubuntuusers.de – Wiki.
  • Here is the official Ubuntu Wiki with their mobile devices section.

Last but not least there are still some other good places to get help for Amarok

  • The awesome amarok IRC channel: Click to start Web chat!
  • The great German amarok IRC channel: Click to start Web chat!
  • The famous Amarok identi.ca group: !Amarok
  • The incredibly helpful Amarok Forum (multi-language)
  • The fantastic multi-language amarok wiki, where the also fantastic, but not „Amarok 2“-fitting IPOD article needs a rewrite.
  • Our friend Google, to find the various forums, mailing lists and blogs, where you can find helpful entries for amarok.

I hope my small guide will help some of you. And please don’t forget to give me improvement tips.

Now go and rediscover YOUR Music with Amarok 2!