LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Crash Course in Python Scripting needed - helper must know python scripting and about audio files ending in m4a (https://www.linuxquestions.org/questions/programming-9/crash-course-in-python-scripting-needed-helper-must-know-python-scripting-and-about-audio-files-ending-in-m4a-4175603393/)

BW-userx 04-07-2017 11:17 AM

Crash Course in Python Scripting needed - helper must know python scripting and about audio files ending in m4a
 
I am trying to extract metadata off of m4a music files that where on my iPhone to reset the file names and place same said music files in a categorized fashion within a directory tree to reflect the same data that is SUPPOSE to be on the files.

Logic tells me this information has to be on there somewhere and somehow in order for it to display on the iPhone when playing them.

As it stands I have a pile of mp3s with the extension of m4a and the names like KQQG.m4a NWGU.m4a QSHO.m4a VHLW.m4a


I want to put them back to the title of the song like

mommy sets me stay up late.mp3

then in the directory with the name of the Band and Album it was one to begin with.

I've already tried them and even written a BASH Script to do this with, only to discovered that nothing works, id3v2 eyeD3 exiftool mp4tools theses do not work on m4a files.

I read that a python tool works on them called mutagen, I found a python script that someone wrote and put up on git hub for anyone to use.

Code:

git clone https://github.com/mjjohnson/id3tagextractor.git
I figured out how to use it, but I did not get anything back. This script read the file then places it into an xml file.

Code:


<?xml encoding="UTF-8"?>
<tags_extracted>
        <song>
                <location>/media/data/iPhone-Music/F01/AALU.m4a</location>
                <tags>
                </tags>
        </song>
        <song>
                <location>/media/data/iPhone-Music/F01/ABRM.m4a</location>
                <tags>
                </tags>
        </song>
        <song>
                <location>/media/data/iPhone-Music/F01/AKMZ.m4a</location>
                <tags>
                </tags>
        </song>
        <song>
                <location>/media/data/iPhone-Music/F01/AWLN.m4a</location>
                <tags>
                </tags>
        </song>

The entire file looks like that. So I am in heavy doubt that an extraction of this data can actually be done.

BUT

if it can then maybe all this script needs is a little fine tuning as it was written for version Mutagen 1.16 back in 2009. Mutagen is now up to version 1.37 and it states that it is

Code:


One of the reasons to include Mutagen in this round up is because it supports ASF, FLAC, M4A

https://www.blog.pythonlibrary.org/2...-using-python/

that is a long shot but just maybe I'd need to change a few things to get this script to get that data and mod it some more to get it to do what I want it to instead of just putting that information in a file to be read.

So all I am looking to learn on this python is how to find out and use whatever function calls I need within this Mutagen I written in Python so I can use them to experiment with it in hopes of getting it to read the metadata I need to do what I want to do with it.

along with the proper way to write it - the syntax

declaring variables and how to manipulate them and such.

Logical flow should stay the same.

ondoho 04-07-2017 11:54 AM

mediainfo

BW-userx 04-07-2017 12:25 PM

Quote:

Originally Posted by ondoho (Post 5693900)
mediainfo

(WARNING : WORK IN PROGRESS, SOME DETAILS MAY BE WRONG)

but they got a SlackBuild for it so its compiling to be installed as I type this

BW-userx 04-07-2017 12:36 PM

Idea scraped due to Applies are rotten -- full of worms ... no needed data seems to be on files.

dugan 04-07-2017 01:55 PM

Here's a tagger I wrote many weekends ago. You can look at it as an example.

https://github.com/duganchen/lasttag.../lasttagger.py


All times are GMT -5. The time now is 02:37 PM.