Discogs Tagger 5.84 (Updated: 2024-01-03)

Download and get help for different MediaMonkey for Windows 4 Addons.

Moderators: Peke, Gurus

Doxtur
Posts: 4
Joined: Sat Jun 04, 2011 9:40 am

Re: Discogs Tagger 4.47 (Updated: 2014-07-19)

Post by Doxtur »

crap_inhuman wrote:
Doxtur wrote:Didn't work with some UTF symbols in search string and if founded items = 0. Errror 8732.
Do you have an example for me please ?
For example track: José González - Heartbeats
In log:
16:54:58 Disc= / Track=4 / AlbumID=415 / Artist=Jose Gonzalez / Album=Veneer / Title=Heartbeats
16:54:58
16:54:58 Start FindResults
16:54:58 SearchTerm=Jose Gonzalez Veneer
16:54:58 SavedSearchArtist=Jose Gonzalez
16:54:58 SavedSearchAlbum=Veneer
16:54:58 searchURL=http://api.discogs.com/database/search? ... r_page=100
16:54:58 Start JSONParser_find_result
16:54:58 Arrayname=results

and appear error as wrote tillmanj
tillmanj

Re: Discogs Tagger 4.47 (Updated: 2014-07-19)

Post by tillmanj »

I am also getting the following error intermittently:

Error #451 - Microsoft VBScript runtime error
Object not a collection
File "C:Users\tillmanj\AppData\Roaming\MediaMonkey\Scripts\AutoTagWeb.vbs", Line:4212, Column:5

Relevant logs:

7:33:24 PM Start DiscogsTagger v4.46
7:33:24 PM
7:33:24 PM Options:
7:33:24 PM CheckAlbum=True
7:33:24 PM CheckArtist=True
7:33:24 PM CheckAlbumArtist=True
7:33:24 PM CheckAlbumArtistFirst=True
7:33:24 PM CheckLabel=True
7:33:24 PM CheckDate=True
7:33:24 PM CheckOrigDate=True
7:33:24 PM CheckGenre=False
7:33:24 PM CheckStyle=False
7:33:24 PM CheckCountry=True
7:33:24 PM CheckSmallCover=False
7:33:24 PM CheckCatalog=True
7:33:24 PM CheckRelease=True
7:33:24 PM CheckInvolved=True
7:33:24 PM CheckLyricist=True
7:33:24 PM CheckComposer=True
7:33:24 PM CheckConductor=True
7:33:24 PM CheckProducer=True
7:33:24 PM CheckDiscNum=True
7:33:24 PM CheckTrackNum=True
7:33:24 PM CheckFormat=True
7:33:24 PM CheckUseAnv=True
7:33:24 PM CheckYearOnlyDate=True
7:33:24 PM CheckForceNumeric=True
7:33:24 PM CheckSidesToDisc=False
7:33:24 PM CheckForceDisc=True
7:33:24 PM CheckNoDisc=False
7:33:24 PM CheckLeadingZero=True
7:33:24 PM ReleaseTag=Custom2
7:33:24 PM CatalogTag=Custom3
7:33:24 PM CountryTag=Custom4
7:33:24 PM FormatTag=Custom5
7:33:24 PM CheckVarious=True
7:33:24 PM TxtVarious=Various Artists
7:33:24 PM CheckTitleFeaturing=True
7:33:24 PM TxtFeaturingName=feat.
7:33:24 PM CheckFeaturingName=True
7:33:24 PM CheckComment=True
7:33:24 PM SubTrackNameSelection=False
7:33:24 PM CheckTurnOffSubTrack=False
7:33:24 PM CheckInvolvedPeopleSingleLine=False
7:33:24 PM ArtistSeparator=,
7:33:24 PM
7:33:24 PM SearchTerm=Darkthrone A Blaze in the Northern Sky
7:33:24 PM SearchArtist=Darkthrone
7:33:24 PM SearchAlbum=A Blaze in the Northern Sky
7:33:24 PM
7:33:24 PM Start Discogs Request
7:33:24 PM AccessToken found in ini = IXQMqBDkGFeBNbbfMNpqWaRFWEKihqNHgOqBDuHN
7:33:24 PM AccessTokenSecret found in ini = GYDdoBwHFqpTswJeyDipqRzeCQHZcychvspnASaV
7:33:24 PM Disc=01 / Track=01 / AlbumID=5104 / Artist=Darkthrone / Album=A Blaze in the Northern Sky / Title=Kathaarian Life Code
7:33:24 PM Disc=01 / Track=02 / AlbumID=5104 / Artist=Darkthrone / Album=A Blaze in the Northern Sky / Title=In the Shadow of the Horns
7:33:24 PM Disc=01 / Track=03 / AlbumID=5104 / Artist=Darkthrone / Album=A Blaze in the Northern Sky / Title=Paragon Belial
7:33:24 PM Disc=01 / Track=04 / AlbumID=5104 / Artist=Darkthrone / Album=A Blaze in the Northern Sky / Title=Where Cold Winds Blow
7:33:24 PM Disc=01 / Track=05 / AlbumID=5104 / Artist=Darkthrone / Album=A Blaze in the Northern Sky / Title=A Blaze in the Northern Sky
7:33:24 PM Disc=01 / Track=06 / AlbumID=5104 / Artist=Darkthrone / Album=A Blaze in the Northern Sky / Title=The Pagan Winter
7:33:24 PM
7:33:24 PM Start FindResults
7:33:24 PM SearchTerm=Darkthrone A Blaze in the Northern Sky
7:33:24 PM SavedSearchArtist=Darkthrone
7:33:24 PM SavedSearchAlbum=A Blaze in the Northern Sky
7:33:24 PM searchURL=http://api.discogs.com/database/search? ... r_page=100
7:33:24 PM Start JSONParser_find_result
7:33:24 PM Arrayname=results
7:33:25 PM SongCountMax=76
7:33:25 PM SongPages=2
crap_inhuman
Posts: 933
Joined: Sat Jan 26, 2013 6:00 am
Location: Friedberg / Hessen / Germany
Contact:

