Showing posts with label music. Show all posts
Showing posts with label music. Show all posts

Friday, September 20, 2013

The best podcast app for Android: AntennaPod


It's about time! I've been looking for a decent Android podcast app for a while. The only ones I've seen up to this point are either:
  • Free but really lousy
  • Decent but cost $7
But my search is finally over.

Say hello to AntennaPod. It has all you'd need and want in a podcast app, plus it has a nice, clean interface, no ads, and it's free. There really isn't much more to say. Check it out, and if you like it, send the developer a buck or two.

Here's what the interface looks like so you can see for yourself:

Enjoy!

Wednesday, September 4, 2013

MP3s ripped from CDs in Ubuntu have incorrect track length

If you rip a CD in Ubuntu 12.04+ using the default program provided for this (Rhythmbox), the track lengths will be incorrect. This is because by default, Ubuntu will rip your mp3s using VBR, but it doesn't add the VBR headers.

Rather than go into the details, here's the easiest way to fix it:
  1. Install vbrfix by running this command in a terminal:
    sudo apt-get install vbrfix

  2. Now CD to the folder where the mp3s are that you need to fix:
    cd /path/to/mp3s

  3. Run this command to add the VBR headers to the mp3s:
    find . -type f -iname '*.mp3' -exec vbrfix {} {} \;

  4. Vbrfix seems to leave behind a couple of temporary files, so clean them up:
    rm vbrfix.log vbrfix.tmp
Another option would be to change the default preset to make it CBR. You can read more about doing that here: How do you edit the “Preferred Format” settings in Rhythmbox? Something like this ought to do the trick (change the bit rate as desired):
[mp3-cbr]
name=lamemp3enc
target=bitrate
bitrate=192
cbr=true
encoding-engine-quality=high
mono=false
You can read the details of the problem at this bug report:
Rhythmbox does not add VBR headers when ripping CDs to MP3

Saturday, August 24, 2013

Import playlists into Google Play Music


I've already covered getting playlists out of Google Play Music, but what if you want to import your playlists into Google Play Music? The easiest way to do this would probably be to get your playlists into iTunes or Windows Media Player and use Google's Music Manager to sync your playlists.

