Difference between revisions of "MythMusic"

From MythTV Official Wiki
Jump to: navigation, search
(Integrating with Squeezecenter)
m (RubyRipper)
(14 intermediate revisions by 6 users not shown)
Line 1: Line 1:
 
MythMusic is a sophisticated MythTV plugin that allows you to play and manage music and audio files .i.e MP3, Ogg, FLAC, wav etc.
 
MythMusic is a sophisticated MythTV plugin that allows you to play and manage music and audio files .i.e MP3, Ogg, FLAC, wav etc.
 
It is specifically designed to be operated by a normal remote control.
 
It is specifically designed to be operated by a normal remote control.
 +
 +
== Supported Formats and Containers ==
 +
 +
=== Playback ===
 +
* Audio CDs
 +
* MP2
 +
* MP3
 +
* MP4
 +
* FLAC
 +
* Vorbis Audio (OGG + OGA)
 +
* AAC (iTunes)
 +
* AC3
 +
* Wav + WavPack (WV)
 +
* Windows Media Audio (WMA)
 +
* Sony OpenMG (OMA + OMG)
 +
* Sony ATRAC (ATP, AA3)
 +
* Real Audio (RA)
 +
* Matroska Audio
 +
* Audio Interchange Format (AIFF)
 +
* True Audio (TTA)
 +
* Shockwave Audio (SWA)
 +
* And more
 +
 +
===Encoding===
 +
* MP3
 +
* FLAC
 +
* OGG Vorbis Audio
  
 
== Installing MythMusic ==
 
== Installing MythMusic ==
The best approach is to follow the installation guides for MythTV and MythMusic that have been developed for your [[Operating System]] and distribution. If you are still having problems getting MythMusic to work, see this section on [[MythMusic Installation]].
+
The best approach is to follow the installation guides for MythTV and MythMusic that have been developed for your [[Operating System]] and distribution.
  
 
==  Configuring MythMusic ==  
 
==  Configuring MythMusic ==  
Line 70: Line 97:
 
====Using Album Art====
 
====Using Album Art====
  
MythMusic is able to detect album art in mp3 files, stored as picture files within ID3V2.3 or ID3V2.4 tags (verified on MythTV 0.21). Since Myth boxes are usually connected to nice large screens, album cover art is definitely a plus!
+
MythMusic supports the display of album art found in the same directory as a music file or embedded in MP3 files with ID3V2.3 or ID3V2.4 tags.
  
As of MythTV 0.21, album art can be in jpeg or PNG format (other formats not tested), embedded in ID3v2 (2.3 or 2.4) as type "Other" in the pictures tag: avoid "leaflet" or "cover" as MythMusic won't display the cover art in that case. Album Art is only supported in MP3 files, not MP4 yet.
+
{{Note box|If you add album art onto an existing collection using software such as "EasyTag" which preserves file modification time by default, you will need to make sure the timestamp of the files is updated (use 'touch') so that Mythmusic rescans the files properly. Otherwise the album art won't appear.}}
 
+
''Note:'' if you add album art onto an existing collection using software such as "EasyTag" which preserves file modification time by default, you will need to make sure the timestamp of the files is updated (use 'touch') so that Mythmusic rescans the files properly. Otherwise the album art won't appear.
+
  
 
===Playing Music===
 
===Playing Music===
Line 216: Line 241:
 
!| Comment
 
!| Comment
 
|-  
 
|-  
|[[Image:Viz1.png|thumb|center|50px]]
+
|
 
|align="center"|  Random
 
|align="center"|  Random
 
|Switches to a different visualization for each song.
 
|Switches to a different visualization for each song.
Line 224: Line 249:
 
|Standard spectrum analyzer, as found on many MP3 players such as XMMS and WinAmp.
 
|Standard spectrum analyzer, as found on many MP3 players such as XMMS and WinAmp.
 
|-
 
|-
|align="center"|[[Image:Viz3.png|thumb|center|50px]]
+
|align="center"|
 
|align="center"| StereoScope
 
|align="center"| StereoScope
 
|Another spectrum analyzer.  Left and right channels are drawn separately.
 
|Another spectrum analyzer.  Left and right channels are drawn separately.
 
|-
 
|-
|align="center"| [[Image:Vi4.png|thumb|center|50px]]
+
|align="center"|
 
|align="center"| BumpScope
 
|align="center"| BumpScope
 
|Similar to Monoscope above, but drawn as a "raised relief" on a flat surface (3D visualization)
 
|Similar to Monoscope above, but drawn as a "raised relief" on a flat surface (3D visualization)
Line 256: Line 281:
 
|It's the GLXgears demo.
 
|It's the GLXgears demo.
 
|-
 
|-
|align="center"| [[Image:Viz11.png|thumb|center|50px]]
+
|align="center"|
 
|align="center"| Blank
 
|align="center"| Blank
 
|Useful if all you want to do is listen to music, saves potential screen burn, as well as putting less stress on your CPU
 
|Useful if all you want to do is listen to music, saves potential screen burn, as well as putting less stress on your CPU
Line 374: Line 399:
 
|-  
 
|-  
 
|align="center" |[[Image:RemoteVoldown.png]]
 
|align="center" |[[Image:RemoteVoldown.png]]
|align="center" | ]
+
|align="center" | [
 
|Volume down
 
|Volume down
 
|
 
|
Line 380: Line 405:
 
|
 
|
 
|}
 
|}
 
