mutagen

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

橙三吉。 提交于 2019-12-04 05:13:34
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/wp-content/uploads/2013/08/Lorde-Royals.mp3') req.headers['Range'] = 'bytes=%s-%s' % (0, 100) response

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

允我心安 提交于 2019-12-03 12:06:06
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? How do I embed album art into other formats? EDIT: embed mp4 audio = MP4(filename) data = open(albumart,

Does anyone have good examples of using mutagen to write to files?

混江龙づ霸主 提交于 2019-12-03 09:08:13
问题 Just as the title asks — does anyone have a good example of using the Mutagen Python ID3 library to write to .mp3 files? I'm looking, in particular, to add disc/track number information, but examples editing the title and artist would be helpful as well. Cheers, /YGA 回答1: Taken from a script I made a while ago for embedding lyrics into MP3 files: http://code.activestate.com/recipes/577138-embed-lyrics-into-mp3-files-using-mutagen-uslt-tag/ The relevant part is: from mutagen.id3 import

Reading file data during form's clean method

元气小坏坏 提交于 2019-12-03 03:52:46
问题 So, I'm working on implementing the answer to my previous question. Here's my model: class Talk(models.Model): title = models.CharField(max_length=200) mp3 = models.FileField(upload_to = u'talks/', max_length=200) Here's my form: class TalkForm(forms.ModelForm): def clean(self): super(TalkForm, self).clean() cleaned_data = self.cleaned_data if u'mp3' in self.files: from mutagen.mp3 import MP3 if hasattr(self.files['mp3'], 'temporary_file_path'): audio = MP3(self.files['mp3'].temporary_file

after using python mutagen,metatags not displayed

本秂侑毒 提交于 2019-12-02 08:46:40
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 after running the program.The id3 tag version changed from ID3v2.3 to ID3v2.4.So I tried using the

Optimizing Python Code Using SQLite3 + Mutagen

怎甘沉沦 提交于 2019-12-02 00:52:09
问题 I'm in the process of improving an open-source music database, which reads songs in from my collection and stores them to an SQLite database. In turn, I'm able to leverage the database to find duplicates, run queries on my collection, and (if I so desired) find duplicate songs in the collection. To read the metadata from the music files, I'm leveraging the Mutagen library, and to store the metadata, I'm using SQLite3. I wanted to test the code I had authored on a sizable collection, so I

Optimizing Python Code Using SQLite3 + Mutagen

人盡茶涼 提交于 2019-12-01 21:09:58
I'm in the process of improving an open-source music database, which reads songs in from my collection and stores them to an SQLite database. In turn, I'm able to leverage the database to find duplicates, run queries on my collection, and (if I so desired) find duplicate songs in the collection. To read the metadata from the music files, I'm leveraging the Mutagen library, and to store the metadata, I'm using SQLite3. I wanted to test the code I had authored on a sizable collection, so I contacted fellow students and family, and came across a total test size of about 90,000. This also consists

How to set: “artist”, “album artist”, “year”, “album”, “song number” and “title” fields of the tag, with mutagen

别说谁变了你拦得住时间么 提交于 2019-12-01 12:51:10
I'm trying to use mutagen (with Python 2.7.5) to create a program that, given that the path to songs is ...\Artist\Year Album\Songnumber Title.mp3 , sets the artist, album artist, year, album, song number and title tags of the song, and preserves the genre tag. I tried to do this with EasyID3 , but it doesn't have the album artist tag. I also tried to do it with regular ID3 , but I ran into a couple of problems with it. Here's the code I used: from mutagen.id3 import ID3, TIT2, TPE2, TALB, TPE1, TYER, TDAT, TRCK, TCON, TORY, TPUB p = "E:\\Musik\\Aeon\\2005 Bleeding the False\\01 Cenobites -

How to set: “artist”, “album artist”, “year”, “album”, “song number” and “title” fields of the tag, with mutagen

半城伤御伤魂 提交于 2019-12-01 11:42:21
问题 I'm trying to use mutagen (with Python 2.7.5) to create a program that, given that the path to songs is ...\Artist\Year Album\Songnumber Title.mp3 , sets the artist, album artist, year, album, song number and title tags of the song, and preserves the genre tag. I tried to do this with EasyID3, but it doesn't have the album artist tag. I also tried to do it with regular ID3, but I ran into a couple of problems with it. Here's the code I used: from mutagen.id3 import ID3, TIT2, TPE2, TALB, TPE1