LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-07-2017, 11:17 AM   #1
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
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.

Last edited by BW-userx; 04-07-2017 at 11:23 AM.
 
Old 04-07-2017, 11:54 AM   #2
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
mediainfo
 
Old 04-07-2017, 12:25 PM   #3
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Original Poster
Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
Quote:
Originally Posted by ondoho View Post
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
 
Old 04-07-2017, 12:36 PM   #4
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Original Poster
Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
Idea scraped due to Applies are rotten -- full of worms ... no needed data seems to be on files.
 
Old 04-07-2017, 01:55 PM   #5
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,217

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

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


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] python scripting question nickygencs17 Programming 6 05-07-2014 09:31 AM
Scripting via Putty(Python) skororo Linux - Server 4 06-03-2013 01:46 AM
LXer: Scripting KVM with Python, Part 2: Add a GUI to manage KVM with libvirt and Python LXer Syndicated Linux News 0 01-17-2012 08:11 PM
python scripting sammymcgee Programming 4 03-23-2011 01:37 PM
Shell Scripting/Python/C MCD_Thom Linux - Newbie 4 11-09-2004 11:40 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:28 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration