mutagen

Mutagen : how to extract album art properties?

左心房为你撑大大i 提交于 2020-01-04 02:29:06
问题 I am trying to get properties (just width & heigth so far, but probably more later) of an album art picture from an mp3 file using python 3.7.1 and mutagen 1.42, but nothing seems to work so far. I am yet able to extract some other information correctly The doc is telling about APIC, but trying to display all tags doesn't show anything related to any picture (and my mp3 test files does have album pictures) : import os,sys from mutagen.mp3 import MP3 from mutagen.easyid3 import EasyID3 song

Extract ID3 tags of a MP3 URL with partial download using python

天涯浪子 提交于 2020-01-01 09:36:09
问题 I need to extract ID3 tags and meta-data of remote mp3 files. I wrote few lines that could get ID3 tags of local file: from mutagen.mp3 import MP3 import urllib2 audio = MP3("Whistle.mp3") songtitle = audio["TIT2"] artist = audio["TPE1"] print "Title: " + str(songtitle) print "Artist: "+str(artist) I need to achieve this for url links for mp3 files. I tried to get partial download of files using urllib2. import urllib2 from mutagen.mp3 import MP3 req = urllib2.Request('http://www.1songday.com

Python Mutagen: add cover photo/album art by url?

╄→尐↘猪︶ㄣ 提交于 2019-12-25 07:09:31
问题 Using mutagen, I am able to add normal metatags such as title , artist , and genre however when I try to add an image via a url, it doesn't work. from mutagen.mp4 import MP4 from mutagen.mp4 import MP4Cover from PIL import Image import urllib2 as urllib import io, sys, getopt #url is defined elsewhere audio = MP4(url) #clear previous meta tags audio.delete() #get album picture data cover ="http://cont-sv5-2.pandora.com/images/public/amz/5/2/9/7/095115137925_500W_488H.jpg" fd = urllib.urlopen

mutagen: how to detect and embed album art in mp3, flac and mp4

廉价感情. 提交于 2019-12-21 03:57:49
问题 I'd like to be able to detect whether an audio file has embedded album art and, if not, add album art to that file. I'm using mutagen 1) Detecting album art. Is there a simpler method than this pseudo code: from mutagen import File audio = File('music.ext') test each of audio.pictures, audio['covr'] and audio['APIC:'] if doesn't raise an exception and isn't None, we found album art 2) I found this for embedding album art into an mp3 file: How do you embed album art into an MP3 using Python?

after using python mutagen,metatags not displayed

大兔子大兔子 提交于 2019-12-20 05:53:46
问题 I wanted to edit the meta data of a bunch of mp3 files,so I used python mutegan. The details of the mp3 file before running mutagen I used this simple code to change the details of the mp3 file. from mutagen.easyid3 import EasyID3 audio = EasyID3("C:/wamp/www/music/songs/showkali.mp3") audio['genre']='pop' audio.save() After running the program the details cannot be seen in the properties. The details of the mp3 file after running mutagen I figured out this is due to change in id3 tag version

Retrieve lyrics from an mp3 file in Python using eyeD3

我是研究僧i 提交于 2019-12-18 09:12:10
问题 I am currently trying to use Python and its eyeD3 library to extract the lyrics from an mp3 file. The lyrics have been embedded into the mp3 file already (via: MusicBee). I am trying to use eyeD3 to return the lyrics. I can't figure out how to do it. I have searched online extensively and all I've found were tutorials showing how to SET the lyrics. I just want to read them from the file. Here's my current code: track = eyed3.load(path) tag = track.tag artist = tag.artist lyrics = tag.lyrics

how to correct the misencoded string?

六眼飞鱼酱① 提交于 2019-12-12 03:02:14
问题 i used mutagen to read the mp3 metadata, since the id3 tag is read in as unicode but in fact it is GBK encoded. how to correct this in python? audio = EasyID3(name) title = audio["title"][0] print title print repr(title) produces µ±Äã¹Âµ¥Äã»áÏëÆðË­ u'\xb5\xb1\xc4\xe3\xb9\xc2\xb5\xa5\xc4\xe3\xbb\xe1\xcf\xeb\xc6\xf0\xcb\xad' but in fact it should be in GBK (chinese). 当你孤单你会想起谁 回答1: It looks like the string has been decoded to unicode using the wrong encoding (latin-1). You need to encode it to

Python - how to a open remote file in binary read mode?

拈花ヽ惹草 提交于 2019-12-10 13:27:36
问题 I'm trying to use the mutagen module to read the metadata of an mp3 file. The problem is that the module is expecting a local mp3 file, but my mp3 files are on a remote server. This is the line in the module that raises an error when I send a remote mp3 URL as the first parameter. fp = file(f, "rb") How can I alter this line of code so that it can open a remote file (e.g. http://remotedomain.com/file.mp3 ) in rb mode ? 回答1: fp = urllib2.urlopen("http://remotedomain.com/file.mp3") binary mode

Embedding album cover in MP4 file using Mutagen

倖福魔咒の 提交于 2019-12-07 09:28:20
问题 I'd like to be able to add album cover into the file using mutagen, however when I add it as a file it returns with: File "D:\Download\pandora\renamingMETAEFF.pyw", line 71, in <module> meta['covr'] = image File "C:\Users\AMD\AppData\Local\Programs\Python\Python35\lib\site-packages\mutagen\_file.py", line 67, in __setitem__ self.tags[key] = value File "C:\Users\AMD\AppData\Local\Programs\Python\Python35\lib\site-packages\mutagen\mp4\__init__.py", line 357, in __setitem__ self._render(key,

Embedding album cover in MP4 file using Mutagen

风格不统一 提交于 2019-12-05 13:58:32
I'd like to be able to add album cover into the file using mutagen, however when I add it as a file it returns with: File "D:\Download\pandora\renamingMETAEFF.pyw", line 71, in <module> meta['covr'] = image File "C:\Users\AMD\AppData\Local\Programs\Python\Python35\lib\site-packages\mutagen\_file.py", line 67, in __setitem__ self.tags[key] = value File "C:\Users\AMD\AppData\Local\Programs\Python\Python35\lib\site-packages\mutagen\mp4\__init__.py", line 357, in __setitem__ self._render(key, value) File "C:\Users\AMD\AppData\Local\Programs\Python\Python35\lib\site-packages\mutagen\mp4\__init__.py