Re: Discogs Tagger 4.47 (Updated: 2014-07-19)

Post by crap_inhuman »

I just released version V4.48.

The bug described from skywalka and tillmanj are found and removed.

The bug with utf still remain. If someone know about php, $_POST and UTF please contact me. I don't know why this error occur.

Sven
Metal up your ass !
-----------------------------------------------
I added my first 2 videos on youtube. The language is german.

Discogs Autorisierung: https://www.youtube.com/watch?v=oryxKKtnEnc
Discogs Tagger Bedienung: https://www.youtube.com/watch?v=85Wk-5rd-W0
tillmanj

Re: Discogs Tagger 4.47 (Updated: 2014-07-19)

Post by tillmanj »

crap_inhuman wrote:I just released version V4.48.
The bug described from skywalka and tillmanj are found and removed.
Thanks! You rock hard my friend.
crap_inhuman wrote: The bug with utf still remain. If someone know about php, $_POST and UTF please contact me. I don't know why this error occur.
It's been a while since I messed with PHP but iirc, you need to migrate to UTF-8, as described roughly here: http://blog.loftdigital.com/blog/php-utf-8-cheatsheet
crap_inhuman
Posts: 933
Joined: Sat Jan 26, 2013 6:00 am
Location: Friedberg / Hessen / Germany
Contact:

Re: Discogs Tagger 4.47 (Updated: 2014-07-19)

Post by crap_inhuman »

tillmanj wrote:
crap_inhuman wrote: The bug with utf still remain. If someone know about php, $_POST and UTF please contact me. I don't know why this error occur.
It's been a while since I messed with PHP but iirc, you need to migrate to UTF-8, as described roughly here: http://blog.loftdigital.com/blog/php-utf-8-cheatsheet
Thank you for the hint. I send via $_POST the url string to the php script.

If i send :

Code: Select all

http://api.discogs.com/database/search?q=Die Ärzte+Debil
or

