# Fill media type based on file type

**URL:** <https://community.mp3tag.de/t/fill-media-type-based-on-file-type/50108>\
**Category:** Support\
**Created:** [September 3, 2020, 9:09pm UTC](https://community.mp3tag.de/t/fill-media-type-based-on-file-type/50108 "2020-09-03T21:09:01Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![LeeB](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/4af34b/32.png) [@LeeB](https://community.mp3tag.de/u/LeeB)\
**Post date:** [September 3, 2020, 9:09pm UTC](https://community.mp3tag.de/t/fill-media-type-based-on-file-type/50108/1 "2020-09-03T21:09:01Z")

</div>

I'm looking to create an action that will look at the file type (mp3, m4a, etc.) then assign a MEDIATYPE and/or ITUNESMEDIATYPE. For example...

1. MP4 will get it's MEDIATYPE/ITUNESMEDIATYPE tagged as "Music Video"
2. MP3 will get it's MEDIATYPE/ITUNESMEDIATYPE tagged as blank (delete or clear any assignment already in place)

This is beyond my knowledge which is HIGHLY limited. And advice?

Many thanks,  
Lee

---

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [September 4, 2020, 5:35am UTC](https://community.mp3tag.de/t/fill-media-type-based-on-file-type/50108/2 "2020-09-04T05:35:11Z")

</div>

Did you have a look at this thread:

> [@Permanently change 'MediaType' for iTunes](https://community.mp3tag.de/t/permanently-change-mediatype-for-itunes/13895):
>
> Hi, How do I permanently change 'MediaType' for iTunes? e.g. I want change some MP3 files (not MP4) mediatype to 'audiobook' instead of 'music' in iTuens, but I want these property to stay with the files, and I don't need to reDo them next time on other itunes from a different computer. Note: MP3 files are stored on a network drive and are shared.

It looks as though there are many more types for mediatype:  
Movie, Normal, Audiobook, Music Video, Short Film, TV Show, Ringtone

And: these categories are only valid for MP4 files anyway (which in a way has been indicated by you as you want to delete the field from mp3s)  
You could create an action of the type "Format value" for MEDIATYPE  
Format string: `$ifgreater($strstr(%_tag%,MP4),0,Music Video,)`

---

<div class="post-metadata">

**Author:** ![LeeB](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/4af34b/32.png) [@LeeB](https://community.mp3tag.de/u/LeeB)\
**Post date:** [September 4, 2020, 7:04am UTC](https://community.mp3tag.de/t/fill-media-type-based-on-file-type/50108/3 "2020-09-04T07:04:52Z")

</div>

Thanks much ohrenkino. From what I can tell, that thread discussed how to do it manually, which I've been doing for a while now. Trying to automatically do it. I used your string suggestion (format value, mediatype, string $ifgreater($strstr(%\_tag%,MP4),0,Music Video,) and it simply changes it to BLANK even on mp4's. Also tried the string $ifgreater($strstr(%\_extension%,mp4),0,Music Video,). Just getting BLANK on all mp4's.

---

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [September 4, 2020, 7:07am UTC](https://community.mp3tag.de/t/fill-media-type-based-on-file-type/50108/4 "2020-09-04T07:07:16Z")

</div>

with %\_extension% you could specify e.g. m4v.  
The function $strstr() is case sensitive.

---

<div class="post-metadata">

**Author:** ![LeeB](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/4af34b/32.png) [@LeeB](https://community.mp3tag.de/u/LeeB)\
**Post date:** [September 4, 2020, 7:15am UTC](https://community.mp3tag.de/t/fill-media-type-based-on-file-type/50108/5 "2020-09-04T07:15:06Z")

</div>

I tried...  
$ifgreater($strstr(%\_tag%,MP4),0,Music Video,) and  
$ifgreater($strstr(%\_tag%,mp4),0,Music Video,)  
Both force mp4's to blank.

---

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [September 4, 2020, 7:22am UTC](https://community.mp3tag.de/t/fill-media-type-based-on-file-type/50108/6 "2020-09-04T07:22:14Z")

</div>

I just tried it on my MP4s and it works like intended:  
`$ifgreater($strstr(%_tag%,MP4),0,Music Video,)`  
writes "Music Video" to MEDIATYPE.

---

<div class="post-metadata">

**Author:** ![LeeB](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/4af34b/32.png) [@LeeB](https://community.mp3tag.de/u/LeeB)\
**Post date:** [September 4, 2020, 7:26am UTC](https://community.mp3tag.de/t/fill-media-type-based-on-file-type/50108/7 "2020-09-04T07:26:45Z")

</div>

Sorry. This DOES work. I was confusing/mixing MEDIATYPE and ITUNESMEDIATYPE. This does change as needed. Thank you ohrenkino.

---

<div class="post-metadata">

**Author:** ![system](https://community.mp3tag.de/uploads/default/original/2X/c/ce7035d426cb755a7916793326d23b465222a407.png) [@system](https://community.mp3tag.de/u/system)\
**Post date:** [October 4, 2020, 7:26am UTC](https://community.mp3tag.de/t/fill-media-type-based-on-file-type/50108/8 "2020-10-04T07:26:45Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
