HydrogenAudio

Hosted Forums => foobar2000 => Uploads - (fb2k) => Topic started by: 2E7AH on 2009-05-28 15:27:52

Title: Python Grabber scripts
Post by: 2E7AH on 2009-05-28 15:27:52
Some users reported errors using the scripts I posted here (http://www.hydrogenaudio.org/forums/index.php?showtopic=62821&view=findpost&p=626828)
The errors are result of incorrectly saving the copied scripts, probably indentation errors, so I'm posting those scripts as ready made files here:

[attachment=5122:Discogs.zip]
Title: Python Grabber scripts
Post by: auldyin on 2009-05-28 18:19:08
Some users reported errors using the scripts I posted here (http://www.hydrogenaudio.org/forums/index.php?showtopic=62821&view=findpost&p=626828)
The errors are result of incorrectly saving the copied scripts, probably indentation errors, so I'm posting those scripts as ready made files here:

[attachment=5122:Discogs.zip]


Many thanks!!

Works a treat


Title: Python Grabber scripts
Post by: 2E7AH on 2009-06-22 23:24:56
[attachment=5177:lrcDB.zip] Search format: artist-title. LRC (time-stamped) lyrics. 26 252 records Link (http://www.lrcdb.org)

[attachment=5178:LyricsNET.zip] Search format: artist-album-title. 184 912 records Link (http://lyrics.net.ua)

[attachment=5179:LyricsTime.zip] Search format: artist-title. We have added around 1.000.000 (http://www.lyricstime.com/news/) new song lyrics (2007) Link (http://www.lyricstime.com)

[attachment=5180:LyricsTXT.zip] Search format: artist-title. This is the same server as lyricsreg.com. More then 700 000 records Link (http://www.lyricstxt.com)

[attachment=5181:pLyrics.zip] Search format: artist-title. PLyrics is lyrics source dedicated to punk music Link (http://www.plyrics.com)

[attachment=5182:Songmeanings.zip] Search format: artist-title. Artists: 39,266; Songs: 446,280; Albums: 14,226 Link (http://www.songmeanings.net)

For questions about python grabber go here (http://www.hydrogenaudio.org/forums/index.php?showtopic=62821)
Title: Python Grabber scripts
Post by: 2E7AH on 2009-06-24 12:46:45
Mistype error corrected and some specific parsing, and also descripton should refer to lyricslib.com (not to lyricsreg.com):

[attachment=5184:LyricsTXT.zip]Search format: artist-title. This is the same server as for lyricslib.com. More then 700 000 records Link (http://www.lyricstxt.com)
Title: Python Grabber scripts
Post by: 2E7AH on 2009-06-24 15:15:40
Mistype error corrected and some specific parsing, and also descripton should refer to lyricslib.com (not to lyricsreg.com):

[attachment=5185:LyricsTXT.zip]Search format: artist-title. This is the same server as for lyricslib.com. More then 700 000 records

[attachment=5186:LyricsTime.zip]Search format: artist-title. More than 1.000.000 records
Title: Python Grabber scripts
Post by: 2E7AH on 2009-06-24 19:56:14
corrected code page for accented chars etc.

[attachment=5191:Songmeanings.zip]
[attachment=5190:pLyrics.zip]
[attachment=5187:LyricsNET.zip]
[attachment=5189:LyricsTXT.zip]
[attachment=5188:LyricsTime.zip]
Title: Python Grabber scripts
Post by: 2E7AH on 2009-06-24 21:33:36
[attachment=5194:AMG_review.zip]
Title: Python Grabber scripts
Post by: elenhil on 2009-06-26 12:40:24
Same error as before:

Code: [Select]
foo_grabber_python: Traceback (most recent call last):
  File "C:\Program Files\foobar2000\pygrabber\scripts\LyricsTXT.py", line 41, in Query
    url = 'http://www.lyricstxt.com/lyrics/'+artist[0]+'/'+artist+'/'+title+'_lyrics.html'
IndexError: string index out of range

Title: Python Grabber scripts
Post by: 2E7AH on 2009-06-26 15:17:59
That can only happen if you don't have artist tag, right?
Title: Python Grabber scripts
Post by: 2E7AH on 2009-06-26 16:57:49
Updated AMG review:

[attachment=5204:AMG_review.zip]
Title: Python Grabber scripts
Post by: elenhil on 2009-06-26 21:45:37
That can only happen if you don't have artist tag, right?

Quite possible!
Title: Python Grabber scripts
Post by: tere on 2009-06-29 06:24:05
maybe there is a way to make a plugin also www.lololyrics.com 
Title: Python Grabber scripts
Post by: 2E7AH on 2009-06-29 23:53:22
maybe there is a way to make a plugin also www.lololyrics.com 

I'll look through it tomorrow. As I see quickly right now they don't have some straight search engine, but we'll see
Title: Python Grabber scripts
Post by: 2E7AH on 2009-06-30 16:36:09
[attachment=5212:lololyrics.zip]Search format: artist-title. We are the leading lyrics site specialized only on electronic music with over 8000 lyrics spread over genres such as Hardstyle, Hardcore/Gabber, Drum & Bass and Psychedelic Trance link (http://www.lololyrics.com/)

Possible problems with accented characters. I tested the script very little lacking the music for which lyrics are offered
Title: Python Grabber scripts
Post by: tberman333 on 2009-09-22 02:46:34
Updated AMG review:
  • faster
  • if fetching multiple releases (release with no review got assigned to previous review value) corrected

[attachment=5204:AMG_review.zip]


Where did this one go??
Title: Python Grabber scripts
Post by: q-stankovic on 2009-09-22 17:31:46
Hello 2E7AH! 

I tried to download some of your scripts , but i have absolutely no idea what to do with such an information: "[attachment=5190:pLyrics.zip]". Hope you can help.

By the way:

Would really love to see a script for that hip-hop lyrics archive
http://www.ohhla.com/ (http://www.ohhla.com/)
Title: Python Grabber scripts
Post by: 2E7AH on 2009-09-23 20:05:50
Some strange interest in scripts today
I'll upload them again these days, I was waiting for new python grabber release but still waiting

Would really love to see a script for that hip-hop lyrics archive
http://www.ohhla.com/ (http://www.ohhla.com/)

Sorry q-stankovic, but I can't test hip-hop lyrics because I don't have that kind of music (same for reggae, funk/soul, latin etc)
If you have some other lyrics vendor I would try, and if you have some LRC provider than certainly
Title: Python Grabber scripts
Post by: q-stankovic on 2009-09-25 17:18:39
Sorry q-stankovic, but I can't test hip-hop lyrics because I don't have that kind of music (same for reggae, funk/soul, latin etc)


Do you need real files to be tagged with LYRICS or would it be enough to have a database.fpl file? In the latter case i could create one and send it to you.
Title: Python Grabber scripts
Post by: 2E7AH on 2009-09-25 17:37:51
hm... I don't know what you mean with database playlist, but for simplicity just select couple of your hip-hop albums and save playlist as M3U (if you have skipyrich's EXTM3U (http://skipyrich.com/wiki/Foobar2000:EXTM3U_playlist_format_plugin) then better)

I'll do the script, but it will be somewhere this week and not in a day or two, because of some other things
Title: Python Grabber scripts
Post by: 2E7AH on 2009-09-25 18:56:15
Also maybe isn't so good idea making lyrics grabber for this site:
1. they don't have search engine as I see
2. if the author isn't some f***ing "50 cent" or something like that, they redirect to FTP and there is not simple way to compare album/title name with their FTP folders - i.e. some random artist: "504 Boyz" has album "Lil' Romeo, Magic" and the folder name is "rm_bside" and then title "Tight Whips" with filename "t_whips.504.txt"

So sorry again, if there isn't search engine I won't bother
Title: Python Grabber scripts
Post by: q-stankovic on 2009-09-26 15:07:33
I'll do the script, but it will be somewhere this week and not in a day or two, because of some other things

I never expected that you write the script so fast!


Also maybe isn't so good idea making lyrics grabber for this site ...


That's a pity! Thanks for considering.
Title: Python Grabber scripts
Post by: 2E7AH on 2009-10-11 07:04:23
Here are updated AMG scripts:

[attachment=5438:AMG.rar]
- AMG_Genre.py
- AMG_Mood.py
- AMG_Review.py
- AMG_Style.py
- AMG_Theme.py

All AMG releases should return %genre% at least, then %style%, %amg_review%, %mood%, %theme% - in this line of importance
%artist% tag should be as they are on AMG - i.e. MusicBrainz tags artist as "Gabrielle Roth and the Mirrors", but maybe AMG tags tham as "Gabrielle Roth & the Mirrors" so there will be no results. But this are special cases perhaps

I'll soon update other missing scripts too
Title: Python Grabber scripts
Post by: 2E7AH on 2009-10-16 14:40:14
Updated AMG review script:

[attachment=5448:AMG_Review.rar]
- changed %artist% to %album artist%
- now stops on first (most probable) release match, and not on last as it was (I forgot to add break in a loop )
- releases with large review now get full review (was "Read more...")

I guess this is final update. Report for problems or suggestions are welcomed
Title: Python Grabber scripts
Post by: Benji99 on 2009-10-29 01:32:40
Hey 2E7AH,

Any chance you could make a script for http://www.uta-net.com/ (http://www.uta-net.com/) ? It's a fantastic lyrics site for Japanese songs.
The best way to run searches is probably by song name, and the word in japanese word for that is: 曲名
Also this word means artist: 歌手名
An example of a search you can do using a artist name and song names in english letters would be:
Artist: Mr.Children
Song: Gift

I've noticed however that if you run a search for a song that's written with Japanese characters, the keyword in the search gets converted into hex (or something similar). An example would be if you search for this: 大阪で生まれた女 (Song name)

Huge thanks in advance!
Title: Python Grabber scripts
Post by: 2E7AH on 2009-10-29 01:58:02
 Aren't you from Canada?

It looks easy to find the lyrics response, but the lyrics are presented in Flash, so impossible with python grabber. Sorry
Title: Python Grabber scripts
Post by: Benji99 on 2009-10-29 02:13:26
Aren't you from Canada?

It looks easy to find the lyrics response, but the lyrics are presented in Flash, so impossible with python grabber. Sorry


I'm from Canada, but I can read/understand Japanese , also I lived in japan for 1 year and accumulated a pretty big collection of Japanese music!

It's too bad about the above site. Actually, I found an alternative site that uses the same back-end for Lyrics but doesn't seem to use flash.
Here it is: http://music.goo.ne.jp/lyric/index.html (http://music.goo.ne.jp/lyric/index.html)

1/2 way down the page you'll see a search box labelled: ?? - ????
Same concept as the other site, if you select ?? you can search by song. (??????? is for searching by artist name)
The button you need to click to search is labelled: ????

Hope you can do something with this one!
Thanks again
Title: Python Grabber scripts
Post by: 2E7AH on 2009-10-29 02:19:33
I'll try this one, it should be OK (although don't know if characters will mess something but will see)

Do you know how many lyrics they have?
Title: Python Grabber scripts
Post by: Benji99 on 2009-10-29 02:36:04
I'll try this one, it should be OK (although don't know if characters will mess something but will see)

Do you know how many lyrics they have?



Thanks!
Well according to uta-net, they have 84,000 songs in the database.
I got tons of obscure Japanese songs, for example stuff from the 1960s, etc, and every single one I was able to find in the database.

Thanks again!
Title: Python Grabber scripts
Post by: 2E7AH on 2009-10-31 05:12:36
Benji99, here is the script:

[attachment=5458:goo.rar]
I've tested it by tagging some files with title/artist present on site, and it worked. If you find any problems post

What I've learned?
- Japanese glyphs have many encodings
- some sites don't like python
- even more about Unicode
Title: Python Grabber scripts
Post by: 2E7AH on 2009-11-10 08:31:23
Once again AMG scripts

Now GENRE, STYLE, MOOD and THEME can be assigned at once with:
[attachment=5477:AMG_Release.rar]
and new AMG review with custom user-agent report, loosen artist match and option to print some info in console:
[attachment=5478:AMG_Review.rar]

Here is example for AMG_Release:

1. Select custom tag in python grabber settings:

(http://img132.imageshack.us/img132/6941/sshot2b.png)

2. run the script and update files

3. select Properties > Tools > Automatically fill values
    source: Other and your custom tag
    pattern: [font= "Courier New"]Genres: %genre% \\ Styles: %style% \\ Moods: %mood% \\ Themes: %theme%[/font]

(http://img136.imageshack.us/img136/5007/sshot3qr.png)

4. then remove AMG tag and with Ctrl - click select newly added tags (GENRE, STYLE, MOOD and THEME) and select "Split values" then OK

If we have GENRE and STYLE tags and don't want to update them, than we enter this pattern i.e.: [font= "Courier New"]%tmp% \\ Moods: %mood% \\ Themes: %theme%[/font] so that GENRE and STYLE remains untouched

As a reminder all AMG scripts rely mostly on correct release (%album%) name
And do comment about problems, I'm rewriting this scripts as I run to some inconsistencies
Title: Python Grabber scripts
Post by: 2E7AH on 2009-11-10 10:08:39
Download this AMG release script:
[attachment=5480:AMG_Release.rar]
Problem with previous here: http://www.hydrogenaudio.org/forums/index....st&p=666954 (http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=76066&view=findpost&p=666954)

Now use this pattern:
Genres:%genre% \\ Styles:%style% \\ Moods:%mood% \\ Themes:%theme%
Title: Python Grabber scripts
Post by: tberman333 on 2009-11-10 14:17:50
Thank you!  This is great!

Download this AMG release script:
[attachment=5480:AMG_Release.rar]
Problem with previous here: http://www.hydrogenaudio.org/forums/index....st&p=666954 (http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=76066&view=findpost&p=666954)

Now use this pattern:
Genres:%genre% \\ Styles:%style% \\ Moods:%mood% \\ Themes:%theme%

Title: Python Grabber scripts
Post by: 2E7AH on 2009-11-10 15:22:51
Enjoy
I didn't forgot about composer/performer conversation, I'll post that soon

Here is masstagger script for cleaning the %amg% tag (Canar's version (http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=76066&view=findpost&p=667008)): just run it after the script (if %genre% and %style% should be preserved delete first two action from masstagger script):
[attachment=5484:AMG_release_MTS.rar]
Title: Python Grabber scripts
Post by: tberman333 on 2009-11-10 17:10:14
Enjoy
I didn't forgot about composer/performer conversation, I'll post that soon

Thank you very much... I will wait on tagging any Various Artist Albums until that one comes.

Here is masstagger script for cleaning the %amg% tag (Canar's version (http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=76066&view=findpost&p=667008)): just run it after the script (if %genre% and %style% should be preserved delete first two action from masstagger script):
[attachment=5484:AMG_release_MTS.rar]


I was just in the process of trying to figure out how to use Masstagger to do this.. they timing on this script is perfect!

By the way, I have been using the Python scripts on a few albums this morning and they are working great!
Title: Python Grabber scripts
Post by: Benji99 on 2009-11-11 06:29:38
Benji99, here is the script:

[attachment=5458:goo.rar]
I've tested it by tagging some files with title/artist present on site, and it worked. If you find any problems post

What I've learned?
- Japanese glyphs have many encodings
- some sites don't like python
- even more about Unicode



Huge thanks for this script!!
It works really well, except for a couple small bugs, if you have some free time, ...

1st bug:
Certain track titles make the script crash.
Code: [Select]
foo_grabber_python: Traceback (most recent call last):
  File "I:\Program Files\foobar2000\pygrabber\scripts\goo.py", line 63, in Query
    raw_title = handle.Format('[%title%]').decode("utf8").encode("euc_jp")
UnicodeEncodeError: 'euc_jp' codec can't encode character u'\uff5e' in position 13: illegal multibyte sequence


This seemingly happens when a track has the '~' character in the title,

A couple examples:
Track title: HIGH G.K LOW ~????~
Artist: GreeeeN

Track title: ?? ~????~
Artist: GreeeeN


Although, this one works:
Track title: ??~?????????????~
Artist: THE BOOM


2nd bug, The script seems to have trouble finding tracks where there's a large amount of tracks with the same name

For example:
Track title: YOU
Artist: ??????????

Track title: ?
Artist: ??????????

I know how this 2nd bug can be fixed I think, I found out that the site has a more advanced search function:
http://music.goo.ne.jp/lyric/db.php (http://music.goo.ne.jp/lyric/db.php)
There you can enter both the artist (???????) and track title (??)
If you can modify the script to use that page instead, it would make it really accurate!

Huge thanks again!
Sebastien






Title: Python Grabber scripts
Post by: 2E7AH on 2009-11-11 07:05:45
1st bug:
Certain track titles make the script crash.
Code: [Select]
foo_grabber_python: Traceback (most recent call last):
  File "I:\Program Files\foobar2000\pygrabber\scripts\goo.py", line 63, in Query
    raw_title = handle.Format('[%title%]').decode("utf8").encode("euc_jp")
UnicodeEncodeError: 'euc_jp' codec can't encode character u'\uff5e' in position 13: illegal multibyte sequence


This seemingly happens when a track has the '~' character in the title

Is that happening only with that character? It can be easily fixed if so.
That character is fullwidth tilde "?" not ordinar tilde "~".

2nd bug, The script seems to have trouble finding tracks where there's a large amount of tracks with the same name

Yeah, I would expect that, because script only tries to find match in first result page, and there can be more pages for some common title names.
I'll check your suggestion, and try to make the script better
Title: Python Grabber scripts
Post by: T.P Wang on 2009-11-21 02:09:11
@2E7AH:
I think replace the u'\uff5e' is a workaround:
Code: [Select]
s = handle.Format('[%title%]').decode("utf8")
raw_title = string.replace(s, u'\uff5e', u'\u301c').encode("euc_jp")
Title: Python Grabber scripts
Post by: Benji99 on 2009-11-21 03:31:53
Is that happening only with that character? It can be easily fixed if so.
That character is fullwidth tilde "~" not ordinar tilde "~".


Oops, forgot to respond to this, whenever it crashes, that character is always in the the track title.
Thanks

Btw, as far as making a more complete AMG script. Since I wrote The Godfather scripts for this already years ago. There's a few inconsistencies with the site. For example, the way to displays the performer and composer. It changes sometimes, in particular, it handles Various Artists albums and albums where a few tracks are collaborated by 2nd performer differently. If you can read Delphi and interested in my logic for how I coded around it, drop me a PM with your email, I'll send them to you

I've been wanting to update it in Python but I found Python really hard to read/understand...
Title: Python Grabber scripts
Post by: garbanzo.bean on 2010-01-08 14:54:22
2E7AH, i'm trying to use your AMG script, but have trouble with the "split values" step. the values don't seem to be splitting. when i set up a Filter to show %mood%, for example, the entries are not separate, and i get things like "Uncompromising; Fiery; Literate; Cerebral; Brooding" all on one line.

what am i doing wrong?
Title: Python Grabber scripts
Post by: tberman333 on 2010-01-08 15:46:10
2E7AH, i'm trying to use your AMG script, but have trouble with the "split values" step. the values don't seem to be splitting. when i set up a Filter to show %mood%, for example, the entries are not separate, and i get things like "Uncompromising; Fiery; Literate; Cerebral; Brooding" all on one line.

what am i doing wrong?


I think you need to make sure that "MOODS" is listed as a Multivalue field in Preferences/Advanced/Display/Properties Dialog
Title: Python Grabber scripts
Post by: tore on 2010-03-15 11:29:33
I have a quick question regarding the python discogs genre/style grabber scripts.

How do you know you've gone over the 5000 limit? Does the lookup just fail?

edit :

And the AMG script gives me reviews in the AMG tags

Example :

Quote
New horizons in historic jazz reissuing were revealed in 2005 when Jazz Oracle came out with a double-CD compendium of recordings made for about a dozen different labels between October 1924 and February 1933 in Vienna, Paris, and Berlin, all involving bandleader Lud Gluskin (1898-1989). Andreas Schmauder, apparently one of the world's leading Gluskin authorities, was asked to paw through literally hundreds of 78 rpm platters to designate the 48 titles included in this package, which is loaded with precious photographs and fascinating information. Gluskin first appears as a drummer with Paul Gason and His Versatile Orchestra. "Ain't She Sweet?" is performed by the Playboys, a Detroit-based band that would soon morph into an expanded and more versatile orchestra under Gluskin's direction. Subsequent billings list the perpetually evolving group as Lud Gluskin and His Versatile Juniors, Lud Gluskin et Son Jazz Orchestre Lud Gluskin, "Lud" Gluskin Ambassadonians, Lud Gluskin and his Ambassadors Orchestra, Jazz-Orchester Lud Gluskin, and finally Lud Gluskin et son Orchestre, which is the name they appeared under most often when serenading patrons at the Casino de Paris. The sound of the band often brings to mind great old-time jazz heroes like the Original Memphis Five, Red Nichols, Miff Mole, Bix Beiderbecke, Frankie Trumbauer, Frank Teschmacher and Jean Goldkette, whose arrangements were in fact used by Gluskin from time to time. Material ranges from hot novelty dance music and traditional pop tunes to substantial jazz numbers like "Tiger Rag," "Milenberg Joys," "Clarinet Marmalade," W.C. Handy's "St. Louis Blues," Fats Waller's "Whiteman Stomp," and Fud Livingston's "Feelin' No Pain." Jazz Oracle continues to astonish and delight all who are fascinated with obscure jazz records from the early 20th century. This installment is particularly rewarding.

AMG Review by arwulf arwulf


This was in one of my files' AMG tag!


edit again :


You had another script for looking up tags from Last.FM. Using this would cause inconcistency with the discogs way of tagging which has a more strict set of styles and genres allowed (http://wiki.discogs.com/index.php/Style_Guide-Related_Styles_Lists). Would it be possible somehow to tag using the last.fm method only if the style/genre appears in the discogs list of styles and genre, for example if such a list was saved as a .txt file?
Title: Python Grabber scripts
Post by: 2E7AH on 2010-03-15 12:15:09
Would it be possible somehow to tag using the last.fm method only if the style/genre appears in the discogs list of styles and genre, for example if such a list was saved as a .txt file?

Script like that exists for Picard tagger, and it seems reasonable because last.fm tags are mess. I don't use last.fm script, and I'm not interested in making it happen, but script is there so maybe you can extend it a bit
Title: Python Grabber scripts
Post by: tore on 2010-03-15 14:05:20
By the way, I did find this little piece of information posted on the discogs forums about a month ago :

Quote
It's in our plans to remove the 5000 per day limit. That should happen within the next 2 months.
Source! (http://www.discogs.com/help/forums/topic/204556)

That should greatly enhance the usefulness of your discogs scripts
Title: Python Grabber scripts
Post by: tore on 2010-03-15 19:11:55
I've now tried playing around with your last.fm script to see if I can tailor it to fetch other sorts of last.fm info. However, my lack of knowledge with Python is a hindrance! I've changed the script slightly so that it fetches similar artists.

Here's an example of the information the script can get : http://ws.audioscrobbler.com/2.0/?method=a...ac220b7b2e0a026 (http://ws.audioscrobbler.com/2.0/?method=artist.getsimilar&artist=Madonna&limit=3&api_key=b25b959554ed76058ac220b7b2e0a026)

I've set a limit to 3 artists. However, I have a hard time getting all three artists - I can only fetch one, just like you only wanted the top tag. So my question is, what do I have to do with this piece of code so that I can fetch all three similar artists?

Code: [Select]
                child = doc.getElementsByTagName("artist")[0]
                toptag = child.getElementsByTagName("name")[0]
                lyric = toptag.childNodes[0].data.encode('utf_8').capitalize()

I see changing the value between the brackets in the "("artist")[0]" snippet changes the information retrieved to the next artist. However, I can't figure out how to get them all in one go!
Title: Python Grabber scripts
Post by: 2E7AH on 2010-03-15 19:28:23
look at the other last.fm script, i.e.

Code: [Select]
toptags = child.getElementsByTagName("tag")
tags=[]
for i in toptags:
    tags.append(str(i.getElementsByTagName("name")[0].toxml()).replace('<name>','').replace('</name>','').capitalize( ))
lyric=str(tags).strip('[]').replace(',', ';').replace('\'','')


try something like that
Title: Python Grabber scripts
Post by: tore on 2010-03-15 19:38:59
look at the other last.fm script, i.e.

Code: [Select]
toptags = child.getElementsByTagName("tag")
tags=[]
for i in toptags:
    tags.append(str(i.getElementsByTagName("name")[0].toxml()).replace('<name>','').replace('</name>','').capitalize( ))
lyric=str(tags).strip('[]').replace(',', ';').replace('\'','')

try something like that

Thanks for the suggestion  I now get a syntax error in some of the code you posted. To make it a little easier, here's a larger snippet with your suggestion pasted in :

Code: [Select]
            artist = handle.Format("[%artist%]")
            title = handle.Format("3")

            try:
                string=urllib.urlopen('http://ws.audioscrobbler.com/2.0/?method=artist.getsimilar&artist=' + artist.lower().replace(' ','+') + '&limit=' + title.lower().replace(' ','+') + '&api_key=' + api_key).read()
                doc = minidom.parseString(string)
                toptags = child.getElementsByTagName("tag")
                tags=[]
            for i in toptags:
                tags.append(str(i.getElementsByTagName("name")[0].toxml()).replace('<name>','').replace('</name>','').capitalize( ))
                lyric=str(tags).strip('[]').replace(',', ';').replace('\'','')
                result.append(lyric)
            except Exception, e:
                traceback.print_exc(file=sys.stdout)
                result.append('')
            continue

        return result

if __name__ == "__main__":
    LyricProviderInstance = LastFm_TopTag()
Title: Python Grabber scripts
Post by: 2E7AH on 2010-03-15 19:48:16
I just pasted that part from that other last.fm script, it wasn't intended for literal use, but as example
Look at your XML response: there isn't "tag" node anywhere, so use what you need, and play a little

[edit] to help you a bit:

where is your "child" variable that you are calling with "toptags" and pasting to look for "tag" node (which doesn't exist BTW in XML response as said)?
why "doc" isn't called?
name those variables meaningful to you

you can explicitly set title, no need for "handle.Format" if you don't need info for some tag to be provided
Title: Python Grabber scripts
Post by: tore on 2010-03-15 20:38:17
I just pasted that part from that other last.fm script, it wasn't intended for literal use, but as example
Look at your XML response: there isn't "tag" node anywhere, so use what you need, and play a little

[edit] to help you a bit:

where is your "child" variable that you are calling with "toptags" and pasting to look for "tag" node (which doesn't exist BTW in XML response as said)?
why "doc" isn't called?
name those variables meaningful to you

you can explicitly set title, no need for "handle.Format" if you don't need info for some tag to be provided

Actually, after your last post, I got somewhat confused and thought I'd try and break it down to something I could understand. I've never looked at Python coding before today, so be aware that much of the code - especially what you pasted - is completely foreign to me. This is something rough I managed to do on my own :

Code: [Select]
string=urllib.urlopen('http://ws.audioscrobbler.com/2.0/?method=artist.getsimilar&artist=' + artist.lower().replace(' ','+') + '&limit=' + title.lower().replace(' ','+') + '&api_key=' + api_key).read()
doc = minidom.parseString(string)
child = doc.getElementsByTagName("artist")[0]
toptag1 = child.getElementsByTagName("name")[0]
child = doc.getElementsByTagName("artist")[1]
toptag2 = child.getElementsByTagName("name")[0]
child = doc.getElementsByTagName("artist")[2]
toptag3 = child.getElementsByTagName("name")[0]
lyric1 = toptag1.childNodes[0].data.encode('utf_8').capitalize()
lyric2 = toptag2.childNodes[0].data.encode('utf_8').capitalize()
lyric3 = toptag3.childNodes[0].data.encode('utf_8').capitalize()
result.append(lyric1)

This gives me 3 variables - lyric1, lyric2, lyric3. They are the names of the artists I'm trying to fetch. I can change the variable appended in the last line to call the different bands/artists. However, if I try to append several, for example by doing this :

Code: [Select]
result.append(lyric1)
result.append(lyric2)
result.append(lyric3)

.. It finds the tags, but applying them causes foobar to crash completely!

Sorry for abandoning your example. Your added hints seem helpful so I will look it over again. However, if you want to help me out with what I got to do to get lyrics1, 2 and 3 appended to the result variable, I'll be happy.
Title: Python Grabber scripts
Post by: 2E7AH on 2010-03-15 20:51:16
hey, why ride motorcycle when I have my bike 

leave it for tomorrow

BTW %lastfm_similar_artist% is already provided by biography view component for nowplaying artist
Title: Python Grabber scripts
Post by: tore on 2010-03-15 21:34:54
hey, why ride motorcycle when I have my bike 

leave it for tomorrow

BTW %lastfm_similar_artist% is already provided by biography view component for nowplaying artist

Don't worry about it! I made something that works, although I'm sure the code will make any regular Python programmer wince.

To summarize, this (horrible, but working) modification of 2E7AH's Last.FM genre-tagging script will fetch the 3 most similar artists from last.fm and write them to a tag, f.ex "Hidria Spacefolk; Gong; Kingston Wall".

Code: [Select]
import urllib
from xml.dom import minidom
from encodings import utf_8
from grabber import LyricProviderBase

class LastFm_TopTag(LyricProviderBase):
    def GetName(self):
        return "LastFm Similarity"

    def GetVersion(self):
        return "0.1"

    def GetURL(self):
        return "http://ws.audioscrobbler.com/"

    def Query(self, handles, status, abort):
        result = []
        api_key = 'b25b959554ed76058ac220b7b2e0a026'

        for handle in handles:
            status.Advance()

            if abort.Aborting():
                return result

            artist = handle.Format("[%artist%]")
            title = handle.Format("3")

            try:
                string=urllib.urlopen('http://ws.audioscrobbler.com/2.0/?method=artist.getsimilar&artist=' + artist.lower().replace(' ','+') + '&limit=' + title.lower().replace(' ','+') + '&api_key=' + api_key).read()
                doc = minidom.parseString(string)
                child = doc.getElementsByTagName("artist")[0]
                toptag1 = child.getElementsByTagName("name")[0]
                child = doc.getElementsByTagName("artist")[1]
                toptag2 = child.getElementsByTagName("name")[0]
                child = doc.getElementsByTagName("artist")[2]
                toptag3 = child.getElementsByTagName("name")[0]
                lyric = toptag1.childNodes[0].data.encode('utf_8').capitalize() + ('; ') +  toptag2.childNodes[0].data.encode('utf_8').capitalize() + ('; ') + toptag3.childNodes[0].data.encode('utf_8').capitalize()
                result.append(lyric)
            except Exception, e:
                traceback.print_exc(file=sys.stdout)
                result.append('')
            continue

        return result

if __name__ == "__main__":
    LyricProviderInstance = LastFm_TopTag()
Title: Python Grabber scripts
Post by: 2E7AH on 2010-03-15 22:00:28
I made something that works

Now that's a feeling
Title: Python Grabber scripts
Post by: tore on 2010-03-15 22:14:22
I made something that works

Now that's a feeling


No, I've tested it on thousands of files already and it does work - at least on my computer, my foobar and my media library. Maybe not always, but most of the time. You should know the code well .. You wrote most of it after all.

edit:

By the way, to all who are interested in such scripts - it should also be possible to fetch information about artists from Wikipedia. It sometimes contains information like bands and artists' countries of origin which might not be available elsewhere. One obvious problem with that is that if you do a search for "KISS" for example, you will get to an article about kissing and not the band. However, I found a blog entry which has a simple workaround for this problem and provides a python code example. The solution is to use the musicbrainz database to find the right wikipedia article as that information gets stored in entries there.

If any Python clever people want to look into it, check here : http://www.davidcraddock.net/2008/09/22/sc...artists-part-2/ (http://www.davidcraddock.net/2008/09/22/scraping-wikipedia-information-for-music-artists-part-2/)
Title: Python Grabber scripts
Post by: tore on 2010-03-15 23:26:05
For an example of what information could be pulled from Wikipedia/dbpedia, check out this page, using the band KISS as an example (again) :

http://dbpedia.org/page/Kiss_%28band%29 (http://dbpedia.org/page/Kiss_%28band%29)
Title: Python Grabber scripts
Post by: tore on 2010-03-19 14:05:02
To anyone having a problem with the discogs 5000 requests limit

The usefulness of 2E7AH's discogs tagging scripts is somewhat limited because of the current 5000 requests limit per 24 hours from the discogs database. 5000 files is a rather small part of my library - and I need to request both genre and style, limiting it to 2500 files for both tags. Because of this, I tried to come up with a solution to this problem - and I have.

First, 2E7AH's style and genre scripts ask for information about the artist and album, but not track title. If you can tag one file from an album, you already know what the genre and style tags should be for the rest of the tracks on that album. If you could tag one file in an album and then copy those tags to the rest of the tracks in that album, you could tag 2500 albums (2500 requests for style + 2500 for genre) rather than 2500 songs.

The practical solution was to do a query (autoplaylist) in the library that shows only the first track from albums. Then I tagged as much as I could of those with Genre and Style from Dicogs. For those that were successful, I gave a new tag, GSTAGGED. Then I rewrote one of 2E7AH's python script to make one which is able to copy tags from that track 1 file and apply it to the other files in the selection. The way it works is way too simple to be foolproof, so you have to use it with care. Every time it meets a file that has the GSTAGGED tag, it writes that file's Genre and Style into a .txt file for storage. When it meets a file which does not contain GSTAGGED, it tags it with the information stored in that text file.

Every time it meets a new GSTAGGED file, the text file is updated and rewritten with the new info. In effect, it works perfectly as long as you tag a selection of albums where each album's first song has been tagged correctly by discogs. If you tag two albums where the first album's first track is correctly tagged and none of the files of the other album are tagged (or more specific, contains the GSTAGGED tag), then the second album will get the tags from the first album. This is why it's not foolproof, so you have to take a little care with your selection.

The output of the script is "%genre%//%style%" so if I write those to a new tag, f.ex COPYTAGS, I can use the "automatically fill values" to split that tag into the correct discogs genre / style tags.


It still requires a little manual labour - making sure you get the right selection of files from your library that you apply the script on (although making a check against album shouldn't be hard even for me to incorporate), but that's about it. I don't wanna post the script here because it's pretty sloppy and I'm 95% sure a lot of those previously active in this thread can find a better way to handle this problem with less chance of getting your stuff tagged wrong. More, I'm posting this as a suggestion for how to address this problem. Maybe someone can refine my approach and make a better script or they could be inspired to find a different solution. Of course, if anyone really wants my modification of 2E7AH's script, just tell me here or send me a PM.
Title: Python Grabber scripts
Post by: 2E7AH on 2010-03-19 17:52:49
I didn't bothered with 5000 limit on Discogs, which BTW as you posted earlier will be changed in a month or so, but I did for AMG scripts (for obvious reasons):

Code: [Select]
try:
    if album == tmp:
        result.append(amg)
    else:
        tmp = album
        amg = ''

So feel free to upload your modification here as it will be also much faster this way

Another solution in such cases would be using proxy in foobar networking preferences, thou it wont be faster nor you can use proxy lists easily

Problem with transferring tag value from one album item to the rest seems interesting: I would have used text tools component and skip/duplicate line feature for outputting the result for additional processing
Title: Python Grabber scripts
Post by: tore on 2010-03-20 01:03:21
Here's a modification of what I described above.

This python script which is a modification of 2E7AH's scripts fetches Genre and Style from discogs. When it meets a track from an album it has not processed before, it writes those tags to a text file. If it meets a track from an album it has processed a track from before, it does not check discogs - rather, it just fetches the tags from those text files. In essence, it fetches discogs genre and style while minimizing the amount of requests. This will allow you to tag thousands more files per 24 hours. For temporary storage of information, it uses text files.

My text files are in the folder C:\Python26 .. Edit the script and change them for whatever values you want to use!

Code: [Select]
import urllib, urllib2, gzip, cStringIO
import xml.etree.ElementTree
from xml.dom import minidom
from encodings import utf_8
from grabber import LyricProviderBase

class Discogs_GetGenre(LyricProviderBase):
    def GetName(self):
        return 'Discogs GenStyles'
   
    def GetVersion(self):
        return '0.1'

    def GetURL(self):
        return 'http://www.discogs.com'

    def Query(self, handles, status, abort):
        result = []
        api_key = '783001745d'

        for handle in handles:
            status.Advance()
           
            if abort.Aborting():
                return result
           
            artist = handle.Format("[%artist%]")
            album = handle.Format("[%album%]")
            album_file = open("C:\Python26\!album.txt", "r")
            test = album_file.read()
            album_file.close()
           
            try:
                if album == test:
                    text_file = open("C:\Python26\!tag3.txt", "r")
                    writeout = text_file.read()
                    text_file.close()
                    result.append(writeout)
                else:
                    URL_s = 'http://www.discogs.com/search?type=all&q=' + artist.lower().replace(' ','+') + '+' + album.lower().replace(' ','+') + '&f=xml&api_key=' + api_key
                    request = urllib2.Request(URL_s)
                    request.add_header('Accept-Encoding', 'gzip')
                    response = urllib2.urlopen(request)
                    data = response.read()
                    unzipped_data = gzip.GzipFile(fileobj = cStringIO.StringIO(data)).read()
                    res = minidom.parseString(unzipped_data)
                    uri_1 = res.getElementsByTagName("uri")[0]
                    rel_id = uri_1.childNodes[0].data.encode('utf-8').rpartition('/')[2]

                    URL_r = 'http://www.discogs.com/release/' + rel_id + '?f=xml&api_key=' + api_key
                    request = urllib2.Request(URL_r)
                    request.add_header('Accept-Encoding', 'gzip')
                    response = urllib2.urlopen(request)
                    data = response.read()
                    unzipped_data = gzip.GzipFile(fileobj = cStringIO.StringIO(data)).read()
                    xml.etree.ElementTree.fromstring(unzipped_data)

                    def getGenres(tree):
                        genres = []
                        release = tree.find('release')
                        genreList = release.find('genres')
                        if genreList:
                            for i in genreList:
                                genres.append(i.text)
                        return genres
               
                    def getStyles(tree):
                        styles = []
                        release = tree.find('release')
                        styleList = release.find('styles')
                        if styleList:
                            for i in styleList:
                                styles.append(i.text)
                        return styles

                    lyric=getGenres(xml.etree.ElementTree.fromstring(unzipped_data))
                    lyric.append('//')
                    lyric.append(getStyles(xml.etree.ElementTree.fromstring(unzipped_data)))
                    lyric=str(lyric).strip('[').strip(']').replace(',', ';').replace('\'','').replace('[','')
                    result.append(lyric)
                    album_file = open("C:\Python26\!album.txt", "w")
                    album_file.write(album)
                    album_file.close()
                    text_file = open("C:\Python26\!tag3.txt", "w")
                    text_file.write(lyric)
                    text_file.close()             
            except Exception, e:
                traceback.print_exc(file=sys.stdout)
                result.append('')
                album_file = open("C:\Python26\!album.txt", "w")
                album_file.write(album)
                album_file.close()
                text_file = open("C:\Python26\!tag3.txt", "w")
                text_file.write('')
                text_file.close()   
                continue
       
        return result

if __name__ == "__main__":
    LyricProviderInstance = Discogs_GetGenre()

The output to the tag will be "%genre%; //; %style%". I don't know how to get rid of the semicolons just yet, but you can clean those up as you split the tag into genre and style tags.

And yes, it's written quick and dirty. I haven't yet beautified it and the script probably won't look the same tomorrow.

edit :

I've tested it on some 5000 files and it works perfectly
Title: Python Grabber scripts
Post by: xtr on 2010-03-21 22:05:58
Is it possible to use these scripts with a foo_run-service and python directly? Similar to

python.exe AMG_Review.py "Artist Name" "Album Name" OutputFilePath.txt
Title: Python Grabber scripts
Post by: 2E7AH on 2010-03-21 22:21:42
If you have python, I guess you know something about it so stripping the script to work out of foobar wouldn't be that hard
For example you can properly debug them, and with python grabber you only get foobar console as your friend

Why would you like to do that anyway?
Title: Python Grabber scripts
Post by: Benji99 on 2010-03-27 22:15:35
Enjoy
I didn't forgot about composer/performer conversation, I'll post that soon

Here is masstagger script for cleaning the %amg% tag (Canar's version (http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=76066&view=findpost&p=667008)): just run it after the script (if %genre% and %style% should be preserved delete first two action from masstagger script):
[attachment=5484:AMG_release_MTS.rar]



Hey 2E7AH,

Did you ever manage to grab the composer/performer from AMG using Python Grabber?
On another note, it would be nice to be able to grab the track titles too...
Title: Python Grabber scripts
Post by: 2E7AH on 2010-03-29 00:10:40
Are you really counting on that

Script is there, and it's working reasonably - change it slightly for fetching custom info from the matched page:

- open some AMG release page source
- find regexp that matches info that you need (you'll need some tool for that)
- change the regexp string in the script (the second one)
- try it couple of times watching foobar console
+ for composer or titles you'll need to do some more thinking as it is per track based and script is per album

Regexp is easy and not so efficient method, but you can't access AMG web services if you don't pay AFAIK

I'll try to make some AMG script one of these days, that doesn't need python grabber (nor foobar?), but will see stars aspect first so that I don't get called like this again if I don't do it

BTW here are more correct masstagger scripts for AMG release script (originally posted had some glitch):
[attachment=5811:AMG_release_MTS.zip]
Title: Python Grabber scripts
Post by: Benji99 on 2010-03-31 21:13:22
I was thinking of writing a small program (evaluated VB or Python) and have it tag the files using dBpoweramp's OLE COM object.
But then I noticed that VB became a lot more complicated than what I remembered from 10 years ago and Python is still very hard to understand for me.
Anyway I haven't had the time in the last few months to really try to get something going but should be able to starting this summer.

Oh about getting track and composer info, would it be possible to tag all the info into a structured tag on the first file of the album?
For example putting this info in a tag:
<1>Title 1
<2>Title 2
<3>Title 3

And then use a masstagger script to tag the other files with the correct data.

Oh I have a question for you, you mentioned this:

Quote
- find regexp that matches info that you need (you'll need some tool for that)


I wrote some regexp expressions a few years back in order to do the exact same thing in The Godfather, but I did it from scratch. You mentioned a tool, is there an easier more automated way?

Oh just found this site (http://www.txt2re.com/index-python.php3), pretty useful!
Title: Python Grabber scripts
Post by: 2E7AH on 2010-04-01 03:15:34
I'm just working on the script, and it's almost finished, I need to test it a bit and compile it today or tomorrow, then I'll post it in another thread. It fetches everything possible, even song review if it exists and it's loaded with regexp  As for which tool, I found RegexBuddy most comfortable, but as it's not free there are some other tools like Regulator, Kodos, Kiki... that are useful too
Title: Python Grabber scripts
Post by: Benji99 on 2010-04-04 22:15:52
I'm just working on the script, and it's almost finished, I need to test it a bit and compile it today or tomorrow, then I'll post it in another thread. It fetches everything possible, even song review if it exists and it's loaded with regexp  As for which tool, I found RegexBuddy most comfortable, but as it's not free there are some other tools like Regulator, Kodos, Kiki... that are useful too


Cool! Looking forward to test it!!
Once you release it, I'll probably try to adapt it for the classical albums too. (They're very different from the standard ones, but data they contain is really nice)
Title: Python Grabber scripts
Post by: Hitchhiker427 on 2010-08-06 00:55:44
Does anyone still have 2E7AH's scripts for LyricsTXT, LyricsTime, and Songmeanings?  The attachments seem to be broken.  Thanks.
Title: Python Grabber scripts
Post by: grimes on 2010-08-07 21:03:18
Found a Lyrics-site with API: ChartLyrics (http://www.chartlyrics.com/)

Here is ChartLyrics.py for foo_grabber_python + foo_lyricsgrabber:

Many false results... 
but better than no results.

EDIT: (Upload failed. You are not permitted to upload this type of file) Renamed to ChartLyrics.txt. Hope that works.
Title: Python Grabber scripts
Post by: Hitchhiker427 on 2010-08-09 20:14:29
Found a Lyrics-site with API: ChartLyrics (http://www.chartlyrics.com/)

Here is ChartLyrics.py for foo_grabber_python + foo_lyricsgrabber:

Many false results... 
but better than no results.

EDIT: (Upload failed. You are not permitted to upload this type of file) Renamed to ChartLyrics.txt. Hope that works.


This works, but like you said, there are many false results.  Maybe instead of using SearchLyricDirect, you can use SearchLyric to obtain the lyricId and lyricChecksum, and while parsing that file do a string compare between the artists/titles to ensure that you're pulling the lyrics to the right song before calling GetLyric. That should eliminate the false results, right?  Otherwise, nice find.  They have a decent selection.
Title: Python Grabber scripts
Post by: Beta4Me on 2010-10-06 13:06:54
For all that are interested...I am coding in PHP an AMG extractor. It currently is pretty basic but is a bit bloated in its coding. It is, though, able to successfully extract Genre, Styles, Moods & Themes and present them in a usable format without issue, if it is given the URL to search. I unfortunately do not have any experience in Python, but it is better than nothing
Title: Python Grabber scripts
Post by: tberman333 on 2010-10-23 23:05:31
For all that are interested...I am coding in PHP an AMG extractor. It currently is pretty basic but is a bit bloated in its coding. It is, though, able to successfully extract Genre, Styles, Moods & Themes and present them in a usable format without issue, if it is given the URL to search. I unfortunately do not have any experience in Python, but it is better than nothing


I would be very interested Beta... By the way, has anyone noticed that 2E7AH's AMG scripts have stopped working?
Title: Python Grabber scripts
Post by: lo-fi on 2010-10-24 00:41:16
yep. amg scripts not working here either
Title: Python Grabber scripts
Post by: Beta4Me on 2010-10-24 06:38:49
For all that are interested...I am coding in PHP an AMG extractor. It currently is pretty basic but is a bit bloated in its coding. It is, though, able to successfully extract Genre, Styles, Moods & Themes and present them in a usable format without issue, if it is given the URL to search. I unfortunately do not have any experience in Python, but it is better than nothing


I would be very interested Beta...

Sometime in December I'll probably get them done and put them to public testing, as I'm busy with exams (and then schoolies) until the end of November.
Title: Python Grabber scripts
Post by: Decalicatan_Decalicatan on 2010-10-24 09:41:43
yep. amg scripts not working here either



It seems that the URL for search in amg is different but I didn't manage to get it right
Title: Python Grabber scripts
Post by: Wooops on 2010-10-25 05:54:57
Since most of the script links seem to be broken - looks like I'm too late, wouldn't be a better idea to upload them to services like pastebin? I was looking for the AMG ones if someone can share them, but if they are not working then there's no point on it. Thanks.
Title: Python Grabber scripts
Post by: Beta4Me on 2010-10-26 02:47:51
How did the original python grabber scripts work? Did you have to input the AMG ID or did it scan files and search and find everything for you etc.? Also, what tags did it pull from allmusic?
Title: Python Grabber scripts
Post by: mrinferno on 2010-10-26 02:53:18
AMG redesigned their site and search methods mid-October.

that's why everything stopped working.

i haven't messed with the python scripts yet, but the mp3tag scripts were completely broken by the HTML redesign.

i rewrote the mp3tag tag scripts to match the new html, it probably wouldn't be that difficult to re-do the python scripts.
Title: Python Grabber scripts
Post by: Beta4Me on 2010-10-26 03:59:30
AMG redesigned their site and search methods mid-October.

that's why everything stopped working.

i haven't messed with the python scripts yet, but the mp3tag scripts were completely broken by the HTML redesign.

i rewrote the mp3tag tag scripts to match the new html, it probably wouldn't be that difficult to re-do the python scripts.

I understand that. My PHP one works perfectly with the new design.
What I'm trying to do, is understand how the original Python script worked: "Did you have to input the AMG ID or did it scan files and search and find everything for you etc.? Also, what tags did it pull from allmusic?"
Title: Python Grabber scripts
Post by: Decalicatan_Decalicatan on 2010-10-26 11:10:08
I have uploaded one of the 2E7AH amg scripts (from november 2009) in pastebin: http://pastebin.com/uzwvDgCq (http://pastebin.com/uzwvDgCq)

It grabbed (before amg search method redesign)  %genre% / %style% / %theme% / %mood% from amg from %album% tag

If someone can update the script with the new search method it would be great.

If 2E7AH is not ok with publication of its script on pastebin, please let me know, I will delete it (and also will delete this post with the link)

thanks in advance,
Decalicatan_Decalicatan
Title: Python Grabber scripts
Post by: Beta4Me on 2010-10-26 11:15:20
I have uploaded one of the 2E7AH amg scripts (from november 2009) in pastebin: http://pastebin.com/uzwvDgCq (http://pastebin.com/uzwvDgCq)

It grabbed (before amg search method redesign)  %genre% / %style% / %theme% / %mood% from amg from %album% tag

If someone can update the script with the new search method it would be great.

If 2E7AH is not ok with publication of its script on pastebin, please let me know, I will delete it (and also will delete this post with the link)

thanks in advance,
Decalicatan_Decalicatan

Thanks.
I don't know Python, but I'll try and dissect that script so I have an idea of what is going on.
Hopefully, I can get mine to work well. Currently it grabs almost every AMG tag based on the input of the AMG Album ID...
Title: Python Grabber scripts
Post by: tberman333 on 2010-10-26 21:16:15
AMG redesigned their site and search methods mid-October.

that's why everything stopped working.

i haven't messed with the python scripts yet, but the mp3tag scripts were completely broken by the HTML redesign.

i rewrote the mp3tag tag scripts to match the new html, it probably wouldn't be that difficult to re-do the python scripts.

I understand that. My PHP one works perfectly with the new design.
What I'm trying to do, is understand how the original Python script worked: "Did you have to input the AMG ID or did it scan files and search and find everything for you etc.? Also, what tags did it pull from allmusic?"


The Python script scanned the files and did a search for you.  I think it searched by album name first, and then artist (but I am not sure).  I think the only data it pulled from allmusic was the genre, styles, mood and theme.  They were all put into one tag and then a masstagger script could be run to separate them out into separate tags on each file.  I have the Python script and the masstagger script if you want them (I can email them to you).
Title: Python Grabber scripts
Post by: Beta4Me on 2010-10-26 23:25:42
AMG redesigned their site and search methods mid-October.

that's why everything stopped working.

i haven't messed with the python scripts yet, but the mp3tag scripts were completely broken by the HTML redesign.

i rewrote the mp3tag tag scripts to match the new html, it probably wouldn't be that difficult to re-do the python scripts.

I understand that. My PHP one works perfectly with the new design.
What I'm trying to do, is understand how the original Python script worked: "Did you have to input the AMG ID or did it scan files and search and find everything for you etc.? Also, what tags did it pull from allmusic?"


The Python script scanned the files and did a search for you.  I think it searched by album name first, and then artist (but I am not sure).  I think the only data it pulled from allmusic was the genre, styles, mood and theme.  They were all put into one tag and then a masstagger script could be run to separate them out into separate tags on each file.  I have the Python script and the masstagger script if you want them (I can email them to you).

Thanks - PM sent.
What I'm really trying to understand is the whole search bit. My script works if you know the Album ID, but I need to write it so that it can scan the file to get the Artist & Album (or they can be input) and use them to search, get the AMG ID and then go from there.
Title: Python Grabber scripts
Post by: tberman333 on 2010-10-27 01:37:49
Thanks - PM sent.
What I'm really trying to understand is the whole search bit. My script works if you know the Album ID, but I need to write it so that it can scan the file to get the Artist & Album (or they can be input) and use them to search, get the AMG ID and then go from there.


I don't really know Python too well, but if you look at the script I sent you, you should see where in there it pulls the album name and plugs it into a URL to search for the album.  Then, if an exact match is not found, it searches the page of results for a matching artist (from the %album artist% tag).

Hope that helps.
Title: Python Grabber scripts
Post by: Schuft on 2011-02-13 08:41:04
I have uploaded one of the 2E7AH amg scripts (from november 2009) in pastebin: http://pastebin.com/uzwvDgCq (http://pastebin.com/uzwvDgCq)
thanks in advance,
Decalicatan_Decalicatan
I've downloaded the script and saved it under amg.py. I always get this error:

Code: [Select]
foo_grabber_python: Traceback (most recent call last):
  File "C:\Program Files (x86)\foobar2000\user-components\foo_lyricsgrabber2\pygrabber\scripts\amg.py", line 3, in <module>
    import os, sys, subprocess, urllib, re, pickle, win32com.client
ImportError: No module named win32com.client
Is this script still compatible with  Lyrics Grabber 2 0.5.5.2 beta ?
Title: Python Grabber scripts
Post by: klonuo on 2011-02-13 15:53:10
Is this script still compatible with  Lyrics Grabber 2 0.5.5.2 beta ?

I don't know about that, but it seems you are missing PyWin32 Extensions (which doesn't come with offical Python distributions by default) and allmusic.com was redesigned is the meantime (judging from dates in this thread) so I would say you try something else
Title: Python Grabber scripts
Post by: Schuft on 2011-02-16 17:37:08
Ok - you're right - phyton installation was missing.

It's a shame that these scripts are no further developed...
Title: Python Grabber scripts
Post by: MDMA on 2012-02-08 15:21:24
Would it be possible to use this component to fetch and display list of all previous releases from an artist, possibly from discogs?
Title: Python Grabber scripts
Post by: Fractal_Mortality on 2013-02-03 19:30:39
Does anyone know where i could find updated scripts for allmusic? The ones i originally had from this thread no longer seem to work.m