Menu

Run Mediainfo on only certain file types in folder

Help
2016-12-14
2016-12-17
  • Derek Morais

    Derek Morais - 2016-12-14

    I'm trying to get the track title and other info for audio files but the only way to do that is using the General inform command. So because I'm running a general command its scanning and returning info for all filetypes. I'm trying to get metainfo data for ONLY audio files of albums I have stored as folders. In these folders i have .cue files and album art and .txt files so when I run mediainfo on the filepath of the entire folder it runs mediainfo on all that folders contents. Again, I only want the mediainfo of audio files. Is there a command in Audio that will give me the track title?

    So far I have my template command
    General;Track: %Track%\n
    Audio;Samplerate: %SamplingRate% Hz\nChannels: %Channels%\nBits per sample: %BitDepth%\nBitrate: %BitRate/String%\nCodec: %Format%\n\n

    Then my bash command
    mediainfo --Inform=file://~Desktop/template.csv ~/Desktop/Album > ~/Desktop/output.txt

    Which outputs this...
    Track: Huntington Ashram Monastery
    Samplerate: 44100 Hz
    Channels: 2
    Bits per sample: 16
    Bitrate: 955 Kbps
    Codec: FLAC

    Track: Turiya
    Samplerate: 44100 Hz
    Channels: 2
    Bits per sample: 16
    Bitrate: 799 Kbps
    Codec: FLAC

    Track: Paramahansa Lake
    Samplerate: 44100 Hz
    Channels: 2
    Bits per sample: 16
    Bitrate: 790 Kbps
    Codec: FLAC

    Track: Via Sivanandagar
    Samplerate: 44100 Hz
    Channels: 2
    Bits per sample: 16
    Bitrate: 874 Kbps
    Codec: FLAC

    Track: IHS
    Samplerate: 44100 Hz
    Channels: 2
    Bits per sample: 16
    Bitrate: 843 Kbps
    Codec: FLAC

    Track: Jaya Jaya Rama
    Samplerate: 44100 Hz
    Channels: 2
    Bits per sample: 16
    Bitrate: 972 Kbps
    Codec: FLAC

    Track:
    Track:
    Track:
    Track:

    You can see that it outputs "Track:" four times. Which I am guessing is because of the other files in folder.

    I'm guessing I need to do some type of conditional (for filetypes .flac>do mediainfo>) or (if filetypes .flac>do mediainfo) so the .csv only runs on .flac, .aiff, .wav, etc and ignores all other filetypes. However I am unaware of the syntax. The other algorithm/logic I thought would be to temporarily create and move all other file types to a temp folder, run mediainfo on the main album folder then merge and delete the temporary.

    My end goal is to create a GUI that prompts for the folder(s) you want to get metadata for, then select with checkboxes the metadata you want, then output that info as a .txt file in the same folder

    Can someone please help me out or point me in the right direction. Thanks

     

    Last edit: Derek Morais 2016-12-16
  • Jerome Martinez

    Jerome Martinez - 2016-12-17

    An heidden feature you could use: [].

    General;[Track: %Track%\n]

    Generally speaking, there is a lack of maintainance on the template due to a lack of sponsor for this feature, so not easy to have something good.

     

Log in to post a comment.