Last active
December 14, 2015 10:19
-
-
Save jonyesno/5071720 to your computer and use it in GitHub Desktop.
Extracting voicememo name and file location from iTunes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cp ~/Music/iTunes/iTunes\ Music\ Library.xml ~/itunes.xml | |
$ xml select --template \ | |
--elem voicememos \ | |
--match "//dict[string='Voice Memo']" \ | |
--elem voicememo \ | |
--elem name \ | |
--copy-of "key[text()='Name']/following-sibling::string[1]/text()" \ | |
--break \ | |
--elem location \ | |
--copy-of "key[text()='Location']/following-sibling::string[1]/text()"\ | |
--break \ | |
--break \ | |
itunes.xml | xml format > voicememos.xml | |
$ head voicememos.xml | |
<?xml version="1.0"?> | |
<voicememos> | |
<voicememo> | |
<name>Train to Nong Khai</name> | |
<location>file://localhost/Public/lemon/iTunes-local/Library/Voice%20Memos/20120909%20075039.m4a</location> | |
</voicememo> | |
<voicememo> | |
<name>Tuk tuk brakes, Nong Khai</name> | |
<location>file://localhost/Public/lemon/iTunes-local/Library/Voice%20Memos/20120909%20123352.m4a</location> | |
</voicememo> | |
<voicememo> | |
<name>Sunset cruise tunes on the Mekong</name> | |
<location>file://localhost/Public/lemon/iTunes-local/Library/Voice%20Memos/20120909%20175758.m4a</location> | |
</voicememo> | |
... | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment