Saturday, November 02, 2013

Getting along with the old eMusic Download Manager for Linux

I've been a loyal eMusic customer for about five years, and I've been a non-proprietary OS man in my home for a lot longer than that, so I've dealt with the pain you're feeling, and I'm going to help you through it.

So you just upgraded to the latest Fedora/Debian/Ubuntu/whatever, and you can't get the old eMusic DLM working anymore?  Yeah, that happened to me too, but I fixed it.

If you just upgraded to Fedora 19, my help will be completely trouble-free for you.  Otherwise, you may need to adapt these instructions and possibly the package itself to your OS's needs.  If your OS doesn't use RPM, you should be able to do this with just the tarball that eMusic is still providing, or if they've stopped providing even that, you can install some RPM tools on your system and extract the archive from this RPM I'm providing.

Step 1) Install Firefox and the rpm-build package.  We're going to build an RPM in order to exploit its automatic dependency determination, and subsequently YUM's automatic dependency installation.  And Firefox because the old eMusic DLM only works w/Firefox, afaik.
        # yum install firefox rpm-build
The old DLM only works with Firefox, as far as I know.  I haven't been able to get it to work otherwise.

Step 2) Download the old eMusic Download Manager" in tarball format.  We're going to make an RPM.
        # wget http://www.emusic.com/apps/dlm/emusic_linux_current.tar.gz
Step 3) Create rpmbuild/SPECS and rpmbuild/SOURCES directories in your home directory
        # mkdir -p rpmbuild/{SPECS,SOURCES}
Step 4) Move the emusic_linux_current.tar.gz file into the new SOURCES directory.
        # mv emusic_linux_current.tar.gz rpmbuild/SOURCES
Step 5) Create a file called emusic-dlm.spec in the rpmbuild/SPECS directory with the following content:
%define userid          root
%define groupid         root
%define version         4.1.4
%define rel             4
%define debug_package   %{nil}
%define prefix          /opt/emusic/%{version}

# This should be set to the first two directories from the
# emusic_linux_current.tar.gz tarball, but without the leading slash.
%define archivelead     builds/emusicdlm 

Summary: eMusic Download Manager
Name: emusic-dlm
Version: %{version}
Release: %{rel}
License: Proprietary
Packager: It was All Me!
Group: Commercial
Source: emusic_linux_current.tar.gz
BuildArch: i686
BuildRoot: %{_tmppath}/%{name}-buildroot
AutoReqProv: yes

%description
The download manager for eMusic.  Set your firefox preferences to use
/opt/emusic/4.1.4/emusicdlm as the handler for emusic download files.

%prep

%setup -q -n %{archivelead}

%build

%install
rm -rf ${RPM_BUILD_ROOT}
mkdir -p ${RPM_BUILD_ROOT}/%{prefix}
cd ${RPM_BUILD_DIR}/%{archivelead}
find . | cpio -dumpv ${RPM_BUILD_ROOT}/%{prefix}

%clean
rm -rf ${RPM_BUILD_ROOT}

%files
%defattr(-, %{userid}, %{groupid}, -)
%{prefix}


%post

%postun

%changelog

You should now have the following files below your home directory:
rpmbuild/SPECS/emusic-dlm.spec
rpmbuild/SOURCES/emusic_linux_current.tar.gz
Step 6) Create the RPM using the rpmbuild command:
        # setarch i686 rpmbuild -ba rpmbuild/SPECS/emusic-dlm.spec
You should now have an RPM in the rpmbuild/RPMS/i686 directory called emusic-dlm-4.1.4-4.i686.rpm.
Step 7) Install the RPM and its dependencies using YUM
# yum localinstall rpmbuild/RPMS/i686/emusic-dlm-4.1.4-4.i686.rpm
Step 8) Configure Firefox to use /opt/emusic/4.1.4/emusicdlm for .emx files by opening Firefox and going to this URL, which will plant a cookie in the browser indicating that the DLM has been installed.

Step 9) Click on a download link for a song or album.  When presented with the "0.emx" file, choose "Open with", and browse to /opt/emusic/4.1.4/emusicdlm.  Also be sure to click on "Always do this".