Install ID3V2

From AwkwardTV
Jump to: navigation, search

Prerequisites

1st Generation, Apple TV

SSH and SCP access to the Apple TV.

gcc installed (see: http://wiki.awkwardtv.org/wiki/Install_gcc). Make sure you install all of the optional files and create the links (ln -s) before you start. If you don't do these steps, you will get a lot of errors.

id3lib package. This is available at sourceforge (http://sourceforge.net/projects/id3lib/). This document refers to version 3.8.3.

id3v2 package. This is available as sourceforge (http://sourceforge.net/projects/id3v2/). This document refers to version 0.1.12.

This document was based on an Apple TV that is running 3.0.2, although that may not make a difference.

Installation

Use SCP (or some other means) to copy the two id3 packages (id3lib and id3v2) to the Apple TV. They can be copied to any usable location. For these instructions, it is assumed they were copied to the ~/Downloads directory. Upon completion, this folder may be deleted.

Enter a root shell

sudo bash

the password should be frontrow.

The id3lib package must be installed before the id3v2 package.

Extract the package.

tar xvfz id3lib.3.8.3.tar.gz

Enter the resulting directory

cd id3lib3.8.3

Run the configure script

./configure

This should run for a few seconds and error out with: configure: error: Missing a vital header file for id3lib. This is fixed with some minor modifications to three files.

First, edit the configure file to remove the reference to iomanip.h, the offending file. Open the file in a text editor, search for iomanip.h in the file, delete it, and save the file.

nano iomanip.h
<ctrl-w>, then type iomanip.h
delete 'iomanip.h'
<ctrl-o>
<enter>
<ctrl-x>

Second, edit the include/id3/id3lib_strings.h file to include a reference to string.h

cd include/id3
nano id3lib_strings.h

just below the #include <string> add the following line:

#include <string.h>

Save the file and exit

<ctrl-o>
<enter>
<ctrl-x>

Third, edit the include/id3/writers.h file to include a reference to string.h

nano writers.h

34 lines down is a line that reads //#include <string>. Those two slashes indicate a comment. Remove the two slashes at the front so line line now reads #include <string.h>.

Save the file and exit

<ctrl-o>
<enter>
<ctrl-x>

Back up to the top directory of the package

cd ../..

Re-run the configure program and it should run to completion (with no errors)

./configure

Make the final library files. This will take about 5-10 minutes.

./make

If all goes well, this will run and end with another error: demo_info.cpp:312: error: first argument of 'int main(unsigned int, char* const*)' should be just int. This error is occurring in the example code. We could force the compiler to bypass these files by removing references to 'examples' in the make file. Let just fix this error quickly in case you want to use the examples. You will need to remove the word unsigned from that line and three others.

Enter the examples directory

cd examples

Fix the first problematic file

nano demo_info.cpp
<ctrl-w>, then type "int main" (without the quotes)
delete 'unsigned'
<ctrl-o>
<enter>
<ctrl-x>

Repeat the above process with demo_convert.cpp, demo_tag.cpp, and demo_copy.cpp.

Back out one directory and install the resulting libraries

cd ..
make install

The first package is installed. Now it is time to build and install the next package with the executable.

Extract the id3v2 package

cd ~/Downloads
tar xvfz id3v2-0.1.12.tar.gz

Enter the resulting directory

cd id3v2-0.1.12

Before we begin building the package, clean up some files that come with the package and may cause problems

make clean

The installation process will attempt to put the executable in its final location. The default location does not exist and is not useful. We need to edit the Makefile to put it in the right directory. Four lines down is the line PREFIX= /opt/local. That needs to be changed to PREFIX= /usr/local.

nano Makefile

Go down 4 lines and replace opt with usr.

Save the file and exit

<ctrl-o>
<enter>
<ctrl-x>

Now make our package

make

DONE.

You can confirm it works by returning to the home directory and trying the new command. The following should print the help details to the screen

cd
id3v2

If you want to have some real fun, go into one of the media folders and run the command on a file.

cd /mnt/Media/Media\ Files/

Pick a folder and cd into it. Now run the idv32 on a file and look at the tag data.

id3v2 -l <filename>

To clean up the build files, do the following. Note that this will remove the id3lib examples folder that may be useful for building scripts or other code using these packages.

cd ~/Downloads
rm -rf id3lib-3.8.3*
rm -rf id3v2-0.1.12*

Acknowledgments

This as largely developed by pulling together bits and pieces from others, whether they know it or not.

marcthenarc @ ubuntuforums.org -- how to fix the ./configure iomanip.h problem.