Jump to content
vdesabou

Optional UID does not seem to be applied for last result

Recommended Posts

Hi Andrew,

 

I noticed this strange behavior: If I use empty UID, it displays results in same order as results in XML (expected), except for the last result..

 

See example below, I have the following xml (complete output here https://i.cloudup.com/sBu1xdxFRP.xml):

<items>
<item uid="" valid="yes" autocomplete="">
<arg>
a:18:{i:0;s:0:"";i:1;s:0:"";i:2;s:0:"";i:3;s:0:"";i:4;s:0:"";i:5;s:0:"";i:6;s:0:"";i:7;s:20:"update_playlist_list";i:8;s:0:"";i:9;s:0:"";i:10;s:0:"";i:11;s:0:"";i:12;s:0:"";i:13;s:0:"";i:14;s:0:"";i:15;s:0:"";i:16;s:0:"";i:17;s:0:"";}
</arg>
<title>
Update Playlist List (use it when you have added or removed a playlist)
</title>
<subtitle>
when done you'll receive a notification. you can check progress by invoking the workflow again
</subtitle>
<icon>./images/new/update.png</icon>
<text/>
</item>
<item uid="" valid="no" autocomplete="Playlist▹spotify:user:vdesabou:starred▹">
<arg/>
<title> Sélection (569 tracks)</title>
<subtitle>by Vincent de Saboulin (vdesabou)</subtitle>
<icon>
/Users/vdesabou/Library/Application Support/Alfred 2/Workflow Data/com.vdesabou.spotify.mini.player/artwork/90badeb4076d291bd08c6c20ffe79625/vdesabou_starred.png
</icon>
<text/>
</item>
<item uid="" valid="no" autocomplete="Playlist▹spotify:user:trickyofficial:playlist:1u5vQfIxo8X1zoOInXxSGn▹">
<arg/>
<title> Tricky’s Choice (95 tracks)</title>
<subtitle>by trickyofficial (trickyofficial)</subtitle>
<icon>
/Users/vdesabou/Library/Application Support/Alfred 2/Workflow Data/com.vdesabou.spotify.mini.player/artwork/defe5e40d4c85e72406c0e6ac416942b/trickyofficial_1u5vQfIxo8X1zoOInXxSGn.png
</icon>
<text/>
</item>

<snip>


<item uid="" valid="no" autocomplete="Playlist▹spotify:user:chibulls23:playlist:3e1ufHxVFft35akWPnXgEq▹">
<arg/>
<title>
 Music from and inspired by the film DRIVE (115 tracks)
</title>
<subtitle>by chibulls23 (chibulls23)</subtitle>
<icon>
/Users/vdesabou/Library/Application Support/Alfred 2/Workflow Data/com.vdesabou.spotify.mini.player/artwork/65d1017e31390a2b57c23c9ca03b010f/chibulls23_3e1ufHxVFft35akWPnXgEq.png
</icon>
<text/>
</item>
</items>

As you can see the playlist " Music from and inspired by the film DRIVE (115 tracks)" is at the end and has UID empty, but I get the following:

 

 

Ai5glDb-HY.png

 

This was not the case before and I had to apply a workaround on May 29th (see https://github.com/vdesabou/alfred-spotify-mini-player/commit/0393575ad65f923951a7a8a9d4c42c22de518ae0 ) so that must appeared in one of the last versions of Alfred?

 

Is this a bug ?

 

Alfred 2.3 (264). Reproducible: yes

Edited by vdesabou

Share this post


Link to post
Share on other sites

Why is there a <snip> tag in the middle of your XML?

 

It just means I've truncated the results here for displaying just a subset of the XML results. The XML is valid, you can find it in the link of my post

Share this post


Link to post
Share on other sites

If that helps, if I clear knowledge, after that the very first time I get it working, but once I select a result, then the other times I get same behavior as explained in my first post, see screencast http://quick.as/b7Vocr62

 

You are in fact setting a UID of '' in your XML... For Alfred to generate a random UID, you need to miss the UID field altogether...

<item valid="no" autocomplete="Playlist▹spotify:user:trickyofficial:playlist:1u5vQfIxo8X1zoOInXxSGn▹">

This should fix the sorting issue you're seeing. The code / behaviour around this hasn't changed for quite some time, so it may have just been lucky that having all UIDs set to the same empty string would have sorted them arbitrarily correctly for you.

 

Moving to [closed], but do let me know if this fixes your issue or not.

 

Cheers,

Andrew

Share this post


Link to post
Share on other sites

You are in fact setting a UID of '' in your XML... For Alfred to generate a random UID, you need to miss the UID field altogether...

<item valid="no" autocomplete="Playlist▹spotify:user:trickyofficial:playlist:1u5vQfIxo8X1zoOInXxSGn▹">

This should fix the sorting issue you're seeing. The code / behaviour around this hasn't changed for quite some time, so it may have just been lucky that having all UIDs set to the same empty string would have sorted them arbitrarily correctly for you.

 

Moving to [closed], but do let me know if this fixes your issue or not.

 

Cheers,

Andrew

 

Thanks Andrew, I figured out I was using an old version of David's Workflows.php that's why UID was set to ''

My bad

 

Thanks for your support

Edited by vdesabou

Share this post


Link to post
Share on other sites

Thanks Andrew, I figured out I was using an old version of David's Workflows.php that's why UID was set to ''

My bad

 

Thanks for your support

 

Great, glad you are sorted :)

Share this post


Link to post
Share on other sites

×