==Accessing your MythMusic Collection outside of MythTV==
 
Once you have your MythMusic collection organised on your mythbox, its sometimes useful to access the collection from other places or applications.
 
 
===Accessing from your Linux laptop using SSHFS===
 
 
As almost all modern Linux distributions include the SSH protocol, you can remotely mount your MythMusic files using the SSHFS file server.You will need to enable the ssh daemon on your distribution, as well as set up ssh login. Normally this is already setup. to test that you can ssh into your Mythbox just do
 
 
>ssh ''mythbox-ipaddress''
 
 
where mythbox-ipaddress is the ip address of your mythbox eg 192.168.2.16
 
The system will then prompt you to login to your mythbox.
 
 
Now to mount your mythmusic directory onto your linux laptop we need to know
 
 
1. The directory where the music files are held on your mythbox (in example below this is /local
 
 
2. The user id for the myth box  (in example below this is mythtv)
 
 
3. The ip address of the mythbox (in example below this is 192.168.2.16)
 
 
4. The the directory on your laptop that you want to mount your music files to (in example below this is /home/mythlocal)
 
 
then all you do is
 
 
> sshfs  mythtv@192.168.2.16:/local  /home/mythtvlocal
 
 
Thats it! now you can drag and drop album art to your mythmusic directory, or play the files remotely, or add and delete files all all streamed from your mythbox.
 
 
 
===Accessing from any internet browser using Webot===
 
 
You might like to try http://www.webot.com
 
 
Webot provides a proxy service to the web for all your media
 
 
===Integrating with Squeezecenter===
 
 
Sometimes its quite nice to be able to access your music collection without having to turn on your main display. An example of this is if you are using a projector, and do not want to leave this on while your are listening to your music, but you still want your sound to come out of your main audio system.
 
 
A nice solution here is to install [Squeezecenter[http://wiki.slimdevices.com/index.php/Category:SqueezeCenter]]
 
 
You will also need to install[Squeezeslave [http://wiki.slimdevices.com/index.php/SqueezeSlave], a media player that is designed for headless audio playback.
 
 
Squeezecenter/Squeezeslave also address issues people have with MythMusic UI, as it offers a much richer web enabled UI. You can now select and control and listen to your music from any web browser from a mobile phone, nokia n800 internet tablet or your laptop.
 
  
 
== Linking Pre-Existing Audio Archive with MythMusic ==
 
== Linking Pre-Existing Audio Archive with MythMusic ==
Line 463: Line 443:
 
I finally setup [[cron]] scripts to periodically attempt to sync with the laptop (using the same rsync command as above), and rerun the mythtv-itunes.pl script to keep the playlists up to date.
 
I finally setup [[cron]] scripts to periodically attempt to sync with the laptop (using the same rsync command as above), and rerun the mythtv-itunes.pl script to keep the playlists up to date.
  
I couldn't get either of these scripts to work for me so I wrote my own, please [http://www.weezey.com/2008/05/itunes-playlists-in-mythtv.html check it out here] if you're in the same boat.  - [[User:Weezey|Weezey]] 15:51, 14 May 2008 (UTC)
+
====Filename Matcher Script====
 
+
 
+
<b>Filename Matcher Script</b>
+
  
 
I wasn't happy with a couple of things that the previous scripts did, and so I started changing them here and there, and eventually most of the thing was gutted.  So here's my version of the above scripts, tested and found working on Myth 0.21.
 
I wasn't happy with a couple of things that the previous scripts did, and so I started changing them here and there, and eventually most of the thing was gutted.  So here's my version of the above scripts, tested and found working on Myth 0.21.
Line 479: Line 456:
  
 
[http://www.et.byu.edu/~bphilli7/mythtv-itunes-filename-match.pl mythtv-itunes-filename-match.pl] - [[User:Brian.phillips|Brian.phillips]] 04:52, 11 January 2009 (UTC)
 
[http://www.et.byu.edu/~bphilli7/mythtv-itunes-filename-match.pl mythtv-itunes-filename-match.pl] - [[User:Brian.phillips|Brian.phillips]] 04:52, 11 January 2009 (UTC)
 +
 +
====PHP Script====
 +
 +
I started development of an iTunes to MythMusic conversion script using the same XML file when the first two results didn't work out for me.  I posted it up at [http://www.weezey.com/2008/05/itunes-playlists-in-mythtv.html this site] and then last fall someone else took a stab at the source and sped the whole thing up.  Basically all you have to do is rsync your music to your system and then scan for new music in MythMusic setup.  Run the script and it will map each of the files to their ID numbers in the myth database and then create all of your playlists so that they'll be available on any of your mythboxen.  The source is made available through subversion so please feel free to develop speed improvements or solutions to the overall puzzle and send me patches but as it stands a 11000 song library takes less than a minute to map and it's only missing the special chars [[User:Brian.phillips|Brian.phillips]] mentions above and the m4v files that MythMusic doesn't store in it's database.
 +
 +
[http://www.weezey.com/2008/05/itunes-playlists-in-mythtv.html iTunes Playlists in MythTV] - [[User:Weezey|Weezey]] 11:55, 22 April 2009 (UTC)
 +
 
----
 
----
  
Line 490: Line 474:
  
 
So, note that if you use the permission settings in the perl script, all attempts to rip from the MythMusic interface should/will fail since the mythtv user has no write permissions under /mythtv/music.
 
So, note that if you use the permission settings in the perl script, all attempts to rip from the MythMusic interface should/will fail since the mythtv user has no write permissions under /mythtv/music.
{{Code box | script |
+
{{Perl| script |
 
<pre>
 
<pre>
 
#!/usr/bin/perl
 
#!/usr/bin/perl
Line 560: Line 544:
 
  SERVER=http://us.freedb.org:80/~cddb/cddb.cgi CDDB
 
  SERVER=http://us.freedb.org:80/~cddb/cddb.cgi CDDB
 
  </nowiki>
 
  </nowiki>
 +
=== No Sound From Digital Output ===
 +
If you have working sound via a digital output from video recordings, but nothing from MythMusic, make sure the correct audio device is configured for MythMusic.  In particular, check for the following error in /var/log/mythtv/mythfrontend.log
 +
 +
AudioOutput Error: Rate doesn't match (requested 44100Hz, got 48000Hz)
 +
 +
If this error is present, you may need to edit the audio device.  Go to Utilities/Setup -> Setup -> Media Settings -> Music Settings -> General Settings and edit the "Audio device" field.  Enter the value, "ALSA:plug:iec958".
  
 
==MythMusic Development==
 
==MythMusic Development==

Revision as of 00:16, 17 March 2011

MythMusic is a sophisticated MythTV plugin that allows you to play and manage music and audio files .i.e MP3, Ogg, FLAC, wav etc. It is specifically designed to be operated by a normal remote control.

Supported Formats and Containers

Playback

  • Audio CDs
  • MP2
  • MP3
  • MP4
  • FLAC
  • Vorbis Audio (OGG + OGA)
  • AAC (iTunes)
  • AC3
  • Wav + WavPack (WV)
  • Windows Media Audio (WMA)
  • Sony OpenMG (OMA + OMG)
  • Sony ATRAC (ATP, AA3)
  • Real Audio (RA)
  • Matroska Audio
  • Audio Interchange Format (AIFF)
  • True Audio (TTA)
  • Shockwave Audio (SWA)
  • And more

Encoding

  • MP3
  • FLAC
  • OGG Vorbis Audio

Installing MythMusic

The best approach is to follow the installation guides for MythTV and MythMusic that have been developed for your Operating System and distribution.

Configuring MythMusic

For global MythMusic configuration. Go to the Utilities/Setup->Setup->Media Settings->Music Settings->General Settings. In particular you can set up which directory your music is stored in here.

There is also a set of music Tools at Utilties/Setup->Music Tools. Here you can rescan your music library, etc.

Using MythMusic

Because MythMusic has been designed to work with a remote control, people often struggle with it, especially when building and editing playlists. Once you become familiar with how it works, which does not take long, you will be amazed at how much more accessible and enjoyable it makes listening to your music collection.

Building your music collection

Importing CDs

Before you start to import a CD into MythMusic there are a few things you should check.

  • Make sure that your system is not set up to mount the CD and begin playing it automatically.
    • Gnome: System→Preferences → Removable Drives and Media Preferences.
    • KDE: There are two ways to do this (the first is easier):
      • Insert an audio CD, which will trigger a pop-up window. Select "X Do Nothing", tick the "Always do this for this type of media" checkbox and press OK.
      • Go to System Settings → Notifications → Storage Media Notifications → (Notifications tab) Medium types, select: Audio CD. "X Do Nothing" should have "(Auto Action) after it. If not, press the "Toggle as Auto Action" button.
  • It helps to have your system connected to the Internet, so that MythMusic can locate the information about your CD
  • Set up how you want your CDs to be ripped, including default quality settings. See the section on CD Ripper Settings
  • Insert the CD before selecting "Import CD".

To import (rip) a CD, you need to select the "Import CD" menu item. This can be found in two places

  • Optical Disks → Import CD
  • Utilities/Setup → Music Tools → Import CD

After a few seconds MythTV will query the Internet freedb database for your CD information and the Import CD screen will show, with the Artist, Album and tracks information.

MythMusic1.png

Check that the Quality setting is what you need. The options are :-

  • Low -Low bit rate, low quality, very small file sizes .ogg or .mp3
  • Medium -Medium bit rate, medium quality .ogg or .mp3
  • High -High bit rate, high quality .ogg or .mp3
  • Perfect - Rips to Lossless FLAC file format. This is CD quality but compressed by about 50%

You can make changes to any of the items on the screen at this point before you finally select the "import this CD" button.

You now see the progress screen showing each track as it is ripped and transcoded, as well as the overall progress on the whole album. Once import has finished you can configure your CD to be ejected.

MythMusic2.png

MythTV stores your ripped music on your hard drive in a structured manner. See the page on MythMusic File Organization. All your music files will also be tagged using the ID3 standard

Importing an existing music collection

If you already have an existing music collection then you can have MythMusic scan for this. Point MythMusic at the directory in which your music collection is, by changing the location of your music library:

  • Utilities/Setup → Setup →Media Settings-> Music Settings → General settings.

Then:

  • Utilities/Setup → Music tools → Scan for New Music.

MythTV will then scan for music and add the information into the MythTV database.

Alternatively of course, you can copy your existing collection across to the folder that MythMusic has already begun building your collection to.

If you have files that have been ripped to Apples aac format this should be no problem. Either copy these files into the MythMusic directory and then scan for new music, or mount your collection onto the systems file system and point your MythMusic directory to it as above.

Using Album Art

MythMusic supports the display of album art found in the same directory as a music file or embedded in MP3 files with ID3V2.3 or ID3V2.4 tags.


Important.png Note: If you add album art onto an existing collection using software such as "EasyTag" which preserves file modification time by default, you will need to make sure the timestamp of the files is updated (use 'touch') so that Mythmusic rescans the files properly. Otherwise the album art won't appear.

Playing Music

There are three ways to select music to play

  • Directly select an Artist,Album or track to play
  • Add tracks to the Active Playlist and play the Active Playlist
  • Create a new Playlist/Choose an existing Playlist

Before you start playing music it is highly recommended that you configure the MythMusic Player to show your entire music tree. This is probably the single biggest reason that people struggle with MythMusic GUI. You can set this in Utilities/Setup->Setup->Media Settings->Player Settings->show entire music tree


  • The Play screen (set up to show entire music tree)

MythMusic3.png



Direct music selection

You don't have to create a Playlist just to play an album or song.

With the "show entire music tree" configured, you will see your Playlists to the left of the Play pane as per the picture above. More importantly you will also see a default Playlist called "All My Music". Once you select this Playlist you will see all your music organized alphabetically by Artist.

Use the Left and right arrow keys to switch between the Playlist pane and the Play pane. Use the up and down arrows to select your Playlist and the the right arrow key to select the Artist then right arrow again to select the Album then right arrow again to select Song etc. Press select to play at any point either the Artist, Album, or Song. Press the left arrow button to backtrack.

Play from the Active Play Queue

When you first start using MythMusic you will find two entries in the Playlist pane already defined.

  • All My Music -Exactly that, use this to directly access any Artist, Album, Track from the Play pane.
  • All My Playlists -Exactly that, with an initial playlist called the Active Play Queue


Active Play Queue

This is a temporary playlist that you can add and remove entire Albums or individual tracks to create a Playlist. Once this has your songs you want you can then save it to a named play list. Of course you can play the Active Play Queue just like any other playlist.

Add songs to the Active Play Queue

To add songs to the Active play Queue you need to enter the playlist management screen by pressing 3 from the "Play" screen or by selecting the "Select Music" option from the Music Tools menu.

The Playlist Management screen

MythMusic4.png

In the above picture you can see the 4 items on the menu that you can select:-

1. All My Music -Add files from your collection to the Active Play Queue.

2. The album you have in your CD drive -Select songs to play.

3. All your play lists previously defined (initially empty)- Select which playlists to perform actions on.

4. Your Active Play Queue -Select what actions to perform on your Active Play Queue.

From the the Playlist management screen you can browse the entire collection from "All My Music". Add tracks to the current queue by pressing 'Select' to toggle the checkbox next to its name. Entire Albums, Genres or Artists may be added in one go.

If you don't have all the items in a sub menu selected this will be indicated by the checkbox being colored Grey rather than White.

MythMusic5.png


Press the ESC key to go back to the Play screen

Remove songs from the Active Play Queue

To remove all songs from the queue-

1. In the Playlist management screen, highlight Active Play Queue.

2. Press OK. A popup menu will appear (see Create a Playlist, below).

3. Highlight "Clear the Active Play Queue" and press OK.

Create a Playlist

When you are happy with the selection "All My Music", go back to the top level menu in Playlist management screen and then scroll down to "Active Play Queue" and press the Menu/m key. Type in the playlist name and then select "Copy to New Playlist". (If you are using a remote for text entry, don't forget to enable your on screen keyboard)

MythMusic6.png

When you return to the Play screen, you will see all your playlists

MythMusic7.png

Edit an existing playlist

From the playlist management screen, browse existing playlists from "All My Playlists". Highlight the playlist and press the I/Menu key. Select "Move to Active Play Queue" from the menu. You can now modify the "Active Play Queue" like normal, adding songs and playlists by selecting them from the song tree.

When you are done, highlight the "Active Play Queue" in the selection tree and press the I/Menu then select "Save Back to Playlist Tree".

  • Rearrange the songs in a playlist. Highlight a song and hit the "space" bar, the song will now have pair of red arrows in front of it. Use the up and down arrow keys to move it around in the playlist. When you have it where you want it, hit the "space" bar again.
  • Delete an item from a playlist. Highlight the item in the selection tree and hit the "d" key.
  • Edit a text field without a keyboard. Press ENTER in the empty line edit control. A keyboard will pop up; you can use this keyboard to enter characters.

Delete an existing playlist

From the playlist management screen, browse existing playlists from "All My Playlists".

  • Highlight the playlist in the selection tree and hit the I/Menu key then select "Delete this Playlist" from the popup.

Auto Playlist

MythMusic Auto playlists allow you to create playlists automatically. From The Play screen press the Menu/m button. A pop up menu will show the following options

  • Smart playlists -create playlists based on parameters, see section on Smart Playlists
  • Search -Text search for music
  • From CD - Play your CD
  • All Tracks -Play everything
  • Tracks by current Artist -Insert or append to current playlist
  • Tracks from current Album -Insert or append to current playlist
  • Tracks from current Genre -Insert or append to current playlist
  • Tracks from current Year -Insert or append to current playlist

Smart Playlist

This allows you create playlist based on parameters options include

  • Decades -1960's, 1970's, 1980's, 1990's,2000's
  • Favorite Tracks -Define your favorite tracks
  • New Tracks -Never Played Tracks

Define favorite tracks

From the Smart Playlist menu you can define your favourite tracks based on a collection of logical operations including artist, albums, Title, Genre,Year, Track no, Rating, Play count,Compilation, Last played date, date imported,

MythMusic8.png

Once you have defined the criteria, you can select the "show results" button to get a sample of the tracks that would form the playlist.

FIXME: how can I get these smart playlists to show up in the "All My Playlists" screen?

Visualizations

Nothing beats listening to your music collection and having an accompanying visualization on your large flat panel TV.

There are currently a number of visualizations for MythMusic that will be displayed in a small window while the Play window is visible, but will be displayed full-screen when you change the visualization mode with by pressing 430.png on your remote. Press the 630.png to cycle through the available visualizations. Which of these visualizations are to be used can be specified as a space-separated list in the Setup menu for MythMusic.

Visualization Name Comment
Random Switches to a different visualization for each song.
Viz2.png
MonoScope Standard spectrum analyzer, as found on many MP3 players such as XMMS and WinAmp.
StereoScope Another spectrum analyzer. Left and right channels are drawn separately.
BumpScope Similar to Monoscope above, but drawn as a "raised relief" on a flat surface (3D visualization)
Viz5.png
Goom The classic visualization of crazy lines and patterns.
Viz6.png
Synaesthesia A more amorphous visualization similar to plasma clouds displays
Viz7.png
Spectrum A classic sprectrum analyser
Viz8.png
Squares
Viz9.png
AlbumArt This displays the album art for the currently playing music. Basically, any image in the same directory as the music file currently playing is treated as if it might be album art, and one is selected randomly for display.
Viz10.png
Gears It's the GLXgears demo.
Blank Useful if all you want to do is listen to music, saves potential screen burn, as well as putting less stress on your CPU
Viz12.png
LibVisual Gives you the libvisual visualisations if you have MythTV 0.21 SVN onwards
Viz13.png
projectM/LibVisual Gives you the projectM visualisations if you have MythTV 0.21 SVN onwards and ProjectM installed

Missing Visualizations after upgrading from 0.19 to latest SVN? The visualizations are now selectable via the Setup menus and by default you won't have any selected. Navigate to Setup > Media Settings > Music Settings > Player Settings and on the third page you'll find the Edit Visualizations button where you can select which visualizations you'd like to show up as options.

Shuffle Modes

  • None - plays songs in sequential order
  • Rand - plays songs in random order
  • Smart - plays songs in smart order. Smart order is calculated using following components, each component weight can be configured in MythMusic Player settings:
    • Rating - songs with greater rating are played more
    • Play Count - songs with smaller play count are player more
    • Last Play - songs not heard recently are played more
    • Random - random component
  • Album - plays songs from the current album in random order
  • Artist - plays songs from the current artist in random order

Useful keys to know

(note these are based on the default key mappings, you can re-assign these in MythWeb)

Remote Control Keyboard Key Function Remote Control Keyboard Key Function
130.png 1 Change Shuffle Mode RemotePause.png P Pause
230.png 2 Change Repeat mode - 2 RemoteStop.png o Stop
330.png 3 Edit Playlist menu - 3 RemoteProgdown.png z Next
430.png 4 Switch to Visualization screen N/A f Filter All My Music
530.png 5 Blank the screen N/A CTRL+S Show incremental search dialog
630.png 6 Select Visualization N/A CTRL+N inc search find next match
730.png 7 Decrease track rating RemoteMute.png F9 Mute
830.png 8 Refresh music tree N/A > Next track in play list
930.png 9 Increase track rating N/A < Previous track in play list
RemoteInfo.png i Edit track information
RemoteVolup.png ] Volume up
RemoteVoldown.png [ Volume down

Linking Pre-Existing Audio Archive with MythMusic

iTunes

Here is how I sync'd MythMusic with an already established iTunes setup. All of our music is stored on a laptop (my wife is a DJ so it must be portable) that runs Windows XP. I wanted to back the music up to our myth box, and also make the songs and the playlists that were already created in iTunes, available via MythMusic. First, I decrypted any purchased iTunes music using QTFairUse. The decryption was only necessary to allow MythMusic to play music purchased from the iTunes Music Store (Please don't steal music!).

Then I configured the Windows XP laptop to share the iTunes folder (stored in My Documents\My Music by default) on the network:

   1. Right-click on the iTunes folder
   2. Click Properties
   3. Click the "Sharing" tab
   4. Select "Share this folder"
   5. Note the share name, e.g. "iTunes"
   6. Click Ok

On the myth box, I used Samba to mount the laptop's shared iTunes folder, and rsync to copy all files from the laptop to the mythbox:

   $ su
   # mkdir /mnt/iTunes
   # mount -t smbfs -o username=<user> //<laptop IP address>/iTunes /mnt/iTunes
   Password:
   # mkdir -p /storage/music/iTunes    # this is where I keep my music, change as necessary
   # chown -R mythtv:users /storage/music
   # su - mythtv
   $ rsync -q --recursive --perms --times --timeout=600 --delete /mnt/iTunes/ /storage/music/iTunes
     ***This can take a while***
   $ exit
   # umount /mnt/iTunes
   # exit
   $

In mythfrontend, I setup MythMusic to look for music in /storage/music and performed a scan for new music. It found all of the music and populated the database (Note: you must have AAC support enabled for MythMusic to find AAC files).

Next, I wanted all of my iTunes playlists to appear in MythMusic. I found this page that provides a utility script that creates MythMusic playlists from an iTunes library xml file. Since I'm using myth 0.20, I downloaded this version of the script. Versions before 0.20 should download this version. There's a small bug in the 0.20 script as is, so I had to open the script in an editor, search for "playlistid" and replace it with "playlist_id" (Note the underscore). I also had to change the values of the variables at the top of the script to suit my system. Then I ran the script and my playlists were imported into MythMusic.

I finally setup cron scripts to periodically attempt to sync with the laptop (using the same rsync command as above), and rerun the mythtv-itunes.pl script to keep the playlists up to date.

Filename Matcher Script

I wasn't happy with a couple of things that the previous scripts did, and so I started changing them here and there, and eventually most of the thing was gutted. So here's my version of the above scripts, tested and found working on Myth 0.21.

Previous scripts have been more general in that they searched the MythMusic database for similar Artists and Song Name and Album and then they called that a match. I didn't like this behavior for a couple reasons. I could never get non-ascii characters in the ID3 tag to map properly. The script would just give up on those songs. Similarly, I have a few songs where the Album field is blank, but the Song Name and Artist are the same (different recordings, live shows, etc) and the previous scripts would simply match all these to the first finding of the song in the database.

By matching on filename, we actually get the correct matches and the matching is much faster. Instead of accessing the database once for each song in your iTunes library, it accesses the database once for the entire library. Tests thus far have shown a speedup of 400% over previous scripts! We also don’t have to worry about the ID3 tag containing "non-standard" characters, the songs will still map. So you can keep your Latin and German music with it's non-standard characters and still have matches.

A couple of gotchas though. I'm no character encoding genius, in fact I'm probably a character encoding idiot, but from my little research for this project I noticed iTunes will store non-ASCII characters just fine as escaped hex values in the iTunes library XML file. MythMusic, on the other hand, doesn't seem to store that information, being a Latin1 database. I'm also a Perl idiot, so I never figured out how to change the data correctly. Basically, if you have non-standard characters in the actual filename (not the ID3 tag), these songs will probably not map. Sorry, but if someone knows how to do the proper conversions in Perl to make iTunes and MythMusic play nice, that would be a nice feature to add to the script. Also, if you find my explanations to be bogus, just remember I might not know what I'm talking about.

Also, while I really don't believe this will ever be a problem, I might as well disclaim it. I've tested this script on my library (~1700 songs) and it works great. However, because this loads some of the music_songs database into a Perl variable before it starts matching, the memory footprint of this script could be larger than the previous Perl scripts. I'm interested in how even the largest of music libraries perform with this script.

mythtv-itunes-filename-match.pl - Brian.phillips 04:52, 11 January 2009 (UTC)

PHP Script

I started development of an iTunes to MythMusic conversion script using the same XML file when the first two results didn't work out for me. I posted it up at this site and then last fall someone else took a stab at the source and sped the whole thing up. Basically all you have to do is rsync your music to your system and then scan for new music in MythMusic setup. Run the script and it will map each of the files to their ID numbers in the myth database and then create all of your playlists so that they'll be available on any of your mythboxen. The source is made available through subversion so please feel free to develop speed improvements or solutions to the overall puzzle and send me patches but as it stands a 11000 song library takes less than a minute to map and it's only missing the special chars Brian.phillips mentions above and the m4v files that MythMusic doesn't store in it's database.

iTunes Playlists in MythTV - Weezey 11:55, 22 April 2009 (UTC)


RubyRipper

I use RubyRipper to rip my CD Music library. I also prefer a much different directory and file layout then MythMusic uses. The RubyRipped files are my 'master'. MythMusic 'Scan for new music' will NOT successfully identify music files that are themselves symbolic links. Scanned files, for now, must be hard links. As space is a consideration though, I don't want to manage two sets of directories with duplicate copies of the same data. So, the solution is to do a HARD LINK from the master audio archive directory to the target mythtv/music directory.

Important.png Note: Hard links must exist on the same file system. So, this only works if your audio library directory and mythtv director are on the same volume/partition.

This little perl script when run will find the all files under audioarchive/vorbis. It then splits the path. This script array elements 4,6,7 of that path align with genre/artist/album. Directories are created under /mythtv/music and a second HARD LINK is created to the master audio file. You'll need to adjust the array element numbering to match your archive path structure and also adjust the order for your MythMusic path.

I also modify the permissions of the '/mythtv/music' directory and files to be 'read-only' because I don't rip from MythMusic setup. While the built in ripper is very flexible and includes all the elements for creating a complex and unique hiearchy -- it doesn't support ripping multiple formats at once like RubyRipper, or swapping out the default ripper with a command reference to a ripper of choice.

So, note that if you use the permission settings in the perl script, all attempts to rip from the MythMusic interface should/will fail since the mythtv user has no write permissions under /mythtv/music.

Application-x-perl.png script

#!/usr/bin/perl

$audioArchive = '/audioarchive/vorbis';
$mythMusic = '/mythtv/music';

@fileList = `find $audioArchive -type f -print`;

foreach $file (@fileList) {

        chomp($file);
        # The RubyRip setup is format/genre/year/artist/album/title
        # Constructing for MythMusic in genre/artist/album/title
        @rubyRip = split('/', $file);
        $mythMusicPath = join('/', ($mythMusic, $rubyRip[4], $rubyRip[6], $rubyRip[7]));

        next if ($rubyRip[8] == 'ripping.log');

        # Make first the directory structure genre/artist/album under mythMusic
        # and the symbolic link to the song titles.
        `mkdir -p "$mythMusicPath"`;    # -p no error on existing. Save Cyles with first -x check?
        if ($@) { print "ERROR Making Directory: $@\n"; exit (1); }

        # Now link the file.. [HARD LINKS]
        `ln "$file" "$mythMusicPath/$rubyRip[8]"`;
        if ($@) { print "ERROR Linking: $@\n"; exit (1); }

}

# Update perms
`chown -R mythtv.mythtv "$mythMusic"`;
`find "$mythMusic" -type d -exec chmod 555 {} \\;`;
`find "$mythMusic" -type f -exec chmod 444 {} \\;`;

Troubleshooting

Error Message Looking up CD on cddb

The full text of the message will say:

databasebox.o: Couldn't find your CD. It may not be in the freedb database.

More likely, however, is that you need to delete /.cddb and /.cdserverrc and restart MythMusic. To do this, go to the home directory of whatever user MythMusic is running as and type:

   rm .cdserverrc
   rm -rf .cddb/

These files aren't automatically deleted because of a conscious design decision by the author that programs that automatically delete things are bad.

The files are used to locally cache CD lookups. If you are re-inserting CDs, your machine will not actually have to go out to the Internet to determine what is on them. However, the URL used to access the freedb database has recently changed, so the stale information in the files from previous runs of MythMusic would cause the error above. Once the files have been deleted the stale information will be gone and your local database will be rebuilt as you use CDs.

The default cddb server in .cdserverrc doesn't seem to be working very well all the time, here's a list of servers you can add:

 SERVER=cddbp://freedb.freedb.org:8880/ CDDB
 SERVER=http://freedb.freedb.org:80/~cddb/cddb.cgi CDDB
 SERVER=cddbp://at.freedb.org:8880/ CDDB
 SERVER=http://at.freedb.org:80/~cddb/cddb.cgi CDDB
 SERVER=cddbp://ca.freedb.org:8880/ CDDB
 SERVER=http://ca.freedb.org:80/~cddb/cddb.cgi CDDB
 SERVER=cddbp://cz.freedb.org:8880/ CDDB
 SERVER=http://cz.freedb.org:80/~cddb/cddb.cgi CDDB
 SERVER=cddbp://no.freedb.org:8880/ CDDB
 SERVER=http://no.freedb.org:80/~cddb/cddb.cgi CDDB
 SERVER=cddbp://uk.freedb.org:8880/ CDDB
 SERVER=http://uk.freedb.org:80/~cddb/cddb.cgi CDDB
 SERVER=cddbp://us.freedb.org:8880/ CDDB
 SERVER=http://us.freedb.org:80/~cddb/cddb.cgi CDDB
 

No Sound From Digital Output

If you have working sound via a digital output from video recordings, but nothing from MythMusic, make sure the correct audio device is configured for MythMusic. In particular, check for the following error in /var/log/mythtv/mythfrontend.log

AudioOutput Error: Rate doesn't match (requested 44100Hz, got 48000Hz)

If this error is present, you may need to edit the audio device. Go to Utilities/Setup -> Setup -> Media Settings -> Music Settings -> General Settings and edit the "Audio device" field. Enter the value, "ALSA:plug:iec958".

MythMusic Development

As with all MythTV development work, modifications are worked on as "tickets" on the MythTV Trac Server. To have a look at the latest developments on the active tickets for the MythMusic module, scroll down to the MythMusic section of the Active Tickets by Component page.

Wishlist

The wishlist for MythMusic development ideas is part of the Feature Wishlist (Plugin Addons) page of this wiki. Before editing this page however, please read the guidelines on the Feature Wishlist page.

MySQL Database Tables

MythTV's information, including MythMusic, is organised using MySQL database tables. These tables are not accessed directly by the user, but it can be useful to know where the information is stored when administering a MythMusic setup. See Database Schema for more information.

The following tables are used exclusively by MythMusic:

The following tables are used by MythMusic, alongside other parts of MythTV:

Media Shares

Mediashares gives a simple walk through of how to export your media directory so its accessible from your other remote Mythtv systems.