Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.028 X-Spam-Evidence: '*H*': 0.94; '*S*': 0.00; 'subject:Python': 0.06; 'encoded': 0.07; 'subject:using': 0.09; 'python': 0.11; '-tkc': 0.16; 'fine.': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'itself,': 0.16; 'modules.': 0.16; 'pythonic': 0.16; 'wrote:': 0.18; 'hey': 0.18; 'trying': 0.19; 'seems': 0.21; 'this?': 0.23; 'subject: .': 0.24; 'title,': 0.24; 'url:moin': 0.24; 'versions': 0.24; 'file.': 0.24; 'looks': 0.24; "i've": 0.25; 'subject:/': 0.26; 'header:In-Reply-To:1': 0.27; '[1]': 0.29; 'properties': 0.29; '[2]': 0.30; 'ease': 0.30; "i'm": 0.30; 'asked': 0.31; 'code': 0.31; 'getting': 0.31; 'that.': 0.31; 'url:wiki': 0.31; 'libraries': 0.31; 'file': 0.32; 'figure': 0.32; 'url:python': 0.33; 'there': 0.35; 'everyone.': 0.36; 'module.': 0.36; 'charset :us-ascii': 0.36; 'url:org': 0.36; 'should': 0.36; 'two': 0.37; 'mine': 0.38; 'handle': 0.38; 'to:addr:python-list': 0.38; 'fact': 0.38; 'to:addr:python.org': 0.39; 'how': 0.40; 'read': 0.60; 'most': 0.60; 'length': 0.61; 'first': 0.61; 'offer': 0.62; 'email addr:gmail.com': 0.63; 'myself': 0.63; 'different': 0.65; 'believe': 0.68; 'links,': 0.74; 'click': 0.77; 'calculations': 0.84; 'received:50.22': 0.84; 'tags,': 0.95 Date: Tue, 26 Nov 2013 09:59:01 -0600 From: Tim Chase To: python-list@python.org Subject: Re: Access and write .mp3 metadata/tags using Python 3 In-Reply-To: <07682b1c-ae9a-4d0b-878e-abef0eb15f8a@googlegroups.com> References: <07682b1c-ae9a-4d0b-878e-abef0eb15f8a@googlegroups.com> X-Mailer: Claws Mail 3.8.1 (GTK+ 2.24.10; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - boston.accountservergroup.com X-AntiAbuse: Original Domain - python.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tim.thechases.com X-Get-Message-Sender-Via: boston.accountservergroup.com: authenticated_id: tim@thechases.com X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 36 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1385481460 news.xs4all.nl 15950 [2001:888:2000:d::a6]:34002 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:60524 On 2013-11-26 07:41, andonefilms@gmail.com wrote: > Hey everyone. > > I'm trying to figure out how to get python to access the properties > section of an mp3 file. When you right click an mp3 file and go to > properties you can edit the title, album, and things like that. I > also want to be able to read the length of the mp3. > > Is there a pythonic way to do this? I asked a professor of mine and > he said to look into the OS module. There are a couple libraries that ease that[1]. Matters are complicated by the fact that there are two different versions of ID3 tags, v1 and v2. However most of those libraries should handle them just fine. Also, I don't believe that the playtime length is actually encoded in the file itself, so you might have to do some calculations to find that. I've wondered this myself and would be interested to learn more. You might look at[2] which seems to offer code using one of those modules. Based on the two links, it looks like Mutagen might be the first stop for getting both parts that you need. -tkc [1] https://wiki.python.org/moin/UsefulModules#ID3_Handling [2] http://stackoverflow.com/questions/6037826/finding-the-length-of-an-mp3-file