libpytunes icon indicating copy to clipboard operation
libpytunes copied to clipboard

How to identify type of Song?

Open ForsythsGambit opened this issue 3 years ago • 4 comments

I'd like to filter my library as its being parsed as I have a mixture of music, podcasts, and audiobooks. Is there an attribute to identify which of these a Song is?

ForsythsGambit avatar Mar 16 '23 18:03 ForsythsGambit

Here's all the attributes of the song class:

'name', 'work', 'movement_number', 'movement_count', 'movement_name', 'track_id', 'artist', 'album_artist', 'composer', 'album', 'genre', 'kind', 'size', 'total_time', 'track_number', 'track_count', 'disc_number', 'disc_count', 'year', 'date_modified', 'date_added', 'bit_rate', 'sample_rate', 'comments', 'rating', 'rating_computed', 'play_count', 'album_rating', 'album_rating_computed', 'persistent_id', 'location_escaped', 'location', 'compilation', 'lastplayed', 'skip_count', 'skip_date', 'length', 'track_type', 'grouping', 'podcast', 'movie', 'has_video', 'loved', 'album_loved', 'playlist_only', 'apple_music', 'protected'

I believe podcast is what you're looking for.

brningpyre avatar Apr 06 '23 17:04 brningpyre

Perfect,thank you! Is there an equivalent one for audiobooks?

ForsythsGambit avatar Apr 06 '23 18:04 ForsythsGambit

I don't see one, unfortunately. I don't have any audiobooks on iTunes myself, so I'm not sure what the XML formatting would look like.

You could probably hack it by just checking the length (1hr+ is probably an audiobook, LOL).

brningpyre avatar Apr 06 '23 21:04 brningpyre

According to google bard:

To recognize an audiobook in the iTunes XML library file, you can use the following XPath expression:

/plist/dict/key[@name='Kind']/string[@value='Audiobook']

Kind is one of the attributes in the song class, I don't have any in mine, so I can not confirm. But it would be worth checking out

CAMYR71 avatar Sep 08 '23 08:09 CAMYR71