Being a Linux user, that's not the best option for me, so I came up with another way. This one's not for the faint of heart, so be sure you've got some time on your hands and lots of patience. Here we go:

  1. Just like my method for exporting playlists from Google Play Music, importing them will require a rooted Android device. The exact method for doing this varies by device, so you'll need to Google it.

  2. This may seem obvious, but first of all you need to make sure all of your music is in Google Play Music. It can take a while, so if you haven't done this you should probably get crackin. These links should help:

  3. Remove any music stored on your Android device's internal memory or SD card. This isn't absolutely necessary, but if you don't do this, any music in the playlists you wish to import that's on your device may not get added to Google Play Music playlists in the cloud.

  4. Get the playlists to import. This step will vary widely depending on where the playlists are coming from. You'll want your data file to contain the following fields:
    1. Playlist name
    2. Artist
    3. Title

    Based on the tools I've used to import data into a Sqlite database, I'd recommend that the data is in one of these formats:
    • A text file where each row is on one line, the fields are separated by a unique character (like the pipe symbol: |), and the fields aren't quoted. For example:

      Folk|Gregory Alan Isakov|Dandelion Wine
      Folk|Gregory Alan Isakov|That Moon Song
      
    • A Microsoft Excel XML file. You don't need Excel to create this; free programs such as LibreOffice Calc work fine.

  5. Make sure all of your tracks and playlists on your Android device are synced with Google's servers. I've already documented this; see step 1 in my post on exporting playlists from Google Play Music.

  6. Optional, but strongly recommended: back up Google Play Music. My app of choice for doing this is Titanium Backup (the free version will suffice, although I think it's worth paying for).

  7. Get the Google Play Music database file (music.db). The instructions for this are also in my post on exporting playlists from Google Play Music (step 2).

  8. Open the music database file. You can use a tool such as Sqliteman, or you can use the sqlite3 command in a terminal, like so:
    sqlite3 /path/to/music.db

  9. Import your playlists into the database file. This is where it gets fun!
    1. Create temporary tables
      create table "temp" ("Playlist Name" text, "Artist" text, "Title" text);
      create table "temp2" ("Playlist Name" text, "Artist" text, "Title" text, "ClientPosition" integer primary key autoincrement);

    2. Import the data. This will vary depending how your playlists are formatted and what program you're using. If you're using Sqliteman:
      • In the menu go to Database --> Import Table Data...
      • Table to Import Into --> select temp
      • File to Import --> Search... --> browse to your playlist file
      • Select an appropriate separator under Column Separators
      • Under Preview, you should see three columns with playlist name, artist, and title
      • Click OK

      If you're using the sqlite3 command:
      • Define the separator between fields. If it's a pipe (|), you can skip this step. For example, to set the separator to a dollar sign:
        sqlite> .separator $
      • Then import the file (things will be easier if the file name doesn't have spaces):
        sqlite> .import /path/to/playlists.txt temp

    3. Before we actually import the playlist entries, this query will show you what's actually going to get imported:
      select temp."playlist name", temp.artist, temp.title from music join temp on music.artist=temp.artist and music.title=temp.title;

    4. If some of your songs don't show up in the above query, then they either aren't in Google Play Music, or the artist or title aren't spelled the same. If you want at this time, upload or rename any missing music. If you decide to fix any missing music, you'll have to start over at the step above where you make sure the music on your Android device is synced with Google's servers.

    5. Copy the data from the temp table to the temp2 table (the temp2 table is my hack to keep the playlist order):
      insert into temp2 ("playlist name", artist, title) select * from temp;

    6. Now, we're finally ready to create the playlists. If you already have playlists in Google Play Music with the same names as the ones you're importing, you can skip this step. Here's the query (the _sync_dirty part is what tells Google Play Music that the data needs to be synced to the cloud):
      insert into lists ("Name", "_sync_dirty") select distinct "Playlist Name", '1' from temp2;

    7. We've created the lists, now we need to import the data into them:
      insert into listitems ("MusicId", "ListId", "ClientPosition", "_sync_dirty") select music.id as musicid, lists.id as listid, clientposition, "1" from music join temp2 on music.artist=temp2.artist and music.title=temp2.title join lists on "playlist name"=lists.name;

    8. Clean up after ourselves:
      drop table temp;
      drop table temp2;

  10. Just to be safe, turn off internet on the Android device (whether it's wifi or data)

  11. On the Android device, kill the Google Play Music app by going to the home screen --> Menu --> Settings --> Application manager --> scroll down and click on Google Play Music --> Force stop

  12. Copy the music.db file you modified back to the device's SD card

  13. Copy the music.db file from the SD card back to /data/data/com.google.android.music/databases

  14. This part can be tricky. Copying music.db back will probably mess up the permissions, which means at this point if you were to open the Google Play Music app, it would probably crash. To fix the permissions, you need to either use the command line or use a file explorer app that's capable of modifying the permissions. For these instructions, I used File Explorer by NextApp with the Root Add-On:
    1. Long-press on one of the other files in the folder, like music.db-journal --> Permissions
    2. Make a note of the Owner and Group
    3. Now long-press on music.db --> Permissions
    4. Click on Owner --> App --> change it to the same owner as the other file you just looked at. You'll see a Google Play Music icon beside the owner, which will confirm you're picking the right one.
    5. Repeat the same thing for the group.
    6. This isn't completely necessary, but you can also uncheck all of the boxes in the Exec column, and uncheck the Global box in the Read column. In the bottom left it should say Octal: 0660.
    7. Click OK --> OK.

  15. Phew, we're almost there! Now open the Play Music app, and go to Playlists. Scroll down and you should see the playlists you imported (if you don't, make sure you're viewing All Music instead of music On Device). Open the playlists, and you should see all the songs you imported.

  16. Lastly, if everything looks good, go ahead and connect your device to the internet again, and follow the step you did above on making sure your music's synced with Google's servers.

  17. To make sure your playlists are on Google's servers, go to music.google.com and your playlists should be there. If they don't show up, don't worry. Give it some time, try syncing from the Play Music app again, and refresh the page. It can take a little bit to sync.

Wednesday, March 13, 2013

Spotify Linux woes

spotify

I recently (okay, almost 2 months ago) updated Spotify on my Ubuntu Linux machine, and the new version is having lots of problems:
  • Dragging from search results into a playlist crashes spotify

  • Dragging items to the top or bottom of a playlist crashes Spotify

  • Artist radio isn't working (or it's taking so long to load that I gave up waiting)

  • Searching doesn't display instant search results like it used to
My solution: downgrade spotify. Here goes:
(Note: I'm running Ubuntu 12.04 64-bit. If you're using 32-bit Ubuntu replace "amd64" in steps 3 and 6 with "i386". If you're using a different version of Ubuntu or a different flavor of Linux, you're on your own.)

  1. First, completely quit spotify. Make sure you click on the icon and click Exit if it's in the system tray

  2. Run this command in a terminal to make sure you've got the problematic version of Spotify:
    dpkg -l spotify-client
    The output should include this line:
    ii spotify-client 1:0.8.8.323.gd Spotify desktop client

  3. Download the previous version of spotify by running this command in a terminal:
    wget http://packages.bodhilinux.com/bodhi/pool/stable/s/spotify/spotify-client_0.8.4.103.g9cb177b.260-1_amd64.deb

  4. Uninstall the current version:
    sudo dpkg -r spotify-client

  5. Move the cache folder out of the way:
    sudo mv ~/.cache/spotify/ /tmp

    Note: if you don't do this, you might get this error when running spotify:
    Missing Dependencies
    Framework compatible with bridge-desktop (version 0.7.0) does not exist.

  6. Install the previous version:
    sudo dpkg -i spotify-client_0.8.4.103.g9cb177b.260-1_amd64.deb

    If you get this error:
    dpkg: error processing spotify-client (--install):
    dependency problems - leaving unconfigured

    run this command to fix it by installing any missing dependencies:
    sudo apt-get -f install

  7. To keep spotify from being upgraded again to the broken version, run this command:
    grep -r repository.spotify.com /etc/apt/sources.list* | egrep -v "\.(save|distUpgrade):deb" | cut -f 1 -d :

  8. The previous step should output one or more files. Edit them and put a pound sign (#) in front of any occurrences of this line:
    deb http://repository.spotify.com stable non-free

    Like so:
    #deb http://repository.spotify.com stable non-free
Now spotify should work, at least as well as it did before ;)

Tuesday, September 11, 2012

Export playlists from Google Play Music


After some brief googling, I was unable to find out a way to export playlists from Google Play Music, so I just figured it out for myself.

In order to do this, your Android device must be rooted, otherwise you won't have access to the music database file where the playlists are stored.

If you don't have an Android device, there's a chance you could use the android emulator from the Android SDK. You'd have to find an .apk file for the Google Play Music app, which shouldn't be too hard.

  1. First, make sure all of your tracks and playlists are synced with Google's servers:
    1. Install the Google Play Music app on the Android device. If it's already installed, open up the Google Play Store app, go to Menu --> My apps, and if it's in the list of updates, update it.

    2. Connect your Android device to the internet (data or wifi)

    3. Open the Google Play Music app

    4. This step will probably change as Google continues to update the app, but essentially you want it to show all of your music in the cloud and refresh it. The current way to do this is:

      At the top left of the app, make sure it says All music. If it says On device, tap it and change it to All music. Click Menu --> Refresh

    5. Wait for all of the tracks and playlists to sync (you should be able to see all of your playlists and music in the app)

    6. Exit the Google Play Music app by pressing the back button

  2. Next, you need to get the music database file from the Android device. The file is located at /data/data/com.google.android.music/databases/music.db. There are several ways to do this:

    • You can use a file manager app, browse to the file, copy it to your SD card, then plug the phone into your computer and copy it from there. Whichever file manager app you use, it needs root access. I'm currently using File Explorer by NextApp with the Root Add-On.

    • Using a file manager app, browse to the file and send it to yourself using whatever method is easiest for you (email, Dropbox, etc.).

    • As an Android developer, because I already have the Android SDK installed, my preferred method is to transfer the file using the Android SDK Platform Tools over the command line.

  3. Open the music.db file with your favorite SQLite database client (I prefer Sqliteman) to get the playlist data, using this query:

  4. select name as "Playlist Name", artist, title from listitems join music on listitems.musicid = music.id join lists on listitems.listid = lists.id order by "Playlist Name";

    From there you can export the data to a friendly format, such as a CSV file. To do a quick dump of the data from a Linux/Mac terminal, you can run this command:

    sqlite3 music.db 'select name as "Playlist Name", artist, title from listitems join music on listitems.musicid = music.id join lists on listitems.listid = lists.id order by "Playlist Name"' > playlists.txt

There are a lot of other columns available, such as album. to get the full list, just replace everything in the query from select to from with *, i.e. select * from listitems...

Enjoy!

Thursday, January 19, 2012

Why Linux?

Let's be honest, sometimes when I'm using Linux I get pretty frustrated. Especially with distributions like Ubuntu who have been focusing so much on new bells and whistles that they've been lackadaisical when it comes to fixing bugs.

...and then I have to use Windows for something or other (normally gaming), and I'm reminded why I use Linux in the first place. So I thought I'd write down some of the advantages, for myself, if nothing else:

  • No more viruses! (or spyware)
    Not only do you not have viruses in Linux, an even bigger advantage in my opinion is that you're not dedicating gobs of processor and memory to antivirus/antispyware software. This is all the more important on older/slower computers.

  • It's free!
    Free as in you can see the source code and modify it however you like, as well as free as in cost, Which you'll remember next time you have to purchase a retail copy of any Microsoft software. Which brings me to my next point...

  • No more licenses/activation!
    Have you ever tried installing Windows and the key wouldn't work because it was a Dell key with OEM media? Or installed office only to discover you've misplaced your key? Since Linux itself as well as most Linux software is free, so no licenses to fuss with!

  • Less rebooting
    Not much needs to be said about the ridiculousness of having to reboot a "modern" operating system (windows) every time it's updated. With Linux, you only need to reboot when updating the kernel. And even then, it doesn't nag you every 15 minutes to reboot.

  • More security
    Linux gets security patches every day, not once a month like Windows.

  • No more startup cramming
    Windows computers gradually get slower the longer you use them, because half of the programs you install (Adobe Reader, Office, iTunes, even Google software) decide they want to run at startup. Not so with Linux.

  • Less use of system resources
    Unlike the latest version of Windows, the latest versions of Linux will actually run on old computers, especially if you use a lightweight desktop environment like Xfce, LXDE, or Enlightenment.

  • Easier software acquisition/updates
    Want to install software in Linux? Almost everything you need is simply an apt-get (or yum) away! This includes codecs, which can be annoying to hunt down in Windows. Software is also automatically updated via the centralized package manager.

  • Easier development
    Everything you need for development is available through a package manager as well (C compiler, JRE, git, etc.). Python? Already comes with Linux. Plus, development software integrates much better in Linux because the terminal isn't just an afterthought like it is in Windows.

  • Automation
    This is more important for servers than for desktops, but every single task in Linux can be automated with free software (Python, shell scripting, Puppet...).

  • Nicer font rendering
    With windows 7, Microsoft is finally starting to catch up, but Linux has had much nicer font rendering for a long time now.
Next time I'm annoyed with Linux I can look at my list and remember life could be worse--I could be using Windows ;)