HydrogenAudio

Hosted Forums => foobar2000 => Uploads - (fb2k) => Topic started by: 2E7AH on 2010-04-06 03:45:09

Title: AMG script
Post by: 2E7AH on 2010-04-06 03:45:09
below is little script/program that can automatically fetch data from AMG and write it in files tags (with foobar and foo_comserver2) or in tab delimetered csv files stored in passed files folder

2 usage scenarios:

1. foobar and foo_comserver2 installed:
 - make playlist, name it "amg" and add some tracks
 - double click script/program or run it with some arguments
 - it will try to fetch data from AMG, including album cover (200x200px amg_%album%.jpg) and Song reviews (not many releases include song reviews of course)

2. from command line:
Code: [Select]
AMG file_path artist album [-track tracknumber title]
additional arguments that can be add as last arguments (if any) are:
_noc_ (don't download cover)
_nosr_ (don't fetch Song Review)
_nofoo_ (don't use foobar as tagger, just write csv files)

It uses just one request per release (on last release basis) so all data is cached then reused if needed without requesting for every track
This fields can be fetched: Mood, Style, Artist_URL, Release_URL, Release_Date, Release_Rating, Theme, Label, Genre, Review, Composer, Performer, Song_Review and album cover

example: "python amg.pyc" (or double click on amg.exe) will process all files in playlist named "AMG" and add this tags:
 - composer/performer/song_review in corresponding tags
 - all other tags will be written to multivalue %amg% tag with each value following this rule - "%AMG_tag_name%: tag_value"

i.e. if I want to map Review, Rating, Genre and Style from %amg% tag, it can be done with properties dialog > automatically fill values (or more easily with masstagger):

[a href=\"http://img87.imageshack.us/img87/5356/sshot10.png\" target=\"_blank\"]

Compiled with Python 2.6 + Python Win32 Extensions (for com server)
[attachment=5840:amg_script.7z]
Frozen stand alone bundle (2.57 MB):
[attachment=5841:amg.7z]
known limitation (other than design) is no unicode support i.e. if filename is in unicode it will just be skipped

source script by sending email by PM
Title: AMG script
Post by: lo-fi on 2010-04-06 06:01:21
awesome!! thank you very much.

is it posible to use this to write to custom db (http://blog.99ravens.net/index.php?e=283) tags?
Title: AMG script
Post by: 2E7AH on 2010-04-06 11:09:27
Good point, I totally forgot about custum_db
I'll make it possible and try to solve problem with unicode filenames somewhere in near future
Title: AMG script
Post by: dscmn on 2010-04-22 00:16:04
It doesn't work for me.  I don't know why. I have followed all instructions, but I got an error that said "unknown commandline parameter: /tag:AMG=AMG_Mood...etc."
Title: AMG script
Post by: 2E7AH on 2010-04-22 04:35:16
Add _dbg_ as argument and see what command line produces
Any more info, like OS, is it portable foobar, which is your foobar install folder, etc?

I'm porting it to Python 3 right now (for unicode support) and some more changes like making it "modular" so that other scripts could work with it, custom_db support etc... but it will be at the end of the next week as I'm somewhat "busy" right now
Title: AMG script
Post by: dscmn on 2010-04-22 08:23:53
Quote
Add _dbg_ as argument and see what command line produces
Any more info, like OS, is it portable foobar, which is your foobar install folder, etc?

OS is WinXP SP2. It was portable version (c:\foobar2000\), but I tried standart installation (c:\program files\foobar2000\) and got same error. Pic releated
(http://img687.imageshack.us/img687/1654/22941018.th.png) (http://img687.imageshack.us/i/22941018.png/)
Title: AMG script
Post by: 2E7AH on 2010-04-22 09:00:06
It's not clear what could it be. I guess it's happening on any release?
You can try with this bundle (it's built with python 2.5 as I uninstalled 2.6, so you need to download whole package): [attachment=5860:amg_test.7z]
It will print exact command line which you can sent me by PM or paste it here and hopefully well see what's wrong

Also as not many people download it, maybe it's something XP related, as I don't have XP anywhere near. Command line length is large, but it shouldn't be more than 8192 characters (max limit), who know...
Title: AMG script
Post by: dscmn on 2010-04-22 09:42:45
You're right, it is command line length problem. It works fine with albums which has a bit information in AMG.
Any ideas to using it on XP? I totally do not want install Seven 
Title: AMG script
Post by: 2E7AH on 2010-04-22 09:56:47
Hm, it doesn't seem to me that "Blue Train" has more than 8000 chars, it should be around 2-3000 unless there is some nonsense in the parsed tags, can you comment?
I'll think about some workaround for future release

BTW 2048 char limitation is for NT4 and 2000
Title: AMG script
Post by: isosceles294 on 2010-04-24 01:02:06
I can't get this script to work with columns_ui... is this possible?
Title: AMG script
Post by: isosceles294 on 2010-04-24 03:48:40
I also can't figure out the masstagger script for taking values from %amg% with the ';'  separator...

this is what I'm using as a guessing pattern in masstagger:
Code: [Select]
%%AMG_Genre: %genre%;%%
Title: AMG script
Post by: 2E7AH on 2010-04-24 03:59:17
do you use
Code: [Select]
$meta_sep(amg,;)
as source field?
Title: AMG script
Post by: simpleton on 2010-05-12 07:21:40
Thanks 2E7AH for this, it is great. 

It's not clear what could it be. I guess it's happening on any release?

I think you may have to have the masstagger component (http://wiki.hydrogenaudio.org/index.php?title=Foobar2000:Masstaggers_User_Guide) installed for it to work.
Without masstagger I get "unknown commandline parameter: /tag:Composer=" errors, similar to what dscmn was getting.

Also 2E7AH, can you please post the uncompiled amg.pyc file as I would like to add the ability to pick up the AMG track picks and AMG album pick flags.

Cheers.
Title: AMG script
Post by: 2E7AH on 2010-05-12 15:26:07
Without masstagger I get "unknown commandline parameter: /tag:Composer=" errors, similar to what dscmn was getting.

that's right - without masstagger "/tag" switch doesn't work, I forgot about that so check will be written in next script

Quote
Also 2E7AH, can you please post the uncompiled amg.pyc file as I would like to add the ability to pick up the AMG track picks and AMG album pick flags.

done (just send mail by pm, you don't need to reply here)

btw, new different version soon
- unicode support
- ini file for managing tags (no more switches),
- modular scripts (amg and discogs as first examples - it's not some proper plugin/modular system as I'm not a programmer but works for now)
- custom db option
- etc minor things

some time is needed for porting to python 3000, which just demoralizes me - changes to script and changed python syntax at the same time is wrong combination
Title: AMG script
Post by: eradumvelhinho on 2010-06-22 14:17:33
First: many thanks for this script!It helped me a lot!

Do you still plan to work on a new version?
Title: AMG script
Post by: 2E7AH on 2010-06-22 15:48:08
Good to hear  and yes, there will be new version, mainly because I want to provide working script with unicode filename support and INI settings for custom tags. I know I said it should be out till now, but I just made mess of it splitting it in different scripts when now I plan to use classes in just one script + ini file. I'm enthusiastic about Python (looking/working with other things) and just postpone anything related to Python 3. I'll have plenty free time these days and I'll make it
Title: AMG script
Post by: eradumvelhinho on 2010-06-22 18:10:36
Okay. Great to hear it.
Title: AMG script
Post by: anselm13 on 2010-07-01 02:34:16
I'm pretty new to foobar.  I thought I'd ask about getting a little more instruction on getting this to work through foobar with comserver and masstagger?
Title: AMG script
Post by: 2E7AH on 2010-07-01 09:25:29
OP should be readable I think, in case you are having trouble with masstagger, here is quick info:

example picture in OP is for properties dialog - "automatically fill values" command, which is the same as masstagger "guess value" command

source is "$meta_sep(amg,;)" which introduces semicolon between values in multivalue %amg% tag

pattern depends on what info you want to place in custom tags: empty double percent (%%) replaces any characters before matched string after it, so if you like to extract only Genre and Style, you should use %%AMG_Style: %style%;%%AMG_Genre: %genre%;

obviously the order or values in %amg% tag is important, and as pointed in OP it's in this order: AMG_Mood; AMG_Style; AMG_Artist_URL; AMG_Release_URL; AMG_Release_Date; AMG_Rating; AMG_Theme; AMG_Label; AMG_Genre; AMG_Review

so "AMG_Style: %style%;" is before "AMG_Genre: %genre%;", and double percent replaces any characters that could be between them, if any

hopefully I'll write new script soon
Title: AMG script
Post by: anselm13 on 2010-07-08 13:43:22
OP should be readable I think, in case you are having trouble with masstagger, here is quick info:

example picture in OP is for properties dialog - "automatically fill values" command, which is the same as masstagger "guess value" command

source is "$meta_sep(amg," which introduces semicolon between values in multivalue %amg% tag

pattern depends on what info you want to place in custom tags: empty double percent (%%) replaces any characters before matched string after it, so if you like to extract only Genre and Style, you should use %%AMG_Style: %style%;%%AMG_Genre: %genre%;

obviously the order or values in %amg% tag is important, and as pointed in OP it's in this order: AMG_Mood; AMG_Style; AMG_Artist_URL; AMG_Release_URL; AMG_Release_Date; AMG_Rating; AMG_Theme; AMG_Label; AMG_Genre; AMG_Review

so "AMG_Style: %style%;" is before "AMG_Genre: %genre%;", and double percent replaces any characters that could be between them, if any

hopefully I'll write new script soon


Thanks, I got it working with that.  The script is great!
Title: AMG script
Post by: hitko on 2010-08-10 15:10:25
Seems that links in 1st post are broken, where else can I get this script?
Title: AMG script
Post by: hitko on 2010-08-10 18:04:04
Seems that links in 1st post are broken, where else can I get this script?

Actualy all links to this file are broken. Can I get the one that's working?
Or maybe someone could send me this script in PM?
Title: AMG script
Post by: Benji99 on 2010-08-23 00:25:44
OP should be readable I think, in case you are having trouble with masstagger, here is quick info:

example picture in OP is for properties dialog - "automatically fill values" command, which is the same as masstagger "guess value" command

source is "$meta_sep(amg," which introduces semicolon between values in multivalue %amg% tag

pattern depends on what info you want to place in custom tags: empty double percent (%%) replaces any characters before matched string after it, so if you like to extract only Genre and Style, you should use %%AMG_Style: %style%;%%AMG_Genre: %genre%;

obviously the order or values in %amg% tag is important, and as pointed in OP it's in this order: AMG_Mood; AMG_Style; AMG_Artist_URL; AMG_Release_URL; AMG_Release_Date; AMG_Rating; AMG_Theme; AMG_Label; AMG_Genre; AMG_Review

so "AMG_Style: %style%;" is before "AMG_Genre: %genre%;", and double percent replaces any characters that could be between them, if any

hopefully I'll write new script soon



Hey 2E7AH, any chance that you're still working on this?
I'd love to see that update!
Title: AMG script
Post by: SilverSB on 2010-09-18 11:11:36
Is there any place where the amg script can be downloaded? Or can somebody send it to me via e-mail?
It's a great piece of code, doing exactly what I need to keep the genres and the styles well organized. Not to mention the composers for individual tracks are not available elsewhere.

Many thanks in advance.
Title: AMG script
Post by: 1sarap1sigara on 2010-09-20 00:12:48
please help avout script.i hope we can all use
Title: AMG script
Post by: Beta4Me on 2010-10-06 09:21:08
Is this script still available? It says the attachments are deleted and the OP has their PM disabled :S
Title: AMG script
Post by: dingdong on 2010-10-10 01:25:39
copy here: http://pastebin.com/bV3GzkiJ (http://pastebin.com/bV3GzkiJ)
Title: AMG script
Post by: tberman333 on 2010-11-24 02:55:20
copy here: http://pastebin.com/bV3GzkiJ (http://pastebin.com/bV3GzkiJ)


Does anyone know if this is working?  I can't seem to get it to work (no errors, there is just nothing happening).
Title: AMG script
Post by: Decalicatan_Decalicatan on 2010-11-24 08:54:31
copy here: http://pastebin.com/bV3GzkiJ (http://pastebin.com/bV3GzkiJ)


Does anyone know if this is working?  I can't seem to get it to work (no errors, there is just nothing happening).


It's not working anymore, because amg has changed its code since last october. Maybe just the go() function has to be updated (lines 48 & 49)
Title: AMG script
Post by: TiPunK on 2010-12-03 13:50:22
It's not working anymore, because amg has changed its code since last october. Maybe just the go() function has to be updated (lines 48 & 49)


I tried to understand how did it works, but I don't know how it reffers to informations. I have a lot of difficulties with this script. Does someone would be granted to update this ? Decalicatan, would you have an idea ?
Title: AMG script
Post by: sigrun on 2011-10-17 15:59:43
Is there someone who could update this to work?!

It would an absolute god send to have this functionality.

Or is there any new applications/scripts which can do this?