Code: Select all

http://api.discogs.com/database/search?q=Die+%C3%84rzte+Debil
the php script always get

Code: Select all

http://api.discogs.com/database/search?q=Die Ã?rzte Debil
I tried to encode it with utf8_encode, but it doesn't work....
Metal up your ass !
-----------------------------------------------
I added my first 2 videos on youtube. The language is german.

Discogs Autorisierung: https://www.youtube.com/watch?v=oryxKKtnEnc
Discogs Tagger Bedienung: https://www.youtube.com/watch?v=85Wk-5rd-W0
tillmanj

Re: Discogs Tagger 4.47 (Updated: 2014-07-19)

Post by tillmanj »

try using iconv() instead of utf8_encode(). utf8_encode ONLY translates from ISO-8859-1 to UTF8. iconv() (especially in conjunction with //IGNORE for automagic dropping of invalid chars should work better.

Otherwise, you might need to write your own parser into UTF8. Something like this:

<?php
function utf8_string_array_encode(&$array){
$func = function(&$value,&$key){
if(is_string($value)){
$value = utf8_encode($value);
}
if(is_string($key)){
$key = utf8_encode($key);
}
if(is_array($value)){
utf8_string_array_encode($value);
}
};
array_walk($array,$func);
return $array;
}
?>

...not that I can make ANY promises about the usefulness (or accuracy) of that function... it's something I found demonstrating the principle...

I personally would use iconv()
tillmanj

Re: Discogs Tagger 4.47 (Updated: 2014-07-19)

Post by tillmanj »

Or, if you have access to PHP functions, use htmlentities()
See here: http://php.net/manual/en/function.htmlentities.php
crap_inhuman
Posts: 933
Joined: Sat Jan 26, 2013 6:00 am
Location: Friedberg / Hessen / Germany
Contact:

Re: Discogs Tagger 4.47 (Updated: 2014-07-19)

Post by crap_inhuman »

Big thank you for your help !! I will try iconv later this day !

I'm happy that you understand my problem and try to help me.
Metal up your ass !
-----------------------------------------------
I added my first 2 videos on youtube. The language is german.

Discogs Autorisierung: https://www.youtube.com/watch?v=oryxKKtnEnc
Discogs Tagger Bedienung: https://www.youtube.com/watch?v=85Wk-5rd-W0
tillmanj

Re: Discogs Tagger 4.47 (Updated: 2014-07-19)

Post by tillmanj »

Instead of going straight to UTF-8, try just HTML encoding the string first:

Function HTMLEncode(ByVal sVal)

sReturn = ""

If ((TypeName(sVal)="String") And (Not IsNull(sVal)) And (sVal<>"")) Then

For i = 1 To Len(sVal)

ch = Mid(sVal, i, 1)

Set oRE = New RegExp : oRE.Pattern = "[ a-zA-Z0-9]"

If (Not oRE.Test(ch)) Then
ch = "&#" & Asc(ch) & ";"
End If

sReturn = sReturn & ch

Set oRE = Nothing
Next
End If

HTMLEncode = sReturn
End Function
crap_inhuman
Posts: 933
Joined: Sat Jan 26, 2013 6:00 am
Location: Friedberg / Hessen / Germany
Contact:

Re: Discogs Tagger 4.47 (Updated: 2014-07-19)

Post by crap_inhuman »

Okay, i don't understand the result i get with different values..

Here is what i do:

The vbs-script:

Code: Select all

Set oXMLHTTP = CreateObject("MSXML2.XMLHTTP.6.0")
AccessToken = "uCvADxrmtbcvoeAUEWKLPbDbqXSlNhyfSclWPwVj"
AccessTokenSecret = "LOjFsieamOzmjUphsOZLusQqeWayuOIByJawelCS"
searchURL = "http://api.discogs.com/database/search?q=Die+%C3%84rzte+Debil&type=release"
REM searchURL = "http://api.discogs.com/database/search?q=Die+Ärzte+Debil&type=release"
REM searchURL = HTMLEncode(searchURL)

oXMLHTTP.Open "POST", "http://www.germanc64.de/mm/oauth/check_test.php", False
oXMLHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
oXMLHTTP.setRequestHeader "User-Agent","MediaMonkeyDiscogsAutoTagWeb/2.0 +http://mediamonkey.com"
oXMLHTTP.send ("at=" & AccessToken & "&ats=" & AccessTokenSecret & "&searchURL=" & searchURL)

If oXMLHTTP.Status = 200 Then
	MsgBox oXMLHTTP.responseText
End If
Here is the php-script :

Code: Select all

<?php
	require('http.php');
	require('oauth_client.php');

	$client = new oauth_client_class;
	$client->debug = false;
	$client->debug_http = false;
	$client->server = 'Discogs';
	$client->redirect_uri = 'http://'.$_SERVER['HTTP_HOST'].
		dirname(strtok($_SERVER['REQUEST_URI'],'?')).'/check_test.php';

	$client->client_id = 'CLIENT-ID'; $application_line = __LINE__;
	$client->client_secret = 'ClIENT-ID-SECRET';
	
	$client->access_token = htmlspecialchars($_POST["at"]);
	$client->access_token_secret = htmlspecialchars($_POST["ats"]);
	$searchURL = $_POST["searchURL"];
        $searchURL = $searchURL . "&type=release";
	$datei = fopen("test.txt","w");
	fwrite($datei, $searchURL);
	fwrite($datei, Chr(13));
	$searchURL = iconv("UTF-8", "ISO-8859-1//IGNORE", $searchURL);
	fwrite($datei, $searchURL);
	fwrite($datei, Chr(13));
	
	// $searchtest = utf8_encode($searchURL);
	$searchtest = "http://api.discogs.com/database/search?q=Die+%C3%84rzte+Debil&type=release";
	fwrite($datei, $searchtest);
	fclose($datei);
	$success = $client->CallAPI(
	$searchtest,
	'GET', array(), array('FailOnAccessError'=>true), $user);

	$success = $client->Finalize($success);

	if($client->exit)
		exit;
	if($success)
	{
		echo json_encode($user);
	}
	else
	{
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>OAuth client error</title>
</head>
<body>
<h1>OAuth client error</h1>
<pre>Error: <?php echo $client->error . "\r\n"; 
echo $searchURL . "\r\n";
echo $searchtest . "\r\n";
?></pre>
</body>
</html>
<?php
	}

?>
The content of the test.txt is :

Code: Select all

http://api.discogs.com/database/search?q=Die Ärzte Debil&type=release
http://api.discogs.com/database/search?q=Die Ärzte Debil&type=release
http://api.discogs.com/database/search?q=Die+%C3%84rzte+Debil&type=release
The first line in test.txt is the $searchURL i send without convert. The second is after converting from UTF8 to ISO-8859-1
If i convert from ISO-8859-1 to UTF8 it looks like :

Code: Select all

http://api.discogs.com/database/search?q=Die Ärzte Debil&type=release
So i think the string is UTF8 !?! Whatever, the first and the second line will give an error from discogs. only sending the third line give a correct answer from discogs.

There are some things i don't understand. I send "&type=release" from the vb-script but this will never arrive at the php script. The + sign are getting lost, too.

I will never understand the utf, ascii ansi shit.. sorry

In Short : I have to convert the string inside the php script so it looks like "Die+%C3%84rzte".
tillmanj wrote:Instead of going straight to UTF-8, try just HTML encoding the string first:

Function HTMLEncode(ByVal sVal)

sReturn = ""

If ((TypeName(sVal)="String") And (Not IsNull(sVal)) And (sVal<>"")) Then

For i = 1 To Len(sVal)

ch = Mid(sVal, i, 1)

Set oRE = New RegExp : oRE.Pattern = "[ a-zA-Z0-9]"

If (Not oRE.Test(ch)) Then
ch = "&#" & Asc(ch) & ";"
End If

sReturn = sReturn & ch

Set oRE = Nothing
Next
End If

HTMLEncode = sReturn
End Function
I used this function, but the result was the same.


I hope you can help me, thank you in advance
Last edited by crap_inhuman on Fri Jul 25, 2014 1:02 pm, edited 1 time in total.
Metal up your ass !
-----------------------------------------------
I added my first 2 videos on youtube. The language is german.

Discogs Autorisierung: https://www.youtube.com/watch?v=oryxKKtnEnc
Discogs Tagger Bedienung: https://www.youtube.com/watch?v=85Wk-5rd-W0
tillmanj

Re: Discogs Tagger 4.47 (Updated: 2014-07-19)

Post by tillmanj »

What happens if you strip out all string processing from the VBScript:

Code: Select all

If SavedSearchArtist <> "" And SavedSearchAlbum <> "" Then
			searchURL = "http://api.discogs.com/database/search?q=" & SearchTerm & "&type=release&per_page=100"
		ElseIf SavedSearchArtist = "" And SavedSearchAlbum <> "" Then
			searchURL = "http://api.discogs.com/database/search?type=release&title=" & SavedSearchAlbum & "&per_page=100"
		ElseIf SavedSearchArtist <> "" And SavedSearchAlbum = "" Then
			searchURL = "http://api.discogs.com/database/search?type=release&artist=" & SavedSearchArtist & "&per_page=100"
		Else
			searchURL = "http://api.discogs.com/database/search?q=" & SearchTerm & "&type=release&per_page=100"
		End If
and only do minimal string escaping in the php:

Code: Select all

$searchtest = "http://api.discogs.com/database/search?q=".urlencode(Die+Ärzte+Debil)."&type=release" ";
Beyond that, I am running out of things to try without having a copy of the code to fool with locally. (which I am willing to do if you have it somewhere like GitHub or want to drop it in PasteBin
crap_inhuman
Posts: 933
Joined: Sat Jan 26, 2013 6:00 am
Location: Friedberg / Hessen / Germany
Contact:

Re: Discogs Tagger 4.47 (Updated: 2014-07-19)

Post by crap_inhuman »

I try it later this day and post the result. Additional i drop the scripts in pastebin.
Metal up your ass !
-----------------------------------------------
I added my first 2 videos on youtube. The language is german.

Discogs Autorisierung: https://www.youtube.com/watch?v=oryxKKtnEnc
Discogs Tagger Bedienung: https://www.youtube.com/watch?v=85Wk-5rd-W0
crap_inhuman
Posts: 933
Joined: Sat Jan 26, 2013 6:00 am
Location: Friedberg / Hessen / Germany
Contact:

Re: Discogs Tagger 4.47 (Updated: 2014-07-19)

Post by crap_inhuman »

tillmanj, you've got it !! :D

I stripped out all string processing from VBScript and do only minimal string escaping with urlencode. And it works !!
I drop it on pastebin the next days if you like to see the result. Perhaps you have a improvement suggestion.

A mega big thank you for helping me (and all users of DiscogsTagger) !!

And a big thank you to skywalka for posting bugs and feature requests ! And certainly all other who helping me !

I just released the Version 4.50.

Happy weekend !
Metal up your ass !
-----------------------------------------------
I added my first 2 videos on youtube. The language is german.

Discogs Autorisierung: https://www.youtube.com/watch?v=oryxKKtnEnc
Discogs Tagger Bedienung: https://www.youtube.com/watch?v=85Wk-5rd-W0
tillmanj

Re: Discogs Tagger 4.47 (Updated: 2014-07-19)

Post by tillmanj »

Glad that worked! Sometimes it's easier to do less (especially with PHP...) and let the language do its magic.

If you post a link to the Pastebin code when you put it up, I'll take a look. No promises though!
skywalka
Posts: 97
Joined: Fri Oct 18, 2013 4:13 am

Re: Discogs Tagger 4.47 (Updated: 2014-07-19)

Post by skywalka »

Thanx guys!

Another bug?:
Image
Image
Post Reply