AMG script, python script and frozen exe |
![]() ![]() |
AMG script, python script and frozen exe |
Apr 6 2010, 03:45
Post
#1
|
|
|
Group: Validating Posts: 2424 Joined: 21-May 08 Member No.: 53675 |
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 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): ![]() another example: "amg.exe _noc_nofoo_" won't write tags to files nor download covers but will make 2 csv files: "%album%.amg_release.csv" and "%album%.amg_tracks.csv" in tracks folder In any case for automatically processing "amg" playlist foo_comserver2 is needed, or path, artist and album arguments must be passed to script/program + optionally for composer/performer/song_review, "-track %tracknumber% %title%" needs to be provided, so using it without foobar or comserver2 will be hard then harder 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 |
|
|
|
Apr 6 2010, 06:01
Post
#2
|
|
|
Group: Members Posts: 22 Joined: 24-March 06 From: Mexico Member No.: 28812 |
-------------------- last.fm/user/boces
|
|
|
|
Apr 6 2010, 11:09
Post
#3
|
|
|
Group: Validating Posts: 2424 Joined: 21-May 08 Member No.: 53675 |
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 |
|
|
|
Apr 22 2010, 00:16
Post
#4
|
|
|
Group: Members Posts: 4 Joined: 22-October 08 Member No.: 60712 |
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."
|
|
|
|
Apr 22 2010, 04:35
Post
#5
|
|
|
Group: Validating Posts: 2424 Joined: 21-May 08 Member No.: 53675 |
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 |
|
|
|
Apr 22 2010, 08:23
Post
#6
|
|
|
Group: Members Posts: 4 Joined: 22-October 08 Member No.: 60712 |
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
|
|
|
|
Apr 22 2010, 09:00
Post
#7
|
|
|
Group: Validating Posts: 2424 Joined: 21-May 08 Member No.: 53675 |
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... This post has been edited by 2E7AH: Apr 22 2010, 09:12 |
|
|
|
Apr 22 2010, 09:42
Post
#8
|
|
|
Group: Members Posts: 4 Joined: 22-October 08 Member No.: 60712 |
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 |
|
|
|
Apr 22 2010, 09:56
Post
#9
|
|
|
Group: Validating Posts: 2424 Joined: 21-May 08 Member No.: 53675 |
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 This post has been edited by 2E7AH: Apr 22 2010, 09:58 |
|
|
|
Apr 24 2010, 01:02
Post
#10
|
|
|
Group: Members Posts: 3 Joined: 23-April 10 Member No.: 80107 |
I can't get this script to work with columns_ui... is this possible?
|
|
|
|
Apr 24 2010, 03:48
Post
#11
|
|
|
Group: Members Posts: 3 Joined: 23-April 10 Member No.: 80107 |
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 %%AMG_Genre: %genre%;%%
|
|
|
|
Apr 24 2010, 03:59
Post
#12
|
|
|
Group: Validating Posts: 2424 Joined: 21-May 08 Member No.: 53675 |
do you use
CODE $meta_sep(amg,;) as source field?
This post has been edited by 2E7AH: Apr 24 2010, 03:59 |
|
|
|
May 12 2010, 07:21
Post
#13
|
|
|
Group: Members Posts: 2 Joined: 9-March 03 Member No.: 5390 |
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 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. |
|
|
|
May 12 2010, 15:26
Post
#14
|
|
|
Group: Validating Posts: 2424 Joined: 21-May 08 Member No.: 53675 |
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 |
|
|
|
Jun 22 2010, 14:17
Post
#15
|
|
|
Group: Members Posts: 101 Joined: 23-March 07 Member No.: 41759 |
First: many thanks for this script!It helped me a lot!
Do you still plan to work on a new version? |
|
|
|
Jun 22 2010, 15:48
Post
#16
|
|
|
Group: Validating Posts: 2424 Joined: 21-May 08 Member No.: 53675 |
Good to hear
|
|
|
|
Jun 22 2010, 18:10
Post
#17
|
|
|
Group: Members Posts: 101 Joined: 23-March 07 Member No.: 41759 |
Okay. Great to hear it.
|
|
|
|
Jul 1 2010, 02:34
Post
#18
|
|
|
Group: Members Posts: 2 Joined: 1-July 10 Member No.: 81954 |
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?
|
|
|
|
Jul 1 2010, 09:25
Post
#19
|
|
|
Group: Validating Posts: 2424 Joined: 21-May 08 Member No.: 53675 |
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 This post has been edited by 2E7AH: Jul 1 2010, 09:30 |
|
|
|
Jul 8 2010, 13:43
Post
#20
|
|
|
Group: Members Posts: 2 Joined: 1-July 10 Member No.: 81954 |
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, 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! |
|
|
|
Aug 10 2010, 15:10
Post
#21
|
|
|
Group: Members Posts: 2 Joined: 10-August 10 Member No.: 82966 |
Seems that links in 1st post are broken, where else can I get this script?
This post has been edited by hitko: Aug 10 2010, 15:12 |
|
|
|
Aug 10 2010, 18:04
Post
#22
|
|
|
Group: Members Posts: 2 Joined: 10-August 10 Member No.: 82966 |
|
|
|
|
Aug 23 2010, 00:25
Post
#23
|
|
|
Group: Members Posts: 80 Joined: 4-October 04 Member No.: 17477 |
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, 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! |
|
|
|
Sep 18 2010, 11:11
Post
#24
|
|
|
Group: Members Posts: 5 Joined: 26-June 09 Member No.: 71006 |
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. |
|
|
|
Sep 20 2010, 00:12
Post
#25
|
|
|
Group: Members Posts: 1 Joined: 7-December 09 Member No.: 75674 |
please help avout script.i hope we can all use
|
|
|
|
![]() ![]() |
|
Lo-Fi Version | Time is now: 22nd May 2013 - 08:27 |